PROP_0,
PROP_DISPLAY,
+ PROP_DISPLAY_TYPE,
PROP_WIDTH,
PROP_HEIGHT
};
g_display_cache = NULL;
}
+/* GstVaapiDisplayType enumerations */
+GType
+gst_vaapi_display_type_get_type(void)
+{
+ static GType g_type = 0;
+
+ static const GEnumValue display_types[] = {
+ { GST_VAAPI_DISPLAY_TYPE_ANY,
+ "Auto detection", "any" },
+ { GST_VAAPI_DISPLAY_TYPE_X11,
+ "VA/X11 display", "x11" },
+#if USE_GLX
+ { GST_VAAPI_DISPLAY_TYPE_GLX,
+ "VA/GLX display", "glx" },
+#endif
+ { 0, NULL, NULL },
+ };
+
+ if (!g_type)
+ g_type = g_enum_register_static("GstVaapiDisplayType", display_types);
+ return g_type;
+}
+
/* Append GstVaapiImageFormat to formats array */
static inline void
append_format(GArray *formats, GstVaapiImageFormat format)
memset(&info, 0, sizeof(info));
info.display = display;
+ info.display_type = priv->display_type;
if (priv->display)
info.va_display = priv->display;
if (!klass->get_display || !klass->get_display(display, &info))
return FALSE;
priv->display = info.va_display;
+ priv->display_type = info.display_type;
if (klass->get_size)
klass->get_size(display, &priv->width, &priv->height);
if (klass->get_size_mm)
if (cached_info) {
g_clear_object(&priv->parent);
priv->parent = g_object_ref(cached_info->display);
+ priv->display_type = cached_info->display_type;
}
if (!priv->parent) {
case PROP_DISPLAY:
display->priv->display = g_value_get_pointer(value);
break;
+ case PROP_DISPLAY_TYPE:
+ display->priv->display_type = g_value_get_enum(value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
case PROP_DISPLAY:
g_value_set_pointer(value, gst_vaapi_display_get_display(display));
break;
+ case PROP_DISPLAY_TYPE:
+ g_value_set_enum(value, gst_vaapi_display_get_display_type(display));
+ break;
case PROP_WIDTH:
g_value_set_uint(value, gst_vaapi_display_get_width(display));
break;
g_object_class_install_property
(object_class,
+ PROP_DISPLAY_TYPE,
+ g_param_spec_enum("display-type",
+ "VA display type",
+ "VA display type",
+ GST_VAAPI_TYPE_DISPLAY_TYPE,
+ GST_VAAPI_DISPLAY_TYPE_ANY,
+ G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property
+ (object_class,
PROP_WIDTH,
g_param_spec_uint("width",
"Width",
display->priv = priv;
priv->parent = NULL;
+ priv->display_type = GST_VAAPI_DISPLAY_TYPE_ANY;
priv->display = NULL;
priv->width = 0;
priv->height = 0;
* gst_vaapi_display_get_display:
* @display: a #GstVaapiDisplay
*
+ * Returns the #GstVaapiDisplayType bound to @display.
+ *
+ * Return value: the #GstVaapiDisplayType
+ */
+GstVaapiDisplayType
+gst_vaapi_display_get_display_type(GstVaapiDisplay *display)
+{
+ g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display),
+ GST_VAAPI_DISPLAY_TYPE_ANY);
+
+ return display->priv->display_type;
+}
+
+/**
+ * gst_vaapi_display_get_display:
+ * @display: a #GstVaapiDisplay
+ *
* Returns the #VADisplay bound to @display.
*
* Return value: the #VADisplay
GST_VAAPI_TYPE_DISPLAY, \
GstVaapiDisplayClass))
+typedef enum _GstVaapiDisplayType GstVaapiDisplayType;
typedef struct _GstVaapiDisplayInfo GstVaapiDisplayInfo;
typedef struct _GstVaapiDisplay GstVaapiDisplay;
typedef struct _GstVaapiDisplayPrivate GstVaapiDisplayPrivate;
typedef struct _GstVaapiDisplayClass GstVaapiDisplayClass;
/**
+ * GstVaapiDisplayType:
+ * @GST_VAAPI_DISPLAY_TYPE_ANY: Automatic detection of the display type.
+ * @GST_VAAPI_DISPLAY_TYPE_X11: VA/X11 display.
+ * @GST_VAAPI_DISPLAY_TYPE_GLX: VA/GLX display.
+ */
+enum _GstVaapiDisplayType {
+ GST_VAAPI_DISPLAY_TYPE_ANY = 0,
+ GST_VAAPI_DISPLAY_TYPE_X11,
+ GST_VAAPI_DISPLAY_TYPE_GLX,
+};
+
+#define GST_VAAPI_TYPE_DISPLAY_TYPE \
+ (gst_vaapi_display_type_get_type())
+
+GType
+gst_vaapi_display_type_get_type(void) G_GNUC_CONST;
+
+/**
* GstVaapiDisplayInfo:
*
* Generic class to retrieve VA display info
*/
struct _GstVaapiDisplayInfo {
GstVaapiDisplay *display;
+ GstVaapiDisplayType display_type;
gchar *display_name;
VADisplay va_display;
gpointer native_display;
void
gst_vaapi_display_flush(GstVaapiDisplay *display);
+GstVaapiDisplayType
+gst_vaapi_display_get_display_type(GstVaapiDisplay *display);
+
VADisplay
gst_vaapi_display_get_display(GstVaapiDisplay *display);
info->va_display = vaGetDisplayGLX(GST_VAAPI_DISPLAY_XDISPLAY(display));
if (!info->va_display)
return FALSE;
+ info->display_type = GST_VAAPI_DISPLAY_TYPE_GLX;
return dpy_class->get_display(display, info);
}
struct _GstVaapiDisplayPrivate {
GstVaapiDisplay *parent;
GStaticRecMutex mutex;
+ GstVaapiDisplayType display_type;
VADisplay display;
guint width;
guint height;
info->va_display = vaGetDisplay(priv->x11_display);
if (!info->va_display)
return FALSE;
+ info->display_type = GST_VAAPI_DISPLAY_TYPE_X11;
}
return TRUE;
}
info->display = di->display;
info->va_display = di->va_display;
info->native_display = di->native_display;
+ info->display_type = di->display_type;
info->display_name = NULL;
if (di->display_name) {
)
{
GstVaapiDisplayType display_type =
- display_type_ptr ? *display_type_ptr : GST_VAAPI_DISPLAY_TYPE_AUTO;
+ display_type_ptr ? *display_type_ptr : GST_VAAPI_DISPLAY_TYPE_ANY;
GstVaapiDisplay *display;
GstVideoContext *context;
const DisplayMap *m;
/* If no neighboor, or application not interested, use system default */
for (m = g_display_map; m->type_str != NULL; m++) {
- if (display_type != GST_VAAPI_DISPLAY_TYPE_AUTO &&
+ if (display_type != GST_VAAPI_DISPLAY_TYPE_ANY &&
display_type != m->type)
continue;
display = NULL;
}
- if (display_type != GST_VAAPI_DISPLAY_TYPE_AUTO)
+ if (display_type != GST_VAAPI_DISPLAY_TYPE_ANY)
break;
}
}
return TRUE;
}
-
-GType
-gst_vaapi_display_type_get_type(void)
-{
- static GType g_type = 0;
-
- static const GEnumValue display_types[] = {
- { GST_VAAPI_DISPLAY_TYPE_AUTO,
- "Auto detection", "auto" },
- { GST_VAAPI_DISPLAY_TYPE_X11,
- "VA/X11 display", "x11" },
-#if USE_GLX
- { GST_VAAPI_DISPLAY_TYPE_GLX,
- "VA/GLX display", "glx" },
-#endif
- { 0, NULL, NULL },
- };
-
- if (!g_type)
- g_type = g_enum_register_static("GstVaapiDisplayType", display_types);
- return g_type;
-}
#include <gst/vaapi/gstvaapidisplay.h>
-/**
- * GstVaapiDisplayType:
- * @GST_VAAPI_DISPLAY_TYPE_AUTO: Automatic detection of the display type.
- * @GST_VAAPI_DISPLAY_TYPE_X11: VA/X11 display.
- * @GST_VAAPI_DISPLAY_TYPE_GLX: VA/GLX display.
- */
-typedef enum _GstVaapiDisplayType GstVaapiDisplayType;
-enum _GstVaapiDisplayType {
- GST_VAAPI_DISPLAY_TYPE_AUTO = 0,
- GST_VAAPI_DISPLAY_TYPE_X11,
- GST_VAAPI_DISPLAY_TYPE_GLX,
-};
-
-#define GST_VAAPI_TYPE_DISPLAY_TYPE \
- gst_vaapi_display_type_get_type()
-
-GType
-gst_vaapi_display_type_get_type(void) G_GNUC_CONST;
-
G_GNUC_INTERNAL
gboolean
gst_vaapi_ensure_display(
PROP_USE_REFLECTION
};
-#define DEFAULT_DISPLAY_TYPE GST_VAAPI_DISPLAY_TYPE_AUTO
+#define DEFAULT_DISPLAY_TYPE GST_VAAPI_DISPLAY_TYPE_ANY
/* GstImplementsInterface interface */
"display type",
"display type to use",
GST_VAAPI_TYPE_DISPLAY_TYPE,
- GST_VAAPI_DISPLAY_TYPE_AUTO,
+ GST_VAAPI_DISPLAY_TYPE_ANY,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
#if USE_GLX