1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

fftools/ffmpeg: move OutputStream.vsync_frame_number to Encoder

It is video encoding-only and does not need to be visible outside of
ffmpeg_enc.c
This commit is contained in:
Anton Khirnov 2023-03-27 07:37:29 +02:00
parent 1e91a39502
commit 45202556cb
2 changed files with 7 additions and 6 deletions

View File

@ -571,8 +571,6 @@ typedef struct OutputStream {
InputStream *ist;
AVStream *st; /* stream in the output file */
/* number of frames emitted by the video-encoding sync code */
int64_t vsync_frame_number;
/* predicted pts of the next frame to be encoded
* audio/video encoding only */
int64_t next_pts;

View File

@ -45,6 +45,8 @@
struct Encoder {
AVFrame *last_frame;
/* number of frames emitted by the video-encoding sync code */
int64_t vsync_frame_number;
};
static uint64_t dup_warning = 1000;
@ -832,6 +834,7 @@ static void video_sync_process(OutputFile *of, OutputStream *ost,
AVFrame *next_picture, double duration,
int64_t *nb_frames, int64_t *nb_frames_prev)
{
Encoder *e = ost->enc;
double delta0, delta;
double sync_ipts = adjust_frame_pts_to_encoder_tb(of, ost, next_picture);
@ -861,7 +864,7 @@ static void video_sync_process(OutputFile *of, OutputStream *ost,
switch (ost->vsync_method) {
case VSYNC_VSCFR:
if (ost->vsync_frame_number == 0 && delta0 >= 0.5) {
if (e->vsync_frame_number == 0 && delta0 >= 0.5) {
av_log(ost, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta0));
delta = duration;
delta0 = 0;
@ -869,7 +872,7 @@ static void video_sync_process(OutputFile *of, OutputStream *ost,
}
case VSYNC_CFR:
// FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
if (frame_drop_threshold && delta < frame_drop_threshold && ost->vsync_frame_number) {
if (frame_drop_threshold && delta < frame_drop_threshold && e->vsync_frame_number) {
*nb_frames = 0;
} else if (delta < -1.1)
*nb_frames = 0;
@ -998,7 +1001,7 @@ static void do_video_out(OutputFile *of,
nb_frames_drop++;
av_log(ost, AV_LOG_VERBOSE,
"*** dropping frame %"PRId64" at ts %"PRId64"\n",
ost->vsync_frame_number, e->last_frame->pts);
e->vsync_frame_number, e->last_frame->pts);
}
if (nb_frames > (nb_frames_prev && ost->last_dropped) + (nb_frames > nb_frames_prev)) {
if (nb_frames > dts_error_threshold * 30) {
@ -1043,7 +1046,7 @@ static void do_video_out(OutputFile *of,
exit_program(1);
ost->next_pts++;
ost->vsync_frame_number++;
e->vsync_frame_number++;
}
av_frame_unref(e->last_frame);