[FFmpeg-devel] [PATCH 4/8] lavc/vaapi_encode: Add hardware config metadata
Mark Thompson
sw at jkqxz.net
Mon Apr 13 18:33:17 EEST 2020
These encoders all accept VAAPI surfaces in a hardware frames context.
---
libavcodec/vaapi_encode.c | 5 +++++
libavcodec/vaapi_encode.h | 3 +++
libavcodec/vaapi_encode_h264.c | 1 +
libavcodec/vaapi_encode_h265.c | 1 +
libavcodec/vaapi_encode_mjpeg.c | 1 +
libavcodec/vaapi_encode_mpeg2.c | 1 +
libavcodec/vaapi_encode_vp8.c | 1 +
libavcodec/vaapi_encode_vp9.c | 1 +
8 files changed, 14 insertions(+)
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 8ff720e395..f551967ad6 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -27,6 +27,11 @@
#include "vaapi_encode.h"
#include "avcodec.h"
+const AVCodecHWConfigInternal *ff_vaapi_encode_hw_configs[] = {
+ HW_CONFIG_ENCODER_FRAMES(VAAPI, VAAPI),
+ NULL,
+};
+
static const char * const picture_type_name[] = { "IDR", "I", "P", "B" };
static int vaapi_encode_make_packed_header(AVCodecContext *avctx,
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index b9a3defd72..1329f6428f 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -31,6 +31,7 @@
#include "libavutil/hwcontext_vaapi.h"
#include "avcodec.h"
+#include "hwconfig.h"
struct VAAPIEncodeType;
struct VAAPIEncodePicture;
@@ -44,6 +45,8 @@ enum {
MAX_PARAM_BUFFER_SIZE = 1024,
};
+extern const AVCodecHWConfigInternal *ff_vaapi_encode_hw_configs[];
+
enum {
PICTURE_TYPE_IDR = 0,
PICTURE_TYPE_I = 1,
diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index f4965d8b09..67b1ecae1b 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -1361,5 +1361,6 @@ AVCodec ff_h264_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .hw_configs = ff_vaapi_encode_hw_configs,
.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index 97dc5a7e75..e20e8cbdd0 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -1297,5 +1297,6 @@ AVCodec ff_hevc_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .hw_configs = ff_vaapi_encode_hw_configs,
.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c
index bd029cc903..2b5d3bf4f9 100644
--- a/libavcodec/vaapi_encode_mjpeg.c
+++ b/libavcodec/vaapi_encode_mjpeg.c
@@ -570,5 +570,6 @@ AVCodec ff_mjpeg_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .hw_configs = ff_vaapi_encode_hw_configs,
.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
index bac9ea1fa6..0398c4cd8c 100644
--- a/libavcodec/vaapi_encode_mpeg2.c
+++ b/libavcodec/vaapi_encode_mpeg2.c
@@ -707,5 +707,6 @@ AVCodec ff_mpeg2_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .hw_configs = ff_vaapi_encode_hw_configs,
.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c
index 6e7bf9d106..16cbcbd81c 100644
--- a/libavcodec/vaapi_encode_vp8.c
+++ b/libavcodec/vaapi_encode_vp8.c
@@ -262,5 +262,6 @@ AVCodec ff_vp8_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .hw_configs = ff_vaapi_encode_hw_configs,
.wrapper_name = "vaapi",
};
diff --git a/libavcodec/vaapi_encode_vp9.c b/libavcodec/vaapi_encode_vp9.c
index d7f415d704..d05319ef39 100644
--- a/libavcodec/vaapi_encode_vp9.c
+++ b/libavcodec/vaapi_encode_vp9.c
@@ -296,5 +296,6 @@ AVCodec ff_vp9_vaapi_encoder = {
AV_PIX_FMT_VAAPI,
AV_PIX_FMT_NONE,
},
+ .hw_configs = ff_vaapi_encode_hw_configs,
.wrapper_name = "vaapi",
};
--
2.25.1
More information about the ffmpeg-devel
mailing list