mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
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>
This commit is contained in:
parent
9163faecd3
commit
1c0912c26e
@ -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).
|
||||
*
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user