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

Stefano Sabatini stefano.sabatini-lala
Thu Jun 21 15:44:42 CEST 2007


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: libavcodec/utils.c
> ===================================================================
> --- libavcodec/utils.c	(revision 9381)
> +++ libavcodec/utils.c	(working copy)
[...]
> +int av_video_frame_rate_abbr_string (char *buf, int buf_rate, int video_frame_rate_abbr)
                                                      ^^^^^^^^^
> +{
> +    VideoFrameRateAbbr info= video_frame_rate_abbrs[video_frame_rate_abbr];
> +
> +    /* print header */
> +    if (video_frame_rate_abbr < 0) {
> +        snprintf (buf, buf_rate,
> +                  "abbr      " " rate_num" " rate_den"
> +            );
> +    } else if (video_frame_rate_abbr < video_frame_rate_abbrs_nb) {
> +        snprintf (buf, buf_rate,
> +                  "%-10s" "   %5d " "   %4d  ",
> +                  info.abbr,
> +                  info.rate_num,
> +                  info.rate_den
> +            );
> +    } else
> +        return -1;
> +
> +    return 0;
> +}

Bad automatic string replace: I meant buf_size instead.

> Index: libavcodec/avcodec.h
> ===================================================================
> --- libavcodec/avcodec.h	(revision 9381)
> +++ libavcodec/avcodec.h	(working copy)
> @@ -2919,6 +2919,35 @@
>   */
>  int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
>  
> +/**
> + * Prints in \p buf the string corresponding to the video frame size
> + * abbreviation with number \p video_frame_size_abbr.
> + *
> + * @return 0 if video_size_abbr is negative or it corresponds to a valid
> + * video frame size abbreviation, a negative value otherwise.
> + * @param[in,out] buf the buffer where to write the string
> + * @param[in] buf_size the size of \p buf
> + * @param[in] video_frame_size_abbr the number of the video size abbreviation
> + * whose information you want to get, or a negative number to print a
> + * header.
> + */
> +int av_video_frame_size_abbr_string (char *buf, int buf_size, int video_frame_size_abbr);
> +
> +/**
> + * Prints in buf the string corresponding to the video frame rate
> + * abbreviation with number \p video_frame_rate_abbr.
> + *
> + * @return 0 if video_rate_abbr is negative or it corresponds to a valid
> + * video frame rate abbreviation, a negative value otherwise.
> + * @param[in,out] buf the buffer where to write the string
> + * @param[in] buf_size the size of \p buf
> + * @param[in] video_frame_rate_abbr the number of the video rate abbreviation
> + * whose information you want to get, or a negative number to print a
> + * header.
> + */
> +int av_video_frame_rate_abbr_string (char *buf, int buf_rate, int video_frame_rate_abbr);
                                                       ^^^^^^^^

again I meant buf_size.

Hope it is OK this time.

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-05.patch
Type: text/x-diff
Size: 7439 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070621/3fe80a69/attachment.patch>



More information about the ffmpeg-devel mailing list