You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
ffplay: remove remains of video_clock
We are now using a pts based approach, libavutil/libavcodec should provide the correct pts-es anyway. This also fixes an issue when seeking to a frame with a pts set to zero. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
29
ffplay.c
29
ffplay.c
@@ -231,11 +231,10 @@ typedef struct VideoState {
|
|||||||
double frame_last_returned_time;
|
double frame_last_returned_time;
|
||||||
double frame_last_filter_delay;
|
double frame_last_filter_delay;
|
||||||
int64_t frame_last_dropped_pos;
|
int64_t frame_last_dropped_pos;
|
||||||
double video_clock; // pts of last decoded frame / predicted pts of next decoded frame
|
|
||||||
int video_stream;
|
int video_stream;
|
||||||
AVStream *video_st;
|
AVStream *video_st;
|
||||||
PacketQueue videoq;
|
PacketQueue videoq;
|
||||||
double video_current_pts; // current displayed pts (different from video_clock if frame fifos are used)
|
double video_current_pts; // current displayed pts
|
||||||
double video_current_pts_drift; // video_current_pts - time (av_gettime) at which we updated video_current_pts - used to have running video pts
|
double video_current_pts_drift; // video_current_pts - time (av_gettime) at which we updated video_current_pts - used to have running video pts
|
||||||
int64_t video_current_pos; // current displayed file pos
|
int64_t video_current_pos; // current displayed file pos
|
||||||
double max_frame_duration; // maximum duration of a frame - above this, we consider the jump a timestamp discontinuity
|
double max_frame_duration; // maximum duration of a frame - above this, we consider the jump a timestamp discontinuity
|
||||||
@@ -1503,29 +1502,13 @@ static void duplicate_right_border_pixels(SDL_Overlay *bmp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_t pos, int serial)
|
static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t pos, int serial)
|
||||||
{
|
{
|
||||||
VideoPicture *vp;
|
VideoPicture *vp;
|
||||||
double frame_delay, pts = pts1;
|
|
||||||
|
|
||||||
/* compute the exact PTS for the picture if it is omitted in the stream
|
|
||||||
* pts1 is the dts of the pkt / pts of the frame */
|
|
||||||
if (pts != 0) {
|
|
||||||
/* update video clock with pts, if present */
|
|
||||||
is->video_clock = pts;
|
|
||||||
} else {
|
|
||||||
pts = is->video_clock;
|
|
||||||
}
|
|
||||||
/* update video clock for next frame */
|
|
||||||
frame_delay = av_q2d(is->video_st->codec->time_base);
|
|
||||||
/* for MPEG2, the frame can be repeated, so we update the
|
|
||||||
clock accordingly */
|
|
||||||
frame_delay += src_frame->repeat_pict * (frame_delay * 0.5);
|
|
||||||
is->video_clock += frame_delay;
|
|
||||||
|
|
||||||
#if defined(DEBUG_SYNC) && 0
|
#if defined(DEBUG_SYNC) && 0
|
||||||
printf("frame_type=%c clock=%0.3f pts=%0.3f\n",
|
printf("frame_type=%c pts=%0.3f\n",
|
||||||
av_get_picture_type_char(src_frame->pict_type), pts, pts1);
|
av_get_picture_type_char(src_frame->pict_type), pts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* wait until we have space to put a new picture */
|
/* wait until we have space to put a new picture */
|
||||||
@@ -2062,9 +2045,9 @@ static int synchronize_audio(VideoState *is, int nb_samples)
|
|||||||
max_nb_samples = ((nb_samples * (100 + SAMPLE_CORRECTION_PERCENT_MAX) / 100));
|
max_nb_samples = ((nb_samples * (100 + SAMPLE_CORRECTION_PERCENT_MAX) / 100));
|
||||||
wanted_nb_samples = FFMIN(FFMAX(wanted_nb_samples, min_nb_samples), max_nb_samples);
|
wanted_nb_samples = FFMIN(FFMAX(wanted_nb_samples, min_nb_samples), max_nb_samples);
|
||||||
}
|
}
|
||||||
av_dlog(NULL, "diff=%f adiff=%f sample_diff=%d apts=%0.3f vpts=%0.3f %f\n",
|
av_dlog(NULL, "diff=%f adiff=%f sample_diff=%d apts=%0.3f %f\n",
|
||||||
diff, avg_diff, wanted_nb_samples - nb_samples,
|
diff, avg_diff, wanted_nb_samples - nb_samples,
|
||||||
is->audio_clock, is->video_clock, is->audio_diff_threshold);
|
is->audio_clock, is->audio_diff_threshold);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* too big difference : may be initial PTS errors, so
|
/* too big difference : may be initial PTS errors, so
|
||||||
|
Reference in New Issue
Block a user