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
|
||||
pesSpace [pes.MaxPesSize]byte
|
||||
|
||||
continuity map[int]byte
|
||||
continuity map[uint16]byte
|
||||
|
||||
nalBasedPSI bool
|
||||
pktCount int
|
||||
psiSendCount int
|
||||
mediaPid int
|
||||
mediaPid uint16
|
||||
streamID byte
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
||||
var mPid int
|
||||
var mPid uint16
|
||||
var sid byte
|
||||
nbp := true
|
||||
switch mediaType {
|
||||
|
@ -170,7 +170,7 @@ func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
|||
Pil: 0,
|
||||
Essd: &psi.ESSD{
|
||||
St: byte(sid),
|
||||
Epid: uint16(mPid),
|
||||
Epid: mPid,
|
||||
Esil: 0x00,
|
||||
},
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ func NewEncoder(dst io.WriteCloser, rate float64, mediaType int) *Encoder {
|
|||
mediaPid: mPid,
|
||||
streamID: sid,
|
||||
|
||||
continuity: map[int]byte{
|
||||
continuity: map[uint16]byte{
|
||||
PatPid: 0,
|
||||
PmtPid: 0,
|
||||
mPid: 0,
|
||||
|
@ -331,7 +331,7 @@ func (e *Encoder) pcr() uint64 {
|
|||
}
|
||||
|
||||
// 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]
|
||||
const continuityCounterMask = 0xf
|
||||
e.continuity[pid] = (cc + 1) & continuityCounterMask
|
||||
|
|
Loading…
Reference in New Issue