[FFmpeg-devel] [PATCH] Add supported_samplerates field to AVCodec

Stefano Sabatini stefano.sabatini-lala
Mon Apr 21 17:51:25 CEST 2008


On date Monday 2008-04-21 16:56:42 +0200, Michael Niedermayer encoded:
> On Mon, Apr 21, 2008 at 12:27:08AM +0200, Stefano Sabatini wrote:
> > Hi,
> > 
> > as suggested in this thread:
> > http://thread.gmane.org/20080407143527.GA15487 at geppetto
> > 
> > I'm not sure what is better if "supported_framerates" (more consistent
> > with AVCodec.supported_framerates) or "supported_frame_rates" (more
> > consistent with AVFrame.sample_rate).
[...]
> > Index: libavcodec/avcodec.h
> > ===================================================================
> > --- libavcodec/avcodec.h	(revision 12912)
> > +++ libavcodec/avcodec.h	(working copy)
> > @@ -30,7 +30,7 @@
> >  #include "libavutil/avutil.h"
> >  
> >  #define LIBAVCODEC_VERSION_MAJOR 51
> > -#define LIBAVCODEC_VERSION_MINOR 55
> > +#define LIBAVCODEC_VERSION_MINOR 56
> >  #define LIBAVCODEC_VERSION_MICRO  0
> >  
> >  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> > @@ -2241,6 +2241,7 @@
> >      const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
> >      const enum PixelFormat *pix_fmts;       ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
> >      const char *long_name;                  ///< descriptive name for the codec, meant to be more human readable than \p name
> 
> > +    const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by -1
> 
> i would prefer if the array where terminated by 0

I don't like this solution, in this way we can't distinguish if a
codec doesn't support a certain value or if we don't know or we don't
want to specify the valid values.

For example suppose we define a common function which checks if the
provided value for the samplerate is valid looking at the
supported_samplerates value, if it is set to NULL then the check is
skipped and will be eventually executed in the open_codec function,
while if the value is set to -1 (empty list of valid values) then it
will always fail.

And for some codecs (for example an hypotetical codec which can
support an indefinite number of different samplerates) would be
impossible to execute properly the check if we can't distinguish
between the two cases: unknown/unspecified list versus empty list.

Regards.
-- 
FFmpeg =  Furious & Fucking Mean Porno Enigmatic God




More information about the ffmpeg-devel mailing list