aboutsummaryrefslogtreecommitdiffstats
path: root/cmdutils.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-12 18:40:26 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-10-12 18:40:26 +0000
commitf7ead94c69bf7b7f8ef63fbe8c869982e2bb5048 (patch)
tree7a384b92352ab755e0531699d0232728669f2a51 /cmdutils.c
parentf5b05b951c81f23c8a79f1c19b2657f85d43f93a (diff)
downloadffmpeg-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.c41
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 */