changeset 35823:b4ec8c8ee5b6

configure: Refactor listing libav* subparts into a function
author diego
date Mon, 18 Feb 2013 02:58:32 +0000
parents e27d1c2f3ac1
children 5ccbc60921d1
files configure
diffstat 1 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Sun Feb 17 13:17:51 2013 +0000
+++ b/configure	Mon Feb 18 02:58:32 2013 +0000
@@ -688,25 +688,32 @@
 _libopencore_amrnb=auto
 _libopencore_amrwb=auto
 libopenjpeg=auto
-libavdecoders_all=$(sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' ffmpeg/libavcodec/allcodecs.c | toupper)
+
+list_subparts() {
+  pattern="s/^[^#]*${1}.*([^ ,]*, *\([^ ,)]*\).*/\1_${2}/p"
+  sed -n "$pattern" ffmpeg/libav${3} | toupper
+}
+
+libavdecoders_all=$(list_subparts  DEC      decoder  codec/allcodecs.c)
+libavencoders_all=$(list_subparts  ENC      encoder  codec/allcodecs.c)
+libavparsers_all=$(list_subparts   PARSER   parser   codec/allcodecs.c)
+libavbsfs_all=$(list_subparts      BSF      bsf      codec/allcodecs.c)
+libavhwaccels_all=$(list_subparts  HWACCEL  hwaccel  codec/allcodecs.c)
+libavdemuxers_all=$(list_subparts  DEMUX    demuxer  format/allformats.c)
+libavmuxers_all=$(list_subparts    _MUX     muxer    format/allformats.c)
+libavprotocols_all=$(list_subparts PROTOCOL protocol format/allformats.c)
+libavfilters_all=$(list_subparts   FILTER   filter   filter/allfilters.c)
+
 libavdecoders=$(echo $libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g')
-libavencoders_all=$(sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' ffmpeg/libavcodec/allcodecs.c | toupper)
 libavencoders=$(echo $libavencoders_all | sed -e 's/ LIB[A-Z0-9_]*_ENCODER//g')
-libavparsers_all=$(sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' ffmpeg/libavcodec/allcodecs.c | toupper)
 libavparsers=$libavparsers_all
-libavbsfs_all=$(sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' ffmpeg/libavcodec/allcodecs.c | toupper)
 libavbsfs=$libavbsfs_all
-libavhwaccels_all=$(sed -n 's/^[^#]*HWACCEL.*(.*, *\(.*\)).*/\1_hwaccel/p' ffmpeg/libavcodec/allcodecs.c | toupper)
 # Disable all hardware accelerators for now.
 libavhwaccels=
-libavdemuxers_all=$(sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' ffmpeg/libavformat/allformats.c | toupper)
 libavdemuxers=$(echo $libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/AVISYNTH_DEMUXER//)
-libavmuxers_all=$(sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' ffmpeg/libavformat/allformats.c | toupper)
 libavmuxers=$(echo $libavmuxers_all | sed -e 's/ LIB[A-Z0-9_]*_MUXER//g' -e s/RTP_MUXER// -e s/RTSP_MUXER// -e s/SAP_MUXER//)
-libavprotocols_all=$(sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' ffmpeg/libavformat/allformats.c | toupper)
 libavprotocols=$libavprotocols_all
 libavprotocols=$(echo $libavprotocols | sed -e s/HTTPS_PROTOCOL// -e s/TLS_PROTOCOL// -e s/BLURAY_PROTOCOL// -e s/FFRTMPCRYPT_PROTOCOL//)
-libavfilters_all=$(sed -n 's/^[^#]*FILTER.*(.*, *\(.*\),.*).*/\1_filter/p' ffmpeg/libavfilter/allfilters.c | toupper)
 libavfilters=$(echo $libavfilters_all | sed -e 's/ LIB[A-Z0-9_]*_FILTER//g' -e 's/ FREI0R[A-Z0-9_]*_FILTER//g' -e 's/ OCV_FILTER//g' -e 's/ MP_FILTER//g')
 _mencoder=yes
 _mplayer=yes