mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
ffmpeg: Fixing typos and adding comments to fps code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
7bf465abf3
commit
dfa98c4f83
16
ffmpeg.c
16
ffmpeg.c
@ -984,11 +984,11 @@ static void do_video_out(AVFormatContext *s,
|
|||||||
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 = sync_ipts - ost->sync_opts; // delta0 is the "drift" between the input frame (next_picture) and where it would fall in the output.
|
||||||
delta = delta0 + duration;
|
delta = delta0 + duration;
|
||||||
|
|
||||||
/* by default, we output a single frame */
|
/* by default, we output a single frame */
|
||||||
nb0_frames = 0;
|
nb0_frames = 0; // tracks the number of times the PREVIOUS frame should be duplicated, mostly for variable framerate (VFR)
|
||||||
nb_frames = 1;
|
nb_frames = 1;
|
||||||
|
|
||||||
format_video_sync = video_sync_method;
|
format_video_sync = video_sync_method;
|
||||||
@ -1017,7 +1017,7 @@ static void do_video_out(AVFormatContext *s,
|
|||||||
if (delta0 < -0.6) {
|
if (delta0 < -0.6) {
|
||||||
av_log(NULL, AV_LOG_WARNING, "Past duration %f too large\n", -delta0);
|
av_log(NULL, AV_LOG_WARNING, "Past duration %f too large\n", -delta0);
|
||||||
} else
|
} else
|
||||||
av_log(NULL, AV_LOG_DEBUG, "Cliping 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 += cor;
|
sync_ipts += cor;
|
||||||
duration -= cor;
|
duration -= cor;
|
||||||
delta0 += cor;
|
delta0 += cor;
|
||||||
@ -1066,22 +1066,22 @@ static void do_video_out(AVFormatContext *s,
|
|||||||
sizeof(ost->last_nb0_frames[0]) * (FF_ARRAY_ELEMS(ost->last_nb0_frames) - 1));
|
sizeof(ost->last_nb0_frames[0]) * (FF_ARRAY_ELEMS(ost->last_nb0_frames) - 1));
|
||||||
ost->last_nb0_frames[0] = nb0_frames;
|
ost->last_nb0_frames[0] = nb0_frames;
|
||||||
|
|
||||||
if (nb0_frames == 0 && ost->last_droped) {
|
if (nb0_frames == 0 && ost->last_dropped) {
|
||||||
nb_frames_drop++;
|
nb_frames_drop++;
|
||||||
av_log(NULL, AV_LOG_VERBOSE,
|
av_log(NULL, AV_LOG_VERBOSE,
|
||||||
"*** dropping frame %d from stream %d at ts %"PRId64"\n",
|
"*** dropping frame %d from stream %d at ts %"PRId64"\n",
|
||||||
ost->frame_number, ost->st->index, ost->last_frame->pts);
|
ost->frame_number, ost->st->index, ost->last_frame->pts);
|
||||||
}
|
}
|
||||||
if (nb_frames > (nb0_frames && ost->last_droped) + (nb_frames > nb0_frames)) {
|
if (nb_frames > (nb0_frames && ost->last_dropped) + (nb_frames > nb0_frames)) {
|
||||||
if (nb_frames > dts_error_threshold * 30) {
|
if (nb_frames > dts_error_threshold * 30) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "%d frame duplication too large, skipping\n", nb_frames - 1);
|
av_log(NULL, AV_LOG_ERROR, "%d frame duplication too large, skipping\n", nb_frames - 1);
|
||||||
nb_frames_drop++;
|
nb_frames_drop++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nb_frames_dup += nb_frames - (nb0_frames && ost->last_droped) - (nb_frames > nb0_frames);
|
nb_frames_dup += nb_frames - (nb0_frames && ost->last_dropped) - (nb_frames > nb0_frames);
|
||||||
av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1);
|
av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1);
|
||||||
}
|
}
|
||||||
ost->last_droped = nb_frames == nb0_frames && next_picture;
|
ost->last_dropped = nb_frames == nb0_frames && next_picture;
|
||||||
|
|
||||||
/* duplicates frame if needed */
|
/* duplicates frame if needed */
|
||||||
for (i = 0; i < nb_frames; i++) {
|
for (i = 0; i < nb_frames; i++) {
|
||||||
@ -1632,7 +1632,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
|
|||||||
pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st),
|
pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st),
|
||||||
ost->st->time_base, AV_TIME_BASE_Q));
|
ost->st->time_base, AV_TIME_BASE_Q));
|
||||||
if (is_last_report)
|
if (is_last_report)
|
||||||
nb_frames_drop += ost->last_droped;
|
nb_frames_drop += ost->last_dropped;
|
||||||
}
|
}
|
||||||
|
|
||||||
secs = FFABS(pts) / AV_TIME_BASE;
|
secs = FFABS(pts) / AV_TIME_BASE;
|
||||||
|
2
ffmpeg.h
2
ffmpeg.h
@ -414,7 +414,7 @@ typedef struct OutputStream {
|
|||||||
int64_t max_frames;
|
int64_t max_frames;
|
||||||
AVFrame *filtered_frame;
|
AVFrame *filtered_frame;
|
||||||
AVFrame *last_frame;
|
AVFrame *last_frame;
|
||||||
int last_droped;
|
int last_dropped;
|
||||||
int last_nb0_frames[3];
|
int last_nb0_frames[3];
|
||||||
|
|
||||||
void *hwaccel_ctx;
|
void *hwaccel_ctx;
|
||||||
|
Loading…
Reference in New Issue
Block a user