diff mbox series

[FFmpeg-devel,38/44] avformat/utils: Move ff_find_stream_index to demux_utils.c

Message ID AS8PR01MB7944BFBAF58BD8B729D2EA068FC49@AS8PR01MB7944.eurprd01.prod.exchangelabs.com
State Accepted
Commit 9825d488d6fdfb7c14d2d702d1a890311f5b2943
Headers show
Series [FFmpeg-devel] lib*/version: Move library version functions into files of their own | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 fail Make failed
andriy/make_x86 fail Make failed

Commit Message

Andreas Rheinhardt May 7, 2022, 11:28 a.m. UTC
It is only used by demuxers (and it is generally demuxers
who have to translate format-specific IDs to stream indices).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/demux.h       | 6 ++++++
 libavformat/demux_utils.c | 8 ++++++++
 libavformat/gxf.c         | 1 +
 libavformat/internal.h    | 6 ------
 libavformat/utils.c       | 8 --------
 5 files changed, 15 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/demux.h b/libavformat/demux.h
index 209cd813ab..a008c3dba1 100644
--- a/libavformat/demux.h
+++ b/libavformat/demux.h
@@ -226,4 +226,10 @@  int ff_generate_avci_extradata(AVStream *st);
  */
 int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size);
 
+/**
+ * Find stream index based on format-specific stream ID
+ * @return stream index, or < 0 on error
+ */
+int ff_find_stream_index(const AVFormatContext *s, int id);
+
 #endif /* AVFORMAT_DEMUX_H */
diff --git a/libavformat/demux_utils.c b/libavformat/demux_utils.c
index 6e894ae28a..f699c79383 100644
--- a/libavformat/demux_utils.c
+++ b/libavformat/demux_utils.c
@@ -367,3 +367,11 @@  int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int
 
     return ret;
 }
+
+int ff_find_stream_index(const AVFormatContext *s, int id)
+{
+    for (unsigned i = 0; i < s->nb_streams; i++)
+        if (s->streams[i]->id == id)
+            return i;
+    return -1;
+}
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index e61291382a..f720521c1b 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -24,6 +24,7 @@ 
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
 #include "avformat.h"
+#include "demux.h"
 #include "internal.h"
 #include "gxf.h"
 
diff --git a/libavformat/internal.h b/libavformat/internal.h
index acda79821a..44516578b0 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -558,12 +558,6 @@  typedef void (*ff_parse_key_val_cb)(void *context, const char *key,
 void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
                         void *context);
 
-/**
- * Find stream index based on format-specific stream ID
- * @return stream index, or < 0 on error
- */
-int ff_find_stream_index(const AVFormatContext *s, int id);
-
 enum AVCodecID ff_guess_image2_codec(const char *filename);
 
 const AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
diff --git a/libavformat/utils.c b/libavformat/utils.c
index c8d975ddcc..68ea1d1050 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -644,14 +644,6 @@  void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
     }
 }
 
-int ff_find_stream_index(const AVFormatContext *s, int id)
-{
-    for (unsigned i = 0; i < s->nb_streams; i++)
-        if (s->streams[i]->id == id)
-            return i;
-    return -1;
-}
-
 int avformat_network_init(void)
 {
 #if CONFIG_NETWORK