diff mbox series

[FFmpeg-devel,1/6] configure: libavradio support

Message ID 20230722192957.703-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/6] configure: libavradio support | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer July 22, 2023, 7:29 p.m. UTC
Autodetected based on existence of libavradio/version.h

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 Makefile  |  5 +++--
 configure | 46 +++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index bf1b69f96b..d5689231c3 100644
--- a/Makefile
+++ b/Makefile
@@ -19,13 +19,14 @@  vpath %/fate_config.sh.template $(SRC_PATH)
 TESTTOOLS   = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 audiomatch
 HOSTPROGS  := $(TESTTOOLS:%=tests/%) doc/print_options
 
-ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
+ALLFFLIBS = avcodec avdevice avfilter avformat avradio avutil postproc swscale swresample
 
 # $(FFLIBS-yes) needs to be in linking order
 FFLIBS-$(CONFIG_AVDEVICE)   += avdevice
 FFLIBS-$(CONFIG_AVFILTER)   += avfilter
 FFLIBS-$(CONFIG_AVFORMAT)   += avformat
 FFLIBS-$(CONFIG_AVCODEC)    += avcodec
+FFLIBS-$(CONFIG_AVRADIO)    += avradio
 FFLIBS-$(CONFIG_POSTPROC)   += postproc
 FFLIBS-$(CONFIG_SWRESAMPLE) += swresample
 FFLIBS-$(CONFIG_SWSCALE)    += swscale
@@ -171,7 +172,7 @@  distclean:: clean
 		libavcodec/bsf_list.c libavformat/protocol_list.c \
 		libavcodec/codec_list.c libavcodec/parser_list.c \
 		libavfilter/filter_list.c libavdevice/indev_list.c libavdevice/outdev_list.c \
-		libavformat/muxer_list.c libavformat/demuxer_list.c
+		libavformat/muxer_list.c libavformat/demuxer_list.c libavradio/inradio_list.c
 ifeq ($(SRC_LINK),src)
 	$(RM) src
 endif
diff --git a/configure b/configure
index eb2fe392b4..363dc8632e 100755
--- a/configure
+++ b/configure
@@ -75,6 +75,7 @@  Help options:
   --list-indevs            show all available input devices
   --list-outdevs           show all available output devices
   --list-filters           show all available filters
+  --list-inradios          show all available input radios
 
 Standard options:
   --logfile=FILE           log tests and output to FILE [ffbuild/config.log]
@@ -128,6 +129,7 @@  Component options:
   --disable-avdevice       disable libavdevice build
   --disable-avcodec        disable libavcodec build
   --disable-avformat       disable libavformat build
+  --disable-avradio        disable libavradio build
   --disable-swresample     disable libswresample build
   --disable-swscale        disable libswscale build
   --disable-postproc       disable libpostproc build
@@ -182,6 +184,10 @@  Individual component options:
   --enable-filter=NAME     enable filter NAME
   --disable-filter=NAME    disable filter NAME
   --disable-filters        disable all filters
+  --enable-inradios=NAME   enable input radio NAME
+  --disable-inradio=NAME   disable input radio NAME
+  --disable-inradios       disable input radios
+  --disable-radios         disable all radios
 
 External library support:
 
@@ -270,6 +276,7 @@  External library support:
   --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
   --enable-libsmbclient    enable Samba protocol via libsmbclient [no]
   --enable-libsnappy       enable Snappy compression, needed for hap encoding [no]
+  --enable-libsoapysdr     enable SoapySDR, needed for connecting to SDR HW [no]
   --enable-libsoxr         enable Include libsoxr resampling [no]
   --enable-libspeex        enable Speex de/encoding via libspeex [no]
   --enable-libsrt          enable Haivision SRT protocol via libsrt [no]
@@ -1743,11 +1750,16 @@  AVFORMAT_COMPONENTS="
     protocols
 "
 
+AVRADIO_COMPONENTS="
+    inradios
+"
+
 COMPONENT_LIST="
     $AVCODEC_COMPONENTS
     $AVDEVICE_COMPONENTS
     $AVFILTER_COMPONENTS
     $AVFORMAT_COMPONENTS
+    $AVRADIO_COMPONENTS
 "
 
 EXAMPLE_LIST="
@@ -1890,6 +1902,7 @@  EXTERNAL_LIBRARY_LIST="
     libshine
     libsmbclient
     libsnappy
+    libsoapysdr
     libsoxr
     libspeex
     libsrt
@@ -1982,6 +1995,7 @@  FEATURE_LIST="
 # this list should be kept in linking order
 LIBRARY_LIST="
     avdevice
+    avradio
     avfilter
     swscale
     postproc
@@ -2228,6 +2242,7 @@  HEADERS_LIST="
     ES2_gl_h
     gsm_h
     io_h
+    libavradio_version_h
     linux_dma_buf_h
     linux_perf_event_h
     machine_ioctl_bt848_h
@@ -3622,6 +3637,9 @@  xcbgrab_indev_deps="libxcb"
 xcbgrab_indev_suggest="libxcb_shm libxcb_shape libxcb_xfixes"
 xv_outdev_deps="xlib_xv xlib_x11 xlib_xext"
 
+# inradios
+sdr_inradio_deps="libsoapysdr"
+
 # protocols
 async_protocol_deps="threads"
 bluray_protocol_deps="libbluray"
@@ -3886,6 +3904,8 @@  avcodec_deps="avutil"
 avcodec_suggest="libm stdatomic"
 avdevice_deps="avformat avcodec avutil"
 avdevice_suggest="libm stdatomic"
+avradio_deps="avformat avcodec avutil libavradio_version_h"
+avradio_suggest="libm stdatomic"
 avfilter_deps="avutil"
 avfilter_suggest="libm stdatomic"
 avformat_deps="avcodec avutil"
@@ -4079,7 +4099,7 @@  find_things_extern(){
     pattern=$2
     file=$source_path/$3
     out=${4:-$thing}
-    sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
+    test -f "$file" && sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file"
 }
 
 find_filters_extern(){
@@ -4090,6 +4110,7 @@  find_filters_extern(){
 FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c)
 OUTDEV_LIST=$(find_things_extern muxer FFOutputFormat libavdevice/alldevices.c outdev)
 INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev)
+INRADIO_LIST=$(find_things_extern demuxer AVInputFormat libavradio/allradios.c inradio)
 MUXER_LIST=$(find_things_extern muxer FFOutputFormat libavformat/allformats.c)
 DEMUXER_LIST=$(find_things_extern demuxer AVInputFormat libavformat/allformats.c)
 ENCODER_LIST=$(find_things_extern encoder FFCodec libavcodec/allcodecs.c)
@@ -4126,11 +4147,16 @@  AVFORMAT_COMPONENTS_LIST="
     $PROTOCOL_LIST
 "
 
+AVRADIO_COMPONENTS_LIST="
+    $INRADIO_LIST
+"
+
 ALL_COMPONENTS="
     $AVCODEC_COMPONENTS_LIST
     $AVDEVICE_COMPONENTS_LIST
     $AVFILTER_COMPONENTS_LIST
     $AVFORMAT_COMPONENTS_LIST
+    $AVRADIO_COMPONENTS_LIST
 "
 
 for n in $COMPONENT_LIST; do
@@ -4217,6 +4243,9 @@  for opt do
         --disable-devices)
             disable $INDEV_LIST $OUTDEV_LIST
         ;;
+        --disable-radios)
+            disable $INRADIO_LIST
+        ;;
         --enable-debug=*)
             debuglevel="$optval"
         ;;
@@ -6306,6 +6335,10 @@  check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)"
 check_ldflags -Wl,--as-needed
 check_ldflags -Wl,-z,noexecstack
 
+if ! disabled avradio; then
+    test -f $source_path/libavradio/version.h && enable libavradio_version_h
+fi
+
 if ! disabled network; then
     check_func getaddrinfo $network_extralibs
     check_func inet_aton $network_extralibs
@@ -6787,6 +6820,7 @@  enabled libshine          && require_pkg_config libshine shine shine/layer3.h sh
 enabled libsmbclient      && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
                                require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
 enabled libsnappy         && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
+enabled libsoapysdr       && require libsoapysdr SoapySDR/Device.h SoapySDRDevice_enumerate -lSoapySDR
 enabled libsoxr           && require libsoxr soxr.h soxr_create -lsoxr
 enabled libssh            && require_pkg_config libssh libssh libssh/sftp.h sftp_init
 enabled libspeex          && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
@@ -7248,7 +7282,7 @@  EOF
 
 # add some linker flags
 check_ldflags -Wl,--warn-common
-check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
+check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavradio:libavformat:libavcodec:libavutil
 enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
 test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
 
@@ -7653,6 +7687,7 @@  expand_deps(){
 
 #we have to remove gpl from the deps here as some code assumes all lib deps are libs
 postproc_deps="$(filter_out 'gpl' $postproc_deps)"
+avradio_deps="$(filter_out 'libavradio_version_h' $avradio_deps)"
 
 map 'expand_deps $v' $LIBRARY_LIST
 
@@ -7770,7 +7805,7 @@  echo "Programs:"
 print_enabled '' $PROGRAM_LIST | print_in_columns
 echo
 
-for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
+for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev inradio; do
     echo "Enabled ${type}s:"
     eval list=\$$(toupper $type)_LIST
     print_enabled '_*' $list | print_in_columns
@@ -8076,6 +8111,9 @@  print_enabled_components(){
                 outdev_list)
                     c=${c%_outdev}_muxer
                 ;;
+                inradio_list)
+                    c=${c%_inradio}_demuxer
+                ;;
             esac
             printf "    &ff_%s,\n" $c >> $TMPH
         fi
@@ -8097,6 +8135,7 @@  print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $
 print_enabled_components libavformat/muxer_list.c FFOutputFormat muxer_list $MUXER_LIST
 print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list $INDEV_LIST
 print_enabled_components libavdevice/outdev_list.c FFOutputFormat outdev_list $OUTDEV_LIST
+print_enabled_components libavradio/inradio_list.c AVInputFormat inradio_list $INRADIO_LIST
 print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
 
 # Settings for pkg-config files
@@ -8115,6 +8154,7 @@  LIBSUF=${LIBSUF}
 extralibs_avutil="$avutil_extralibs"
 extralibs_avcodec="$avcodec_extralibs"
 extralibs_avformat="$avformat_extralibs"
+extralibs_avradio="$avradio_extralibs"
 extralibs_avdevice="$avdevice_extralibs"
 extralibs_avfilter="$avfilter_extralibs"
 extralibs_postproc="$postproc_extralibs"