mirror of
https://github.com/wader/fq.git
synced 2024-11-27 06:04:47 +03:00
2fc0a71a47
Move scalar into own package. Split scalar code into decode related scalar code (that reads etc) and scalar code that just transform the scalar value. Use a scalar.Mapper interface instead of just a function. Make mappers, assert and validat impement the interface.
33 lines
938 B
Go
33 lines
938 B
Go
package vpx
|
|
|
|
// https://www.webmproject.org/vp9/mp4/
|
|
|
|
import (
|
|
"github.com/wader/fq/format"
|
|
"github.com/wader/fq/format/registry"
|
|
"github.com/wader/fq/pkg/decode"
|
|
)
|
|
|
|
func init() {
|
|
registry.MustRegister(decode.Format{
|
|
Name: format.VPX_CCR,
|
|
Description: "VPX Codec Configuration Record",
|
|
DecodeFn: vpxCCRDecode,
|
|
})
|
|
}
|
|
|
|
func vpxCCRDecode(d *decode.D, in interface{}) interface{} {
|
|
d.FieldU8("profile")
|
|
d.FieldU8("level", vpxLevelNames)
|
|
d.FieldU4("bit_depth")
|
|
d.FieldU3("chroma_subsampling", vpxChromeSubsamplingNames)
|
|
d.FieldU1("video_full_range_flag")
|
|
d.FieldU8("colour_primaries", format.ISO_23091_2_ColourPrimariesMap)
|
|
d.FieldU8("transfer_characteristics", format.ISO_23091_2_TransferCharacteristicMap)
|
|
d.FieldU8("matrix_coefficients", format.ISO_23091_2_MatrixCoefficients)
|
|
_ = d.FieldU16("codec_initialization_data_size")
|
|
// d.FieldRawLen("codec_initialization_data", int64(initDataSize)*8)
|
|
|
|
return nil
|
|
}
|