mirror of https://bitbucket.org/ausocean/av.git
Export StandardPAT, StandardPMT and MaxPTS.
This commit is contained in:
parent
aeb10e0ab7
commit
1728c3a531
|
@ -34,10 +34,10 @@ import (
|
|||
"bitbucket.org/ausocean/av/container/mts/psi"
|
||||
)
|
||||
|
||||
// Some common manifestations of PSI
|
||||
// Some common manifestations of PSI.
|
||||
var (
|
||||
// standardPat is a minimal PAT.
|
||||
standardPat = psi.PSI{
|
||||
// StandardPAT is a minimal PAT.
|
||||
StandardPAT = psi.PSI{
|
||||
Pf: 0x00,
|
||||
Tid: 0x00,
|
||||
Ssi: true,
|
||||
|
@ -55,6 +55,30 @@ var (
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Standard PMT is a minimal PMT.
|
||||
StandardPMT = psi.PSI{
|
||||
Pf: 0x00,
|
||||
Tid: 0x02,
|
||||
Ssi: true,
|
||||
Sl: 0x12,
|
||||
Tss: &psi.TSS{
|
||||
Tide: 0x01,
|
||||
V: 0,
|
||||
Cni: true,
|
||||
Sn: 0,
|
||||
Lsn: 0,
|
||||
Sd: &psi.PMT{
|
||||
Pcrpid: 0x0100,
|
||||
Pil: 0,
|
||||
Essd: &psi.ESSD{
|
||||
St: H264ID,
|
||||
Epid: 0x0100,
|
||||
Esil: 0x00,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -69,7 +93,7 @@ const (
|
|||
var Meta *meta.Data
|
||||
|
||||
var (
|
||||
patTable = standardPat.Bytes()
|
||||
patTable = StandardPAT.Bytes()
|
||||
pmtTable []byte
|
||||
)
|
||||
|
||||
|
@ -102,6 +126,9 @@ const (
|
|||
|
||||
// PTSFrequency is the presentation timestamp frequency in Hz.
|
||||
PTSFrequency = 90000
|
||||
|
||||
// MaxPTS is the largest PTS value (i.e., for a 33-bit unsigned integer).
|
||||
MaxPTS = (1 << 33) - 1
|
||||
)
|
||||
|
||||
// Encoder encapsulates properties of an MPEG-TS generator.
|
||||
|
@ -143,19 +170,10 @@ func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
|||
sid = H264ID
|
||||
}
|
||||
|
||||
// standardPmt is a minimal PMT, without descriptors for metadata.
|
||||
pmtTable = (&psi.PSI{
|
||||
Pf: 0x00,
|
||||
Tid: 0x02,
|
||||
Ssi: true,
|
||||
Sl: 0x12,
|
||||
Tss: &psi.TSS{
|
||||
Tide: 0x01,
|
||||
V: 0,
|
||||
Cni: true,
|
||||
Sn: 0,
|
||||
Lsn: 0,
|
||||
Sd: &psi.PMT{
|
||||
// StandardPmt is a minimal PMT, without descriptors for metadata.
|
||||
pmt := StandardPMT
|
||||
if sid != H264ID {
|
||||
pmt.Tss.Sd = &psi.PMT{
|
||||
Pcrpid: 0x0100,
|
||||
Pil: 0,
|
||||
Essd: &psi.ESSD{
|
||||
|
@ -163,9 +181,9 @@ func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
|||
Epid: 0x0100,
|
||||
Esil: 0x00,
|
||||
},
|
||||
},
|
||||
},
|
||||
}).Bytes()
|
||||
}
|
||||
}
|
||||
pmtTable = pmt.Bytes()
|
||||
|
||||
return &Encoder{
|
||||
dst: dst,
|
||||
|
|
Loading…
Reference in New Issue