[vlc-devel] [PATCH 1/6] vout_window: add rendering suspension/resuming callbacks
Alexandre Janniaux
ajanni at videolabs.io
Fri Feb 5 09:01:52 UTC 2021
Those callbacks are used by vout_window implementations in environment
where the rendering is constrained by the application state. The design
case for those events is iOS where application must not draw onto its
surface when they have been moved to the background, but it should be
generalizable to every cases where the window is in a state such as no
more rendering is needed for it.
---
include/vlc_vout_window.h | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index ea16d4b414..b02c451794 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -289,6 +289,25 @@ struct vout_window_callbacks {
*/
void (*output_event)(struct vout_window_t *,
const char *id, const char *desc);
+
+ /**
+ * Callback for window rendering suspension.
+ *
+ * This callback function (if non-NULL) signals that the window has been
+ * suspended and should not be used for rendering after the end of this
+ * function until the `resumed` event is submitted. Typicaly use case of
+ * this event is when the application has been moved to the background
+ * and should not draw anything.
+ */
+ void (*rendering_suspended)(struct vout_window_t *);
+
+ /**
+ * Callback for resuming window rendering.
+ *
+ * This callback function (if non-NULL) signals that the window has been
+ * resumed and can be rendered.
+ */
+ void (*rendering_resumed)(struct vout_window_t *);
};
/**
@@ -692,5 +711,19 @@ static inline void vout_window_ReportOutputDevice(vout_window_t *window,
window->owner.cbs->output_event(window, id, name);
}
+static inline void
+vout_window_ReportRenderingSuspended(vout_window_t *window)
+{
+ if (window->owner.cbs->rendering_suspended != NULL)
+ window->owner.cbs->rendering_suspended(window);
+}
+
+static inline void
+vout_window_ReportRenderingResumed(vout_window_t *window)
+{
+ if (window->owner.cbs->rendering_resumed != NULL)
+ window->owner.cbs->rendering_resumed(window);
+}
+
/** @} */
#endif /* VLC_VOUT_WINDOW_H */
--
2.28.0
More information about the vlc-devel
mailing list