mirror of
https://github.com/wader/fq.git
synced 2024-11-29 23:27:12 +03:00
b08ef00dd1
Replaces []Format with a Group type. A bit more type safe. Breaking change for RegisterFormat, now takes a first argument that is a "single" format group. Lots of naming cleanup. This is also preparation for decode group argument which will enable doing intresting probing, ex a format decoder could know it's decode as part of probe group (html could be probed possibly), or have "arg probe" group for decoder who inspect args to know if they should probe (-d /path/to/schema etc) to enable nice CLI-ergonomics.
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package av1
|
|
|
|
// matroska "Low Overhead Bitstream Format syntax" format
|
|
// "Each Block contains one Temporal Unit containing one or more OBUs. Each OBU stored in the Block MUST contain its header and its payload."
|
|
// "The OBUs in the Block follow the [Low Overhead Bitstream Format syntax]. They MUST have the [obu_has_size_field] set to 1 except for the last OBU in the frame, for which [obu_has_size_field] MAY be set to 0, in which case it is assumed to fill the remainder of the frame."
|
|
|
|
import (
|
|
"github.com/wader/fq/format"
|
|
"github.com/wader/fq/pkg/decode"
|
|
"github.com/wader/fq/pkg/interp"
|
|
)
|
|
|
|
var av1FrameObuGroup decode.Group
|
|
|
|
func init() {
|
|
interp.RegisterFormat(
|
|
format.Av1Frame,
|
|
&decode.Format{
|
|
Description: "AV1 frame",
|
|
DecodeFn: frameDecode,
|
|
RootArray: true,
|
|
RootName: "frame",
|
|
Dependencies: []decode.Dependency{
|
|
{Groups: []*decode.Group{format.Av1Obu}, Out: &av1FrameObuGroup},
|
|
},
|
|
})
|
|
}
|
|
|
|
func frameDecode(d *decode.D) any {
|
|
for d.NotEnd() {
|
|
d.FieldFormat("obu", &av1FrameObuGroup, nil)
|
|
}
|
|
|
|
return nil
|
|
}
|