mirror of
https://github.com/wader/fq.git
synced 2024-11-24 19:35:58 +03:00
c92f4f13c1
Update spec from https://raw.githubusercontent.com/ietf-wg-cellar/matroska-specification/master/ebml_matroska.xml Allow unknown ids, decodeas "unknown" type with just binary data Change "type" field to just a string, there is no type id number. Make all type field symbols consistently lowercase
70 lines
1.5 KiB
Go
70 lines
1.5 KiB
Go
package ebml
|
|
|
|
import "github.com/wader/fq/pkg/scalar"
|
|
|
|
type Type int
|
|
|
|
const (
|
|
Unknown Type = iota
|
|
Integer
|
|
Uinteger
|
|
Float
|
|
String
|
|
UTF8
|
|
Date
|
|
Binary
|
|
Master
|
|
)
|
|
|
|
var TypeNames = map[Type]string{
|
|
Unknown: "unknown",
|
|
Integer: "integer",
|
|
Uinteger: "uinteger",
|
|
Float: "float",
|
|
String: "string",
|
|
UTF8: "utf8",
|
|
Date: "data",
|
|
Binary: "binary",
|
|
Master: "master",
|
|
}
|
|
|
|
type Attribute struct {
|
|
Name string
|
|
Type Type
|
|
Tag Tag
|
|
Definition string
|
|
IntegerEnums scalar.SToScalar
|
|
UintegerEnums scalar.UToScalar
|
|
StringEnums scalar.StrToScalar
|
|
}
|
|
|
|
type Tag map[uint64]Attribute
|
|
|
|
const (
|
|
CRC32ID = 0xbf
|
|
VoidID = 0xec
|
|
HeaderID = 0x1a45dfa3
|
|
EBMLVersionID = 0x4286
|
|
EBMLReadVersionID = 0x42f7
|
|
EBMLMaxIDLengthID = 0x42f2
|
|
EBMLMaxSizeLengthID = 0x42f3
|
|
DocTypeID = 0x4282
|
|
DocTypeVersionID = 0x4287
|
|
DocTypeReadVersionID = 0x4285
|
|
)
|
|
|
|
var Global = Tag{
|
|
CRC32ID: {Name: "crc32", Type: Binary},
|
|
VoidID: {Name: "void", Type: Binary},
|
|
}
|
|
|
|
var Header = Tag{
|
|
EBMLVersionID: {Name: "ebml_version", Type: Uinteger},
|
|
EBMLReadVersionID: {Name: "ebml_read_version", Type: Uinteger},
|
|
EBMLMaxIDLengthID: {Name: "ebml_max_id_length", Type: Uinteger},
|
|
EBMLMaxSizeLengthID: {Name: "ebml_max_size_length", Type: Uinteger},
|
|
DocTypeID: {Name: "doc_type", Type: String},
|
|
DocTypeVersionID: {Name: "doc_type_version", Type: Uinteger},
|
|
DocTypeReadVersionID: {Name: "doc_type_read_version", Type: Uinteger},
|
|
}
|