[FFmpeg-devel] [PATCH] List supported video size and rate abbreviations

Stefano Sabatini stefano.sabatini-lala
Mon Jun 25 13:09:34 CEST 2007


On date Thursday 2007-06-21 15:44:42 +0200, Stefano Sabatini encoded:
> On date Thursday 2007-06-21 12:47:34 +0200, Stefano Sabatini encoded:
> > Suggested log message:
> > "Add support for listing the supported video size and rate abbreviations".
> > 
> > In order to support this functionality, this patch does:
> > 
> > * defines the functions
> >   libavcodec/utils.c:av_video_frame_{size,rate}_abbr_string, modeled
> >   after avcodec_string and avcodec_pix_fmt_string, which fill a string
> >   buffer with the corresponding abbreviation info, and exports them in
> >   libavcodec/avcodec.h.
> > 
> > * defines the functions list_video_frame_{size,frame}_abbrs in
> >   ffmpeg.c, modifies opt_frame_{size,rate} to get them support the
> >   'list' argument, and updates the corresponding documentation strings
> >   in the options struct.
> >   Once applied another patch is required for reindentation.
> > 
> > * updates doc/ffmpeg-doc.texi accordingly
> > 
> > Please note that rather than export the abbreviations tables in
> > avcodec.h as Michael suggested, I preferred to define the
> > av_video_frame_{size,rate}_abbr_string functions, which seemed to me
> > more consistent with the avcodec_pix_fmt_string/list_pix_fmts method,
> > please let me know if you prefer Michael's suggestion (export
> > video_frame_{rate,size}_abbrs in avcodec.h, no need for av_*_string
> > corresponding functions).
> > 

[...]
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 9381)
> +++ ffmpeg.c	(working copy)
> @@ -2064,12 +2064,29 @@
>      av_log_level = atoi(arg);
>  }
>  
> +static void list_video_frame_rate_abbrs(void)
> +{
> +    int i;
> +    char str[128];
> +    i=-1;
> +
> +    while (!av_video_frame_rate_abbr_string(str, sizeof(str), i)) {
> +        printf("%s\n", str);
> +        i++;
> +    }
> +}

Replaced with:

static void list_video_frame_rate_abbrs(void)
{
    char str[128];
    int i=-1;

    while (!av_video_frame_rate_abbr_string(str, sizeof(str), i++))
        printf("%s\n", str);
}

Now it looks slightly shorter and nicer.

[...]
> +static void list_video_frame_size_abbrs(void)
> +{
> +    int i;
> +    char str[128];
> +    i=-1;
> +
> +    while (!av_video_frame_size_abbr_string(str, sizeof(str), i)) {
> +        printf("%s\n", str);
> +        i++;
> +    }
> +}

Same replacement as above.

Cheers.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: list-video-size-rate-abvs-06.patch
Type: text/x-diff
Size: 7381 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070625/45185ed7/attachment.patch>



More information about the ffmpeg-devel mailing list