mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
display: add utility function to check for OpenGL rendering.
Add gst_vaapi_display_has_opengl() helper function to help determining whether the display can support OpenGL context to be bound to it, i.e. if the class is of type GST_VAAPI_DISPLAY_TYPE_GLX.
This commit is contained in:
parent
7d5d3e8640
commit
807c4e8248
4 changed files with 29 additions and 1 deletions
|
@ -2115,3 +2115,26 @@ gst_vaapi_display_get_vendor_string (GstVaapiDisplay * display)
|
|||
return NULL;
|
||||
return display->priv.vendor_string;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_display_has_opengl:
|
||||
* @display: a #GstVaapiDisplay
|
||||
*
|
||||
* Returns wether the @display that was created does support OpenGL
|
||||
* context to be attached.
|
||||
*
|
||||
* This function is thread safe.
|
||||
*
|
||||
* Return value: %TRUE if the @display supports OpenGL context, %FALSE
|
||||
* otherwise
|
||||
*/
|
||||
gboolean
|
||||
gst_vaapi_display_has_opengl (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayClass *klass;
|
||||
|
||||
g_return_val_if_fail (display != NULL, NULL);
|
||||
|
||||
klass = GST_VAAPI_DISPLAY_GET_CLASS (display);
|
||||
return (klass->display_type == GST_VAAPI_DISPLAY_TYPE_GLX);
|
||||
}
|
||||
|
|
|
@ -252,6 +252,9 @@ gst_vaapi_display_set_rotation (GstVaapiDisplay * display,
|
|||
const gchar *
|
||||
gst_vaapi_display_get_vendor_string (GstVaapiDisplay * display);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_has_opengl (GstVaapiDisplay * display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_VAAPI_DISPLAY_H */
|
||||
|
|
|
@ -106,6 +106,7 @@ gst_vaapi_texture_new (GstVaapiDisplay * display, guint target, guint format,
|
|||
GstVaapiDisplayClass *dpy_class;
|
||||
|
||||
g_return_val_if_fail (display != NULL, NULL);
|
||||
g_return_val_if_fail (gst_vaapi_display_has_opengl (display), NULL);
|
||||
|
||||
dpy_class = GST_VAAPI_DISPLAY_GET_CLASS (display);
|
||||
if (G_UNLIKELY (!dpy_class->create_texture))
|
||||
|
@ -144,6 +145,7 @@ gst_vaapi_texture_new_wrapped (GstVaapiDisplay * display, guint id,
|
|||
GstVaapiDisplayClass *dpy_class;
|
||||
|
||||
g_return_val_if_fail (display != NULL, NULL);
|
||||
g_return_val_if_fail (gst_vaapi_display_has_opengl (display), NULL);
|
||||
|
||||
dpy_class = GST_VAAPI_DISPLAY_GET_CLASS (display);
|
||||
if (G_UNLIKELY (!dpy_class->create_texture))
|
||||
|
|
|
@ -90,7 +90,7 @@ gst_vaapi_texture_upload (GstVideoGLTextureUploadMeta * meta,
|
|||
GstVaapiSurface *const surface = gst_vaapi_surface_proxy_get_surface (proxy);
|
||||
GstVaapiDisplay *const dpy = GST_VAAPI_OBJECT_DISPLAY (surface);
|
||||
|
||||
if (gst_vaapi_display_get_class_type (dpy) != GST_VAAPI_DISPLAY_TYPE_GLX)
|
||||
if (!gst_vaapi_display_has_opengl (dpy))
|
||||
return FALSE;
|
||||
|
||||
if (!meta_texture->texture ||
|
||||
|
|
Loading…
Reference in a new issue