mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +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,7 +47,8 @@ typedef struct _GstVaapiDisplay GstVaapiDisplay;
|
|||
* @GST_VAAPI_DISPLAY_TYPE_WAYLAND: VA/Wayland 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_GLX,
|
||||
|
@ -59,10 +60,10 @@ typedef enum {
|
|||
(gst_vaapi_display_type_get_type())
|
||||
|
||||
GType
|
||||
gst_vaapi_display_type_get_type(void) G_GNUC_CONST;
|
||||
gst_vaapi_display_type_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_type_is_compatible(GstVaapiDisplayType type1,
|
||||
gst_vaapi_display_type_is_compatible (GstVaapiDisplayType type1,
|
||||
GstVaapiDisplayType type2);
|
||||
|
||||
/**
|
||||
|
@ -70,7 +71,8 @@ gst_vaapi_display_type_is_compatible(GstVaapiDisplayType type1,
|
|||
*
|
||||
* Generic class to retrieve VA display info
|
||||
*/
|
||||
struct _GstVaapiDisplayInfo {
|
||||
struct _GstVaapiDisplayInfo
|
||||
{
|
||||
GstVaapiDisplay *display;
|
||||
GstVaapiDisplayType display_type;
|
||||
gchar *display_name;
|
||||
|
@ -95,122 +97,103 @@ struct _GstVaapiDisplayInfo {
|
|||
#define GST_VAAPI_DISPLAY_PROP_CONTRAST "contrast"
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_new_with_display(VADisplay va_display);
|
||||
gst_vaapi_display_new_with_display (VADisplay va_display);
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_ref(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_ref (GstVaapiDisplay * display);
|
||||
|
||||
void
|
||||
gst_vaapi_display_unref(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_unref (GstVaapiDisplay * display);
|
||||
|
||||
void
|
||||
gst_vaapi_display_replace(GstVaapiDisplay **old_display_ptr,
|
||||
GstVaapiDisplay *new_display);
|
||||
gst_vaapi_display_replace (GstVaapiDisplay ** old_display_ptr,
|
||||
GstVaapiDisplay * new_display);
|
||||
|
||||
void
|
||||
gst_vaapi_display_lock(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_lock (GstVaapiDisplay * display);
|
||||
|
||||
void
|
||||
gst_vaapi_display_unlock(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_unlock (GstVaapiDisplay * display);
|
||||
|
||||
void
|
||||
gst_vaapi_display_sync(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_sync (GstVaapiDisplay * display);
|
||||
|
||||
void
|
||||
gst_vaapi_display_flush(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_flush (GstVaapiDisplay * display);
|
||||
|
||||
GstVaapiDisplayType
|
||||
gst_vaapi_display_get_display_type(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_get_display_type (GstVaapiDisplay * display);
|
||||
|
||||
VADisplay
|
||||
gst_vaapi_display_get_display(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_get_display (GstVaapiDisplay * display);
|
||||
|
||||
guint
|
||||
gst_vaapi_display_get_width(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_get_width (GstVaapiDisplay * display);
|
||||
|
||||
guint
|
||||
gst_vaapi_display_get_height(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_get_height (GstVaapiDisplay * display);
|
||||
|
||||
void
|
||||
gst_vaapi_display_get_size(GstVaapiDisplay *display, guint *pwidth, guint *pheight);
|
||||
gst_vaapi_display_get_size (GstVaapiDisplay * display, guint * pwidth,
|
||||
guint * pheight);
|
||||
|
||||
void
|
||||
gst_vaapi_display_get_pixel_aspect_ratio(
|
||||
GstVaapiDisplay *display,
|
||||
guint *par_n,
|
||||
guint *par_d
|
||||
);
|
||||
gst_vaapi_display_get_pixel_aspect_ratio (GstVaapiDisplay * display,
|
||||
guint * par_n, guint * par_d);
|
||||
|
||||
GstCaps *
|
||||
gst_vaapi_display_get_decode_caps(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_get_decode_caps (GstVaapiDisplay * display);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_has_decoder(
|
||||
GstVaapiDisplay *display,
|
||||
GstVaapiProfile profile,
|
||||
GstVaapiEntrypoint entrypoint
|
||||
);
|
||||
gst_vaapi_display_has_decoder (GstVaapiDisplay * display,
|
||||
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
|
||||
|
||||
GstCaps *
|
||||
gst_vaapi_display_get_encode_caps(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_get_encode_caps (GstVaapiDisplay * display);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_has_encoder(
|
||||
GstVaapiDisplay *display,
|
||||
GstVaapiProfile profile,
|
||||
GstVaapiEntrypoint entrypoint
|
||||
);
|
||||
gst_vaapi_display_has_encoder (GstVaapiDisplay * display,
|
||||
GstVaapiProfile profile, GstVaapiEntrypoint entrypoint);
|
||||
|
||||
GstCaps *
|
||||
gst_vaapi_display_get_image_caps(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_get_image_caps (GstVaapiDisplay * display);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_has_image_format(
|
||||
GstVaapiDisplay *display,
|
||||
GstVideoFormat format
|
||||
);
|
||||
gst_vaapi_display_has_image_format (GstVaapiDisplay * display,
|
||||
GstVideoFormat format);
|
||||
|
||||
GstCaps *
|
||||
gst_vaapi_display_get_subpicture_caps(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_get_subpicture_caps (GstVaapiDisplay * display);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_has_subpicture_format(
|
||||
GstVaapiDisplay *display,
|
||||
GstVideoFormat format,
|
||||
guint *flags_ptr
|
||||
);
|
||||
gst_vaapi_display_has_subpicture_format (GstVaapiDisplay * display,
|
||||
GstVideoFormat format, guint * flags_ptr);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_has_property(GstVaapiDisplay *display, const gchar *name);
|
||||
gst_vaapi_display_has_property (GstVaapiDisplay * display, const gchar * name);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_get_property(GstVaapiDisplay *display, const gchar *name,
|
||||
GValue *out_value);
|
||||
gst_vaapi_display_get_property (GstVaapiDisplay * display, const gchar * name,
|
||||
GValue * out_value);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_set_property(GstVaapiDisplay *display, const gchar *name,
|
||||
const GValue *value);
|
||||
gst_vaapi_display_set_property (GstVaapiDisplay * display, const gchar * name,
|
||||
const GValue * value);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_get_render_mode(
|
||||
GstVaapiDisplay *display,
|
||||
GstVaapiRenderMode *pmode
|
||||
);
|
||||
gst_vaapi_display_get_render_mode (GstVaapiDisplay * display,
|
||||
GstVaapiRenderMode * pmode);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_set_render_mode(
|
||||
GstVaapiDisplay *display,
|
||||
GstVaapiRenderMode mode
|
||||
);
|
||||
gst_vaapi_display_set_render_mode (GstVaapiDisplay * display,
|
||||
GstVaapiRenderMode mode);
|
||||
|
||||
GstVaapiRotation
|
||||
gst_vaapi_display_get_rotation(GstVaapiDisplay *display);
|
||||
gst_vaapi_display_get_rotation (GstVaapiDisplay * display);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_display_set_rotation(
|
||||
GstVaapiDisplay *display,
|
||||
GstVaapiRotation rotation
|
||||
);
|
||||
gst_vaapi_display_set_rotation (GstVaapiDisplay * display,
|
||||
GstVaapiRotation rotation);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_DRM;
|
|||
|
||||
/* Get default device path. Actually, the first match in the DRM subsystem */
|
||||
static const gchar *
|
||||
get_default_device_path(GstVaapiDisplay *display)
|
||||
get_default_device_path (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayDRMPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
||||
GstVaapiDisplayDRMPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||
const gchar *syspath, *devpath;
|
||||
struct udev *udev = NULL;
|
||||
struct udev_device *device, *parent;
|
||||
|
@ -56,53 +56,53 @@ get_default_device_path(GstVaapiDisplay *display)
|
|||
int fd;
|
||||
|
||||
if (!priv->device_path_default) {
|
||||
udev = udev_new();
|
||||
udev = udev_new ();
|
||||
if (!udev)
|
||||
goto end;
|
||||
|
||||
e = udev_enumerate_new(udev);
|
||||
e = udev_enumerate_new (udev);
|
||||
if (!e)
|
||||
goto end;
|
||||
|
||||
udev_enumerate_add_match_subsystem(e, "drm");
|
||||
udev_enumerate_scan_devices(e);
|
||||
udev_list_entry_foreach(l, udev_enumerate_get_list_entry(e)) {
|
||||
syspath = udev_list_entry_get_name(l);
|
||||
device = udev_device_new_from_syspath(udev, syspath);
|
||||
parent = udev_device_get_parent(device);
|
||||
if (strcmp(udev_device_get_subsystem(parent), "pci") != 0) {
|
||||
udev_device_unref(device);
|
||||
udev_enumerate_add_match_subsystem (e, "drm");
|
||||
udev_enumerate_scan_devices (e);
|
||||
udev_list_entry_foreach (l, udev_enumerate_get_list_entry (e)) {
|
||||
syspath = udev_list_entry_get_name (l);
|
||||
device = udev_device_new_from_syspath (udev, syspath);
|
||||
parent = udev_device_get_parent (device);
|
||||
if (strcmp (udev_device_get_subsystem (parent), "pci") != 0) {
|
||||
udev_device_unref (device);
|
||||
continue;
|
||||
}
|
||||
|
||||
devpath = udev_device_get_devnode(device);
|
||||
fd = open(devpath, O_RDWR|O_CLOEXEC);
|
||||
devpath = udev_device_get_devnode (device);
|
||||
fd = open (devpath, O_RDWR | O_CLOEXEC);
|
||||
if (fd < 0) {
|
||||
udev_device_unref(device);
|
||||
udev_device_unref (device);
|
||||
continue;
|
||||
}
|
||||
|
||||
priv->device_path_default = g_strdup(devpath);
|
||||
close(fd);
|
||||
udev_device_unref(device);
|
||||
priv->device_path_default = g_strdup (devpath);
|
||||
close (fd);
|
||||
udev_device_unref (device);
|
||||
break;
|
||||
}
|
||||
|
||||
end:
|
||||
if (e)
|
||||
udev_enumerate_unref(e);
|
||||
udev_enumerate_unref (e);
|
||||
if (udev)
|
||||
udev_unref(udev);
|
||||
udev_unref (udev);
|
||||
}
|
||||
return priv->device_path_default;
|
||||
}
|
||||
|
||||
/* Reconstruct a device path without our prefix */
|
||||
static const gchar *
|
||||
get_device_path(GstVaapiDisplay *display)
|
||||
get_device_path (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayDRMPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
||||
GstVaapiDisplayDRMPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||
const gchar *device_path = priv->device_path;
|
||||
|
||||
if (!device_path || *device_path == '\0')
|
||||
|
@ -112,29 +112,29 @@ get_device_path(GstVaapiDisplay *display)
|
|||
|
||||
/* Mangle device path with our prefix */
|
||||
static gboolean
|
||||
set_device_path(GstVaapiDisplay *display, const gchar *device_path)
|
||||
set_device_path (GstVaapiDisplay * display, const gchar * device_path)
|
||||
{
|
||||
GstVaapiDisplayDRMPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
||||
GstVaapiDisplayDRMPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||
|
||||
g_free(priv->device_path);
|
||||
g_free (priv->device_path);
|
||||
priv->device_path = NULL;
|
||||
|
||||
if (!device_path) {
|
||||
device_path = get_default_device_path(display);
|
||||
device_path = get_default_device_path (display);
|
||||
if (!device_path)
|
||||
return FALSE;
|
||||
}
|
||||
priv->device_path = g_strdup(device_path);
|
||||
priv->device_path = g_strdup (device_path);
|
||||
return priv->device_path != NULL;
|
||||
}
|
||||
|
||||
/* Set device path from file descriptor */
|
||||
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 =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
||||
GstVaapiDisplayDRMPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||
const gchar *busid, *path, *str;
|
||||
gsize busid_length, path_length;
|
||||
struct udev *udev = NULL;
|
||||
|
@ -143,98 +143,98 @@ set_device_path_from_fd(GstVaapiDisplay *display, gint drm_device)
|
|||
struct udev_list_entry *l;
|
||||
gboolean success = FALSE;
|
||||
|
||||
g_free(priv->device_path);
|
||||
g_free (priv->device_path);
|
||||
priv->device_path = NULL;
|
||||
|
||||
if (drm_device < 0)
|
||||
goto end;
|
||||
|
||||
busid = drmGetBusid(drm_device);
|
||||
busid = drmGetBusid (drm_device);
|
||||
if (!busid)
|
||||
goto end;
|
||||
if (strncmp(busid, "pci:", 4) != 0)
|
||||
if (strncmp (busid, "pci:", 4) != 0)
|
||||
goto end;
|
||||
busid += 4;
|
||||
busid_length = strlen(busid);
|
||||
busid_length = strlen (busid);
|
||||
|
||||
udev = udev_new();
|
||||
udev = udev_new ();
|
||||
if (!udev)
|
||||
goto end;
|
||||
|
||||
e = udev_enumerate_new(udev);
|
||||
e = udev_enumerate_new (udev);
|
||||
if (!e)
|
||||
goto end;
|
||||
|
||||
udev_enumerate_add_match_subsystem(e, "drm");
|
||||
udev_enumerate_scan_devices(e);
|
||||
udev_list_entry_foreach(l, udev_enumerate_get_list_entry(e)) {
|
||||
path = udev_list_entry_get_name(l);
|
||||
str = strstr(path, busid);
|
||||
udev_enumerate_add_match_subsystem (e, "drm");
|
||||
udev_enumerate_scan_devices (e);
|
||||
udev_list_entry_foreach (l, udev_enumerate_get_list_entry (e)) {
|
||||
path = udev_list_entry_get_name (l);
|
||||
str = strstr (path, busid);
|
||||
if (!str || str <= path || str[-1] != '/')
|
||||
continue;
|
||||
|
||||
path_length = strlen(path);
|
||||
path_length = strlen (path);
|
||||
if (str + busid_length >= path + path_length)
|
||||
continue;
|
||||
if (strncmp(&str[busid_length], "/drm/card", 9) != 0)
|
||||
if (strncmp (&str[busid_length], "/drm/card", 9) != 0)
|
||||
continue;
|
||||
|
||||
device = udev_device_new_from_syspath(udev, path);
|
||||
device = udev_device_new_from_syspath (udev, path);
|
||||
if (!device)
|
||||
continue;
|
||||
|
||||
path = udev_device_get_devnode(device);
|
||||
priv->device_path = g_strdup(path);
|
||||
udev_device_unref(device);
|
||||
path = udev_device_get_devnode (device);
|
||||
priv->device_path = g_strdup (path);
|
||||
udev_device_unref (device);
|
||||
break;
|
||||
}
|
||||
success = TRUE;
|
||||
|
||||
end:
|
||||
if (e)
|
||||
udev_enumerate_unref(e);
|
||||
udev_enumerate_unref (e);
|
||||
if (udev)
|
||||
udev_unref(udev);
|
||||
udev_unref (udev);
|
||||
return success;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_vaapi_display_drm_bind_display(GstVaapiDisplay *display,
|
||||
gst_vaapi_display_drm_bind_display (GstVaapiDisplay * display,
|
||||
gpointer native_display)
|
||||
{
|
||||
GstVaapiDisplayDRMPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
||||
GstVaapiDisplayDRMPrivate *const priv =
|
||||
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))
|
||||
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)
|
||||
gst_vaapi_display_drm_open_display (GstVaapiDisplay * display,
|
||||
const gchar * name)
|
||||
{
|
||||
GstVaapiDisplayDRMPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
||||
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);
|
||||
cache = gst_vaapi_display_get_cache ();
|
||||
g_return_val_if_fail (cache != NULL, FALSE);
|
||||
|
||||
if (!set_device_path(display, name))
|
||||
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));
|
||||
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->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);
|
||||
} 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;
|
||||
|
@ -243,54 +243,54 @@ gst_vaapi_display_drm_open_display(GstVaapiDisplay *display, const gchar *name)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_drm_close_display(GstVaapiDisplay *display)
|
||||
gst_vaapi_display_drm_close_display (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayDRMPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
||||
GstVaapiDisplayDRMPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||
|
||||
if (priv->drm_device >= 0) {
|
||||
if (!priv->use_foreign_display)
|
||||
close(priv->drm_device);
|
||||
close (priv->drm_device);
|
||||
priv->drm_device = -1;
|
||||
}
|
||||
|
||||
if (priv->device_path) {
|
||||
g_free(priv->device_path);
|
||||
g_free (priv->device_path);
|
||||
priv->device_path = NULL;
|
||||
}
|
||||
|
||||
if (priv->device_path_default) {
|
||||
g_free(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)
|
||||
gst_vaapi_display_drm_get_display_info (GstVaapiDisplay * display,
|
||||
GstVaapiDisplayInfo * info)
|
||||
{
|
||||
GstVaapiDisplayDRMPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
||||
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();
|
||||
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));
|
||||
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->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);
|
||||
info->va_display = vaGetDisplayDRM (priv->drm_device);
|
||||
if (!info->va_display)
|
||||
return FALSE;
|
||||
info->display_type = GST_VAAPI_DISPLAY_TYPE_DRM;
|
||||
|
@ -299,24 +299,24 @@ gst_vaapi_display_drm_get_display_info(GstVaapiDisplay *display,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_drm_init(GstVaapiDisplay *display)
|
||||
gst_vaapi_display_drm_init (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayDRMPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
|
||||
GstVaapiDisplayDRMPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE (display);
|
||||
|
||||
priv->drm_device = -1;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_drm_class_init(GstVaapiDisplayDRMClass *klass)
|
||||
gst_vaapi_display_drm_class_init (GstVaapiDisplayDRMClass * klass)
|
||||
{
|
||||
GstVaapiMiniObjectClass * const object_class =
|
||||
GST_VAAPI_MINI_OBJECT_CLASS(klass);
|
||||
GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
|
||||
GstVaapiMiniObjectClass *const object_class =
|
||||
GST_VAAPI_MINI_OBJECT_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(GstVaapiDisplayDRM);
|
||||
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;
|
||||
|
@ -326,16 +326,16 @@ gst_vaapi_display_drm_class_init(GstVaapiDisplayDRMClass *klass)
|
|||
}
|
||||
|
||||
static inline const GstVaapiDisplayClass *
|
||||
gst_vaapi_display_drm_class(void)
|
||||
gst_vaapi_display_drm_class (void)
|
||||
{
|
||||
static GstVaapiDisplayDRMClass g_class;
|
||||
static gsize g_class_init = FALSE;
|
||||
|
||||
if (g_once_init_enter(&g_class_init)) {
|
||||
gst_vaapi_display_drm_class_init(&g_class);
|
||||
g_once_init_leave(&g_class_init, TRUE);
|
||||
if (g_once_init_enter (&g_class_init)) {
|
||||
gst_vaapi_display_drm_class_init (&g_class);
|
||||
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
|
||||
*/
|
||||
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(),
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer)device_path);
|
||||
return gst_vaapi_display_new (gst_vaapi_display_drm_class (),
|
||||
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
|
||||
*/
|
||||
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(),
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY, GINT_TO_POINTER(device));
|
||||
return gst_vaapi_display_new (gst_vaapi_display_drm_class (),
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_drm_new(const gchar *device_path);
|
||||
gst_vaapi_display_drm_new (const gchar * device_path);
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_drm_new_with_device(gint device);
|
||||
gst_vaapi_display_drm_new_with_device (gint device);
|
||||
|
||||
gint
|
||||
gst_vaapi_display_drm_get_device(GstVaapiDisplayDRM *display);
|
||||
gst_vaapi_display_drm_get_device (GstVaapiDisplayDRM * display);
|
||||
|
||||
const gchar *
|
||||
gst_vaapi_display_drm_get_device_path(GstVaapiDisplayDRM *display);
|
||||
gst_vaapi_display_drm_get_device_path (GstVaapiDisplayDRM *
|
||||
display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -51,11 +51,12 @@ typedef struct _GstVaapiDisplayDRMClass GstVaapiDisplayDRMClass;
|
|||
#define GST_VAAPI_DISPLAY_DRM_DEVICE(display) \
|
||||
GST_VAAPI_DISPLAY_DRM_PRIVATE(display)->drm_device
|
||||
|
||||
struct _GstVaapiDisplayDRMPrivate {
|
||||
struct _GstVaapiDisplayDRMPrivate
|
||||
{
|
||||
gchar *device_path_default;
|
||||
gchar *device_path;
|
||||
gint drm_device;
|
||||
guint use_foreign_display : 1; // Foreign native_display?
|
||||
guint use_foreign_display:1; // Foreign native_display?
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -63,7 +64,8 @@ struct _GstVaapiDisplayDRMPrivate {
|
|||
*
|
||||
* VA/DRM display wrapper.
|
||||
*/
|
||||
struct _GstVaapiDisplayDRM {
|
||||
struct _GstVaapiDisplayDRM
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiDisplay parent_instance;
|
||||
|
||||
|
@ -75,7 +77,8 @@ struct _GstVaapiDisplayDRM {
|
|||
*
|
||||
* VA/DRM display wrapper clas.
|
||||
*/
|
||||
struct _GstVaapiDisplayDRMClass {
|
||||
struct _GstVaapiDisplayDRMClass
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiDisplayClass parent_class;
|
||||
};
|
||||
|
|
|
@ -42,47 +42,45 @@
|
|||
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_GLX;
|
||||
|
||||
static gboolean
|
||||
gst_vaapi_display_glx_get_display_info(
|
||||
GstVaapiDisplay *display,
|
||||
GstVaapiDisplayInfo *info
|
||||
)
|
||||
gst_vaapi_display_glx_get_display_info (GstVaapiDisplay * display,
|
||||
GstVaapiDisplayInfo * info)
|
||||
{
|
||||
const GstVaapiDisplayGLXClass * const klass =
|
||||
GST_VAAPI_DISPLAY_GLX_GET_CLASS(display);
|
||||
const GstVaapiDisplayGLXClass *const klass =
|
||||
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)
|
||||
return FALSE;
|
||||
info->display_type = GST_VAAPI_DISPLAY_TYPE_GLX;
|
||||
return klass->parent_get_display(display, info);
|
||||
return klass->parent_get_display (display, info);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_glx_class_init(GstVaapiDisplayGLXClass *klass)
|
||||
gst_vaapi_display_glx_class_init (GstVaapiDisplayGLXClass * klass)
|
||||
{
|
||||
GstVaapiMiniObjectClass * const object_class =
|
||||
GST_VAAPI_MINI_OBJECT_CLASS(klass);
|
||||
GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
|
||||
GstVaapiMiniObjectClass *const object_class =
|
||||
GST_VAAPI_MINI_OBJECT_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;
|
||||
dpy_class->display_types = g_display_types;
|
||||
dpy_class->get_display = gst_vaapi_display_glx_get_display_info;
|
||||
}
|
||||
|
||||
static inline const GstVaapiDisplayClass *
|
||||
gst_vaapi_display_glx_class(void)
|
||||
gst_vaapi_display_glx_class (void)
|
||||
{
|
||||
static GstVaapiDisplayGLXClass g_class;
|
||||
static gsize g_class_init = FALSE;
|
||||
|
||||
if (g_once_init_enter(&g_class_init)) {
|
||||
gst_vaapi_display_glx_class_init(&g_class);
|
||||
g_once_init_leave(&g_class_init, TRUE);
|
||||
if (g_once_init_enter (&g_class_init)) {
|
||||
gst_vaapi_display_glx_class_init (&g_class);
|
||||
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
|
||||
*/
|
||||
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(),
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer)display_name);
|
||||
return gst_vaapi_display_new (gst_vaapi_display_glx_class (),
|
||||
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
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -37,10 +37,10 @@ G_BEGIN_DECLS
|
|||
typedef struct _GstVaapiDisplayGLX GstVaapiDisplayGLX;
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_glx_new(const gchar *display_name);
|
||||
gst_vaapi_display_glx_new (const gchar * display_name);
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_glx_new_with_display(Display *x11_display);
|
||||
gst_vaapi_display_glx_new_with_display (Display * x11_display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -49,7 +49,8 @@ typedef struct _GstVaapiDisplayGLXClass GstVaapiDisplayGLXClass;
|
|||
*
|
||||
* VA/GLX display wrapper.
|
||||
*/
|
||||
struct _GstVaapiDisplayGLX {
|
||||
struct _GstVaapiDisplayGLX
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiDisplayX11 parent_instance;
|
||||
};
|
||||
|
@ -59,7 +60,8 @@ struct _GstVaapiDisplayGLX {
|
|||
*
|
||||
* VA/GLX display wrapper clas.
|
||||
*/
|
||||
struct _GstVaapiDisplayGLXClass {
|
||||
struct _GstVaapiDisplayGLXClass
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiDisplayX11Class parent_class;
|
||||
|
||||
|
|
|
@ -50,22 +50,22 @@ typedef struct _GstVaapiDisplayPrivate GstVaapiDisplayPrivate;
|
|||
typedef struct _GstVaapiDisplayClass GstVaapiDisplayClass;
|
||||
typedef enum _GstVaapiDisplayInitType GstVaapiDisplayInitType;
|
||||
|
||||
typedef void (*GstVaapiDisplayInitFunc) (GstVaapiDisplay *display);
|
||||
typedef gboolean (*GstVaapiDisplayBindFunc) (GstVaapiDisplay *display,
|
||||
typedef void (*GstVaapiDisplayInitFunc) (GstVaapiDisplay * display);
|
||||
typedef gboolean (*GstVaapiDisplayBindFunc) (GstVaapiDisplay * display,
|
||||
gpointer native_dpy);
|
||||
typedef gboolean (*GstVaapiDisplayOpenFunc) (GstVaapiDisplay *display,
|
||||
const gchar *name);
|
||||
typedef void (*GstVaapiDisplayCloseFunc) (GstVaapiDisplay *display);
|
||||
typedef void (*GstVaapiDisplayLockFunc) (GstVaapiDisplay *display);
|
||||
typedef void (*GstVaapiDisplayUnlockFunc) (GstVaapiDisplay *display);
|
||||
typedef void (*GstVaapiDisplaySyncFunc) (GstVaapiDisplay *display);
|
||||
typedef void (*GstVaapiDisplayFlushFunc) (GstVaapiDisplay *display);
|
||||
typedef gboolean (*GstVaapiDisplayGetInfoFunc) (GstVaapiDisplay *display,
|
||||
GstVaapiDisplayInfo *info);
|
||||
typedef void (*GstVaapiDisplayGetSizeFunc) (GstVaapiDisplay *display,
|
||||
guint *pwidth, guint *pheight);
|
||||
typedef void (*GstVaapiDisplayGetSizeMFunc)(GstVaapiDisplay *display,
|
||||
guint *pwidth, guint *pheight);
|
||||
typedef gboolean (*GstVaapiDisplayOpenFunc) (GstVaapiDisplay * display,
|
||||
const gchar * name);
|
||||
typedef void (*GstVaapiDisplayCloseFunc) (GstVaapiDisplay * display);
|
||||
typedef void (*GstVaapiDisplayLockFunc) (GstVaapiDisplay * display);
|
||||
typedef void (*GstVaapiDisplayUnlockFunc) (GstVaapiDisplay * display);
|
||||
typedef void (*GstVaapiDisplaySyncFunc) (GstVaapiDisplay * display);
|
||||
typedef void (*GstVaapiDisplayFlushFunc) (GstVaapiDisplay * display);
|
||||
typedef gboolean (*GstVaapiDisplayGetInfoFunc) (GstVaapiDisplay * display,
|
||||
GstVaapiDisplayInfo * info);
|
||||
typedef void (*GstVaapiDisplayGetSizeFunc) (GstVaapiDisplay * display,
|
||||
guint * pwidth, guint * pheight);
|
||||
typedef void (*GstVaapiDisplayGetSizeMFunc) (GstVaapiDisplay * display,
|
||||
guint * pwidth, guint * pheight);
|
||||
|
||||
/**
|
||||
* GST_VAAPI_DISPLAY_VADISPLAY:
|
||||
|
@ -128,7 +128,8 @@ typedef void (*GstVaapiDisplayGetSizeMFunc)(GstVaapiDisplay *display,
|
|||
#define GST_VAAPI_DISPLAY_HAS_VPP(display) \
|
||||
(GST_VAAPI_DISPLAY_GET_PRIVATE(display)->has_vpp)
|
||||
|
||||
struct _GstVaapiDisplayPrivate {
|
||||
struct _GstVaapiDisplayPrivate
|
||||
{
|
||||
GstVaapiDisplay *parent;
|
||||
GRecMutex mutex;
|
||||
GstVaapiDisplayType display_type;
|
||||
|
@ -144,8 +145,8 @@ struct _GstVaapiDisplayPrivate {
|
|||
GArray *image_formats;
|
||||
GArray *subpicture_formats;
|
||||
GArray *properties;
|
||||
guint use_foreign_display : 1;
|
||||
guint has_vpp : 1;
|
||||
guint use_foreign_display:1;
|
||||
guint has_vpp:1;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -153,7 +154,8 @@ struct _GstVaapiDisplayPrivate {
|
|||
*
|
||||
* Base class for VA displays.
|
||||
*/
|
||||
struct _GstVaapiDisplay {
|
||||
struct _GstVaapiDisplay
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiMiniObject parent_instance;
|
||||
|
||||
|
@ -174,7 +176,8 @@ struct _GstVaapiDisplay {
|
|||
*
|
||||
* Base class for VA displays.
|
||||
*/
|
||||
struct _GstVaapiDisplayClass {
|
||||
struct _GstVaapiDisplayClass
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiMiniObjectClass parent_class;
|
||||
|
||||
|
@ -196,27 +199,28 @@ struct _GstVaapiDisplayClass {
|
|||
};
|
||||
|
||||
/* 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_VA_DISPLAY
|
||||
};
|
||||
|
||||
void
|
||||
gst_vaapi_display_class_init(GstVaapiDisplayClass *klass);
|
||||
gst_vaapi_display_class_init (GstVaapiDisplayClass * klass);
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_new(const GstVaapiDisplayClass *klass,
|
||||
gst_vaapi_display_new (const GstVaapiDisplayClass * klass,
|
||||
GstVaapiDisplayInitType init_type, gpointer init_value);
|
||||
|
||||
GstVaapiDisplayCache *
|
||||
gst_vaapi_display_get_cache(void);
|
||||
gst_vaapi_display_get_cache (void);
|
||||
|
||||
static inline guint
|
||||
gst_vaapi_display_get_display_types(GstVaapiDisplay *display)
|
||||
gst_vaapi_display_get_display_types (GstVaapiDisplay * display)
|
||||
{
|
||||
const GstVaapiDisplayClass * const dpy_class =
|
||||
GST_VAAPI_DISPLAY_GET_CLASS(display);
|
||||
const GstVaapiDisplayClass *const dpy_class =
|
||||
GST_VAAPI_DISPLAY_GET_CLASS (display);
|
||||
|
||||
return dpy_class->display_types;
|
||||
}
|
||||
|
|
|
@ -38,83 +38,82 @@
|
|||
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
||||
|
||||
static inline const gchar *
|
||||
get_default_display_name(void)
|
||||
get_default_display_name (void)
|
||||
{
|
||||
static const gchar *g_display_name;
|
||||
|
||||
if (!g_display_name)
|
||||
g_display_name = getenv("WAYLAND_DISPLAY");
|
||||
g_display_name = getenv ("WAYLAND_DISPLAY");
|
||||
return g_display_name;
|
||||
}
|
||||
|
||||
static inline guint
|
||||
get_display_name_length(const gchar *display_name)
|
||||
get_display_name_length (const gchar * display_name)
|
||||
{
|
||||
const gchar *str;
|
||||
|
||||
str = strchr(display_name, '-');
|
||||
str = strchr (display_name, '-');
|
||||
if (str)
|
||||
return str - display_name;
|
||||
return strlen(display_name);
|
||||
return strlen (display_name);
|
||||
}
|
||||
|
||||
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 *tested_name = b;
|
||||
guint cached_name_length, tested_name_length;
|
||||
|
||||
g_return_val_if_fail(cached_name, FALSE);
|
||||
g_return_val_if_fail(tested_name, FALSE);
|
||||
g_return_val_if_fail (cached_name, FALSE);
|
||||
g_return_val_if_fail (tested_name, FALSE);
|
||||
|
||||
cached_name_length = get_display_name_length(cached_name);
|
||||
tested_name_length = get_display_name_length(tested_name);
|
||||
cached_name_length = get_display_name_length (cached_name);
|
||||
tested_name_length = get_display_name_length (tested_name);
|
||||
|
||||
/* XXX: handle screen number and default WAYLAND_DISPLAY name */
|
||||
if (cached_name_length != tested_name_length)
|
||||
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 TRUE;
|
||||
}
|
||||
|
||||
/* Mangle display name with our prefix */
|
||||
static gboolean
|
||||
set_display_name(GstVaapiDisplay *display, const gchar *display_name)
|
||||
set_display_name (GstVaapiDisplay * display, const gchar * display_name)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
||||
GstVaapiDisplayWaylandPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||
|
||||
g_free(priv->display_name);
|
||||
g_free (priv->display_name);
|
||||
|
||||
if (!display_name) {
|
||||
display_name = get_default_display_name();
|
||||
display_name = get_default_display_name ();
|
||||
if (!display_name)
|
||||
display_name = "";
|
||||
}
|
||||
priv->display_name = g_strdup(display_name);
|
||||
priv->display_name = g_strdup (display_name);
|
||||
return priv->display_name != NULL;
|
||||
}
|
||||
|
||||
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 subpixel, const char *make, const char *model,
|
||||
int transform)
|
||||
int subpixel, const char *make, const char *model, int transform)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv = data;
|
||||
GstVaapiDisplayWaylandPrivate *const priv = data;
|
||||
|
||||
priv->phys_width = physical_width;
|
||||
priv->phys_height = physical_height;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv = data;
|
||||
GstVaapiDisplayWaylandPrivate *const priv = data;
|
||||
|
||||
if (flags & WL_OUTPUT_MODE_CURRENT) {
|
||||
priv->width = width;
|
||||
|
@ -128,24 +127,20 @@ static const struct wl_output_listener output_listener = {
|
|||
};
|
||||
|
||||
static void
|
||||
registry_handle_global(
|
||||
void *data,
|
||||
registry_handle_global (void *data,
|
||||
struct wl_registry *registry,
|
||||
uint32_t id,
|
||||
const char *interface,
|
||||
uint32_t version
|
||||
)
|
||||
uint32_t id, 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 =
|
||||
wl_registry_bind(registry, id, &wl_compositor_interface, 1);
|
||||
else if (strcmp(interface, "wl_shell") == 0)
|
||||
priv->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
|
||||
else if (strcmp(interface, "wl_output") == 0) {
|
||||
priv->output = wl_registry_bind(registry, id, &wl_output_interface, 1);
|
||||
wl_output_add_listener(priv->output, &output_listener, priv);
|
||||
wl_registry_bind (registry, id, &wl_compositor_interface, 1);
|
||||
else if (strcmp (interface, "wl_shell") == 0)
|
||||
priv->shell = wl_registry_bind (registry, id, &wl_shell_interface, 1);
|
||||
else if (strcmp (interface, "wl_output") == 0) {
|
||||
priv->output = wl_registry_bind (registry, id, &wl_output_interface, 1);
|
||||
wl_output_add_listener (priv->output, &output_listener, priv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,134 +150,131 @@ static const struct wl_registry_listener registry_listener = {
|
|||
};
|
||||
|
||||
static gboolean
|
||||
gst_vaapi_display_wayland_setup(GstVaapiDisplay *display)
|
||||
gst_vaapi_display_wayland_setup (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
||||
GstVaapiDisplayWaylandPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||
|
||||
wl_display_set_user_data(priv->wl_display, priv);
|
||||
priv->registry = wl_display_get_registry(priv->wl_display);
|
||||
wl_registry_add_listener(priv->registry, ®istry_listener, priv);
|
||||
priv->event_fd = wl_display_get_fd(priv->wl_display);
|
||||
wl_display_roundtrip(priv->wl_display);
|
||||
wl_display_set_user_data (priv->wl_display, priv);
|
||||
priv->registry = wl_display_get_registry (priv->wl_display);
|
||||
wl_registry_add_listener (priv->registry, ®istry_listener, priv);
|
||||
priv->event_fd = wl_display_get_fd (priv->wl_display);
|
||||
wl_display_roundtrip (priv->wl_display);
|
||||
|
||||
if (!priv->width || !priv->height) {
|
||||
wl_display_roundtrip(priv->wl_display);
|
||||
wl_display_roundtrip (priv->wl_display);
|
||||
if (!priv->width || !priv->height) {
|
||||
GST_ERROR("failed to determine the display size");
|
||||
GST_ERROR ("failed to determine the display size");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!priv->compositor) {
|
||||
GST_ERROR("failed to bind compositor interface");
|
||||
GST_ERROR ("failed to bind compositor interface");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!priv->shell) {
|
||||
GST_ERROR("failed to bind shell interface");
|
||||
GST_ERROR ("failed to bind shell interface");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_vaapi_display_wayland_bind_display(GstVaapiDisplay *display,
|
||||
gst_vaapi_display_wayland_bind_display (GstVaapiDisplay * display,
|
||||
gpointer native_display)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
||||
GstVaapiDisplayWaylandPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (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);
|
||||
GST_WARNING ("wayland: get display name");
|
||||
set_display_name (display, NULL);
|
||||
|
||||
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)
|
||||
gst_vaapi_display_wayland_open_display (GstVaapiDisplay * display,
|
||||
const gchar * name)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
||||
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);
|
||||
cache = gst_vaapi_display_get_cache ();
|
||||
g_return_val_if_fail (cache != NULL, FALSE);
|
||||
|
||||
if (!set_display_name(display, name))
|
||||
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));
|
||||
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);
|
||||
} 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);
|
||||
return gst_vaapi_display_wayland_setup (display);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_wayland_close_display(GstVaapiDisplay * display)
|
||||
gst_vaapi_display_wayland_close_display (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
||||
GstVaapiDisplayWaylandPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||
|
||||
if (priv->output) {
|
||||
wl_output_destroy(priv->output);
|
||||
wl_output_destroy (priv->output);
|
||||
priv->output = NULL;
|
||||
}
|
||||
|
||||
if (priv->shell) {
|
||||
wl_shell_destroy(priv->shell);
|
||||
wl_shell_destroy (priv->shell);
|
||||
priv->shell = NULL;
|
||||
}
|
||||
|
||||
if (priv->compositor) {
|
||||
wl_compositor_destroy(priv->compositor);
|
||||
wl_compositor_destroy (priv->compositor);
|
||||
priv->compositor = NULL;
|
||||
}
|
||||
|
||||
if (priv->wl_display) {
|
||||
if (!priv->use_foreign_display)
|
||||
wl_display_disconnect(priv->wl_display);
|
||||
wl_display_disconnect (priv->wl_display);
|
||||
priv->wl_display = NULL;
|
||||
}
|
||||
|
||||
if (priv->display_name) {
|
||||
g_free(priv->display_name);
|
||||
g_free (priv->display_name);
|
||||
priv->display_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_vaapi_display_wayland_get_display_info(
|
||||
GstVaapiDisplay *display,
|
||||
GstVaapiDisplayInfo *info
|
||||
)
|
||||
gst_vaapi_display_wayland_get_display_info (GstVaapiDisplay * display,
|
||||
GstVaapiDisplayInfo * info)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
||||
GstVaapiDisplayWaylandPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_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();
|
||||
cache = gst_vaapi_display_get_cache ();
|
||||
if (!cache)
|
||||
return FALSE;
|
||||
cached_info = gst_vaapi_display_cache_lookup_by_native_display(cache,
|
||||
priv->wl_display, GST_VAAPI_DISPLAY_TYPES(display));
|
||||
cached_info = gst_vaapi_display_cache_lookup_by_native_display (cache,
|
||||
priv->wl_display, GST_VAAPI_DISPLAY_TYPES (display));
|
||||
if (cached_info) {
|
||||
*info = *cached_info;
|
||||
return TRUE;
|
||||
|
@ -292,7 +284,7 @@ gst_vaapi_display_wayland_get_display_info(
|
|||
info->native_display = priv->wl_display;
|
||||
info->display_name = priv->display_name;
|
||||
if (!info->va_display) {
|
||||
info->va_display = vaGetDisplayWl(priv->wl_display);
|
||||
info->va_display = vaGetDisplayWl (priv->wl_display);
|
||||
if (!info->va_display)
|
||||
return FALSE;
|
||||
info->display_type = GST_VAAPI_DISPLAY_TYPE_WAYLAND;
|
||||
|
@ -301,14 +293,11 @@ gst_vaapi_display_wayland_get_display_info(
|
|||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_wayland_get_size(
|
||||
GstVaapiDisplay *display,
|
||||
guint *pwidth,
|
||||
guint *pheight
|
||||
)
|
||||
gst_vaapi_display_wayland_get_size (GstVaapiDisplay * display,
|
||||
guint * pwidth, guint * pheight)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
||||
GstVaapiDisplayWaylandPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||
|
||||
if (!priv->output)
|
||||
return;
|
||||
|
@ -321,14 +310,11 @@ gst_vaapi_display_wayland_get_size(
|
|||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_wayland_get_size_mm(
|
||||
GstVaapiDisplay *display,
|
||||
guint *pwidth,
|
||||
guint *pheight
|
||||
)
|
||||
gst_vaapi_display_wayland_get_size_mm (GstVaapiDisplay * display,
|
||||
guint * pwidth, guint * pheight)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
||||
GstVaapiDisplayWaylandPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||
|
||||
if (!priv->output)
|
||||
return;
|
||||
|
@ -341,24 +327,24 @@ gst_vaapi_display_wayland_get_size_mm(
|
|||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_wayland_init(GstVaapiDisplay *display)
|
||||
gst_vaapi_display_wayland_init (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayWaylandPrivate * const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
|
||||
GstVaapiDisplayWaylandPrivate *const priv =
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE (display);
|
||||
|
||||
priv->event_fd = -1;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_wayland_class_init(GstVaapiDisplayWaylandClass * klass)
|
||||
gst_vaapi_display_wayland_class_init (GstVaapiDisplayWaylandClass * klass)
|
||||
{
|
||||
GstVaapiMiniObjectClass * const object_class =
|
||||
GST_VAAPI_MINI_OBJECT_CLASS(klass);
|
||||
GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
|
||||
GstVaapiMiniObjectClass *const object_class =
|
||||
GST_VAAPI_MINI_OBJECT_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->init = gst_vaapi_display_wayland_init;
|
||||
dpy_class->bind_display = gst_vaapi_display_wayland_bind_display;
|
||||
|
@ -370,16 +356,16 @@ gst_vaapi_display_wayland_class_init(GstVaapiDisplayWaylandClass * klass)
|
|||
}
|
||||
|
||||
static inline const GstVaapiDisplayClass *
|
||||
gst_vaapi_display_wayland_class(void)
|
||||
gst_vaapi_display_wayland_class (void)
|
||||
{
|
||||
static GstVaapiDisplayWaylandClass g_class;
|
||||
static gsize g_class_init = FALSE;
|
||||
|
||||
if (g_once_init_enter(&g_class_init)) {
|
||||
gst_vaapi_display_wayland_class_init(&g_class);
|
||||
g_once_init_leave(&g_class_init, TRUE);
|
||||
if (g_once_init_enter (&g_class_init)) {
|
||||
gst_vaapi_display_wayland_class_init (&g_class);
|
||||
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
|
||||
*/
|
||||
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(),
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer)display_name);
|
||||
return gst_vaapi_display_new (gst_vaapi_display_wayland_class (),
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -411,11 +397,11 @@ gst_vaapi_display_wayland_new(const gchar *display_name)
|
|||
* Return value: a newly allocated #GstVaapiDisplay object
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
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;
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_wayland_new(const gchar *display_name);
|
||||
gst_vaapi_display_wayland_new (const gchar * display_name);
|
||||
|
||||
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 *
|
||||
gst_vaapi_display_wayland_get_display(GstVaapiDisplayWayland *display);
|
||||
gst_vaapi_display_wayland_get_display (GstVaapiDisplayWayland * display);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ typedef struct _GstVaapiDisplayWaylandClass GstVaapiDisplayWaylandClass;
|
|||
#define GST_VAAPI_DISPLAY_WL_DISPLAY(display) \
|
||||
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display)->wl_display
|
||||
|
||||
struct _GstVaapiDisplayWaylandPrivate {
|
||||
struct _GstVaapiDisplayWaylandPrivate
|
||||
{
|
||||
gchar *display_name;
|
||||
struct wl_display *wl_display;
|
||||
struct wl_compositor *compositor;
|
||||
|
@ -65,7 +66,7 @@ struct _GstVaapiDisplayWaylandPrivate {
|
|||
guint phys_width;
|
||||
guint phys_height;
|
||||
gint event_fd;
|
||||
guint use_foreign_display : 1;
|
||||
guint use_foreign_display:1;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -73,7 +74,8 @@ struct _GstVaapiDisplayWaylandPrivate {
|
|||
*
|
||||
* VA/Wayland display wrapper.
|
||||
*/
|
||||
struct _GstVaapiDisplayWayland {
|
||||
struct _GstVaapiDisplayWayland
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiDisplay parent_instance;
|
||||
|
||||
|
@ -85,7 +87,8 @@ struct _GstVaapiDisplayWayland {
|
|||
*
|
||||
* VA/Wayland display wrapper clas.
|
||||
*/
|
||||
struct _GstVaapiDisplayWaylandClass {
|
||||
struct _GstVaapiDisplayWaylandClass
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiDisplayClass parent_class;
|
||||
};
|
||||
|
|
|
@ -46,45 +46,44 @@
|
|||
#include "gstvaapidebug.h"
|
||||
|
||||
static const guint g_display_types =
|
||||
(1U << GST_VAAPI_DISPLAY_TYPE_X11) |
|
||||
(1U << GST_VAAPI_DISPLAY_TYPE_GLX);
|
||||
(1U << GST_VAAPI_DISPLAY_TYPE_X11) | (1U << GST_VAAPI_DISPLAY_TYPE_GLX);
|
||||
|
||||
static inline const gchar *
|
||||
get_default_display_name(void)
|
||||
get_default_display_name (void)
|
||||
{
|
||||
static const gchar *g_display_name;
|
||||
|
||||
if (!g_display_name)
|
||||
g_display_name = getenv("DISPLAY");
|
||||
g_display_name = getenv ("DISPLAY");
|
||||
return g_display_name;
|
||||
}
|
||||
|
||||
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 *tested_name = b, *tested_name_end;
|
||||
guint cached_name_length, tested_name_length;
|
||||
|
||||
g_return_val_if_fail(cached_name, FALSE);
|
||||
g_return_val_if_fail(tested_name, FALSE);
|
||||
g_return_val_if_fail (cached_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)
|
||||
cached_name_length = cached_name_end - cached_name;
|
||||
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)
|
||||
tested_name_length = tested_name_end - tested_name;
|
||||
else
|
||||
tested_name_length = strlen(tested_name);
|
||||
tested_name_length = strlen (tested_name);
|
||||
|
||||
if (cached_name_length != tested_name_length)
|
||||
return FALSE;
|
||||
if (strncmp(cached_name, tested_name, cached_name_length) != 0)
|
||||
if (strncmp (cached_name, tested_name, cached_name_length) != 0)
|
||||
return FALSE;
|
||||
|
||||
/* XXX: handle screen number? */
|
||||
|
@ -93,9 +92,9 @@ compare_display_name(gconstpointer a, gconstpointer b)
|
|||
|
||||
/* Reconstruct a display name without our prefix */
|
||||
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;
|
||||
|
||||
if (!display_name || *display_name == '\0')
|
||||
|
@ -105,174 +104,170 @@ get_display_name(GstVaapiDisplayX11 *display)
|
|||
|
||||
/* Mangle display name with our prefix */
|
||||
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) {
|
||||
display_name = get_default_display_name();
|
||||
display_name = get_default_display_name ();
|
||||
if (!display_name)
|
||||
display_name = "";
|
||||
}
|
||||
priv->display_name = g_strdup(display_name);
|
||||
priv->display_name = g_strdup (display_name);
|
||||
return priv->display_name != NULL;
|
||||
}
|
||||
|
||||
/* Set synchronous behavious on the underlying X11 display */
|
||||
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) {
|
||||
priv->synchronous = synchronous;
|
||||
if (priv->x11_display) {
|
||||
GST_VAAPI_DISPLAY_LOCK(display);
|
||||
XSynchronize(priv->x11_display, synchronous);
|
||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||
GST_VAAPI_DISPLAY_LOCK (display);
|
||||
XSynchronize (priv->x11_display, synchronous);
|
||||
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for display server extensions */
|
||||
static void
|
||||
check_extensions(GstVaapiDisplayX11 *display)
|
||||
check_extensions (GstVaapiDisplayX11 * display)
|
||||
{
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
||||
GstVaapiDisplayX11Private *const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||
int evt_base, err_base;
|
||||
|
||||
#ifdef HAVE_XRANDR
|
||||
priv->use_xrandr = XRRQueryExtension(priv->x11_display,
|
||||
priv->use_xrandr = XRRQueryExtension (priv->x11_display,
|
||||
&evt_base, &err_base);
|
||||
#endif
|
||||
#ifdef HAVE_XRENDER
|
||||
priv->has_xrender = XRenderQueryExtension(priv->x11_display,
|
||||
priv->has_xrender = XRenderQueryExtension (priv->x11_display,
|
||||
&evt_base, &err_base);
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_vaapi_display_x11_bind_display(GstVaapiDisplay *base_display,
|
||||
gst_vaapi_display_x11_bind_display (GstVaapiDisplay * base_display,
|
||||
gpointer native_display)
|
||||
{
|
||||
GstVaapiDisplayX11 * const display =
|
||||
GST_VAAPI_DISPLAY_X11_CAST(base_display);
|
||||
GstVaapiDisplayX11Private * const priv = &display->priv;
|
||||
GstVaapiDisplayX11 *const display = GST_VAAPI_DISPLAY_X11_CAST (base_display);
|
||||
GstVaapiDisplayX11Private *const priv = &display->priv;
|
||||
|
||||
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);
|
||||
check_extensions (display);
|
||||
|
||||
if (!set_display_name(display, XDisplayString(priv->x11_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)
|
||||
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;
|
||||
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);
|
||||
cache = gst_vaapi_display_get_cache ();
|
||||
g_return_val_if_fail (cache != NULL, FALSE);
|
||||
|
||||
if (!set_display_name(display, name))
|
||||
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));
|
||||
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;
|
||||
}
|
||||
else {
|
||||
priv->x11_display = XOpenDisplay(get_display_name(display));
|
||||
} 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);
|
||||
priv->x11_screen = DefaultScreen (priv->x11_display);
|
||||
|
||||
check_extensions(display);
|
||||
check_extensions (display);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_x11_close_display(GstVaapiDisplay *display)
|
||||
gst_vaapi_display_x11_close_display (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
||||
GstVaapiDisplayX11Private *const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||
|
||||
if (priv->pixmap_formats) {
|
||||
g_array_free(priv->pixmap_formats, TRUE);
|
||||
g_array_free (priv->pixmap_formats, TRUE);
|
||||
priv->pixmap_formats = NULL;
|
||||
}
|
||||
|
||||
if (priv->x11_display) {
|
||||
if (!priv->use_foreign_display)
|
||||
XCloseDisplay(priv->x11_display);
|
||||
XCloseDisplay (priv->x11_display);
|
||||
priv->x11_display = NULL;
|
||||
}
|
||||
|
||||
if (priv->display_name) {
|
||||
g_free(priv->display_name);
|
||||
g_free (priv->display_name);
|
||||
priv->display_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_x11_sync(GstVaapiDisplay *display)
|
||||
gst_vaapi_display_x11_sync (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(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);
|
||||
GST_VAAPI_DISPLAY_LOCK (display);
|
||||
XSync (priv->x11_display, False);
|
||||
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_x11_flush(GstVaapiDisplay *display)
|
||||
gst_vaapi_display_x11_flush (GstVaapiDisplay * display)
|
||||
{
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(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);
|
||||
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
|
||||
)
|
||||
gst_vaapi_display_x11_get_display_info (GstVaapiDisplay * display,
|
||||
GstVaapiDisplayInfo * info)
|
||||
{
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
||||
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();
|
||||
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));
|
||||
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;
|
||||
|
@ -282,7 +277,7 @@ gst_vaapi_display_x11_get_display_info(
|
|||
info->native_display = priv->x11_display;
|
||||
info->display_name = priv->display_name;
|
||||
if (!info->va_display) {
|
||||
info->va_display = vaGetDisplay(priv->x11_display);
|
||||
info->va_display = vaGetDisplay (priv->x11_display);
|
||||
if (!info->va_display)
|
||||
return FALSE;
|
||||
info->display_type = GST_VAAPI_DISPLAY_TYPE_X11;
|
||||
|
@ -291,41 +286,35 @@ gst_vaapi_display_x11_get_display_info(
|
|||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_x11_get_size(
|
||||
GstVaapiDisplay *display,
|
||||
guint *pwidth,
|
||||
guint *pheight
|
||||
)
|
||||
gst_vaapi_display_x11_get_size (GstVaapiDisplay * display,
|
||||
guint * pwidth, guint * pheight)
|
||||
{
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
||||
GstVaapiDisplayX11Private *const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||
|
||||
if (!priv->x11_display)
|
||||
return;
|
||||
|
||||
if (pwidth)
|
||||
*pwidth = DisplayWidth(priv->x11_display, priv->x11_screen);
|
||||
*pwidth = DisplayWidth (priv->x11_display, priv->x11_screen);
|
||||
|
||||
if (pheight)
|
||||
*pheight = DisplayHeight(priv->x11_display, priv->x11_screen);
|
||||
*pheight = DisplayHeight (priv->x11_display, priv->x11_screen);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_vaapi_display_x11_get_size_mm(
|
||||
GstVaapiDisplay *display,
|
||||
guint *pwidth,
|
||||
guint *pheight
|
||||
)
|
||||
gst_vaapi_display_x11_get_size_mm (GstVaapiDisplay * display,
|
||||
guint * pwidth, guint * pheight)
|
||||
{
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
||||
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);
|
||||
width_mm = DisplayWidthMM (priv->x11_display, priv->x11_screen);
|
||||
height_mm = DisplayHeightMM (priv->x11_display, priv->x11_screen);
|
||||
|
||||
#ifdef HAVE_XRANDR
|
||||
/* XXX: fix up physical size if the display is rotated */
|
||||
|
@ -337,18 +326,18 @@ gst_vaapi_display_x11_get_size_mm(
|
|||
Rotation rotation;
|
||||
|
||||
do {
|
||||
win = DefaultRootWindow(priv->x11_display);
|
||||
screen = XRRRootToScreen(priv->x11_display, win);
|
||||
win = DefaultRootWindow (priv->x11_display);
|
||||
screen = XRRRootToScreen (priv->x11_display, win);
|
||||
|
||||
xrr_config = XRRGetScreenInfo(priv->x11_display, win);
|
||||
xrr_config = XRRGetScreenInfo (priv->x11_display, win);
|
||||
if (!xrr_config)
|
||||
break;
|
||||
|
||||
size_id = XRRConfigCurrentConfiguration(xrr_config, &rotation);
|
||||
size_id = XRRConfigCurrentConfiguration (xrr_config, &rotation);
|
||||
if (rotation == RR_Rotate_0 || rotation == RR_Rotate_180)
|
||||
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)
|
||||
break;
|
||||
|
||||
|
@ -356,7 +345,7 @@ gst_vaapi_display_x11_get_size_mm(
|
|||
height_mm = xrr_sizes[size_id].mwidth;
|
||||
} while (0);
|
||||
if (xrr_config)
|
||||
XRRFreeScreenConfigInfo(xrr_config);
|
||||
XRRFreeScreenConfigInfo (xrr_config);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -368,15 +357,15 @@ gst_vaapi_display_x11_get_size_mm(
|
|||
}
|
||||
|
||||
void
|
||||
gst_vaapi_display_x11_class_init(GstVaapiDisplayX11Class *klass)
|
||||
gst_vaapi_display_x11_class_init (GstVaapiDisplayX11Class * klass)
|
||||
{
|
||||
GstVaapiMiniObjectClass * const object_class =
|
||||
GST_VAAPI_MINI_OBJECT_CLASS(klass);
|
||||
GstVaapiDisplayClass * const dpy_class = GST_VAAPI_DISPLAY_CLASS(klass);
|
||||
GstVaapiMiniObjectClass *const object_class =
|
||||
GST_VAAPI_MINI_OBJECT_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->bind_display = gst_vaapi_display_x11_bind_display;
|
||||
dpy_class->open_display = gst_vaapi_display_x11_open_display;
|
||||
|
@ -389,16 +378,16 @@ gst_vaapi_display_x11_class_init(GstVaapiDisplayX11Class *klass)
|
|||
}
|
||||
|
||||
static inline const GstVaapiDisplayClass *
|
||||
gst_vaapi_display_x11_class(void)
|
||||
gst_vaapi_display_x11_class (void)
|
||||
{
|
||||
static GstVaapiDisplayX11Class g_class;
|
||||
static gsize g_class_init = FALSE;
|
||||
|
||||
if (g_once_init_enter(&g_class_init)) {
|
||||
gst_vaapi_display_x11_class_init(&g_class);
|
||||
g_once_init_leave(&g_class_init, TRUE);
|
||||
if (g_once_init_enter (&g_class_init)) {
|
||||
gst_vaapi_display_x11_class_init (&g_class);
|
||||
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
|
||||
*/
|
||||
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(),
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer)display_name);
|
||||
return gst_vaapi_display_new (gst_vaapi_display_x11_class (),
|
||||
GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, (gpointer) display_name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -430,11 +419,11 @@ gst_vaapi_display_x11_new(const gchar *display_name)
|
|||
* Return value: a newly allocated #GstVaapiDisplay object
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -449,11 +438,11 @@ gst_vaapi_display_x11_new_with_display(Display *x11_display)
|
|||
* Return value: the X11 #Display attached to @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
|
||||
*/
|
||||
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,23 +475,24 @@ gst_vaapi_display_x11_get_screen(GstVaapiDisplayX11 *display)
|
|||
* @synchronous is %FALSE.
|
||||
*/
|
||||
void
|
||||
gst_vaapi_display_x11_set_synchronous(GstVaapiDisplayX11 *display,
|
||||
gst_vaapi_display_x11_set_synchronous (GstVaapiDisplayX11 * display,
|
||||
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;
|
||||
struct _GstVaapiPixmapFormatX11 {
|
||||
struct _GstVaapiPixmapFormatX11
|
||||
{
|
||||
GstVideoFormat format;
|
||||
gint depth;
|
||||
gint bpp;
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
@ -526,37 +516,37 @@ pix_fmt_to_video_format(gint depth, gint bpp)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
ensure_pix_fmts(GstVaapiDisplayX11 *display)
|
||||
ensure_pix_fmts (GstVaapiDisplayX11 * display)
|
||||
{
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
||||
GstVaapiDisplayX11Private *const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||
XPixmapFormatValues *pix_fmts;
|
||||
int i, n, num_pix_fmts;
|
||||
|
||||
if (priv->pixmap_formats)
|
||||
return TRUE;
|
||||
|
||||
GST_VAAPI_DISPLAY_LOCK(display);
|
||||
pix_fmts = XListPixmapFormats(GST_VAAPI_DISPLAY_XDISPLAY(display),
|
||||
GST_VAAPI_DISPLAY_LOCK (display);
|
||||
pix_fmts = XListPixmapFormats (GST_VAAPI_DISPLAY_XDISPLAY (display),
|
||||
&num_pix_fmts);
|
||||
GST_VAAPI_DISPLAY_UNLOCK(display);
|
||||
GST_VAAPI_DISPLAY_UNLOCK (display);
|
||||
if (!pix_fmts)
|
||||
return FALSE;
|
||||
|
||||
priv->pixmap_formats = g_array_sized_new(FALSE, FALSE,
|
||||
sizeof(GstVaapiPixmapFormatX11), num_pix_fmts);
|
||||
priv->pixmap_formats = g_array_sized_new (FALSE, FALSE,
|
||||
sizeof (GstVaapiPixmapFormatX11), num_pix_fmts);
|
||||
if (!priv->pixmap_formats) {
|
||||
XFree(pix_fmts);
|
||||
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);
|
||||
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);
|
||||
pix_fmt->format = pix_fmt_to_video_format (pix_fmt->depth, pix_fmt->bpp);
|
||||
if (pix_fmt->format != GST_VIDEO_FORMAT_UNKNOWN)
|
||||
n++;
|
||||
}
|
||||
|
@ -566,17 +556,17 @@ ensure_pix_fmts(GstVaapiDisplayX11 *display)
|
|||
|
||||
/* Determine the GstVideoFormat based on a supported Pixmap depth */
|
||||
GstVideoFormat
|
||||
gst_vaapi_display_x11_get_pixmap_format(GstVaapiDisplayX11 *display,
|
||||
gst_vaapi_display_x11_get_pixmap_format (GstVaapiDisplayX11 * display,
|
||||
guint depth)
|
||||
{
|
||||
if (ensure_pix_fmts(display)) {
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
||||
if (ensure_pix_fmts (display)) {
|
||||
GstVaapiDisplayX11Private *const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < priv->pixmap_formats->len; i++) {
|
||||
GstVaapiPixmapFormatX11 * const pix_fmt = &g_array_index(
|
||||
priv->pixmap_formats, GstVaapiPixmapFormatX11, i);
|
||||
GstVaapiPixmapFormatX11 *const pix_fmt =
|
||||
&g_array_index (priv->pixmap_formats, GstVaapiPixmapFormatX11, i);
|
||||
if (pix_fmt->depth == depth)
|
||||
return pix_fmt->format;
|
||||
}
|
||||
|
@ -586,17 +576,17 @@ gst_vaapi_display_x11_get_pixmap_format(GstVaapiDisplayX11 *display,
|
|||
|
||||
/* Determine the Pixmap depth based on a GstVideoFormat */
|
||||
guint
|
||||
gst_vaapi_display_x11_get_pixmap_depth(GstVaapiDisplayX11 *display,
|
||||
gst_vaapi_display_x11_get_pixmap_depth (GstVaapiDisplayX11 * display,
|
||||
GstVideoFormat format)
|
||||
{
|
||||
if (ensure_pix_fmts(display)) {
|
||||
GstVaapiDisplayX11Private * const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE(display);
|
||||
if (ensure_pix_fmts (display)) {
|
||||
GstVaapiDisplayX11Private *const priv =
|
||||
GST_VAAPI_DISPLAY_X11_PRIVATE (display);
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < priv->pixmap_formats->len; i++) {
|
||||
GstVaapiPixmapFormatX11 * const pix_fmt = &g_array_index(
|
||||
priv->pixmap_formats, GstVaapiPixmapFormatX11, i);
|
||||
GstVaapiPixmapFormatX11 *const pix_fmt =
|
||||
&g_array_index (priv->pixmap_formats, GstVaapiPixmapFormatX11, i);
|
||||
if (pix_fmt->format == format)
|
||||
return pix_fmt->depth;
|
||||
}
|
||||
|
|
|
@ -36,19 +36,19 @@ G_BEGIN_DECLS
|
|||
typedef struct _GstVaapiDisplayX11 GstVaapiDisplayX11;
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_x11_new(const gchar *display_name);
|
||||
gst_vaapi_display_x11_new (const gchar * display_name);
|
||||
|
||||
GstVaapiDisplay *
|
||||
gst_vaapi_display_x11_new_with_display(Display *x11_display);
|
||||
gst_vaapi_display_x11_new_with_display (Display * x11_display);
|
||||
|
||||
Display *
|
||||
gst_vaapi_display_x11_get_display(GstVaapiDisplayX11 *display);
|
||||
gst_vaapi_display_x11_get_display (GstVaapiDisplayX11 * display);
|
||||
|
||||
int
|
||||
gst_vaapi_display_x11_get_screen(GstVaapiDisplayX11 *display);
|
||||
gst_vaapi_display_x11_get_screen (GstVaapiDisplayX11 * display);
|
||||
|
||||
void
|
||||
gst_vaapi_display_x11_set_synchronous(GstVaapiDisplayX11 *display,
|
||||
gst_vaapi_display_x11_set_synchronous (GstVaapiDisplayX11 * display,
|
||||
gboolean synchronous);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -76,15 +76,16 @@ typedef struct _GstVaapiDisplayX11Class GstVaapiDisplayX11Class;
|
|||
#define GST_VAAPI_DISPLAY_HAS_XRENDER(display) \
|
||||
(GST_VAAPI_DISPLAY_X11_PRIVATE(display)->has_xrender)
|
||||
|
||||
struct _GstVaapiDisplayX11Private {
|
||||
struct _GstVaapiDisplayX11Private
|
||||
{
|
||||
gchar *display_name;
|
||||
Display *x11_display;
|
||||
int x11_screen;
|
||||
GArray *pixmap_formats;
|
||||
guint use_foreign_display : 1; // Foreign native_display?
|
||||
guint use_xrandr : 1;
|
||||
guint has_xrender : 1; // Has XRender extension?
|
||||
guint synchronous : 1;
|
||||
guint use_foreign_display:1; // Foreign native_display?
|
||||
guint use_xrandr:1;
|
||||
guint has_xrender:1; // Has XRender extension?
|
||||
guint synchronous:1;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -92,7 +93,8 @@ struct _GstVaapiDisplayX11Private {
|
|||
*
|
||||
* VA/X11 display wrapper.
|
||||
*/
|
||||
struct _GstVaapiDisplayX11 {
|
||||
struct _GstVaapiDisplayX11
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiDisplay parent_instance;
|
||||
|
||||
|
@ -104,22 +106,23 @@ struct _GstVaapiDisplayX11 {
|
|||
*
|
||||
* VA/X11 display wrapper clas.
|
||||
*/
|
||||
struct _GstVaapiDisplayX11Class {
|
||||
struct _GstVaapiDisplayX11Class
|
||||
{
|
||||
/*< private >*/
|
||||
GstVaapiDisplayClass parent_class;
|
||||
};
|
||||
|
||||
void
|
||||
gst_vaapi_display_x11_class_init(GstVaapiDisplayX11Class *klass);
|
||||
gst_vaapi_display_x11_class_init (GstVaapiDisplayX11Class * klass);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
GstVideoFormat
|
||||
gst_vaapi_display_x11_get_pixmap_format(GstVaapiDisplayX11 *display,
|
||||
gst_vaapi_display_x11_get_pixmap_format (GstVaapiDisplayX11 * display,
|
||||
guint depth);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
guint
|
||||
gst_vaapi_display_x11_get_pixmap_depth(GstVaapiDisplayX11 *display,
|
||||
gst_vaapi_display_x11_get_pixmap_depth (GstVaapiDisplayX11 * display,
|
||||
GstVideoFormat format);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -29,17 +29,19 @@
|
|||
#include "gstvaapidebug.h"
|
||||
|
||||
typedef struct _CacheEntry CacheEntry;
|
||||
struct _CacheEntry {
|
||||
struct _CacheEntry
|
||||
{
|
||||
GstVaapiDisplayInfo info;
|
||||
};
|
||||
|
||||
struct _GstVaapiDisplayCache {
|
||||
struct _GstVaapiDisplayCache
|
||||
{
|
||||
GMutex mutex;
|
||||
GList *list;
|
||||
};
|
||||
|
||||
static void
|
||||
cache_entry_free(CacheEntry *entry)
|
||||
cache_entry_free (CacheEntry * entry)
|
||||
{
|
||||
GstVaapiDisplayInfo *info;
|
||||
|
||||
|
@ -49,19 +51,19 @@ cache_entry_free(CacheEntry *entry)
|
|||
info = &entry->info;
|
||||
|
||||
if (info->display_name) {
|
||||
g_free(info->display_name);
|
||||
g_free (info->display_name);
|
||||
info->display_name = NULL;
|
||||
}
|
||||
g_slice_free(CacheEntry, entry);
|
||||
g_slice_free (CacheEntry, entry);
|
||||
}
|
||||
|
||||
static CacheEntry *
|
||||
cache_entry_new(const GstVaapiDisplayInfo *di)
|
||||
cache_entry_new (const GstVaapiDisplayInfo * di)
|
||||
{
|
||||
GstVaapiDisplayInfo *info;
|
||||
CacheEntry *entry;
|
||||
|
||||
entry = g_slice_new(CacheEntry);
|
||||
entry = g_slice_new (CacheEntry);
|
||||
if (!entry)
|
||||
return NULL;
|
||||
|
||||
|
@ -73,19 +75,19 @@ cache_entry_new(const GstVaapiDisplayInfo *di)
|
|||
info->display_name = NULL;
|
||||
|
||||
if (di->display_name) {
|
||||
info->display_name = g_strdup(di->display_name);
|
||||
info->display_name = g_strdup (di->display_name);
|
||||
if (!info->display_name)
|
||||
goto error;
|
||||
}
|
||||
return entry;
|
||||
|
||||
error:
|
||||
cache_entry_free(entry);
|
||||
cache_entry_free (entry);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
is_compatible_display_type(const GstVaapiDisplayType display_type,
|
||||
is_compatible_display_type (const GstVaapiDisplayType display_type,
|
||||
guint display_types)
|
||||
{
|
||||
if (display_type == GST_VAAPI_DISPLAY_TYPE_ANY)
|
||||
|
@ -96,67 +98,67 @@ is_compatible_display_type(const GstVaapiDisplayType display_type,
|
|||
}
|
||||
|
||||
static GList *
|
||||
cache_lookup_1(GstVaapiDisplayCache *cache, GCompareFunc func,
|
||||
cache_lookup_1 (GstVaapiDisplayCache * cache, GCompareFunc func,
|
||||
gconstpointer data, guint display_types)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
g_mutex_lock(&cache->mutex);
|
||||
g_mutex_lock (&cache->mutex);
|
||||
for (l = cache->list; l != NULL; l = l->next) {
|
||||
GstVaapiDisplayInfo * const info = &((CacheEntry *)l->data)->info;
|
||||
if (!is_compatible_display_type(info->display_type, display_types))
|
||||
GstVaapiDisplayInfo *const info = &((CacheEntry *) l->data)->info;
|
||||
if (!is_compatible_display_type (info->display_type, display_types))
|
||||
continue;
|
||||
if (func(info, data))
|
||||
if (func (info, data))
|
||||
break;
|
||||
}
|
||||
g_mutex_unlock(&cache->mutex);
|
||||
g_mutex_unlock (&cache->mutex);
|
||||
return l;
|
||||
}
|
||||
|
||||
static inline const GstVaapiDisplayInfo *
|
||||
cache_lookup(GstVaapiDisplayCache *cache, GCompareFunc func,
|
||||
cache_lookup (GstVaapiDisplayCache * cache, GCompareFunc func,
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_display_name(gconstpointer a, gconstpointer b)
|
||||
compare_display_name (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
const GstVaapiDisplayInfo * const info = a;
|
||||
const gchar * const display_name = b;
|
||||
const GstVaapiDisplayInfo *const info = a;
|
||||
const gchar *const display_name = b;
|
||||
|
||||
if (info->display_name == NULL && display_name == NULL)
|
||||
return TRUE;
|
||||
if (!info->display_name || !display_name)
|
||||
return FALSE;
|
||||
return strcmp(info->display_name, display_name) == 0;
|
||||
return strcmp (info->display_name, display_name) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,15 +169,15 @@ compare_display_name(gconstpointer a, gconstpointer b)
|
|||
* Return value: the newly created #GstVaapiDisplayCache object
|
||||
*/
|
||||
GstVaapiDisplayCache *
|
||||
gst_vaapi_display_cache_new(void)
|
||||
gst_vaapi_display_cache_new (void)
|
||||
{
|
||||
GstVaapiDisplayCache *cache;
|
||||
|
||||
cache = g_slice_new0(GstVaapiDisplayCache);
|
||||
cache = g_slice_new0 (GstVaapiDisplayCache);
|
||||
if (!cache)
|
||||
return NULL;
|
||||
|
||||
g_mutex_init(&cache->mutex);
|
||||
g_mutex_init (&cache->mutex);
|
||||
return cache;
|
||||
}
|
||||
|
||||
|
@ -186,7 +188,7 @@ gst_vaapi_display_cache_new(void)
|
|||
* Destroys a VA display cache.
|
||||
*/
|
||||
void
|
||||
gst_vaapi_display_cache_free(GstVaapiDisplayCache *cache)
|
||||
gst_vaapi_display_cache_free (GstVaapiDisplayCache * cache)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
|
@ -195,12 +197,12 @@ gst_vaapi_display_cache_free(GstVaapiDisplayCache *cache)
|
|||
|
||||
if (cache->list) {
|
||||
for (l = cache->list; l != NULL; l = l->next)
|
||||
cache_entry_free(l->data);
|
||||
g_list_free(cache->list);
|
||||
cache_entry_free (l->data);
|
||||
g_list_free (cache->list);
|
||||
cache->list = NULL;
|
||||
}
|
||||
g_mutex_clear(&cache->mutex);
|
||||
g_slice_free(GstVaapiDisplayCache, cache);
|
||||
g_mutex_clear (&cache->mutex);
|
||||
g_slice_free (GstVaapiDisplayCache, cache);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,15 +214,15 @@ gst_vaapi_display_cache_free(GstVaapiDisplayCache *cache)
|
|||
* Return value: the size of the display cache
|
||||
*/
|
||||
guint
|
||||
gst_vaapi_display_cache_get_size(GstVaapiDisplayCache *cache)
|
||||
gst_vaapi_display_cache_get_size (GstVaapiDisplayCache * cache)
|
||||
{
|
||||
guint size;
|
||||
|
||||
g_return_val_if_fail(cache != NULL, 0);
|
||||
g_return_val_if_fail (cache != NULL, 0);
|
||||
|
||||
g_mutex_lock(&cache->mutex);
|
||||
size = g_list_length(cache->list);
|
||||
g_mutex_unlock(&cache->mutex);
|
||||
g_mutex_lock (&cache->mutex);
|
||||
size = g_list_length (cache->list);
|
||||
g_mutex_unlock (&cache->mutex);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -235,23 +237,21 @@ gst_vaapi_display_cache_get_size(GstVaapiDisplayCache *cache)
|
|||
* Return value: %TRUE on success
|
||||
*/
|
||||
gboolean
|
||||
gst_vaapi_display_cache_add(
|
||||
GstVaapiDisplayCache *cache,
|
||||
GstVaapiDisplayInfo *info
|
||||
)
|
||||
gst_vaapi_display_cache_add (GstVaapiDisplayCache * cache,
|
||||
GstVaapiDisplayInfo * info)
|
||||
{
|
||||
CacheEntry *entry;
|
||||
|
||||
g_return_val_if_fail(cache != NULL, FALSE);
|
||||
g_return_val_if_fail(info != NULL, FALSE);
|
||||
g_return_val_if_fail (cache != NULL, FALSE);
|
||||
g_return_val_if_fail (info != NULL, FALSE);
|
||||
|
||||
entry = cache_entry_new(info);
|
||||
entry = cache_entry_new (info);
|
||||
if (!entry)
|
||||
return FALSE;
|
||||
|
||||
g_mutex_lock(&cache->mutex);
|
||||
cache->list = g_list_prepend(cache->list, entry);
|
||||
g_mutex_unlock(&cache->mutex);
|
||||
g_mutex_lock (&cache->mutex);
|
||||
cache->list = g_list_prepend (cache->list, entry);
|
||||
g_mutex_unlock (&cache->mutex);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -263,22 +263,20 @@ gst_vaapi_display_cache_add(
|
|||
* Removes any cache entry that matches the specified #GstVaapiDisplay.
|
||||
*/
|
||||
void
|
||||
gst_vaapi_display_cache_remove(
|
||||
GstVaapiDisplayCache *cache,
|
||||
GstVaapiDisplay *display
|
||||
)
|
||||
gst_vaapi_display_cache_remove (GstVaapiDisplayCache * cache,
|
||||
GstVaapiDisplay * display)
|
||||
{
|
||||
GList *m;
|
||||
|
||||
m = cache_lookup_1(cache, compare_display, display,
|
||||
m = cache_lookup_1 (cache, compare_display, display,
|
||||
GST_VAAPI_DISPLAY_TYPE_ANY);
|
||||
if (!m)
|
||||
return;
|
||||
|
||||
cache_entry_free(m->data);
|
||||
g_mutex_lock(&cache->mutex);
|
||||
cache->list = g_list_delete_link(cache->list, m);
|
||||
g_mutex_unlock(&cache->mutex);
|
||||
cache_entry_free (m->data);
|
||||
g_mutex_lock (&cache->mutex);
|
||||
cache->list = g_list_delete_link (cache->list, m);
|
||||
g_mutex_unlock (&cache->mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -292,15 +290,13 @@ gst_vaapi_display_cache_remove(
|
|||
* none was found
|
||||
*/
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup(
|
||||
GstVaapiDisplayCache *cache,
|
||||
GstVaapiDisplay *display
|
||||
)
|
||||
gst_vaapi_display_cache_lookup (GstVaapiDisplayCache * cache,
|
||||
GstVaapiDisplay * display)
|
||||
{
|
||||
g_return_val_if_fail(cache != NULL, NULL);
|
||||
g_return_val_if_fail(display != NULL, NULL);
|
||||
g_return_val_if_fail (cache != 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);
|
||||
}
|
||||
|
||||
|
@ -324,17 +320,13 @@ gst_vaapi_display_cache_lookup(
|
|||
* (i.e. returning %TRUE), or %NULL if none was found
|
||||
*/
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup_custom(
|
||||
GstVaapiDisplayCache *cache,
|
||||
GCompareFunc func,
|
||||
gconstpointer data,
|
||||
guint display_types
|
||||
)
|
||||
gst_vaapi_display_cache_lookup_custom (GstVaapiDisplayCache * cache,
|
||||
GCompareFunc func, gconstpointer data, guint display_types)
|
||||
{
|
||||
g_return_val_if_fail(cache != NULL, NULL);
|
||||
g_return_val_if_fail(func != NULL, NULL);
|
||||
g_return_val_if_fail (cache != 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,15 +340,13 @@ gst_vaapi_display_cache_lookup_custom(
|
|||
* if none was found
|
||||
*/
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup_by_va_display(
|
||||
GstVaapiDisplayCache *cache,
|
||||
VADisplay va_display
|
||||
)
|
||||
gst_vaapi_display_cache_lookup_by_va_display (GstVaapiDisplayCache * cache,
|
||||
VADisplay va_display)
|
||||
{
|
||||
g_return_val_if_fail(cache != NULL, NULL);
|
||||
g_return_val_if_fail(va_display != NULL, NULL);
|
||||
g_return_val_if_fail (cache != 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);
|
||||
}
|
||||
|
||||
|
@ -371,16 +361,13 @@ gst_vaapi_display_cache_lookup_by_va_display(
|
|||
* %NULL if none was found
|
||||
*/
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup_by_native_display(
|
||||
GstVaapiDisplayCache *cache,
|
||||
gpointer native_display,
|
||||
guint display_types
|
||||
)
|
||||
gst_vaapi_display_cache_lookup_by_native_display (GstVaapiDisplayCache * cache,
|
||||
gpointer native_display, guint display_types)
|
||||
{
|
||||
g_return_val_if_fail(cache != NULL, NULL);
|
||||
g_return_val_if_fail(native_display != NULL, NULL);
|
||||
g_return_val_if_fail (cache != 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);
|
||||
}
|
||||
|
||||
|
@ -395,14 +382,11 @@ gst_vaapi_display_cache_lookup_by_native_display(
|
|||
* %NULL if none was found
|
||||
*/
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup_by_name(
|
||||
GstVaapiDisplayCache *cache,
|
||||
const gchar *display_name,
|
||||
guint display_types
|
||||
)
|
||||
gst_vaapi_display_cache_lookup_by_name (GstVaapiDisplayCache * cache,
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -29,62 +29,44 @@ typedef struct _GstVaapiDisplayCache GstVaapiDisplayCache;
|
|||
|
||||
G_GNUC_INTERNAL
|
||||
GstVaapiDisplayCache *
|
||||
gst_vaapi_display_cache_new(void);
|
||||
gst_vaapi_display_cache_new (void);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void
|
||||
gst_vaapi_display_cache_free(GstVaapiDisplayCache *cache);
|
||||
gst_vaapi_display_cache_free (GstVaapiDisplayCache * cache);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
guint
|
||||
gst_vaapi_display_cache_get_size(GstVaapiDisplayCache *cache);
|
||||
gst_vaapi_display_cache_get_size (GstVaapiDisplayCache * cache);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
gboolean
|
||||
gst_vaapi_display_cache_add(
|
||||
GstVaapiDisplayCache *cache,
|
||||
GstVaapiDisplayInfo *info
|
||||
);
|
||||
gst_vaapi_display_cache_add (GstVaapiDisplayCache * cache,
|
||||
GstVaapiDisplayInfo * info);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
void
|
||||
gst_vaapi_display_cache_remove(
|
||||
GstVaapiDisplayCache *cache,
|
||||
GstVaapiDisplay *display
|
||||
);
|
||||
gst_vaapi_display_cache_remove (GstVaapiDisplayCache * cache,
|
||||
GstVaapiDisplay * display);
|
||||
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup(
|
||||
GstVaapiDisplayCache *cache,
|
||||
GstVaapiDisplay *display
|
||||
);
|
||||
gst_vaapi_display_cache_lookup (GstVaapiDisplayCache
|
||||
* cache, GstVaapiDisplay * display);
|
||||
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup_custom(
|
||||
GstVaapiDisplayCache *cache,
|
||||
GCompareFunc func,
|
||||
gconstpointer data,
|
||||
guint display_types
|
||||
);
|
||||
gst_vaapi_display_cache_lookup_custom (GstVaapiDisplayCache * cache,
|
||||
GCompareFunc func, gconstpointer data, guint display_types);
|
||||
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup_by_va_display(
|
||||
GstVaapiDisplayCache *cache,
|
||||
VADisplay va_display
|
||||
);
|
||||
gst_vaapi_display_cache_lookup_by_va_display (GstVaapiDisplayCache * cache,
|
||||
VADisplay va_display);
|
||||
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup_by_native_display(
|
||||
GstVaapiDisplayCache *cache,
|
||||
gpointer native_display,
|
||||
guint display_types
|
||||
);
|
||||
gst_vaapi_display_cache_lookup_by_native_display (GstVaapiDisplayCache *
|
||||
cache, gpointer native_display, guint display_types);
|
||||
|
||||
const GstVaapiDisplayInfo *
|
||||
gst_vaapi_display_cache_lookup_by_name(
|
||||
GstVaapiDisplayCache *cache,
|
||||
const gchar *display_name,
|
||||
guint display_types
|
||||
);
|
||||
gst_vaapi_display_cache_lookup_by_name (GstVaapiDisplayCache * cache,
|
||||
const gchar * display_name, guint display_types);
|
||||
|
||||
#endif /* GSTVAAPIDISPLAYCACHE_H */
|
||||
|
|
Loading…
Reference in a new issue