[FFmpeg-cvslog] lavc/amfenc: Add hardware config metadata

OvchinnikovDmitrii git at videolan.org
Sun Nov 8 21:07:16 EET 2020


ffmpeg | branch: master | OvchinnikovDmitrii <ovchinnikov.dmitrii at gmail.com> | Thu Oct 15 03:16:21 2020 +0300| [2fb764e1f3932ddb5a2a071d238a4db83e6d5a1b] | committer: Mark Thompson

lavc/amfenc: Add hardware config metadata

Without this metadata section the ffmpeg utility thinks that the AMF encoder
does not support input from D3D11 and DXVA2 hardware surfaces, causing
hardware pipelines to fail.

Fixes #8953.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2fb764e1f3932ddb5a2a071d238a4db83e6d5a1b
---

 libavcodec/amfenc.c      | 12 ++++++++++++
 libavcodec/amfenc.h      |  3 +++
 libavcodec/amfenc_h264.c |  1 +
 libavcodec/amfenc_hevc.c |  1 +
 4 files changed, 17 insertions(+)

diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index da0652943d..e234cfd354 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -782,3 +782,15 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
     }
     return ret;
 }
+
+const AVCodecHWConfigInternal *const ff_amfenc_hw_configs[] = {
+#if CONFIG_D3D11VA
+    HW_CONFIG_ENCODER_FRAMES(D3D11, D3D11VA),
+    HW_CONFIG_ENCODER_DEVICE(NONE,  D3D11VA),
+#endif
+#if CONFIG_DXVA2
+    HW_CONFIG_ENCODER_FRAMES(DXVA2_VLD, DXVA2),
+    HW_CONFIG_ENCODER_DEVICE(NONE,      DXVA2),
+#endif
+    NULL,
+};
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index 80658c6b2a..358b2ef778 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -27,6 +27,7 @@
 #include "libavutil/fifo.h"
 
 #include "avcodec.h"
+#include "hwconfig.h"
 
 
 /**
@@ -117,6 +118,8 @@ typedef struct AmfContext {
     int                 tier;
 } AmfContext;
 
+extern const AVCodecHWConfigInternal *const ff_amfenc_hw_configs[];
+
 /**
 * Common encoder initization function
 */
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index 7a8029f3b7..622ee85946 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -392,4 +392,5 @@ AVCodec ff_h264_amf_encoder = {
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .pix_fmts       = ff_amf_pix_fmts,
     .wrapper_name   = "amf",
+    .hw_configs     = ff_amfenc_hw_configs,
 };
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index fa12a3a3f6..bb224c5fec 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -322,4 +322,5 @@ AVCodec ff_hevc_amf_encoder = {
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .pix_fmts       = ff_amf_pix_fmts,
     .wrapper_name   = "amf",
+    .hw_configs     = ff_amfenc_hw_configs,
 };



More information about the ffmpeg-cvslog mailing list