summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-12-10 18:02:55 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2015-01-27 18:11:44 +0100
commit7d5d3e8640efec613b7717600fe6cb2e4f82a615 (patch)
tree5aa2e6bbfd7f26709c425e6934ce0634737a100b
parent17f21ac4dbbb258fadee36ecadbeb08df74a025a (diff)
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.
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay.c23
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay.h18
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_drm.c6
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_drm_priv.h2
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_glx.c17
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_glx_priv.h6
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_priv.h41
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_wayland.c6
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h4
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_x11.c9
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay_x11_priv.h7
-rw-r--r--gst/vaapi/gstvaapipluginutil.c3
-rw-r--r--gst/vaapi/gstvaapivideobuffer.c2
-rw-r--r--gst/vaapi/gstvaapivideometa_texture.c2
14 files changed, 73 insertions, 73 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.c b/gst-libs/gst/vaapi/gstvaapidisplay.c
index 5fa5ffd3..aab09369 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay.c
@@ -1281,10 +1281,29 @@ gst_vaapi_display_flush (GstVaapiDisplay * 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);
}
/**
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.h b/gst-libs/gst/vaapi/gstvaapidisplay.h
index 288b516f..a3d43969 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay.h
+++ b/gst-libs/gst/vaapi/gstvaapidisplay.h
@@ -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))
/**
@@ -158,6 +167,9 @@ 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);
const gchar *
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_drm.c b/gst-libs/gst/vaapi/gstvaapidisplay_drm.c
index b42fe402..d24bd678 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_drm.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_drm.c
@@ -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;
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_drm_priv.h b/gst-libs/gst/vaapi/gstvaapidisplay_drm_priv.h
index 1e65fbba..0fa295a6 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_drm_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_drm_priv.h
@@ -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))
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_glx.c b/gst-libs/gst/vaapi/gstvaapidisplay_glx.c
index 5342a6ed..9a3ab3ee 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_glx.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_glx.c
@@ -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;
}
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_glx_priv.h b/gst-libs/gst/vaapi/gstvaapidisplay_glx_priv.h
index 12ee2f24..63f7175c 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_glx_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_glx_priv.h
@@ -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
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_priv.h b/gst-libs/gst/vaapi/gstvaapidisplay_priv.h
index 895f6dac..a19b7d19 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_priv.h
@@ -72,6 +72,17 @@ typedef GstVaapiTexture *(*GstVaapiDisplayCreateTextureFunc) (
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,28 +105,17 @@ 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) \
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c b/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c
index d859840a..b0458a99 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c
@@ -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;
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h b/gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h
index 0a98ec74..0232d247 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_wayland_priv.h
@@ -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))
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_x11.c b/gst-libs/gst/vaapi/gstvaapidisplay_x11.c
index e9d193a7..d17535f0 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_x11.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_x11.c
@@ -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;
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay_x11_priv.h b/gst-libs/gst/vaapi/gstvaapidisplay_x11_priv.h
index ca333df7..3225328d 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay_x11_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapidisplay_x11_priv.h
@@ -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))
diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c
index 21f7e03d..d3b20585 100644
--- a/gst/vaapi/gstvaapipluginutil.c
+++ b/gst/vaapi/gstvaapipluginutil.c
@@ -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);
diff --git a/gst/vaapi/gstvaapivideobuffer.c b/gst/vaapi/gstvaapivideobuffer.c
index a36846db..1a5bff5f 100644
--- a/gst/vaapi/gstvaapivideobuffer.c
+++ b/gst/vaapi/gstvaapivideobuffer.c
@@ -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;
diff --git a/gst/vaapi/gstvaapivideometa_texture.c b/gst/vaapi/gstvaapivideometa_texture.c
index 6b08f94e..2e3a8494 100644
--- a/gst/vaapi/gstvaapivideometa_texture.c
+++ b/gst/vaapi/gstvaapivideometa_texture.c
@@ -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 ||