1
1
mirror of https://github.com/wader/fq.git synced 2024-11-28 11:42:50 +03:00
fq/format/matroska/ebml/ebml.go

70 lines
1.5 KiB
Go
Raw Normal View History

2020-06-08 03:29:51 +03:00
package ebml
import "github.com/wader/fq/pkg/scalar"
2020-06-08 03:29:51 +03:00
type Type int
const (
Unknown Type = iota
Integer
2020-06-08 03:29:51 +03:00
Uinteger
Float
String
UTF8
Date
Binary
Master
)
var TypeNames = map[Type]string{
Unknown: "unknown",
2020-06-08 03:29:51 +03:00
Integer: "integer",
Uinteger: "uinteger",
Float: "float",
String: "string",
UTF8: "utf8",
2020-06-08 03:29:51 +03:00
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
2020-06-08 03:29:51 +03:00
}
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{
2022-04-06 20:37:34 +03:00
CRC32ID: {Name: "crc32", Type: Binary},
VoidID: {Name: "void", Type: Binary},
2020-06-08 03:29:51 +03:00
}
var Header = Tag{
2022-04-06 20:37:34 +03:00
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},
2020-06-08 03:29:51 +03:00
}