Update format list generator to support aliases.

master
Icedream 2018-07-09 12:23:15 +02:00
parent 4187d0dfda
commit 426c26c613
Signed by: icedream
GPG Key ID: 1573F6D8EFE4D0CF
1 changed files with 9 additions and 7 deletions

View File

@ -51,21 +51,23 @@ var (
muxingSupported := text[2] == 'E' muxingSupported := text[2] == 'E'
text = text[4:] text = text[4:]
cols := strings.Fields(text) cols := strings.Fields(text)
id := cols[0] ids := strings.Split(cols[0], ",")
name := strings.Join(cols[1:], " ") name := strings.Join(cols[1:], " ")
code += fmt.Sprintf(` for _, id := range ids {
code += fmt.Sprintf(`
// %s // %s
Format_%s = %q Format_%s = %q
`, name, strings.ToUpper(id), id) `, name, strings.ToUpper(id), id)
if demuxingSupported { if demuxingSupported {
code += fmt.Sprintf(` // %s code += fmt.Sprintf(` // %s
Demux_Format_%s = Format_%s Demux_Format_%s = Format_%s
`, name, strings.ToUpper(id), strings.ToUpper(id)) `, name, strings.ToUpper(id), strings.ToUpper(id))
} }
if muxingSupported { if muxingSupported {
code += fmt.Sprintf(` // %s code += fmt.Sprintf(` // %s
Mux_Format_%s = Format_%s Mux_Format_%s = Format_%s
`, name, strings.ToUpper(id), strings.ToUpper(id)) `, name, strings.ToUpper(id), strings.ToUpper(id))
}
} }
} }