[vlc-devel] [PATCH 4/7] qsv: keep the incoming decoder device

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 14 16:00:26 CEST 2020


---
 modules/codec/qsv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index dec2ef2668f..be35315d717 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -294,6 +294,7 @@ typedef struct
 
     picture_pool_t   *input_pool;         // pool of pictures to feed the decoder
                                           //  as it doesn't like constantly changing buffers
+    vlc_decoder_device *dec_device;
 } encoder_sys_t;
 
 static block_t *Encode(encoder_t *, picture_t *);
@@ -425,6 +426,11 @@ static int Open(vlc_object_t *this)
     if (unlikely(!sys))
         return VLC_ENOMEM;
 
+    if (enc->vctx_in)
+    {
+        sys->dec_device = vlc_video_context_HoldDevice(enc->vctx_in);
+    }
+
     /* Initialize dispatcher, it will loads the actual SW/HW Implementation */
     sts = MFXInit(MFX_IMPL_AUTO_ANY, &ver, &sys->session);
 
@@ -433,6 +439,8 @@ static int Open(vlc_object_t *this)
             msg_Err(enc, "Intel Media SDK implementation not supported, is your card plugged?");
         else
             msg_Err(enc, "Unable to find an Intel Media SDK implementation (%d).", sts);
+        if (sys->dec_device)
+            vlc_decoder_device_Release(sys->dec_device);
         free(sys);
         return VLC_EGENERIC;
     }
@@ -648,6 +656,8 @@ static void Close(vlc_object_t *this)
     async_task_t_fifo_Release(&sys->packets);
     if (sys->input_pool)
         picture_pool_Release(sys->input_pool);
+    if (sys->dec_device)
+        vlc_decoder_device_Release(sys->dec_device);
     free(sys);
 }
 
-- 
2.26.2



More information about the vlc-devel mailing list