diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index e57486fd4a..f8b02a8871 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3912,9 +3912,6 @@ static int transcode(void) timer_start = av_gettime_relative(); - if ((ret = init_input_threads()) < 0) - goto fail; - while (!received_sigterm) { int64_t cur_time= av_gettime_relative(); diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 12df5920a6..ab8b9018ca 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -770,7 +770,6 @@ int ifile_open(OptionsContext *o, const char *filename); * - a negative error code on failure */ int ifile_get_packet(InputFile *f, AVPacket **pkt); -int init_input_threads(void); void free_input_threads(void); #define SPECIFIER_OPT_FMT_str "%s" diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 847d6901d3..53a497da66 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -346,11 +346,10 @@ void free_input_threads(void) free_input_thread(i); } -static int init_input_thread(int i) +static int thread_start(Demuxer *d) { int ret; - InputFile *f = input_files[i]; - Demuxer *d = demuxer_from_ifile(f); + InputFile *f = &d->f; if (f->thread_queue_size <= 0) f->thread_queue_size = (nb_input_files > 1 ? 8 : 1); @@ -393,24 +392,19 @@ fail: return ret; } -int init_input_threads(void) -{ - int i, ret; - - for (i = 0; i < nb_input_files; i++) { - ret = init_input_thread(i); - if (ret < 0) - return ret; - } - return 0; -} - int ifile_get_packet(InputFile *f, AVPacket **pkt) { + Demuxer *d = demuxer_from_ifile(f); InputStream *ist; DemuxMsg msg; int ret; + if (!f->in_thread_queue) { + ret = thread_start(d); + if (ret < 0) + return ret; + } + if (f->readrate || f->rate_emu) { int i; int64_t file_start = copy_ts * (