codec/h264/h264dec/nalunit.go: using consts for NAL unit types check in newNALUnit

This commit is contained in:
Saxon 2019-07-29 14:08:59 +09:30
parent b71d8fdd8b
commit 520ead0c6c
2 changed files with 4 additions and 3 deletions

View File

@ -19,6 +19,8 @@ const (
naluTypePrefixNALU naluTypePrefixNALU
naluTypeSubsetSPS naluTypeSubsetSPS
naluTypeDepthParamSet naluTypeDepthParamSet
naluTypeSliceLayerExtRBSP = 20
naluTypeSliceLayerExtRBSP2 = 21
) )
var ( var (

View File

@ -234,10 +234,9 @@ func NewNALUnit(br *bits.BitReader) (*NALUnit, error) {
n.RefIdc = uint8(r.readBits(2)) n.RefIdc = uint8(r.readBits(2))
n.Type = uint8(r.readBits(5)) n.Type = uint8(r.readBits(5))
// TODO: use consts for the NAL types here
var err error var err error
if n.Type == 14 || n.Type == 20 || n.Type == 21 { if n.Type == naluTypePrefixNALU || n.Type == naluTypeSliceLayerExtRBSP || n.Type == naluTypeSliceLayerExtRBSP2 {
if n.Type != 21 { if n.Type != naluTypeSliceLayerExtRBSP2 {
n.SVCExtensionFlag = r.readBits(1) == 1 n.SVCExtensionFlag = r.readBits(1) == 1
} else { } else {
n.AVC3DExtensionFlag = r.readBits(1) == 1 n.AVC3DExtensionFlag = r.readBits(1) == 1