]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg_filter.c
avfilter/vf_displace: remove useless requirement that SAR matches between input streams
[ffmpeg] / ffmpeg_filter.c
index 817f48f473d0748dfe8f41afff530da9b0e73468..aacc185059e655586a1057fae97eaf4ae5cf4acc 100644 (file)
@@ -1046,9 +1046,15 @@ int configure_filtergraph(FilterGraph *fg)
     if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0)
         goto fail;
 
-    if (hw_device_ctx) {
+    if (filter_hw_device || hw_device_ctx) {
+        AVBufferRef *device = filter_hw_device ? filter_hw_device->device_ref
+                                               : hw_device_ctx;
         for (i = 0; i < fg->graph->nb_filters; i++) {
-            fg->graph->filters[i]->hw_device_ctx = av_buffer_ref(hw_device_ctx);
+            fg->graph->filters[i]->hw_device_ctx = av_buffer_ref(device);
+            if (!fg->graph->filters[i]->hw_device_ctx) {
+                ret = AVERROR(ENOMEM);
+                goto fail;
+            }
         }
     }