mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:28:32 +00:00
display: cope with new display cache API.
This commit is contained in:
parent
b59445b2ab
commit
c957823e8a
3 changed files with 13 additions and 27 deletions
|
@ -48,21 +48,6 @@ is_device_path(const gchar *device_path)
|
||||||
return strncmp(device_path, NAME_PREFIX, NAME_PREFIX_LENGTH) == 0;
|
return strncmp(device_path, NAME_PREFIX, NAME_PREFIX_LENGTH) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
compare_device_path(gconstpointer a, gconstpointer b, gpointer user_data)
|
|
||||||
{
|
|
||||||
const gchar *cached_name = a;
|
|
||||||
const gchar *tested_name = b;
|
|
||||||
|
|
||||||
if (!cached_name || !is_device_path(cached_name))
|
|
||||||
return FALSE;
|
|
||||||
g_return_val_if_fail(tested_name && is_device_path(tested_name), FALSE);
|
|
||||||
|
|
||||||
cached_name += NAME_PREFIX_LENGTH;
|
|
||||||
tested_name += NAME_PREFIX_LENGTH;
|
|
||||||
return strcmp(cached_name, tested_name) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get default device path. Actually, the first match in the DRM subsystem */
|
/* Get default device path. Actually, the first match in the DRM subsystem */
|
||||||
static const gchar *
|
static const gchar *
|
||||||
get_default_device_path(GstVaapiDisplay *display)
|
get_default_device_path(GstVaapiDisplay *display)
|
||||||
|
@ -254,8 +239,7 @@ gst_vaapi_display_drm_open_display(GstVaapiDisplay *display, const gchar *name)
|
||||||
if (!set_device_path(display, name))
|
if (!set_device_path(display, name))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
info = gst_vaapi_display_cache_lookup_by_name(cache, priv->device_path,
|
info = gst_vaapi_display_cache_lookup_by_name(cache, priv->device_path);
|
||||||
compare_device_path, NULL);
|
|
||||||
if (info) {
|
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;
|
priv->use_foreign_display = TRUE;
|
||||||
|
|
|
@ -63,10 +63,11 @@ get_display_name_length(const gchar *display_name)
|
||||||
return strlen(display_name);
|
return strlen(display_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gint
|
||||||
compare_display_name(gconstpointer a, gconstpointer b, gpointer user_data)
|
compare_display_name(gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
const gchar *cached_name = a;
|
const GstVaapiDisplayInfo * const info = a;
|
||||||
|
const gchar *cached_name = info->display_name;
|
||||||
const gchar *tested_name = b;
|
const gchar *tested_name = b;
|
||||||
guint cached_name_length, tested_name_length;
|
guint cached_name_length, tested_name_length;
|
||||||
|
|
||||||
|
@ -248,8 +249,8 @@ gst_vaapi_display_wayland_open_display(GstVaapiDisplay *display,
|
||||||
if (!set_display_name(display, name))
|
if (!set_display_name(display, name))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
info = gst_vaapi_display_cache_lookup_by_name(cache, priv->display_name,
|
info = gst_vaapi_display_cache_lookup_custom(cache, compare_display_name,
|
||||||
compare_display_name, NULL);
|
priv->display_name);
|
||||||
if (info) {
|
if (info) {
|
||||||
priv->wl_display = info->native_display;
|
priv->wl_display = info->native_display;
|
||||||
priv->use_foreign_display = TRUE;
|
priv->use_foreign_display = TRUE;
|
||||||
|
|
|
@ -58,10 +58,11 @@ get_default_display_name(void)
|
||||||
return g_display_name;
|
return g_display_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gint
|
||||||
compare_display_name(gconstpointer a, gconstpointer b, gpointer user_data)
|
compare_display_name(gconstpointer a, gconstpointer b)
|
||||||
{
|
{
|
||||||
const gchar *cached_name = a, *cached_name_end;
|
const GstVaapiDisplayInfo * const info = a;
|
||||||
|
const gchar *cached_name = info->display_name, *cached_name_end;
|
||||||
const gchar *tested_name = b, *tested_name_end;
|
const gchar *tested_name = b, *tested_name_end;
|
||||||
guint cached_name_length, tested_name_length;
|
guint cached_name_length, tested_name_length;
|
||||||
|
|
||||||
|
@ -196,8 +197,8 @@ gst_vaapi_display_x11_open_display(GstVaapiDisplay *base_display,
|
||||||
if (!set_display_name(display, name))
|
if (!set_display_name(display, name))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
info = gst_vaapi_display_cache_lookup_by_name(cache, priv->display_name,
|
info = gst_vaapi_display_cache_lookup_custom(cache, compare_display_name,
|
||||||
compare_display_name, NULL);
|
priv->display_name);
|
||||||
if (info) {
|
if (info) {
|
||||||
priv->x11_display = info->native_display;
|
priv->x11_display = info->native_display;
|
||||||
priv->use_foreign_display = TRUE;
|
priv->use_foreign_display = TRUE;
|
||||||
|
|
Loading…
Reference in a new issue