/**
 * gst_vaapi_window_drm_new:
 * @display: a #GstVaapiDisplay
 * @width: the requested window width, in pixels (unused)
 * @height: the requested windo height, in pixels (unused)
 *
 * Creates a dummy window. The window will be attached to the @display.
 * All rendering functions will return success since VA/DRM is a
 * renderless API.
 *
 * Note: this dummy window object is only necessary to fulfill cases
 * where the client application wants to automatically determine the
 * best display to use for the current system. As such, it provides
 * utility functions with the same API (function arguments) to help
 * implement uniform function tables.
 *
 * Return value: the newly allocated #GstVaapiWindow object
 */
GstVaapiWindow *
gst_vaapi_window_drm_new (GstVaapiDisplay * display, guint width, guint height)
{
  g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_DRM (display), NULL);

  return gst_vaapi_window_new_internal (GST_TYPE_VAAPI_WINDOW_DRM, display,
      GST_VAAPI_ID_INVALID, width, height);
}
/**
 * gst_vaapi_window_wayland_new:
 * @display: a #GstVaapiDisplay
 * @width: the requested window width, in pixels
 * @height: the requested windo height, in pixels
 *
 * Creates a window with the specified @width and @height. The window
 * will be attached to the @display and remains invisible to the user
 * until gst_vaapi_window_show() is called.
 *
 * Return value: the newly allocated #GstVaapiWindow object
 */
GstVaapiWindow *
gst_vaapi_window_wayland_new (GstVaapiDisplay * display,
                              guint width, guint height)
{
    GST_DEBUG ("new window, size %ux%u", width, height);

    g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_WAYLAND (display), NULL);

    return gst_vaapi_window_new_internal (GST_VAAPI_WINDOW_CLASS
                                          (gst_vaapi_window_wayland_class ()), display, GST_VAAPI_ID_INVALID, width,
                                          height);
}
/**
 * gst_vaapi_window_glx_new:
 * @display: a #GstVaapiDisplay
 * @width: the requested window width, in pixels
 * @height: the requested windo height, in pixels
 *
 * Creates a window with the specified @width and @height. The window
 * will be attached to the @display and remains invisible to the user
 * until gst_vaapi_window_show() is called.
 *
 * Return value: the newly allocated #GstVaapiWindow object
 */
GstVaapiWindow *
gst_vaapi_window_glx_new (GstVaapiDisplay * display, guint width, guint height)
{
  GstVaapiWindow *window;

  g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_GLX (display), NULL);

  window = gst_vaapi_window_new_internal (GST_TYPE_VAAPI_WINDOW_GLX, display,
      GST_VAAPI_ID_INVALID, width, height);
  if (!window)
    return NULL;

  if (!gst_vaapi_window_glx_ensure_context (window, NULL))
    goto error;
  return window;

  /* ERRORS */
error:
  {
    gst_object_unref (window);
    return NULL;
  }
}
/**
 * gst_vaapi_window_glx_new_with_xid:
 * @display: a #GstVaapiDisplay
 * @xid: an X11 #Window id
 *
 * Creates a #GstVaapiWindow using the X11 #Window @xid. The caller
 * still owns the window and must call XDestroyWindow() when all
 * #GstVaapiWindow references are released. Doing so too early can
 * yield undefined behaviour.
 *
 * Return value: the newly allocated #GstVaapiWindow object
 */
GstVaapiWindow *
gst_vaapi_window_glx_new_with_xid (GstVaapiDisplay * display, Window xid)
{
  GstVaapiWindow *window;

  g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_GLX (display), NULL);
  g_return_val_if_fail (xid != None, NULL);

  window = gst_vaapi_window_new_internal (GST_TYPE_VAAPI_WINDOW_GLX, display,
      xid, 0, 0);
  if (!window)
    return NULL;

  if (!gst_vaapi_window_glx_ensure_context (window, NULL))
    goto error;
  return window;

  /* ERRORS */
error:
  {
    gst_object_unref (window);
    return NULL;
  }
}