[FFmpeg-devel] [PATCH 5/5] Implement add_filter() and use it in configure_filters(). Factorize.
Michael Niedermayer
michaelni
Mon Aug 16 16:07:11 CEST 2010
On Fri, Aug 13, 2010 at 04:30:47PM +0200, Stefano Sabatini wrote:
> On date Sunday 2010-07-25 12:44:41 +0200, Stefano Sabatini encoded:
> > ---
> > ffmpeg.c | 58 ++++++++++++++++++++++++++++++----------------------------
> > 1 files changed, 30 insertions(+), 28 deletions(-)
>
> Updated.
> --
> FFmpeg = Fantastic and Faithful Magic Picky Elitist Guru
> ffmpeg.c | 56 ++++++++++++++++++++++++++++++--------------------------
> 1 file changed, 30 insertions(+), 26 deletions(-)
> a57c6f38477cef75d1e17d56f53a9db8695ae7df 0003-Implement-add_filter-and-use-it-in-configure_filters.patch
> From 9265aebd2be004cbb978a727a16a7261ed22810f Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Sun, 25 Jul 2010 12:26:52 +0200
> Subject: [PATCH 3/5] Implement add_filter() and use it in configure_filters().
> Factorize.
>
> ---
> ffmpeg.c | 56 ++++++++++++++++++++++++++++++--------------------------
> 1 files changed, 30 insertions(+), 26 deletions(-)
>
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 9a2eced..1737b72 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -400,32 +400,48 @@ static AVFilter output_filter =
> .outputs = (AVFilterPad[]) {{ .name = NULL }},
> };
>
> +static int add_filter(AVFilterGraph *graph_ctx, AVFilterContext **filter_ctx,
> + const char *name, const char *inst_name, const char *args, void *opaque,
> + AVFilterContext *last_filter_ctx)
> +{
> + AVFilter *filter;
> + int ret;
> +
> + if (!(filter = avfilter_get_by_name(name)))
> + return AVERROR(EINVAL);
> + if ((ret = avfilter_open(filter_ctx, filter, inst_name)) < 0)
> + return ret;
> + if ((ret = avfilter_init_filter(*filter_ctx, args, opaque)) < 0)
> + return ret;
> + if (last_filter_ctx) {
> + if ((ret = avfilter_link(last_filter_ctx, 0, *filter_ctx, 0)) < 0)
> + return ret;
> + }
> + avfilter_graph_add_filter(graph_ctx, *filter_ctx);
> +
> + return 0;
> +}
> +
> static int configure_filters(AVInputStream *ist, AVOutputStream *ost)
> {
> - AVFilterContext *last_filter, *filter;
> + AVFilterContext *last_filter;
> /** filter graph containing all filters including input & output */
> AVCodecContext *codec = ost->st->codec;
> AVCodecContext *icodec = ist->st->codec;
> char args[255];
> int ret;
>
> - graph = av_mallocz(sizeof(AVFilterGraph));
> -
> - if ((ret = avfilter_open(&ist->input_video_filter, avfilter_get_by_name("buffer"), "src")) < 0)
> - return ret;
> - if ((ret = avfilter_open(&ist->output_video_filter, &output_filter, "out")) < 0)
> + if ((ret = avfilter_register(&output_filter)) < 0)
there was no avfilter_register() call before so thats not factorizing
also if the api is too complex it should be fixed not wraper unctions
be put in ffmpeg.c
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100816/f8efca27/attachment.pgp>
More information about the ffmpeg-devel
mailing list