[FFmpeg-devel] [PATCH 05/13] lavc: Remove register mechanism for hwaccels

Mark Thompson sw at jkqxz.net
Sat Nov 18 20:47:05 EET 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 | 80 --------------------------------------------------
 2 files changed, 1 insertion(+), 81 deletions(-)

diff --git a/configure b/configure
index 8b7b7e164b..1695ae1770 100755
--- a/configure
+++ b/configure
@@ -3509,7 +3509,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)
@@ -3525,6 +3524,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 e0adb71951..4a21687b20 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -29,13 +29,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;                                \
@@ -61,79 +54,6 @@
 
 static void register_all(void)
 {
-    /* hardware accelerators */
-    REGISTER_HWACCEL(H263_VAAPI,        h263_vaapi);
-    REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
-    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_MEDIACODEC,   h264_mediacodec);
-    REGISTER_HWACCEL(H264_MMAL,         h264_mmal);
-    REGISTER_HWACCEL(H264_NVDEC,        h264_nvdec);
-    REGISTER_HWACCEL(H264_QSV,          h264_qsv);
-    REGISTER_HWACCEL(H264_VAAPI,        h264_vaapi);
-    REGISTER_HWACCEL(H264_VDPAU,        h264_vdpau);
-    REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox);
-    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_NVDEC,        hevc_nvdec);
-    REGISTER_HWACCEL(HEVC_MEDIACODEC,   hevc_mediacodec);
-    REGISTER_HWACCEL(HEVC_QSV,          hevc_qsv);
-    REGISTER_HWACCEL(HEVC_VAAPI,        hevc_vaapi);
-    REGISTER_HWACCEL(HEVC_VDPAU,        hevc_vdpau);
-    REGISTER_HWACCEL(HEVC_VIDEOTOOLBOX, hevc_videotoolbox);
-    REGISTER_HWACCEL(MJPEG_CUVID,       mjpeg_cuvid);
-    REGISTER_HWACCEL(MPEG1_CUVID,       mpeg1_cuvid);
-    REGISTER_HWACCEL(MPEG1_XVMC,        mpeg1_xvmc);
-    REGISTER_HWACCEL(MPEG1_VDPAU,       mpeg1_vdpau);
-    REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);
-    REGISTER_HWACCEL(MPEG2_CUVID,       mpeg2_cuvid);
-    REGISTER_HWACCEL(MPEG2_XVMC,        mpeg2_xvmc);
-    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_NVDEC,       mpeg2_nvdec);
-    REGISTER_HWACCEL(MPEG2_QSV,         mpeg2_qsv);
-    REGISTER_HWACCEL(MPEG2_VAAPI,       mpeg2_vaapi);
-    REGISTER_HWACCEL(MPEG2_VDPAU,       mpeg2_vdpau);
-    REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
-    REGISTER_HWACCEL(MPEG2_MEDIACODEC,  mpeg2_mediacodec);
-    REGISTER_HWACCEL(MPEG4_CUVID,       mpeg4_cuvid);
-    REGISTER_HWACCEL(MPEG4_MEDIACODEC,  mpeg4_mediacodec);
-    REGISTER_HWACCEL(MPEG4_MMAL,        mpeg4_mmal);
-    REGISTER_HWACCEL(MPEG4_VAAPI,       mpeg4_vaapi);
-    REGISTER_HWACCEL(MPEG4_VDPAU,       mpeg4_vdpau);
-    REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);
-    REGISTER_HWACCEL(VC1_CUVID,         vc1_cuvid);
-    REGISTER_HWACCEL(VC1_D3D11VA,       vc1_d3d11va);
-    REGISTER_HWACCEL(VC1_D3D11VA2,      vc1_d3d11va2);
-    REGISTER_HWACCEL(VC1_DXVA2,         vc1_dxva2);
-    REGISTER_HWACCEL(VC1_NVDEC,         vc1_nvdec);
-    REGISTER_HWACCEL(VC1_VAAPI,         vc1_vaapi);
-    REGISTER_HWACCEL(VC1_VDPAU,         vc1_vdpau);
-    REGISTER_HWACCEL(VC1_MMAL,          vc1_mmal);
-    REGISTER_HWACCEL(VC1_QSV,           vc1_qsv);
-    REGISTER_HWACCEL(VP8_CUVID,         vp8_cuvid);
-    REGISTER_HWACCEL(VP8_MEDIACODEC,    vp8_mediacodec);
-    REGISTER_HWACCEL(VP8_QSV,           vp8_qsv);
-    REGISTER_HWACCEL(VP9_CUVID,         vp9_cuvid);
-    REGISTER_HWACCEL(VP9_D3D11VA,       vp9_d3d11va);
-    REGISTER_HWACCEL(VP9_D3D11VA2,      vp9_d3d11va2);
-    REGISTER_HWACCEL(VP9_DXVA2,         vp9_dxva2);
-    REGISTER_HWACCEL(VP9_MEDIACODEC,    vp9_mediacodec);
-    REGISTER_HWACCEL(VP9_NVDEC,         vp9_nvdec);
-    REGISTER_HWACCEL(VP9_VAAPI,         vp9_vaapi);
-    REGISTER_HWACCEL(WMV3_D3D11VA,      wmv3_d3d11va);
-    REGISTER_HWACCEL(WMV3_D3D11VA2,     wmv3_d3d11va2);
-    REGISTER_HWACCEL(WMV3_DXVA2,        wmv3_dxva2);
-    REGISTER_HWACCEL(WMV3_NVDEC,        wmv3_nvdec);
-    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 ffmpeg-devel mailing list