mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 03:29:50 +00:00
window: add toplevel display indirection for visualid and colormap.
Add GstVaapiDisplay::get_{visual_id,colormap}() helpers to help determine the best suitable window visual id and colormap. This is an indirection in view to supporting EGL and custom/generic replacements.
This commit is contained in:
parent
babae32432
commit
f5af9d150e
2 changed files with 21 additions and 3 deletions
|
@ -74,6 +74,11 @@ typedef GstVaapiTexture *(*GstVaapiDisplayCreateTextureFunc) (
|
|||
GstVaapiDisplay * display, GstVaapiID id, guint target, guint format,
|
||||
guint width, guint height);
|
||||
|
||||
typedef guintptr (*GstVaapiDisplayGetVisualIdFunc) (GstVaapiDisplay * display,
|
||||
GstVaapiWindow * window);
|
||||
typedef guintptr (*GstVaapiDisplayGetColormapFunc) (GstVaapiDisplay * display,
|
||||
GstVaapiWindow * window);
|
||||
|
||||
/**
|
||||
* GST_VAAPI_DISPLAY_GET_CLASS_TYPE:
|
||||
* @display: a #GstVaapiDisplay
|
||||
|
@ -190,6 +195,8 @@ struct _GstVaapiDisplay
|
|||
* @get_display: virtual function to retrieve the #GstVaapiDisplayInfo
|
||||
* @get_size: virtual function to retrieve the display dimensions, in pixels
|
||||
* @get_size_mm: virtual function to retrieve the display dimensions, in millimeters
|
||||
* @get_visual_id: (optional) virtual function to retrieve the window visual id
|
||||
* @get_colormap: (optional) virtual function to retrieve the window colormap
|
||||
* @create_window: (optional) virtual function to create a window
|
||||
* @create_texture: (optional) virtual function to create a texture
|
||||
*
|
||||
|
@ -215,7 +222,8 @@ struct _GstVaapiDisplayClass
|
|||
GstVaapiDisplayGetInfoFunc get_display;
|
||||
GstVaapiDisplayGetSizeFunc get_size;
|
||||
GstVaapiDisplayGetSizeMFunc get_size_mm;
|
||||
|
||||
GstVaapiDisplayGetVisualIdFunc get_visual_id;
|
||||
GstVaapiDisplayGetColormapFunc get_colormap;
|
||||
GstVaapiDisplayCreateWindowFunc create_window;
|
||||
GstVaapiDisplayCreateTextureFunc create_texture;
|
||||
};
|
||||
|
|
|
@ -212,10 +212,12 @@ gst_vaapi_window_x11_create (GstVaapiWindow * window, guint * width,
|
|||
{
|
||||
GstVaapiWindowX11Private *const priv =
|
||||
GST_VAAPI_WINDOW_X11_GET_PRIVATE (window);
|
||||
GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (window);
|
||||
Display *const dpy = GST_VAAPI_OBJECT_NATIVE_DISPLAY (window);
|
||||
Window xid = GST_VAAPI_OBJECT_ID (window);
|
||||
guint vid = 0;
|
||||
Colormap cmap = None;
|
||||
const GstVaapiDisplayClass *display_class;
|
||||
const GstVaapiWindowClass *window_class;
|
||||
XWindowAttributes wattr;
|
||||
Atom atoms[2];
|
||||
|
@ -238,11 +240,19 @@ gst_vaapi_window_x11_create (GstVaapiWindow * window, guint * width,
|
|||
return ok;
|
||||
}
|
||||
|
||||
display_class = GST_VAAPI_DISPLAY_GET_CLASS (display);
|
||||
if (display_class) {
|
||||
if (display_class->get_visual_id)
|
||||
vid = display_class->get_visual_id (display, window);
|
||||
if (display_class->get_colormap)
|
||||
cmap = display_class->get_colormap (display, window);
|
||||
}
|
||||
|
||||
window_class = GST_VAAPI_WINDOW_GET_CLASS (window);
|
||||
if (window_class) {
|
||||
if (window_class->get_visual_id)
|
||||
if (window_class->get_visual_id && !vid)
|
||||
vid = window_class->get_visual_id (window);
|
||||
if (window_class->get_colormap)
|
||||
if (window_class->get_colormap && !cmap)
|
||||
cmap = window_class->get_colormap (window);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue