[FFmpeg-cvslog] r25090 - trunk/ffmpeg.c
Martin Storsjö
martin
Thu Sep 9 23:13:11 CEST 2010
On Thu, 9 Sep 2010, Reimar D?ffinger wrote:
> On Thu, Sep 09, 2010 at 10:58:13PM +0200, mstorsjo wrote:
> > Author: mstorsjo
> > Date: Thu Sep 9 22:58:13 2010
> > New Revision: 25090
> >
> > Log:
> > Update the audio sample rate when doing lowres audio decoding, before opening the decoder
> >
> > Modified:
> > trunk/ffmpeg.c
> >
> > Modified: trunk/ffmpeg.c
> > ==============================================================================
> > --- trunk/ffmpeg.c Thu Sep 9 22:23:41 2010 (r25089)
> > +++ trunk/ffmpeg.c Thu Sep 9 22:58:13 2010 (r25090)
> > @@ -3241,6 +3241,11 @@ static void opt_input_file(const char *f
> > input_codecs[nb_icodecs++] = avcodec_find_decoder_by_name(audio_codec_name);
> > if(audio_disable)
> > st->discard= AVDISCARD_ALL;
> > + /* Note that av_find_stream_info can add more streams, and we
> > + * currently have no chance of setting up lowres decoding
> > + * early enough for them. */
> > + if (dec->lowres)
> > + audio_sample_rate >>= dec->lowres;
>
>
> I really can't see how this kind of hack would belong here.
The same is done for width/height around lines 3262-3265 already, but I
know that's not a proper reason.
> Like this every single application using FFmpeg would have to duplicate
> this code (a fact that also is undocumented) in order to support lowres?
No, AVCodecContext->sample_rate is updated (and width and height for video
likewise) when opening the codec when lowres is enabled.
> If yes that's not acceptable IMO, if no and only FFmpeg needs that IMO
> FFmpeg is broken and needs to be fixed.
That might be the case. The issue is that the sample rate and video
dimensions is copied out from the decoder AVCodecContext before the
decoder is opened, where the parameters are updated to the actual ones.
// Martin
More information about the ffmpeg-cvslog
mailing list