]> git.sesse.net Git - ffmpeg/commitdiff
lavc/amfenc: Add hardware config metadata
authorOvchinnikovDmitrii <ovchinnikov.dmitrii@gmail.com>
Thu, 15 Oct 2020 00:16:21 +0000 (03:16 +0300)
committerMark Thompson <sw@jkqxz.net>
Sun, 8 Nov 2020 19:05:17 +0000 (19:05 +0000)
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.

libavcodec/amfenc.c
libavcodec/amfenc.h
libavcodec/amfenc_h264.c
libavcodec/amfenc_hevc.c

index da0652943d1fd48aacb2a3f9dcd13e84a204b136..e234cfd354134ba64f90947929a943d6c3fbb068 100644 (file)
@@ -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,
+};
index 80658c6b2a6dc8a50cf582a76ab1d8e0ed1fc936..358b2ef778a016ad3e16db3c2a938fac099c05e6 100644 (file)
@@ -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
 */
index 7a8029f3b7e9ce1256d09d182e8a00bb81292a10..622ee859464838e1485d1aacc6f59ddb6770d2d9 100644 (file)
@@ -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,
 };
index fa12a3a3f6bfd9b469b7892e35c52973d2b1ef90..bb224c5fece995688c43a1eaf787fc510ec304f9 100644 (file)
@@ -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,
 };