mirror of https://bitbucket.org/ausocean/av.git
container/mts: using uint16 for PID always
This commit is contained in:
parent
04c7825063
commit
8f8ae7c558
|
@ -303,12 +303,12 @@ func (e *Encoder) tick() {
|
||||||
|
|
||||||
// pts retuns the current presentation timestamp.
|
// pts retuns the current presentation timestamp.
|
||||||
func (e *Encoder) pts() uint64 {
|
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.
|
// pcr returns the current program clock reference.
|
||||||
func (e *Encoder) pcr() uint64 {
|
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.
|
// ccFor returns the next continuity counter for pid.
|
||||||
|
|
|
@ -318,9 +318,9 @@ func DiscontinuityIndicator(f bool) Option {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPTSRange retreives the first and last PTS of an MPEGTS clip.
|
// 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.
|
// Find the first packet with PID pidType.
|
||||||
pkt, _, err := FindPid(clip, uint16(pidType))
|
pkt, _, err := FindPid(clip, pidType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return [2]uint64{}, err
|
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.
|
// Get the final PTS searching from end of clip for access unit start.
|
||||||
for i := len(clip) - PacketSize; i >= 0; i -= PacketSize {
|
for i := len(clip) - PacketSize; i >= 0; i -= PacketSize {
|
||||||
copy(_pkt[:], clip[i: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)
|
payload, err = packet.Payload(&_pkt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return [2]uint64{}, err
|
return [2]uint64{}, err
|
||||||
|
|
Loading…
Reference in New Issue