From patchwork Thu Jul 27 22:38:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43010 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7927:b0:130:ccc6:6c4b with SMTP id b39csp290625pzg; Thu, 27 Jul 2023 15:39:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlGrdYsucv1v/npaYdvMKg5+L+V8YzVtlbklgxxVmv+6fikuQRP5YAXYEkfH4dExVC+Q88gN X-Received: by 2002:a2e:9247:0:b0:2b9:c4f6:fe8 with SMTP id v7-20020a2e9247000000b002b9c4f60fe8mr224527ljg.40.1690497559222; Thu, 27 Jul 2023 15:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690497559; cv=none; d=google.com; s=arc-20160816; b=JRhWSWYelREY6ElViiPWmac91KaapKy9yNU1YWYQD/fhYFKCKAQ8GRVc++KyPMarHR c14WXW03v6G4EowjNgiAvb6iHse7pJywk4ct5H05SCwvrwcIuYiNWJGMLPs9HlZodNWQ Y/Wl/7R6X1PXEKbfquXIZr3UJtvIeHnZWpQHAKhEuvPXMF7EkGNxyoSQMutpbMxxQfc+ YKuZhJ0jGAV3F+YhoEI1W5D6++gJM7ngdbVg/wmy2i/1gURRrwrLTnrUdmRVHuh75YZl H8RX4y2WBTembptirVlkAsIS0vL8AsDFM/wUMpLJdeaeQ4m+SmQFKnCgDZ8atNbIruJo vTdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=oi/8NshKDBi3+6GEOUYbgHb3qIDo0e7a9WVohTWolL0=; fh=YYwLYmpaV0Fpw/rxmSKNRLS2XzDkAlGbHATiKOPtZrY=; b=vI+SfYPFbgBTnZrNOH/YGBboavL0yRepdPt+nq4VWvqOv7CgKGEmjDs6u3M3ph0RgK dOsiPl6YbzPQuQSf/Q35bqnBaVhyiEenXJgo3jEczaJby5PcYbukd0LKbMHTLdRGU6a7 3JmPBrVsl6RdgcRkeEBm2jTslDPYdZ5NTgxLSUgdzvXFpdAGY179No9GaAhndMZWlLvE FI6zFy6kt0SyR4anfBlb2Meb15IX/4a9mvX/3vkMLqrXcaEXVPPBpe90HRLcldaLiq11 vXoJ7uVa/fBRGlFuDsxNovPy5zKfhFLQ8DEw+le3nWvwUuOz91Kn1wTCRuZ5rb5kE/u8 8ogw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id by23-20020a170906a2d700b00992d753205csi1644570ejb.658.2023.07.27.15.39.03; Thu, 27 Jul 2023 15:39:19 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 62BB668C5A1; Fri, 28 Jul 2023 01:38:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0009268C5A1 for ; Fri, 28 Jul 2023 01:38:41 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 15F58C0008 for ; Thu, 27 Jul 2023 22:38:40 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 28 Jul 2023 00:38:37 +0200 Message-Id: <20230727223837.3970793-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230727223837.3970793-1-michael@niedermayer.cc> References: <20230727223837.3970793-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 2/2] Move sdr within the libavradio repository X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: /EJ/Yr6Xc4qq This moves sdr back from libavradio into libavdevice & libavformat (inside the libavradio repository) People originally wanted this code in a libavradio library but recently suggested that sdr should have no impact on other things in FFmpeg. libavradio has a substantial impact as it will result in distributions packaging a new library. Also there is currently no API specific to sdr, its just the input device API. So until a new API is created there is no benefit from a new library in the release. This also avoids the need for build system changes for a new library --- Makefile | 5 +- configure | 36 +----- fftools/ffmpeg.c | 5 - fftools/ffplay.c | 4 - fftools/ffprobe.c | 4 - fftools/opt_common.c | 62 +-------- fftools/opt_common.h | 27 ---- libavdevice/Makefile | 1 + libavdevice/alldevices.c | 1 + .../sdrinradio.c => libavdevice/sdrindev.c | 18 +-- libavdevice/utils.c | 2 +- libavformat/Makefile | 1 + libavformat/allformats.c | 33 ++--- libavformat/internal.h | 1 - {libavradio => libavformat}/rds.c | 0 {libavradio => libavformat}/sdr.h | 20 +-- .../sdr_vissualize.c | 0 {libavradio => libavformat}/sdrdemux.c | 28 ++-- libavradio/Makefile | 15 --- libavradio/allradios.c | 66 ---------- libavradio/avradio.c | 32 ----- libavradio/avradio.h | 121 ------------------ libavradio/internal.h | 28 ---- libavradio/utils.c | 59 --------- libavradio/version.c | 45 ------- libavradio/version.h | 45 ------- libavradio/version_major.h | 36 ------ libavutil/log.h | 1 - tools/uncoded_frame.c | 4 - 29 files changed, 55 insertions(+), 645 deletions(-) rename libavradio/sdrinradio.c => libavdevice/sdrindev.c (98%) rename {libavradio => libavformat}/rds.c (100%) rename {libavradio => libavformat}/sdr.h (95%) rename libavradio/vissualize.c => libavformat/sdr_vissualize.c (100%) rename {libavradio => libavformat}/sdrdemux.c (99%) delete mode 100644 libavradio/Makefile delete mode 100644 libavradio/allradios.c delete mode 100644 libavradio/avradio.c delete mode 100644 libavradio/avradio.h delete mode 100644 libavradio/internal.h delete mode 100644 libavradio/utils.c delete mode 100644 libavradio/version.c delete mode 100644 libavradio/version.h delete mode 100644 libavradio/version_major.h diff --git a/Makefile b/Makefile index d5689231c3..bf1b69f96b 100644 --- a/Makefile +++ b/Makefile @@ -19,14 +19,13 @@ 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 avradio avutil postproc swscale swresample +ALLFFLIBS = avcodec avdevice avfilter avformat 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 @@ -172,7 +171,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 libavradio/inradio_list.c + libavformat/muxer_list.c libavformat/demuxer_list.c ifeq ($(SRC_LINK),src) $(RM) src endif diff --git a/configure b/configure index b104455822..23c9df3b73 100755 --- a/configure +++ b/configure @@ -75,7 +75,6 @@ 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] @@ -129,7 +128,6 @@ 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 @@ -184,10 +182,6 @@ 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: @@ -1750,16 +1744,11 @@ AVFORMAT_COMPONENTS=" protocols " -AVRADIO_COMPONENTS=" - inradios -" - COMPONENT_LIST=" $AVCODEC_COMPONENTS $AVDEVICE_COMPONENTS $AVFILTER_COMPONENTS $AVFORMAT_COMPONENTS - $AVRADIO_COMPONENTS " EXAMPLE_LIST=" @@ -1995,7 +1984,6 @@ FEATURE_LIST=" # this list should be kept in linking order LIBRARY_LIST=" avdevice - avradio avfilter swscale postproc @@ -3627,6 +3615,7 @@ oss_outdev_deps_any="sys_soundcard_h" pulse_indev_deps="libpulse" pulse_outdev_deps="libpulse" sdl2_outdev_deps="sdl2" +sdr_indev_deps="libsoapysdr sdrfile_demuxer" sndio_indev_deps="sndio" sndio_outdev_deps="sndio" v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" @@ -3638,9 +3627,6 @@ 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" @@ -3905,8 +3891,6 @@ avcodec_deps="avutil" avcodec_suggest="libm stdatomic" avdevice_deps="avformat avcodec avutil" avdevice_suggest="libm stdatomic" -avradio_deps="avformat avcodec avutil" -avradio_suggest="libm stdatomic" avfilter_deps="avutil" avfilter_suggest="libm stdatomic" avformat_deps="avcodec avutil" @@ -4111,7 +4095,6 @@ 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) @@ -4148,16 +4131,11 @@ 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 @@ -4244,9 +4222,6 @@ for opt do --disable-devices) disable $INDEV_LIST $OUTDEV_LIST ;; - --disable-radios) - disable $INRADIO_LIST - ;; --enable-debug=*) debuglevel="$optval" ;; @@ -7280,7 +7255,7 @@ EOF # add some linker flags check_ldflags -Wl,--warn-common -check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavradio:libavformat:libavcodec:libavutil +check_ldflags -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic @@ -7803,7 +7778,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 inradio; do +for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do echo "Enabled ${type}s:" eval list=\$$(toupper $type)_LIST print_enabled '_*' $list | print_in_columns @@ -8109,9 +8084,6 @@ print_enabled_components(){ outdev_list) c=${c%_outdev}_muxer ;; - inradio_list) - c=${c%_inradio}_demuxer - ;; esac printf " &ff_%s,\n" $c >> $TMPH fi @@ -8133,7 +8105,6 @@ 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 @@ -8152,7 +8123,6 @@ 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" diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 3c6777f519..435e12a37b 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -95,8 +95,6 @@ #include "libavdevice/avdevice.h" -#include "libavradio/avradio.h" - #include "libswresample/swresample.h" #include "libavfilter/avfilter.h" @@ -1313,9 +1311,6 @@ int main(int argc, char **argv) #if CONFIG_AVDEVICE avdevice_register_all(); -#endif -#if CONFIG_AVRADIO - avradio_register_all(); #endif avformat_network_init(); diff --git a/fftools/ffplay.c b/fftools/ffplay.c index 311753055f..15fd644974 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -45,7 +45,6 @@ #include "libavutil/bprint.h" #include "libavformat/avformat.h" #include "libavdevice/avdevice.h" -#include "libavradio/avradio.h" #include "libswscale/swscale.h" #include "libavutil/opt.h" #include "libavcodec/avfft.h" @@ -3630,9 +3629,6 @@ int main(int argc, char **argv) /* register all codecs, demux and protocols */ #if CONFIG_AVDEVICE avdevice_register_all(); -#endif -#if CONFIG_AVRADIO - avradio_register_all(); #endif avformat_network_init(); diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index c0eef62d3b..1ff76ce809 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -56,7 +56,6 @@ #include "libavutil/timestamp.h" #include "libavdevice/avdevice.h" #include "libavdevice/version.h" -#include "libavradio/avradio.h" #include "libswscale/swscale.h" #include "libswscale/version.h" #include "libswresample/swresample.h" @@ -4110,9 +4109,6 @@ int main(int argc, char **argv) #if CONFIG_AVDEVICE avdevice_register_all(); #endif -#if CONFIG_AVRADIO - avradio_register_all(); -#endif show_banner(argc, argv, options); parse_options(NULL, argc, argv, options, opt_input_file); diff --git a/fftools/opt_common.c b/fftools/opt_common.c index 2796a49582..f6fe9815e1 100644 --- a/fftools/opt_common.c +++ b/fftools/opt_common.c @@ -51,9 +51,6 @@ #include "libavdevice/avdevice.h" #include "libavdevice/version.h" -#include "libavradio/avradio.h" -#include "libavradio/version.h" - #include "libavfilter/avfilter.h" #include "libavfilter/version.h" @@ -190,7 +187,6 @@ static void print_all_libs_info(int flags, int level) PRINT_LIB_INFO(avutil, AVUTIL, flags, level); PRINT_LIB_INFO(avcodec, AVCODEC, flags, level); PRINT_LIB_INFO(avformat, AVFORMAT, flags, level); - PRINT_LIB_INFO(avradio, AVRADIO, flags, level); PRINT_LIB_INFO(avdevice, AVDEVICE, flags, level); PRINT_LIB_INFO(avfilter, AVFILTER, flags, level); PRINT_LIB_INFO(swscale, SWSCALE, flags, level); @@ -844,13 +840,6 @@ static int is_device(const AVClass *avclass) return AV_IS_INPUT_DEVICE(avclass->category) || AV_IS_OUTPUT_DEVICE(avclass->category); } -static int is_radio(const AVClass *avclass) -{ - if (!avclass) - return 0; - return avclass->category == AV_CLASS_CATEGORY_RADIO_INPUT; -} - static int show_formats_devices(void *optctx, const char *opt, const char *arg, int device_only, int muxdemuxers) { void *ifmt_opaque = NULL; @@ -858,13 +847,12 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, void *ofmt_opaque = NULL; const AVOutputFormat *ofmt = NULL; const char *last_name; - int is_dev, is_rad; - const char *name[3] = {"File formats:", "Devices:", "Radios:"}; + int is_dev; printf("%s\n" " D. = Demuxing supported\n" " .E = Muxing supported\n" - " --\n", name[device_only]); + " --\n", device_only ? "Devices:" : "File formats:"); last_name = "000"; for (;;) { int decode = 0; @@ -876,9 +864,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, ofmt_opaque = NULL; while ((ofmt = av_muxer_iterate(&ofmt_opaque))) { is_dev = is_device(ofmt->priv_class); - if (!is_dev && device_only == 1) - continue; - if (device_only == 2) + if (!is_dev && device_only) continue; if ((!name || strcmp(ofmt->name, name) < 0) && strcmp(ofmt->name, last_name) > 0) { @@ -892,10 +878,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, ifmt_opaque = NULL; while ((ifmt = av_demuxer_iterate(&ifmt_opaque))) { is_dev = is_device(ifmt->priv_class); - is_rad = is_radio(ifmt->priv_class); - if (!is_dev && device_only == 1) - continue; - if (!is_rad && device_only == 2) + if (!is_dev && device_only) continue; if ((!name || strcmp(ifmt->name, name) < 0) && strcmp(ifmt->name, last_name) > 0) { @@ -940,11 +923,6 @@ int show_devices(void *optctx, const char *opt, const char *arg) return show_formats_devices(optctx, opt, arg, 1, SHOW_DEFAULT); } -int show_radios(void *optctx, const char *opt, const char *arg) -{ - return show_formats_devices(optctx, opt, arg, 2, SHOW_DEFAULT); -} - int show_protocols(void *optctx, const char *opt, const char *arg) { void *opaque = NULL; @@ -1351,7 +1329,7 @@ static int print_device_sources(const AVInputFormat *fmt, AVDictionary *opts) int ret; AVDeviceInfoList *device_list = NULL; - if (!fmt || !fmt->priv_class || (!AV_IS_INPUT_DEVICE(fmt->priv_class->category) && fmt->priv_class->category != AV_CLASS_CATEGORY_RADIO_INPUT)) + if (!fmt || !fmt->priv_class || !AV_IS_INPUT_DEVICE(fmt->priv_class->category)) return AVERROR(EINVAL); printf("Auto-detected sources for %s:\n", fmt->name); @@ -1484,33 +1462,3 @@ int show_sinks(void *optctx, const char *opt, const char *arg) return ret; } #endif /* CONFIG_AVDEVICE */ - -#if CONFIG_AVRADIO -int show_radio_sources(void *optctx, const char *opt, const char *arg) -{ - const AVInputFormat *fmt = NULL; - char *dev = NULL; - AVDictionary *opts = NULL; - int ret = 0; - int error_level = av_log_get_level(); - - av_log_set_level(AV_LOG_WARNING); - - if ((ret = show_sinks_sources_parse_arg(arg, &dev, &opts)) < 0) - goto fail; - - do { - fmt = av_input_radio_next(fmt); - if (fmt) { - if (dev && !av_match_name(dev, fmt->name)) - continue; - print_device_sources(fmt, opts); - } - } while (fmt); - fail: - av_dict_free(&opts); - av_free(dev); - av_log_set_level(error_level); - return ret; -} -#endif /* CONFIG_AVRADIO */ diff --git a/fftools/opt_common.h b/fftools/opt_common.h index b64ab07e10..ea1d16e769 100644 --- a/fftools/opt_common.h +++ b/fftools/opt_common.h @@ -39,15 +39,6 @@ int show_sinks(void *optctx, const char *opt, const char *arg); int show_sources(void *optctx, const char *opt, const char *arg); #endif -#if CONFIG_AVRADIO -/** - * Print a listing containing autodetected sources of the input radio. - * Device name with options may be passed as an argument to limit results. - */ -int show_radio_sources(void *optctx, const char *opt, const char *arg); -#endif - - #if CONFIG_AVDEVICE #define CMDUTILS_COMMON_OPTIONS_AVDEVICE \ { "sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_sources }, \ @@ -59,15 +50,6 @@ int show_radio_sources(void *optctx, const char *opt, const char *arg); #define CMDUTILS_COMMON_OPTIONS_AVDEVICE #endif -#if CONFIG_AVRADIO -#define CMDUTILS_COMMON_OPTIONS_AVRADIO \ - { "radio_sources" , OPT_EXIT | HAS_ARG, { .func_arg = show_radio_sources }, \ - "list sources of the input device", "device" }, \ - -#else -#define CMDUTILS_COMMON_OPTIONS_AVRADIO -#endif - /** * Print the license of the program to stdout. The license depends on * the license of the libraries compiled into the program. @@ -123,13 +105,6 @@ int show_demuxers(void *optctx, const char *opt, const char *arg); */ int show_devices(void *optctx, const char *opt, const char *arg); -/** - * Print a listing containing all the radios supported by the - * program. - * This option processing function does not utilize the arguments. - */ -int show_radios(void *optctx, const char *opt, const char *arg); - /** * Print a listing containing all the codecs supported by the * program. @@ -233,7 +208,6 @@ int opt_cpucount(void *optctx, const char *opt, const char *arg); { "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" }, \ { "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" }, \ { "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" }, \ - { "radios", OPT_EXIT, { .func_arg = show_radios }, "show available radios" }, \ { "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" }, \ { "decoders", OPT_EXIT, { .func_arg = show_decoders }, "show available decoders" }, \ { "encoders", OPT_EXIT, { .func_arg = show_encoders }, "show available encoders" }, \ @@ -253,6 +227,5 @@ int opt_cpucount(void *optctx, const char *opt, const char *arg); { "cpucount", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpucount }, "force specific cpu count", "count" }, \ { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, \ CMDUTILS_COMMON_OPTIONS_AVDEVICE \ - CMDUTILS_COMMON_OPTIONS_AVRADIO \ #endif /* FFTOOLS_OPT_COMMON_H */ diff --git a/libavdevice/Makefile b/libavdevice/Makefile index c30449201d..2ddabd19b0 100644 --- a/libavdevice/Makefile +++ b/libavdevice/Makefile @@ -43,6 +43,7 @@ OBJS-$(CONFIG_PULSE_INDEV) += pulse_audio_dec.o \ OBJS-$(CONFIG_PULSE_OUTDEV) += pulse_audio_enc.o \ pulse_audio_common.o OBJS-$(CONFIG_SDL2_OUTDEV) += sdl2.o +OBJS-$(CONFIG_SDR_INDEV) += sdrindev.o OBJS-$(CONFIG_SNDIO_INDEV) += sndio_dec.o sndio.o OBJS-$(CONFIG_SNDIO_OUTDEV) += sndio_enc.o sndio.o OBJS-$(CONFIG_V4L2_INDEV) += v4l2.o v4l2-common.o timefilter.o diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index 8a90fcb5d7..5dbfb24cbc 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -47,6 +47,7 @@ extern const FFOutputFormat ff_oss_muxer; extern const AVInputFormat ff_pulse_demuxer; extern const FFOutputFormat ff_pulse_muxer; extern const FFOutputFormat ff_sdl2_muxer; +extern const AVInputFormat ff_sdr_demuxer; extern const AVInputFormat ff_sndio_demuxer; extern const FFOutputFormat ff_sndio_muxer; extern const AVInputFormat ff_v4l2_demuxer; diff --git a/libavradio/sdrinradio.c b/libavdevice/sdrindev.c similarity index 98% rename from libavradio/sdrinradio.c rename to libavdevice/sdrindev.c index ab7e786744..f07bd6b154 100644 --- a/libavradio/sdrinradio.c +++ b/libavdevice/sdrindev.c @@ -23,7 +23,6 @@ #include #include -#include "sdr.h" #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/fifo.h" @@ -36,6 +35,7 @@ #include "libavformat/avformat.h" #include "libavformat/demux.h" #include "libavformat/internal.h" +#include "libavformat/sdr.h" #include "libavdevice/avdevice.h" #define MAX_CHANNELS 4 @@ -212,7 +212,7 @@ static int sdrindev_initial_hw_setup(AVFormatContext *s) if (!sdr->driver_name) return AVERROR(EINVAL); //No driver specified and none found - ff_sdr_autodetect_workarounds(sdr); + avpriv_sdr_autodetect_workarounds(sdr); SoapySDRKwargs_set(&args, "driver", sdr->driver_name); sdr->soapy = soapy = SoapySDRDevice_make(&args); @@ -396,7 +396,7 @@ static int sdrindev_initial_hw_setup(AVFormatContext *s) SoapySDRDevice_activateStream(soapy, soapyRxStream, 0, 0, 0); - return ff_sdr_common_init(s); + return avpriv_sdr_common_init(s); } static int sdrindev_read_close(AVFormatContext *s) @@ -404,7 +404,7 @@ static int sdrindev_read_close(AVFormatContext *s) SDRContext *sdr = s->priv_data; SoapySDRDevice *soapy = sdr->soapy; - ff_sdr_stop_threading(s); + avpriv_sdr_stop_threading(s); if (soapy) { if (sdr->soapyRxStream) { @@ -417,7 +417,7 @@ static int sdrindev_read_close(AVFormatContext *s) sdr->soapy = NULL; } - return ff_sdr_read_close(s); + return avpriv_sdr_read_close(s); } static int sdr_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_list) @@ -467,9 +467,9 @@ static int sdr_get_device_list(AVFormatContext *ctx, AVDeviceInfoList *device_li static const AVClass sdr_demuxer_class = { .class_name = "sdr", .item_name = av_default_item_name, - .option = ff_sdr_options, + .option = avpriv_sdr_options, .version = LIBAVUTIL_VERSION_INT, - .category = AV_CLASS_CATEGORY_RADIO_INPUT, + .category = AV_CLASS_CATEGORY_DEMUXER, }; const AVInputFormat ff_sdr_demuxer = { @@ -477,9 +477,9 @@ const AVInputFormat ff_sdr_demuxer = { .long_name = NULL_IF_CONFIG_SMALL("Software Defined Radio Demodulator"), .priv_data_size = sizeof(SDRContext), .read_header = sdrindev_initial_hw_setup, - .read_packet = ff_sdr_read_packet, + .read_packet = avpriv_sdr_read_packet, .read_close = sdrindev_read_close, - .read_seek = ff_sdr_read_seek, + .read_seek = avpriv_sdr_read_seek, .get_device_list= sdr_get_device_list, .flags = AVFMT_NOFILE, .flags_internal = FF_FMT_INIT_CLEANUP, diff --git a/libavdevice/utils.c b/libavdevice/utils.c index faa24fa74d..d9a52c53ab 100644 --- a/libavdevice/utils.c +++ b/libavdevice/utils.c @@ -33,7 +33,7 @@ int ff_alloc_input_device_context(AVFormatContext **avctx, const AVInputFormat * if (!iformat) iformat = av_find_input_format(format); - if (!iformat || !iformat->priv_class || (!AV_IS_INPUT_DEVICE(iformat->priv_class->category) && iformat->priv_class->category != AV_CLASS_CATEGORY_RADIO_INPUT)) { + if (!iformat || !iformat->priv_class || !AV_IS_INPUT_DEVICE(iformat->priv_class->category)) { ret = AVERROR(EINVAL); goto error; } diff --git a/libavformat/Makefile b/libavformat/Makefile index 4cb00f8700..6f99adb429 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -532,6 +532,7 @@ OBJS-$(CONFIG_SCC_MUXER) += sccenc.o OBJS-$(CONFIG_SCD_DEMUXER) += scd.o OBJS-$(CONFIG_SDNS_DEMUXER) += sdns.o OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o +OBJS-$(CONFIG_SDRFILE_DEMUXER) += sdrdemux.o sdr_vissualize.o rds.o OBJS-$(CONFIG_SDR2_DEMUXER) += sdr2.o OBJS-$(CONFIG_SDS_DEMUXER) += sdsdec.o OBJS-$(CONFIG_SDX_DEMUXER) += sdxdec.o pcm.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 27a32028dd..d0e6fb5412 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -415,6 +415,7 @@ extern const AVInputFormat ff_scd_demuxer; extern const AVInputFormat ff_sdns_demuxer; extern const AVInputFormat ff_sdp_demuxer; extern const AVInputFormat ff_sdr2_demuxer; +extern const AVInputFormat ff_sdrfile_demuxer; extern const AVInputFormat ff_sds_demuxer; extern const AVInputFormat ff_sdx_demuxer; extern const AVInputFormat ff_segafilm_demuxer; @@ -570,7 +571,6 @@ extern const AVInputFormat ff_vapoursynth_demuxer; static atomic_uintptr_t indev_list_intptr = ATOMIC_VAR_INIT(0); static atomic_uintptr_t outdev_list_intptr = ATOMIC_VAR_INIT(0); -static atomic_uintptr_t inradio_list_intptr= ATOMIC_VAR_INIT(0); const AVOutputFormat *av_muxer_iterate(void **opaque) { @@ -595,32 +595,20 @@ const AVOutputFormat *av_muxer_iterate(void **opaque) const AVInputFormat *av_demuxer_iterate(void **opaque) { + static const uintptr_t size = sizeof(demuxer_list)/sizeof(demuxer_list[0]) - 1; uintptr_t i = (uintptr_t)*opaque; const AVInputFormat *f = NULL; uintptr_t tmp; - if (i % 4 == 0) { - f = demuxer_list[i/4]; - if (!f) - i = 1; - } - if (i % 4 == 1) { - if(tmp = atomic_load_explicit(&indev_list_intptr, memory_order_relaxed)) { - const AVInputFormat *const *indev_list = (const AVInputFormat *const *)tmp; - f = indev_list[i/4]; - } - if (!f) - i = 2; - } - if (i % 4 == 2) { - if(tmp = atomic_load_explicit(&inradio_list_intptr, memory_order_relaxed)) { - const AVInputFormat *const *indev_list = (const AVInputFormat *const *)tmp; - f = indev_list[i/4]; - } + if (i < size) { + f = demuxer_list[i]; + } else if (tmp = atomic_load_explicit(&indev_list_intptr, memory_order_relaxed)) { + const AVInputFormat *const *indev_list = (const AVInputFormat *const *)tmp; + f = indev_list[i - size]; } if (f) - *opaque = (void*)(i + 4); + *opaque = (void*)(i + 1); return f; } @@ -629,8 +617,3 @@ void avpriv_register_devices(const FFOutputFormat * const o[], const AVInputForm atomic_store_explicit(&outdev_list_intptr, (uintptr_t)o, memory_order_relaxed); atomic_store_explicit(&indev_list_intptr, (uintptr_t)i, memory_order_relaxed); } - -void avpriv_register_radios(const FFOutputFormat * const o[], const AVInputFormat * const i[]) -{ - atomic_store_explicit(&inradio_list_intptr, (uintptr_t)i, memory_order_relaxed); -} diff --git a/libavformat/internal.h b/libavformat/internal.h index aa6b8b21a9..9fc980601f 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -719,6 +719,5 @@ int ff_match_url_ext(const char *url, const char *extensions); struct FFOutputFormat; void avpriv_register_devices(const struct FFOutputFormat * const o[], const AVInputFormat * const i[]); -void avpriv_register_radios(const struct FFOutputFormat * const o[], const AVInputFormat * const i[]); #endif /* AVFORMAT_INTERNAL_H */ diff --git a/libavradio/rds.c b/libavformat/rds.c similarity index 100% rename from libavradio/rds.c rename to libavformat/rds.c diff --git a/libavradio/sdr.h b/libavformat/sdr.h similarity index 95% rename from libavradio/sdr.h rename to libavformat/sdr.h index b27e6a719e..77278ada67 100644 --- a/libavradio/sdr.h +++ b/libavformat/sdr.h @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVRADIO_SDR_H -#define AVRADIO_SDR_H +#ifndef AVFORMAT_SDR_H +#define AVFORMAT_SDR_H #include #include @@ -290,14 +290,14 @@ typedef struct BandDescriptor { int64_t freq_max; } BandDescriptor ; -extern const AVOption ff_sdr_options[]; +extern const AVOption avpriv_sdr_options[]; extern ModulationDescriptor ff_sdr_modulation_descs[]; /** * Detect hw bug specific workarounds. */ -void ff_sdr_autodetect_workarounds(SDRContext *sdr); +void avpriv_sdr_autodetect_workarounds(SDRContext *sdr); /** * Set the center frequency of the hardware @@ -306,19 +306,19 @@ void ff_sdr_autodetect_workarounds(SDRContext *sdr); */ int ff_sdr_set_freq(SDRContext *sdr, int64_t freq); -int ff_sdr_common_init(AVFormatContext *s); +int avpriv_sdr_common_init(AVFormatContext *s); -int ff_sdr_read_packet(AVFormatContext *s, AVPacket *pkt); +int avpriv_sdr_read_packet(AVFormatContext *s, AVPacket *pkt); -int ff_sdr_read_seek(AVFormatContext *s, int stream_index, int64_t target, int flags); +int avpriv_sdr_read_seek(AVFormatContext *s, int stream_index, int64_t target, int flags); /** * shuts down threads, destroys mutex * Safe to call if no thread was started or after it was shutdown */ -void ff_sdr_stop_threading(AVFormatContext *s); +void avpriv_sdr_stop_threading(AVFormatContext *s); -int ff_sdr_read_close(AVFormatContext *s); +int avpriv_sdr_read_close(AVFormatContext *s); int ff_sdr_vissualization(SDRContext *sdr, AVStream *st, AVPacket *pkt); @@ -343,4 +343,4 @@ static inline float len2(AVComplexFloat c) return c.re*c.re + c.im*c.im; } -#endif /* AVRADIO_SDR_H */ +#endif /* AVFORMAT_SDR_H */ diff --git a/libavradio/vissualize.c b/libavformat/sdr_vissualize.c similarity index 100% rename from libavradio/vissualize.c rename to libavformat/sdr_vissualize.c diff --git a/libavradio/sdrdemux.c b/libavformat/sdrdemux.c similarity index 99% rename from libavradio/sdrdemux.c rename to libavformat/sdrdemux.c index 78c933f6f1..0dc89041c5 100644 --- a/libavradio/sdrdemux.c +++ b/libavformat/sdrdemux.c @@ -99,7 +99,7 @@ static void apply_deemphasis(SDRContext *sdr, AVComplexFloat *data, int len, int } } -void ff_sdr_autodetect_workarounds(SDRContext *sdr) +void avpriv_sdr_autodetect_workarounds(SDRContext *sdr) { if (sdr-> rtlsdr_fixes < 0 && sdr->driver_name) sdr->rtlsdr_fixes = !strcmp(sdr->driver_name, "rtlsdr"); @@ -1565,7 +1565,7 @@ static void init_window(SDRContext *sdr, float *window, int block_size) } } -int ff_sdr_common_init(AVFormatContext *s) +int avpriv_sdr_common_init(AVFormatContext *s) { SDRContext *sdr = s->priv_data; AVStream *st; @@ -1576,7 +1576,7 @@ int ff_sdr_common_init(AVFormatContext *s) sdr->avfmt = s; s->ctx_flags |= AVFMTCTX_NOHEADER; - ff_sdr_autodetect_workarounds(sdr); + avpriv_sdr_autodetect_workarounds(sdr); if (sdr->bandwidth > sdr->sdr_sample_rate * 7 / 8) av_log(s, AV_LOG_WARNING, "Bandwidth looks suspicious\n"); @@ -1815,10 +1815,10 @@ static int sdrfile_initial_setup(AVFormatContext *s) sdr->read_callback = sdrfile_read_callback; - return ff_sdr_common_init(s); + return avpriv_sdr_common_init(s); } -int ff_sdr_read_packet(AVFormatContext *s, AVPacket *pkt) +int avpriv_sdr_read_packet(AVFormatContext *s, AVPacket *pkt) { SDRContext *sdr = s->priv_data; int ret, i, full_blocks, seek_direction; @@ -2169,7 +2169,7 @@ process_next_block: return AVERROR(EAGAIN); } -int ff_sdr_read_seek(AVFormatContext *s, int stream_index, +int avpriv_sdr_read_seek(AVFormatContext *s, int stream_index, int64_t target, int flags) { SDRContext *sdr = s->priv_data; @@ -2208,7 +2208,7 @@ int ff_sdr_read_seek(AVFormatContext *s, int stream_index, return 0; } -void ff_sdr_stop_threading(AVFormatContext *s) +void avpriv_sdr_stop_threading(AVFormatContext *s) { SDRContext *sdr = s->priv_data; @@ -2227,12 +2227,12 @@ void ff_sdr_stop_threading(AVFormatContext *s) sdr->thread_started = 0; } -int ff_sdr_read_close(AVFormatContext *s) +int avpriv_sdr_read_close(AVFormatContext *s) { SDRContext *sdr = s->priv_data; int i; - ff_sdr_stop_threading(s); + avpriv_sdr_stop_threading(s); av_fifo_freep2(&sdr->empty_block_fifo); av_fifo_freep2(&sdr->full_block_fifo); @@ -2300,7 +2300,7 @@ static int sdrfile_probe(const AVProbeData *p) #define OFFSET(x) offsetof(SDRContext, x) #define DEC AV_OPT_FLAG_DECODING_PARAM -const AVOption ff_sdr_options[] = { +const AVOption avpriv_sdr_options[] = { { "video_size", "set frame size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = "0x0"}, 0, 0, DEC }, { "framerate" , "set frame rate", OFFSET(fps), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX,DEC }, { "block_size", "FFT block size", OFFSET(block_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, DEC}, @@ -2361,7 +2361,7 @@ const AVOption ff_sdr_options[] = { static const AVClass sdrfile_demuxer_class = { .class_name = "sdrfile", .item_name = av_default_item_name, - .option = ff_sdr_options, + .option = avpriv_sdr_options, .version = LIBAVUTIL_VERSION_INT, .category = AV_CLASS_CATEGORY_DEMUXER, }; @@ -2372,9 +2372,9 @@ const AVInputFormat ff_sdrfile_demuxer = { .priv_data_size = sizeof(SDRContext), .read_probe = sdrfile_probe, .read_header = sdrfile_initial_setup, - .read_packet = ff_sdr_read_packet, - .read_close = ff_sdr_read_close, - .read_seek = ff_sdr_read_seek, + .read_packet = avpriv_sdr_read_packet, + .read_close = avpriv_sdr_read_close, + .read_seek = avpriv_sdr_read_seek, .flags_internal = FF_FMT_INIT_CLEANUP, .priv_class = &sdrfile_demuxer_class, }; diff --git a/libavradio/Makefile b/libavradio/Makefile deleted file mode 100644 index 5efc2588c3..0000000000 --- a/libavradio/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -NAME = avradio -DESC = FFmpeg softwarde defined radio handling library - -HEADERS = avradio.h \ - version.h \ - version_major.h \ - -OBJS = allradios.o \ - avradio.o \ - version.o \ - - -# input/output radios -OBJS-$(CONFIG_SDR_INRADIO) += sdrinradio.o vissualize.o rds.o -OBJS-$(CONFIG_SDRFILE_INRADIO) += sdrdemux.o vissualize.o rds.o diff --git a/libavradio/allradios.c b/libavradio/allradios.c deleted file mode 100644 index 33d0abf7ef..0000000000 --- a/libavradio/allradios.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Register all the grabbing radios. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavformat/internal.h" -#include "libavformat/mux.h" -#include "avradio.h" - -/* radios */ -extern const AVInputFormat ff_sdr_demuxer; -extern const AVInputFormat ff_sdrfile_demuxer; - -#include "libavradio/inradio_list.c" - -void avradio_register_all(void) -{ - avpriv_register_radios(NULL, inradio_list); -} - -static const void *next_input(const AVInputFormat *prev, AVClassCategory c2) -{ - const AVClass *pc; - const AVClassCategory c1 = AV_CLASS_CATEGORY_RADIO_INPUT; - AVClassCategory category = AV_CLASS_CATEGORY_NA; - const AVInputFormat *fmt = NULL; - int i = 0; - - while (prev && (fmt = inradio_list[i])) { - i++; - if (prev == fmt) - break; - } - - do { - fmt = inradio_list[i++]; - if (!fmt) - break; - pc = fmt->priv_class; - if (!pc) - continue; - category = pc->category; - } while (category != c1 && category != c2); - return fmt; -} - -const AVInputFormat *av_input_radio_next(const AVInputFormat *d) -{ - return next_input(d, AV_CLASS_CATEGORY_RADIO_INPUT); -} - diff --git a/libavradio/avradio.c b/libavradio/avradio.c deleted file mode 100644 index b584c2b19d..0000000000 --- a/libavradio/avradio.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/avassert.h" -#include "avradio.h" -#include "internal.h" - -int avradio_dev_to_app_control_message(struct AVFormatContext *s, enum AVDevToAppMessageType type, - void *data, size_t data_size) -{ - if (!s->control_message_cb) - return AVERROR(ENOSYS); - return s->control_message_cb(s, type, data, data_size); -} - - - diff --git a/libavradio/avradio.h b/libavradio/avradio.h deleted file mode 100644 index 17898587a9..0000000000 --- a/libavradio/avradio.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVRADIO_AVRADIO_H -#define AVRADIO_AVRADIO_H - -#include "version_major.h" -#ifndef HAVE_AV_CONFIG_H -/* When included as part of the ffmpeg build, only include the major version - * to avoid unnecessary rebuilds. When included externally, keep including - * the full version information. */ -#include "version.h" -#endif - -/** - * @file - * @ingroup lavr - * Main libavradio API header - */ - -/** - * @defgroup lavr libavradio - * Special radio devices muxing/demuxing library. - * - * Libavradio is a complementary library to @ref libavf "libavformat". It - * provides various "special" platform-specific muxers and demuxers, e.g. for - * Software defined radios. As a consequence, many - * (de)muxers in libavradio are of the AVFMT_NOFILE type (they use their own - * I/O functions). The filename passed to avformat_open_input() often does not - * refer to an actually existing file, but has some special device-specific - * meaning - e.g. for xcbgrab it is the display name. - * - * To use libavradio, simply call avradio_register_all() to register all - * compiled muxers and demuxers. They all use standard libavformat API. - * - * @{ - */ - -#include "libavutil/log.h" -#include "libavutil/opt.h" -#include "libavutil/dict.h" -#include "libavformat/avformat.h" -#include "libavdevice/avdevice.h" - -/** - * Return the LIBAVRADIO_VERSION_INT constant. - */ -unsigned avradio_version(void); - -/** - * Return the libavradio build-time configuration. - */ -const char *avradio_configuration(void); - -/** - * Return the libavradio license. - */ -const char *avradio_license(void); - -/** - * Initialize libavradio and register all the input and output radios. - */ -void avradio_register_all(void); - -/** - * Input radios iterator. - * - * If d is NULL, returns the first registered input radio, - * if d is non-NULL, returns the next registered input radio after d - * or NULL if d is the last one. - */ -const AVInputFormat *av_input_radio_next(const AVInputFormat *d); - -/** - * Send control message from application to radio. - * - * @param s radio context. - * @param type message type. - * @param data message data. Exact type depends on message type. - * @param data_size size of message data. - * @return >= 0 on success, negative on error. - * AVERROR(ENOSYS) when radio doesn't implement handler of the message. - */ -int avradio_app_to_dev_control_message(struct AVFormatContext *s, - enum AVAppToDevMessageType type, - void *data, size_t data_size); - -/** - * Send control message from radio to application. - * - * @param s radio context. - * @param type message type. - * @param data message data. Can be NULL. - * @param data_size size of message data. - * @return >= 0 on success, negative on error. - * AVERROR(ENOSYS) when application doesn't implement handler of the message. - */ -int avradio_dev_to_app_control_message(struct AVFormatContext *s, - enum AVDevToAppMessageType type, - void *data, size_t data_size); - -/** - * @} - */ - -#endif /* AVRADIO_AVRADIO_H */ diff --git a/libavradio/internal.h b/libavradio/internal.h deleted file mode 100644 index e00382339a..0000000000 --- a/libavradio/internal.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVRADIO_INTERNAL_H -#define AVRADIO_INTERNAL_H - -#include "libavformat/avformat.h" - -av_warn_unused_result -int ff_alloc_input_radio_context(struct AVFormatContext **avctx, const AVInputFormat *iformat, - const char *format); - -#endif diff --git a/libavradio/utils.c b/libavradio/utils.c deleted file mode 100644 index 9b308dd443..0000000000 --- a/libavradio/utils.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "internal.h" -#include "libavutil/opt.h" -#include "libavformat/avformat.h" - -int ff_alloc_input_radio_context(AVFormatContext **avctx, const AVInputFormat *iformat, const char *format) -{ - AVFormatContext *s; - int ret = 0; - - *avctx = NULL; - if (!iformat && !format) - return AVERROR(EINVAL); - if (!(s = avformat_alloc_context())) - return AVERROR(ENOMEM); - - if (!iformat) - iformat = av_find_input_format(format); - if (!iformat || !iformat->priv_class || iformat->priv_class->category != AV_CLASS_CATEGORY_RADIO_INPUT) { - ret = AVERROR(EINVAL); - goto error; - } - s->iformat = iformat; - if (s->iformat->priv_data_size > 0) { - s->priv_data = av_mallocz(s->iformat->priv_data_size); - if (!s->priv_data) { - ret = AVERROR(ENOMEM); - goto error; - } - if (s->iformat->priv_class) { - *(const AVClass**)s->priv_data= s->iformat->priv_class; - av_opt_set_defaults(s->priv_data); - } - } else - s->priv_data = NULL; - - *avctx = s; - return 0; - error: - avformat_free_context(s); - return ret; -} diff --git a/libavradio/version.c b/libavradio/version.c deleted file mode 100644 index 26d7c0153f..0000000000 --- a/libavradio/version.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Version functions. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#include "libavutil/avassert.h" -#include "avradio.h" -#include "version.h" - -#include "libavutil/ffversion.h" -const char av_radio_ffversion[] = "FFmpeg version " FFMPEG_VERSION; - -unsigned avradio_version(void) -{ - av_assert0(LIBAVRADIO_VERSION_MICRO >= 100); - return LIBAVRADIO_VERSION_INT; -} - -const char * avradio_configuration(void) -{ - return FFMPEG_CONFIGURATION; -} - -const char * avradio_license(void) -{ -#define LICENSE_PREFIX "libavradio license: " - return &LICENSE_PREFIX FFMPEG_LICENSE[sizeof(LICENSE_PREFIX) - 1]; -} diff --git a/libavradio/version.h b/libavradio/version.h deleted file mode 100644 index bfd17e4e36..0000000000 --- a/libavradio/version.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVRADIO_VERSION_H -#define AVRADIO_VERSION_H - -/** - * @file - * @ingroup lavr - * Libavradio version macros - */ - -#include "libavutil/version.h" - -#include "version_major.h" - -#define LIBAVRADIO_VERSION_MINOR 0 -#define LIBAVRADIO_VERSION_MICRO 100 - -#define LIBAVRADIO_VERSION_INT AV_VERSION_INT(LIBAVRADIO_VERSION_MAJOR, \ - LIBAVRADIO_VERSION_MINOR, \ - LIBAVRADIO_VERSION_MICRO) -#define LIBAVRADIO_VERSION AV_VERSION(LIBAVRADIO_VERSION_MAJOR, \ - LIBAVRADIO_VERSION_MINOR, \ - LIBAVRADIO_VERSION_MICRO) -#define LIBAVRADIO_BUILD LIBAVRADIO_VERSION_INT - -#define LIBAVRADIO_IDENT "Lavr" AV_STRINGIFY(LIBAVRADIO_VERSION) - -#endif /* AVRADIO_VERSION_H */ diff --git a/libavradio/version_major.h b/libavradio/version_major.h deleted file mode 100644 index afd6e5aeb7..0000000000 --- a/libavradio/version_major.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVRADIO_VERSION_MAJOR_H -#define AVRADIO_VERSION_MAJOR_H - -/** - * @file - * @ingroup lavd - * Libavradio version macros - */ - -#define LIBAVRADIO_VERSION_MAJOR 60 - -/** - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - */ - -#endif /* AVRADIO_VERSION_MAJOR_H */ diff --git a/libavutil/log.h b/libavutil/log.h index 245ad24988..ab7ceabe22 100644 --- a/libavutil/log.h +++ b/libavutil/log.h @@ -43,7 +43,6 @@ typedef enum { AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, AV_CLASS_CATEGORY_DEVICE_OUTPUT, AV_CLASS_CATEGORY_DEVICE_INPUT, - AV_CLASS_CATEGORY_RADIO_INPUT, AV_CLASS_CATEGORY_NB ///< not part of ABI/API }AVClassCategory; diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c index e8a234c337..edea2367c4 100644 --- a/tools/uncoded_frame.c +++ b/tools/uncoded_frame.c @@ -3,7 +3,6 @@ #include #include "libavutil/avassert.h" #include "libavdevice/avdevice.h" -#include "libavradio/avradio.h" #include "libavfilter/avfilter.h" #include "libavfilter/buffersink.h" #include "libavformat/avformat.h" @@ -65,9 +64,6 @@ int main(int argc, char **argv) nb_out_dev = argc - 2; avdevice_register_all(); -#if CONFIG_AVRADIO - avradio_register_all(); -#endif /* Create input graph */ if (!(in_graph = avfilter_graph_alloc())) {