mirror of
https://github.com/mpv-player/mpv
synced 2025-04-28 22:34:59 +00:00
video: move up vo_frame setup
This commit is contained in:
parent
f15e652dd4
commit
7d889fbdd0
@ -860,9 +860,17 @@ void write_video(struct MPContext *mpctx, double endpts)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t duration = -1;
|
|
||||||
double diff = -1;
|
|
||||||
assert(mpctx->num_next_frames >= 1);
|
assert(mpctx->num_next_frames >= 1);
|
||||||
|
struct vo_frame dummy = {
|
||||||
|
.pts = pts,
|
||||||
|
.duration = -1,
|
||||||
|
.num_frames = mpctx->num_next_frames,
|
||||||
|
};
|
||||||
|
for (int n = 0; n < dummy.num_frames; n++)
|
||||||
|
dummy.frames[n] = mpctx->next_frames[n];
|
||||||
|
struct vo_frame *frame = vo_frame_ref(&dummy);
|
||||||
|
|
||||||
|
double diff = -1;
|
||||||
double vpts0 = mpctx->next_frames[0]->pts;
|
double vpts0 = mpctx->next_frames[0]->pts;
|
||||||
double vpts1 = MP_NOPTS_VALUE;
|
double vpts1 = MP_NOPTS_VALUE;
|
||||||
if (mpctx->num_next_frames >= 2)
|
if (mpctx->num_next_frames >= 2)
|
||||||
@ -878,7 +886,7 @@ void write_video(struct MPContext *mpctx, double endpts)
|
|||||||
diff /= opts->playback_speed;
|
diff /= opts->playback_speed;
|
||||||
if (mpctx->time_frame < 0)
|
if (mpctx->time_frame < 0)
|
||||||
diff += mpctx->time_frame;
|
diff += mpctx->time_frame;
|
||||||
duration = MPCLAMP(diff, 0, 10) * 1e6;
|
frame->duration = MPCLAMP(diff, 0, 10) * 1e6;
|
||||||
}
|
}
|
||||||
|
|
||||||
mpctx->video_pts = mpctx->next_frames[0]->pts;
|
mpctx->video_pts = mpctx->next_frames[0]->pts;
|
||||||
@ -891,15 +899,7 @@ void write_video(struct MPContext *mpctx, double endpts)
|
|||||||
update_osd_msg(mpctx);
|
update_osd_msg(mpctx);
|
||||||
update_subtitles(mpctx);
|
update_subtitles(mpctx);
|
||||||
|
|
||||||
assert(mpctx->num_next_frames >= 1);
|
vo_queue_frame(vo, frame);
|
||||||
struct vo_frame dummy = {
|
|
||||||
.pts = pts,
|
|
||||||
.duration = duration,
|
|
||||||
.num_frames = mpctx->num_next_frames,
|
|
||||||
};
|
|
||||||
for (int n = 0; n < dummy.num_frames; n++)
|
|
||||||
dummy.frames[n] = mpctx->next_frames[n];
|
|
||||||
vo_queue_frame(vo, vo_frame_ref(&dummy));
|
|
||||||
|
|
||||||
shift_frames(mpctx);
|
shift_frames(mpctx);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user