This patch is for discussion only, not ready to commit yet.

We were facing issue when using -hwaccel cuvid, then we were unable to use -filter_complex filters for video streams, this hack fixed it, but i am sure that it is not ready to commit, because it is dirty/ugly fix.

--
Miroslav Slugeň













>From 569a2c69e799d5fed364fbe55de2a49e2bbeab06 Mon Sep 17 00:00:00 2001
From: Miroslav Slugen <thunde...@email.cz>
Date: Sun, 12 Feb 2017 20:15:13 +0100
Subject: [PATCH 1/1] ffmpeg_filter: initialize cuvid for filter_complex

---
 ffmpeg_filter.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index f13f523..1eb75b6 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -1026,6 +1026,26 @@ int configure_filtergraph(FilterGraph *fg)
         fg->graph->nb_threads = filter_complex_nbthreads;
     }
 
+#if CONFIG_CUVID
+    if (!simple) {
+        for (i = 0; i < fg->nb_outputs; i++) {
+            OutputFilter *ofilter = fg->outputs[i];
+            int source_index;
+            if (!ofilter->ost || ofilter->ost->source_index >= 0)
+                continue;
+            if (fg->nb_inputs != 1)
+                continue;
+            for (source_index = nb_input_streams-1; source_index >= 0; source_index--)
+                if (fg->inputs[0]->ist == input_streams[source_index])
+                    break;
+            ofilter->ost->source_index = source_index;
+
+            if (cuvid_transcode_init(ofilter->ost))
+                exit_program(1);
+        }
+    }
+#endif
+
     if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
         return ret;
 
-- 
2.1.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to