diff --git a/stream/mts/psi/pat.go b/stream/mts/psi/pat.go deleted file mode 100644 index d090a0d7..00000000 --- a/stream/mts/psi/pat.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -NAME - revid - a testbed for re-muxing and re-directing video streams as MPEG-TS over various protocols. - -DESCRIPTION - See Readme.md - -AUTHOR - Alan Noble - -LICENSE - revid is Copyright (C) 2017 Alan Noble. - - It is free software: you can redistribute it and/or modify them - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - It is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). -*/ - -package psi - -type PAT struct { - PF byte // Point field - PFB []byte // pointer filler bytes - TableID byte // Table ID - SSI bool // Sectiopn syntax indicator (1 for PAT, PMT, CAT) - PB bool // Private bit (0 for PAT, PMT, CAT) - SL uint16 // Section length - TIE uint16 // Table ID extension - Version byte // Version number - CNI bool // Current/next indicator - Section byte // Section number - LSN byte // Last section number - DT byte // Descriptor tag - DL byte // Descriptor length - Program uint16 // Program number - PMPID uint16 // Program map PID - CRC32 uint32 // Checksum of table -} - -func (p *PAT) ToByteSlice() (output []byte) { - return -} diff --git a/stream/mts/psi/pmt.go b/stream/mts/psi/pmt.go deleted file mode 100644 index 9def4e60..00000000 --- a/stream/mts/psi/pmt.go +++ /dev/null @@ -1,61 +0,0 @@ -/* -NAME - revid - a testbed for re-muxing and re-directing video streams as MPEG-TS over various protocols. - -DESCRIPTION - See Readme.md - -AUTHOR - Alan Noble - -LICENSE - revid is Copyright (C) 2017 Alan Noble. - - It is free software: you can redistribute it and/or modify them - under the terms of the GNU General Public License as published by the - Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - It is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with revid in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). -*/ - -package psi - -// Bitmasks -const ( - // bitmasks used for second byte - SYNTAX_INDICATOR = 0x80 - PRIVATE_BIT = 0x40 - RESERVED_BITS = 0x30 - SECTION_LENGTH_1 = 0x03 // first two bits of the section length - - // bitmasks used for third byte - SECTION_LENGTH_2 = 0xff -) - -type PMT struct { - PF byte // Point field - PFB []byte // pointer filler bytes - TableID byte // Table ID - SSI bool // Sectiopn syntax indicator (1 for PAT, PMT, CAT) - PB bool // Private bit (0 for PAT, PMT, CAT) - SL uint16 // Section length - TIE uint16 // Table ID extension - Version byte // Version number - CNI bool // Current/next indicator - Section byte // Section number - LSN byte // Last section number -} - -func ReadPMT(pmtData []byte) (PMT, error) { - return PMT{}, nil -} -func (p *PMT) ToByteSlice() (output []byte) { - return -} diff --git a/stream/mts/psi/psi.go b/stream/mts/psi/psi.go index 13816f15..31393c00 100644 --- a/stream/mts/psi/psi.go +++ b/stream/mts/psi/psi.go @@ -2,35 +2,62 @@ package psi // Program specific information type PSI struct { - PF byte // Point field - PFB []byte // pointer filler bytes - TableID byte // Table ID - SSI bool // Sectiopn syntax indicator (1 for PAT, PMT, CAT) - PB bool // Private bit (0 for PAT, PMT, CAT) - SL uint16 // Section length - tss *TSS // Table syntax section (length defined by SL) if length 0 then nil + pf byte // Point field + pfb []byte // pointer filler bytes + tid byte // Table ID + ssi bool // Sectiopn syntax indicator (1 for PAT, PMT, CAT) + pb bool // Private bit (0 for PAT, PMT, CAT) + sl uint16 // Section length + tss *TSS // Table syntax section (length defined by SL) if length 0 then nil } // Table syntax section type TSS struct { - TIE uint16 // Table ID extension - Version byte // Version number - CNI bool // Current/next indicator - Section byte // Section number - LSN byte // Last section number - table SD // specific data PAT/PMT + tie uint16 // Table ID extension + v byte // Version number + cni bool // Current/next indicator + sn byte // Section number + lsn byte // Last section number + sd SD // specific data PAT/PMT + crc []byte // crc32 of entire table excluding pointer field, pointer filler bytes and the trailing CRC32 } -// Specific Data, which could be PAT or PMT +// Specific Data, (could be PAT or PMT) type SD interface { - Read(psiData []byte) (PSI, error) - ToByte() []byte + Bytes() []byte } -func (p *PSI) Read(psiData []byte) (PSI, error) { - return PSI{}, nil +// Program association table, implements SD +type PAT struct { + pn uint16 // Program Number + pmpid uint16 // program map PID } -func (p *PSI) ToByte() []byte { +type Descriptor struct { + dt byte // Descriptor tag + dl byte // Descriptor length + dd []byte // Descriptor data +} + +// Program mapping table, implements SD +type PMT struct { + pcrpid uint16 // program clock reference pid + PIL uint16 // program info length + PD []Descriptor // program descriptors +} + +func ReadPSI(data []byte) *PAT { + return nil +} + +func (p *PSI) Bytes() (output []byte) { + return nil +} + +func (p *PAT) Bytes() (output []byte) { + return nil +} + +func (p *PMT) Bytes() (output []byte) { return nil }