summaryrefslogtreecommitdiffstats
path: root/core/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-06 22:43:12 +0200
committerwm4 <wm4@nowhere>2013-05-12 21:24:55 +0200
commit4b5cee4617d0decbf93d06df4f45097fd7e00105 (patch)
treeb6d293e86d83ab5c3efd99153aa7a7a134d2937f /core/command.c
parent586b75ad0840e154835ae67c7720b71bd36f8cc9 (diff)
downloadmpv-4b5cee4617d0decbf93d06df4f45097fd7e00105.tar.bz2
mpv-4b5cee4617d0decbf93d06df4f45097fd7e00105.tar.xz
core: use channel map on demuxer level too
This helps passing the channel layout correctly from decoder to audio filter chain. (Because that part "reuses" the demuxer level codec parameters, which is very disgusting.) Note that ffmpeg stuff already passed the channel layout via mp_copy_lav_codec_headers(). So other than easier dealing with the demuxer/decoder parameters mess, there's no real advantage to doing this. Make the --channels option accept a channel map. Since simple numbers map to standard layouts with the given number of channels, this is downwards compatible. Likewise for demux_rawaudio.
Diffstat (limited to 'core/command.c')
-rw-r--r--core/command.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/core/command.c b/core/command.c
index 641dfb80e0..115ea9236f 100644
--- a/core/command.c
+++ b/core/command.c
@@ -667,20 +667,10 @@ static int mp_property_channels(m_option_t *prop, int action, void *arg,
return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_PRINT:
- switch (mpctx->sh_audio->channels) {
- case 1:
- *(char **) arg = talloc_strdup(NULL, "mono");
- break;
- case 2:
- *(char **) arg = talloc_strdup(NULL, "stereo");
- break;
- default:
- *(char **) arg = talloc_asprintf(NULL, "%d channels",
- mpctx->sh_audio->channels);
- }
+ *(char **) arg = mp_chmap_to_str(&mpctx->sh_audio->channels);
return M_PROPERTY_OK;
case M_PROPERTY_GET:
- *(int *)arg = mpctx->sh_audio->channels;
+ *(int *)arg = mpctx->sh_audio->channels.num;
return M_PROPERTY_OK;
}
return M_PROPERTY_NOT_IMPLEMENTED;