On 21 Nov 2013, at 14:30, Anton Khirnov <[email protected]> wrote: > > On Mon, 18 Nov 2013 12:41:44 +0100, Tim Walker <[email protected]> wrote: >> --- >> libavcodec/dcadec.c | 21 ++++++++++++++------- >> 1 file changed, 14 insertions(+), 7 deletions(-) >> >> diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c >> index 7af5e5c..8835133 100644 >> --- a/libavcodec/dcadec.c >> +++ b/libavcodec/dcadec.c >> @@ -1288,7 +1288,8 @@ static int dca_filter_channels(DCAContext *s, int >> block_index) >> } >> >> /* Down mixing */ >> - if (s->avctx->request_channels == 2 && s->prim_channels > 2) { >> + if (s->prim_channels > 2 && >> + s->avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) { >> dca_downmix(s->samples_chanptr, s->amode, s->downmix_coef, >> s->channel_order_tab); >> } >> >> @@ -1803,8 +1804,11 @@ static int dca_decode_frame(AVCodecContext *avctx, >> void *data, >> if (s->amode < 16) { >> avctx->channel_layout = dca_core_channel_layout[s->amode]; >> >> - if (s->xch_present && (!avctx->request_channels || >> - avctx->request_channels > num_core_channels >> + !!s->lfe)) { >> + if (s->xch_present && >> + (!avctx->request_channels || >> + avctx->request_channels > num_core_channels + !!s->lfe) && >> + (!avctx->request_channel_layout || >> + avctx->request_channel_layout & AV_CH_BACK_CENTER)) { > > I'm a bit confused by this part. > If we're only handling request_channel_layout == stereo > (and temporarily request_channels == 2, which is converted to > request_channel_layout in init), why are you checking request_channels here?
No, the DCA decoder also handles disabling XCh via request_channels, by checking whether (request_channels < num_core_channels + lfe + xch). Not sure how to properly handle that, short of hardcoding the layout for request_channels == 5 (-> 5.0) or == 6 (-> 5.1) or checking request_channels as I do above. Tim _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
