[libav-devel] [PATCH 6/9] lavc: Remove register mechanism for hwaccels

Mark Thompson sw at jkqxz.net
Mon Dec 11 00:05:44 CET 2017


There is no longer any need for a list of them at runtime, because
decoders now carry the pointers to their associated hwaccels internally.
The file containing external declarations is now used to make the list
of hwaccels for configure.
---
 configure              |  2 +-
 libavcodec/allcodecs.c | 51 --------------------------------------------------
 2 files changed, 1 insertion(+), 52 deletions(-)

diff --git a/configure b/configure
index 7f320fee1..d0e1980dc 100755
--- a/configure
+++ b/configure
@@ -2704,7 +2704,6 @@ find_things(){
 
 ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
 DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
-HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
 PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
 MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
 DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
@@ -2719,6 +2718,7 @@ find_things_extern(){
 }
 
 BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
+HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
 PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
 
 AVCODEC_COMPONENTS_LIST="
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 4ece4307a..50a87493e 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -28,13 +28,6 @@
 #include "avcodec.h"
 #include "version.h"
 
-#define REGISTER_HWACCEL(X, x)                                          \
-    {                                                                   \
-        extern AVHWAccel ff_##x##_hwaccel;                              \
-        if (CONFIG_##X##_HWACCEL)                                       \
-            av_register_hwaccel(&ff_##x##_hwaccel);                     \
-    }
-
 #define REGISTER_ENCODER(X, x)                                          \
     {                                                                   \
         extern AVCodec ff_##x##_encoder;                                \
@@ -66,50 +59,6 @@ void avcodec_register_all(void)
         return;
     initialized = 1;
 
-    /* hardware accelerators */
-    REGISTER_HWACCEL(H263_VAAPI,        h263_vaapi);
-    REGISTER_HWACCEL(H264_CUVID,        h264_cuvid);
-    REGISTER_HWACCEL(H264_D3D11VA,      h264_d3d11va);
-    REGISTER_HWACCEL(H264_D3D11VA2,     h264_d3d11va2);
-    REGISTER_HWACCEL(H264_DXVA2,        h264_dxva2);
-    REGISTER_HWACCEL(H264_MMAL,         h264_mmal);
-    REGISTER_HWACCEL(H264_QSV,          h264_qsv);
-    REGISTER_HWACCEL(H264_VAAPI,        h264_vaapi);
-    REGISTER_HWACCEL(H264_VDA,          h264_vda);
-    REGISTER_HWACCEL(H264_VDA_OLD,      h264_vda_old);
-    REGISTER_HWACCEL(H264_VDPAU,        h264_vdpau);
-    REGISTER_HWACCEL(HEVC_CUVID,        hevc_cuvid);
-    REGISTER_HWACCEL(HEVC_D3D11VA,      hevc_d3d11va);
-    REGISTER_HWACCEL(HEVC_D3D11VA2,     hevc_d3d11va2);
-    REGISTER_HWACCEL(HEVC_DXVA2,        hevc_dxva2);
-    REGISTER_HWACCEL(HEVC_QSV,          hevc_qsv);
-    REGISTER_HWACCEL(HEVC_VAAPI,        hevc_vaapi);
-    REGISTER_HWACCEL(HEVC_VDPAU,        hevc_vdpau);
-    REGISTER_HWACCEL(MPEG1_VDPAU,       mpeg1_vdpau);
-    REGISTER_HWACCEL(MPEG2_D3D11VA,     mpeg2_d3d11va);
-    REGISTER_HWACCEL(MPEG2_D3D11VA2,    mpeg2_d3d11va2);
-    REGISTER_HWACCEL(MPEG2_DXVA2,       mpeg2_dxva2);
-    REGISTER_HWACCEL(MPEG2_MMAL,        mpeg2_mmal);
-    REGISTER_HWACCEL(MPEG2_QSV,         mpeg2_qsv);
-    REGISTER_HWACCEL(MPEG2_VAAPI,       mpeg2_vaapi);
-    REGISTER_HWACCEL(MPEG2_VDPAU,       mpeg2_vdpau);
-    REGISTER_HWACCEL(MPEG4_VAAPI,       mpeg4_vaapi);
-    REGISTER_HWACCEL(MPEG4_VDPAU,       mpeg4_vdpau);
-    REGISTER_HWACCEL(VC1_D3D11VA,       vc1_d3d11va);
-    REGISTER_HWACCEL(VC1_D3D11VA2,      vc1_d3d11va2);
-    REGISTER_HWACCEL(VC1_DXVA2,         vc1_dxva2);
-    REGISTER_HWACCEL(VC1_QSV,           vc1_qsv);
-    REGISTER_HWACCEL(VC1_VAAPI,         vc1_vaapi);
-    REGISTER_HWACCEL(VC1_VDPAU,         vc1_vdpau);
-    REGISTER_HWACCEL(VC1_MMAL,          vc1_mmal);
-    REGISTER_HWACCEL(VP8_QSV,           vp8_qsv);
-    REGISTER_HWACCEL(VP8_VAAPI,         vp8_vaapi);
-    REGISTER_HWACCEL(WMV3_D3D11VA,      wmv3_d3d11va);
-    REGISTER_HWACCEL(WMV3_D3D11VA2,     wmv3_d3d11va2);
-    REGISTER_HWACCEL(WMV3_DXVA2,        wmv3_dxva2);
-    REGISTER_HWACCEL(WMV3_VAAPI,        wmv3_vaapi);
-    REGISTER_HWACCEL(WMV3_VDPAU,        wmv3_vdpau);
-
     /* video codecs */
     REGISTER_ENCODER(A64MULTI,          a64multi);
     REGISTER_ENCODER(A64MULTI5,         a64multi5);
-- 
2.11.0



More information about the libav-devel mailing list