summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-07-28 23:54:39 +0200
committerwm4 <wm4@nowhere>2015-07-28 23:54:39 +0200
commit7d889fbdd0735aab6c0930ed23bc8b5c33ff46e7 (patch)
treecf9e1853fb3a1a9b59e1cdc7890a0e9fde7efd4d
parentf15e652dd40a27ec000b4dcfe2b5fff90a3ac36a (diff)
downloadmpv-7d889fbdd0735aab6c0930ed23bc8b5c33ff46e7.tar.bz2
mpv-7d889fbdd0735aab6c0930ed23bc8b5c33ff46e7.tar.xz
video: move up vo_frame setup
-rw-r--r--player/video.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/player/video.c b/player/video.c
index 4831189dff..5943f39d43 100644
--- a/player/video.c
+++ b/player/video.c
@@ -860,9 +860,17 @@ void write_video(struct MPContext *mpctx, double endpts)
return;
}
- int64_t duration = -1;
- double diff = -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 vpts1 = MP_NOPTS_VALUE;
if (mpctx->num_next_frames >= 2)
@@ -878,7 +886,7 @@ void write_video(struct MPContext *mpctx, double endpts)
diff /= opts->playback_speed;
if (mpctx->time_frame < 0)
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;
@@ -891,15 +899,7 @@ void write_video(struct MPContext *mpctx, double endpts)
update_osd_msg(mpctx);
update_subtitles(mpctx);
- assert(mpctx->num_next_frames >= 1);
- 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));
+ vo_queue_frame(vo, frame);
shift_frames(mpctx);