[vlc-commits] qsv: set default encoding parameters before calling MFXVideoENCODE_Init()

Steve Lhomme git at videolan.org
Wed Apr 4 18:27:55 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Aug 31 18:03:41 2017 +0200| [b68cc8b5cda7ca5ab7b6343c81f693738ebe7b8a] | committer: Steve Lhomme

qsv: set default encoding parameters before calling MFXVideoENCODE_Init()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b68cc8b5cda7ca5ab7b6343c81f693738ebe7b8a
---

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

diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index eb8019c6cf..920c4857d2 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -37,6 +37,8 @@
 
 #define SOUT_CFG_PREFIX     "sout-qsv-"
 
+#define QSV_HAVE_CO2 (MFX_VERSION_MAJOR > 1 || (MFX_VERSION_MAJOR == 1 && MFX_VERSION_MINOR >= 6))
+
 /* Default wait on Intel Media SDK SyncOperation. Almost useless when async-depth >= 2 */
 #define QSV_SYNCPOINT_WAIT  (420)
 /* Encoder input synchronization busy wait loop time */
@@ -406,6 +408,24 @@ static int Open(vlc_object_t *this)
     uint8_t pps_buf[128];
     mfxExtCodingOptionSPSPPS headers;
     mfxExtBuffer *extended_params[1] = {(mfxExtBuffer *)&headers};
+    mfxExtCodingOption co = {
+        .Header.BufferId = MFX_EXTBUFF_CODING_OPTION,
+        .Header.BufferSz = sizeof(co),
+        .PicTimingSEI = MFX_CODINGOPTION_ON,
+    };
+#if QSV_HAVE_CO2
+    mfxExtCodingOption2 co2 = {
+        .Header.BufferId = MFX_EXTBUFF_CODING_OPTION2,
+        .Header.BufferSz = sizeof(co2),
+    };
+#endif
+    mfxExtBuffer *init_params[] =
+    {
+        (mfxExtBuffer*)&co,
+#if QSV_HAVE_CO2
+        (mfxExtBuffer*)&co2,
+#endif
+    };
     mfxVersion ver = { { MFX_VERSION_MINOR, MFX_VERSION_MAJOR } };
 
     uint8_t *p_extra;
@@ -536,6 +556,14 @@ static int Open(vlc_object_t *this)
         goto nomem;
     msg_Dbg(enc, "Requested %d surfaces for work", alloc_request.NumFrameSuggested);
 
+    sys->params.ExtParam    = (mfxExtBuffer**)&init_params;
+    sys->params.NumExtParam =
+#if QSV_HAVE_CO2
+            2;
+#else
+            1;
+#endif
+
     /* Initializing MFX_Encoder */
     sts = MFXVideoENCODE_Init(sys->session, &sys->params);
     if (sts == MFX_ERR_NONE)



More information about the vlc-commits mailing list