diff options
author | wm4 <wm4@nowhere> | 2015-06-26 23:06:21 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-06-26 23:06:21 +0200 |
commit | d6737c5fab489964558b1eed934969c4f151912d (patch) | |
tree | 3c35d89e60b52b2ba4a787db20f9af527f24b94d /options | |
parent | efb50cabe6a479fad1f440474a1eb1f47e0ce58f (diff) |
audio: replace format name table
Having a big switch() is simpler.
Diffstat (limited to 'options')
-rw-r--r-- | options/m_option.c | 10 |
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)); |