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

Stefano Sabatini stefano.sabatini-lala
Thu Jun 21 12:47:34 CEST 2007


On date Saturday 2007-06-02 16:40:40 +0200, Stefano Sabatini encoded:
> On date Saturday 2007-06-02 13:38:24 +0200, Michael Niedermayer encoded:
> > On Sat, Jun 02, 2007 at 10:29:01AM +0200, Stefano Sabatini wrote:
> > > On date Friday 2007-06-01 21:16:25 +0200, Michael Niedermayer encoded:
> [...]
> > > > > +static void list_video_rate_abvs(void)
> > > > 
> > > > what is abvs? if you mean abbreviation thats abbr (try google with both)
> > > 
> > > I agree with you, I was conforming to the abbreviation for
> > > abbreviation (sic! ;-)) choosed in
> > > libavformat/utils.c:{frame_abvs,AbvEntry}.
> > > 
> > > If you prefer I can use "abbr" consistently throughout the patch then
> > > send a cosmetic patch to change frame_abvs and AbvEntry and the code
> > > that use them accordingly, or even better send *before* the cosmetic
> > > patch *then* this one.
> > 
> > AbvEntry and the other non exported abv names should be changed
> > the order of patches doesnt matter, choose whichever you like best
> [...]
> > > > > +/**
> > > > > + * Number of supported video size and rate abbreviations supported.
> > > > > + */
> > > > > +extern int const video_size_rate_abv_nb;
> > > > 
> > > > would need a av_ or avcodec_ prefix
> > > 
> > > OK, then I prefer avcodec_ for consistency with
> > > avcodec_video_{size,frame}_abv_string.
> > 
> > avcodec in libavformat/avformat.h is not ok, and iam not sure if the
> > whole should not rather be in libavcodec
> [...]
> > > > and iam not completely sure if i like this implementation, somehow i
> > > > dont ...
> > 
> > what i meant here is that it might make more sense to export a
> > size and a framerate table directly
> > with pix_fmt the information which is stored is likely going t change so
> > directly exporting the table cant be done but here, hell what do you want
> > to store in a table of abbreviations and width/height?
> > (and yes the size and framerate tables should be split)
> 
> Thank you Michael for the much needed explanations.
> 
> I think the best thing to do is to redesign the abbreviations system,
> which I'll discuss into another thread, *then* eventually I'll jump
> back to this one.

Here I am again!

I moved the video size/rate abbreviations system from libavformat to
libavcodec and splitted video frame size and rate abbreviations table
in previous patches. 

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).

The output looks like this:

sds at santefisi:~/src/ffmpeg-svn$ ./ffmpeg -s list
FFmpeg version SVN-r9381, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  configuration: --prefix=/home/sds --mandir=/home/sds/share/man --enable-gpl --enable-swscaler --enable-pp --enable-libfaad --enable-x11grab
  libavutil version: 49.4.0
  libavcodec version: 51.40.4
  libavformat version: 51.12.1
  built on Jun 21 2007 11:53:15, gcc: 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
abbr       width height
ntsc         720   480
pal          720   576
qntsc        352   240
[...]
wquxga      3840  2400
whsxga      6400  4096
whuxga      7680  4800
cga          320   200
ega          640   350
hd480        852   480
hd720       1280   720
hd1080      1920  1080

sds at santefisi:~/src/ffmpeg-svn$ ./ffmpeg -r list
FFmpeg version SVN-r9381, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  configuration: --prefix=/home/sds --mandir=/home/sds/share/man --enable-gpl --enable-swscaler --enable-pp --enable-libfaad --enable-x11grab
  libavutil version: 49.4.0
  libavcodec version: 51.40.4
  libavformat version: 51.12.1
  built on Jun 21 2007 12:25:48, gcc: 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
abbr       rate_num rate_den
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

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



More information about the ffmpeg-devel mailing list