[FFmpeg-devel] [PATCH] List supported video size and rate abbreviations
Stefano Sabatini
stefano.sabatini-lala
Fri Jun 1 11:44:44 CEST 2007
Hi ffmpeg developers.
As promised, here it is a patch, based on the "List supported pixel
formats" patch, which lets the user list the supported abbreviations
for the -s (video size) and -r (video rate) option.
Suggested log message:
"Add support for listing the supported video size and rate abbreviations".
In order to support this functionality, this patch does:
* define a constant video_size_rate_abv_nb with the number of
supported size/rate abbreviations, computed as follows in
libavformat/utils.c:
int const video_size_rate_abv_nb= sizeof (frame_abvs) / sizeof (AbvEntry);
and export it in libavformat/avformat.h
* define the functions avcodec_video_{size,rate}_abv_string, modeled
after avcodec_string and avcodec_pix_fmt_string, which fill a string
buffer with the corresponding abbreviation info, and export them in
libavformat/avformat.h.
* define the functions list_video_{size,frame}_abvs in ffmpeg.c,
modify opt_frame_{size,frame} to get them support the 'list'
argument, and update the corresponding documentation strings in the
options struct.
* update doc/ffmpeg-doc.texi
The corresponding output looks like this:
sds at santefisi:~/src/ffmpeg-snapshot$ ./ffmpeg -r list
FFmpeg version SVN-r9165, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --prefix=/home/sds --mandir=/home/sds/share/man --enable-gpl --enable-swscaler --enable-pp
libavutil version: 49.4.0
libavcodec version: 51.40.4
libavformat version: 51.12.1
built on May 31 2007 18:47:00, gcc: 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
name frame_rate frame_rate_base
ntsc 30000 1001
pal 25 1
qntsc 30000 1001
qpal 25 1
sntsc 30000 1001
spal 25 1
film 24 1
ntsc-film 24000 1001
sds at santefisi:~/src/ffmpeg-snapshot$ ./ffmpeg -s list
FFmpeg version SVN-r9165, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --prefix=/home/sds --mandir=/home/sds/share/man --enable-gpl --enable-swscaler --enable-pp
libavutil version: 49.4.0
libavcodec version: 51.40.4
libavformat version: 51.12.1
built on May 31 2007 18:47:00, gcc: 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
name width height
ntsc 720 480
pal 720 576
qntsc 352 240
...
whuxga 7680 4800
cga 320 200
ega 640 350
hd480 852 480
hd720 1280 720
hd1080 1920 1080
Problems
* These functions have this interface:
char *avcodec_video_{rate,size}_abv_string (char *buf, int buf_size, int video_{rate,size}_abv)
They're the only functions with the "avcodec_" prefix in avformat.h,
which is retained to keep consistency with avcodec_string and
avcodec_pix_fmt_string, other functions in libavformat/utils.c don't
have any prefix or or have "av_" as prefix.
Which prefix policy do you prefer in this case? Possible solutions:
* to keep "avcodec_" as prefix
* use "av_" as prefix
* use no prefix (consistency with parse_image_size/parse_frame_rate)
* maybe keep "avcodec_" as prefix and move AbvEntry, frame_abvs and friends to
libavcodec/utils.c where they seem to me to fit more appropriately
(this should go into another patch).
* These functions return a char pointer (the pointer to the filled
buffer), or NULL if the video_{rate,size}_abv argument is
meaningless.
Do you prefer (maybe it would be more consistent with the rest of
the code) to return just an int (1 in case of success, -1 or 0 in
case of meaningless argument)?
* What about to delete the size abbreviations listing in
ffmpeg-doc.texi? This will avoid synchronization problems between
the abbreviations struct and docs.
Sorry for the long mail.
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-00.patch
Type: text/x-diff
Size: 8683 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070601/a2c828de/attachment.patch>
More information about the ffmpeg-devel
mailing list