Imported Upstream version 6.1
[platform/upstream/ffmpeg.git] / libavcodec / qsv_internal.h
index 8131acd..c2d301b 100644 (file)
@@ -23,9 +23,9 @@
 
 #include "config.h"
 
-#if CONFIG_VAAPI
+#if CONFIG_VAAPI && !defined(_WIN32) // Do not enable for libva-win32 on Windows
 #define AVCODEC_QSV_LINUX_SESSION_HANDLE
-#endif //CONFIG_VAAPI
+#endif //CONFIG_VAAPI && !defined(_WIN32)
 
 #ifdef AVCODEC_QSV_LINUX_SESSION_HANDLE
 #include <stdio.h>
 #endif
 #include <fcntl.h>
 #include <va/va.h>
-#include <va/va_drm.h>
 #include "libavutil/hwcontext_vaapi.h"
 #endif
 
-#include <mfx/mfxvideo.h>
+#include <mfxvideo.h>
 
 #include "libavutil/frame.h"
 
@@ -51,7 +50,7 @@
 #define ASYNC_DEPTH_DEFAULT 4       // internal parallelism
 
 #define QSV_MAX_ENC_PAYLOAD 2       // # of mfxEncodeCtrl payloads supported
-#define QSV_MAX_ENC_EXTPARAM 2
+#define QSV_MAX_ENC_EXTPARAM 8      // # of mfxEncodeCtrl extparam supported
 
 #define QSV_MAX_ROI_NUM 256
 
@@ -65,6 +64,9 @@
     ((MFX_VERSION.Major > (MAJOR)) ||                           \
     (MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
 
+#define QSV_ONEVPL       QSV_VERSION_ATLEAST(2, 0)
+#define QSV_HAVE_OPAQUE  !QSV_ONEVPL
+
 typedef struct QSVMid {
     AVBufferRef *hw_frames_ref;
     mfxHDLPair *handle_pair;
@@ -82,6 +84,12 @@ typedef struct QSVFrame {
 #if QSV_VERSION_ATLEAST(1, 34)
     mfxExtAV1FilmGrainParam av1_film_grain_param;
 #endif
+
+#if QSV_VERSION_ATLEAST(1, 35)
+    mfxExtMasteringDisplayColourVolume mdcv;
+    mfxExtContentLightLevelInfo clli;
+#endif
+
     mfxExtBuffer *ext_param[QSV_MAX_FRAME_EXT_PARAMS];
     int num_ext_params;
 
@@ -100,6 +108,7 @@ typedef struct QSVSession {
     AVBufferRef *va_device_ref;
     AVHWDeviceContext *va_device_ctx;
 #endif
+    void *loader;
 } QSVSession;
 
 typedef struct QSVFramesContext {
@@ -128,7 +137,7 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
 
 enum AVPixelFormat ff_qsv_map_fourcc(uint32_t fourcc);
 
-int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc);
+int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc, uint16_t *shift);
 enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type);
 
 enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct);