mirror of
https://github.com/mpv-player/mpv
synced 2025-01-20 14:20:55 +00:00
video: get rid of video_next_pts field
Not really needed anymore. Code should be mostly equivalent. Also get rid of some other now-unused or outdated things.
This commit is contained in:
parent
7b3a889c92
commit
5afc025cc9
@ -329,8 +329,8 @@ static bool get_sync_samples(struct MPContext *mpctx, int *skip)
|
||||
|
||||
double sync_pts = MP_NOPTS_VALUE;
|
||||
if (sync_to_video) {
|
||||
if (mpctx->video_next_pts != MP_NOPTS_VALUE) {
|
||||
sync_pts = mpctx->video_next_pts;
|
||||
if (mpctx->video_pts != MP_NOPTS_VALUE) {
|
||||
sync_pts = mpctx->video_pts;
|
||||
} else if (mpctx->video_status < STATUS_READY) {
|
||||
return false; // wait until we know a video PTS
|
||||
}
|
||||
|
@ -3670,7 +3670,7 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
|
||||
case MP_CMD_SUB_SEEK: {
|
||||
struct osd_sub_state state;
|
||||
osd_get_sub(mpctx->osd, OSDTYPE_SUB, &state);
|
||||
if (state.dec_sub) {
|
||||
if (state.dec_sub && mpctx->video_pts != MP_NOPTS_VALUE) {
|
||||
double a[2];
|
||||
a[0] = mpctx->video_pts - state.video_offset - opts->sub_delay;
|
||||
a[1] = cmd->args[0].v.i;
|
||||
|
@ -255,16 +255,11 @@ typedef struct MPContext {
|
||||
// AV sync: the next frame should be shown when the audio out has this
|
||||
// much (in seconds) buffered data left. Increased when more data is
|
||||
// written to the ao, decreased when moving to the next frame.
|
||||
// In the audio-only case used as a timer since the last seek
|
||||
// by the audio CPU usage meter.
|
||||
double delay;
|
||||
// AV sync: time until next frame should be shown
|
||||
double time_frame;
|
||||
// Optional/additional AV sync compensation if video is too slow.
|
||||
double insert_silence;
|
||||
// Set to true some time after a new frame has been shown, and it turns out
|
||||
// that this frame was the last one before video ends.
|
||||
bool playing_last_frame;
|
||||
// How much video timing has been changed to make it match the audio
|
||||
// timeline. Used for status line information only.
|
||||
double total_avsync_change;
|
||||
@ -277,9 +272,6 @@ typedef struct MPContext {
|
||||
// the same value if the status line is updated at a time where no new
|
||||
// video frame is shown.
|
||||
double last_av_difference;
|
||||
/* Timestamp of the latest image that was queued on the VO, but not yet
|
||||
* to be flipped. */
|
||||
double video_next_pts;
|
||||
/* timestamp of video frame currently visible on screen
|
||||
* (or at least queued to be flipped by VO) */
|
||||
double video_pts;
|
||||
|
@ -270,7 +270,6 @@ void mp_handle_nav(struct MPContext *mpctx)
|
||||
if (nav->nav_still_frame > 0) {
|
||||
// gross hack
|
||||
mpctx->time_frame += nav->nav_still_frame;
|
||||
mpctx->playing_last_frame = true;
|
||||
nav->nav_still_frame = -2;
|
||||
} else if (nav->nav_still_frame == -2) {
|
||||
struct mp_nav_cmd inp = {MP_NAV_CMD_SKIP_STILL};
|
||||
|
@ -253,10 +253,8 @@ static int mp_seek(MPContext *mpctx, struct seek_params seek,
|
||||
|
||||
/* Use the target time as "current position" for further relative
|
||||
* seeks etc until a new video frame has been decoded */
|
||||
if (seek.type == MPSEEK_ABSOLUTE) {
|
||||
mpctx->video_pts = seek.amount;
|
||||
if (seek.type == MPSEEK_ABSOLUTE)
|
||||
mpctx->last_seek_pts = seek.amount;
|
||||
}
|
||||
|
||||
// The hr_seek==false case is for skipping frames with PTS before the
|
||||
// current timeline chapter start. It's not really known where the demuxer
|
||||
|
@ -214,8 +214,7 @@ void reset_video_state(struct MPContext *mpctx)
|
||||
|
||||
mpctx->delay = 0;
|
||||
mpctx->time_frame = 0;
|
||||
mpctx->video_next_pts = MP_NOPTS_VALUE;
|
||||
mpctx->playing_last_frame = false;
|
||||
mpctx->video_pts = MP_NOPTS_VALUE;
|
||||
mpctx->total_avsync_change = 0;
|
||||
mpctx->drop_frame_cnt = 0;
|
||||
mpctx->dropped_frames = 0;
|
||||
@ -475,7 +474,6 @@ static void adjust_sync(struct MPContext *mpctx, double v_pts, double frame_time
|
||||
|
||||
double a_pts = written_audio_pts(mpctx) - mpctx->delay;
|
||||
double av_delay = a_pts - v_pts;
|
||||
// Try to sync vo_flip() so it will *finish* at given time
|
||||
av_delay += mpctx->audio_delay; // This much pts difference is desired
|
||||
|
||||
double change = av_delay * 0.1;
|
||||
@ -544,10 +542,8 @@ static int update_video(struct MPContext *mpctx, double endpts)
|
||||
if (mpctx->d_video->header->attached_picture) {
|
||||
if (vo_has_frame(vo))
|
||||
return VD_EOF;
|
||||
if (mpctx->next_frame[0]) {
|
||||
mpctx->video_next_pts = MP_NOPTS_VALUE;
|
||||
if (mpctx->next_frame[0])
|
||||
return VD_NEW_FRAME;
|
||||
}
|
||||
r = video_output_image(mpctx, MP_NOPTS_VALUE);
|
||||
return r <= 0 ? VD_EOF: VD_PROGRESS;
|
||||
}
|
||||
@ -573,7 +569,7 @@ static int update_video(struct MPContext *mpctx, double endpts)
|
||||
|
||||
if (r == VD_NEW_FRAME) {
|
||||
double pts = mpctx->next_frame[0]->pts;
|
||||
double last_pts = mpctx->video_next_pts;
|
||||
double last_pts = mpctx->video_pts;
|
||||
if (last_pts == MP_NOPTS_VALUE)
|
||||
last_pts = pts;
|
||||
double frame_time = pts - last_pts;
|
||||
@ -582,7 +578,6 @@ static int update_video(struct MPContext *mpctx, double endpts)
|
||||
MP_WARN(mpctx, "Jump in video pts: %f -> %f\n", last_pts, pts);
|
||||
frame_time = 0;
|
||||
}
|
||||
mpctx->video_next_pts = pts;
|
||||
if (mpctx->d_audio)
|
||||
mpctx->delay -= frame_time;
|
||||
if (mpctx->video_status >= STATUS_READY) {
|
||||
@ -767,7 +762,7 @@ void write_video(struct MPContext *mpctx, double endpts)
|
||||
duration = MPCLAMP(diff, 0, 10) * 1e6;
|
||||
}
|
||||
|
||||
mpctx->video_pts = mpctx->video_next_pts;
|
||||
mpctx->video_pts = mpctx->next_frame[0]->pts;
|
||||
mpctx->last_vo_pts = mpctx->video_pts;
|
||||
mpctx->playback_pts = mpctx->video_pts;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user