Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
feb764bd by Steve Lhomme at 2026-02-13T09:11:57+00:00
qsv: use non-deprecated API's when compiling with libvpl

MFXInit is replaced by MFXLoad/filter implementations/MFXCreateSession.

- - - - -
5368f9f9 by Steve Lhomme at 2026-02-13T09:11:57+00:00
qsv: disable load of software implementation when only hardware ones are 
requested

- - - - -


1 changed file:

- modules/codec/qsv.c


Changes:

=====================================
modules/codec/qsv.c
=====================================
@@ -37,6 +37,9 @@
 
 
 #include <vpl/mfxvideo.h>
+#if MFX_VERSION_MAJOR > 1
+# include <vpl/mfxdispatcher.h>
+#endif
 #include "../demux/mpeg/timestamps.h"
 
 #define SOUT_CFG_PREFIX     "sout-qsv-"
@@ -279,6 +282,9 @@ typedef struct async_task_t
 
 typedef struct
 {
+#if MFX_VERSION_MAJOR > 1
+    mfxLoader        loader;
+#endif
     mfxSession       session;             // Intel Media SDK Session.
     mfxVideoParam    params;              // Encoding parameters.
     QSVFrame         *work_frames;        // IntelMediaSDK's frame pool.
@@ -368,6 +374,9 @@ static void delete_sys(encoder_sys_t *sys)
 {
     MFXVideoENCODE_Close(sys->session);
     MFXClose(sys->session);
+#if MFX_VERSION_MAJOR > 1
+    MFXUnload(sys->loader);
+#endif
 
     assert(vlc_list_is_empty(&sys->packets));
 
@@ -412,7 +421,6 @@ static int Open(vlc_object_t *this)
         (mfxExtBuffer*)&co2,
 #endif
     };
-    mfxVersion    ver = { { 1, 1 } };
     mfxIMPL       impl;
     mfxVideoParam param_out = { 0 };
 
@@ -435,13 +443,44 @@ static int Open(vlc_object_t *this)
         return VLC_ENOMEM;
 
     /* Initialize dispatcher, it will loads the actual SW/HW Implementation */
+#if MFX_VERSION_MAJOR > 1
+    sys->loader = MFXLoad();
+    if (sys->loader == NULL) {
+        msg_Err(enc, "Unable to find an Intel Media SDK implementation.");
+        free(sys);
+        return VLC_EGENERIC;
+    }
+
+    mfxConfig cfg = NULL;
+    if (!var_InheritBool(enc, SOUT_CFG_PREFIX "software"))
+    {
+        cfg = MFXCreateConfig(sys->loader);
+        if (unlikely(cfg == NULL)) {
+            msg_Err(enc, "Unable to create hardware-only implementation.");
+            MFXUnload(sys->loader);
+            free(sys);
+            return VLC_EGENERIC;
+        }
+        mfxVariant implValue;
+        implValue.Type     = MFX_VARIANT_TYPE_U32;
+        implValue.Data.U32 = MFX_IMPL_TYPE_HARDWARE;
+        MFXSetConfigFilterProperty(cfg, (mfxU8 *)"mfxImplDescription.Impl", 
implValue);
+    }
+
+    sts = MFXCreateSession(sys->loader, 0, &sys->session);
+#else
+    mfxVersion    ver = { { 1, 1 } };
     sts = MFXInit(MFX_IMPL_AUTO_ANY, &ver, &sys->session);
+#endif
 
     if (sts != MFX_ERR_NONE) {
         if (sts == MFX_ERR_UNSUPPORTED)
             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 MFX_VERSION_MAJOR > 1
+        MFXUnload(sys->loader);
+#endif
         free(sys);
         return VLC_EGENERIC;
     }
@@ -452,10 +491,12 @@ static int Open(vlc_object_t *this)
 
     /* Checking if we are on software and are allowing it */
     MFXQueryIMPL(sys->session, &impl);
+#if MFX_VERSION_MAJOR < 1
     if (!var_InheritBool(enc, SOUT_CFG_PREFIX "software") && (impl & 
MFX_IMPL_SOFTWARE)) {
         msg_Err(enc, "No hardware implementation found and software mode 
disabled");
         goto error;
     }
+#endif
 
     msg_Dbg(enc, "Using Intel QuickSync Video %s implementation",
         impl & MFX_IMPL_HARDWARE ? "hardware" : "software");



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/4ca9a6ae6c4be8a251c99b23a3a182a0a2cfcb7c...5368f9f9e996623b6a6009578bbc3dfb99aebee5

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/4ca9a6ae6c4be8a251c99b23a3a182a0a2cfcb7c...5368f9f9e996623b6a6009578bbc3dfb99aebee5
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to