container/mts: using uint16 for PID always

This commit is contained in:
Saxon 2019-05-11 13:50:40 +09:30
parent 04c7825063
commit 8f8ae7c558
2 changed files with 5 additions and 5 deletions

View File

@ -303,12 +303,12 @@ func (e *Encoder) tick() {
// pts retuns the current presentation timestamp.
func (e *Encoder) pts() uint64 {
return uint64((e.clock + e.ptsOffset).Seconds() * PTSFreq)
return uint64((e.clock + e.ptsOffset).Seconds() * PTSFrequency)
}
// pcr returns the current program clock reference.
func (e *Encoder) pcr() uint64 {
return uint64(e.clock.Seconds() * PCRFreq)
return uint64(e.clock.Seconds() * PCRFrequency)
}
// ccFor returns the next continuity counter for pid.

View File

@ -318,9 +318,9 @@ func DiscontinuityIndicator(f bool) Option {
}
// GetPTSRange retreives the first and last PTS of an MPEGTS clip.
func GetPTSRange(clip []byte, pidType int) (pts [2]uint64, err error) {
func GetPTSRange(clip []byte, pidType uint16) (pts [2]uint64, err error) {
// Find the first packet with PID pidType.
pkt, _, err := FindPid(clip, uint16(pidType))
pkt, _, err := FindPid(clip, pidType)
if err != nil {
return [2]uint64{}, err
}
@ -344,7 +344,7 @@ func GetPTSRange(clip []byte, pidType int) (pts [2]uint64, err error) {
// Get the final PTS searching from end of clip for access unit start.
for i := len(clip) - PacketSize; i >= 0; i -= PacketSize {
copy(_pkt[:], clip[i:i+PacketSize])
if packet.PayloadUnitStartIndicator(&_pkt) && _pkt.PID() == pidType {
if packet.PayloadUnitStartIndicator(&_pkt) && uint16(_pkt.PID()) == pidType {
payload, err = packet.Payload(&_pkt)
if err != nil {
return [2]uint64{}, err