mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +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:
parent
1e91a39502
commit
45202556cb
@ -571,8 +571,6 @@ typedef struct OutputStream {
|
|||||||
InputStream *ist;
|
InputStream *ist;
|
||||||
|
|
||||||
AVStream *st; /* stream in the output file */
|
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
|
/* predicted pts of the next frame to be encoded
|
||||||
* audio/video encoding only */
|
* audio/video encoding only */
|
||||||
int64_t next_pts;
|
int64_t next_pts;
|
||||||
|
@ -45,6 +45,8 @@
|
|||||||
|
|
||||||
struct Encoder {
|
struct Encoder {
|
||||||
AVFrame *last_frame;
|
AVFrame *last_frame;
|
||||||
|
/* number of frames emitted by the video-encoding sync code */
|
||||||
|
int64_t vsync_frame_number;
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint64_t dup_warning = 1000;
|
static uint64_t dup_warning = 1000;
|
||||||
@ -832,6 +834,7 @@ static void video_sync_process(OutputFile *of, OutputStream *ost,
|
|||||||
AVFrame *next_picture, double duration,
|
AVFrame *next_picture, double duration,
|
||||||
int64_t *nb_frames, int64_t *nb_frames_prev)
|
int64_t *nb_frames, int64_t *nb_frames_prev)
|
||||||
{
|
{
|
||||||
|
Encoder *e = ost->enc;
|
||||||
double delta0, delta;
|
double delta0, delta;
|
||||||
|
|
||||||
double sync_ipts = adjust_frame_pts_to_encoder_tb(of, ost, next_picture);
|
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) {
|
switch (ost->vsync_method) {
|
||||||
case VSYNC_VSCFR:
|
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));
|
av_log(ost, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta0));
|
||||||
delta = duration;
|
delta = duration;
|
||||||
delta0 = 0;
|
delta0 = 0;
|
||||||
@ -869,7 +872,7 @@ static void video_sync_process(OutputFile *of, OutputStream *ost,
|
|||||||
}
|
}
|
||||||
case VSYNC_CFR:
|
case VSYNC_CFR:
|
||||||
// FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
|
// 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;
|
*nb_frames = 0;
|
||||||
} else if (delta < -1.1)
|
} else if (delta < -1.1)
|
||||||
*nb_frames = 0;
|
*nb_frames = 0;
|
||||||
@ -998,7 +1001,7 @@ static void do_video_out(OutputFile *of,
|
|||||||
nb_frames_drop++;
|
nb_frames_drop++;
|
||||||
av_log(ost, AV_LOG_VERBOSE,
|
av_log(ost, AV_LOG_VERBOSE,
|
||||||
"*** dropping frame %"PRId64" at ts %"PRId64"\n",
|
"*** 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 > (nb_frames_prev && ost->last_dropped) + (nb_frames > nb_frames_prev)) {
|
||||||
if (nb_frames > dts_error_threshold * 30) {
|
if (nb_frames > dts_error_threshold * 30) {
|
||||||
@ -1043,7 +1046,7 @@ static void do_video_out(OutputFile *of,
|
|||||||
exit_program(1);
|
exit_program(1);
|
||||||
|
|
||||||
ost->next_pts++;
|
ost->next_pts++;
|
||||||
ost->vsync_frame_number++;
|
e->vsync_frame_number++;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_frame_unref(e->last_frame);
|
av_frame_unref(e->last_frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user