lavfi: Always propagate hw_frames_ctx through links
[ffmpeg.git] / libavfilter / vf_hwdownload.c
index 0ba1d98aa61eb4fc70d8e1c244fcdafaf532beaa..aee8d23cb78f9f221370145c55dd1dbb6e30e5cc 100644 (file)
@@ -16,7 +16,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "libavutil/avassert.h"
 #include "libavutil/buffer.h"
 #include "libavutil/hwcontext.h"
 #include "libavutil/log.h"
@@ -141,7 +140,8 @@ static int hwdownload_filter_frame(AVFilterLink *link, AVFrame *input)
         goto fail;
     }
 
-    output = ff_get_video_buffer(outlink, outlink->w, outlink->h);
+    output = ff_get_video_buffer(outlink, ctx->hwframes->width,
+                                 ctx->hwframes->height);
     if (!output) {
         err = AVERROR(ENOMEM);
         goto fail;
@@ -153,6 +153,9 @@ static int hwdownload_filter_frame(AVFilterLink *link, AVFrame *input)
         goto fail;
     }
 
+    output->width  = outlink->w;
+    output->height = outlink->h;
+
     err = av_frame_copy_props(output, input);
     if (err < 0)
         goto fail;
@@ -209,4 +212,5 @@ AVFilter ff_vf_hwdownload = {
     .priv_class    = &hwdownload_class,
     .inputs        = hwdownload_inputs,
     .outputs       = hwdownload_outputs,
+    .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
 };