Skip to content

Commit 55521bb

Browse files
committed
avi: Add stream type constants
1 parent 9e92cdc commit 55521bb

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

format/riff/avi.go

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package riff
22

33
// TODO:
4-
// mp3 mappig, samples can span?
4+
// mp3 mappig, samples can span over sample ranges?
55
// hevc mapping?
66
// DV handler https://learn.microsoft.com/en-us/windows/win32/directshow/dv-data-in-the-avi-file-format
77
// palette change
@@ -62,11 +62,18 @@ var aviListTypeDescriptions = scalar.StrMapDescription{
6262
"rec ": "Chunk group",
6363
}
6464

65+
const (
66+
aviStrhTypeAudio = "auds"
67+
aviStrhTypeMidi = "mids"
68+
aviStrhTypeVideo = "vids"
69+
aviStrhTypeText = "txts"
70+
)
71+
6572
var aviStrhTypeDescriptions = scalar.StrMapDescription{
66-
"auds": "Audio stream",
67-
"mids": "MIDI stream",
68-
"txts": "Text stream",
69-
"vids": "Video stream",
73+
aviStrhTypeAudio: "Audio stream",
74+
aviStrhTypeMidi: "MIDI stream",
75+
aviStrhTypeText: "Text stream",
76+
aviStrhTypeVideo: "Video stream",
7077
}
7178

7279
const (
@@ -352,7 +359,7 @@ func aviDecode(d *decode.D) any {
352359
typ := stream.typ
353360

354361
switch typ {
355-
case "vids":
362+
case aviStrhTypeVideo:
356363
// BITMAPINFOHEADER
357364
d.BitsLeft()
358365
d.FieldU32("bi_size")
@@ -397,7 +404,7 @@ func aviDecode(d *decode.D) any {
397404
stream.hasFormat = true
398405
}
399406

400-
case "auds":
407+
case aviStrhTypeAudio:
401408
// WAVEFORMATEX
402409
formatTag := d.FieldU16("format_tag", format.WAVTagNames)
403410
d.FieldU16("channels")
@@ -537,9 +544,9 @@ func aviDecode(d *decode.D) any {
537544
d.FieldValueStr("type", stream.typ)
538545
d.FieldValueStr("handler", stream.handler)
539546
switch stream.typ {
540-
case "auds":
547+
case aviStrhTypeAudio:
541548
d.FieldValueUint("format_tag", stream.formatTag, format.WAVTagNames)
542-
case "vids":
549+
case aviStrhTypeVideo:
543550
d.FieldValueStr("compression", stream.compression)
544551
}
545552

0 commit comments

Comments
 (0)