mirror of https://bitbucket.org/ausocean/av.git
container/mts: use uint16 for media PID
This commit is contained in:
parent
bfcd2607c7
commit
8a9d914283
|
@ -136,19 +136,19 @@ type Encoder struct {
|
||||||
tsSpace [PacketSize]byte
|
tsSpace [PacketSize]byte
|
||||||
pesSpace [pes.MaxPesSize]byte
|
pesSpace [pes.MaxPesSize]byte
|
||||||
|
|
||||||
continuity map[int]byte
|
continuity map[uint16]byte
|
||||||
|
|
||||||
nalBasedPSI bool
|
nalBasedPSI bool
|
||||||
pktCount int
|
pktCount int
|
||||||
psiSendCount int
|
psiSendCount int
|
||||||
mediaPid int
|
mediaPid uint16
|
||||||
streamID byte
|
streamID byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEncoder returns an Encoder with the specified media type and rate eg. if a video stream
|
// NewEncoder returns an Encoder with the specified media type and rate eg. if a video stream
|
||||||
// calls write for every frame, the rate will be the frame rate of the video.
|
// calls write for every frame, the rate will be the frame rate of the video.
|
||||||
func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
||||||
var mPid int
|
var mPid uint16
|
||||||
var sid byte
|
var sid byte
|
||||||
nbp := true
|
nbp := true
|
||||||
switch mediaType {
|
switch mediaType {
|
||||||
|
@ -170,7 +170,7 @@ func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
||||||
Pil: 0,
|
Pil: 0,
|
||||||
Essd: &psi.ESSD{
|
Essd: &psi.ESSD{
|
||||||
St: byte(sid),
|
St: byte(sid),
|
||||||
Epid: uint16(mPid),
|
Epid: mPid,
|
||||||
Esil: 0x00,
|
Esil: 0x00,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
||||||
mediaPid: mPid,
|
mediaPid: mPid,
|
||||||
streamID: sid,
|
streamID: sid,
|
||||||
|
|
||||||
continuity: map[int]byte{
|
continuity: map[uint16]byte{
|
||||||
PatPid: 0,
|
PatPid: 0,
|
||||||
PmtPid: 0,
|
PmtPid: 0,
|
||||||
mPid: 0,
|
mPid: 0,
|
||||||
|
@ -331,7 +331,7 @@ func (e *Encoder) pcr() uint64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ccFor returns the next continuity counter for pid.
|
// ccFor returns the next continuity counter for pid.
|
||||||
func (e *Encoder) ccFor(pid int) byte {
|
func (e *Encoder) ccFor(pid uint16) byte {
|
||||||
cc := e.continuity[pid]
|
cc := e.continuity[pid]
|
||||||
const continuityCounterMask = 0xf
|
const continuityCounterMask = 0xf
|
||||||
e.continuity[pid] = (cc + 1) & continuityCounterMask
|
e.continuity[pid] = (cc + 1) & continuityCounterMask
|
||||||
|
|
Loading…
Reference in New Issue