]> git.sesse.net Git - ffmpeg/commitdiff
lavc/qsvenc: Add hardware config metadata
authorMark Thompson <sw@jkqxz.net>
Mon, 13 Apr 2020 15:33:16 +0000 (16:33 +0100)
committerMark Thompson <sw@jkqxz.net>
Sun, 26 Apr 2020 17:38:25 +0000 (18:38 +0100)
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.

libavcodec/qsvenc.c
libavcodec/qsvenc.h
libavcodec/qsvenc_h264.c
libavcodec/qsvenc_hevc.c
libavcodec/qsvenc_jpeg.c
libavcodec/qsvenc_mpeg2.c
libavcodec/qsvenc_vp9.c

index afab8fd7151f46f53638945170559931f684dba3..9ec0636dde1ec5442ad142101882798ccd46df46 100644 (file)
@@ -1652,3 +1652,10 @@ int ff_qsv_enc_close(AVCodecContext *avctx, QSVEncContext *q)
 
     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,
+};
index 6609171af3cf384858717c23aa07d2855fdb7970..4f579d1db1475f4cf753ab57370bc1947a843b4f 100644 (file)
@@ -32,6 +32,7 @@
 #include "libavutil/fifo.h"
 
 #include "avcodec.h"
+#include "hwconfig.h"
 #include "qsv_internal.h"
 
 #define QSV_HAVE_CO2 QSV_VERSION_ATLEAST(1, 6)
@@ -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 },                         \
 { "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,
                              const AVFrame *frame, mfxEncodeCtrl* enc_ctrl);
 typedef struct QSVEncContext {
index 27f36b9f7b3d36cc72721b5a2fe18ed3eb0377a1..364975bea5bbd60e80ae8196648644069657ba0d 100644 (file)
@@ -197,4 +197,5 @@ AVCodec ff_h264_qsv_encoder = {
     .defaults       = qsv_enc_defaults,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .wrapper_name   = "qsv",
+    .hw_configs     = ff_qsv_enc_hw_configs,
 };
index 27e2232a9f348ddaa0e2fa1bab03f58022b899b3..36e5ef60522338640e01c122295db84f1f375499 100644 (file)
@@ -288,4 +288,5 @@ AVCodec ff_hevc_qsv_encoder = {
     .defaults       = qsv_enc_defaults,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .wrapper_name   = "qsv",
+    .hw_configs     = ff_qsv_enc_hw_configs,
 };
index 1619a335c79ad8bf70dd0427e8f21a082e5a0425..f76af9486baaccd70625d1b2d2e56803a306df9b 100644 (file)
@@ -95,4 +95,5 @@ AVCodec ff_mjpeg_qsv_encoder = {
     .priv_class     = &class,
     .defaults       = qsv_enc_defaults,
     .wrapper_name   = "qsv",
+    .hw_configs     = ff_qsv_enc_hw_configs,
 };
index e4ade56d624f67ba5313fc09f51702d8e169873a..0e34bb75dc03e073aa8bb95658289d5f4f50b2bb 100644 (file)
@@ -112,4 +112,5 @@ AVCodec ff_mpeg2_qsv_encoder = {
     .defaults       = qsv_enc_defaults,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .wrapper_name   = "qsv",
+    .hw_configs     = ff_qsv_enc_hw_configs,
 };
index 9402f806b1f17f5c4fc4df301c31d33395784b45..ce44c09397ed474888263dd66ecbacd34abe79c6 100644 (file)
@@ -110,4 +110,5 @@ AVCodec ff_vp9_qsv_encoder = {
     .defaults       = qsv_enc_defaults,
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .wrapper_name   = "qsv",
+    .hw_configs     = ff_qsv_enc_hw_configs,
 };