qsvenc: Allow use of hw_device_ctx to make the internal session
authorMark Thompson <sw@jkqxz.net>
Sat, 4 Mar 2017 23:57:37 +0000 (23:57 +0000)
committerMark Thompson <sw@jkqxz.net>
Wed, 14 Jun 2017 21:26:32 +0000 (22:26 +0100)
(cherry picked from commit 3d197514e613ccd9eab43180c0a7c8b09a307606)

libavcodec/qsvenc.c

index 64227ce..5eb506f 100644 (file)
@@ -699,6 +699,13 @@ static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q)
             return ret;
         }
 
+        q->session = q->internal_session;
+    } else if (avctx->hw_device_ctx) {
+        ret = ff_qsv_init_session_device(avctx, &q->internal_session,
+                                         avctx->hw_device_ctx, q->load_plugins);
+        if (ret < 0)
+            return ret;
+
         q->session = q->internal_session;
     } else {
         ret = ff_qsv_init_internal_session(avctx, &q->internal_session,