fftools/ffmpeg_enc: move fps conversion code to ffmpeg_filter

Its function is analogous to that of the fps filter, so filtering is a
more appropriate place for this.

The main practical reason for this move is that it places the encoding
sync queue right at the boundary between filters and encoders. This will
be important when switching to threaded scheduling, as the sync queue
involves multiple streams and will thus need to do nontrivial
inter-thread synchronization.

In addition to framerate conversion, the closely-related
* encoder timebase selection
* applying the start_time offset
are also moved to filtering.
This commit is contained in:
Anton Khirnov
2023-07-24 12:32:48 +02:00
parent f0f6d6d0e1
commit 9196be2fb1
4 changed files with 442 additions and 373 deletions

View File

@@ -302,6 +302,9 @@ typedef struct OutputFilter {
/* pts of the last frame received from this filter, in AV_TIME_BASE_Q */
int64_t last_pts;
uint64_t nb_frames_dup;
uint64_t nb_frames_drop;
} OutputFilter;
typedef struct FilterGraph {
@@ -536,10 +539,6 @@ typedef struct OutputStream {
Encoder *enc;
AVCodecContext *enc_ctx;
uint64_t nb_frames_dup;
uint64_t nb_frames_drop;
int64_t last_dropped;
/* video only */
AVRational frame_rate;
AVRational max_frame_rate;