Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 3/6] avformat: add support for demuxers/inputs from avradio
Date: Sat, 22 Jul 2023 21:29:54 +0200
Message-ID: <20230722192957.703-3-michael@niedermayer.cc> (raw)
In-Reply-To: <20230722192957.703-1-michael@niedermayer.cc>

This avoids keeping diffs for libavformat in the libavradio repository

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 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".

  parent reply	other threads:[~2023-07-22 19:30 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-22 19:29 [FFmpeg-devel] [PATCH 1/6] configure: libavradio support Michael Niedermayer
2023-07-22 19:29 ` [FFmpeg-devel] [PATCH 2/6] avutil/log: Add AV_CLASS_CATEGORY_RADIO_INPUT Michael Niedermayer
2023-07-22 20:30   ` Paul B Mahol
2023-07-22 19:29 ` Michael Niedermayer [this message]
2023-07-22 20:35   ` [FFmpeg-devel] [PATCH 3/6] avformat: add support for demuxers/inputs from avradio Paul B Mahol
2023-07-22 19:29 ` [FFmpeg-devel] [PATCH 4/6] avdevice/utils: add test for AV_CLASS_CATEGORY_RADIO_INPUT Michael Niedermayer
2023-07-22 19:29 ` [FFmpeg-devel] [PATCH 5/6] fftools: avradio support Michael Niedermayer
2023-07-22 21:39   ` Lynne
2023-07-23 15:23     ` Michael Niedermayer
2023-07-23 18:49       ` Tomas Härdin
2023-07-23 19:01         ` James Almer
2023-07-23 22:56           ` Michael Niedermayer
2023-07-24  8:19             ` Nicolas George
2023-07-24 15:57               ` Michael Niedermayer
2023-07-24 22:30               ` Tomas Härdin
2023-07-25 14:17             ` Tomas Härdin
2023-07-24 20:19           ` Tomas Härdin
2023-07-25  9:37             ` Nicolas George
2023-07-26 10:37             ` Michael Niedermayer
2023-07-27 13:05               ` Tomas Härdin
2023-07-27 18:36                 ` Michael Niedermayer
2023-07-27 18:48                   ` Nicolas George
     [not found]                   ` <CC2992B9-B047-4724-8DE5-01C02CBE31FD@cosmin.at>
2023-08-01 19:51                     ` Cosmin Stejerean
2023-08-01 20:06                       ` Paul B Mahol
2023-08-02 12:46                         ` Michael Niedermayer
2023-08-02 13:00                           ` Paul B Mahol
2023-08-02 13:01                             ` Michael Niedermayer
2023-07-24  8:13         ` Nicolas George
2023-07-24 20:22           ` Tomas Härdin
2023-07-25  9:33             ` Nicolas George
2023-07-25  9:51               ` Kieran Kunhya
2023-07-25  9:56                 ` Nicolas George
2023-07-25 10:16                   ` Kieran Kunhya
2023-07-25 13:55                     ` Nicolas George
2023-07-25 14:37                       ` Kieran Kunhya
2023-07-27 17:56                         ` Nicolas George
2023-07-28 11:07                           ` Kieran Kunhya
2023-07-30 13:04                             ` [FFmpeg-devel] What is FFmpeg and what should it be Nicolas George
2023-07-30 17:07                               ` Andrey Turkin
2023-07-30 18:29                                 ` Kieran Kunhya
2023-07-30 18:54                                   ` Nicolas George
2023-08-01  7:48                                 ` Rémi Denis-Courmont
2023-07-31 13:56                               ` Tomas Härdin
2023-08-03 13:25                                 ` Nicolas George
2023-08-03 20:50                                   ` Tomas Härdin
2023-08-02  1:44                               ` Vittorio Giovara
2023-08-02 12:55                                 ` Michael Niedermayer
2023-08-02 12:59                                   ` Jean-Baptiste Kempf
2023-08-02 14:12                                     ` Brad Isbell
2023-08-02 14:19                                       ` Nicolas George
2023-08-02 14:26                                       ` Michael Niedermayer
2023-08-02 14:30                                         ` Nicolas George
     [not found]                                           ` <A3B35B92-8333-4637-B4AA-FA9D9750E784@cosmin.at>
2023-08-02 15:46                                             ` Cosmin Stejerean
2023-08-03 15:40                                               ` Michael Niedermayer
2023-08-02 14:20                                     ` Michael Niedermayer
2023-08-02 14:44                                       ` Jean-Baptiste Kempf
2023-08-03 17:45                                         ` Michael Niedermayer
2023-08-03 18:24                                           ` Kieran Kunhya
2023-08-03 19:25                                             ` Michael Niedermayer
2023-08-03 20:04                                               ` Kieran Kunhya
2023-08-04 17:09                                                 ` Michael Niedermayer
2023-08-04 17:35                                                   ` Nicolas George
2023-08-04 23:17                                                     ` Kieran Kunhya
2023-08-05 18:55                                         ` Michael Niedermayer
2023-08-05 19:17                                           ` Paul B Mahol
2023-08-05 23:32                                           ` Vittorio Giovara
2023-08-06  8:28                                             ` Tomas Härdin
2023-08-06 19:53                                             ` Michael Niedermayer
2023-08-07 15:39                                               ` Rémi Denis-Courmont
2023-08-08 15:22                                                 ` Michael Niedermayer
2023-08-08 15:37                                                   ` Paul B Mahol
2023-08-08 18:53                                                   ` Rémi Denis-Courmont
2023-08-09 15:59                                                     ` Michael Niedermayer
2023-08-09 16:24                                                       ` Paul B Mahol
2023-08-10 12:39                                                     ` Nicolas George
2023-08-10 14:58                                                       ` Vittorio Giovara
2023-08-12 17:12                                                         ` Michael Niedermayer
2023-08-10 15:01                                                       ` James Almer
2023-08-10 15:43                                                       ` Jean-Baptiste Kempf
2023-08-10 18:39                                                       ` Tomas Härdin
2023-08-03 11:38                               ` Tomas Härdin
2023-08-03 13:29                                 ` Nicolas George
2023-07-25 12:02                   ` [FFmpeg-devel] [PATCH 5/6] fftools: avradio support Tomas Härdin
2023-07-22 19:29 ` [FFmpeg-devel] [PATCH 6/6] tools/uncoded_frame: " Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230722192957.703-3-michael@niedermayer.cc \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git