[FFmpeg-devel] [PATCH] Make the scale filter only declare the supported formats
Stefano Sabatini
stefano.sabatini-lala
Wed Jan 6 23:33:38 CET 2010
On date Wednesday 2010-01-06 21:56:30 +0100, Stefano Sabatini encoded:
> Index: libavfilter-soc/ffmpeg/libavfilter/vf_scale.c
> ===================================================================
> --- libavfilter-soc.orig/ffmpeg/libavfilter/vf_scale.c 2010-01-06 21:53:47.000000000 +0100
> +++ libavfilter-soc/ffmpeg/libavfilter/vf_scale.c 2010-01-06 21:55:39.000000000 +0100
> @@ -68,15 +68,24 @@
>
> static int query_formats(AVFilterContext *ctx)
> {
> - AVFilterFormats *formats;
> + AVFilterFormats *in_formats = NULL;
> + AVFilterFormats *out_formats = NULL;
> + enum PixelFormat pix_fmt;
> + int ret;
>
> if (ctx->inputs[0]) {
> - formats = avfilter_all_colorspaces();
> - avfilter_formats_ref(formats, &ctx->inputs[0]->out_formats);
> + for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
> + if (sws_isSupportedInput(pix_fmt))
> + if ((ret = avfilter_add_colorspace(&in_formats, pix_fmt)) < 0)
> + return ret;
> + avfilter_formats_ref(in_formats, &ctx->inputs[0]->out_formats);
> }
> if (ctx->outputs[0]) {
> - formats = avfilter_all_colorspaces();
> - avfilter_formats_ref(formats, &ctx->outputs[0]->in_formats);
> + for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
> + if (sws_isSupportedOutput(pix_fmt))
> + if ((ret = avfilter_add_colorspace(&out_formats, pix_fmt)) < 0)
> + return ret;
> + avfilter_formats_ref(out_formats, &ctx->outputs[0]->in_formats);
> }
>
> return 0;
Fixed memleak and simplified.
--
FFmpeg = Freak and Fundamental Minimalistic Purposeless Ecumenical Governor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make-scale-filter-declare-managed-fmts.patch
Type: text/x-diff
Size: 1386 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100106/7d1cb050/attachment.patch>
More information about the ffmpeg-devel
mailing list