update peek return type(uint32 -> uint64)

This commit is contained in:
notch
2021-01-15 08:44:45 +08:00
parent 0e3b400911
commit d3c4ab4012
3 changed files with 8 additions and 4 deletions

View File

@@ -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)
}

View File

@@ -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
@@ -54,6 +55,7 @@ type H265RawProfileTierLevel struct {
General_max_14bit_constraint_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()

View File

@@ -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.