From 5a958921a738f2cd928f8339872b74a3c299ff0e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 23 Mar 2013 13:02:59 +0100 Subject: af: remove automatically inserted filters on full reinit Make sure automatically inserted filters are removed on full reinit (they are re-added later if they are really needed). Automatically inserted filters were never explicitly removed, instead, it was expected that redundant conversion filters detach themselves. This didn't work if there were several chained format conversion filters, e.g. s16le->floatle->s16le, which could result from repeated filter insertion and removal. (format filters detach only if input format and output format are the same.) Further, the dummy filter (which exists only because af.c can't handle an empty filter chain for some reason) could introduce bad conversions due to how the format negotiation works. Change the code so that the dummy filter never takes part on format negotiation. (It would be better to fix format negotiation, but that would be much more complicated and would involving fixing all filters.) Simplify af_reinit() and remove the start audio filter parameter. This means format negotiation and filter initialization is run more often, but should be harmless. --- core/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/command.c') diff --git a/core/command.c b/core/command.c index 8f6dfeb4ca..641dfb80e0 100644 --- a/core/command.c +++ b/core/command.c @@ -2274,7 +2274,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) break; } af->control(af, AF_CONTROL_COMMAND_LINE, cmd->args[1].v.s); - af_reinit(sh_audio->afilter, af); + af_reinit(sh_audio->afilter); } break; case MP_CMD_SHOW_CHAPTERS: -- cgit v1.2.3 From 4b5cee4617d0decbf93d06df4f45097fd7e00105 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 6 Apr 2013 22:43:12 +0200 Subject: 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. --- core/command.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'core/command.c') 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; -- cgit v1.2.3