diff options
author | wm4 <wm4@nowhere> | 2016-08-05 12:23:42 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-08-05 12:23:42 +0200 |
commit | 9f70117233c88b6cf4329c93e0d89f56f96acbac (patch) | |
tree | 0fb8aa26019a0c683b871d9ed47e5bd68d2dea16 | |
parent | eccabeb81c67953ca15f8d318fccc0f7f4370020 (diff) | |
download | mpv-9f70117233c88b6cf4329c93e0d89f56f96acbac.tar.bz2 mpv-9f70117233c88b6cf4329c93e0d89f56f96acbac.tar.xz |
ao_null: use channel list option type for channel-layouts suboption
-rw-r--r-- | audio/out/ao_null.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/audio/out/ao_null.c b/audio/out/ao_null.c index 7d45795d9e..ac3f8348b5 100644 --- a/audio/out/ao_null.c +++ b/audio/out/ao_null.c @@ -57,7 +57,7 @@ struct priv { // (This is not needed by the AO API, but many AOs behave this way.) int outburst; // samples - char **channel_layouts; + struct m_channels channel_layouts; }; static void drain(struct ao *ao) @@ -91,15 +91,9 @@ static int init(struct ao *ao) ao->untimed = priv->untimed; struct mp_chmap_sel sel = {.tmp = ao}; - if (priv->channel_layouts) { - for (int n = 0; priv->channel_layouts[n]; n++) { - struct mp_chmap map = {0}; - if (!mp_chmap_from_str(&map, bstr0(priv->channel_layouts[n]))) { - MP_FATAL(ao, "Invalid channel map in option.\n"); - return -1; - } - mp_chmap_sel_add_map(&sel, &map); - } + if (priv->channel_layouts.num_chmaps) { + for (int n = 0; n < priv->channel_layouts.num_chmaps; n++) + mp_chmap_sel_add_map(&sel, &priv->channel_layouts.chmaps[n]); } else { mp_chmap_sel_add_any(&sel); } @@ -244,7 +238,7 @@ const struct ao_driver audio_out_null = { OPT_FLOATRANGE("latency", latency_sec, 0, 0, 100), OPT_FLAG("broken-eof", broken_eof, 0), OPT_FLAG("broken-delay", broken_delay, 0), - OPT_STRINGLIST("channel-layouts", channel_layouts, 0), + OPT_CHANNELS("channel-layouts", channel_layouts, 0), {0} }, }; |