mirror of https://bitbucket.org/ausocean/av.git
codec/h264/decode: added SVCExtension struct with NewSVCExtension function
This commit is contained in:
parent
16b4d570b6
commit
0d9861c49e
|
@ -1,7 +1,7 @@
|
|||
package h264
|
||||
|
||||
import (
|
||||
"github.com/ausocean/h264decode/h264/bits"
|
||||
"bitbucket.org/ausocean/av/codec/h264/decode/bits"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
|
@ -12,16 +12,7 @@ type NalUnit struct {
|
|||
Type int
|
||||
SvcExtensionFlag int
|
||||
Avc3dExtensionFlag int
|
||||
IdrFlag int
|
||||
PriorityId int
|
||||
NoInterLayerPredFlag int
|
||||
DependencyId int
|
||||
QualityId int
|
||||
TemporalId int
|
||||
UseRefBasePicFlag int
|
||||
DiscardableFlag int
|
||||
OutputFlag int
|
||||
ReservedThree2Bits int
|
||||
SVCExtension *SVCExtension
|
||||
HeaderBytes int
|
||||
NonIdrFlag int
|
||||
ViewId int
|
||||
|
@ -34,19 +25,74 @@ type NalUnit struct {
|
|||
rbsp []byte
|
||||
}
|
||||
|
||||
func NalUnitHeaderSvcExtension(nalUnit *NalUnit, br *bits.BitReader) error {
|
||||
return readFields(br, []field{
|
||||
{&nalUnit.IdrFlag, "IdrFlag", 1},
|
||||
{&nalUnit.PriorityId, "PriorityId", 6},
|
||||
{&nalUnit.NoInterLayerPredFlag, "NoInterLayerPredFlag", 1},
|
||||
{&nalUnit.DependencyId, "DependencyId", 3},
|
||||
{&nalUnit.QualityId, "QualityId", 4},
|
||||
{&nalUnit.TemporalId, "TemporalId", 3},
|
||||
{&nalUnit.UseRefBasePicFlag, "UseRefBasePicFlag", 1},
|
||||
{&nalUnit.DiscardableFlag, "DiscardableFlag", 1},
|
||||
{&nalUnit.OutputFlag, "OutputFlag", 1},
|
||||
{&nalUnit.ReservedThree2Bits, "ReservedThree2Bits", 2},
|
||||
})
|
||||
type SVCExtension struct {
|
||||
IdrFlag bool
|
||||
PriorityId int
|
||||
NoInterLayerPredFlag bool
|
||||
DependencyId int
|
||||
QualityId int
|
||||
TemporalId int
|
||||
UseRefBasePicFlag bool
|
||||
DiscardableFlag bool
|
||||
OutputFlag bool
|
||||
ReservedThree2Bits int
|
||||
}
|
||||
|
||||
func NewSVCExtension(br *bits.BitReader) (*SVCExtension, error) {
|
||||
e := &SVCExtension{}
|
||||
var err error
|
||||
|
||||
e.IdrFlag, err = br.ReadBool()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read IdrFlag")
|
||||
}
|
||||
|
||||
e.PriorityId, err = br.ReadBitsInt(6)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read PriorityId")
|
||||
}
|
||||
|
||||
e.NoInterLayerPredFlag, err = br.ReadBool()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read NoInterLayerPredFlag")
|
||||
}
|
||||
|
||||
e.DependencyId, err = br.ReadBitsInt(3)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read DependencyId")
|
||||
}
|
||||
|
||||
e.QualityId, err = br.ReadBitsInt(4)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read QualityId")
|
||||
}
|
||||
|
||||
e.TemporalId, err = br.ReadBitsInt(3)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read TemporalId")
|
||||
}
|
||||
|
||||
e.UseRefBasePicFlag, err = br.ReadBool()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read UseRefBasePicFlag")
|
||||
}
|
||||
|
||||
e.DiscardableFlag, err = br.ReadBool()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read DiscardableFlag")
|
||||
}
|
||||
|
||||
e.OutputFlag, err = br.ReadBool()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read OutputFlag")
|
||||
}
|
||||
|
||||
e.ReservedThree2Bits, err = br.ReadBitsInt(2)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not read ReservedThree2Bits")
|
||||
}
|
||||
|
||||
return e, nil
|
||||
}
|
||||
|
||||
func NalUnitHeader3davcExtension(nalUnit *NalUnit, br *bits.BitReader) error {
|
||||
|
|
Loading…
Reference in New Issue