[FFmpeg-devel] [PATCH] Move the video size and rate abbreviations system from libavformat to libavcodec

Diego Biurrun diego
Sat Jun 9 10:36:30 CEST 2007


On Sat, Jun 09, 2007 at 08:58:52AM +0200, Stefano Sabatini wrote:
> On date Thursday 2007-06-07 15:11:15 +0200, Stefano Sabatini encoded:
> > On date Wednesday 2007-06-06 17:03:54 +0200, Michael Niedermayer encoded:
> > > 
> > > On Wed, Jun 06, 2007 at 04:58:28PM +0200, Aurelien Jacobs wrote:
> > > > On Wed, 06 Jun 2007 16:31:20 +0200
> > > > Baptiste Coudurier <baptiste.coudurier at smartjog.com> wrote:
> > > [...]
> > > > > Right. What about keeping parse* in avformat, making them calling 
> > > > > av_parse* (which will be added to avcodec), deprecate them, and remove 
> > > > > them with next major bump ? So you have clean avcodec API right now.
> > > > 
> > > > That's a nice plan. I'm for it.
> > > 
> > > me too :)
> > 
> > Yes, it's a good idea :-).
> > 
> > So the attached patch does as follows:
> > 
> > * Defines in libavcodec/utils.c:
> >   * the definition of AbvEntry
> >   * the array frame_abvs
> >   * av_parse_image_size
> >   * av_parse_frame_rate
> > 
> >   Struct defintion and array and functions are moved *unchanged* (but
> >   the "av_" prefix for the parse_image_size and parse_frame_rate
> >   functions) from libavformat/utils.c.
> > 
> > * Exports the functions av_parse_image_size and av_parse_frame_rate in 
> >   libavcodec/avcodec.h.
> > 
> > * Modifies parse_image_size and parse_frame_rate in libavformat/utils.c
> >   to only call the corresponding av_ functions in libavcodec.
> >   
> > * Declares parse_image_size and parse_frame_rate deprecated in
> >   libavformat/avformat.h.
> > 
> > All this without to break abi.
> > 
> > Suggested changelog message:
> > "Moves the parse_image_size and parse_frame_rate functionality from
> > libavformat to libavcodec, deprecates parse_image_size and
> > parse_frame_rate in favour of av_parse_image_size and
> > av_parse_frame_rate."
> > 
> > Just another nitpick: I'd prefer to call parse_image_size and
> > parse_frame_rate in this way:
> > 
> > parse_image_size -> av_parse_video_frame_size
> > parse_frame_rate -> av_parse_video_frame_rate
> > 
> > for both symmetry and unambiguity ("frame" may refer to both a video or
> > an audio frame). If you like this I can provide another patch with the
> > corresponding changes.
> 
> Here it is.

.. some spelling nitpicks ..

> --- libavcodec/utils.c	(revision 9235)
> +++ libavcodec/utils.c	(working copy)
> @@ -1347,3 +1347,113 @@
> +
> +static AbvEntry frame_abvs[] = {
> +    { "ntsc",      720, 480, 30000, 1001 },
> +    { "pal",       720, 576,    25,    1 },
> +    { "qntsc",     352, 240, 30000, 1001 }, /* VCD compliant ntsc */
> +    { "qpal",      352, 288,    25,    1 }, /* VCD compliant pal */
> +    { "sntsc",     640, 480, 30000, 1001 }, /* square pixel ntsc */
> +    { "spal",      768, 576,    25,    1 }, /* square pixel pal */

NTSC, PAL

> --- libavcodec/avcodec.h	(revision 9235)
> +++ libavcodec/avcodec.h	(working copy)
> @@ -3143,6 +3143,32 @@
>  
>  extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
>  
> +/**
> + * Parses \p str and put in \p width_ptr and \p height_ptr the detected values.
> + *
> + * @return 0 in case of a succesfull parsing, -1 otherwise

succesSfuL

> + * @param[in] str the string to parse: it has to be a string in the format
> + * <width>x<height> or a valid video frame size abbreviation.
> + * @param[in,out] width_ptr pointer to the variable which will contain the detected
> + * frame width value
> + * @param[in,out] height_ptr pointer to the varaible which will contain the detected

varIAble

> + * @return 0 in case of a succesfull parsing, -1 otherwise

dito

Diego




More information about the ffmpeg-devel mailing list