From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1D25246F1B for ; Sat, 22 Jul 2023 19:30:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AB2EA68C672; Sat, 22 Jul 2023 22:30:08 +0300 (EEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8C0A168C627 for ; Sat, 22 Jul 2023 22:30:01 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E80691C0004 for ; Sat, 22 Jul 2023 19:30:00 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 22 Jul 2023 21:29:54 +0200 Message-Id: <20230722192957.703-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230722192957.703-1-michael@niedermayer.cc> References: <20230722192957.703-1-michael@niedermayer.cc> X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 3/6] avformat: add support for demuxers/inputs from avradio 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 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This avoids keeping diffs for libavformat in the libavradio repository Signed-off-by: Michael Niedermayer --- libavformat/allformats.c | 32 +++++++++++++++++++++++++------- libavformat/internal.h | 1 + 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 6324952bd2..27a32028dd 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -570,6 +570,7 @@ 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) { @@ -594,20 +595,32 @@ 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 < 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 (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 (f) - *opaque = (void*)(i + 1); + *opaque = (void*)(i + 4); return f; } @@ -616,3 +629,8 @@ 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 9fc980601f..aa6b8b21a9 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -719,5 +719,6 @@ 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 */ -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".