mirror of
https://github.com/wader/fq.git
synced 2024-11-23 18:56:52 +03:00
39 lines
820 B
Go
39 lines
820 B
Go
package mpeg
|
|
|
|
import (
|
|
"github.com/wader/fq/format"
|
|
"github.com/wader/fq/format/registry"
|
|
"github.com/wader/fq/pkg/decode"
|
|
)
|
|
|
|
var hevcAUNALFormat decode.Group
|
|
|
|
func init() {
|
|
registry.MustRegister(decode.Format{
|
|
Name: format.HEVC_AU,
|
|
Description: "H.265/HEVC Access Unit",
|
|
DecodeFn: hevcAUDecode,
|
|
RootArray: true,
|
|
RootName: "access_unit",
|
|
Dependencies: []decode.Dependency{
|
|
{Names: []string{format.HEVC_NALU}, Group: &hevcAUNALFormat},
|
|
},
|
|
})
|
|
}
|
|
|
|
func hevcAUDecode(d *decode.D, in interface{}) interface{} {
|
|
hevcIn, ok := in.(format.HevcIn)
|
|
if !ok {
|
|
d.Errorf("hevcIn required")
|
|
}
|
|
|
|
for d.NotEnd() {
|
|
d.FieldStruct("nalu", func(d *decode.D) {
|
|
l := d.FieldU("length", int(hevcIn.LengthSize)*8)
|
|
d.FieldFormatLen("nalu", int64(l)*8, hevcAUNALFormat, nil)
|
|
})
|
|
}
|
|
|
|
return nil
|
|
}
|