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>
Sun, 2 Apr 2017 18:06:33 +0000 (19:06 +0100)
libavcodec/qsvenc.c

index b2f2b4d..bd8c243 100644 (file)
@@ -693,6 +693,13 @@ static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q)
         }
 
         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,
                                            q->load_plugins);