fftools/ffmpeg: add thread-aware transcode scheduling infrastructure

See the comment block at the top of fftools/ffmpeg_sched.h for more
details on what this scheduler is for.

This commit adds the scheduling code itself, along with minimal
integration with the rest of the program:
* allocating and freeing the scheduler
* passing it throughout the call stack in order to register the
  individual components (demuxers/decoders/filtergraphs/encoders/muxers)
  with the scheduler

The scheduler is not actually used as of this commit, so it should not
result in any change in behavior. That will change in future commits.
This commit is contained in:
Anton Khirnov
2023-05-18 16:56:15 +02:00
parent ee2a8cbfd1
commit 9b8cc36ce0
13 changed files with 2936 additions and 56 deletions

View File

@@ -24,6 +24,7 @@
#include <stdatomic.h>
#include <stdint.h>
#include "ffmpeg_sched.h"
#include "thread_queue.h"
#include "libavformat/avformat.h"
@@ -50,6 +51,10 @@ typedef struct MuxStream {
EncStats stats;
int sch_idx;
int sch_idx_enc;
int sch_idx_src;
int64_t max_frames;
/*
@@ -94,6 +99,13 @@ typedef struct Muxer {
AVFormatContext *fc;
Scheduler *sch;
unsigned sch_idx;
// OutputStream indices indexed by scheduler stream indices
int *sch_stream_idx;
int nb_sch_stream_idx;
pthread_t thread;
ThreadQueue *tq;