2018-12-12 02:48:05 +03:00
|
|
|
/*
|
|
|
|
NAME
|
|
|
|
std.go
|
|
|
|
DESCRIPTION
|
|
|
|
See Readme.md
|
|
|
|
|
|
|
|
AUTHOR
|
|
|
|
Saxon Milton <saxon@ausocean.org>
|
|
|
|
|
|
|
|
LICENSE
|
|
|
|
std.go is Copyright (C) 2018 the Australian Ocean Lab (AusOcean)
|
|
|
|
|
|
|
|
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 http://www.gnu.org/licenses.
|
|
|
|
*/
|
|
|
|
|
2018-12-11 09:46:26 +03:00
|
|
|
package psi
|
|
|
|
|
2018-12-12 09:47:06 +03:00
|
|
|
const (
|
2018-12-14 08:32:47 +03:00
|
|
|
pmtTimeLocationPil = 44
|
2018-12-12 09:47:06 +03:00
|
|
|
)
|
|
|
|
|
2018-12-12 09:43:43 +03:00
|
|
|
// Some common manifestations of PSI
|
2018-12-11 09:46:26 +03:00
|
|
|
var (
|
2018-12-12 09:43:43 +03:00
|
|
|
// PSI struct to represent basic pat
|
2019-01-07 09:32:57 +03:00
|
|
|
StandardPat = PSI{
|
2018-12-12 08:56:59 +03:00
|
|
|
Pf: 0x00,
|
|
|
|
Tid: 0x00,
|
|
|
|
Ssi: true,
|
|
|
|
Pb: false,
|
2019-01-07 09:30:48 +03:00
|
|
|
Sl: 0x0d,
|
2018-12-12 08:56:59 +03:00
|
|
|
Tss: &TSS{
|
2019-01-07 09:30:48 +03:00
|
|
|
Tide: 0x01,
|
2018-12-12 08:56:59 +03:00
|
|
|
V: 0,
|
|
|
|
Cni: true,
|
|
|
|
Sn: 0,
|
|
|
|
Lsn: 0,
|
|
|
|
Sd: &PAT{
|
2019-01-07 09:30:48 +03:00
|
|
|
Pn: 0x01,
|
|
|
|
Pmpid: 0x1000,
|
2018-12-12 08:56:59 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-12-14 08:32:47 +03:00
|
|
|
// PSI struct to represent basic pmt without descriptors for time and location
|
2019-01-07 09:32:57 +03:00
|
|
|
StandardPmt = PSI{
|
2018-12-12 08:56:59 +03:00
|
|
|
Pf: 0x00,
|
|
|
|
Tid: 0x02,
|
|
|
|
Ssi: true,
|
2019-01-07 09:30:48 +03:00
|
|
|
Sl: 0x12,
|
2018-12-12 08:56:59 +03:00
|
|
|
Tss: &TSS{
|
2019-01-07 09:30:48 +03:00
|
|
|
Tide: 0x01,
|
2018-12-12 08:56:59 +03:00
|
|
|
V: 0,
|
|
|
|
Cni: true,
|
|
|
|
Sn: 0,
|
|
|
|
Lsn: 0,
|
|
|
|
Sd: &PMT{
|
|
|
|
Pcrpid: 0x0100, // wrong
|
|
|
|
Pil: 0,
|
|
|
|
Essd: &ESSD{
|
|
|
|
St: 0x1b,
|
|
|
|
Epid: 0x0100,
|
|
|
|
Esil: 0x00,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2018-12-12 09:43:43 +03:00
|
|
|
|
2018-12-14 08:48:18 +03:00
|
|
|
// Std pmt with time and location descriptors, time and location fields are zeroed out
|
2019-01-07 09:32:57 +03:00
|
|
|
StandardPmtTimeLocation = PSI{
|
2018-12-12 09:43:43 +03:00
|
|
|
Pf: 0x00,
|
|
|
|
Tid: 0x02,
|
|
|
|
Ssi: true,
|
2019-01-07 09:30:48 +03:00
|
|
|
Sl: 0x3e,
|
2018-12-12 09:43:43 +03:00
|
|
|
Tss: &TSS{
|
2019-01-07 09:30:48 +03:00
|
|
|
Tide: 0x01,
|
2018-12-12 09:43:43 +03:00
|
|
|
V: 0,
|
|
|
|
Cni: true,
|
|
|
|
Sn: 0,
|
|
|
|
Lsn: 0,
|
|
|
|
Sd: &PMT{
|
2018-12-12 09:47:06 +03:00
|
|
|
Pcrpid: 0x0100,
|
2018-12-14 08:32:47 +03:00
|
|
|
Pil: pmtTimeLocationPil,
|
2018-12-12 09:43:43 +03:00
|
|
|
Pd: []Desc{
|
2019-01-07 09:34:57 +03:00
|
|
|
{
|
2019-01-07 09:30:48 +03:00
|
|
|
Dt: timeDescTag,
|
|
|
|
Dl: timeDataSize,
|
2018-12-12 09:43:43 +03:00
|
|
|
Dd: make([]byte, timeDataSize),
|
|
|
|
},
|
2019-01-07 09:34:57 +03:00
|
|
|
{
|
2019-01-07 09:30:48 +03:00
|
|
|
Dt: locationDescTag,
|
|
|
|
Dl: locationDataSize,
|
2018-12-14 08:32:47 +03:00
|
|
|
Dd: make([]byte, locationDataSize),
|
2018-12-12 09:43:43 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
Essd: &ESSD{
|
|
|
|
St: 0x1b,
|
|
|
|
Epid: 0x0100,
|
|
|
|
Esil: 0x00,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2018-12-12 08:56:59 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// Std PSI in bytes form
|
|
|
|
var (
|
2019-01-07 09:32:57 +03:00
|
|
|
StandardPatBytes = []byte{
|
2018-12-11 09:46:26 +03:00
|
|
|
0x00, // pointer
|
|
|
|
|
|
|
|
// ---- section included in data sent to CRC32 during check
|
|
|
|
// 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:2|version:5|use now:1 1100 0001
|
|
|
|
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
|
|
|
|
// ----
|
|
|
|
}
|
2019-01-07 09:32:57 +03:00
|
|
|
StandardPmtBytes = []byte{
|
2018-12-11 09:46:26 +03:00
|
|
|
0x00, // pointer
|
|
|
|
|
|
|
|
// ---- section included in data sent to CRC32 during check
|
|
|
|
// 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 descriptors since ES info length is 0.
|
|
|
|
|
|
|
|
// 0x15, 0xbd, 0x4d, 0x56, // CRC
|
|
|
|
// ----
|
|
|
|
}
|
|
|
|
)
|