psi: working on psi test file

This commit is contained in:
saxon 2018-12-10 17:42:45 +10:30
parent 8fe430f5f5
commit 9e7b65ac6a
2 changed files with 96 additions and 0 deletions

View File

@ -6,6 +6,59 @@ import (
"math/bits"
)
// TODO: Finish off mts/psi so that we can create pat and pmt tables instead
// of hardcoding.
var (
StdPat = []byte{
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:3|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
// ----
}
StdPmt = []byte{
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
// ----
}
)
// Some common lengths
const (
ESSDDefLen = 5

View File

@ -4,6 +4,49 @@ import (
"testing"
)
var (
patPsi = PSI{
Pf: 0x00,
Tid: 0x00,
Ssi: true,
Pb: false,
Sl: uint16(0x0d),
Tss: &TSS{
Tide: uint16(0x01),
V: 0,
Cni: true,
Sn: 0,
Lsn: 0,
Sd: &PAT{
Pn: uint16(0x01),
Pmpid: 16,
},
},
}
pmtPsi = 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: 16, // wrong
Pil: 0,
Essd: &ESSD{
St: 0x1b,
}
}
}
}
}
)
func TestReadPSI1(t *testing.T) {
}