diff mbox series

[FFmpeg-devel,34/44] avformat/utils: Move av_find_program_from_stream to avformat.c

Message ID AS8PR01MB79447CA1136E9DC2F83475BE8FC49@AS8PR01MB7944.eurprd01.prod.exchangelabs.com
State Accepted
Commit 1c0912c26eb96c270e2cec08650d3d487b28ea49
Headers show
Series [FFmpeg-devel] lib*/version: Move library version functions into files of their own | 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

Andreas Rheinhardt May 7, 2022, 11:28 a.m. UTC
It is potentially used with both demuxers and muxers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/avformat.c | 15 +++++++++++++++
 libavformat/utils.c    | 15 ---------------
 2 files changed, 15 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 78bec2f736..e3dad1f9a5 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -261,6 +261,21 @@  void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned idx)
     }
 }
 
+AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
+{
+    for (unsigned i = 0; i < ic->nb_programs; i++) {
+        if (ic->programs[i] == last) {
+            last = NULL;
+        } else {
+            if (!last)
+                for (unsigned j = 0; j < ic->programs[i]->nb_stream_indexes; j++)
+                    if (ic->programs[i]->stream_index[j] == s)
+                        return ic->programs[i];
+        }
+    }
+    return NULL;
+}
+
 /**
  * Matches a stream specifier (but ignores requested index).
  *
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 272b8790a6..e500d35d83 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -341,21 +341,6 @@  int ff_alloc_extradata(AVCodecParameters *par, int size)
     return 0;
 }
 
-AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
-{
-    for (unsigned i = 0; i < ic->nb_programs; i++) {
-        if (ic->programs[i] == last) {
-            last = NULL;
-        } else {
-            if (!last)
-                for (unsigned j = 0; j < ic->programs[i]->nb_stream_indexes; j++)
-                    if (ic->programs[i]->stream_index[j] == s)
-                        return ic->programs[i];
-        }
-    }
-    return NULL;
-}
-
 int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type,
                         int wanted_stream_nb, int related_stream,
                         const AVCodec **decoder_ret, int flags)