mirror of https://bitbucket.org/ausocean/av.git
codec/h264/decode: added MVCExtension type and NewMVCExtension func
This commit is contained in:
parent
e54bc234c8
commit
24f6b2d12f
|
@ -14,10 +14,63 @@ type NalUnit struct {
|
||||||
Avc3dExtensionFlag int
|
Avc3dExtensionFlag int
|
||||||
SVCExtension *SVCExtension
|
SVCExtension *SVCExtension
|
||||||
ThreeDAVCExtension *ThreeDAVCExtension
|
ThreeDAVCExtension *ThreeDAVCExtension
|
||||||
|
MVCExtension *MVCExtension
|
||||||
EmulationPreventionThreeByte byte
|
EmulationPreventionThreeByte byte
|
||||||
rbsp []byte
|
rbsp []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MVCExtension struct {
|
||||||
|
NonIdrFlag bool
|
||||||
|
PriorityID int
|
||||||
|
ViewID int
|
||||||
|
TemporalID int
|
||||||
|
AnchorPicFlag bool
|
||||||
|
InterViewFlag bool
|
||||||
|
ReservedOneBit int
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMVCExtension(br *bits.BitReader) (*MVCExtension, error) {
|
||||||
|
e := &MVCExtension{}
|
||||||
|
var err error
|
||||||
|
|
||||||
|
e.NonIdrFlag, err = br.ReadBool()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "could not read NonIdrFlag")
|
||||||
|
}
|
||||||
|
|
||||||
|
e.PriorityID, err = br.ReadBitsInt(6)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "could not read PriorityId")
|
||||||
|
}
|
||||||
|
|
||||||
|
e.ViewID, err = br.ReadBitsInt(10)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "could not read ViewId")
|
||||||
|
}
|
||||||
|
|
||||||
|
e.TemporalID, err = br.ReadBitsInt(3)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "could not read TemporalId")
|
||||||
|
}
|
||||||
|
|
||||||
|
e.AnchorPicFlag, err = br.ReadBool()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "could not read AnchorPicFlag")
|
||||||
|
}
|
||||||
|
|
||||||
|
e.InterViewFlag, err = br.ReadBool()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "could not read InterViewFlag")
|
||||||
|
}
|
||||||
|
|
||||||
|
e.ReservedOneBit, err = br.ReadBitsInt(1)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "could not read ReservedOneBit")
|
||||||
|
}
|
||||||
|
|
||||||
|
return e, nil
|
||||||
|
}
|
||||||
|
|
||||||
type ThreeDAVCExtension struct {
|
type ThreeDAVCExtension struct {
|
||||||
ViewIdx int
|
ViewIdx int
|
||||||
DepthFlag bool
|
DepthFlag bool
|
||||||
|
@ -134,18 +187,6 @@ func NewSVCExtension(br *bits.BitReader) (*SVCExtension, error) {
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NalUnitHeaderMvcExtension(nalUnit *NalUnit, br *bits.BitReader) error {
|
|
||||||
return readFields(br, []field{
|
|
||||||
{&nalUnit.NonIdrFlag, "NonIdrFlag", 1},
|
|
||||||
{&nalUnit.PriorityId, "PriorityId", 6},
|
|
||||||
{&nalUnit.ViewId, "ViewId", 10},
|
|
||||||
{&nalUnit.TemporalId, "TemporalId", 3},
|
|
||||||
{&nalUnit.AnchorPicFlag, "AnchorPicFlag", 1},
|
|
||||||
{&nalUnit.InterViewFlag, "InterViewFlag", 1},
|
|
||||||
{&nalUnit.ReservedOneBit, "ReservedOneBit", 1},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (n *NalUnit) RBSP() []byte {
|
func (n *NalUnit) RBSP() []byte {
|
||||||
return n.rbsp
|
return n.rbsp
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue