From e6d0f0d679cfa18cb27bbcf9f9c795c3bdee7878 Mon Sep 17 00:00:00 2001 From: Quentin Renard Date: Tue, 23 Jun 2020 14:08:15 +0200 Subject: [PATCH] Fixed ClockReference for 32 bits --- clock_reference.go | 4 ++-- data_pes.go | 4 ++-- packet.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clock_reference.go b/clock_reference.go index 9d31c67..73c147c 100644 --- a/clock_reference.go +++ b/clock_reference.go @@ -7,11 +7,11 @@ import ( // ClockReference represents a clock reference // Base is based on a 90 kHz clock and extension is based on a 27 MHz clock type ClockReference struct { - Base, Extension int + Base, Extension int64 } // newClockReference builds a new clock reference -func newClockReference(base, extension int) *ClockReference { +func newClockReference(base, extension int64) *ClockReference { return &ClockReference{ Base: base, Extension: extension, diff --git a/data_pes.go b/data_pes.go index b84f051..858d911 100644 --- a/data_pes.go +++ b/data_pes.go @@ -397,7 +397,7 @@ func parsePTSOrDTS(i *astikit.BytesIterator) (cr *ClockReference, err error) { err = fmt.Errorf("astits: fetching next bytes failed: %w", err) return } - cr = newClockReference(int(uint64(bs[0])>>1&0x7<<30|uint64(bs[1])<<22|uint64(bs[2])>>1&0x7f<<15|uint64(bs[3])<<7|uint64(bs[4])>>1&0x7f), 0) + cr = newClockReference(int64(uint64(bs[0])>>1&0x7<<30|uint64(bs[1])<<22|uint64(bs[2])>>1&0x7f<<15|uint64(bs[3])<<7|uint64(bs[4])>>1&0x7f), 0) return } @@ -409,6 +409,6 @@ func parseESCR(i *astikit.BytesIterator) (cr *ClockReference, err error) { return } escr := uint64(bs[0])>>3&0x7<<39 | uint64(bs[0])&0x3<<37 | uint64(bs[1])<<29 | uint64(bs[2])>>3<<24 | uint64(bs[2])&0x3<<22 | uint64(bs[3])<<14 | uint64(bs[4])>>3<<9 | uint64(bs[4])&0x3<<7 | uint64(bs[5])>>1 - cr = newClockReference(int(escr>>9), int(escr&0x1ff)) + cr = newClockReference(int64(escr>>9), int64(escr&0x1ff)) return } diff --git a/packet.go b/packet.go index 1bc1402..375980e 100644 --- a/packet.go +++ b/packet.go @@ -299,6 +299,6 @@ func parsePCR(i *astikit.BytesIterator) (cr *ClockReference, err error) { return } pcr := uint64(bs[0])<<40 | uint64(bs[1])<<32 | uint64(bs[2])<<24 | uint64(bs[3])<<16 | uint64(bs[4])<<8 | uint64(bs[5]) - cr = newClockReference(int(pcr>>15), int(pcr&0x1ff)) + cr = newClockReference(int64(pcr>>15), int64(pcr&0x1ff)) return }