mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
waylandsink: make the display property useful
Let the display property control the name of the display, like in x(v)imagesink.
This commit is contained in:
parent
e7650117af
commit
253eafd4ef
2 changed files with 14 additions and 10 deletions
|
@ -55,7 +55,7 @@ enum
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_WAYLAND_DISPLAY
|
PROP_DISPLAY
|
||||||
};
|
};
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gstwayland_debug);
|
GST_DEBUG_CATEGORY (gstwayland_debug);
|
||||||
|
@ -127,10 +127,10 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_wayland_sink_propose_allocation);
|
GST_DEBUG_FUNCPTR (gst_wayland_sink_propose_allocation);
|
||||||
gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_wayland_sink_render);
|
gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_wayland_sink_render);
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_WAYLAND_DISPLAY,
|
g_object_class_install_property (gobject_class, PROP_DISPLAY,
|
||||||
g_param_spec_pointer ("wayland-display", "Wayland Display",
|
g_param_spec_string ("display", "Wayland Display name", "Wayland "
|
||||||
"Wayland Display handle created by the application ",
|
"display name to connect to, if not supplied with GstVideoOverlay",
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -148,8 +148,8 @@ gst_wayland_sink_get_property (GObject * object,
|
||||||
GstWaylandSink *sink = GST_WAYLAND_SINK (object);
|
GstWaylandSink *sink = GST_WAYLAND_SINK (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_WAYLAND_DISPLAY:
|
case PROP_DISPLAY:
|
||||||
g_value_set_pointer (value, sink->display);
|
g_value_set_string (value, sink->display_name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -164,8 +164,8 @@ gst_wayland_sink_set_property (GObject * object,
|
||||||
GstWaylandSink *sink = GST_WAYLAND_SINK (object);
|
GstWaylandSink *sink = GST_WAYLAND_SINK (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_WAYLAND_DISPLAY:
|
case PROP_DISPLAY:
|
||||||
sink->display = g_value_get_pointer (value);
|
sink->display_name = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -184,6 +184,8 @@ gst_wayland_sink_finalize (GObject * object)
|
||||||
g_object_unref (sink->window);
|
g_object_unref (sink->window);
|
||||||
if (sink->display)
|
if (sink->display)
|
||||||
g_object_unref (sink->display);
|
g_object_unref (sink->display);
|
||||||
|
if (sink->display_name)
|
||||||
|
g_free (sink->display_name);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -280,7 +282,7 @@ gst_wayland_sink_start (GstBaseSink * bsink)
|
||||||
GST_DEBUG_OBJECT (sink, "start");
|
GST_DEBUG_OBJECT (sink, "start");
|
||||||
|
|
||||||
if (!sink->display)
|
if (!sink->display)
|
||||||
sink->display = gst_wl_display_new (NULL, &error);
|
sink->display = gst_wl_display_new (sink->display_name, &error);
|
||||||
|
|
||||||
if (sink->display == NULL) {
|
if (sink->display == NULL) {
|
||||||
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_READ_WRITE,
|
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_READ_WRITE,
|
||||||
|
|
|
@ -59,6 +59,8 @@ struct _GstWaylandSink
|
||||||
gint video_width;
|
gint video_width;
|
||||||
gint video_height;
|
gint video_height;
|
||||||
enum wl_shm_format format;
|
enum wl_shm_format format;
|
||||||
|
|
||||||
|
gchar *display_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstWaylandSinkClass
|
struct _GstWaylandSinkClass
|
||||||
|
|
Loading…
Reference in a new issue