summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-26 23:06:21 +0200
committerwm4 <wm4@nowhere>2015-06-26 23:06:21 +0200
commitd6737c5fab489964558b1eed934969c4f151912d (patch)
tree3c35d89e60b52b2ba4a787db20f9af527f24b94d /options
parentefb50cabe6a479fad1f440474a1eb1f47e0ce58f (diff)
downloadmpv-d6737c5fab489964558b1eed934969c4f151912d.tar.bz2
mpv-d6737c5fab489964558b1eed934969c4f151912d.tar.xz
audio: replace format name table
Having a big switch() is simpler.
Diffstat (limited to 'options')
-rw-r--r--options/m_option.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 8acdc8390d..347a2726db 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -2217,13 +2217,17 @@ static int parse_afmt(struct mp_log *log, const m_option_t *opt,
if (!bstrcmp0(param, "help")) {
mp_info(log, "Available formats:");
- for (int i = 0; af_fmtstr_table[i].name; i++)
- mp_info(log, " %s", af_fmtstr_table[i].name);
+ for (int i = 1; i < AF_FORMAT_COUNT; i++)
+ mp_info(log, " %s", af_fmt_to_str(i));
mp_info(log, "\n");
return M_OPT_EXIT - 1;
}
- int fmt = af_str2fmt_short(param);
+ int fmt = 0;
+ for (int i = 1; i < AF_FORMAT_COUNT; i++) {
+ if (bstr_equals0(param, af_fmt_to_str(i)))
+ fmt = i;
+ }
if (!fmt) {
mp_err(log, "Option %.*s: unknown format name: '%.*s'\n",
BSTR_P(name), BSTR_P(param));