summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2020-04-13 16:33:18 +0100
committerTimo Rothenpieler <timo@rothenpieler.org>2020-04-27 23:06:06 +0200
commit1dff97b7bc792267c3e79030fbaed0e9fefc65fb (patch)
tree73f245cf37c284dbcaecd4ad6e535f0bd7f1935a /libavcodec
parent1128aa875367f66ac11adc30364d5652919a2591 (diff)
avcodec/nvenc: add hardware config metadata
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/nvenc.c10
-rw-r--r--libavcodec/nvenc.h2
-rw-r--r--libavcodec/nvenc_h264.c3
-rw-r--r--libavcodec/nvenc_hevc.c2
4 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 9a96bf2bba..2c75399b44 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -55,6 +55,16 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
AV_PIX_FMT_NONE
};
+const AVCodecHWConfigInternal *ff_nvenc_hw_configs[] = {
+ HW_CONFIG_ENCODER_FRAMES(CUDA, CUDA),
+ HW_CONFIG_ENCODER_DEVICE(NONE, CUDA),
+#if CONFIG_D3D11VA
+ HW_CONFIG_ENCODER_FRAMES(D3D11, D3D11VA),
+ HW_CONFIG_ENCODER_DEVICE(NONE, D3D11VA),
+#endif
+ NULL,
+};
+
#define IS_10BIT(pix_fmt) (pix_fmt == AV_PIX_FMT_P010 || \
pix_fmt == AV_PIX_FMT_P016 || \
pix_fmt == AV_PIX_FMT_YUV444P16)
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index c44c81e675..6bdf4741fa 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -33,6 +33,7 @@ typedef void ID3D11Device;
#include "compat/cuda/dynlink_loader.h"
#include "libavutil/fifo.h"
#include "libavutil/opt.h"
+#include "hwconfig.h"
#include "avcodec.h"
@@ -217,5 +218,6 @@ int ff_nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
void ff_nvenc_encode_flush(AVCodecContext *avctx);
extern const enum AVPixelFormat ff_nvenc_pix_fmts[];
+extern const AVCodecHWConfigInternal *ff_nvenc_hw_configs[];
#endif /* AVCODEC_NVENC_H */
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index c39f90fe1b..bac45ac8ee 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -191,6 +191,7 @@ AVCodec ff_nvenc_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = ff_nvenc_pix_fmts,
.wrapper_name = "nvenc",
+ .hw_configs = ff_nvenc_hw_configs,
};
#endif
@@ -222,6 +223,7 @@ AVCodec ff_nvenc_h264_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = ff_nvenc_pix_fmts,
.wrapper_name = "nvenc",
+ .hw_configs = ff_nvenc_hw_configs,
};
#endif
@@ -253,4 +255,5 @@ AVCodec ff_h264_nvenc_encoder = {
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.pix_fmts = ff_nvenc_pix_fmts,
.wrapper_name = "nvenc",
+ .hw_configs = ff_nvenc_hw_configs,
};
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index ea337a514f..89919b162c 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -178,6 +178,7 @@ AVCodec ff_nvenc_hevc_encoder = {
AV_CODEC_CAP_ENCODER_FLUSH,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.wrapper_name = "nvenc",
+ .hw_configs = ff_nvenc_hw_configs,
};
#endif
@@ -208,4 +209,5 @@ AVCodec ff_hevc_nvenc_encoder = {
AV_CODEC_CAP_ENCODER_FLUSH,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.wrapper_name = "nvenc",
+ .hw_configs = ff_nvenc_hw_configs,
};