#define DEBUG 1
#include "gstvaapidebug.h"
-#define NAME_PREFIX "DRM:"
-#define NAME_PREFIX_LENGTH 4
-
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_DRM;
-static inline gboolean
-is_device_path(const gchar *device_path)
-{
- return strncmp(device_path, NAME_PREFIX, NAME_PREFIX_LENGTH) == 0;
-}
-
/* Get default device path. Actually, the first match in the DRM subsystem */
static const gchar *
get_default_device_path(GstVaapiDisplay *display)
GST_VAAPI_DISPLAY_DRM_PRIVATE(display);
const gchar *device_path = priv->device_path;
- if (!device_path)
- return NULL;
-
- g_return_val_if_fail(is_device_path(device_path), NULL);
-
- device_path += NAME_PREFIX_LENGTH;
- if (*device_path == '\0')
+ if (!device_path || *device_path == '\0')
return NULL;
return device_path;
}
if (!device_path)
return FALSE;
}
- priv->device_path = g_strdup_printf("%s%s", NAME_PREFIX, device_path);
+ priv->device_path = g_strdup(device_path);
return priv->device_path != NULL;
}
continue;
path = udev_device_get_devnode(device);
- priv->device_path = g_strdup_printf("%s%s", NAME_PREFIX, path);
+ priv->device_path = g_strdup(path);
udev_device_unref(device);
break;
}
#define DEBUG 1
#include "gstvaapidebug.h"
-#define NAME_PREFIX "WLD:"
-#define NAME_PREFIX_LENGTH 4
-
static const guint g_display_types = 1U << GST_VAAPI_DISPLAY_TYPE_WAYLAND;
-static inline gboolean
-is_display_name(const gchar *display_name)
-{
- return strncmp(display_name, NAME_PREFIX, NAME_PREFIX_LENGTH) == 0;
-}
-
static inline const gchar *
get_default_display_name(void)
{
const gchar *tested_name = b;
guint cached_name_length, tested_name_length;
- if (!cached_name || !is_display_name(cached_name))
- return FALSE;
- cached_name += NAME_PREFIX_LENGTH;
- cached_name_length = get_display_name_length(cached_name);
+ g_return_val_if_fail(cached_name, FALSE);
+ g_return_val_if_fail(tested_name, FALSE);
- g_return_val_if_fail(tested_name && is_display_name(tested_name), FALSE);
- tested_name += NAME_PREFIX_LENGTH;
+ 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 */
return TRUE;
}
-/* Reconstruct a display name without our prefix */
-static const gchar *
-get_display_name(GstVaapiDisplayWayland *display)
-{
- GstVaapiDisplayWaylandPrivate * const priv =
- GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display);
- const gchar *display_name = priv->display_name;
-
- if (!display_name)
- return NULL;
-
- if (is_display_name(display_name)) {
- display_name += NAME_PREFIX_LENGTH;
- if (*display_name == '\0')
- return NULL;
- return display_name;
- }
-
- /* XXX: this should not happen */
- g_assert(0 && "display name without prefix");
- return display_name;
-}
-
/* Mangle display name with our prefix */
static gboolean
set_display_name(GstVaapiDisplay *display, const gchar *display_name)
if (!display_name)
display_name = "";
}
- priv->display_name = g_strdup_printf("%s%s", NAME_PREFIX, display_name);
+ priv->display_name = g_strdup(display_name);
return priv->display_name != NULL;
}
#define DEBUG 1
#include "gstvaapidebug.h"
-#define NAME_PREFIX "X11:"
-#define NAME_PREFIX_LENGTH 4
-
static const guint g_display_types =
(1U << GST_VAAPI_DISPLAY_TYPE_X11) |
(1U << GST_VAAPI_DISPLAY_TYPE_GLX);
-static inline gboolean
-is_display_name(const gchar *display_name)
-{
- return strncmp(display_name, NAME_PREFIX, NAME_PREFIX_LENGTH) == 0;
-}
-
static inline const gchar *
get_default_display_name(void)
{
const gchar *tested_name = b, *tested_name_end;
guint cached_name_length, tested_name_length;
- if (!cached_name || !is_display_name(cached_name))
- return FALSE;
- g_return_val_if_fail(tested_name && is_display_name(tested_name), FALSE);
+ g_return_val_if_fail(cached_name, FALSE);
+ g_return_val_if_fail(tested_name, FALSE);
- cached_name += NAME_PREFIX_LENGTH;
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);
- tested_name += NAME_PREFIX_LENGTH;
tested_name_end = strchr(tested_name, ':');
if (tested_name_end)
tested_name_length = tested_name_end - tested_name;
GstVaapiDisplayX11Private * const priv = &display->priv;
const gchar *display_name = priv->display_name;
- if (!display_name)
+ if (!display_name || *display_name == '\0')
return NULL;
-
- if (is_display_name(display_name)) {
- display_name += NAME_PREFIX_LENGTH;
- if (*display_name == '\0')
- return NULL;
- return display_name;
- }
-
- /* XXX: this should not happen */
- g_assert(0 && "display name without prefix");
return display_name;
}
if (!display_name)
display_name = "";
}
- priv->display_name = g_strdup_printf("%s%s", NAME_PREFIX, display_name);
+ priv->display_name = g_strdup(display_name);
return priv->display_name != NULL;
}