diff options
author | Marton Balint <cus@passwd.hu> | 2013-02-10 01:35:45 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2013-02-15 00:10:46 +0100 |
commit | 5534d8f75e271743d954886409c39e3386e9e48d (patch) | |
tree | 62ed9726d53105dfef5e26b86b9fb7282a931413 /ffplay.c | |
parent | b853cfe7eaf13b7d4ff3ceba7098544ccc049df8 (diff) | |
download | ffmpeg-5534d8f75e271743d954886409c39e3386e9e48d.tar.gz |
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>
Diffstat (limited to 'ffplay.c')
-rw-r--r-- | ffplay.c | 29 |
1 files changed, 6 insertions, 23 deletions
@@ -231,11 +231,10 @@ typedef struct VideoState { double frame_last_returned_time; double frame_last_filter_delay; int64_t frame_last_dropped_pos; - double video_clock; // pts of last decoded frame / predicted pts of next decoded frame int video_stream; AVStream *video_st; 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 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 @@ -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; - 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 - printf("frame_type=%c clock=%0.3f pts=%0.3f\n", - av_get_picture_type_char(src_frame->pict_type), pts, pts1); + printf("frame_type=%c pts=%0.3f\n", + av_get_picture_type_char(src_frame->pict_type), pts); #endif /* 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)); 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, - is->audio_clock, is->video_clock, is->audio_diff_threshold); + is->audio_clock, is->audio_diff_threshold); } } else { /* too big difference : may be initial PTS errors, so |