Skip to content

Commit

Permalink
matroska: Update spec and make refs in descriptions look nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Feb 9, 2023
1 parent 072a63a commit c890a28
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 77 deletions.
2 changes: 2 additions & 0 deletions format/matroska/ebml/gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type Documentation struct {
var symLowerRE = regexp.MustCompile(`[^a-z0-9]+`)
var newLineRE = regexp.MustCompile(`\n`)
var doubleParanRE = regexp.MustCompile(`\(\(.+?\)\)`)
var refsRE = regexp.MustCompile(`\[@[?!](.+?)\]`)
var longParanRE = regexp.MustCompile(`\(.{20,}?\)`)
var whitespaceRE = regexp.MustCompile(`\s+`)
var quotesRE = regexp.MustCompile("`")
Expand All @@ -76,6 +77,7 @@ func findDefintion(docs []Documentation) (string, bool) {
s := d.Value
s = doubleParanRE.ReplaceAllLiteralString(s, "")
s = longParanRE.ReplaceAllLiteralString(s, "")
s = refsRE.ReplaceAllString(s, "$1")
s = whitespaceRE.ReplaceAllLiteralString(s, " ")
s = quotesRE.ReplaceAllLiteralString(s, "")
s = strings.TrimRight(s, " .")
Expand Down
86 changes: 41 additions & 45 deletions format/matroska/ebml_matroska/ebml_matroska.xml

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions format/matroska/ebml_matroska/ebml_matroska_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ var TrackNumberElement = &ebml.Uinteger{
ID: TrackNumberID,
ParentID: TrackEntryID,
Name: "track_number",
Definition: "The track number as used in the Block Header (using more than 127 tracks is not encouraged",
Definition: "The track number as used in the Block Header",
},
}
var TrackUIDElement = &ebml.Uinteger{
Expand Down Expand Up @@ -930,7 +930,7 @@ var FlagDefaultElement = &ebml.Uinteger{
ID: FlagDefaultID,
ParentID: TrackEntryID,
Name: "flag_default",
Definition: "Set if that track **SHOULD** be eligible for automatic selection by the player",
Definition: "Set if that track is eligible for automatic selection by the player",
},
}
var FlagForcedElement = &ebml.Uinteger{
Expand All @@ -946,39 +946,39 @@ var FlagHearingImpairedElement = &ebml.Uinteger{
ID: FlagHearingImpairedID,
ParentID: TrackEntryID,
Name: "flag_hearing_impaired",
Definition: "Set to 1 if that track is suitable for users with hearing impairments",
Definition: "Set to 1 if and only if that track is suitable for users with hearing impairments",
},
}
var FlagVisualImpairedElement = &ebml.Uinteger{
ElementType: ebml.ElementType{
ID: FlagVisualImpairedID,
ParentID: TrackEntryID,
Name: "flag_visual_impaired",
Definition: "Set to 1 if that track is suitable for users with visual impairments",
Definition: "Set to 1 if and only if that track is suitable for users with visual impairments",
},
}
var FlagTextDescriptionsElement = &ebml.Uinteger{
ElementType: ebml.ElementType{
ID: FlagTextDescriptionsID,
ParentID: TrackEntryID,
Name: "flag_text_descriptions",
Definition: "Set to 1 if that track contains textual descriptions of video content",
Definition: "Set to 1 if and only if that track contains textual descriptions of video content",
},
}
var FlagOriginalElement = &ebml.Uinteger{
ElementType: ebml.ElementType{
ID: FlagOriginalID,
ParentID: TrackEntryID,
Name: "flag_original",
Definition: "Set to 1 if that track is in the content's original language",
Definition: "Set to 1 if and only if that track is in the content's original language",
},
}
var FlagCommentaryElement = &ebml.Uinteger{
ElementType: ebml.ElementType{
ID: FlagCommentaryID,
ParentID: TrackEntryID,
Name: "flag_commentary",
Definition: "Set to 1 if that track contains commentary",
Definition: "Set to 1 if and only if that track contains commentary",
},
}
var FlagLacingElement = &ebml.Uinteger{
Expand Down Expand Up @@ -1322,7 +1322,7 @@ var FlagInterlacedElement = &ebml.Uinteger{
ID: FlagInterlacedID,
ParentID: VideoID,
Name: "flag_interlaced",
Definition: "Specify whether the video frames in this track are interlaced or not",
Definition: "Specify whether the video frames in this track are interlaced",
},
Enums: map[uint64]ebml.Enum{
0: {Name: "undetermined", Description: "Unknown status"},
Expand Down Expand Up @@ -1943,7 +1943,7 @@ var EmphasisElement = &ebml.Uinteger{
0: {Name: "no_emphasis"},
1: {Name: "cd_audio", Description: "First order filter with zero point at 50 microseconds and a pole at 15 microseconds"},
2: {Name: "reserved"},
3: {Name: "ccit_j_17", Description: "Defined in [@!ITU-J"},
3: {Name: "ccit_j_17", Description: "Defined in ITU-J"},
4: {Name: "fm_50", Description: "FM Radio in Europe"},
5: {Name: "fm_75", Description: "FM Radio in the USA"},
10: {Name: "phono_riaa", Description: "Phono filter with time constants of t1=3180"},
Expand Down Expand Up @@ -2116,9 +2116,9 @@ var ContentCompAlgoElement = &ebml.Uinteger{
Definition: "The compression algorithm used",
},
Enums: map[uint64]ebml.Enum{
0: {Name: "zlib", Description: "zlib compression [@!RFC1950]"},
1: {Name: "bzlib", Description: "bzip2 compression [@?BZIP2]"},
2: {Name: "lzo1x", Description: "Lempel-Ziv-Oberhumer compression [@?LZO]"},
0: {Name: "zlib", Description: "zlib compression RFC1950"},
1: {Name: "bzlib", Description: "bzip2 compression BZIP2"},
2: {Name: "lzo1x", Description: "Lempel-Ziv-Oberhumer compression LZO"},
3: {Name: "header_stripping", Description: "Octets in ContentCompSettings have been stripped from each frame"},
},
}
Expand Down Expand Up @@ -2157,11 +2157,11 @@ var ContentEncAlgoElement = &ebml.Uinteger{
},
Enums: map[uint64]ebml.Enum{
0: {Name: "not_encrypted", Description: "The data are not encrypted"},
1: {Name: "des", Description: "Data Encryption Standard (DES) [@?FIPS"},
2: {Name: "3des", Description: "Triple Data Encryption Algorithm [@?SP"},
3: {Name: "twofish", Description: "Twofish Encryption Algorithm [@?Twofish]"},
4: {Name: "blowfish", Description: "Blowfish Encryption Algorithm [@?Blowfish]"},
5: {Name: "aes", Description: "Advanced Encryption Standard (AES) [@?FIPS"},
1: {Name: "des", Description: "Data Encryption Standard (DES) FIPS"},
2: {Name: "3des", Description: "Triple Data Encryption Algorithm SP"},
3: {Name: "twofish", Description: "Twofish Encryption Algorithm Twofish"},
4: {Name: "blowfish", Description: "Blowfish Encryption Algorithm Blowfish"},
5: {Name: "aes", Description: "Advanced Encryption Standard (AES) FIPS"},
},
}
var ContentEncKeyIDElement = &ebml.Binary{
Expand Down Expand Up @@ -2233,8 +2233,8 @@ var AESSettingsCipherModeElement = &ebml.Uinteger{
Definition: "The AES cipher mode used in the encryption",
},
Enums: map[uint64]ebml.Enum{
1: {Name: "aes_ctr", Description: "Counter [@?SP"},
2: {Name: "aes_cbc", Description: "Cipher Block Chaining [@?SP"},
1: {Name: "aes_ctr", Description: "Counter SP"},
2: {Name: "aes_cbc", Description: "Cipher Block Chaining SP"},
},
}

Expand Down Expand Up @@ -2435,7 +2435,7 @@ var FileMediaTypeElement = &ebml.String{
ID: FileMediaTypeID,
ParentID: AttachedFileID,
Name: "file_media_type",
Definition: "Media type of the file following the [@!RFC6838] format",
Definition: "Media type of the file following the RFC6838 format",
},
}
var FileDataElement = &ebml.Binary{
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/aac.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ $ fq -d matroska dv aac.mkv
0x130| 01 00 00 00 00 00 00 3d | .......= | size: 61 0x131-0x138.7 (8)
| | | elements[0:8]: 0x139-0x175.7 (61)
| | | [0]{}: element 0x139-0x13b.7 (3)
0x130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x139-0x139.7 (1)
0x130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x139-0x139.7 (1)
| | | type: "uinteger" 0x13a-NA (0)
0x130| 81 | . | size: 1 0x13a-0x13a.7 (1)
0x130| 01 | . | value: 1 0x13b-0x13b.7 (1)
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/av1.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ $ fq -d matroska dv av1.mkv
0x0130| 01 00 00 00 00 00 00 41 | .......A | size: 65 0x131-0x138.7 (8)
| | | elements[0:9]: 0x139-0x179.7 (65)
| | | [0]{}: element 0x139-0x13b.7 (3)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x139-0x139.7 (1)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x139-0x139.7 (1)
| | | type: "uinteger" 0x13a-NA (0)
0x0130| 81 | . | size: 1 0x13a-0x13a.7 (1)
0x0130| 01 | . | value: 1 0x13b-0x13b.7 (1)
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/avc.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ $ fq -d matroska dv avc.mkv
0x00130| 01 00 00 00 00 00 00 75 | .......u | size: 117 0x132-0x139.7 (8)
| | | elements[0:9]: 0x13a-0x1ae.7 (117)
| | | [0]{}: element 0x13a-0x13c.7 (3)
0x00130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x13a-0x13a.7 (1)
0x00130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x13a-0x13a.7 (1)
| | | type: "uinteger" 0x13b-NA (0)
0x00130| 81 | . | size: 1 0x13b-0x13b.7 (1)
0x00130| 01 | . | value: 1 0x13c-0x13c.7 (1)
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/flac.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ $ fq -d matroska dv flac.mkv
0x130| 01 00 00 00 00 00 00 63 | .......c | size: 99 0x131-0x138.7 (8)
| | | elements[0:8]: 0x139-0x19b.7 (99)
| | | [0]{}: element 0x139-0x13b.7 (3)
0x130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x139-0x139.7 (1)
0x130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x139-0x139.7 (1)
| | | type: "uinteger" 0x13a-NA (0)
0x130| 81 | . | size: 1 0x13a-0x13a.7 (1)
0x130| 01 | . | value: 1 0x13b-0x13b.7 (1)
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/hevc.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ $ fq -d matroska dv hevc.mkv
0x0130| 01 00 00 00 00 00 09 84 | ........ | size: 2436 0x132-0x139.7 (8)
| | | elements[0:9]: 0x13a-0xabd.7 (2436)
| | | [0]{}: element 0x13a-0x13c.7 (3)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x13a-0x13a.7 (1)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x13a-0x13a.7 (1)
| | | type: "uinteger" 0x13b-NA (0)
0x0130| 81 | . | size: 1 0x13b-0x13b.7 (1)
0x0130| 01 | . | value: 1 0x13c-0x13c.7 (1)
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/mp3.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ $ fq -d matroska dv mp3.mkv
0x130| 01 00 00 00 00 00 00 39 | .......9 | size: 57 0x131-0x138.7 (8)
| | | elements[0:7]: 0x139-0x171.7 (57)
| | | [0]{}: element 0x139-0x13b.7 (3)
0x130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x139-0x139.7 (1)
0x130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x139-0x139.7 (1)
| | | type: "uinteger" 0x13a-NA (0)
0x130| 81 | . | size: 1 0x13a-0x13a.7 (1)
0x130| 01 | . | value: 1 0x13b-0x13b.7 (1)
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/mpeg2.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ $ fq -d matroska dv mpeg2.mkv
0x0130| 01 00 00 00 00 00 00 3c | .......< | size: 60 0x131-0x138.7 (8)
| | | elements[0:8]: 0x139-0x174.7 (60)
| | | [0]{}: element 0x139-0x13b.7 (3)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x139-0x139.7 (1)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x139-0x139.7 (1)
| | | type: "uinteger" 0x13a-NA (0)
0x0130| 81 | . | size: 1 0x13a-0x13a.7 (1)
0x0130| 01 | . | value: 1 0x13b-0x13b.7 (1)
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/opus.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ $ fq -d matroska dv opus.mkv
0x130| 01 00 00 00 00 00 00 59 | .......Y | size: 89 0x131-0x138.7 (8)
| | | elements[0:10]: 0x139-0x191.7 (89)
| | | [0]{}: element 0x139-0x13b.7 (3)
0x130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x139-0x139.7 (1)
0x130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x139-0x139.7 (1)
| | | type: "uinteger" 0x13a-NA (0)
0x130| 81 | . | size: 1 0x13a-0x13a.7 (1)
0x130| 01 | . | value: 1 0x13b-0x13b.7 (1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ $ fq dv sweep-with-DC.mkvmerge13.mka
0x10c0| 40 c4 | @. | size: 196 0x10ca-0x10cb.7 (2)
| | | elements[0:9]: 0x10cc-0x118f.7 (196)
| | | [0]{}: element 0x10cc-0x10ce.7 (3)
0x10c0| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x10cc-0x10cc.7 (1)
0x10c0| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x10cc-0x10cc.7 (1)
| | | type: "uinteger" 0x10cd-NA (0)
0x10c0| 81 | . | size: 1 0x10cd-0x10cd.7 (1)
0x10c0| 01 | . | value: 1 0x10ce-0x10ce.7 (1)
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/vorbis.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ $ fq -d matroska dv vorbis.mkv
0x0130| 01 00 00 00 00 00 0d 1c | ........ | size: 3356 0x132-0x139.7 (8)
| | | elements[0:8]: 0x13a-0xe55.7 (3356)
| | | [0]{}: element 0x13a-0x13c.7 (3)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x13a-0x13a.7 (1)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x13a-0x13a.7 (1)
| | | type: "uinteger" 0x13b-NA (0)
0x0130| 81 | . | size: 1 0x13b-0x13b.7 (1)
0x0130| 01 | . | value: 1 0x13c-0x13c.7 (1)
Expand Down
2 changes: 1 addition & 1 deletion format/matroska/testdata/vp8.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ $ fq -d matroska dv vp8.mkv
0x0130| 01 00 00 00 00 00 00 3a | .......: | size: 58 0x131-0x138.7 (8)
| | | elements[0:8]: 0x139-0x172.7 (58)
| | | [0]{}: element 0x139-0x13b.7 (3)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header (using more than 127 tracks is not encouraged) 0x139-0x139.7 (1)
0x0130| d7 | . | id: "track_number" (0xd7) (The track number as used in the Block Header) 0x139-0x139.7 (1)
| | | type: "uinteger" 0x13a-NA (0)
0x0130| 81 | . | size: 1 0x13a-0x13a.7 (1)
0x0130| 01 | . | value: 1 0x13b-0x13b.7 (1)
Expand Down

0 comments on commit c890a28

Please sign in to comment.