OSDN Git Service

ffmpeg: pass the hwaccel frames context to the decoder
authorAnton Khirnov <anton@khirnov.net>
Thu, 29 Sep 2016 08:29:10 +0000 (10:29 +0200)
committerTimo Rothenpieler <timo@rothenpieler.org>
Thu, 29 Sep 2016 13:57:32 +0000 (15:57 +0200)
ffmpeg.c

index d0f247e..9a8e65a 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2547,6 +2547,13 @@ static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat
             }
             continue;
         }
+
+        if (ist->hw_frames_ctx) {
+            s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx);
+            if (!s->hw_frames_ctx)
+                return AV_PIX_FMT_NONE;
+        }
+
         ist->active_hwaccel_id = hwaccel->id;
         ist->hwaccel_pix_fmt   = *p;
         break;