]> git.sesse.net Git - ffmpeg/commitdiff
libavfilter: Support the forks ABI for buffer sinks
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 31 Aug 2012 20:02:08 +0000 (22:02 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 1 Sep 2012 04:05:08 +0000 (06:05 +0200)
With this change avconv compiled against libav and linked to ffmpegs libs
will run through the whole fate testsuite without any crashes.
857 tests pass, the remaining tests fail one way or another, which is
to be expected as avconv is not a drop in replacement for ffmpeg
The testsuite used was the ffmpeg fate testsuite, not libavs.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/allfilters.c
libavfilter/buffersink.c
libavfilter/sink_buffer.c

index 9e68d4c6dd8c41990413b5c316d91b99abd2ae56..6842ec95d5aafab710355e74506c3e079284e2eb 100644 (file)
@@ -64,8 +64,11 @@ void avfilter_register_all(void)
     REGISTER_FILTER (ANULLSRC,    anullsrc,    asrc);
     REGISTER_FILTER (FLITE,       flite,       asrc);
 
+#if !AV_HAVE_INCOMPATIBLE_FORK_ABI
     REGISTER_FILTER (ABUFFERSINK, abuffersink, asink);
+#endif
     REGISTER_FILTER (ANULLSINK,   anullsink,   asink);
+    REGISTER_FILTER (FFABUFFERSINK, ffabuffersink, asink);
 
     REGISTER_FILTER (ALPHAEXTRACT, alphaextract, vf);
     REGISTER_FILTER (ALPHAMERGE,  alphamerge,  vf);
@@ -140,7 +143,10 @@ void avfilter_register_all(void)
     REGISTER_FILTER (SMPTEBARS,   smptebars,   vsrc);
     REGISTER_FILTER (TESTSRC,     testsrc,     vsrc);
 
+#if !AV_HAVE_INCOMPATIBLE_FORK_ABI
     REGISTER_FILTER (BUFFERSINK,  buffersink,  vsink);
+#endif
+    REGISTER_FILTER (FFBUFFERSINK,ffbuffersink,vsink);
     REGISTER_FILTER (NULLSINK,    nullsink,    vsink);
 
     /* multimedia filters */
index e66a099c1453e364f47c2b18ccdfe4324db86cd0..50cd6d4e96bbea19be9aaaff1390cd33cde13a69 100644 (file)
@@ -141,7 +141,11 @@ int av_buffersink_read_samples(AVFilterContext *ctx, AVFilterBufferRef **pbuf,
 }
 
 AVFilter avfilter_vsink_buffer = {
+#if AV_HAVE_INCOMPATIBLE_FORK_ABI
+    .name      = "buffersink",
+#else
     .name      = "buffersink_old",
+#endif
     .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
     .priv_size = sizeof(BufferSinkContext),
     .uninit    = uninit,
@@ -156,7 +160,11 @@ AVFilter avfilter_vsink_buffer = {
 };
 
 AVFilter avfilter_asink_abuffer = {
+#if AV_HAVE_INCOMPATIBLE_FORK_ABI
+    .name      = "abuffersink",
+#else
     .name      = "abuffersink_old",
+#endif
     .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
     .priv_size = sizeof(BufferSinkContext),
     .uninit    = uninit,
index 95ba590d4ae846bc39e25ac5683c78c41e9eb1a2..0b685e3d3107c8554cda3ba88c8e9c29a54116d7 100644 (file)
@@ -143,7 +143,10 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx,
     int ret;
     *bufref = NULL;
 
-    av_assert0(!strcmp(ctx->filter->name, "buffersink") || !strcmp(ctx->filter->name, "abuffersink"));
+    av_assert0(    !strcmp(ctx->filter->name, "buffersink")
+                || !strcmp(ctx->filter->name, "abuffersink")
+                || !strcmp(ctx->filter->name, "ffbuffersink")
+                || !strcmp(ctx->filter->name, "ffabuffersink"));
 
     /* no picref available, fetch it from the filterchain */
     if (!av_fifo_size(buf->fifo)) {
@@ -166,7 +169,8 @@ int av_buffersink_get_buffer_ref(AVFilterContext *ctx,
 
 AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx)
 {
-    av_assert0(!strcmp(ctx->filter->name, "buffersink"));
+    av_assert0(   !strcmp(ctx->filter->name, "buffersink")
+               || !strcmp(ctx->filter->name, "ffbuffersink"));
 
     return ctx->inputs[0]->frame_rate;
 }
@@ -176,7 +180,10 @@ int av_buffersink_poll_frame(AVFilterContext *ctx)
     BufferSinkContext *buf = ctx->priv;
     AVFilterLink *inlink = ctx->inputs[0];
 
-    av_assert0(!strcmp(ctx->filter->name, "buffersink") || !strcmp(ctx->filter->name, "abuffersink"));
+    av_assert0(   !strcmp(ctx->filter->name, "buffersink")
+               || !strcmp(ctx->filter->name, "abuffersink")
+               || !strcmp(ctx->filter->name, "ffbuffersink")
+               || !strcmp(ctx->filter->name, "ffabuffersink"));
 
     return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + ff_poll_frame(inlink);
 }
@@ -218,6 +225,23 @@ static int vsink_query_formats(AVFilterContext *ctx)
     return 0;
 }
 
+AVFilter avfilter_vsink_ffbuffersink = {
+    .name      = "ffbuffersink",
+    .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
+    .priv_size = sizeof(BufferSinkContext),
+    .init_opaque = vsink_init,
+    .uninit    = vsink_uninit,
+
+    .query_formats = vsink_query_formats,
+
+    .inputs    = (const AVFilterPad[]) {{ .name    = "default",
+                                    .type          = AVMEDIA_TYPE_VIDEO,
+                                    .end_frame     = end_frame,
+                                    .min_perms     = AV_PERM_READ | AV_PERM_PRESERVE, },
+                                  { .name = NULL }},
+    .outputs   = (const AVFilterPad[]) {{ .name = NULL }},
+};
+
 AVFilter avfilter_vsink_buffersink = {
     .name      = "buffersink",
     .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them available to the end of the filter graph."),
@@ -299,6 +323,22 @@ static int asink_query_formats(AVFilterContext *ctx)
     return 0;
 }
 
+AVFilter avfilter_asink_ffabuffersink = {
+    .name      = "ffabuffersink",
+    .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),
+    .init_opaque = asink_init,
+    .uninit    = asink_uninit,
+    .priv_size = sizeof(BufferSinkContext),
+    .query_formats = asink_query_formats,
+
+    .inputs    = (const AVFilterPad[]) {{ .name     = "default",
+                                    .type           = AVMEDIA_TYPE_AUDIO,
+                                    .filter_samples = filter_samples,
+                                    .min_perms      = AV_PERM_READ | AV_PERM_PRESERVE, },
+                                  { .name = NULL }},
+    .outputs   = (const AVFilterPad[]) {{ .name = NULL }},
+};
+
 AVFilter avfilter_asink_abuffersink = {
     .name      = "abuffersink",
     .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them available to the end of the filter graph."),