gst_vaapi_display_new_with_display
gst_vaapi_display_lock
gst_vaapi_display_unlock
+gst_vaapi_display_sync
+gst_vaapi_display_flush
gst_vaapi_display_get_display
gst_vaapi_display_get_width
gst_vaapi_display_get_height
guint height_mm;
guint par_n;
guint par_d;
- gboolean create_display;
GArray *profiles;
GArray *image_formats;
GArray *subpicture_formats;
+ guint create_display : 1;
};
enum {
priv->height_mm = 0;
priv->par_n = 1;
priv->par_d = 1;
- priv->create_display = TRUE;
priv->profiles = NULL;
priv->image_formats = NULL;
priv->subpicture_formats = NULL;
+ priv->create_display = TRUE;
g_static_mutex_init(&priv->mutex);
}
}
/**
+ * gst_vaapi_display_sync:
+ * @display: a #GstVaapiDisplay
+ *
+ * Flushes any requests queued for the windowing system and waits until
+ * all requests have been handled. This is often used for making sure
+ * that the display is synchronized with the current state of the program.
+ *
+ * This is most useful for X11. On windowing systems where requests are
+ * handled synchronously, this function will do nothing.
+ */
+void
+gst_vaapi_display_sync(GstVaapiDisplay *display)
+{
+ GstVaapiDisplayClass *klass;
+
+ g_return_if_fail(GST_VAAPI_IS_DISPLAY(display));
+
+ klass = GST_VAAPI_DISPLAY_GET_CLASS(display);
+ if (klass->sync)
+ klass->sync(display);
+ else if (klass->flush)
+ klass->flush(display);
+}
+
+/**
+ * gst_vaapi_display_sync:
+ * @display: a #GstVaapiDisplay
+ *
+ * Flushes any requests queued for the windowing system.
+ *
+ * This is most useful for X11. On windowing systems where requests
+ * are handled synchronously, this function will do nothing.
+ */
+void
+gst_vaapi_display_flush(GstVaapiDisplay *display)
+{
+ GstVaapiDisplayClass *klass;
+
+ g_return_if_fail(GST_VAAPI_IS_DISPLAY(display));
+
+ klass = GST_VAAPI_DISPLAY_GET_CLASS(display);
+ if (klass->flush)
+ klass->flush(display);
+}
+
+/**
* gst_vaapi_display_get_display:
* @display: a #GstVaapiDisplay
*
* GstVaapiDisplayClass:
* @open_display: virtual function to open a display
* @close_display: virtual function to close a display
- * @lock: virtual function to lock a display
- * @unlock: virtual function to unlock a display
+ * @lock: (optional) virtual function to lock a display
+ * @unlock: (optional) virtual function to unlock a display
+ * @sync: (optional) virtual function to sync a display
+ * @flush: (optional) virtual function to flush pending requests of a display
* @get_display: virtual function to retrieve the #VADisplay
* @get_size: virtual function to retrieve the display dimensions, in pixels
* @get_size_mm: virtual function to retrieve the display dimensions, in millimeters
void (*close_display) (GstVaapiDisplay *display);
void (*lock) (GstVaapiDisplay *display);
void (*unlock) (GstVaapiDisplay *display);
+ void (*sync) (GstVaapiDisplay *display);
+ void (*flush) (GstVaapiDisplay *display);
VADisplay (*get_display) (GstVaapiDisplay *display);
void (*get_size) (GstVaapiDisplay *display,
guint *pwidth, guint *pheight);
void
gst_vaapi_display_unlock(GstVaapiDisplay *display);
+void
+gst_vaapi_display_sync(GstVaapiDisplay *display);
+
+void
+gst_vaapi_display_flush(GstVaapiDisplay *display);
+
VADisplay
gst_vaapi_display_get_display(GstVaapiDisplay *display);
}
}
+static void
+gst_vaapi_display_x11_sync(GstVaapiDisplay *display)
+{
+ GstVaapiDisplayX11Private * const priv =
+ GST_VAAPI_DISPLAY_X11(display)->priv;
+
+ if (priv->x11_display)
+ XSync(priv->x11_display, False);
+}
+
+static void
+gst_vaapi_display_x11_flush(GstVaapiDisplay *display)
+{
+ GstVaapiDisplayX11Private * const priv =
+ GST_VAAPI_DISPLAY_X11(display)->priv;
+
+ if (priv->x11_display)
+ XFlush(priv->x11_display);
+}
+
static VADisplay
gst_vaapi_display_x11_get_va_display(GstVaapiDisplay *display)
{
dpy_class->open_display = gst_vaapi_display_x11_open_display;
dpy_class->close_display = gst_vaapi_display_x11_close_display;
+ dpy_class->sync = gst_vaapi_display_x11_sync;
+ dpy_class->flush = gst_vaapi_display_x11_flush;
dpy_class->get_display = gst_vaapi_display_x11_get_va_display;
dpy_class->get_size = gst_vaapi_display_x11_get_size;
dpy_class->get_size_mm = gst_vaapi_display_x11_get_size_mm;