summaryrefslogtreecommitdiffstats
path: root/video/out/vo.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/vo.c')
-rw-r--r--video/out/vo.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index 9f6021282f..f697002f92 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -129,6 +129,7 @@ struct vo_internal {
bool request_redraw; // redraw request from player to VO
bool want_redraw; // redraw request from VO to player
bool paused;
+ int queued_events;
int64_t flip_queue_offset; // queue flip events at most this much in advance
@@ -838,6 +839,31 @@ int64_t vo_get_vsync_interval(struct vo *vo)
return vo->in->vsync_interval;
}
+// Set specific event flags, and wakeup the playback core if needed.
+// vo_query_events() can retrieve the events again.
+void vo_event(struct vo *vo, int event)
+{
+ struct vo_internal *in = vo->in;
+ pthread_mutex_lock(&in->lock);
+ if ((in->queued_events & event & VO_EVENTS_USER) != (event & VO_EVENTS_USER))
+ mp_input_wakeup(vo->input_ctx);
+ in->queued_events |= event;
+ pthread_mutex_unlock(&in->lock);
+}
+
+// Check event flags set with vo_event(). Return the mask of events that was
+// set and included in the events parameter. If clear==true, clear these events.
+int vo_query_events(struct vo *vo, int events, bool clear)
+{
+ struct vo_internal *in = vo->in;
+ pthread_mutex_lock(&in->lock);
+ int r = in->queued_events & events;
+ if (clear)
+ in->queued_events &= ~(unsigned)r;
+ pthread_mutex_unlock(&in->lock);
+ return r;
+}
+
/**
* \brief lookup an integer in a table, table must have 0 as the last key
* \param key key to search for