mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
display: refine the meaning of display type.
Make gst_vaapi_display_get_display_type() return the actual VA display type. Conversely, add a gst_vaapi_display_get_class_type() function to return the type of the GstVaapiDisplay instance. The former is used to identify the display server onto which the application is running, and the latter to identify the original object class.
This commit is contained in:
parent
17f21ac4db
commit
7d5d3e8640
14 changed files with 73 additions and 73 deletions
|
@ -1280,11 +1280,30 @@ gst_vaapi_display_flush (GstVaapiDisplay * display)
|
|||
klass->flush (display);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_display_get_class_type:
|
||||
* @display: a #GstVaapiDisplay
|
||||
*
|
||||
* Returns the #GstVaapiDisplayType of @display. This is the type of
|
||||
* the object, thus the associated class, not the type of the VA
|
||||
* display.
|
||||
*
|
||||
* Return value: the #GstVaapiDisplayType
|
||||
*/
|
||||
GstVaapiDisplayType
|
||||
gst_vaapi_display_get_class_type (GstVaapiDisplay * display)
|
||||
{
|
||||
g_return_val_if_fail (display != NULL, GST_VAAPI_DISPLAY_TYPE_ANY);
|
||||
|
||||
return GST_VAAPI_DISPLAY_GET_CLASS_TYPE (display);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_display_get_display_type:
|
||||
* @display: a #GstVaapiDisplay
|
||||
*
|
||||
* Returns the #GstVaapiDisplayType bound to @display.
|
||||
* Returns the #GstVaapiDisplayType of the VA display bound to
|
||||
* @display. This is not the type of the @display object.
|
||||
*
|
||||
* Return value: the #GstVaapiDisplayType
|
||||
*/
|
||||
|
@ -1293,7 +1312,7 @@ gst_vaapi_display_get_display_type (GstVaapiDisplay * display)
|
|||
{
|
||||
g_return_val_if_fail (display != NULL, GST_VAAPI_DISPLAY_TYPE_ANY);
|
||||
|
||||
return GST_VAAPI_DISPLAY_GET_PRIVATE (display)->display_type;
|
||||
return GST_VAAPI_DISPLAY_VADISPLAY_TYPE (display);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,12 +37,21 @@ G_BEGIN_DECLS
|
|||
((GstVaapiDisplay *)(obj))
|
||||
|
||||
/**
|
||||
* GST_VAAPI_DISPLAY_TYPE:
|
||||
* GST_VAAPI_DISPLAY_GET_CLASS_TYPE:
|
||||
* @display: a #GstVaapiDisplay
|
||||
*
|
||||
* Returns the @display type
|
||||
* Returns the #display class type
|
||||
*/
|
||||
#define GST_VAAPI_DISPLAY_TYPE(display) \
|
||||
#define GST_VAAPI_DISPLAY_GET_CLASS_TYPE(display) \
|
||||
gst_vaapi_display_get_class_type (GST_VAAPI_DISPLAY (display))
|
||||
|
||||
/**
|
||||
* GST_VAAPI_DISPLAY_VADISPLAY_TYPE:
|
||||
* @display: a #GstVaapiDisplay
|
||||
*
|
||||
* Returns the underlying VADisplay @display type.
|
||||
*/
|
||||
#define GST_VAAPI_DISPLAY_VADISPLAY_TYPE(display) \
|
||||
gst_vaapi_display_get_display_type (GST_VAAPI_DISPLAY (display))
|
||||
|
||||
/**
|
||||
|
@ -157,6 +166,9 @@ gst_vaapi_display_sync (GstVaapiDisplay * display);
|
|||
void
|
||||
gst_vaapi_display_flush (GstVaapiDisplay * display);
|
||||
|
||||
GstVaapiDisplayType
|
||||
gst_vaapi_display_get_class_type (GstVaapiDisplay * display);
|
||||
|
||||
GstVaapiDisplayType
|
||||
gst_vaapi_display_get_display_type (GstVaapiDisplay * display);
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ gst_vaapi_display_drm_open_display (GstVaapiDisplay * display,
|
|||
return FALSE;
|
||||
|
||||
info = gst_vaapi_display_cache_lookup_by_name (cache, priv->device_path,
|
||||
GST_VAAPI_DISPLAY_TYPES (display));
|
||||
g_display_types);
|
||||
if (info) {
|
||||
priv->drm_device = GPOINTER_TO_INT (info->native_display);
|
||||
priv->use_foreign_display = TRUE;
|
||||
|
@ -294,7 +294,7 @@ gst_vaapi_display_drm_get_display_info (GstVaapiDisplay * display,
|
|||
|
||||
/* Return any cached info even if child has its own VA display */
|
||||
cached_info = gst_vaapi_display_cache_lookup_by_native_display (cache,
|
||||
GINT_TO_POINTER (priv->drm_device), GST_VAAPI_DISPLAY_TYPES (display));
|
||||
GINT_TO_POINTER (priv->drm_device), g_display_types);
|
||||
if (cached_info) {
|
||||
*info = *cached_info;
|
||||
return TRUE;
|
||||
|
@ -331,7 +331,7 @@ gst_vaapi_display_drm_class_init (GstVaapiDisplayDRMClass * klass)
|
|||
gst_vaapi_display_class_init (&klass->parent_class);
|
||||
|
||||
object_class->size = sizeof (GstVaapiDisplayDRM);
|
||||
dpy_class->display_types = g_display_types;
|
||||
dpy_class->display_type = GST_VAAPI_DISPLAY_TYPE_DRM;
|
||||
dpy_class->init = gst_vaapi_display_drm_init;
|
||||
dpy_class->bind_display = gst_vaapi_display_drm_bind_display;
|
||||
dpy_class->open_display = gst_vaapi_display_drm_open_display;
|
||||
|
|
|
@ -30,7 +30,7 @@ G_BEGIN_DECLS
|
|||
|
||||
#define GST_VAAPI_IS_DISPLAY_DRM(display) \
|
||||
((display) != NULL && \
|
||||
GST_VAAPI_DISPLAY_TYPE(display) == GST_VAAPI_DISPLAY_TYPE_DRM)
|
||||
GST_VAAPI_DISPLAY_VADISPLAY_TYPE(display) == GST_VAAPI_DISPLAY_TYPE_DRM)
|
||||
|
||||
#define GST_VAAPI_DISPLAY_DRM_CAST(display) \
|
||||
((GstVaapiDisplayDRM *)(display))
|
||||
|
|
|
@ -42,19 +42,6 @@
|
|||
|
||||
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_GLX;
|
||||
|
||||
static gboolean
|
||||
gst_vaapi_display_glx_get_display_info (GstVaapiDisplay * display,
|
||||
GstVaapiDisplayInfo * info)
|
||||
{
|
||||
const GstVaapiDisplayGLXClass *const klass =
|
||||
GST_VAAPI_DISPLAY_GLX_GET_CLASS (display);
|
||||
|
||||
if (!klass->parent_get_display (display, info))
|
||||
return FALSE;
|
||||
info->display_type = GST_VAAPI_DISPLAY_TYPE_GLX;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstVaapiTexture *
|
||||
gst_vaapi_display_glx_create_texture (GstVaapiDisplay * display, GstVaapiID id,
|
||||
guint target, guint format, guint width, guint height)
|
||||
|
@ -74,9 +61,7 @@ gst_vaapi_display_glx_class_init (GstVaapiDisplayGLXClass * klass)
|
|||
gst_vaapi_display_x11_class_init (&klass->parent_class);
|
||||
|
||||
object_class->size = sizeof (GstVaapiDisplayGLX);
|
||||
klass->parent_get_display = dpy_class->get_display;
|
||||
dpy_class->display_types = g_display_types;
|
||||
dpy_class->get_display = gst_vaapi_display_glx_get_display_info;
|
||||
dpy_class->display_type = GST_VAAPI_DISPLAY_TYPE_GLX;
|
||||
dpy_class->create_texture = gst_vaapi_display_glx_create_texture;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_VAAPI_IS_DISPLAY_GLX(display) \
|
||||
((display) != NULL && \
|
||||
GST_VAAPI_DISPLAY_TYPE(display) == GST_VAAPI_DISPLAY_TYPE_GLX)
|
||||
((display) != NULL && \
|
||||
GST_VAAPI_DISPLAY_GET_CLASS_TYPE (display) == GST_VAAPI_DISPLAY_TYPE_GLX)
|
||||
|
||||
#define GST_VAAPI_DISPLAY_GLX_CAST(display) \
|
||||
((GstVaapiDisplayGLX *)(display))
|
||||
|
@ -64,8 +64,6 @@ struct _GstVaapiDisplayGLXClass
|
|||
{
|
||||
/*< private >*/
|
||||
GstVaapiDisplayX11Class parent_class;
|
||||
|
||||
GstVaapiDisplayGetInfoFunc parent_get_display;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -71,6 +71,17 @@ typedef GstVaapiTexture *(*GstVaapiDisplayCreateTextureFunc) (
|
|||
GstVaapiDisplay * display, GstVaapiID id, guint target, guint format,
|
||||
guint width, guint height);
|
||||
|
||||
/**
|
||||
* GST_VAAPI_DISPLAY_GET_CLASS_TYPE:
|
||||
* @display: a #GstVaapiDisplay
|
||||
*
|
||||
* Returns the #display class type
|
||||
* This is an internal macro that does not do any run-time type check.
|
||||
*/
|
||||
#undef GST_VAAPI_DISPLAY_GET_CLASS_TYPE
|
||||
#define GST_VAAPI_DISPLAY_GET_CLASS_TYPE(display) \
|
||||
(GST_VAAPI_DISPLAY_GET_CLASS (display)->display_type)
|
||||
|
||||
/**
|
||||
* GST_VAAPI_DISPLAY_NATIVE:
|
||||
* @display: a #GstVaapiDisplay
|
||||
|
@ -94,27 +105,16 @@ typedef GstVaapiTexture *(*GstVaapiDisplayCreateTextureFunc) (
|
|||
(GST_VAAPI_DISPLAY_GET_PRIVATE (display_)->display)
|
||||
|
||||
/**
|
||||
* GST_VAAPI_DISPLAY_TYPE:
|
||||
* GST_VAAPI_DISPLAY_VADISPLAY_TYPE:
|
||||
* @display: a #GstVaapiDisplay
|
||||
*
|
||||
* Returns the @display type
|
||||
* Returns the underlying VADisplay @display type
|
||||
* This is an internal macro that does not do any run-time type check.
|
||||
*/
|
||||
#undef GST_VAAPI_DISPLAY_TYPE
|
||||
#define GST_VAAPI_DISPLAY_TYPE(display) \
|
||||
#undef GST_VAAPI_DISPLAY_VADISPLAY_TYPE
|
||||
#define GST_VAAPI_DISPLAY_VADISPLAY_TYPE(display) \
|
||||
(GST_VAAPI_DISPLAY_GET_PRIVATE (display)->display_type)
|
||||
|
||||
/**
|
||||
* GST_VAAPI_DISPLAY_TYPES:
|
||||
* @display: a #GstVaapiDisplay
|
||||
*
|
||||
* Returns compatible @display types as a set of flags
|
||||
* This is an internal macro that does not do any run-time type check.
|
||||
*/
|
||||
#undef GST_VAAPI_DISPLAY_TYPES
|
||||
#define GST_VAAPI_DISPLAY_TYPES(display) \
|
||||
gst_vaapi_display_get_display_types (GST_VAAPI_DISPLAY_CAST (display))
|
||||
|
||||
/**
|
||||
* GST_VAAPI_DISPLAY_HAS_VPP:
|
||||
* @display: a @GstVaapiDisplay
|
||||
|
@ -197,7 +197,7 @@ struct _GstVaapiDisplayClass
|
|||
GstVaapiMiniObjectClass parent_class;
|
||||
|
||||
/*< protected >*/
|
||||
guint display_types;
|
||||
guint display_type;
|
||||
|
||||
/*< public >*/
|
||||
GstVaapiDisplayInitFunc init;
|
||||
|
@ -230,15 +230,6 @@ GstVaapiDisplay *
|
|||
gst_vaapi_display_new (const GstVaapiDisplayClass * klass,
|
||||
GstVaapiDisplayInitType init_type, gpointer init_value);
|
||||
|
||||
static inline guint
|
||||
gst_vaapi_display_get_display_types (GstVaapiDisplay * display)
|
||||
{
|
||||
const GstVaapiDisplayClass *const dpy_class =
|
||||
GST_VAAPI_DISPLAY_GET_CLASS (display);
|
||||
|
||||
return dpy_class->display_types;
|
||||
}
|
||||
|
||||
/* Inline reference counting for core libgstvaapi library */
|
||||
#ifdef IN_LIBGSTVAAPI_CORE
|
||||
#define gst_vaapi_display_ref_internal(display) \
|
||||
|
|
|
@ -211,7 +211,7 @@ gst_vaapi_display_wayland_open_display (GstVaapiDisplay * display,
|
|||
return FALSE;
|
||||
|
||||
info = gst_vaapi_display_cache_lookup_custom (cache, compare_display_name,
|
||||
priv->display_name, GST_VAAPI_DISPLAY_TYPES (display));
|
||||
priv->display_name, g_display_types);
|
||||
if (info) {
|
||||
priv->wl_display = info->native_display;
|
||||
priv->use_foreign_display = TRUE;
|
||||
|
@ -268,7 +268,7 @@ gst_vaapi_display_wayland_get_display_info (GstVaapiDisplay * display,
|
|||
|
||||
/* Return any cached info even if child has its own VA display */
|
||||
cached_info = gst_vaapi_display_cache_lookup_by_native_display (cache,
|
||||
priv->wl_display, GST_VAAPI_DISPLAY_TYPES (display));
|
||||
priv->wl_display, g_display_types);
|
||||
if (cached_info) {
|
||||
*info = *cached_info;
|
||||
return TRUE;
|
||||
|
@ -339,7 +339,7 @@ gst_vaapi_display_wayland_class_init (GstVaapiDisplayWaylandClass * klass)
|
|||
gst_vaapi_display_class_init (&klass->parent_class);
|
||||
|
||||
object_class->size = sizeof (GstVaapiDisplayWayland);
|
||||
dpy_class->display_types = g_display_types;
|
||||
dpy_class->display_type = GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
||||
dpy_class->init = gst_vaapi_display_wayland_init;
|
||||
dpy_class->bind_display = gst_vaapi_display_wayland_bind_display;
|
||||
dpy_class->open_display = gst_vaapi_display_wayland_open_display;
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_VAAPI_IS_DISPLAY_WAYLAND(display) \
|
||||
((display) != NULL && \
|
||||
GST_VAAPI_DISPLAY_TYPE(display) == GST_VAAPI_DISPLAY_TYPE_WAYLAND)
|
||||
((display) != NULL && \
|
||||
GST_VAAPI_DISPLAY_VADISPLAY_TYPE (display) == GST_VAAPI_DISPLAY_TYPE_WAYLAND)
|
||||
|
||||
#define GST_VAAPI_DISPLAY_WAYLAND_CAST(display) \
|
||||
((GstVaapiDisplayWayland *)(display))
|
||||
|
|
|
@ -45,8 +45,7 @@
|
|||
#define DEBUG 1
|
||||
#include "gstvaapidebug.h"
|
||||
|
||||
static const guint g_display_types =
|
||||
(1U << GST_VAAPI_DISPLAY_TYPE_X11) | (1U << GST_VAAPI_DISPLAY_TYPE_GLX);
|
||||
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_X11;
|
||||
|
||||
static gboolean
|
||||
parse_display_name (const gchar * name, guint * len_ptr, guint * id_ptr,
|
||||
|
@ -204,7 +203,7 @@ gst_vaapi_display_x11_open_display (GstVaapiDisplay * base_display,
|
|||
return FALSE;
|
||||
|
||||
info = gst_vaapi_display_cache_lookup_custom (cache, compare_display_name,
|
||||
priv->display_name, GST_VAAPI_DISPLAY_TYPES (display));
|
||||
priv->display_name, g_display_types);
|
||||
if (info) {
|
||||
priv->x11_display = info->native_display;
|
||||
priv->use_foreign_display = TRUE;
|
||||
|
@ -280,7 +279,7 @@ gst_vaapi_display_x11_get_display_info (GstVaapiDisplay * display,
|
|||
|
||||
/* Return any cached info even if child has its own VA display */
|
||||
cached_info = gst_vaapi_display_cache_lookup_by_native_display (cache,
|
||||
priv->x11_display, GST_VAAPI_DISPLAY_TYPES (display));
|
||||
priv->x11_display, g_display_types);
|
||||
if (cached_info) {
|
||||
*info = *cached_info;
|
||||
return TRUE;
|
||||
|
@ -379,7 +378,7 @@ gst_vaapi_display_x11_class_init (GstVaapiDisplayX11Class * klass)
|
|||
gst_vaapi_display_class_init (&klass->parent_class);
|
||||
|
||||
object_class->size = sizeof (GstVaapiDisplayX11);
|
||||
dpy_class->display_types = g_display_types;
|
||||
dpy_class->display_type = GST_VAAPI_DISPLAY_TYPE_X11;
|
||||
dpy_class->bind_display = gst_vaapi_display_x11_bind_display;
|
||||
dpy_class->open_display = gst_vaapi_display_x11_open_display;
|
||||
dpy_class->close_display = gst_vaapi_display_x11_close_display;
|
||||
|
|
|
@ -31,10 +31,9 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_VAAPI_IS_DISPLAY_X11(display) \
|
||||
((display) != NULL && \
|
||||
(GST_VAAPI_DISPLAY_TYPE(display) == GST_VAAPI_DISPLAY_TYPE_X11 || \
|
||||
GST_VAAPI_DISPLAY_TYPE(display) == GST_VAAPI_DISPLAY_TYPE_GLX))
|
||||
#define GST_VAAPI_IS_DISPLAY_X11(display) \
|
||||
((display) != NULL && \
|
||||
GST_VAAPI_DISPLAY_VADISPLAY_TYPE (display) == GST_VAAPI_DISPLAY_TYPE_X11)
|
||||
|
||||
#define GST_VAAPI_DISPLAY_X11_CAST(display) \
|
||||
((GstVaapiDisplayX11 *)(display))
|
||||
|
|
|
@ -274,9 +274,6 @@ gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display)
|
|||
}
|
||||
#endif
|
||||
#if USE_X11
|
||||
#if USE_GLX
|
||||
case GST_VAAPI_DISPLAY_TYPE_GLX:
|
||||
#endif
|
||||
case GST_VAAPI_DISPLAY_TYPE_X11:{
|
||||
GstVaapiDisplayX11 *const xvadpy = GST_VAAPI_DISPLAY_X11 (display);
|
||||
Display *const x11dpy = gst_vaapi_display_x11_get_display (xvadpy);
|
||||
|
|
|
@ -267,7 +267,7 @@ get_surface_converter (GstVaapiDisplay * display)
|
|||
{
|
||||
GFunc func;
|
||||
|
||||
switch (gst_vaapi_display_get_display_type (display)) {
|
||||
switch (gst_vaapi_display_get_class_type (display)) {
|
||||
#if USE_X11 && !GST_CHECK_VERSION(1,1,0)
|
||||
case GST_VAAPI_DISPLAY_TYPE_X11:
|
||||
func = (GFunc) gst_vaapi_video_converter_x11_new;
|
||||
|
|
|
@ -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_display_type (dpy) != GST_VAAPI_DISPLAY_TYPE_GLX)
|
||||
if (gst_vaapi_display_get_class_type (dpy) != GST_VAAPI_DISPLAY_TYPE_GLX)
|
||||
return FALSE;
|
||||
|
||||
if (!meta_texture->texture ||
|
||||
|
|
Loading…
Reference in a new issue