mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
window: add toplevel API to determine the colormap.
Add GstVaapiWindowClass::get_colormap() hook to help determine the currently active colormap bound to the supplied window, or actually create it if it does not already exist yet.
This commit is contained in:
parent
e9f437167f
commit
babae32432
4 changed files with 9 additions and 14 deletions
|
@ -268,10 +268,10 @@ gst_vaapi_window_glx_create_colormap (GstVaapiWindow * window)
|
||||||
return priv->cmap;
|
return priv->cmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Colormap
|
static guintptr
|
||||||
gst_vaapi_window_glx_get_colormap (GstVaapiWindow * window)
|
gst_vaapi_window_glx_get_colormap (GstVaapiWindow * window)
|
||||||
{
|
{
|
||||||
return gst_vaapi_window_glx_create_colormap (window);
|
return GPOINTER_TO_SIZE (gst_vaapi_window_glx_create_colormap (window));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -321,7 +321,7 @@ gst_vaapi_window_glx_class_init (GstVaapiWindowGLXClass * klass)
|
||||||
klass->parent_finalize = GST_VAAPI_OBJECT_CLASS (klass)->finalize;
|
klass->parent_finalize = GST_VAAPI_OBJECT_CLASS (klass)->finalize;
|
||||||
window_class->resize = gst_vaapi_window_glx_resize;
|
window_class->resize = gst_vaapi_window_glx_resize;
|
||||||
window_class->get_visual_id = gst_vaapi_window_glx_get_visual_id;
|
window_class->get_visual_id = gst_vaapi_window_glx_get_visual_id;
|
||||||
xwindow_class->get_colormap = gst_vaapi_window_glx_get_colormap;
|
window_class->get_colormap = gst_vaapi_window_glx_get_colormap;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiWindowGLX,
|
GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiWindowGLX,
|
||||||
|
|
|
@ -53,6 +53,7 @@ typedef gboolean (*GstVaapiWindowRenderPixmapFunc) (GstVaapiWindow * window,
|
||||||
GstVaapiPixmap * pixmap, const GstVaapiRectangle * src_rect,
|
GstVaapiPixmap * pixmap, const GstVaapiRectangle * src_rect,
|
||||||
const GstVaapiRectangle * dst_rect);
|
const GstVaapiRectangle * dst_rect);
|
||||||
typedef guintptr (*GstVaapiWindowGetVisualIdFunc) (GstVaapiWindow * window);
|
typedef guintptr (*GstVaapiWindowGetVisualIdFunc) (GstVaapiWindow * window);
|
||||||
|
typedef guintptr (*GstVaapiWindowGetColormapFunc) (GstVaapiWindow * window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstVaapiWindow:
|
* GstVaapiWindow:
|
||||||
|
@ -85,6 +86,8 @@ struct _GstVaapiWindow
|
||||||
* @render: virtual function to render a #GstVaapiSurface into a window
|
* @render: virtual function to render a #GstVaapiSurface into a window
|
||||||
* @get_visual_id: virtual function to get the desired visual id used to
|
* @get_visual_id: virtual function to get the desired visual id used to
|
||||||
* create the window
|
* create the window
|
||||||
|
* @get_colormap: virtual function to get the desired colormap used to
|
||||||
|
* create the window, or the currently allocated one
|
||||||
*
|
*
|
||||||
* Base class for system-dependent windows.
|
* Base class for system-dependent windows.
|
||||||
*/
|
*/
|
||||||
|
@ -103,6 +106,7 @@ struct _GstVaapiWindowClass
|
||||||
GstVaapiWindowRenderFunc render;
|
GstVaapiWindowRenderFunc render;
|
||||||
GstVaapiWindowRenderPixmapFunc render_pixmap;
|
GstVaapiWindowRenderPixmapFunc render_pixmap;
|
||||||
GstVaapiWindowGetVisualIdFunc get_visual_id;
|
GstVaapiWindowGetVisualIdFunc get_visual_id;
|
||||||
|
GstVaapiWindowGetColormapFunc get_colormap;
|
||||||
};
|
};
|
||||||
|
|
||||||
GstVaapiWindow *
|
GstVaapiWindow *
|
||||||
|
|
|
@ -217,7 +217,6 @@ gst_vaapi_window_x11_create (GstVaapiWindow * window, guint * width,
|
||||||
guint vid = 0;
|
guint vid = 0;
|
||||||
Colormap cmap = None;
|
Colormap cmap = None;
|
||||||
const GstVaapiWindowClass *window_class;
|
const GstVaapiWindowClass *window_class;
|
||||||
const GstVaapiWindowX11Class *klass;
|
|
||||||
XWindowAttributes wattr;
|
XWindowAttributes wattr;
|
||||||
Atom atoms[2];
|
Atom atoms[2];
|
||||||
gboolean ok;
|
gboolean ok;
|
||||||
|
@ -243,12 +242,8 @@ gst_vaapi_window_x11_create (GstVaapiWindow * window, guint * width,
|
||||||
if (window_class) {
|
if (window_class) {
|
||||||
if (window_class->get_visual_id)
|
if (window_class->get_visual_id)
|
||||||
vid = window_class->get_visual_id (window);
|
vid = window_class->get_visual_id (window);
|
||||||
}
|
if (window_class->get_colormap)
|
||||||
|
cmap = window_class->get_colormap (window);
|
||||||
klass = GST_VAAPI_WINDOW_X11_GET_CLASS (window);
|
|
||||||
if (klass) {
|
|
||||||
if (klass->get_colormap)
|
|
||||||
cmap = klass->get_colormap (window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_VAAPI_OBJECT_LOCK_DISPLAY (window);
|
GST_VAAPI_OBJECT_LOCK_DISPLAY (window);
|
||||||
|
|
|
@ -72,8 +72,6 @@ struct _GstVaapiWindowX11
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstVaapiWindowX11Class:
|
* GstVaapiWindowX11Class:
|
||||||
* @get_colormap: virtual function to get the desired colormap used to
|
|
||||||
* create the window
|
|
||||||
*
|
*
|
||||||
* An X11 #Window wrapper class.
|
* An X11 #Window wrapper class.
|
||||||
*/
|
*/
|
||||||
|
@ -81,8 +79,6 @@ struct _GstVaapiWindowX11Class
|
||||||
{
|
{
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GstVaapiWindowClass parent_class;
|
GstVaapiWindowClass parent_class;
|
||||||
|
|
||||||
Colormap (*get_colormap) (GstVaapiWindow * window);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue