From 283689ea6c97cf862dce554bd025564a1ed4a70e Mon Sep 17 00:00:00 2001 From: saxon Date: Wed, 12 Dec 2018 17:13:43 +1030 Subject: [PATCH] psi: added a std template PSI struct for pmt with time and gps descriptors to make things easier --- stream/mts/psi/std.go | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/stream/mts/psi/std.go b/stream/mts/psi/std.go index f3448a6a..228f4493 100644 --- a/stream/mts/psi/std.go +++ b/stream/mts/psi/std.go @@ -26,8 +26,9 @@ LICENSE package psi -// Std PSI in struct form without descriptor +// Some common manifestations of PSI var ( + // PSI struct to represent basic pat stdPat = PSI{ Pf: 0x00, Tid: 0x00, @@ -47,6 +48,7 @@ var ( }, } + // PSI struct to represent basic pmt without descriptors for time and gps stdPmt = PSI{ Pf: 0x00, Tid: 0x02, @@ -69,6 +71,42 @@ var ( }, }, } + + // Std pmt with time and gps descriptors, time and gps fields are zerod out + stdPmtTimeGps = PSI{ + Pf: 0x00, + Tid: 0x02, + Ssi: true, + Sl: uint16(0x12), + Tss: &TSS{ + Tide: uint16(0x01), + V: 0, + Cni: true, + Sn: 0, + Lsn: 0, + Sd: &PMT{ + Pcrpid: 0x0100, // wrong + Pil: 10, + Pd: []Desc{ + Desc{ + Dt: byte(timeDescTag), + Dl: byte(timeDataSize), + Dd: make([]byte, timeDataSize), + }, + Desc{ + Dt: byte(gpsDescTag), + Dl: byte(gpsDataSize), + Dd: make([]byte, gpsDataSize), + }, + }, + Essd: &ESSD{ + St: 0x1b, + Epid: 0x0100, + Esil: 0x00, + }, + }, + }, + } ) // Std PSI in bytes form