2020-06-08 03:29:51 +03:00
|
|
|
package ebml
|
|
|
|
|
2021-12-07 17:51:46 +03:00
|
|
|
import "github.com/wader/fq/pkg/scalar"
|
|
|
|
|
2020-06-08 03:29:51 +03:00
|
|
|
type Type int
|
|
|
|
|
|
|
|
const (
|
2022-06-06 22:17:36 +03:00
|
|
|
Unknown Type = iota
|
|
|
|
Integer
|
2020-06-08 03:29:51 +03:00
|
|
|
Uinteger
|
|
|
|
Float
|
|
|
|
String
|
|
|
|
UTF8
|
|
|
|
Date
|
|
|
|
Binary
|
|
|
|
Master
|
|
|
|
)
|
|
|
|
|
|
|
|
var TypeNames = map[Type]string{
|
2022-06-06 22:17:36 +03:00
|
|
|
Unknown: "unknown",
|
2020-06-08 03:29:51 +03:00
|
|
|
Integer: "integer",
|
|
|
|
Uinteger: "uinteger",
|
|
|
|
Float: "float",
|
|
|
|
String: "string",
|
2022-06-06 22:17:36 +03:00
|
|
|
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
|
2021-12-07 17:51:46 +03:00
|
|
|
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
|
|
|
}
|