mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-29 19:52:03 +08:00
fftools/ffmpeg: rename OutputStream.sync_opts to next_pts
The current name is confusing.
This commit is contained in:
@@ -1044,12 +1044,12 @@ static void do_audio_out(OutputFile *of, OutputStream *ost,
|
|||||||
|
|
||||||
adjust_frame_pts_to_encoder_tb(of, ost, frame);
|
adjust_frame_pts_to_encoder_tb(of, ost, frame);
|
||||||
|
|
||||||
if (!check_recording_time(ost, ost->sync_opts, ost->enc_ctx->time_base))
|
if (!check_recording_time(ost, ost->next_pts, ost->enc_ctx->time_base))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (frame->pts == AV_NOPTS_VALUE)
|
if (frame->pts == AV_NOPTS_VALUE)
|
||||||
frame->pts = ost->sync_opts;
|
frame->pts = ost->next_pts;
|
||||||
ost->sync_opts = frame->pts + frame->nb_samples;
|
ost->next_pts = frame->pts + frame->nb_samples;
|
||||||
|
|
||||||
ret = submit_encode_frame(of, ost, frame);
|
ret = submit_encode_frame(of, ost, frame);
|
||||||
if (ret < 0 && ret != AVERROR_EOF)
|
if (ret < 0 && ret != AVERROR_EOF)
|
||||||
@@ -1230,7 +1230,9 @@ static void do_video_out(OutputFile *of,
|
|||||||
ost->last_nb0_frames[1],
|
ost->last_nb0_frames[1],
|
||||||
ost->last_nb0_frames[2]);
|
ost->last_nb0_frames[2]);
|
||||||
} else {
|
} else {
|
||||||
delta0 = sync_ipts - ost->sync_opts; // delta0 is the "drift" between the input frame (next_picture) and where it would fall in the output.
|
/* delta0 is the "drift" between the input frame (next_picture) and
|
||||||
|
* where it would fall in the output. */
|
||||||
|
delta0 = sync_ipts - ost->next_pts;
|
||||||
delta = delta0 + duration;
|
delta = delta0 + duration;
|
||||||
|
|
||||||
/* by default, we output a single frame */
|
/* by default, we output a single frame */
|
||||||
@@ -1245,7 +1247,7 @@ static void do_video_out(OutputFile *of,
|
|||||||
av_log(NULL, AV_LOG_VERBOSE, "Past duration %f too large\n", -delta0);
|
av_log(NULL, AV_LOG_VERBOSE, "Past duration %f too large\n", -delta0);
|
||||||
} else
|
} else
|
||||||
av_log(NULL, AV_LOG_DEBUG, "Clipping frame in rate conversion by %f\n", -delta0);
|
av_log(NULL, AV_LOG_DEBUG, "Clipping frame in rate conversion by %f\n", -delta0);
|
||||||
sync_ipts = ost->sync_opts;
|
sync_ipts = ost->next_pts;
|
||||||
duration += delta0;
|
duration += delta0;
|
||||||
delta0 = 0;
|
delta0 = 0;
|
||||||
}
|
}
|
||||||
@@ -1256,7 +1258,7 @@ static void do_video_out(OutputFile *of,
|
|||||||
av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta0));
|
av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta0));
|
||||||
delta = duration;
|
delta = duration;
|
||||||
delta0 = 0;
|
delta0 = 0;
|
||||||
ost->sync_opts = llrint(sync_ipts);
|
ost->next_pts = llrint(sync_ipts);
|
||||||
}
|
}
|
||||||
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
|
||||||
@@ -1275,13 +1277,13 @@ static void do_video_out(OutputFile *of,
|
|||||||
if (delta <= -0.6)
|
if (delta <= -0.6)
|
||||||
nb_frames = 0;
|
nb_frames = 0;
|
||||||
else if (delta > 0.6)
|
else if (delta > 0.6)
|
||||||
ost->sync_opts = llrint(sync_ipts);
|
ost->next_pts = llrint(sync_ipts);
|
||||||
next_picture->duration = duration;
|
next_picture->duration = duration;
|
||||||
break;
|
break;
|
||||||
case VSYNC_DROP:
|
case VSYNC_DROP:
|
||||||
case VSYNC_PASSTHROUGH:
|
case VSYNC_PASSTHROUGH:
|
||||||
next_picture->duration = duration;
|
next_picture->duration = duration;
|
||||||
ost->sync_opts = llrint(sync_ipts);
|
ost->next_pts = llrint(sync_ipts);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
av_assert0(0);
|
av_assert0(0);
|
||||||
@@ -1335,7 +1337,7 @@ static void do_video_out(OutputFile *of,
|
|||||||
if (!in_picture)
|
if (!in_picture)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
in_picture->pts = ost->sync_opts;
|
in_picture->pts = ost->next_pts;
|
||||||
|
|
||||||
if (!check_recording_time(ost, in_picture->pts, ost->enc_ctx->time_base))
|
if (!check_recording_time(ost, in_picture->pts, ost->enc_ctx->time_base))
|
||||||
return;
|
return;
|
||||||
@@ -1347,7 +1349,7 @@ static void do_video_out(OutputFile *of,
|
|||||||
if (ret < 0 && ret != AVERROR_EOF)
|
if (ret < 0 && ret != AVERROR_EOF)
|
||||||
exit_program(1);
|
exit_program(1);
|
||||||
|
|
||||||
ost->sync_opts++;
|
ost->next_pts++;
|
||||||
ost->vsync_frame_number++;
|
ost->vsync_frame_number++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -492,9 +492,9 @@ typedef struct OutputStream {
|
|||||||
AVStream *st; /* stream in the output file */
|
AVStream *st; /* stream in the output file */
|
||||||
/* number of frames emitted by the video-encoding sync code */
|
/* number of frames emitted by the video-encoding sync code */
|
||||||
int64_t vsync_frame_number;
|
int64_t vsync_frame_number;
|
||||||
/* input pts and corresponding output pts
|
/* predicted pts of the next frame to be encoded
|
||||||
for A/V sync */
|
* audio/video encoding only */
|
||||||
int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ // FIXME look at frame_number
|
int64_t next_pts;
|
||||||
/* dts of the last packet sent to the muxing queue, in AV_TIME_BASE_Q */
|
/* dts of the last packet sent to the muxing queue, in AV_TIME_BASE_Q */
|
||||||
int64_t last_mux_dts;
|
int64_t last_mux_dts;
|
||||||
/* pts of the last frame received from the filters, in AV_TIME_BASE_Q */
|
/* pts of the last frame received from the filters, in AV_TIME_BASE_Q */
|
||||||
|
|||||||
Reference in New Issue
Block a user