mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
display: re-indent all GstVaapiDisplay related source code.
This commit is contained in:
parent
a6fe7698bc
commit
ff0642efad
17 changed files with 2295 additions and 2405 deletions
File diff suppressed because it is too large
Load diff
|
@ -47,22 +47,23 @@ typedef struct _GstVaapiDisplay GstVaapiDisplay;
|
||||||
* @GST_VAAPI_DISPLAY_TYPE_WAYLAND: VA/Wayland display.
|
* @GST_VAAPI_DISPLAY_TYPE_WAYLAND: VA/Wayland display.
|
||||||
* @GST_VAAPI_DISPLAY_TYPE_DRM: VA/DRM display.
|
* @GST_VAAPI_DISPLAY_TYPE_DRM: VA/DRM display.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum
|
||||||
GST_VAAPI_DISPLAY_TYPE_ANY = 0,
|
{
|
||||||
GST_VAAPI_DISPLAY_TYPE_X11,
|
GST_VAAPI_DISPLAY_TYPE_ANY = 0,
|
||||||
GST_VAAPI_DISPLAY_TYPE_GLX,
|
GST_VAAPI_DISPLAY_TYPE_X11,
|
||||||
GST_VAAPI_DISPLAY_TYPE_WAYLAND,
|
GST_VAAPI_DISPLAY_TYPE_GLX,
|
||||||
GST_VAAPI_DISPLAY_TYPE_DRM,
|
GST_VAAPI_DISPLAY_TYPE_WAYLAND,
|
||||||
|
GST_VAAPI_DISPLAY_TYPE_DRM,
|
||||||
} GstVaapiDisplayType;
|
} GstVaapiDisplayType;
|
||||||
|
|
||||||
#define GST_VAAPI_TYPE_DISPLAY_TYPE \
|
#define GST_VAAPI_TYPE_DISPLAY_TYPE \
|
||||||
(gst_vaapi_display_type_get_type())
|
(gst_vaapi_display_type_get_type())
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gst_vaapi_display_type_get_type(void) G_GNUC_CONST;
|
gst_vaapi_display_type_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_type_is_compatible(GstVaapiDisplayType type1,
|
gst_vaapi_display_type_is_compatible (GstVaapiDisplayType type1,
|
||||||
GstVaapiDisplayType type2);
|
GstVaapiDisplayType type2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,12 +71,13 @@ gst_vaapi_display_type_is_compatible(GstVaapiDisplayType type1,
|
||||||
*
|
*
|
||||||
* Generic class to retrieve VA display info
|
* Generic class to retrieve VA display info
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayInfo {
|
struct _GstVaapiDisplayInfo
|
||||||
GstVaapiDisplay *display;
|
{
|
||||||
GstVaapiDisplayType display_type;
|
GstVaapiDisplay *display;
|
||||||
gchar *display_name;
|
GstVaapiDisplayType display_type;
|
||||||
VADisplay va_display;
|
gchar *display_name;
|
||||||
gpointer native_display;
|
VADisplay va_display;
|
||||||
|
gpointer native_display;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,122 +97,103 @@ struct _GstVaapiDisplayInfo {
|
||||||
#define GST_VAAPI_DISPLAY_PROP_CONTRAST "contrast"
|
#define GST_VAAPI_DISPLAY_PROP_CONTRAST "contrast"
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_new_with_display(VADisplay va_display);
|
gst_vaapi_display_new_with_display (VADisplay va_display);
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_ref(GstVaapiDisplay *display);
|
gst_vaapi_display_ref (GstVaapiDisplay * display);
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_unref(GstVaapiDisplay *display);
|
gst_vaapi_display_unref (GstVaapiDisplay * display);
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_replace(GstVaapiDisplay **old_display_ptr,
|
gst_vaapi_display_replace (GstVaapiDisplay ** old_display_ptr,
|
||||||
GstVaapiDisplay *new_display);
|
GstVaapiDisplay * new_display);
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_lock(GstVaapiDisplay *display);
|
gst_vaapi_display_lock (GstVaapiDisplay * display);
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_unlock(GstVaapiDisplay *display);
|
gst_vaapi_display_unlock (GstVaapiDisplay * display);
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_sync(GstVaapiDisplay *display);
|
gst_vaapi_display_sync (GstVaapiDisplay * display);
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_flush(GstVaapiDisplay *display);
|
gst_vaapi_display_flush (GstVaapiDisplay * display);
|
||||||
|
|
||||||
GstVaapiDisplayType
|
GstVaapiDisplayType
|
||||||
gst_vaapi_display_get_display_type(GstVaapiDisplay *display);
|
gst_vaapi_display_get_display_type (GstVaapiDisplay * display);
|
||||||
|
|
||||||
VADisplay
|
VADisplay
|
||||||
gst_vaapi_display_get_display(GstVaapiDisplay *display);
|
gst_vaapi_display_get_display (GstVaapiDisplay * display);
|
||||||
|
|
||||||
guint
|
guint
|
||||||
gst_vaapi_display_get_width(GstVaapiDisplay *display);
|
gst_vaapi_display_get_width (GstVaapiDisplay * display);
|
||||||
|
|
||||||
guint
|
guint
|
||||||
gst_vaapi_display_get_height(GstVaapiDisplay *display);
|
gst_vaapi_display_get_height (GstVaapiDisplay * display);
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_get_size(GstVaapiDisplay *display, guint *pwidth, guint *pheight);
|
gst_vaapi_display_get_size (GstVaapiDisplay * display, guint * pwidth,
|
||||||
|
guint * pheight);
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_get_pixel_aspect_ratio(
|
gst_vaapi_display_get_pixel_aspect_ratio (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
guint * par_n, guint * par_d);
|
||||||
guint *par_n,
|
|
||||||
guint *par_d
|
|
||||||
);
|
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
gst_vaapi_display_get_decode_caps(GstVaapiDisplay *display);
|
gst_vaapi_display_get_decode_caps (GstVaapiDisplay * display);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_decoder(
|
gst_vaapi_display_has_decoder (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
|
||||||
GstVaapiProfile profile,
|
|
||||||
GstVaapiEntrypoint entrypoint
|
|
||||||
);
|
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
gst_vaapi_display_get_encode_caps(GstVaapiDisplay *display);
|
gst_vaapi_display_get_encode_caps (GstVaapiDisplay * display);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_encoder(
|
gst_vaapi_display_has_encoder (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
|
||||||
GstVaapiProfile profile,
|
|
||||||
GstVaapiEntrypoint entrypoint
|
|
||||||
);
|
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
gst_vaapi_display_get_image_caps(GstVaapiDisplay *display);
|
gst_vaapi_display_get_image_caps (GstVaapiDisplay * display);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_image_format(
|
gst_vaapi_display_has_image_format (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
GstVideoFormat format);
|
||||||
GstVideoFormat format
|
|
||||||
);
|
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
gst_vaapi_display_get_subpicture_caps(GstVaapiDisplay *display);
|
gst_vaapi_display_get_subpicture_caps (GstVaapiDisplay * display);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_subpicture_format(
|
gst_vaapi_display_has_subpicture_format (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
GstVideoFormat format, guint * flags_ptr);
|
||||||
GstVideoFormat format,
|
|
||||||
guint *flags_ptr
|
|
||||||
);
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_has_property(GstVaapiDisplay *display, const gchar *name);
|
gst_vaapi_display_has_property (GstVaapiDisplay * display, const gchar * name);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_get_property(GstVaapiDisplay *display, const gchar *name,
|
gst_vaapi_display_get_property (GstVaapiDisplay * display, const gchar * name,
|
||||||
GValue *out_value);
|
GValue * out_value);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_set_property(GstVaapiDisplay *display, const gchar *name,
|
gst_vaapi_display_set_property (GstVaapiDisplay * display, const gchar * name,
|
||||||
const GValue *value);
|
const GValue * value);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_get_render_mode(
|
gst_vaapi_display_get_render_mode (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
GstVaapiRenderMode * pmode);
|
||||||
GstVaapiRenderMode *pmode
|
|
||||||
);
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_set_render_mode(
|
gst_vaapi_display_set_render_mode (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
GstVaapiRenderMode mode);
|
||||||
GstVaapiRenderMode mode
|
|
||||||
);
|
|
||||||
|
|
||||||
GstVaapiRotation
|
GstVaapiRotation
|
||||||
gst_vaapi_display_get_rotation(GstVaapiDisplay *display);
|
gst_vaapi_display_get_rotation (GstVaapiDisplay * display);
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_set_rotation(
|
gst_vaapi_display_set_rotation (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
GstVaapiRotation rotation);
|
||||||
GstVaapiRotation rotation
|
|
||||||
);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -44,298 +44,298 @@ static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_DRM;
|
||||||
|
|
||||||
/* Get default device path. Actually, the first match in the DRM subsystem */
|
/* Get default device path. Actually, the first match in the DRM subsystem */
|
||||||
static const gchar *
|
static const gchar *
|
||||||
get_default_device_path(GstVaapiDisplay *display)
|
get_default_device_path (GstVaapiDisplay * display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayDRMPrivate * const priv =
|
GstVaapiDisplayDRMPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||||
const gchar *syspath, *devpath;
|
const gchar *syspath, *devpath;
|
||||||
struct udev *udev = NULL;
|
struct udev *udev = NULL;
|
||||||
struct udev_device *device, *parent;
|
struct udev_device *device, *parent;
|
||||||
struct udev_enumerate *e = NULL;
|
struct udev_enumerate *e = NULL;
|
||||||
struct udev_list_entry *l;
|
struct udev_list_entry *l;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (!priv->device_path_default) {
|
if (!priv->device_path_default) {
|
||||||
udev = udev_new();
|
udev = udev_new ();
|
||||||
if (!udev)
|
if (!udev)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
e = udev_enumerate_new(udev);
|
e = udev_enumerate_new (udev);
|
||||||
if (!e)
|
if (!e)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
udev_enumerate_add_match_subsystem(e, "drm");
|
udev_enumerate_add_match_subsystem (e, "drm");
|
||||||
udev_enumerate_scan_devices(e);
|
udev_enumerate_scan_devices (e);
|
||||||
udev_list_entry_foreach(l, udev_enumerate_get_list_entry(e)) {
|
udev_list_entry_foreach (l, udev_enumerate_get_list_entry (e)) {
|
||||||
syspath = udev_list_entry_get_name(l);
|
syspath = udev_list_entry_get_name (l);
|
||||||
device = udev_device_new_from_syspath(udev, syspath);
|
device = udev_device_new_from_syspath (udev, syspath);
|
||||||
parent = udev_device_get_parent(device);
|
parent = udev_device_get_parent (device);
|
||||||
if (strcmp(udev_device_get_subsystem(parent), "pci") != 0) {
|
if (strcmp (udev_device_get_subsystem (parent), "pci") != 0) {
|
||||||
udev_device_unref(device);
|
udev_device_unref (device);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
devpath = udev_device_get_devnode(device);
|
devpath = udev_device_get_devnode (device);
|
||||||
fd = open(devpath, O_RDWR|O_CLOEXEC);
|
fd = open (devpath, O_RDWR | O_CLOEXEC);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
udev_device_unref(device);
|
udev_device_unref (device);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->device_path_default = g_strdup(devpath);
|
priv->device_path_default = g_strdup (devpath);
|
||||||
close(fd);
|
close (fd);
|
||||||
udev_device_unref(device);
|
udev_device_unref (device);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
end:
|
|
||||||
if (e)
|
|
||||||
udev_enumerate_unref(e);
|
|
||||||
if (udev)
|
|
||||||
udev_unref(udev);
|
|
||||||
}
|
}
|
||||||
return priv->device_path_default;
|
|
||||||
|
end:
|
||||||
|
if (e)
|
||||||
|
udev_enumerate_unref (e);
|
||||||
|
if (udev)
|
||||||
|
udev_unref (udev);
|
||||||
|
}
|
||||||
|
return priv->device_path_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reconstruct a device path without our prefix */
|
/* Reconstruct a device path without our prefix */
|
||||||
static const gchar *
|
static const gchar *
|
||||||
get_device_path(GstVaapiDisplay *display)
|
get_device_path (GstVaapiDisplay * display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayDRMPrivate * const priv =
|
GstVaapiDisplayDRMPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||||
const gchar *device_path = priv->device_path;
|
const gchar *device_path = priv->device_path;
|
||||||
|
|
||||||
if (!device_path || *device_path == '\0')
|
if (!device_path || *device_path == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
return device_path;
|
return device_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mangle device path with our prefix */
|
/* Mangle device path with our prefix */
|
||||||
static gboolean
|
static gboolean
|
||||||
set_device_path(GstVaapiDisplay *display, const gchar *device_path)
|
set_device_path (GstVaapiDisplay * display, const gchar * device_path)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayDRMPrivate * const priv =
|
GstVaapiDisplayDRMPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||||
|
|
||||||
g_free(priv->device_path);
|
g_free (priv->device_path);
|
||||||
priv->device_path = NULL;
|
priv->device_path = NULL;
|
||||||
|
|
||||||
if (!device_path) {
|
if (!device_path) {
|
||||||
device_path = get_default_device_path(display);
|
device_path = get_default_device_path (display);
|
||||||
if (!device_path)
|
if (!device_path)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
priv->device_path = g_strdup(device_path);
|
priv->device_path = g_strdup (device_path);
|
||||||
return priv->device_path != NULL;
|
return priv->device_path != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set device path from file descriptor */
|
/* Set device path from file descriptor */
|
||||||
static gboolean
|
static gboolean
|
||||||
set_device_path_from_fd(GstVaapiDisplay *display, gint drm_device)
|
set_device_path_from_fd (GstVaapiDisplay * display, gint drm_device)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayDRMPrivate * const priv =
|
GstVaapiDisplayDRMPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||||
const gchar *busid, *path, *str;
|
const gchar *busid, *path, *str;
|
||||||
gsize busid_length, path_length;
|
gsize busid_length, path_length;
|
||||||
struct udev *udev = NULL;
|
struct udev *udev = NULL;
|
||||||
struct udev_device *device;
|
struct udev_device *device;
|
||||||
struct udev_enumerate *e = NULL;
|
struct udev_enumerate *e = NULL;
|
||||||
struct udev_list_entry *l;
|
struct udev_list_entry *l;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
|
|
||||||
g_free(priv->device_path);
|
g_free (priv->device_path);
|
||||||
priv->device_path = NULL;
|
priv->device_path = NULL;
|
||||||
|
|
||||||
if (drm_device < 0)
|
if (drm_device < 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
busid = drmGetBusid(drm_device);
|
busid = drmGetBusid (drm_device);
|
||||||
if (!busid)
|
if (!busid)
|
||||||
goto end;
|
goto end;
|
||||||
if (strncmp(busid, "pci:", 4) != 0)
|
if (strncmp (busid, "pci:", 4) != 0)
|
||||||
goto end;
|
goto end;
|
||||||
busid += 4;
|
busid += 4;
|
||||||
busid_length = strlen(busid);
|
busid_length = strlen (busid);
|
||||||
|
|
||||||
udev = udev_new();
|
udev = udev_new ();
|
||||||
if (!udev)
|
if (!udev)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
e = udev_enumerate_new(udev);
|
e = udev_enumerate_new (udev);
|
||||||
if (!e)
|
if (!e)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
udev_enumerate_add_match_subsystem(e, "drm");
|
udev_enumerate_add_match_subsystem (e, "drm");
|
||||||
udev_enumerate_scan_devices(e);
|
udev_enumerate_scan_devices (e);
|
||||||
udev_list_entry_foreach(l, udev_enumerate_get_list_entry(e)) {
|
udev_list_entry_foreach (l, udev_enumerate_get_list_entry (e)) {
|
||||||
path = udev_list_entry_get_name(l);
|
path = udev_list_entry_get_name (l);
|
||||||
str = strstr(path, busid);
|
str = strstr (path, busid);
|
||||||
if (!str || str <= path || str[-1] != '/')
|
if (!str || str <= path || str[-1] != '/')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
path_length = strlen(path);
|
path_length = strlen (path);
|
||||||
if (str + busid_length >= path + path_length)
|
if (str + busid_length >= path + path_length)
|
||||||
continue;
|
continue;
|
||||||
if (strncmp(&str[busid_length], "/drm/card", 9) != 0)
|
if (strncmp (&str[busid_length], "/drm/card", 9) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
device = udev_device_new_from_syspath(udev, path);
|
device = udev_device_new_from_syspath (udev, path);
|
||||||
if (!device)
|
if (!device)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
path = udev_device_get_devnode(device);
|
path = udev_device_get_devnode (device);
|
||||||
priv->device_path = g_strdup(path);
|
priv->device_path = g_strdup (path);
|
||||||
udev_device_unref(device);
|
udev_device_unref (device);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (e)
|
if (e)
|
||||||
udev_enumerate_unref(e);
|
udev_enumerate_unref (e);
|
||||||
if (udev)
|
if (udev)
|
||||||
udev_unref(udev);
|
udev_unref (udev);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapi_display_drm_bind_display(GstVaapiDisplay *display,
|
gst_vaapi_display_drm_bind_display (GstVaapiDisplay * display,
|
||||||
gpointer native_display)
|
gpointer native_display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayDRMPrivate * const priv =
|
GstVaapiDisplayDRMPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||||
|
|
||||||
priv->drm_device = GPOINTER_TO_INT(native_display);
|
priv->drm_device = GPOINTER_TO_INT (native_display);
|
||||||
|
priv->use_foreign_display = TRUE;
|
||||||
|
|
||||||
|
if (!set_device_path_from_fd (display, priv->drm_device))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_vaapi_display_drm_open_display (GstVaapiDisplay * display,
|
||||||
|
const gchar * name)
|
||||||
|
{
|
||||||
|
GstVaapiDisplayDRMPrivate *const priv =
|
||||||
|
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||||
|
GstVaapiDisplayCache *cache;
|
||||||
|
const GstVaapiDisplayInfo *info;
|
||||||
|
|
||||||
|
cache = gst_vaapi_display_get_cache ();
|
||||||
|
g_return_val_if_fail (cache != NULL, FALSE);
|
||||||
|
|
||||||
|
if (!set_device_path (display, name))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
info = gst_vaapi_display_cache_lookup_by_name (cache, priv->device_path,
|
||||||
|
GST_VAAPI_DISPLAY_TYPES (display));
|
||||||
|
if (info) {
|
||||||
|
priv->drm_device = GPOINTER_TO_INT (info->native_display);
|
||||||
priv->use_foreign_display = TRUE;
|
priv->use_foreign_display = TRUE;
|
||||||
|
} else {
|
||||||
if (!set_device_path_from_fd(display, priv->drm_device))
|
priv->drm_device = open (get_device_path (display), O_RDWR | O_CLOEXEC);
|
||||||
return FALSE;
|
if (priv->drm_device < 0)
|
||||||
return TRUE;
|
return FALSE;
|
||||||
}
|
priv->use_foreign_display = FALSE;
|
||||||
|
}
|
||||||
static gboolean
|
return TRUE;
|
||||||
gst_vaapi_display_drm_open_display(GstVaapiDisplay *display, const gchar *name)
|
|
||||||
{
|
|
||||||
GstVaapiDisplayDRMPrivate * const priv =
|
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
|
||||||
GstVaapiDisplayCache *cache;
|
|
||||||
const GstVaapiDisplayInfo *info;
|
|
||||||
|
|
||||||
cache = gst_vaapi_display_get_cache();
|
|
||||||
g_return_val_if_fail(cache != NULL, FALSE);
|
|
||||||
|
|
||||||
if (!set_device_path(display, name))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
info = gst_vaapi_display_cache_lookup_by_name(cache, priv->device_path,
|
|
||||||
GST_VAAPI_DISPLAY_TYPES(display));
|
|
||||||
if (info) {
|
|
||||||
priv->drm_device = GPOINTER_TO_INT(info->native_display);
|
|
||||||
priv->use_foreign_display = TRUE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
priv->drm_device = open(get_device_path(display), O_RDWR|O_CLOEXEC);
|
|
||||||
if (priv->drm_device < 0)
|
|
||||||
return FALSE;
|
|
||||||
priv->use_foreign_display = FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_drm_close_display(GstVaapiDisplay *display)
|
gst_vaapi_display_drm_close_display (GstVaapiDisplay * display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayDRMPrivate * const priv =
|
GstVaapiDisplayDRMPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||||
|
|
||||||
if (priv->drm_device >= 0) {
|
|
||||||
if (!priv->use_foreign_display)
|
|
||||||
close(priv->drm_device);
|
|
||||||
priv->drm_device = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->device_path) {
|
|
||||||
g_free(priv->device_path);
|
|
||||||
priv->device_path = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->device_path_default) {
|
|
||||||
g_free(priv->device_path_default);
|
|
||||||
priv->device_path_default = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_vaapi_display_drm_get_display_info(GstVaapiDisplay *display,
|
|
||||||
GstVaapiDisplayInfo *info)
|
|
||||||
{
|
|
||||||
GstVaapiDisplayDRMPrivate * const priv =
|
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
|
||||||
GstVaapiDisplayCache *cache;
|
|
||||||
const GstVaapiDisplayInfo *cached_info;
|
|
||||||
|
|
||||||
/* Return any cached info even if child has its own VA display */
|
|
||||||
cache = gst_vaapi_display_get_cache();
|
|
||||||
if (!cache)
|
|
||||||
return FALSE;
|
|
||||||
cached_info = gst_vaapi_display_cache_lookup_by_native_display(
|
|
||||||
cache, GINT_TO_POINTER(priv->drm_device),
|
|
||||||
GST_VAAPI_DISPLAY_TYPES(display));
|
|
||||||
if (cached_info) {
|
|
||||||
*info = *cached_info;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Otherwise, create VA display if there is none already */
|
|
||||||
info->native_display = GINT_TO_POINTER(priv->drm_device);
|
|
||||||
info->display_name = priv->device_path;
|
|
||||||
if (!info->va_display) {
|
|
||||||
info->va_display = vaGetDisplayDRM(priv->drm_device);
|
|
||||||
if (!info->va_display)
|
|
||||||
return FALSE;
|
|
||||||
info->display_type = GST_VAAPI_DISPLAY_TYPE_DRM;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_vaapi_display_drm_init(GstVaapiDisplay *display)
|
|
||||||
{
|
|
||||||
GstVaapiDisplayDRMPrivate * const priv =
|
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
|
||||||
|
|
||||||
|
if (priv->drm_device >= 0) {
|
||||||
|
if (!priv->use_foreign_display)
|
||||||
|
close (priv->drm_device);
|
||||||
priv->drm_device = -1;
|
priv->drm_device = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->device_path) {
|
||||||
|
g_free (priv->device_path);
|
||||||
|
priv->device_path = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->device_path_default) {
|
||||||
|
g_free (priv->device_path_default);
|
||||||
|
priv->device_path_default = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_vaapi_display_drm_get_display_info (GstVaapiDisplay * display,
|
||||||
|
GstVaapiDisplayInfo * info)
|
||||||
|
{
|
||||||
|
GstVaapiDisplayDRMPrivate *const priv =
|
||||||
|
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||||
|
GstVaapiDisplayCache *cache;
|
||||||
|
const GstVaapiDisplayInfo *cached_info;
|
||||||
|
|
||||||
|
/* Return any cached info even if child has its own VA display */
|
||||||
|
cache = gst_vaapi_display_get_cache ();
|
||||||
|
if (!cache)
|
||||||
|
return FALSE;
|
||||||
|
cached_info =
|
||||||
|
gst_vaapi_display_cache_lookup_by_native_display (cache,
|
||||||
|
GINT_TO_POINTER (priv->drm_device), GST_VAAPI_DISPLAY_TYPES (display));
|
||||||
|
if (cached_info) {
|
||||||
|
*info = *cached_info;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise, create VA display if there is none already */
|
||||||
|
info->native_display = GINT_TO_POINTER (priv->drm_device);
|
||||||
|
info->display_name = priv->device_path;
|
||||||
|
if (!info->va_display) {
|
||||||
|
info->va_display = vaGetDisplayDRM (priv->drm_device);
|
||||||
|
if (!info->va_display)
|
||||||
|
return FALSE;
|
||||||
|
info->display_type = GST_VAAPI_DISPLAY_TYPE_DRM;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_drm_class_init(GstVaapiDisplayDRMClass *klass)
|
gst_vaapi_display_drm_init (GstVaapiDisplay * display)
|
||||||
{
|
{
|
||||||
GstVaapiMiniObjectClass * const object_class =
|
GstVaapiDisplayDRMPrivate *const priv =
|
||||||
GST_VAAPI_MINI_OBJECT_CLASS(klass);
|
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||||
GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
|
|
||||||
|
|
||||||
gst_vaapi_display_class_init(&klass->parent_class);
|
priv->drm_device = -1;
|
||||||
|
}
|
||||||
|
|
||||||
object_class->size = sizeof(GstVaapiDisplayDRM);
|
static void
|
||||||
dpy_class->display_types = g_display_types;
|
gst_vaapi_display_drm_class_init (GstVaapiDisplayDRMClass * klass)
|
||||||
dpy_class->init = gst_vaapi_display_drm_init;
|
{
|
||||||
dpy_class->bind_display = gst_vaapi_display_drm_bind_display;
|
GstVaapiMiniObjectClass *const object_class =
|
||||||
dpy_class->open_display = gst_vaapi_display_drm_open_display;
|
GST_VAAPI_MINI_OBJECT_CLASS (klass);
|
||||||
dpy_class->close_display = gst_vaapi_display_drm_close_display;
|
GstVaapiDisplayClass *const dpy_class = GST_VAAPI_DISPLAY_CLASS (klass);
|
||||||
dpy_class->get_display = gst_vaapi_display_drm_get_display_info;
|
|
||||||
|
gst_vaapi_display_class_init (&klass->parent_class);
|
||||||
|
|
||||||
|
object_class->size = sizeof (GstVaapiDisplayDRM);
|
||||||
|
dpy_class->display_types = g_display_types;
|
||||||
|
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;
|
||||||
|
dpy_class->close_display = gst_vaapi_display_drm_close_display;
|
||||||
|
dpy_class->get_display = gst_vaapi_display_drm_get_display_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const GstVaapiDisplayClass *
|
static inline const GstVaapiDisplayClass *
|
||||||
gst_vaapi_display_drm_class(void)
|
gst_vaapi_display_drm_class (void)
|
||||||
{
|
{
|
||||||
static GstVaapiDisplayDRMClass g_class;
|
static GstVaapiDisplayDRMClass g_class;
|
||||||
static gsize g_class_init = FALSE;
|
static gsize g_class_init = FALSE;
|
||||||
|
|
||||||
if (g_once_init_enter(&g_class_init)) {
|
if (g_once_init_enter (&g_class_init)) {
|
||||||
gst_vaapi_display_drm_class_init(&g_class);
|
gst_vaapi_display_drm_class_init (&g_class);
|
||||||
g_once_init_leave(&g_class_init, TRUE);
|
g_once_init_leave (&g_class_init, TRUE);
|
||||||
}
|
}
|
||||||
return GST_VAAPI_DISPLAY_CLASS(&g_class);
|
return GST_VAAPI_DISPLAY_CLASS (&g_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -353,10 +353,10 @@ gst_vaapi_display_drm_class(void)
|
||||||
* Return value: a newly allocated #GstVaapiDisplay object
|
* Return value: a newly allocated #GstVaapiDisplay object
|
||||||
*/
|
*/
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_drm_new(const gchar *device_path)
|
gst_vaapi_display_drm_new (const gchar * device_path)
|
||||||
{
|
{
|
||||||
return gst_vaapi_display_new(gst_vaapi_display_drm_class(),
|
return gst_vaapi_display_new (gst_vaapi_display_drm_class (),
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer)device_path);
|
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) device_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,12 +371,12 @@ gst_vaapi_display_drm_new(const gchar *device_path)
|
||||||
* Return value: a newly allocated #GstVaapiDisplay object
|
* Return value: a newly allocated #GstVaapiDisplay object
|
||||||
*/
|
*/
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_drm_new_with_device(gint device)
|
gst_vaapi_display_drm_new_with_device (gint device)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(device >= 0, NULL);
|
g_return_val_if_fail (device >= 0, NULL);
|
||||||
|
|
||||||
return gst_vaapi_display_new(gst_vaapi_display_drm_class(),
|
return gst_vaapi_display_new (gst_vaapi_display_drm_class (),
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, GINT_TO_POINTER(device));
|
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, GINT_TO_POINTER (device));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -390,11 +390,11 @@ gst_vaapi_display_drm_new_with_device(gint device)
|
||||||
* Return value: the DRM file descriptor attached to @display
|
* Return value: the DRM file descriptor attached to @display
|
||||||
*/
|
*/
|
||||||
gint
|
gint
|
||||||
gst_vaapi_display_drm_get_device(GstVaapiDisplayDRM *display)
|
gst_vaapi_display_drm_get_device (GstVaapiDisplayDRM * display)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY_DRM(display), -1);
|
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_DRM (display), -1);
|
||||||
|
|
||||||
return GST_VAAPI_DISPLAY_DRM_DEVICE(display);
|
return GST_VAAPI_DISPLAY_DRM_DEVICE (display);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -411,9 +411,9 @@ gst_vaapi_display_drm_get_device(GstVaapiDisplayDRM *display)
|
||||||
* Return value: the DRM device path name attached to @display
|
* Return value: the DRM device path name attached to @display
|
||||||
*/
|
*/
|
||||||
const gchar *
|
const gchar *
|
||||||
gst_vaapi_display_drm_get_device_path(GstVaapiDisplayDRM *display)
|
gst_vaapi_display_drm_get_device_path (GstVaapiDisplayDRM * display)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY_DRM(display), NULL);
|
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_DRM (display), NULL);
|
||||||
|
|
||||||
return get_device_path(GST_VAAPI_DISPLAY_CAST(display));
|
return get_device_path (GST_VAAPI_DISPLAY_CAST (display));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,16 +33,17 @@ G_BEGIN_DECLS
|
||||||
typedef struct _GstVaapiDisplayDRM GstVaapiDisplayDRM;
|
typedef struct _GstVaapiDisplayDRM GstVaapiDisplayDRM;
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_drm_new(const gchar *device_path);
|
gst_vaapi_display_drm_new (const gchar * device_path);
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_drm_new_with_device(gint device);
|
gst_vaapi_display_drm_new_with_device (gint device);
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gst_vaapi_display_drm_get_device(GstVaapiDisplayDRM *display);
|
gst_vaapi_display_drm_get_device (GstVaapiDisplayDRM * display);
|
||||||
|
|
||||||
const gchar *
|
const gchar *
|
||||||
gst_vaapi_display_drm_get_device_path(GstVaapiDisplayDRM *display);
|
gst_vaapi_display_drm_get_device_path (GstVaapiDisplayDRM *
|
||||||
|
display);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -51,11 +51,12 @@ typedef struct _GstVaapiDisplayDRMClass GstVaapiDisplayDRMClass;
|
||||||
#define GST_VAAPI_DISPLAY_DRM_DEVICE(display) \
|
#define GST_VAAPI_DISPLAY_DRM_DEVICE(display) \
|
||||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display)->drm_device
|
GST_VAAPI_DISPLAY_DRM_PRIVATE(display)->drm_device
|
||||||
|
|
||||||
struct _GstVaapiDisplayDRMPrivate {
|
struct _GstVaapiDisplayDRMPrivate
|
||||||
gchar *device_path_default;
|
{
|
||||||
gchar *device_path;
|
gchar *device_path_default;
|
||||||
gint drm_device;
|
gchar *device_path;
|
||||||
guint use_foreign_display : 1; // Foreign native_display?
|
gint drm_device;
|
||||||
|
guint use_foreign_display:1; // Foreign native_display?
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,11 +64,12 @@ struct _GstVaapiDisplayDRMPrivate {
|
||||||
*
|
*
|
||||||
* VA/DRM display wrapper.
|
* VA/DRM display wrapper.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayDRM {
|
struct _GstVaapiDisplayDRM
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiDisplay parent_instance;
|
/*< private >*/
|
||||||
|
GstVaapiDisplay parent_instance;
|
||||||
|
|
||||||
GstVaapiDisplayDRMPrivate priv;
|
GstVaapiDisplayDRMPrivate priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,9 +77,10 @@ struct _GstVaapiDisplayDRM {
|
||||||
*
|
*
|
||||||
* VA/DRM display wrapper clas.
|
* VA/DRM display wrapper clas.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayDRMClass {
|
struct _GstVaapiDisplayDRMClass
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiDisplayClass parent_class;
|
/*< private >*/
|
||||||
|
GstVaapiDisplayClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -42,47 +42,45 @@
|
||||||
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_GLX;
|
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_GLX;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapi_display_glx_get_display_info(
|
gst_vaapi_display_glx_get_display_info (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplayInfo * info)
|
||||||
GstVaapiDisplayInfo *info
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const GstVaapiDisplayGLXClass * const klass =
|
const GstVaapiDisplayGLXClass *const klass =
|
||||||
GST_VAAPI_DISPLAY_GLX_GET_CLASS(display);
|
GST_VAAPI_DISPLAY_GLX_GET_CLASS (display);
|
||||||
|
|
||||||
info->va_display = vaGetDisplayGLX(GST_VAAPI_DISPLAY_XDISPLAY(display));
|
info->va_display = vaGetDisplayGLX (GST_VAAPI_DISPLAY_XDISPLAY (display));
|
||||||
if (!info->va_display)
|
if (!info->va_display)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
info->display_type = GST_VAAPI_DISPLAY_TYPE_GLX;
|
info->display_type = GST_VAAPI_DISPLAY_TYPE_GLX;
|
||||||
return klass->parent_get_display(display, info);
|
return klass->parent_get_display (display, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_glx_class_init(GstVaapiDisplayGLXClass *klass)
|
gst_vaapi_display_glx_class_init (GstVaapiDisplayGLXClass * klass)
|
||||||
{
|
{
|
||||||
GstVaapiMiniObjectClass * const object_class =
|
GstVaapiMiniObjectClass *const object_class =
|
||||||
GST_VAAPI_MINI_OBJECT_CLASS(klass);
|
GST_VAAPI_MINI_OBJECT_CLASS (klass);
|
||||||
GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
|
GstVaapiDisplayClass *const dpy_class = GST_VAAPI_DISPLAY_CLASS (klass);
|
||||||
|
|
||||||
gst_vaapi_display_x11_class_init(&klass->parent_class);
|
gst_vaapi_display_x11_class_init (&klass->parent_class);
|
||||||
|
|
||||||
object_class->size = sizeof(GstVaapiDisplayGLX);
|
object_class->size = sizeof (GstVaapiDisplayGLX);
|
||||||
klass->parent_get_display = dpy_class->get_display;
|
klass->parent_get_display = dpy_class->get_display;
|
||||||
dpy_class->display_types = g_display_types;
|
dpy_class->display_types = g_display_types;
|
||||||
dpy_class->get_display = gst_vaapi_display_glx_get_display_info;
|
dpy_class->get_display = gst_vaapi_display_glx_get_display_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const GstVaapiDisplayClass *
|
static inline const GstVaapiDisplayClass *
|
||||||
gst_vaapi_display_glx_class(void)
|
gst_vaapi_display_glx_class (void)
|
||||||
{
|
{
|
||||||
static GstVaapiDisplayGLXClass g_class;
|
static GstVaapiDisplayGLXClass g_class;
|
||||||
static gsize g_class_init = FALSE;
|
static gsize g_class_init = FALSE;
|
||||||
|
|
||||||
if (g_once_init_enter(&g_class_init)) {
|
if (g_once_init_enter (&g_class_init)) {
|
||||||
gst_vaapi_display_glx_class_init(&g_class);
|
gst_vaapi_display_glx_class_init (&g_class);
|
||||||
g_once_init_leave(&g_class_init, TRUE);
|
g_once_init_leave (&g_class_init, TRUE);
|
||||||
}
|
}
|
||||||
return GST_VAAPI_DISPLAY_CLASS(&g_class);
|
return GST_VAAPI_DISPLAY_CLASS (&g_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,10 +94,10 @@ gst_vaapi_display_glx_class(void)
|
||||||
* Return value: a newly allocated #GstVaapiDisplay object
|
* Return value: a newly allocated #GstVaapiDisplay object
|
||||||
*/
|
*/
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_glx_new(const gchar *display_name)
|
gst_vaapi_display_glx_new (const gchar * display_name)
|
||||||
{
|
{
|
||||||
return gst_vaapi_display_new(gst_vaapi_display_glx_class(),
|
return gst_vaapi_display_new (gst_vaapi_display_glx_class (),
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer)display_name);
|
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,10 +112,10 @@ gst_vaapi_display_glx_new(const gchar *display_name)
|
||||||
* Return value: a newly allocated #GstVaapiDisplay object
|
* Return value: a newly allocated #GstVaapiDisplay object
|
||||||
*/
|
*/
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_glx_new_with_display(Display *x11_display)
|
gst_vaapi_display_glx_new_with_display (Display * x11_display)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(x11_display != NULL, NULL);
|
g_return_val_if_fail (x11_display != NULL, NULL);
|
||||||
|
|
||||||
return gst_vaapi_display_new(gst_vaapi_display_glx_class(),
|
return gst_vaapi_display_new (gst_vaapi_display_glx_class (),
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, x11_display);
|
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, x11_display);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,10 @@ G_BEGIN_DECLS
|
||||||
typedef struct _GstVaapiDisplayGLX GstVaapiDisplayGLX;
|
typedef struct _GstVaapiDisplayGLX GstVaapiDisplayGLX;
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_glx_new(const gchar *display_name);
|
gst_vaapi_display_glx_new (const gchar * display_name);
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_glx_new_with_display(Display *x11_display);
|
gst_vaapi_display_glx_new_with_display (Display * x11_display);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,10 @@ typedef struct _GstVaapiDisplayGLXClass GstVaapiDisplayGLXClass;
|
||||||
*
|
*
|
||||||
* VA/GLX display wrapper.
|
* VA/GLX display wrapper.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayGLX {
|
struct _GstVaapiDisplayGLX
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiDisplayX11 parent_instance;
|
/*< private >*/
|
||||||
|
GstVaapiDisplayX11 parent_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,11 +60,12 @@ struct _GstVaapiDisplayGLX {
|
||||||
*
|
*
|
||||||
* VA/GLX display wrapper clas.
|
* VA/GLX display wrapper clas.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayGLXClass {
|
struct _GstVaapiDisplayGLXClass
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiDisplayX11Class parent_class;
|
/*< private >*/
|
||||||
|
GstVaapiDisplayX11Class parent_class;
|
||||||
|
|
||||||
GstVaapiDisplayGetInfoFunc parent_get_display;
|
GstVaapiDisplayGetInfoFunc parent_get_display;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -50,22 +50,22 @@ typedef struct _GstVaapiDisplayPrivate GstVaapiDisplayPrivate;
|
||||||
typedef struct _GstVaapiDisplayClass GstVaapiDisplayClass;
|
typedef struct _GstVaapiDisplayClass GstVaapiDisplayClass;
|
||||||
typedef enum _GstVaapiDisplayInitType GstVaapiDisplayInitType;
|
typedef enum _GstVaapiDisplayInitType GstVaapiDisplayInitType;
|
||||||
|
|
||||||
typedef void (*GstVaapiDisplayInitFunc) (GstVaapiDisplay *display);
|
typedef void (*GstVaapiDisplayInitFunc) (GstVaapiDisplay * display);
|
||||||
typedef gboolean (*GstVaapiDisplayBindFunc) (GstVaapiDisplay *display,
|
typedef gboolean (*GstVaapiDisplayBindFunc) (GstVaapiDisplay * display,
|
||||||
gpointer native_dpy);
|
gpointer native_dpy);
|
||||||
typedef gboolean (*GstVaapiDisplayOpenFunc) (GstVaapiDisplay *display,
|
typedef gboolean (*GstVaapiDisplayOpenFunc) (GstVaapiDisplay * display,
|
||||||
const gchar *name);
|
const gchar * name);
|
||||||
typedef void (*GstVaapiDisplayCloseFunc) (GstVaapiDisplay *display);
|
typedef void (*GstVaapiDisplayCloseFunc) (GstVaapiDisplay * display);
|
||||||
typedef void (*GstVaapiDisplayLockFunc) (GstVaapiDisplay *display);
|
typedef void (*GstVaapiDisplayLockFunc) (GstVaapiDisplay * display);
|
||||||
typedef void (*GstVaapiDisplayUnlockFunc) (GstVaapiDisplay *display);
|
typedef void (*GstVaapiDisplayUnlockFunc) (GstVaapiDisplay * display);
|
||||||
typedef void (*GstVaapiDisplaySyncFunc) (GstVaapiDisplay *display);
|
typedef void (*GstVaapiDisplaySyncFunc) (GstVaapiDisplay * display);
|
||||||
typedef void (*GstVaapiDisplayFlushFunc) (GstVaapiDisplay *display);
|
typedef void (*GstVaapiDisplayFlushFunc) (GstVaapiDisplay * display);
|
||||||
typedef gboolean (*GstVaapiDisplayGetInfoFunc) (GstVaapiDisplay *display,
|
typedef gboolean (*GstVaapiDisplayGetInfoFunc) (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplayInfo *info);
|
GstVaapiDisplayInfo * info);
|
||||||
typedef void (*GstVaapiDisplayGetSizeFunc) (GstVaapiDisplay *display,
|
typedef void (*GstVaapiDisplayGetSizeFunc) (GstVaapiDisplay * display,
|
||||||
guint *pwidth, guint *pheight);
|
guint * pwidth, guint * pheight);
|
||||||
typedef void (*GstVaapiDisplayGetSizeMFunc)(GstVaapiDisplay *display,
|
typedef void (*GstVaapiDisplayGetSizeMFunc) (GstVaapiDisplay * display,
|
||||||
guint *pwidth, guint *pheight);
|
guint * pwidth, guint * pheight);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GST_VAAPI_DISPLAY_VADISPLAY:
|
* GST_VAAPI_DISPLAY_VADISPLAY:
|
||||||
|
@ -128,24 +128,25 @@ typedef void (*GstVaapiDisplayGetSizeMFunc)(GstVaapiDisplay *display,
|
||||||
#define GST_VAAPI_DISPLAY_HAS_VPP(display) \
|
#define GST_VAAPI_DISPLAY_HAS_VPP(display) \
|
||||||
(GST_VAAPI_DISPLAY_GET_PRIVATE(display)->has_vpp)
|
(GST_VAAPI_DISPLAY_GET_PRIVATE(display)->has_vpp)
|
||||||
|
|
||||||
struct _GstVaapiDisplayPrivate {
|
struct _GstVaapiDisplayPrivate
|
||||||
GstVaapiDisplay *parent;
|
{
|
||||||
GRecMutex mutex;
|
GstVaapiDisplay *parent;
|
||||||
GstVaapiDisplayType display_type;
|
GRecMutex mutex;
|
||||||
VADisplay display;
|
GstVaapiDisplayType display_type;
|
||||||
guint width;
|
VADisplay display;
|
||||||
guint height;
|
guint width;
|
||||||
guint width_mm;
|
guint height;
|
||||||
guint height_mm;
|
guint width_mm;
|
||||||
guint par_n;
|
guint height_mm;
|
||||||
guint par_d;
|
guint par_n;
|
||||||
GArray *decoders;
|
guint par_d;
|
||||||
GArray *encoders;
|
GArray *decoders;
|
||||||
GArray *image_formats;
|
GArray *encoders;
|
||||||
GArray *subpicture_formats;
|
GArray *image_formats;
|
||||||
GArray *properties;
|
GArray *subpicture_formats;
|
||||||
guint use_foreign_display : 1;
|
GArray *properties;
|
||||||
guint has_vpp : 1;
|
guint use_foreign_display:1;
|
||||||
|
guint has_vpp:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,11 +154,12 @@ struct _GstVaapiDisplayPrivate {
|
||||||
*
|
*
|
||||||
* Base class for VA displays.
|
* Base class for VA displays.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplay {
|
struct _GstVaapiDisplay
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiMiniObject parent_instance;
|
/*< private >*/
|
||||||
|
GstVaapiMiniObject parent_instance;
|
||||||
|
|
||||||
GstVaapiDisplayPrivate priv;
|
GstVaapiDisplayPrivate priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,51 +176,53 @@ struct _GstVaapiDisplay {
|
||||||
*
|
*
|
||||||
* Base class for VA displays.
|
* Base class for VA displays.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayClass {
|
struct _GstVaapiDisplayClass
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiMiniObjectClass parent_class;
|
/*< private >*/
|
||||||
|
GstVaapiMiniObjectClass parent_class;
|
||||||
|
|
||||||
/*< protected >*/
|
/*< protected >*/
|
||||||
guint display_types;
|
guint display_types;
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
GstVaapiDisplayInitFunc init;
|
GstVaapiDisplayInitFunc init;
|
||||||
GstVaapiDisplayBindFunc bind_display;
|
GstVaapiDisplayBindFunc bind_display;
|
||||||
GstVaapiDisplayOpenFunc open_display;
|
GstVaapiDisplayOpenFunc open_display;
|
||||||
GstVaapiDisplayCloseFunc close_display;
|
GstVaapiDisplayCloseFunc close_display;
|
||||||
GstVaapiDisplayLockFunc lock;
|
GstVaapiDisplayLockFunc lock;
|
||||||
GstVaapiDisplayUnlockFunc unlock;
|
GstVaapiDisplayUnlockFunc unlock;
|
||||||
GstVaapiDisplaySyncFunc sync;
|
GstVaapiDisplaySyncFunc sync;
|
||||||
GstVaapiDisplayFlushFunc flush;
|
GstVaapiDisplayFlushFunc flush;
|
||||||
GstVaapiDisplayGetInfoFunc get_display;
|
GstVaapiDisplayGetInfoFunc get_display;
|
||||||
GstVaapiDisplayGetSizeFunc get_size;
|
GstVaapiDisplayGetSizeFunc get_size;
|
||||||
GstVaapiDisplayGetSizeMFunc get_size_mm;
|
GstVaapiDisplayGetSizeMFunc get_size_mm;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Initialization types */
|
/* Initialization types */
|
||||||
enum _GstVaapiDisplayInitType {
|
enum _GstVaapiDisplayInitType
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME = 1,
|
{
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY,
|
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME = 1,
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY
|
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY,
|
||||||
|
GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_class_init(GstVaapiDisplayClass *klass);
|
gst_vaapi_display_class_init (GstVaapiDisplayClass * klass);
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_new(const GstVaapiDisplayClass *klass,
|
gst_vaapi_display_new (const GstVaapiDisplayClass * klass,
|
||||||
GstVaapiDisplayInitType init_type, gpointer init_value);
|
GstVaapiDisplayInitType init_type, gpointer init_value);
|
||||||
|
|
||||||
GstVaapiDisplayCache *
|
GstVaapiDisplayCache *
|
||||||
gst_vaapi_display_get_cache(void);
|
gst_vaapi_display_get_cache (void);
|
||||||
|
|
||||||
static inline guint
|
static inline guint
|
||||||
gst_vaapi_display_get_display_types(GstVaapiDisplay *display)
|
gst_vaapi_display_get_display_types (GstVaapiDisplay * display)
|
||||||
{
|
{
|
||||||
const GstVaapiDisplayClass * const dpy_class =
|
const GstVaapiDisplayClass *const dpy_class =
|
||||||
GST_VAAPI_DISPLAY_GET_CLASS(display);
|
GST_VAAPI_DISPLAY_GET_CLASS (display);
|
||||||
|
|
||||||
return dpy_class->display_types;
|
return dpy_class->display_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inline reference counting for core libgstvaapi library */
|
/* Inline reference counting for core libgstvaapi library */
|
||||||
|
|
|
@ -38,348 +38,334 @@
|
||||||
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
||||||
|
|
||||||
static inline const gchar *
|
static inline const gchar *
|
||||||
get_default_display_name(void)
|
get_default_display_name (void)
|
||||||
{
|
{
|
||||||
static const gchar *g_display_name;
|
static const gchar *g_display_name;
|
||||||
|
|
||||||
if (!g_display_name)
|
if (!g_display_name)
|
||||||
g_display_name = getenv("WAYLAND_DISPLAY");
|
g_display_name = getenv ("WAYLAND_DISPLAY");
|
||||||
return g_display_name;
|
return g_display_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline guint
|
static inline guint
|
||||||
get_display_name_length(const gchar *display_name)
|
get_display_name_length (const gchar * display_name)
|
||||||
{
|
{
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
|
|
||||||
str = strchr(display_name, '-');
|
str = strchr (display_name, '-');
|
||||||
if (str)
|
if (str)
|
||||||
return str - display_name;
|
return str - display_name;
|
||||||
return strlen(display_name);
|
return strlen (display_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
compare_display_name(gconstpointer a, gconstpointer b)
|
compare_display_name (gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
const GstVaapiDisplayInfo * const info = a;
|
const GstVaapiDisplayInfo *const info = a;
|
||||||
const gchar *cached_name = info->display_name;
|
const gchar *cached_name = info->display_name;
|
||||||
const gchar *tested_name = b;
|
const gchar *tested_name = b;
|
||||||
guint cached_name_length, tested_name_length;
|
guint cached_name_length, tested_name_length;
|
||||||
|
|
||||||
g_return_val_if_fail(cached_name, FALSE);
|
g_return_val_if_fail (cached_name, FALSE);
|
||||||
g_return_val_if_fail(tested_name, FALSE);
|
g_return_val_if_fail (tested_name, FALSE);
|
||||||
|
|
||||||
cached_name_length = get_display_name_length(cached_name);
|
cached_name_length = get_display_name_length (cached_name);
|
||||||
tested_name_length = get_display_name_length(tested_name);
|
tested_name_length = get_display_name_length (tested_name);
|
||||||
|
|
||||||
/* XXX: handle screen number and default WAYLAND_DISPLAY name */
|
/* XXX: handle screen number and default WAYLAND_DISPLAY name */
|
||||||
if (cached_name_length != tested_name_length)
|
if (cached_name_length != tested_name_length)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (strncmp(cached_name, tested_name, cached_name_length) != 0)
|
if (strncmp (cached_name, tested_name, cached_name_length) != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mangle display name with our prefix */
|
/* Mangle display name with our prefix */
|
||||||
static gboolean
|
static gboolean
|
||||||
set_display_name(GstVaapiDisplay *display, const gchar *display_name)
|
set_display_name (GstVaapiDisplay * display, const gchar * display_name)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv =
|
GstVaapiDisplayWaylandPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||||
|
|
||||||
g_free(priv->display_name);
|
g_free (priv->display_name);
|
||||||
|
|
||||||
if (!display_name) {
|
if (!display_name) {
|
||||||
display_name = get_default_display_name();
|
display_name = get_default_display_name ();
|
||||||
if (!display_name)
|
if (!display_name)
|
||||||
display_name = "";
|
display_name = "";
|
||||||
}
|
}
|
||||||
priv->display_name = g_strdup(display_name);
|
priv->display_name = g_strdup (display_name);
|
||||||
return priv->display_name != NULL;
|
return priv->display_name != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_handle_geometry(void *data, struct wl_output *output,
|
output_handle_geometry (void *data, struct wl_output *output,
|
||||||
int x, int y, int physical_width, int physical_height,
|
int x, int y, int physical_width, int physical_height,
|
||||||
int subpixel, const char *make, const char *model,
|
int subpixel, const char *make, const char *model, int transform)
|
||||||
int transform)
|
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv = data;
|
GstVaapiDisplayWaylandPrivate *const priv = data;
|
||||||
|
|
||||||
priv->phys_width = physical_width;
|
priv->phys_width = physical_width;
|
||||||
priv->phys_height = physical_height;
|
priv->phys_height = physical_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_handle_mode(void *data, struct wl_output *wl_output,
|
output_handle_mode (void *data, struct wl_output *wl_output,
|
||||||
uint32_t flags, int width, int height, int refresh)
|
uint32_t flags, int width, int height, int refresh)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv = data;
|
GstVaapiDisplayWaylandPrivate *const priv = data;
|
||||||
|
|
||||||
if (flags & WL_OUTPUT_MODE_CURRENT) {
|
if (flags & WL_OUTPUT_MODE_CURRENT) {
|
||||||
priv->width = width;
|
priv->width = width;
|
||||||
priv->height = height;
|
priv->height = height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_output_listener output_listener = {
|
static const struct wl_output_listener output_listener = {
|
||||||
output_handle_geometry,
|
output_handle_geometry,
|
||||||
output_handle_mode,
|
output_handle_mode,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
registry_handle_global(
|
registry_handle_global (void *data,
|
||||||
void *data,
|
|
||||||
struct wl_registry *registry,
|
struct wl_registry *registry,
|
||||||
uint32_t id,
|
uint32_t id, const char *interface, uint32_t version)
|
||||||
const char *interface,
|
|
||||||
uint32_t version
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv = data;
|
GstVaapiDisplayWaylandPrivate *const priv = data;
|
||||||
|
|
||||||
if (strcmp(interface, "wl_compositor") == 0)
|
if (strcmp (interface, "wl_compositor") == 0)
|
||||||
priv->compositor =
|
priv->compositor =
|
||||||
wl_registry_bind(registry, id, &wl_compositor_interface, 1);
|
wl_registry_bind (registry, id, &wl_compositor_interface, 1);
|
||||||
else if (strcmp(interface, "wl_shell") == 0)
|
else if (strcmp (interface, "wl_shell") == 0)
|
||||||
priv->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
|
priv->shell = wl_registry_bind (registry, id, &wl_shell_interface, 1);
|
||||||
else if (strcmp(interface, "wl_output") == 0) {
|
else if (strcmp (interface, "wl_output") == 0) {
|
||||||
priv->output = wl_registry_bind(registry, id, &wl_output_interface, 1);
|
priv->output = wl_registry_bind (registry, id, &wl_output_interface, 1);
|
||||||
wl_output_add_listener(priv->output, &output_listener, priv);
|
wl_output_add_listener (priv->output, &output_listener, priv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_registry_listener registry_listener = {
|
static const struct wl_registry_listener registry_listener = {
|
||||||
registry_handle_global,
|
registry_handle_global,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapi_display_wayland_setup(GstVaapiDisplay *display)
|
gst_vaapi_display_wayland_setup (GstVaapiDisplay * display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv =
|
GstVaapiDisplayWaylandPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||||
|
|
||||||
wl_display_set_user_data(priv->wl_display, priv);
|
wl_display_set_user_data (priv->wl_display, priv);
|
||||||
priv->registry = wl_display_get_registry(priv->wl_display);
|
priv->registry = wl_display_get_registry (priv->wl_display);
|
||||||
wl_registry_add_listener(priv->registry, ®istry_listener, priv);
|
wl_registry_add_listener (priv->registry, ®istry_listener, priv);
|
||||||
priv->event_fd = wl_display_get_fd(priv->wl_display);
|
priv->event_fd = wl_display_get_fd (priv->wl_display);
|
||||||
wl_display_roundtrip(priv->wl_display);
|
wl_display_roundtrip (priv->wl_display);
|
||||||
|
|
||||||
|
if (!priv->width || !priv->height) {
|
||||||
|
wl_display_roundtrip (priv->wl_display);
|
||||||
if (!priv->width || !priv->height) {
|
if (!priv->width || !priv->height) {
|
||||||
wl_display_roundtrip(priv->wl_display);
|
GST_ERROR ("failed to determine the display size");
|
||||||
if (!priv->width || !priv->height) {
|
return FALSE;
|
||||||
GST_ERROR("failed to determine the display size");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!priv->compositor) {
|
if (!priv->compositor) {
|
||||||
GST_ERROR("failed to bind compositor interface");
|
GST_ERROR ("failed to bind compositor interface");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!priv->shell) {
|
if (!priv->shell) {
|
||||||
GST_ERROR("failed to bind shell interface");
|
GST_ERROR ("failed to bind shell interface");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapi_display_wayland_bind_display(GstVaapiDisplay *display,
|
gst_vaapi_display_wayland_bind_display (GstVaapiDisplay * display,
|
||||||
gpointer native_display)
|
gpointer native_display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv =
|
GstVaapiDisplayWaylandPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||||
|
|
||||||
priv->wl_display = native_display;
|
priv->wl_display = native_display;
|
||||||
|
priv->use_foreign_display = TRUE;
|
||||||
|
|
||||||
|
/* XXX: how to get socket/display name? */
|
||||||
|
GST_WARNING ("wayland: get display name");
|
||||||
|
set_display_name (display, NULL);
|
||||||
|
|
||||||
|
return gst_vaapi_display_wayland_setup (display);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_vaapi_display_wayland_open_display (GstVaapiDisplay * display,
|
||||||
|
const gchar * name)
|
||||||
|
{
|
||||||
|
GstVaapiDisplayWaylandPrivate *const priv =
|
||||||
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||||
|
GstVaapiDisplayCache *cache;
|
||||||
|
const GstVaapiDisplayInfo *info;
|
||||||
|
|
||||||
|
cache = gst_vaapi_display_get_cache ();
|
||||||
|
g_return_val_if_fail (cache != NULL, FALSE);
|
||||||
|
|
||||||
|
if (!set_display_name (display, name))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
info = gst_vaapi_display_cache_lookup_custom (cache, compare_display_name,
|
||||||
|
priv->display_name, GST_VAAPI_DISPLAY_TYPES (display));
|
||||||
|
if (info) {
|
||||||
|
priv->wl_display = info->native_display;
|
||||||
priv->use_foreign_display = TRUE;
|
priv->use_foreign_display = TRUE;
|
||||||
|
} else {
|
||||||
/* XXX: how to get socket/display name? */
|
priv->wl_display = wl_display_connect (name);
|
||||||
GST_WARNING("wayland: get display name");
|
if (!priv->wl_display)
|
||||||
set_display_name(display, NULL);
|
return FALSE;
|
||||||
|
priv->use_foreign_display = FALSE;
|
||||||
return gst_vaapi_display_wayland_setup(display);
|
}
|
||||||
}
|
return gst_vaapi_display_wayland_setup (display);
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_vaapi_display_wayland_open_display(GstVaapiDisplay *display,
|
|
||||||
const gchar *name)
|
|
||||||
{
|
|
||||||
GstVaapiDisplayWaylandPrivate * const priv =
|
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
|
||||||
GstVaapiDisplayCache *cache;
|
|
||||||
const GstVaapiDisplayInfo *info;
|
|
||||||
|
|
||||||
cache = gst_vaapi_display_get_cache();
|
|
||||||
g_return_val_if_fail(cache != NULL, FALSE);
|
|
||||||
|
|
||||||
if (!set_display_name(display, name))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
info = gst_vaapi_display_cache_lookup_custom(cache, compare_display_name,
|
|
||||||
priv->display_name, GST_VAAPI_DISPLAY_TYPES(display));
|
|
||||||
if (info) {
|
|
||||||
priv->wl_display = info->native_display;
|
|
||||||
priv->use_foreign_display = TRUE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
priv->wl_display = wl_display_connect(name);
|
|
||||||
if (!priv->wl_display)
|
|
||||||
return FALSE;
|
|
||||||
priv->use_foreign_display = FALSE;
|
|
||||||
}
|
|
||||||
return gst_vaapi_display_wayland_setup(display);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_wayland_close_display(GstVaapiDisplay * display)
|
gst_vaapi_display_wayland_close_display (GstVaapiDisplay * display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv =
|
GstVaapiDisplayWaylandPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||||
|
|
||||||
if (priv->output) {
|
if (priv->output) {
|
||||||
wl_output_destroy(priv->output);
|
wl_output_destroy (priv->output);
|
||||||
priv->output = NULL;
|
priv->output = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->shell) {
|
if (priv->shell) {
|
||||||
wl_shell_destroy(priv->shell);
|
wl_shell_destroy (priv->shell);
|
||||||
priv->shell = NULL;
|
priv->shell = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->compositor) {
|
if (priv->compositor) {
|
||||||
wl_compositor_destroy(priv->compositor);
|
wl_compositor_destroy (priv->compositor);
|
||||||
priv->compositor = NULL;
|
priv->compositor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->wl_display) {
|
if (priv->wl_display) {
|
||||||
if (!priv->use_foreign_display)
|
if (!priv->use_foreign_display)
|
||||||
wl_display_disconnect(priv->wl_display);
|
wl_display_disconnect (priv->wl_display);
|
||||||
priv->wl_display = NULL;
|
priv->wl_display = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->display_name) {
|
if (priv->display_name) {
|
||||||
g_free(priv->display_name);
|
g_free (priv->display_name);
|
||||||
priv->display_name = NULL;
|
priv->display_name = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapi_display_wayland_get_display_info(
|
gst_vaapi_display_wayland_get_display_info (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
GstVaapiDisplayInfo * info)
|
||||||
GstVaapiDisplayInfo *info
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv =
|
GstVaapiDisplayWaylandPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||||
GstVaapiDisplayCache *cache;
|
GstVaapiDisplayCache *cache;
|
||||||
const GstVaapiDisplayInfo *cached_info;
|
const GstVaapiDisplayInfo *cached_info;
|
||||||
|
|
||||||
/* Return any cached info even if child has its own VA display */
|
/* Return any cached info even if child has its own VA display */
|
||||||
cache = gst_vaapi_display_get_cache();
|
cache = gst_vaapi_display_get_cache ();
|
||||||
if (!cache)
|
if (!cache)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
cached_info = gst_vaapi_display_cache_lookup_by_native_display(cache,
|
cached_info = gst_vaapi_display_cache_lookup_by_native_display (cache,
|
||||||
priv->wl_display, GST_VAAPI_DISPLAY_TYPES(display));
|
priv->wl_display, GST_VAAPI_DISPLAY_TYPES (display));
|
||||||
if (cached_info) {
|
if (cached_info) {
|
||||||
*info = *cached_info;
|
*info = *cached_info;
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Otherwise, create VA display if there is none already */
|
|
||||||
info->native_display = priv->wl_display;
|
|
||||||
info->display_name = priv->display_name;
|
|
||||||
if (!info->va_display) {
|
|
||||||
info->va_display = vaGetDisplayWl(priv->wl_display);
|
|
||||||
if (!info->va_display)
|
|
||||||
return FALSE;
|
|
||||||
info->display_type = GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise, create VA display if there is none already */
|
||||||
|
info->native_display = priv->wl_display;
|
||||||
|
info->display_name = priv->display_name;
|
||||||
|
if (!info->va_display) {
|
||||||
|
info->va_display = vaGetDisplayWl (priv->wl_display);
|
||||||
|
if (!info->va_display)
|
||||||
|
return FALSE;
|
||||||
|
info->display_type = GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_wayland_get_size(
|
gst_vaapi_display_wayland_get_size (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
guint * pwidth, guint * pheight)
|
||||||
guint *pwidth,
|
|
||||||
guint *pheight
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv =
|
GstVaapiDisplayWaylandPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||||
|
|
||||||
if (!priv->output)
|
if (!priv->output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pwidth)
|
if (pwidth)
|
||||||
*pwidth = priv->width;
|
*pwidth = priv->width;
|
||||||
|
|
||||||
if (pheight)
|
if (pheight)
|
||||||
*pheight = priv->height;
|
*pheight = priv->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_wayland_get_size_mm(
|
gst_vaapi_display_wayland_get_size_mm (GstVaapiDisplay * display,
|
||||||
GstVaapiDisplay *display,
|
guint * pwidth, guint * pheight)
|
||||||
guint *pwidth,
|
|
||||||
guint *pheight
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv =
|
GstVaapiDisplayWaylandPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||||
|
|
||||||
if (!priv->output)
|
if (!priv->output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pwidth)
|
if (pwidth)
|
||||||
*pwidth = priv->phys_width;
|
*pwidth = priv->phys_width;
|
||||||
|
|
||||||
if (pheight)
|
if (pheight)
|
||||||
*pheight = priv->phys_height;
|
*pheight = priv->phys_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_wayland_init(GstVaapiDisplay *display)
|
gst_vaapi_display_wayland_init (GstVaapiDisplay * display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayWaylandPrivate * const priv =
|
GstVaapiDisplayWaylandPrivate *const priv =
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||||
|
|
||||||
priv->event_fd = -1;
|
priv->event_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_wayland_class_init(GstVaapiDisplayWaylandClass * klass)
|
gst_vaapi_display_wayland_class_init (GstVaapiDisplayWaylandClass * klass)
|
||||||
{
|
{
|
||||||
GstVaapiMiniObjectClass * const object_class =
|
GstVaapiMiniObjectClass *const object_class =
|
||||||
GST_VAAPI_MINI_OBJECT_CLASS(klass);
|
GST_VAAPI_MINI_OBJECT_CLASS (klass);
|
||||||
GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
|
GstVaapiDisplayClass *const dpy_class = GST_VAAPI_DISPLAY_CLASS (klass);
|
||||||
|
|
||||||
gst_vaapi_display_class_init(&klass->parent_class);
|
gst_vaapi_display_class_init (&klass->parent_class);
|
||||||
|
|
||||||
object_class->size = sizeof(GstVaapiDisplayWayland);
|
object_class->size = sizeof (GstVaapiDisplayWayland);
|
||||||
dpy_class->display_types = g_display_types;
|
dpy_class->display_types = g_display_types;
|
||||||
dpy_class->init = gst_vaapi_display_wayland_init;
|
dpy_class->init = gst_vaapi_display_wayland_init;
|
||||||
dpy_class->bind_display = gst_vaapi_display_wayland_bind_display;
|
dpy_class->bind_display = gst_vaapi_display_wayland_bind_display;
|
||||||
dpy_class->open_display = gst_vaapi_display_wayland_open_display;
|
dpy_class->open_display = gst_vaapi_display_wayland_open_display;
|
||||||
dpy_class->close_display = gst_vaapi_display_wayland_close_display;
|
dpy_class->close_display = gst_vaapi_display_wayland_close_display;
|
||||||
dpy_class->get_display = gst_vaapi_display_wayland_get_display_info;
|
dpy_class->get_display = gst_vaapi_display_wayland_get_display_info;
|
||||||
dpy_class->get_size = gst_vaapi_display_wayland_get_size;
|
dpy_class->get_size = gst_vaapi_display_wayland_get_size;
|
||||||
dpy_class->get_size_mm = gst_vaapi_display_wayland_get_size_mm;
|
dpy_class->get_size_mm = gst_vaapi_display_wayland_get_size_mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const GstVaapiDisplayClass *
|
static inline const GstVaapiDisplayClass *
|
||||||
gst_vaapi_display_wayland_class(void)
|
gst_vaapi_display_wayland_class (void)
|
||||||
{
|
{
|
||||||
static GstVaapiDisplayWaylandClass g_class;
|
static GstVaapiDisplayWaylandClass g_class;
|
||||||
static gsize g_class_init = FALSE;
|
static gsize g_class_init = FALSE;
|
||||||
|
|
||||||
if (g_once_init_enter(&g_class_init)) {
|
if (g_once_init_enter (&g_class_init)) {
|
||||||
gst_vaapi_display_wayland_class_init(&g_class);
|
gst_vaapi_display_wayland_class_init (&g_class);
|
||||||
g_once_init_leave(&g_class_init, TRUE);
|
g_once_init_leave (&g_class_init, TRUE);
|
||||||
}
|
}
|
||||||
return GST_VAAPI_DISPLAY_CLASS(&g_class);
|
return GST_VAAPI_DISPLAY_CLASS (&g_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -393,10 +379,10 @@ gst_vaapi_display_wayland_class(void)
|
||||||
* Return value: a newly allocated #GstVaapiDisplay object
|
* Return value: a newly allocated #GstVaapiDisplay object
|
||||||
*/
|
*/
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_wayland_new(const gchar *display_name)
|
gst_vaapi_display_wayland_new (const gchar * display_name)
|
||||||
{
|
{
|
||||||
return gst_vaapi_display_new(gst_vaapi_display_wayland_class(),
|
return gst_vaapi_display_new (gst_vaapi_display_wayland_class (),
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer)display_name);
|
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -411,12 +397,12 @@ gst_vaapi_display_wayland_new(const gchar *display_name)
|
||||||
* Return value: a newly allocated #GstVaapiDisplay object
|
* Return value: a newly allocated #GstVaapiDisplay object
|
||||||
*/
|
*/
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_wayland_new_with_display(struct wl_display *wl_display)
|
gst_vaapi_display_wayland_new_with_display (struct wl_display * wl_display)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(wl_display, NULL);
|
g_return_val_if_fail (wl_display, NULL);
|
||||||
|
|
||||||
return gst_vaapi_display_new(gst_vaapi_display_wayland_class(),
|
return gst_vaapi_display_new (gst_vaapi_display_wayland_class (),
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, wl_display);
|
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, wl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -430,9 +416,9 @@ gst_vaapi_display_wayland_new_with_display(struct wl_display *wl_display)
|
||||||
* Return value: the Wayland #wl_display attached to @display
|
* Return value: the Wayland #wl_display attached to @display
|
||||||
*/
|
*/
|
||||||
struct wl_display *
|
struct wl_display *
|
||||||
gst_vaapi_display_wayland_get_display(GstVaapiDisplayWayland *display)
|
gst_vaapi_display_wayland_get_display (GstVaapiDisplayWayland * display)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY_WAYLAND(display), NULL);
|
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_WAYLAND (display), NULL);
|
||||||
|
|
||||||
return GST_VAAPI_DISPLAY_WL_DISPLAY(display);
|
return GST_VAAPI_DISPLAY_WL_DISPLAY (display);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,13 @@ G_BEGIN_DECLS
|
||||||
typedef struct _GstVaapiDisplayWayland GstVaapiDisplayWayland;
|
typedef struct _GstVaapiDisplayWayland GstVaapiDisplayWayland;
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_wayland_new(const gchar *display_name);
|
gst_vaapi_display_wayland_new (const gchar * display_name);
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_wayland_new_with_display(struct wl_display *wl_display);
|
gst_vaapi_display_wayland_new_with_display (struct wl_display * wl_display);
|
||||||
|
|
||||||
struct wl_display *
|
struct wl_display *
|
||||||
gst_vaapi_display_wayland_get_display(GstVaapiDisplayWayland *display);
|
gst_vaapi_display_wayland_get_display (GstVaapiDisplayWayland * display);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -53,19 +53,20 @@ typedef struct _GstVaapiDisplayWaylandClass GstVaapiDisplayWaylandClass;
|
||||||
#define GST_VAAPI_DISPLAY_WL_DISPLAY(display) \
|
#define GST_VAAPI_DISPLAY_WL_DISPLAY(display) \
|
||||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display)->wl_display
|
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display)->wl_display
|
||||||
|
|
||||||
struct _GstVaapiDisplayWaylandPrivate {
|
struct _GstVaapiDisplayWaylandPrivate
|
||||||
gchar *display_name;
|
{
|
||||||
struct wl_display *wl_display;
|
gchar *display_name;
|
||||||
struct wl_compositor *compositor;
|
struct wl_display *wl_display;
|
||||||
struct wl_shell *shell;
|
struct wl_compositor *compositor;
|
||||||
struct wl_output *output;
|
struct wl_shell *shell;
|
||||||
struct wl_registry *registry;
|
struct wl_output *output;
|
||||||
guint width;
|
struct wl_registry *registry;
|
||||||
guint height;
|
guint width;
|
||||||
guint phys_width;
|
guint height;
|
||||||
guint phys_height;
|
guint phys_width;
|
||||||
gint event_fd;
|
guint phys_height;
|
||||||
guint use_foreign_display : 1;
|
gint event_fd;
|
||||||
|
guint use_foreign_display:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,11 +74,12 @@ struct _GstVaapiDisplayWaylandPrivate {
|
||||||
*
|
*
|
||||||
* VA/Wayland display wrapper.
|
* VA/Wayland display wrapper.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayWayland {
|
struct _GstVaapiDisplayWayland
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiDisplay parent_instance;
|
/*< private >*/
|
||||||
|
GstVaapiDisplay parent_instance;
|
||||||
|
|
||||||
GstVaapiDisplayWaylandPrivate priv;
|
GstVaapiDisplayWaylandPrivate priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,9 +87,10 @@ struct _GstVaapiDisplayWayland {
|
||||||
*
|
*
|
||||||
* VA/Wayland display wrapper clas.
|
* VA/Wayland display wrapper clas.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayWaylandClass {
|
struct _GstVaapiDisplayWaylandClass
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiDisplayClass parent_class;
|
/*< private >*/
|
||||||
|
GstVaapiDisplayClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -46,359 +46,348 @@
|
||||||
#include "gstvaapidebug.h"
|
#include "gstvaapidebug.h"
|
||||||
|
|
||||||
static const guint g_display_types =
|
static const guint g_display_types =
|
||||||
(1U << GST_VAAPI_DISPLAY_TYPE_X11) |
|
(1U << GST_VAAPI_DISPLAY_TYPE_X11) | (1U << GST_VAAPI_DISPLAY_TYPE_GLX);
|
||||||
(1U << GST_VAAPI_DISPLAY_TYPE_GLX);
|
|
||||||
|
|
||||||
static inline const gchar *
|
static inline const gchar *
|
||||||
get_default_display_name(void)
|
get_default_display_name (void)
|
||||||
{
|
{
|
||||||
static const gchar *g_display_name;
|
static const gchar *g_display_name;
|
||||||
|
|
||||||
if (!g_display_name)
|
if (!g_display_name)
|
||||||
g_display_name = getenv("DISPLAY");
|
g_display_name = getenv ("DISPLAY");
|
||||||
return g_display_name;
|
return g_display_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
compare_display_name(gconstpointer a, gconstpointer b)
|
compare_display_name (gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
const GstVaapiDisplayInfo * const info = a;
|
const GstVaapiDisplayInfo *const info = a;
|
||||||
const gchar *cached_name = info->display_name, *cached_name_end;
|
const gchar *cached_name = info->display_name, *cached_name_end;
|
||||||
const gchar *tested_name = b, *tested_name_end;
|
const gchar *tested_name = b, *tested_name_end;
|
||||||
guint cached_name_length, tested_name_length;
|
guint cached_name_length, tested_name_length;
|
||||||
|
|
||||||
g_return_val_if_fail(cached_name, FALSE);
|
g_return_val_if_fail (cached_name, FALSE);
|
||||||
g_return_val_if_fail(tested_name, FALSE);
|
g_return_val_if_fail (tested_name, FALSE);
|
||||||
|
|
||||||
cached_name_end = strchr(cached_name, ':');
|
cached_name_end = strchr (cached_name, ':');
|
||||||
if (cached_name_end)
|
if (cached_name_end)
|
||||||
cached_name_length = cached_name_end - cached_name;
|
cached_name_length = cached_name_end - cached_name;
|
||||||
else
|
else
|
||||||
cached_name_length = strlen(cached_name);
|
cached_name_length = strlen (cached_name);
|
||||||
|
|
||||||
tested_name_end = strchr(tested_name, ':');
|
tested_name_end = strchr (tested_name, ':');
|
||||||
if (tested_name_end)
|
if (tested_name_end)
|
||||||
tested_name_length = tested_name_end - tested_name;
|
tested_name_length = tested_name_end - tested_name;
|
||||||
else
|
else
|
||||||
tested_name_length = strlen(tested_name);
|
tested_name_length = strlen (tested_name);
|
||||||
|
|
||||||
if (cached_name_length != tested_name_length)
|
if (cached_name_length != tested_name_length)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (strncmp(cached_name, tested_name, cached_name_length) != 0)
|
if (strncmp (cached_name, tested_name, cached_name_length) != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* XXX: handle screen number? */
|
/* XXX: handle screen number? */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reconstruct a display name without our prefix */
|
/* Reconstruct a display name without our prefix */
|
||||||
static const gchar *
|
static const gchar *
|
||||||
get_display_name(GstVaapiDisplayX11 *display)
|
get_display_name (GstVaapiDisplayX11 * display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayX11Private * const priv = &display->priv;
|
GstVaapiDisplayX11Private *const priv = &display->priv;
|
||||||
const gchar *display_name = priv->display_name;
|
const gchar *display_name = priv->display_name;
|
||||||
|
|
||||||
if (!display_name || *display_name == '\0')
|
if (!display_name || *display_name == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
return display_name;
|
return display_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mangle display name with our prefix */
|
/* Mangle display name with our prefix */
|
||||||
static gboolean
|
static gboolean
|
||||||
set_display_name(GstVaapiDisplayX11 *display, const gchar *display_name)
|
set_display_name (GstVaapiDisplayX11 * display, const gchar * display_name)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayX11Private * const priv = &display->priv;
|
GstVaapiDisplayX11Private *const priv = &display->priv;
|
||||||
|
|
||||||
g_free(priv->display_name);
|
g_free (priv->display_name);
|
||||||
|
|
||||||
if (!display_name) {
|
if (!display_name) {
|
||||||
display_name = get_default_display_name();
|
display_name = get_default_display_name ();
|
||||||
if (!display_name)
|
if (!display_name)
|
||||||
display_name = "";
|
display_name = "";
|
||||||
}
|
}
|
||||||
priv->display_name = g_strdup(display_name);
|
priv->display_name = g_strdup (display_name);
|
||||||
return priv->display_name != NULL;
|
return priv->display_name != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set synchronous behavious on the underlying X11 display */
|
/* Set synchronous behavious on the underlying X11 display */
|
||||||
static void
|
static void
|
||||||
set_synchronous(GstVaapiDisplayX11 *display, gboolean synchronous)
|
set_synchronous (GstVaapiDisplayX11 * display, gboolean synchronous)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayX11Private * const priv = &display->priv;
|
GstVaapiDisplayX11Private *const priv = &display->priv;
|
||||||
|
|
||||||
if (priv->synchronous != synchronous) {
|
if (priv->synchronous != synchronous) {
|
||||||
priv->synchronous = synchronous;
|
priv->synchronous = synchronous;
|
||||||
if (priv->x11_display) {
|
if (priv->x11_display) {
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
GST_VAAPI_DISPLAY_LOCK (display);
|
||||||
XSynchronize(priv->x11_display, synchronous);
|
XSynchronize (priv->x11_display, synchronous);
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for display server extensions */
|
/* Check for display server extensions */
|
||||||
static void
|
static void
|
||||||
check_extensions(GstVaapiDisplayX11 *display)
|
check_extensions (GstVaapiDisplayX11 * display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayX11Private * const priv =
|
GstVaapiDisplayX11Private *const priv =
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
int evt_base, err_base;
|
int evt_base, err_base;
|
||||||
|
|
||||||
#ifdef HAVE_XRANDR
|
#ifdef HAVE_XRANDR
|
||||||
priv->use_xrandr = XRRQueryExtension(priv->x11_display,
|
priv->use_xrandr = XRRQueryExtension (priv->x11_display,
|
||||||
&evt_base, &err_base);
|
&evt_base, &err_base);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_XRENDER
|
#ifdef HAVE_XRENDER
|
||||||
priv->has_xrender = XRenderQueryExtension(priv->x11_display,
|
priv->has_xrender = XRenderQueryExtension (priv->x11_display,
|
||||||
&evt_base, &err_base);
|
&evt_base, &err_base);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapi_display_x11_bind_display(GstVaapiDisplay *base_display,
|
gst_vaapi_display_x11_bind_display (GstVaapiDisplay * base_display,
|
||||||
gpointer native_display)
|
gpointer native_display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayX11 * const display =
|
GstVaapiDisplayX11 *const display = GST_VAAPI_DISPLAY_X11_CAST (base_display);
|
||||||
GST_VAAPI_DISPLAY_X11_CAST(base_display);
|
GstVaapiDisplayX11Private *const priv = &display->priv;
|
||||||
GstVaapiDisplayX11Private * const priv = &display->priv;
|
|
||||||
|
|
||||||
priv->x11_display = native_display;
|
priv->x11_display = native_display;
|
||||||
priv->x11_screen = DefaultScreen(native_display);
|
priv->x11_screen = DefaultScreen (native_display);
|
||||||
|
priv->use_foreign_display = TRUE;
|
||||||
|
|
||||||
|
check_extensions (display);
|
||||||
|
|
||||||
|
if (!set_display_name (display, XDisplayString (priv->x11_display)))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_vaapi_display_x11_open_display (GstVaapiDisplay * base_display,
|
||||||
|
const gchar * name)
|
||||||
|
{
|
||||||
|
GstVaapiDisplayX11 *const display = GST_VAAPI_DISPLAY_X11_CAST (base_display);
|
||||||
|
GstVaapiDisplayX11Private *const priv = &display->priv;
|
||||||
|
GstVaapiDisplayCache *cache;
|
||||||
|
const GstVaapiDisplayInfo *info;
|
||||||
|
|
||||||
|
cache = gst_vaapi_display_get_cache ();
|
||||||
|
g_return_val_if_fail (cache != NULL, FALSE);
|
||||||
|
|
||||||
|
if (!set_display_name (display, name))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
info = gst_vaapi_display_cache_lookup_custom (cache, compare_display_name,
|
||||||
|
priv->display_name, GST_VAAPI_DISPLAY_TYPES (display));
|
||||||
|
if (info) {
|
||||||
|
priv->x11_display = info->native_display;
|
||||||
priv->use_foreign_display = TRUE;
|
priv->use_foreign_display = TRUE;
|
||||||
|
} else {
|
||||||
|
priv->x11_display = XOpenDisplay (get_display_name (display));
|
||||||
|
if (!priv->x11_display)
|
||||||
|
return FALSE;
|
||||||
|
priv->use_foreign_display = FALSE;
|
||||||
|
}
|
||||||
|
priv->x11_screen = DefaultScreen (priv->x11_display);
|
||||||
|
|
||||||
check_extensions(display);
|
check_extensions (display);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!set_display_name(display, XDisplayString(priv->x11_display)))
|
static void
|
||||||
return FALSE;
|
gst_vaapi_display_x11_close_display (GstVaapiDisplay * display)
|
||||||
return TRUE;
|
{
|
||||||
|
GstVaapiDisplayX11Private *const priv =
|
||||||
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
|
|
||||||
|
if (priv->pixmap_formats) {
|
||||||
|
g_array_free (priv->pixmap_formats, TRUE);
|
||||||
|
priv->pixmap_formats = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->x11_display) {
|
||||||
|
if (!priv->use_foreign_display)
|
||||||
|
XCloseDisplay (priv->x11_display);
|
||||||
|
priv->x11_display = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->display_name) {
|
||||||
|
g_free (priv->display_name);
|
||||||
|
priv->display_name = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_vaapi_display_x11_sync (GstVaapiDisplay * display)
|
||||||
|
{
|
||||||
|
GstVaapiDisplayX11Private *const priv =
|
||||||
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
|
|
||||||
|
if (priv->x11_display) {
|
||||||
|
GST_VAAPI_DISPLAY_LOCK (display);
|
||||||
|
XSync (priv->x11_display, False);
|
||||||
|
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_vaapi_display_x11_flush (GstVaapiDisplay * display)
|
||||||
|
{
|
||||||
|
GstVaapiDisplayX11Private *const priv =
|
||||||
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
|
|
||||||
|
if (priv->x11_display) {
|
||||||
|
GST_VAAPI_DISPLAY_LOCK (display);
|
||||||
|
XFlush (priv->x11_display);
|
||||||
|
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_vaapi_display_x11_open_display(GstVaapiDisplay *base_display,
|
gst_vaapi_display_x11_get_display_info (GstVaapiDisplay * display,
|
||||||
const gchar *name)
|
GstVaapiDisplayInfo * info)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayX11 * const display =
|
GstVaapiDisplayX11Private *const priv =
|
||||||
GST_VAAPI_DISPLAY_X11_CAST(base_display);
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
GstVaapiDisplayX11Private * const priv = &display->priv;
|
GstVaapiDisplayCache *cache;
|
||||||
GstVaapiDisplayCache *cache;
|
const GstVaapiDisplayInfo *cached_info;
|
||||||
const GstVaapiDisplayInfo *info;
|
|
||||||
|
|
||||||
cache = gst_vaapi_display_get_cache();
|
/* Return any cached info even if child has its own VA display */
|
||||||
g_return_val_if_fail(cache != NULL, FALSE);
|
cache = gst_vaapi_display_get_cache ();
|
||||||
|
if (!cache)
|
||||||
if (!set_display_name(display, name))
|
return FALSE;
|
||||||
return FALSE;
|
cached_info =
|
||||||
|
gst_vaapi_display_cache_lookup_by_native_display (cache,
|
||||||
info = gst_vaapi_display_cache_lookup_custom(cache, compare_display_name,
|
priv->x11_display, GST_VAAPI_DISPLAY_TYPES (display));
|
||||||
priv->display_name, GST_VAAPI_DISPLAY_TYPES(display));
|
if (cached_info) {
|
||||||
if (info) {
|
*info = *cached_info;
|
||||||
priv->x11_display = info->native_display;
|
|
||||||
priv->use_foreign_display = TRUE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
priv->x11_display = XOpenDisplay(get_display_name(display));
|
|
||||||
if (!priv->x11_display)
|
|
||||||
return FALSE;
|
|
||||||
priv->use_foreign_display = FALSE;
|
|
||||||
}
|
|
||||||
priv->x11_screen = DefaultScreen(priv->x11_display);
|
|
||||||
|
|
||||||
check_extensions(display);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise, create VA display if there is none already */
|
||||||
|
info->native_display = priv->x11_display;
|
||||||
|
info->display_name = priv->display_name;
|
||||||
|
if (!info->va_display) {
|
||||||
|
info->va_display = vaGetDisplay (priv->x11_display);
|
||||||
|
if (!info->va_display)
|
||||||
|
return FALSE;
|
||||||
|
info->display_type = GST_VAAPI_DISPLAY_TYPE_X11;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_x11_close_display(GstVaapiDisplay *display)
|
gst_vaapi_display_x11_get_size (GstVaapiDisplay * display,
|
||||||
|
guint * pwidth, guint * pheight)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayX11Private * const priv =
|
GstVaapiDisplayX11Private *const priv =
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
|
|
||||||
if (priv->pixmap_formats) {
|
if (!priv->x11_display)
|
||||||
g_array_free(priv->pixmap_formats, TRUE);
|
return;
|
||||||
priv->pixmap_formats = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->x11_display) {
|
if (pwidth)
|
||||||
if (!priv->use_foreign_display)
|
*pwidth = DisplayWidth (priv->x11_display, priv->x11_screen);
|
||||||
XCloseDisplay(priv->x11_display);
|
|
||||||
priv->x11_display = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->display_name) {
|
if (pheight)
|
||||||
g_free(priv->display_name);
|
*pheight = DisplayHeight (priv->x11_display, priv->x11_screen);
|
||||||
priv->display_name = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vaapi_display_x11_sync(GstVaapiDisplay *display)
|
gst_vaapi_display_x11_get_size_mm (GstVaapiDisplay * display,
|
||||||
|
guint * pwidth, guint * pheight)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayX11Private * const priv =
|
GstVaapiDisplayX11Private *const priv =
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
|
guint width_mm, height_mm;
|
||||||
|
|
||||||
if (priv->x11_display) {
|
if (!priv->x11_display)
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
return;
|
||||||
XSync(priv->x11_display, False);
|
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
width_mm = DisplayWidthMM (priv->x11_display, priv->x11_screen);
|
||||||
gst_vaapi_display_x11_flush(GstVaapiDisplay *display)
|
height_mm = DisplayHeightMM (priv->x11_display, priv->x11_screen);
|
||||||
{
|
|
||||||
GstVaapiDisplayX11Private * const priv =
|
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
|
||||||
|
|
||||||
if (priv->x11_display) {
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
|
||||||
XFlush(priv->x11_display);
|
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_vaapi_display_x11_get_display_info(
|
|
||||||
GstVaapiDisplay *display,
|
|
||||||
GstVaapiDisplayInfo *info
|
|
||||||
)
|
|
||||||
{
|
|
||||||
GstVaapiDisplayX11Private * const priv =
|
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
|
||||||
GstVaapiDisplayCache *cache;
|
|
||||||
const GstVaapiDisplayInfo *cached_info;
|
|
||||||
|
|
||||||
/* Return any cached info even if child has its own VA display */
|
|
||||||
cache = gst_vaapi_display_get_cache();
|
|
||||||
if (!cache)
|
|
||||||
return FALSE;
|
|
||||||
cached_info = gst_vaapi_display_cache_lookup_by_native_display(
|
|
||||||
cache, priv->x11_display, GST_VAAPI_DISPLAY_TYPES(display));
|
|
||||||
if (cached_info) {
|
|
||||||
*info = *cached_info;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Otherwise, create VA display if there is none already */
|
|
||||||
info->native_display = priv->x11_display;
|
|
||||||
info->display_name = priv->display_name;
|
|
||||||
if (!info->va_display) {
|
|
||||||
info->va_display = vaGetDisplay(priv->x11_display);
|
|
||||||
if (!info->va_display)
|
|
||||||
return FALSE;
|
|
||||||
info->display_type = GST_VAAPI_DISPLAY_TYPE_X11;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_vaapi_display_x11_get_size(
|
|
||||||
GstVaapiDisplay *display,
|
|
||||||
guint *pwidth,
|
|
||||||
guint *pheight
|
|
||||||
)
|
|
||||||
{
|
|
||||||
GstVaapiDisplayX11Private * const priv =
|
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
|
||||||
|
|
||||||
if (!priv->x11_display)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (pwidth)
|
|
||||||
*pwidth = DisplayWidth(priv->x11_display, priv->x11_screen);
|
|
||||||
|
|
||||||
if (pheight)
|
|
||||||
*pheight = DisplayHeight(priv->x11_display, priv->x11_screen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_vaapi_display_x11_get_size_mm(
|
|
||||||
GstVaapiDisplay *display,
|
|
||||||
guint *pwidth,
|
|
||||||
guint *pheight
|
|
||||||
)
|
|
||||||
{
|
|
||||||
GstVaapiDisplayX11Private * const priv =
|
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
|
||||||
guint width_mm, height_mm;
|
|
||||||
|
|
||||||
if (!priv->x11_display)
|
|
||||||
return;
|
|
||||||
|
|
||||||
width_mm = DisplayWidthMM(priv->x11_display, priv->x11_screen);
|
|
||||||
height_mm = DisplayHeightMM(priv->x11_display, priv->x11_screen);
|
|
||||||
|
|
||||||
#ifdef HAVE_XRANDR
|
#ifdef HAVE_XRANDR
|
||||||
/* XXX: fix up physical size if the display is rotated */
|
/* XXX: fix up physical size if the display is rotated */
|
||||||
if (priv->use_xrandr) {
|
if (priv->use_xrandr) {
|
||||||
XRRScreenConfiguration *xrr_config = NULL;
|
XRRScreenConfiguration *xrr_config = NULL;
|
||||||
XRRScreenSize *xrr_sizes;
|
XRRScreenSize *xrr_sizes;
|
||||||
Window win;
|
Window win;
|
||||||
int num_xrr_sizes, size_id, screen;
|
int num_xrr_sizes, size_id, screen;
|
||||||
Rotation rotation;
|
Rotation rotation;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
win = DefaultRootWindow(priv->x11_display);
|
win = DefaultRootWindow (priv->x11_display);
|
||||||
screen = XRRRootToScreen(priv->x11_display, win);
|
screen = XRRRootToScreen (priv->x11_display, win);
|
||||||
|
|
||||||
xrr_config = XRRGetScreenInfo(priv->x11_display, win);
|
xrr_config = XRRGetScreenInfo (priv->x11_display, win);
|
||||||
if (!xrr_config)
|
if (!xrr_config)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
size_id = XRRConfigCurrentConfiguration(xrr_config, &rotation);
|
size_id = XRRConfigCurrentConfiguration (xrr_config, &rotation);
|
||||||
if (rotation == RR_Rotate_0 || rotation == RR_Rotate_180)
|
if (rotation == RR_Rotate_0 || rotation == RR_Rotate_180)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
xrr_sizes = XRRSizes(priv->x11_display, screen, &num_xrr_sizes);
|
xrr_sizes = XRRSizes (priv->x11_display, screen, &num_xrr_sizes);
|
||||||
if (!xrr_sizes || size_id >= num_xrr_sizes)
|
if (!xrr_sizes || size_id >= num_xrr_sizes)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
width_mm = xrr_sizes[size_id].mheight;
|
width_mm = xrr_sizes[size_id].mheight;
|
||||||
height_mm = xrr_sizes[size_id].mwidth;
|
height_mm = xrr_sizes[size_id].mwidth;
|
||||||
} while (0);
|
} while (0);
|
||||||
if (xrr_config)
|
if (xrr_config)
|
||||||
XRRFreeScreenConfigInfo(xrr_config);
|
XRRFreeScreenConfigInfo (xrr_config);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pwidth)
|
if (pwidth)
|
||||||
*pwidth = width_mm;
|
*pwidth = width_mm;
|
||||||
|
|
||||||
if (pheight)
|
if (pheight)
|
||||||
*pheight = height_mm;
|
*pheight = height_mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_x11_class_init(GstVaapiDisplayX11Class *klass)
|
gst_vaapi_display_x11_class_init (GstVaapiDisplayX11Class * klass)
|
||||||
{
|
{
|
||||||
GstVaapiMiniObjectClass * const object_class =
|
GstVaapiMiniObjectClass *const object_class =
|
||||||
GST_VAAPI_MINI_OBJECT_CLASS(klass);
|
GST_VAAPI_MINI_OBJECT_CLASS (klass);
|
||||||
GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
|
GstVaapiDisplayClass *const dpy_class = GST_VAAPI_DISPLAY_CLASS (klass);
|
||||||
|
|
||||||
gst_vaapi_display_class_init(&klass->parent_class);
|
gst_vaapi_display_class_init (&klass->parent_class);
|
||||||
|
|
||||||
object_class->size = sizeof(GstVaapiDisplayX11);
|
object_class->size = sizeof (GstVaapiDisplayX11);
|
||||||
dpy_class->display_types = g_display_types;
|
dpy_class->display_types = g_display_types;
|
||||||
dpy_class->bind_display = gst_vaapi_display_x11_bind_display;
|
dpy_class->bind_display = gst_vaapi_display_x11_bind_display;
|
||||||
dpy_class->open_display = gst_vaapi_display_x11_open_display;
|
dpy_class->open_display = gst_vaapi_display_x11_open_display;
|
||||||
dpy_class->close_display = gst_vaapi_display_x11_close_display;
|
dpy_class->close_display = gst_vaapi_display_x11_close_display;
|
||||||
dpy_class->sync = gst_vaapi_display_x11_sync;
|
dpy_class->sync = gst_vaapi_display_x11_sync;
|
||||||
dpy_class->flush = gst_vaapi_display_x11_flush;
|
dpy_class->flush = gst_vaapi_display_x11_flush;
|
||||||
dpy_class->get_display = gst_vaapi_display_x11_get_display_info;
|
dpy_class->get_display = gst_vaapi_display_x11_get_display_info;
|
||||||
dpy_class->get_size = gst_vaapi_display_x11_get_size;
|
dpy_class->get_size = gst_vaapi_display_x11_get_size;
|
||||||
dpy_class->get_size_mm = gst_vaapi_display_x11_get_size_mm;
|
dpy_class->get_size_mm = gst_vaapi_display_x11_get_size_mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const GstVaapiDisplayClass *
|
static inline const GstVaapiDisplayClass *
|
||||||
gst_vaapi_display_x11_class(void)
|
gst_vaapi_display_x11_class (void)
|
||||||
{
|
{
|
||||||
static GstVaapiDisplayX11Class g_class;
|
static GstVaapiDisplayX11Class g_class;
|
||||||
static gsize g_class_init = FALSE;
|
static gsize g_class_init = FALSE;
|
||||||
|
|
||||||
if (g_once_init_enter(&g_class_init)) {
|
if (g_once_init_enter (&g_class_init)) {
|
||||||
gst_vaapi_display_x11_class_init(&g_class);
|
gst_vaapi_display_x11_class_init (&g_class);
|
||||||
g_once_init_leave(&g_class_init, TRUE);
|
g_once_init_leave (&g_class_init, TRUE);
|
||||||
}
|
}
|
||||||
return GST_VAAPI_DISPLAY_CLASS(&g_class);
|
return GST_VAAPI_DISPLAY_CLASS (&g_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -412,10 +401,10 @@ gst_vaapi_display_x11_class(void)
|
||||||
* Return value: a newly allocated #GstVaapiDisplay object
|
* Return value: a newly allocated #GstVaapiDisplay object
|
||||||
*/
|
*/
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_x11_new(const gchar *display_name)
|
gst_vaapi_display_x11_new (const gchar * display_name)
|
||||||
{
|
{
|
||||||
return gst_vaapi_display_new(gst_vaapi_display_x11_class(),
|
return gst_vaapi_display_new (gst_vaapi_display_x11_class (),
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer)display_name);
|
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -430,12 +419,12 @@ gst_vaapi_display_x11_new(const gchar *display_name)
|
||||||
* Return value: a newly allocated #GstVaapiDisplay object
|
* Return value: a newly allocated #GstVaapiDisplay object
|
||||||
*/
|
*/
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_x11_new_with_display(Display *x11_display)
|
gst_vaapi_display_x11_new_with_display (Display * x11_display)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(x11_display, NULL);
|
g_return_val_if_fail (x11_display, NULL);
|
||||||
|
|
||||||
return gst_vaapi_display_new(gst_vaapi_display_x11_class(),
|
return gst_vaapi_display_new (gst_vaapi_display_x11_class (),
|
||||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, x11_display);
|
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, x11_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -449,11 +438,11 @@ gst_vaapi_display_x11_new_with_display(Display *x11_display)
|
||||||
* Return value: the X11 #Display attached to @display
|
* Return value: the X11 #Display attached to @display
|
||||||
*/
|
*/
|
||||||
Display *
|
Display *
|
||||||
gst_vaapi_display_x11_get_display(GstVaapiDisplayX11 *display)
|
gst_vaapi_display_x11_get_display (GstVaapiDisplayX11 * display)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY_X11(display), NULL);
|
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_X11 (display), NULL);
|
||||||
|
|
||||||
return GST_VAAPI_DISPLAY_XDISPLAY(display);
|
return GST_VAAPI_DISPLAY_XDISPLAY (display);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -467,11 +456,11 @@ gst_vaapi_display_x11_get_display(GstVaapiDisplayX11 *display)
|
||||||
* Return value: the X11 #Display attached to @display
|
* Return value: the X11 #Display attached to @display
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
gst_vaapi_display_x11_get_screen(GstVaapiDisplayX11 *display)
|
gst_vaapi_display_x11_get_screen (GstVaapiDisplayX11 * display)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_DISPLAY_X11(display), -1);
|
g_return_val_if_fail (GST_VAAPI_IS_DISPLAY_X11 (display), -1);
|
||||||
|
|
||||||
return GST_VAAPI_DISPLAY_XSCREEN(display);
|
return GST_VAAPI_DISPLAY_XSCREEN (display);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -486,120 +475,121 @@ gst_vaapi_display_x11_get_screen(GstVaapiDisplayX11 *display)
|
||||||
* @synchronous is %FALSE.
|
* @synchronous is %FALSE.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_vaapi_display_x11_set_synchronous(GstVaapiDisplayX11 *display,
|
gst_vaapi_display_x11_set_synchronous (GstVaapiDisplayX11 * display,
|
||||||
gboolean synchronous)
|
gboolean synchronous)
|
||||||
{
|
{
|
||||||
g_return_if_fail(GST_VAAPI_IS_DISPLAY_X11(display));
|
g_return_if_fail (GST_VAAPI_IS_DISPLAY_X11 (display));
|
||||||
|
|
||||||
set_synchronous(display, synchronous);
|
set_synchronous (display, synchronous);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct _GstVaapiPixmapFormatX11 GstVaapiPixmapFormatX11;
|
typedef struct _GstVaapiPixmapFormatX11 GstVaapiPixmapFormatX11;
|
||||||
struct _GstVaapiPixmapFormatX11 {
|
struct _GstVaapiPixmapFormatX11
|
||||||
GstVideoFormat format;
|
{
|
||||||
gint depth;
|
GstVideoFormat format;
|
||||||
gint bpp;
|
gint depth;
|
||||||
|
gint bpp;
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstVideoFormat
|
static GstVideoFormat
|
||||||
pix_fmt_to_video_format(gint depth, gint bpp)
|
pix_fmt_to_video_format (gint depth, gint bpp)
|
||||||
{
|
{
|
||||||
GstVideoFormat format = GST_VIDEO_FORMAT_UNKNOWN;
|
GstVideoFormat format = GST_VIDEO_FORMAT_UNKNOWN;
|
||||||
|
|
||||||
switch (bpp) {
|
switch (bpp) {
|
||||||
case 16:
|
case 16:
|
||||||
if (depth == 15)
|
if (depth == 15)
|
||||||
format = GST_VIDEO_FORMAT_RGB15;
|
format = GST_VIDEO_FORMAT_RGB15;
|
||||||
else if (depth == 16)
|
else if (depth == 16)
|
||||||
format = GST_VIDEO_FORMAT_RGB16;
|
format = GST_VIDEO_FORMAT_RGB16;
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
if (depth == 24)
|
if (depth == 24)
|
||||||
format = GST_VIDEO_FORMAT_RGB;
|
format = GST_VIDEO_FORMAT_RGB;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
if (depth == 24 || depth == 32)
|
if (depth == 24 || depth == 32)
|
||||||
format = GST_VIDEO_FORMAT_xRGB;
|
format = GST_VIDEO_FORMAT_xRGB;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
ensure_pix_fmts(GstVaapiDisplayX11 *display)
|
ensure_pix_fmts (GstVaapiDisplayX11 * display)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayX11Private * const priv =
|
GstVaapiDisplayX11Private *const priv =
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
XPixmapFormatValues *pix_fmts;
|
XPixmapFormatValues *pix_fmts;
|
||||||
int i, n, num_pix_fmts;
|
int i, n, num_pix_fmts;
|
||||||
|
|
||||||
if (priv->pixmap_formats)
|
if (priv->pixmap_formats)
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
GST_VAAPI_DISPLAY_LOCK(display);
|
|
||||||
pix_fmts = XListPixmapFormats(GST_VAAPI_DISPLAY_XDISPLAY(display),
|
|
||||||
&num_pix_fmts);
|
|
||||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
|
||||||
if (!pix_fmts)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
priv->pixmap_formats = g_array_sized_new(FALSE, FALSE,
|
|
||||||
sizeof(GstVaapiPixmapFormatX11), num_pix_fmts);
|
|
||||||
if (!priv->pixmap_formats) {
|
|
||||||
XFree(pix_fmts);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0, n = 0; i < num_pix_fmts; i++) {
|
|
||||||
GstVaapiPixmapFormatX11 * const pix_fmt =
|
|
||||||
&g_array_index(priv->pixmap_formats, GstVaapiPixmapFormatX11, n);
|
|
||||||
|
|
||||||
pix_fmt->depth = pix_fmts[i].depth;
|
|
||||||
pix_fmt->bpp = pix_fmts[i].bits_per_pixel;
|
|
||||||
pix_fmt->format = pix_fmt_to_video_format(pix_fmt->depth, pix_fmt->bpp);
|
|
||||||
if (pix_fmt->format != GST_VIDEO_FORMAT_UNKNOWN)
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
priv->pixmap_formats->len = n;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
GST_VAAPI_DISPLAY_LOCK (display);
|
||||||
|
pix_fmts = XListPixmapFormats (GST_VAAPI_DISPLAY_XDISPLAY (display),
|
||||||
|
&num_pix_fmts);
|
||||||
|
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||||
|
if (!pix_fmts)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
priv->pixmap_formats = g_array_sized_new (FALSE, FALSE,
|
||||||
|
sizeof (GstVaapiPixmapFormatX11), num_pix_fmts);
|
||||||
|
if (!priv->pixmap_formats) {
|
||||||
|
XFree (pix_fmts);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0, n = 0; i < num_pix_fmts; i++) {
|
||||||
|
GstVaapiPixmapFormatX11 *const pix_fmt =
|
||||||
|
&g_array_index (priv->pixmap_formats, GstVaapiPixmapFormatX11, n);
|
||||||
|
|
||||||
|
pix_fmt->depth = pix_fmts[i].depth;
|
||||||
|
pix_fmt->bpp = pix_fmts[i].bits_per_pixel;
|
||||||
|
pix_fmt->format = pix_fmt_to_video_format (pix_fmt->depth, pix_fmt->bpp);
|
||||||
|
if (pix_fmt->format != GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
priv->pixmap_formats->len = n;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the GstVideoFormat based on a supported Pixmap depth */
|
/* Determine the GstVideoFormat based on a supported Pixmap depth */
|
||||||
GstVideoFormat
|
GstVideoFormat
|
||||||
gst_vaapi_display_x11_get_pixmap_format(GstVaapiDisplayX11 *display,
|
gst_vaapi_display_x11_get_pixmap_format (GstVaapiDisplayX11 * display,
|
||||||
guint depth)
|
guint depth)
|
||||||
{
|
{
|
||||||
if (ensure_pix_fmts(display)) {
|
if (ensure_pix_fmts (display)) {
|
||||||
GstVaapiDisplayX11Private * const priv =
|
GstVaapiDisplayX11Private *const priv =
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
for (i = 0; i < priv->pixmap_formats->len; i++) {
|
for (i = 0; i < priv->pixmap_formats->len; i++) {
|
||||||
GstVaapiPixmapFormatX11 * const pix_fmt = &g_array_index(
|
GstVaapiPixmapFormatX11 *const pix_fmt =
|
||||||
priv->pixmap_formats, GstVaapiPixmapFormatX11, i);
|
&g_array_index (priv->pixmap_formats, GstVaapiPixmapFormatX11, i);
|
||||||
if (pix_fmt->depth == depth)
|
if (pix_fmt->depth == depth)
|
||||||
return pix_fmt->format;
|
return pix_fmt->format;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return GST_VIDEO_FORMAT_UNKNOWN;
|
}
|
||||||
|
return GST_VIDEO_FORMAT_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the Pixmap depth based on a GstVideoFormat */
|
/* Determine the Pixmap depth based on a GstVideoFormat */
|
||||||
guint
|
guint
|
||||||
gst_vaapi_display_x11_get_pixmap_depth(GstVaapiDisplayX11 *display,
|
gst_vaapi_display_x11_get_pixmap_depth (GstVaapiDisplayX11 * display,
|
||||||
GstVideoFormat format)
|
GstVideoFormat format)
|
||||||
{
|
{
|
||||||
if (ensure_pix_fmts(display)) {
|
if (ensure_pix_fmts (display)) {
|
||||||
GstVaapiDisplayX11Private * const priv =
|
GstVaapiDisplayX11Private *const priv =
|
||||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
for (i = 0; i < priv->pixmap_formats->len; i++) {
|
for (i = 0; i < priv->pixmap_formats->len; i++) {
|
||||||
GstVaapiPixmapFormatX11 * const pix_fmt = &g_array_index(
|
GstVaapiPixmapFormatX11 *const pix_fmt =
|
||||||
priv->pixmap_formats, GstVaapiPixmapFormatX11, i);
|
&g_array_index (priv->pixmap_formats, GstVaapiPixmapFormatX11, i);
|
||||||
if (pix_fmt->format == format)
|
if (pix_fmt->format == format)
|
||||||
return pix_fmt->depth;
|
return pix_fmt->depth;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,19 +36,19 @@ G_BEGIN_DECLS
|
||||||
typedef struct _GstVaapiDisplayX11 GstVaapiDisplayX11;
|
typedef struct _GstVaapiDisplayX11 GstVaapiDisplayX11;
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_x11_new(const gchar *display_name);
|
gst_vaapi_display_x11_new (const gchar * display_name);
|
||||||
|
|
||||||
GstVaapiDisplay *
|
GstVaapiDisplay *
|
||||||
gst_vaapi_display_x11_new_with_display(Display *x11_display);
|
gst_vaapi_display_x11_new_with_display (Display * x11_display);
|
||||||
|
|
||||||
Display *
|
Display *
|
||||||
gst_vaapi_display_x11_get_display(GstVaapiDisplayX11 *display);
|
gst_vaapi_display_x11_get_display (GstVaapiDisplayX11 * display);
|
||||||
|
|
||||||
int
|
int
|
||||||
gst_vaapi_display_x11_get_screen(GstVaapiDisplayX11 *display);
|
gst_vaapi_display_x11_get_screen (GstVaapiDisplayX11 * display);
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_x11_set_synchronous(GstVaapiDisplayX11 *display,
|
gst_vaapi_display_x11_set_synchronous (GstVaapiDisplayX11 * display,
|
||||||
gboolean synchronous);
|
gboolean synchronous);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -76,15 +76,16 @@ typedef struct _GstVaapiDisplayX11Class GstVaapiDisplayX11Class;
|
||||||
#define GST_VAAPI_DISPLAY_HAS_XRENDER(display) \
|
#define GST_VAAPI_DISPLAY_HAS_XRENDER(display) \
|
||||||
(GST_VAAPI_DISPLAY_X11_PRIVATE(display)->has_xrender)
|
(GST_VAAPI_DISPLAY_X11_PRIVATE(display)->has_xrender)
|
||||||
|
|
||||||
struct _GstVaapiDisplayX11Private {
|
struct _GstVaapiDisplayX11Private
|
||||||
gchar *display_name;
|
{
|
||||||
Display *x11_display;
|
gchar *display_name;
|
||||||
int x11_screen;
|
Display *x11_display;
|
||||||
GArray *pixmap_formats;
|
int x11_screen;
|
||||||
guint use_foreign_display : 1; // Foreign native_display?
|
GArray *pixmap_formats;
|
||||||
guint use_xrandr : 1;
|
guint use_foreign_display:1; // Foreign native_display?
|
||||||
guint has_xrender : 1; // Has XRender extension?
|
guint use_xrandr:1;
|
||||||
guint synchronous : 1;
|
guint has_xrender:1; // Has XRender extension?
|
||||||
|
guint synchronous:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,11 +93,12 @@ struct _GstVaapiDisplayX11Private {
|
||||||
*
|
*
|
||||||
* VA/X11 display wrapper.
|
* VA/X11 display wrapper.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayX11 {
|
struct _GstVaapiDisplayX11
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiDisplay parent_instance;
|
/*< private >*/
|
||||||
|
GstVaapiDisplay parent_instance;
|
||||||
|
|
||||||
GstVaapiDisplayX11Private priv;
|
GstVaapiDisplayX11Private priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,22 +106,23 @@ struct _GstVaapiDisplayX11 {
|
||||||
*
|
*
|
||||||
* VA/X11 display wrapper clas.
|
* VA/X11 display wrapper clas.
|
||||||
*/
|
*/
|
||||||
struct _GstVaapiDisplayX11Class {
|
struct _GstVaapiDisplayX11Class
|
||||||
/*< private >*/
|
{
|
||||||
GstVaapiDisplayClass parent_class;
|
/*< private >*/
|
||||||
|
GstVaapiDisplayClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_vaapi_display_x11_class_init(GstVaapiDisplayX11Class *klass);
|
gst_vaapi_display_x11_class_init (GstVaapiDisplayX11Class * klass);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GstVideoFormat
|
GstVideoFormat
|
||||||
gst_vaapi_display_x11_get_pixmap_format(GstVaapiDisplayX11 *display,
|
gst_vaapi_display_x11_get_pixmap_format (GstVaapiDisplayX11 * display,
|
||||||
guint depth);
|
guint depth);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
gst_vaapi_display_x11_get_pixmap_depth(GstVaapiDisplayX11 *display,
|
gst_vaapi_display_x11_get_pixmap_depth (GstVaapiDisplayX11 * display,
|
||||||
GstVideoFormat format);
|
GstVideoFormat format);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -29,134 +29,136 @@
|
||||||
#include "gstvaapidebug.h"
|
#include "gstvaapidebug.h"
|
||||||
|
|
||||||
typedef struct _CacheEntry CacheEntry;
|
typedef struct _CacheEntry CacheEntry;
|
||||||
struct _CacheEntry {
|
struct _CacheEntry
|
||||||
GstVaapiDisplayInfo info;
|
{
|
||||||
|
GstVaapiDisplayInfo info;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstVaapiDisplayCache {
|
struct _GstVaapiDisplayCache
|
||||||
GMutex mutex;
|
{
|
||||||
GList *list;
|
GMutex mutex;
|
||||||
|
GList *list;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cache_entry_free(CacheEntry *entry)
|
cache_entry_free (CacheEntry * entry)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayInfo *info;
|
GstVaapiDisplayInfo *info;
|
||||||
|
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
info = &entry->info;
|
info = &entry->info;
|
||||||
|
|
||||||
if (info->display_name) {
|
if (info->display_name) {
|
||||||
g_free(info->display_name);
|
g_free (info->display_name);
|
||||||
info->display_name = NULL;
|
info->display_name = NULL;
|
||||||
}
|
}
|
||||||
g_slice_free(CacheEntry, entry);
|
g_slice_free (CacheEntry, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CacheEntry *
|
static CacheEntry *
|
||||||
cache_entry_new(const GstVaapiDisplayInfo *di)
|
cache_entry_new (const GstVaapiDisplayInfo * di)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayInfo *info;
|
GstVaapiDisplayInfo *info;
|
||||||
CacheEntry *entry;
|
CacheEntry *entry;
|
||||||
|
|
||||||
entry = g_slice_new(CacheEntry);
|
entry = g_slice_new (CacheEntry);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
info = &entry->info;
|
info = &entry->info;
|
||||||
info->display = di->display;
|
info->display = di->display;
|
||||||
info->va_display = di->va_display;
|
info->va_display = di->va_display;
|
||||||
info->native_display = di->native_display;
|
info->native_display = di->native_display;
|
||||||
info->display_type = di->display_type;
|
info->display_type = di->display_type;
|
||||||
info->display_name = NULL;
|
info->display_name = NULL;
|
||||||
|
|
||||||
if (di->display_name) {
|
if (di->display_name) {
|
||||||
info->display_name = g_strdup(di->display_name);
|
info->display_name = g_strdup (di->display_name);
|
||||||
if (!info->display_name)
|
if (!info->display_name)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
return entry;
|
return entry;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
cache_entry_free(entry);
|
cache_entry_free (entry);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
is_compatible_display_type(const GstVaapiDisplayType display_type,
|
is_compatible_display_type (const GstVaapiDisplayType display_type,
|
||||||
guint display_types)
|
guint display_types)
|
||||||
{
|
{
|
||||||
if (display_type == GST_VAAPI_DISPLAY_TYPE_ANY)
|
if (display_type == GST_VAAPI_DISPLAY_TYPE_ANY)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (display_types == GST_VAAPI_DISPLAY_TYPE_ANY)
|
if (display_types == GST_VAAPI_DISPLAY_TYPE_ANY)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return ((1U << display_type) & display_types) != 0;
|
return ((1U << display_type) & display_types) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
cache_lookup_1(GstVaapiDisplayCache *cache, GCompareFunc func,
|
cache_lookup_1 (GstVaapiDisplayCache * cache, GCompareFunc func,
|
||||||
gconstpointer data, guint display_types)
|
gconstpointer data, guint display_types)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
g_mutex_lock(&cache->mutex);
|
g_mutex_lock (&cache->mutex);
|
||||||
for (l = cache->list; l != NULL; l = l->next) {
|
for (l = cache->list; l != NULL; l = l->next) {
|
||||||
GstVaapiDisplayInfo * const info = &((CacheEntry *)l->data)->info;
|
GstVaapiDisplayInfo *const info = &((CacheEntry *) l->data)->info;
|
||||||
if (!is_compatible_display_type(info->display_type, display_types))
|
if (!is_compatible_display_type (info->display_type, display_types))
|
||||||
continue;
|
continue;
|
||||||
if (func(info, data))
|
if (func (info, data))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_mutex_unlock(&cache->mutex);
|
g_mutex_unlock (&cache->mutex);
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const GstVaapiDisplayInfo *
|
static inline const GstVaapiDisplayInfo *
|
||||||
cache_lookup(GstVaapiDisplayCache *cache, GCompareFunc func,
|
cache_lookup (GstVaapiDisplayCache * cache, GCompareFunc func,
|
||||||
gconstpointer data, guint display_types)
|
gconstpointer data, guint display_types)
|
||||||
{
|
{
|
||||||
GList * const m = cache_lookup_1(cache, func, data, display_types);
|
GList *const m = cache_lookup_1 (cache, func, data, display_types);
|
||||||
|
|
||||||
return m ? &((CacheEntry *)m->data)->info : NULL;
|
return m ? &((CacheEntry *) m->data)->info : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
compare_display(gconstpointer a, gconstpointer display)
|
compare_display (gconstpointer a, gconstpointer display)
|
||||||
{
|
{
|
||||||
const GstVaapiDisplayInfo * const info = a;
|
const GstVaapiDisplayInfo *const info = a;
|
||||||
|
|
||||||
return info->display == display;
|
return info->display == display;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
compare_va_display(gconstpointer a, gconstpointer va_display)
|
compare_va_display (gconstpointer a, gconstpointer va_display)
|
||||||
{
|
{
|
||||||
const GstVaapiDisplayInfo * const info = a;
|
const GstVaapiDisplayInfo *const info = a;
|
||||||
|
|
||||||
return info->va_display == va_display;
|
return info->va_display == va_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
compare_native_display(gconstpointer a, gconstpointer native_display)
|
compare_native_display (gconstpointer a, gconstpointer native_display)
|
||||||
{
|
{
|
||||||
const GstVaapiDisplayInfo * const info = a;
|
const GstVaapiDisplayInfo *const info = a;
|
||||||
|
|
||||||
return info->native_display == native_display;
|
return info->native_display == native_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
compare_display_name(gconstpointer a, gconstpointer b)
|
compare_display_name (gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
const GstVaapiDisplayInfo * const info = a;
|
const GstVaapiDisplayInfo *const info = a;
|
||||||
const gchar * const display_name = b;
|
const gchar *const display_name = b;
|
||||||
|
|
||||||
if (info->display_name == NULL && display_name == NULL)
|
if (info->display_name == NULL && display_name == NULL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (!info->display_name || !display_name)
|
if (!info->display_name || !display_name)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return strcmp(info->display_name, display_name) == 0;
|
return strcmp (info->display_name, display_name) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,16 +169,16 @@ compare_display_name(gconstpointer a, gconstpointer b)
|
||||||
* Return value: the newly created #GstVaapiDisplayCache object
|
* Return value: the newly created #GstVaapiDisplayCache object
|
||||||
*/
|
*/
|
||||||
GstVaapiDisplayCache *
|
GstVaapiDisplayCache *
|
||||||
gst_vaapi_display_cache_new(void)
|
gst_vaapi_display_cache_new (void)
|
||||||
{
|
{
|
||||||
GstVaapiDisplayCache *cache;
|
GstVaapiDisplayCache *cache;
|
||||||
|
|
||||||
cache = g_slice_new0(GstVaapiDisplayCache);
|
cache = g_slice_new0 (GstVaapiDisplayCache);
|
||||||
if (!cache)
|
if (!cache)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
g_mutex_init(&cache->mutex);
|
g_mutex_init (&cache->mutex);
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,21 +188,21 @@ gst_vaapi_display_cache_new(void)
|
||||||
* Destroys a VA display cache.
|
* Destroys a VA display cache.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_vaapi_display_cache_free(GstVaapiDisplayCache *cache)
|
gst_vaapi_display_cache_free (GstVaapiDisplayCache * cache)
|
||||||
{
|
{
|
||||||
GList *l;
|
GList *l;
|
||||||
|
|
||||||
if (!cache)
|
if (!cache)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (cache->list) {
|
if (cache->list) {
|
||||||
for (l = cache->list; l != NULL; l = l->next)
|
for (l = cache->list; l != NULL; l = l->next)
|
||||||
cache_entry_free(l->data);
|
cache_entry_free (l->data);
|
||||||
g_list_free(cache->list);
|
g_list_free (cache->list);
|
||||||
cache->list = NULL;
|
cache->list = NULL;
|
||||||
}
|
}
|
||||||
g_mutex_clear(&cache->mutex);
|
g_mutex_clear (&cache->mutex);
|
||||||
g_slice_free(GstVaapiDisplayCache, cache);
|
g_slice_free (GstVaapiDisplayCache, cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -212,16 +214,16 @@ gst_vaapi_display_cache_free(GstVaapiDisplayCache *cache)
|
||||||
* Return value: the size of the display cache
|
* Return value: the size of the display cache
|
||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
gst_vaapi_display_cache_get_size(GstVaapiDisplayCache *cache)
|
gst_vaapi_display_cache_get_size (GstVaapiDisplayCache * cache)
|
||||||
{
|
{
|
||||||
guint size;
|
guint size;
|
||||||
|
|
||||||
g_return_val_if_fail(cache != NULL, 0);
|
g_return_val_if_fail (cache != NULL, 0);
|
||||||
|
|
||||||
g_mutex_lock(&cache->mutex);
|
g_mutex_lock (&cache->mutex);
|
||||||
size = g_list_length(cache->list);
|
size = g_list_length (cache->list);
|
||||||
g_mutex_unlock(&cache->mutex);
|
g_mutex_unlock (&cache->mutex);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,24 +237,22 @@ gst_vaapi_display_cache_get_size(GstVaapiDisplayCache *cache)
|
||||||
* Return value: %TRUE on success
|
* Return value: %TRUE on success
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_cache_add(
|
gst_vaapi_display_cache_add (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
GstVaapiDisplayInfo * info)
|
||||||
GstVaapiDisplayInfo *info
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
CacheEntry *entry;
|
CacheEntry *entry;
|
||||||
|
|
||||||
g_return_val_if_fail(cache != NULL, FALSE);
|
g_return_val_if_fail (cache != NULL, FALSE);
|
||||||
g_return_val_if_fail(info != NULL, FALSE);
|
g_return_val_if_fail (info != NULL, FALSE);
|
||||||
|
|
||||||
entry = cache_entry_new(info);
|
entry = cache_entry_new (info);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
g_mutex_lock(&cache->mutex);
|
g_mutex_lock (&cache->mutex);
|
||||||
cache->list = g_list_prepend(cache->list, entry);
|
cache->list = g_list_prepend (cache->list, entry);
|
||||||
g_mutex_unlock(&cache->mutex);
|
g_mutex_unlock (&cache->mutex);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -263,22 +263,20 @@ gst_vaapi_display_cache_add(
|
||||||
* Removes any cache entry that matches the specified #GstVaapiDisplay.
|
* Removes any cache entry that matches the specified #GstVaapiDisplay.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_vaapi_display_cache_remove(
|
gst_vaapi_display_cache_remove (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
GstVaapiDisplay * display)
|
||||||
GstVaapiDisplay *display
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
GList *m;
|
GList *m;
|
||||||
|
|
||||||
m = cache_lookup_1(cache, compare_display, display,
|
m = cache_lookup_1 (cache, compare_display, display,
|
||||||
GST_VAAPI_DISPLAY_TYPE_ANY);
|
GST_VAAPI_DISPLAY_TYPE_ANY);
|
||||||
if (!m)
|
if (!m)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cache_entry_free(m->data);
|
cache_entry_free (m->data);
|
||||||
g_mutex_lock(&cache->mutex);
|
g_mutex_lock (&cache->mutex);
|
||||||
cache->list = g_list_delete_link(cache->list, m);
|
cache->list = g_list_delete_link (cache->list, m);
|
||||||
g_mutex_unlock(&cache->mutex);
|
g_mutex_unlock (&cache->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -292,16 +290,14 @@ gst_vaapi_display_cache_remove(
|
||||||
* none was found
|
* none was found
|
||||||
*/
|
*/
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup(
|
gst_vaapi_display_cache_lookup (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
GstVaapiDisplay * display)
|
||||||
GstVaapiDisplay *display
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(cache != NULL, NULL);
|
g_return_val_if_fail (cache != NULL, NULL);
|
||||||
g_return_val_if_fail(display != NULL, NULL);
|
g_return_val_if_fail (display != NULL, NULL);
|
||||||
|
|
||||||
return cache_lookup(cache, compare_display, display,
|
return cache_lookup (cache, compare_display, display,
|
||||||
GST_VAAPI_DISPLAY_TYPE_ANY);
|
GST_VAAPI_DISPLAY_TYPE_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -324,17 +320,13 @@ gst_vaapi_display_cache_lookup(
|
||||||
* (i.e. returning %TRUE), or %NULL if none was found
|
* (i.e. returning %TRUE), or %NULL if none was found
|
||||||
*/
|
*/
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup_custom(
|
gst_vaapi_display_cache_lookup_custom (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
GCompareFunc func, gconstpointer data, guint display_types)
|
||||||
GCompareFunc func,
|
|
||||||
gconstpointer data,
|
|
||||||
guint display_types
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(cache != NULL, NULL);
|
g_return_val_if_fail (cache != NULL, NULL);
|
||||||
g_return_val_if_fail(func != NULL, NULL);
|
g_return_val_if_fail (func != NULL, NULL);
|
||||||
|
|
||||||
return cache_lookup(cache, func, data, display_types);
|
return cache_lookup (cache, func, data, display_types);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -348,16 +340,14 @@ gst_vaapi_display_cache_lookup_custom(
|
||||||
* if none was found
|
* if none was found
|
||||||
*/
|
*/
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup_by_va_display(
|
gst_vaapi_display_cache_lookup_by_va_display (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
VADisplay va_display)
|
||||||
VADisplay va_display
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(cache != NULL, NULL);
|
g_return_val_if_fail (cache != NULL, NULL);
|
||||||
g_return_val_if_fail(va_display != NULL, NULL);
|
g_return_val_if_fail (va_display != NULL, NULL);
|
||||||
|
|
||||||
return cache_lookup(cache, compare_va_display, va_display,
|
return cache_lookup (cache, compare_va_display, va_display,
|
||||||
GST_VAAPI_DISPLAY_TYPE_ANY);
|
GST_VAAPI_DISPLAY_TYPE_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,17 +361,14 @@ gst_vaapi_display_cache_lookup_by_va_display(
|
||||||
* %NULL if none was found
|
* %NULL if none was found
|
||||||
*/
|
*/
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup_by_native_display(
|
gst_vaapi_display_cache_lookup_by_native_display (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
gpointer native_display, guint display_types)
|
||||||
gpointer native_display,
|
|
||||||
guint display_types
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(cache != NULL, NULL);
|
g_return_val_if_fail (cache != NULL, NULL);
|
||||||
g_return_val_if_fail(native_display != NULL, NULL);
|
g_return_val_if_fail (native_display != NULL, NULL);
|
||||||
|
|
||||||
return cache_lookup(cache, compare_native_display, native_display,
|
return cache_lookup (cache, compare_native_display, native_display,
|
||||||
display_types);
|
display_types);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -395,14 +382,11 @@ gst_vaapi_display_cache_lookup_by_native_display(
|
||||||
* %NULL if none was found
|
* %NULL if none was found
|
||||||
*/
|
*/
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup_by_name(
|
gst_vaapi_display_cache_lookup_by_name (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
const gchar * display_name, guint display_types)
|
||||||
const gchar *display_name,
|
|
||||||
guint display_types
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(cache != NULL, NULL);
|
g_return_val_if_fail (cache != NULL, NULL);
|
||||||
|
|
||||||
return cache_lookup(cache, compare_display_name, display_name,
|
return cache_lookup (cache, compare_display_name, display_name,
|
||||||
display_types);
|
display_types);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,66 +25,48 @@
|
||||||
|
|
||||||
#include <gst/vaapi/gstvaapidisplay.h>
|
#include <gst/vaapi/gstvaapidisplay.h>
|
||||||
|
|
||||||
typedef struct _GstVaapiDisplayCache GstVaapiDisplayCache;
|
typedef struct _GstVaapiDisplayCache GstVaapiDisplayCache;
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GstVaapiDisplayCache *
|
GstVaapiDisplayCache *
|
||||||
gst_vaapi_display_cache_new(void);
|
gst_vaapi_display_cache_new (void);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gst_vaapi_display_cache_free(GstVaapiDisplayCache *cache);
|
gst_vaapi_display_cache_free (GstVaapiDisplayCache * cache);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
gst_vaapi_display_cache_get_size(GstVaapiDisplayCache *cache);
|
gst_vaapi_display_cache_get_size (GstVaapiDisplayCache * cache);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_display_cache_add(
|
gst_vaapi_display_cache_add (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
GstVaapiDisplayInfo * info);
|
||||||
GstVaapiDisplayInfo *info
|
|
||||||
);
|
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gst_vaapi_display_cache_remove(
|
gst_vaapi_display_cache_remove (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
GstVaapiDisplay * display);
|
||||||
GstVaapiDisplay *display
|
|
||||||
);
|
|
||||||
|
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup(
|
gst_vaapi_display_cache_lookup (GstVaapiDisplayCache
|
||||||
GstVaapiDisplayCache *cache,
|
* cache, GstVaapiDisplay * display);
|
||||||
GstVaapiDisplay *display
|
|
||||||
);
|
|
||||||
|
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup_custom(
|
gst_vaapi_display_cache_lookup_custom (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
GCompareFunc func, gconstpointer data, guint display_types);
|
||||||
GCompareFunc func,
|
|
||||||
gconstpointer data,
|
|
||||||
guint display_types
|
|
||||||
);
|
|
||||||
|
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup_by_va_display(
|
gst_vaapi_display_cache_lookup_by_va_display (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
VADisplay va_display);
|
||||||
VADisplay va_display
|
|
||||||
);
|
|
||||||
|
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup_by_native_display(
|
gst_vaapi_display_cache_lookup_by_native_display (GstVaapiDisplayCache *
|
||||||
GstVaapiDisplayCache *cache,
|
cache, gpointer native_display, guint display_types);
|
||||||
gpointer native_display,
|
|
||||||
guint display_types
|
|
||||||
);
|
|
||||||
|
|
||||||
const GstVaapiDisplayInfo *
|
const GstVaapiDisplayInfo *
|
||||||
gst_vaapi_display_cache_lookup_by_name(
|
gst_vaapi_display_cache_lookup_by_name (GstVaapiDisplayCache * cache,
|
||||||
GstVaapiDisplayCache *cache,
|
const gchar * display_name, guint display_types);
|
||||||
const gchar *display_name,
|
|
||||||
guint display_types
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif /* GSTVAAPIDISPLAYCACHE_H */
|
#endif /* GSTVAAPIDISPLAYCACHE_H */
|
||||||
|
|
Loading…
Reference in a new issue