From 8a9d914283417203bf0a398056ff2ca9a62c919b Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Sun, 15 Sep 2019 09:27:26 +0930 Subject: [PATCH] container/mts: use uint16 for media PID --- container/mts/encoder.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/container/mts/encoder.go b/container/mts/encoder.go index 693b0be3..a903500b 100644 --- a/container/mts/encoder.go +++ b/container/mts/encoder.go @@ -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