changeset 6022:6dd429a5d0be libavcodec

Make DCA decoder honor avctx->request_channels in a more advisory way.
author andoma
date Sat, 15 Dec 2007 07:01:33 +0000
parents 90b36c43c4ef
children 78b46e3f9df2
files dca.c
diffstat 1 files changed, 3 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/dca.c	Sat Dec 15 07:00:19 2007 +0000
+++ b/dca.c	Sat Dec 15 07:01:33 2007 +0000
@@ -1159,23 +1159,12 @@
     avctx->bit_rate = s->bit_rate;
 
     channels = s->prim_channels + !!s->lfe;
-    avctx->channels = avctx->request_channels;
-    if(avctx->channels == 0) {
-        avctx->channels = channels;
-    } else if(channels < avctx->channels) {
-        av_log(avctx, AV_LOG_WARNING, "DTS source channels are less than "
-               "specified: output to %d channels.\n", channels);
-        avctx->channels = channels;
-    }
-    if(avctx->channels == 2) {
+    if(avctx->request_channels == 2 && s->prim_channels > 2) {
+        channels = 2;
         s->output = DCA_STEREO;
-    } else if(avctx->channels != channels) {
-        av_log(avctx, AV_LOG_ERROR, "Cannot downmix DTS to %d channels.\n",
-               avctx->channels);
-        return -1;
     }
 
-    channels = avctx->channels;
+    avctx->channels = channels;
     if(*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
         return -1;
     *data_size = 0;