1
1
mirror of https://github.com/wader/fq.git synced 2024-11-26 21:55:57 +03:00

Merge pull request #779 from wader/avi-cleanup-consts

avi: Add stream type constants
This commit is contained in:
Mattias Wadman 2023-10-07 21:52:36 +02:00 committed by GitHub
commit b921a5f91e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
package riff package riff
// TODO: // TODO:
// mp3 mappig, samples can span? // mp3 mappig, samples can span over sample ranges?
// hevc mapping? // hevc mapping?
// DV handler https://learn.microsoft.com/en-us/windows/win32/directshow/dv-data-in-the-avi-file-format // DV handler https://learn.microsoft.com/en-us/windows/win32/directshow/dv-data-in-the-avi-file-format
// palette change // palette change
@ -62,11 +62,18 @@ var aviListTypeDescriptions = scalar.StrMapDescription{
"rec ": "Chunk group", "rec ": "Chunk group",
} }
const (
aviStrhTypeAudio = "auds"
aviStrhTypeMidi = "mids"
aviStrhTypeVideo = "vids"
aviStrhTypeText = "txts"
)
var aviStrhTypeDescriptions = scalar.StrMapDescription{ var aviStrhTypeDescriptions = scalar.StrMapDescription{
"auds": "Audio stream", aviStrhTypeAudio: "Audio stream",
"mids": "MIDI stream", aviStrhTypeMidi: "MIDI stream",
"txts": "Text stream", aviStrhTypeText: "Text stream",
"vids": "Video stream", aviStrhTypeVideo: "Video stream",
} }
const ( const (
@ -352,7 +359,7 @@ func aviDecode(d *decode.D) any {
typ := stream.typ typ := stream.typ
switch typ { switch typ {
case "vids": case aviStrhTypeVideo:
// BITMAPINFOHEADER // BITMAPINFOHEADER
d.BitsLeft() d.BitsLeft()
d.FieldU32("bi_size") d.FieldU32("bi_size")
@ -397,7 +404,7 @@ func aviDecode(d *decode.D) any {
stream.hasFormat = true stream.hasFormat = true
} }
case "auds": case aviStrhTypeAudio:
// WAVEFORMATEX // WAVEFORMATEX
formatTag := d.FieldU16("format_tag", format.WAVTagNames) formatTag := d.FieldU16("format_tag", format.WAVTagNames)
d.FieldU16("channels") d.FieldU16("channels")
@ -537,9 +544,9 @@ func aviDecode(d *decode.D) any {
d.FieldValueStr("type", stream.typ) d.FieldValueStr("type", stream.typ)
d.FieldValueStr("handler", stream.handler) d.FieldValueStr("handler", stream.handler)
switch stream.typ { switch stream.typ {
case "auds": case aviStrhTypeAudio:
d.FieldValueUint("format_tag", stream.formatTag, format.WAVTagNames) d.FieldValueUint("format_tag", stream.formatTag, format.WAVTagNames)
case "vids": case aviStrhTypeVideo:
d.FieldValueStr("compression", stream.compression) d.FieldValueStr("compression", stream.compression)
} }