diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-10-12 18:40:26 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-10-12 18:40:26 +0000 |
commit | f7ead94c69bf7b7f8ef63fbe8c869982e2bb5048 (patch) | |
tree | 7a384b92352ab755e0531699d0232728669f2a51 /cmdutils.c | |
parent | f5b05b951c81f23c8a79f1c19b2657f85d43f93a (diff) | |
download | ffmpeg-f7ead94c69bf7b7f8ef63fbe8c869982e2bb5048.tar.gz |
Factorize definition of the output_filter defined in both ffplay.c and
ffmpeg.c.
Replace it with a more generic definition which can be shared.
Originally committed as revision 25453 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'cmdutils.c')
-rw-r--r-- | cmdutils.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/cmdutils.c b/cmdutils.c index 313b37deb1..fca783ca94 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -747,3 +747,44 @@ int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t reordered_pts, int6 return pts; } + +#if CONFIG_AVFILTER + +static int ffsink_init(AVFilterContext *ctx, const char *args, void *opaque) +{ + FFSinkContext *priv = ctx->priv; + + if (!opaque) + return AVERROR(EINVAL); + *priv = *(FFSinkContext *)opaque; + + return 0; +} + +static void null_end_frame(AVFilterLink *inlink) { } + +static int ffsink_query_formats(AVFilterContext *ctx) +{ + FFSinkContext *priv = ctx->priv; + enum PixelFormat pix_fmts[] = { priv->pix_fmt, PIX_FMT_NONE }; + + avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts)); + return 0; +} + +AVFilter ffsink = { + .name = "ffsink", + .priv_size = sizeof(FFSinkContext), + .init = ffsink_init, + + .query_formats = ffsink_query_formats, + + .inputs = (AVFilterPad[]) {{ .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .end_frame = null_end_frame, + .min_perms = AV_PERM_READ, }, + { .name = NULL }}, + .outputs = (AVFilterPad[]) {{ .name = NULL }}, +}; + +#endif /* CONFIG_AVFILTER */ |