From 9a73d00fff022811a113f64aef59984672f469c2 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Sat, 18 Aug 2018 23:28:26 +0930 Subject: [PATCH] generator: disect and annotate pat and pmt tables --- generator/mpegts_generator.go | 46 +++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/generator/mpegts_generator.go b/generator/mpegts_generator.go index b6646668..42dceaa1 100644 --- a/generator/mpegts_generator.go +++ b/generator/mpegts_generator.go @@ -39,8 +39,50 @@ const psiPacketSize = 184 // TODO: really need to finish the at and pmt stuff - this is too hacky var ( - patTable = []byte{0, 0, 176, 13, 0, 1, 193, 0, 0, 0, 1, 240, 0, 42, 177, 4, 178} - pmtTable = []byte{0, 2, 176, 18, 0, 1, 193, 0, 0, 0xE1, 0x00, 0xF0, 0, 0x1B, 0xE1, 0, 0xF0, 0, 0x15, 0xBD, 0x4D, 0x56} + patTable = []byte{ + 0x00, // pointer + + // table header + 0x00, // table id + 0xb0, // section syntax indicator:1|private bit:1|reserved:2|section length:2|more bytes...:2 + 0x0d, // more bytes... + + // syntax section + 0x00, 0x01, // table id extension + 0xc1, // reserved bits:3|version:5|use now:1 + 0x00, // section number + 0x00, // last section number + // table data + 0x00, 0x01, // Program number + 0xf0, 0x00, // reserved:3|program map PID:13 + + 0x2a, 0xb1, 0x04, 0xb2, // CRC + } + pmtTable = []byte{ + 0x00, // pointer + + // table header + 0x02, // table id. + 0xb0, // section syntax indicator:1|private bit:1|reserved:2|section length:2|more bytes...:2 + 0x12, // more bytes... + + // syntax section + 0x00, 0x01, // table id extension + 0xc1, // reserved bits:3|version:5|use now:1 + 0x00, // section number + 0x00, // last section number + // table data + 0xe1, 0x00, // reserved:3|PCR PID:13 + 0xf0, 0x00, // reserved:4|unused:2|program info length:10 + // No program descriptors since program info length is 0. + // elementary stream info data + 0x1b, // stream type + 0xe1, 0x00, // reserved:3|elementary PID:13 + 0xf0, 0x00, // reserved:4|unused:2|ES info length:10 + // No elementary stream descriptos since ES info length is 0. + + 0x15, 0xbd, 0x4d, 0x56, // CRC + } ) func init() {