fftools/ffmpeg: drop init_input_threads()

Start threads implicitly when ifile_get_packet() is called. Simplifies
the demuxer API.
This commit is contained in:
Anton Khirnov 2022-10-17 11:23:55 +02:00
parent 6975320506
commit 09cd147dcc
3 changed files with 9 additions and 19 deletions

View File

@ -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();

View File

@ -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"

View File

@ -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 * (