Commit 5a1ff449 authored by Mark Thompson's avatar Mark Thompson

lavc/qsvenc: Add hardware config metadata

All of these encoders can accept libmfx surfaces directly in a hardware
frames context, or they can accept software frames if a suitable device
is supplied to use.
parent 858eba0c
...@@ -1652,3 +1652,10 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q) ...@@ -1652,3 +1652,10 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
return 0; return 0;
} }
const AVCodecHWConfigInternal *ff_qsv_enc_hw_configs[] = {
HW_CONFIG_ENCODER_FRAMES(QSV, QSV),
HW_CONFIG_ENCODER_DEVICE(NV12, QSV),
HW_CONFIG_ENCODER_DEVICE(P010, QSV),
NULL,
};
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "libavutil/fifo.h" #include "libavutil/fifo.h"
#include "avcodec.h" #include "avcodec.h"
#include "hwconfig.h"
#include "qsv_internal.h" #include "qsv_internal.h"
#define QSV_HAVE_CO2 QSV_VERSION_ATLEAST(1, 6) #define QSV_HAVE_CO2 QSV_VERSION_ATLEAST(1, 6)
...@@ -97,6 +98,8 @@ ...@@ -97,6 +98,8 @@
{ "forced_idr", "Forcing I frames as IDR frames", OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, \ { "forced_idr", "Forcing I frames as IDR frames", OFFSET(qsv.forced_idr), AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE }, \
{ "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, VE},\ { "low_power", "enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.)", OFFSET(qsv.low_power), AV_OPT_TYPE_BOOL, { .i64 = 0}, 0, 1, VE},\
extern const AVCodecHWConfigInternal *ff_qsv_enc_hw_configs[];
typedef int SetEncodeCtrlCB (AVCodecContext *avctx, typedef int SetEncodeCtrlCB (AVCodecContext *avctx,
const AVFrame *frame, mfxEncodeCtrl* enc_ctrl); const AVFrame *frame, mfxEncodeCtrl* enc_ctrl);
typedef struct QSVEncContext { typedef struct QSVEncContext {
......
...@@ -197,4 +197,5 @@ AVCodec ff_h264_qsv_encoder = { ...@@ -197,4 +197,5 @@ AVCodec ff_h264_qsv_encoder = {
.defaults = qsv_enc_defaults, .defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.wrapper_name = "qsv", .wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
}; };
...@@ -288,4 +288,5 @@ AVCodec ff_hevc_qsv_encoder = { ...@@ -288,4 +288,5 @@ AVCodec ff_hevc_qsv_encoder = {
.defaults = qsv_enc_defaults, .defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.wrapper_name = "qsv", .wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
}; };
...@@ -95,4 +95,5 @@ AVCodec ff_mjpeg_qsv_encoder = { ...@@ -95,4 +95,5 @@ AVCodec ff_mjpeg_qsv_encoder = {
.priv_class = &class, .priv_class = &class,
.defaults = qsv_enc_defaults, .defaults = qsv_enc_defaults,
.wrapper_name = "qsv", .wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
}; };
...@@ -112,4 +112,5 @@ AVCodec ff_mpeg2_qsv_encoder = { ...@@ -112,4 +112,5 @@ AVCodec ff_mpeg2_qsv_encoder = {
.defaults = qsv_enc_defaults, .defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.wrapper_name = "qsv", .wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
}; };
...@@ -110,4 +110,5 @@ AVCodec ff_vp9_qsv_encoder = { ...@@ -110,4 +110,5 @@ AVCodec ff_vp9_qsv_encoder = {
.defaults = qsv_enc_defaults, .defaults = qsv_enc_defaults,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.wrapper_name = "qsv", .wrapper_name = "qsv",
.hw_configs = ff_qsv_enc_hw_configs,
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment