[FFmpeg-devel] Per codec defaults

Robert Swain robert.swain
Thu Jan 17 02:04:51 CET 2008


Hello,

After discussing per codec defaults with M?ns, he had the idea of
adding a defaults function to the AVCodec struct and calling
avcodec_get_context_defaults2 with an AVCodec.

This sounds like a great idea but after inspecting the code in
ffmpeg.c it seems that avcodec_get_context_defaults2 isn't quite the
right place to call the function as it seems to wipe out the
AVCodecContext then apply some flags and other stuff. The problem is
that, within this function, the AVCodec isn't known.

I think it should be called (if existing) just after ffmpeg.c:2882 and
just before ffmpeg.c:2884. At this point the AVCodec has just been
successfully discovered by avcodec_find_encoder() and what looks to be
the command line option parsing for video encoding options is just
about to be conducted. I think this is the perfect place as it's the
last chance for defaults to be applied. The call would of course be
added for audio and subtitles as well, though this seems a little
awkward.

How does this sound? Any better suggestions? At least this way the
code is there for codecs to define their own defaults and it just has
to be done for each codec so it has no effect on anything in the mean
time.

Rob



More information about the ffmpeg-devel mailing list