From f2aafffb2c68a023fd20b08451de20d1e2808fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Mon, 22 Jan 2018 17:05:13 +0800 Subject: [PATCH] gstpipewiresrc: Add fd parameter Will be passed to a pw_remote_connect_fd() instead of plain a pw_remote_connect() call. --- src/gst/gstpipewiresink.c | 2 +- src/gst/gstpipewiresrc.c | 19 +++++++++++++++++++ src/gst/gstpipewiresrc.h | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gst/gstpipewiresink.c b/src/gst/gstpipewiresink.c index 3ed348194..498ef8153 100644 --- a/src/gst/gstpipewiresink.c +++ b/src/gst/gstpipewiresink.c @@ -197,7 +197,7 @@ gst_pipewire_sink_class_init (GstPipeWireSinkClass * klass) g_param_spec_int ("fd", "Fd", "The fd to connect with", - 0, G_MAXINT, -1, + -1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 16f74848b..ec3b75823 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -60,6 +60,7 @@ enum PROP_CLIENT_NAME, PROP_STREAM_PROPERTIES, PROP_ALWAYS_COPY, + PROP_FD, }; @@ -115,6 +116,10 @@ gst_pipewire_src_set_property (GObject * object, guint prop_id, pwsrc->always_copy = g_value_get_boolean (value); break; + case PROP_FD: + pwsrc->fd = g_value_get_int (value); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -144,6 +149,10 @@ gst_pipewire_src_get_property (GObject * object, guint prop_id, g_value_set_boolean (value, pwsrc->always_copy); break; + case PROP_FD: + g_value_set_int (value, pwsrc->fd); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -264,6 +273,15 @@ gst_pipewire_src_class_init (GstPipeWireSrcClass * klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, + PROP_FD, + g_param_spec_int ("fd", + "Fd", + "The fd to connect with", + -1, G_MAXINT, -1, + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + gstelement_class->provide_clock = gst_pipewire_src_provide_clock; gstelement_class->change_state = gst_pipewire_src_change_state; @@ -298,6 +316,7 @@ gst_pipewire_src_init (GstPipeWireSrc * src) GST_OBJECT_FLAG_SET (src, GST_ELEMENT_FLAG_PROVIDE_CLOCK); src->always_copy = DEFAULT_ALWAYS_COPY; + src->fd = -1; g_queue_init (&src->queue); diff --git a/src/gst/gstpipewiresrc.h b/src/gst/gstpipewiresrc.h index ad769ae2e..45820b8fb 100644 --- a/src/gst/gstpipewiresrc.h +++ b/src/gst/gstpipewiresrc.h @@ -55,6 +55,7 @@ struct _GstPipeWireSrc { gchar *path; gchar *client_name; gboolean always_copy; + int fd; gboolean negotiated; gboolean flushing;