/**
 * gst_vaapi_display_glx_new_with_display:
 * @x11_display: an X11 #Display
 *
 * Creates a #GstVaapiDisplay based on the X11 @x11_display
 * display. The caller still owns the display and must call
 * XCloseDisplay() when all #GstVaapiDisplay references are
 * released. Doing so too early can yield undefined behaviour.
 *
 * Return value: a newly allocated #GstVaapiDisplay object
 */
GstVaapiDisplay *
gst_vaapi_display_glx_new_with_display (Display * x11_display)
{
  g_return_val_if_fail (x11_display != NULL, NULL);

  return gst_vaapi_display_new (gst_vaapi_display_glx_class (),
      GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, x11_display);
}
/**
 * gst_vaapi_display_egl_new_with_native_display:
 * @native_display: an EGLDisplay object
 * @display_type: the display type of @native_display
 * @gles_version: the OpenGL ES version API to use
 *
 * Creates a #GstVaapiDisplay based on the native display supplied in
 * as @native_display. The caller still owns the display and must call
 * native display close function when all #GstVaapiDisplay references
 * are released. Doing so too early can yield undefined behaviour.
 *
 * The @gles_version will further ensure the OpenGL ES API to use, or
 * zero to indicate "desktop" OpenGL.
 *
 * Return value: a newly allocated #GstVaapiDisplay object
 */
GstVaapiDisplay *
gst_vaapi_display_egl_new_with_native_display (gpointer native_display,
    GstVaapiDisplayType display_type, guint gles_version)
{
  InitParams params;

  g_return_val_if_fail (native_display != NULL, NULL);

  params.display = native_display;
  params.display_type = display_type;
  params.gles_version = gles_version;
  return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_EGL, NULL),
      GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, &params);
}
/**
 * gst_vaapi_display_egl_new:
 * @display: a #GstVaapiDisplay, or %NULL to pick any one
 * @gles_version: the OpenGL ES version API to use
 *
 * Creates a new #GstVaapiDisplay object suitable in EGL context. If
 * the native @display is %NULL, then any type of display is picked,
 * i.e. one that can be successfully opened. The @gles_version will
 * further ensure the OpenGL ES API to use, or zero to indicate
 * "desktop" OpenGL.
 *
 * Return value: a newly allocated #GstVaapiDisplay object
 */
GstVaapiDisplay *
gst_vaapi_display_egl_new (GstVaapiDisplay * display, guint gles_version)
{
  InitParams params;

  if (display) {
    params.display = display;
    params.display_type = GST_VAAPI_DISPLAY_VADISPLAY_TYPE (display);
  } else {
    params.display = NULL;
    params.display_type = GST_VAAPI_DISPLAY_TYPE_ANY;
  }
  params.gles_version = gles_version;
  return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_EGL, NULL),
      GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, &params);
}
/**
 * gst_vaapi_display_glx_new:
 * @display_name: the X11 display name
 *
 * Opens an X11 #Display using @display_name and returns a newly
 * allocated #GstVaapiDisplay object. The X11 display will be cloed
 * when the reference count of the object reaches zero.
 *
 * Return value: a newly allocated #GstVaapiDisplay object
 */
GstVaapiDisplay *
gst_vaapi_display_glx_new (const gchar * display_name)
{
  return gst_vaapi_display_new (gst_vaapi_display_glx_class (),
      GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
}
/**
 * gst_vaapi_display_glx_new:
 * @display_name: the X11 display name
 *
 * Opens an X11 #Display using @display_name and returns a newly
 * allocated #GstVaapiDisplay object. The X11 display will be cloed
 * when the reference count of the object reaches zero.
 *
 * Return value: a newly allocated #GstVaapiDisplay object
 */
GstVaapiDisplay *
gst_vaapi_display_glx_new (const gchar * display_name)
{
  return gst_vaapi_display_new (g_object_new (GST_TYPE_VAAPI_DISPLAY_GLX, NULL),
      GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
}