[FFmpeg-devel] [PATCH] add init/uninit code to cmdutils.c
Stefano Sabatini
stefano.sabatini-lala
Sat Sep 25 15:07:59 CEST 2010
On date Saturday 2010-09-25 14:19:55 +0200, Reimar D?ffinger encoded:
> Hello,
> this avoids some code duplication between ffmpeg and ffplay and also frees
> the AVFormatContext::key value.
> The tests pass, but I do not know the code well enough to be 100%
> certain that using SWS_BICUBIC always instead of sws_flags is ok for
> the option parsing.
[...]
> Index: cmdutils.c
> ===================================================================
> --- cmdutils.c (revision 25163)
> +++ cmdutils.c (working copy)
> @@ -56,6 +56,25 @@
>
> const int this_year = 2010;
>
> +void init_opts(void)
> +{
> + int i;
> + for (i = 0; i < AVMEDIA_TYPE_NB; i++)
> + avcodec_opts[i] = avcodec_alloc_context2(i);
> + avformat_opts = avformat_alloc_context();
> + sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, NULL, NULL, NULL);
> +}
> +
> +void uninit_opts(void)
> +{
> + int i;
> + for (i = 0; i < AVMEDIA_TYPE_NB; i++)
> + av_freep(&avcodec_opts[i]);
> + av_freep(&avformat_opts->key);
Why is AVFormatContext.key special?
Shouldn't we have a function for automatically clean it up?
Regards.
--
FFmpeg = Formidable and Free Multimedia Perennial Extravagant Generator
More information about the ffmpeg-devel
mailing list