From d3c4ab4012ea3cb2544c9f4425be44b4a52343e4 Mon Sep 17 00:00:00 2001 From: notch Date: Fri, 15 Jan 2021 08:44:45 +0800 Subject: [PATCH] update peek return type(uint32 -> uint64) --- av/codec/aac/asc.go | 2 +- av/codec/hevc/vps.go | 6 +++++- utils/bits/reader.go | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/av/codec/aac/asc.go b/av/codec/aac/asc.go index 8187416..f12850a 100644 --- a/av/codec/aac/asc.go +++ b/av/codec/aac/asc.go @@ -81,7 +81,7 @@ func (asc *AudioSpecificConfig) Decode(config []byte) (err error) { if asc.ObjectType == AOT_ALS { r.Skip(5) - if r.Peek(24) != binary.BigEndian.Uint32([]byte{0, 'A', 'L', 'S'}) { + if uint32(r.Peek(24)) != binary.BigEndian.Uint32([]byte{0, 'A', 'L', 'S'}) { r.Skip(24) } diff --git a/av/codec/hevc/vps.go b/av/codec/hevc/vps.go index fd55311..6834271 100644 --- a/av/codec/hevc/vps.go +++ b/av/codec/hevc/vps.go @@ -36,6 +36,7 @@ type H265RawProfileTierLevel struct { General_profile_idc uint8 General_profile_compatibility_flag [32]uint8 + GeneralProfileCompatibilityFlags uint32 // shortcut flags 32bits General_progressive_source_flag uint8 General_interlaced_source_flag uint8 @@ -53,7 +54,8 @@ type H265RawProfileTierLevel struct { General_lower_bit_rate_constraint_flag uint8 General_max_14bit_constraint_flag uint8 - General_inbld_flag uint8 + General_inbld_flag uint8 + GeneralConstraintIndicatorFlags uint64 // shortcut flags 48bits General_level_idc uint8 @@ -103,10 +105,12 @@ func (ptl *H265RawProfileTierLevel) decode(r *bits.Reader, ptl.General_tier_flag = r.ReadBit() ptl.General_profile_idc = r.ReadUint8(5) + ptl.GeneralProfileCompatibilityFlags = uint32(r.Peek(32)) for j := 0; j < 32; j++ { ptl.General_profile_compatibility_flag[j] = r.ReadBit() } + ptl.GeneralConstraintIndicatorFlags = r.Peek(48) ptl.General_progressive_source_flag = r.ReadBit() ptl.General_interlaced_source_flag = r.ReadBit() ptl.General_non_packed_constraint_flag = r.ReadBit() diff --git a/utils/bits/reader.go b/utils/bits/reader.go index 4c1e277..d650d83 100644 --- a/utils/bits/reader.go +++ b/utils/bits/reader.go @@ -29,9 +29,9 @@ func (r *Reader) Skip(n int) { } // Peek peek the uint32 of n bits. -func (r *Reader) Peek(n int) uint32 { +func (r *Reader) Peek(n int) uint64 { clone := *r - return uint32(clone.readUint64(n, 32)) + return clone.readUint64(n, 64) } // Read read the uint32 of n bits.