diff --git a/packets/Pes.go b/packets/Pes.go index c7147884..894072ce 100644 --- a/packets/Pes.go +++ b/packets/Pes.go @@ -25,26 +25,60 @@ LICENSE */ package packets - +/* +============================================================================ +| octet no | bit 0 | bit 1 | bit 2 | bit 3 | bit 4 | bit 5 | bit 6 | bit 7 | +============================================================================ +| octet 0 | 0x00 | +---------------------------------------------------------------------------- +| octet 1 | 0x00 | +---------------------------------------------------------------------------- +| octet 2 | 0x01 | +---------------------------------------------------------------------------- +| octet 3 | Stream ID (0xE0 for video) | +---------------------------------------------------------------------------- +| octet 4 | PES Packet Length (no bytes in packet after this field) | +---------------------------------------------------------------------------- +| octet 5 | PES Length cont. | +---------------------------------------------------------------------------- +| octet 6 | 0x2 | SC | Prior | DAI | Copyr | Copy | +---------------------------------------------------------------------------- +| octet 7 | PDI | ESCRF | ESRF | DSMTMF| ACIF | CRCF | EF | +---------------------------------------------------------------------------- +| octet 8 | PES Header Length | +---------------------------------------------------------------------------- +| optional | optional fields (determined by flags above) (variable Length) | +---------------------------------------------------------------------------- +| - | ... | +---------------------------------------------------------------------------- +| optional | stuffing bytes (varible length) | +---------------------------------------------------------------------------- +| - | ... | +---------------------------------------------------------------------------- +| Optional | Data (variable length) | +---------------------------------------------------------------------------- +| - | ... | +---------------------------------------------------------------------------- +*/ type PESPacket struct { StreamID byte Length uint16 - ScramblingControl byte - Priority bool - DAI bool // data alginment indicator - Copyright bool - Original bool + SC byte // Scrambling control + Priority bool // Priority Indicator + DAI bool // Data alginment indicator + Copyright bool // Copyright indicator + Original bool // Original data indicator PDI byte // PTS DTS indicator - ESCR bool - ESRate bool - DSMTrickMode bool - ACI bool // additional copy info flag - CRC bool - Ext bool - HeaderLength byte - OptFields []byte - Stuffing []byte - Data []byte + ESCRF bool // Elementary stream clock reference flag + ESRF bool // Elementary stream rate reference flag + DSMTMF bool // Dsm trick mode flag + ACI bool // Additional copy info flag + CRC bool // + EF bool // Extension flag + HeaderLength byte // Pes header length + OptFields []byte // Optional fields + Stuffing []byte // Stuffing bytes + Data []byte // Pes packet data } func (p *PESPacket) ToByteSlice() (output []byte) {