summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-22 20:16:44 +0200
committerwm4 <wm4@nowhere>2016-09-22 20:16:44 +0200
commit9179e8ed21e35731cdd7ba258d46090e57a8c281 (patch)
treecfbc32b60a3d243fe2cdd5af8e4c549704a397b2 /video
parentc296b6204fcace8a3ad99c08fa5d2931b70e57cc (diff)
downloadmpv-9179e8ed21e35731cdd7ba258d46090e57a8c281.tar.bz2
mpv-9179e8ed21e35731cdd7ba258d46090e57a8c281.tar.xz
vo: add a unique frame_id to vo_frame
We think that this allows simpler logic than using the redraw and repeat fields. Not used yet.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo.c3
-rw-r--r--video/out/vo.h6
2 files changed, 9 insertions, 0 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index b9d9bcd4f2..74449a9296 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -154,6 +154,7 @@ struct vo_internal {
bool rendering; // true if an image is being rendered
struct vo_frame *frame_queued; // should be drawn next
int req_frames; // VO's requested value of num_frames
+ uint64_t current_frame_id;
double display_fps;
int opt_framedrop;
@@ -597,6 +598,7 @@ static void forget_frames(struct vo *vo)
in->delayed_count = 0;
talloc_free(in->frame_queued);
in->frame_queued = NULL;
+ in->current_frame_id += VO_MAX_REQ_FRAMES + 1;
// don't unref current_frame; we always want to be able to redraw it
if (in->current_frame) {
in->current_frame->num_vsyncs = 0; // but reset future repeats
@@ -699,6 +701,7 @@ void vo_queue_frame(struct vo *vo, struct vo_frame *frame)
assert(vo->config_ok && !in->frame_queued &&
(!in->current_frame || in->current_frame->num_vsyncs < 1));
in->hasframe = true;
+ frame->frame_id = ++(in->current_frame_id);
in->frame_queued = frame;
in->wakeup_pts = frame->display_synced
? 0 : frame->pts + MPMAX(frame->duration, 0);
diff --git a/video/out/vo.h b/video/out/vo.h
index e35085c49b..d76329ffeb 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -211,6 +211,12 @@ struct vo_frame {
// VO if frames are dropped.
int num_frames;
struct mp_image *frames[VO_MAX_REQ_FRAMES];
+ // ID for frames[0] (== current). If current==NULL, the number is
+ // meaningless. Otherwise, it's an unique ID for the frame. The ID for
+ // a frame is guaranteed not to change (instant redraws will use the same
+ // ID). frames[n] has the ID frame_id+n, with the guarantee that frame
+ // drops or reconfigs will keep the guarantee.
+ uint64_t frame_id;
};
struct vo_driver {