[Ffmpeg-devel] [PATCH] DTS multichannel
Kostya
kostya.shishkov
Thu Apr 26 05:17:14 CEST 2007
On Wed, Apr 25, 2007 at 04:25:18PM -0400, Justin Ruggles wrote:
> Hi,
>
> Here is a patch to add multichannel support to the native DTS decoder.
> It also utilizes the downmixing coeffients, which is not done currently.
> The default coefficients are based on the comments at the bottom of
> dtsdata.h.
>
> downmix 5.1 to stereo:
> ffmpeg -f dts -i stream.dts -acodec pcm_s16le -ac 2 stream-stereo.wav
>
> copy 5.1 direct to wav:
> ffmpeg -f dts -i stream.dts -acodec pcm_s16le -ac 6 stream-5p1.wav
>
> Note that channel reordering is not done yet, so the multichannel output
> would be in MPEG-2/4 channel order (C,L,R,LS,RS,LFE).
>
> -Justin
Looks ok except minor nitpick:
> @@ -1140,10 +1156,24 @@
> }
> //set AVCodec values with parsed data
> avctx->sample_rate = s->sample_rate;
> - avctx->channels = 2; //FIXME
> +
> + channels = s->prim_channels + !!s->lfe;
> + if(avctx->channels == 0) {
> + avctx->channels = channels;
> + } else if(channels < avctx->channels) {
> + av_log(avctx, AV_LOG_ERROR, "DTS source channels are less than specified: output to %d channels.\n", channels);
> + avctx->channels = channels;
This should be IMHO av_log(avctx, AV_LOG_DEBUG, "Downmixing to %d channels\n", channels)
or dropped at all
> + }
> + if(avctx->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;
> + }
> +
And feel free to work on multichannel code in DCA decoder.
More information about the ffmpeg-devel
mailing list