Ticket #4918: libs_libmythtv_mpeg_tspacket.h-move-AFCOffset-to-TSPacket.patch

File libs_libmythtv_mpeg_tspacket.h-move-AFCOffset-to-TSPacket.patch, 1.3 KB (added by Erik Hovland <erik@…>, 12 years ago)

Moves AFCOffset to TSPacket so that we don't have funny indexing of _tsdata

  • libs/libmythtv/mpeg/tspacket.h

    Since AFCOffset uses a strange off index value it should be moved to TSPacket
    
    From: Erik Hovland <erik@hovland.org>
    
    instead of TSHeader
    ---
    
     libs/libmythtv/mpeg/tspacket.h |    8 ++++----
     1 files changed, 4 insertions(+), 4 deletions(-)
    
    diff --git a/libs/libmythtv/mpeg/tspacket.h b/libs/libmythtv/mpeg/tspacket.h
    index 4d10c02..3e87609 100644
    a b class TSHeader { 
    7474    bool HasAdaptationField() const { return bool(_tsdata[3] & 0x20); }
    7575    bool HasPayload() const { return bool(_tsdata[3] & 0x10); }
    7676
    77     unsigned int AFCOffset() const { // only works if AFC fits in TSPacket
    78         return HasAdaptationField() ? _tsdata[4]+1+4 : 4;
    79     }
    80 
    8177    void SetTransportError(bool err) {
    8278        if (err) _tsdata[1] |= 0x80; else _tsdata[1] &= (0xff-(0x80));
    8379    }
    class TSPacket : public TSHeader 
    141137            memcpy(_tspayload, payload, PAYLOAD_SIZE);
    142138    }
    143139
     140    unsigned int AFCOffset() const { // only works if AFC fits in TSPacket
     141        return HasAdaptationField() ? _tspayload[0]+1+4 : 4;
     142    }
     143
    144144    //4.0  8 bits, iff payloadStart(), points to start of field
    145145    unsigned int StartOfFieldPointer() const { return data()[AFCOffset()]; }
    146146    void SetStartOfFieldPointer(uint sof) { data()[AFCOffset()] = sof; }