diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-07 07:27:36 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-10 07:46:55 +0200 |
commit | 1c0912c26eb96c270e2cec08650d3d487b28ea49 (patch) | |
tree | 4ba3eda0e74111a663fa3728dc333fa4509f82b3 /libavformat/avformat.c | |
parent | 9163faecd3cdd93b69ae98605e7f518bd228196e (diff) | |
download | ffmpeg-1c0912c26eb96c270e2cec08650d3d487b28ea49.tar.gz |
avformat/utils: Move av_find_program_from_stream to avformat.c
It is potentially used with both demuxers and muxers.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/avformat.c')
-rw-r--r-- | libavformat/avformat.c | 15 |
1 files changed, 15 insertions, 0 deletions
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). * |