mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
fftools/ffmpeg_demux: move the loop out of add_input_streams()
Make the function process just one input stream at a time and save an indentation level. Also rename it to ist_add() to be consistent with an analogous function in ffmpeg_mux_init.
This commit is contained in:
parent
47a14b542e
commit
98766dbbd7
@ -1032,15 +1032,9 @@ static DemuxStream *demux_stream_alloc(Demuxer *d, AVStream *st)
|
|||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add all the streams from the given input file to the demuxer */
|
static void ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
|
||||||
static void add_input_streams(const OptionsContext *o, Demuxer *d)
|
|
||||||
{
|
{
|
||||||
InputFile *f = &d->f;
|
AVFormatContext *ic = d->f.ctx;
|
||||||
AVFormatContext *ic = f->ctx;
|
|
||||||
int i, ret;
|
|
||||||
|
|
||||||
for (i = 0; i < ic->nb_streams; i++) {
|
|
||||||
AVStream *st = ic->streams[i];
|
|
||||||
AVCodecParameters *par = st->codecpar;
|
AVCodecParameters *par = st->codecpar;
|
||||||
DemuxStream *ds;
|
DemuxStream *ds;
|
||||||
InputStream *ist;
|
InputStream *ist;
|
||||||
@ -1053,6 +1047,7 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d)
|
|||||||
const AVClass *cc = avcodec_get_class();
|
const AVClass *cc = avcodec_get_class();
|
||||||
const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL,
|
const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL,
|
||||||
0, AV_OPT_SEARCH_FAKE_OBJ);
|
0, AV_OPT_SEARCH_FAKE_OBJ);
|
||||||
|
int ret;
|
||||||
|
|
||||||
ds = demux_stream_alloc(d, st);
|
ds = demux_stream_alloc(d, st);
|
||||||
ist = &ds->ist;
|
ist = &ds->ist;
|
||||||
@ -1265,7 +1260,6 @@ static void add_input_streams(const OptionsContext *o, Demuxer *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ist->codec_desc = avcodec_descriptor_get(ist->par->codec_id);
|
ist->codec_desc = avcodec_descriptor_get(ist->par->codec_id);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_attachment(InputStream *ist, const char *filename)
|
static void dump_attachment(InputStream *ist, const char *filename)
|
||||||
@ -1580,7 +1574,9 @@ int ifile_open(const OptionsContext *o, const char *filename)
|
|||||||
|
|
||||||
d->thread_queue_size = o->thread_queue_size;
|
d->thread_queue_size = o->thread_queue_size;
|
||||||
|
|
||||||
add_input_streams(o, d);
|
/* Add all the streams from the given input file to the demuxer */
|
||||||
|
for (int i = 0; i < ic->nb_streams; i++)
|
||||||
|
ist_add(o, d, ic->streams[i]);
|
||||||
|
|
||||||
/* dump the file content */
|
/* dump the file content */
|
||||||
av_dump_format(ic, f->index, filename, 0);
|
av_dump_format(ic, f->index, filename, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user