[FFmpeg-devel] [PATCH 1/2] ffplay: reorder the filters to ensure that inputs of the custom filters are merged first

Marton Balint cus at passwd.hu
Sun Feb 2 20:47:46 CET 2014


For more info see http://ffmpeg.org/pipermail/ffmpeg-user/2013-December/018761.html

Signed-off-by: Marton Balint <cus at passwd.hu>
---
 ffplay.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ffplay.c b/ffplay.c
index d8dcf84..0e173dc 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1727,7 +1727,8 @@ static int get_video_frame(VideoState *is, AVFrame *frame, AVPacket *pkt, int *s
 static int configure_filtergraph(AVFilterGraph *graph, const char *filtergraph,
                                  AVFilterContext *source_ctx, AVFilterContext *sink_ctx)
 {
-    int ret;
+    int ret, i;
+    int nb_filters = graph->nb_filters;
     AVFilterInOut *outputs = NULL, *inputs = NULL;
 
     if (filtergraph) {
@@ -1755,6 +1756,10 @@ static int configure_filtergraph(AVFilterGraph *graph, const char *filtergraph,
             goto fail;
     }
 
+    /* Reorder the filters to ensure that inputs of the custom filters are merged first */
+    for (i = 0; i < graph->nb_filters - nb_filters; i++)
+        FFSWAP(AVFilterContext*, graph->filters[i], graph->filters[i + nb_filters]);
+
     ret = avfilter_graph_config(graph, NULL);
 fail:
     avfilter_inout_free(&outputs);
-- 
1.8.4



More information about the ffmpeg-devel mailing list