[FFmpeg-devel] [PATCH v7 05/10] qsv: build audio related code when MFX_VERSION < 2.0
Xiang, Haihao
haihao.xiang at intel.com
Fri Mar 11 10:16:25 EET 2022
From: Haihao Xiang <haihao.xiang at intel.com>
Audio isn't supported for MFX_VERSION >= 2.0[1][2]. This is in
preparation for oneVPL support
[1]: https://spec.oneapi.io/versions/latest/elements/oneVPL/source/VPL_intel_media_sdk.html#msdk-full-name-feature-removals
[2]: https://github.com/oneapi-src/oneVPL
---
libavcodec/qsv.c | 5 +++++
libavfilter/qsvvpp.c | 6 ++++++
libavfilter/qsvvpp.h | 2 ++
3 files changed, 13 insertions(+)
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 0eb0d83ac0..063d6dfb0a 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -37,6 +37,7 @@
#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
#define QSV_HAVE_USER_PLUGIN !QSV_ONEVPL
+#define QSV_HAVE_AUDIO !QSV_ONEVPL
#if QSV_VERSION_ATLEAST(1, 12)
#include "mfxvp8.h"
@@ -137,8 +138,10 @@ static const struct {
{ MFX_ERR_INVALID_VIDEO_PARAM, AVERROR(EINVAL), "invalid video parameters" },
{ MFX_ERR_UNDEFINED_BEHAVIOR, AVERROR_BUG, "undefined behavior" },
{ MFX_ERR_DEVICE_FAILED, AVERROR(EIO), "device failed" },
+#if QSV_HAVE_AUDIO
{ MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio parameters" },
{ MFX_ERR_INVALID_AUDIO_PARAM, AVERROR(EINVAL), "invalid audio parameters" },
+#endif
{ MFX_WRN_IN_EXECUTION, 0, "operation in execution" },
{ MFX_WRN_DEVICE_BUSY, 0, "device busy" },
@@ -148,7 +151,9 @@ static const struct {
{ MFX_WRN_VALUE_NOT_CHANGED, 0, "value is saturated" },
{ MFX_WRN_OUT_OF_RANGE, 0, "value out of range" },
{ MFX_WRN_FILTER_SKIPPED, 0, "filter skipped" },
+#if QSV_HAVE_AUDIO
{ MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0, "incompatible audio parameters" },
+#endif
};
/**
diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 954f882637..3647891d13 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -38,6 +38,8 @@
#define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)
#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
+#define QSV_HAVE_AUDIO !QSV_ONEVPL
+
static const AVRational default_tb = { 1, 90000 };
typedef struct QSVAsyncFrame {
@@ -100,8 +102,10 @@ static const struct {
{ MFX_ERR_INVALID_VIDEO_PARAM, AVERROR(EINVAL), "invalid video parameters" },
{ MFX_ERR_UNDEFINED_BEHAVIOR, AVERROR_BUG, "undefined behavior" },
{ MFX_ERR_DEVICE_FAILED, AVERROR(EIO), "device failed" },
+#if QSV_HAVE_AUDIO
{ MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio parameters" },
{ MFX_ERR_INVALID_AUDIO_PARAM, AVERROR(EINVAL), "invalid audio parameters" },
+#endif
{ MFX_WRN_IN_EXECUTION, 0, "operation in execution" },
{ MFX_WRN_DEVICE_BUSY, 0, "device busy" },
@@ -111,7 +115,9 @@ static const struct {
{ MFX_WRN_VALUE_NOT_CHANGED, 0, "value is saturated" },
{ MFX_WRN_OUT_OF_RANGE, 0, "value out of range" },
{ MFX_WRN_FILTER_SKIPPED, 0, "filter skipped" },
+#if QSV_HAVE_AUDIO
{ MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0, "incompatible audio parameters" },
+#endif
};
static int qsv_map_error(mfxStatus mfx_err, const char **desc)
diff --git a/libavfilter/qsvvpp.h b/libavfilter/qsvvpp.h
index 543c58a967..802abd987d 100644
--- a/libavfilter/qsvvpp.h
+++ b/libavfilter/qsvvpp.h
@@ -40,6 +40,8 @@
((MFX_VERSION.Major > (MAJOR)) || \
(MFX_VERSION.Major == (MAJOR) && MFX_VERSION.Minor >= (MINOR)))
+#define QSV_ONEVPL QSV_VERSION_ATLEAST(2, 0)
+
typedef struct QSVFrame {
AVFrame *frame;
mfxFrameSurface1 surface;
--
2.17.1
More information about the ffmpeg-devel
mailing list