[FFmpeg-devel] Make ffmpeg.c and ffplay.c use avctx->request_channels
Benjamin Larsson
banan
Fri Dec 14 11:16:26 CET 2007
Andreas ?man wrote:
> Hello,
>
> Michael Niedermayer wrote:
>> it is just advisory (=many codecs ignore it currently)
>> codecs which fail hard due to request_chan could be changed ...
>
> Here are four patches.
>
> I believe they should be applied at the same time (not in the same
> commit though).
>
> I've fixed the dca.c and ac3dec.c to interpret reqeust_channels
> in a advisory way.
>
> ffmpeg.c now sets up the resampler after the first frame is decoded.
>
> and the changes to ffplay.c is pretty straight forward.
> I have not been able to make SDL work with more than two channels.
> Also, the man-page says that only mono and stereo is supported.
>
> So, If each maintainer can have a look at these please :)
>
> ------------------------------------------------------------------------
>
> Index: libavcodec/dca.c
> ===================================================================
> --- libavcodec/dca.c (revision 11202)
> +++ libavcodec/dca.c (working copy)
> @@ -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;
>
> ------------------------------------------------------------------------
>
>
OK.
MvH
Benjamin Larsson
More information about the ffmpeg-devel
mailing list