diff --git a/src/client/pv-stream.c b/src/client/pv-stream.c
index c4bd7ad70..ce4968fd2 100644
--- a/src/client/pv-stream.c
+++ b/src/client/pv-stream.c
@@ -474,8 +474,8 @@ do_connect_capture (PvStream *stream)
g_dbus_proxy_call (context->priv->client,
"CreateSourceOutput",
- g_variant_new ("(os)",
- (priv->target ? priv->target : "/"),
+ g_variant_new ("(ss)",
+ (priv->target ? priv->target : ""),
g_bytes_get_data (priv->accepted_formats, NULL)),
G_DBUS_CALL_FLAGS_NONE,
-1,
diff --git a/src/dbus/org.pulsevideo.xml b/src/dbus/org.pulsevideo.xml
index 6e5cd17f4..ee60b6d05 100644
--- a/src/dbus/org.pulsevideo.xml
+++ b/src/dbus/org.pulsevideo.xml
@@ -59,7 +59,7 @@
Create a new output for @source with given @incaps
-->
-
+
diff --git a/src/gst/gstpvsink.c b/src/gst/gstpvsink.c
index 8051a7564..e90ec65fe 100644
--- a/src/gst/gstpvsink.c
+++ b/src/gst/gstpvsink.c
@@ -23,8 +23,8 @@
*
* Example launch line
* |[
- * gst-launch -v pulsevideosink ! ximagesink
- * ]| Shows pulsevideo output in an X window.
+ * gst-launch -v videotestsrc ! pulsevideosink
+ * ]| Sends a test video source to pulsevideo
*
*/
diff --git a/src/gst/gstpvsrc.c b/src/gst/gstpvsrc.c
index 0fdc072e4..a457b8c4a 100644
--- a/src/gst/gstpvsrc.c
+++ b/src/gst/gstpvsrc.c
@@ -23,7 +23,7 @@
*
* Example launch line
* |[
- * gst-launch -v pulsevideosrc ! ximagesink
+ * gst-launch -v pulsevideosrc ! videoconvert ! ximagesink
* ]| Shows pulsevideo output in an X window.
*
*/
@@ -50,7 +50,7 @@ GST_DEBUG_CATEGORY_STATIC (pulsevideo_src_debug);
enum
{
PROP_0,
- PROP_LAST
+ PROP_SOURCE
};
@@ -66,11 +66,6 @@ GST_STATIC_PAD_TEMPLATE ("src",
#define gst_pulsevideo_src_parent_class parent_class
G_DEFINE_TYPE (GstPulsevideoSrc, gst_pulsevideo_src, GST_TYPE_PUSH_SRC);
-static void gst_pulsevideo_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_pulsevideo_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
static GstStateChangeReturn
gst_pulsevideo_src_change_state (GstElement * element, GstStateChange transition);
@@ -85,6 +80,51 @@ static GstFlowReturn gst_pulsevideo_src_create (GstPushSrc * psrc,
static gboolean gst_pulsevideo_src_start (GstBaseSrc * basesrc);
static gboolean gst_pulsevideo_src_stop (GstBaseSrc * basesrc);
+static void
+gst_pulsevideo_src_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstPulsevideoSrc *pvsrc = GST_PULSEVIDEO_SRC (object);
+
+ switch (prop_id) {
+ case PROP_SOURCE:
+ g_free (pvsrc->source);
+ pvsrc->source = g_value_dup_string (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gst_pulsevideo_src_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GstPulsevideoSrc *pvsrc = GST_PULSEVIDEO_SRC (object);
+
+ switch (prop_id) {
+ case PROP_SOURCE:
+ g_value_set_string (value, pvsrc->source);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gst_pulsevideo_src_finalize (GObject * object)
+{
+ GstPulsevideoSrc *pvsrc = GST_PULSEVIDEO_SRC (object);
+
+ g_free (pvsrc->source);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
static void
gst_pulsevideo_src_class_init (GstPulsevideoSrcClass * klass)
{
@@ -98,9 +138,20 @@ gst_pulsevideo_src_class_init (GstPulsevideoSrcClass * klass)
gstbasesrc_class = (GstBaseSrcClass *) klass;
gstpushsrc_class = (GstPushSrcClass *) klass;
+ gobject_class->finalize = gst_pulsevideo_src_finalize;
gobject_class->set_property = gst_pulsevideo_src_set_property;
gobject_class->get_property = gst_pulsevideo_src_get_property;
+ g_object_class_install_property (gobject_class,
+ PROP_SOURCE,
+ g_param_spec_string ("source",
+ "Source",
+ "The source name to connect to (NULL = default)",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
+
+
gstelement_class->change_state = gst_pulsevideo_src_change_state;
gst_element_class_set_static_metadata (gstelement_class,
@@ -172,28 +223,6 @@ gst_pulsevideo_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
return caps;
}
-static void
-gst_pulsevideo_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_pulsevideo_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
static void
on_new_buffer (GObject *gobject,
gpointer user_data)
@@ -263,7 +292,7 @@ gst_pulsevideo_src_negotiate (GstBaseSrc * basesrc)
/* open a connection with these caps */
str = gst_caps_to_string (caps);
accepted = g_bytes_new_take (str, strlen (str) + 1);
- pv_stream_connect_capture (pvsrc->stream, NULL, 0, accepted);
+ pv_stream_connect_capture (pvsrc->stream, pvsrc->source, 0, accepted);
g_mutex_lock (&pvsrc->lock);
while (TRUE) {
diff --git a/src/gst/gstpvsrc.h b/src/gst/gstpvsrc.h
index 0fe7344c2..93ad30e6d 100644
--- a/src/gst/gstpvsrc.h
+++ b/src/gst/gstpvsrc.h
@@ -54,6 +54,7 @@ struct _GstPulsevideoSrc {
GstPushSrc element;
/*< private >*/
+ gchar *source;
gboolean negotiated;
diff --git a/src/server/pv-daemon.c b/src/server/pv-daemon.c
index bfcd00994..12bd9b20b 100644
--- a/src/server/pv-daemon.c
+++ b/src/server/pv-daemon.c
@@ -372,19 +372,30 @@ pv_daemon_find_source (PvDaemon *daemon,
GError **error)
{
PvDaemonPrivate *priv;
+ PvSource *best = NULL;
+ GList *walk;
g_return_val_if_fail (PV_IS_DAEMON (daemon), NULL);
priv = daemon->priv;
- if (priv->sources == NULL) {
+ for (walk = priv->sources; walk; walk = g_list_next (walk)) {
+ PvSource *s = walk->data;
+
+ if (name == NULL) {
+ best = s;
+ break;
+ }
+ else if (g_str_has_suffix (pv_source_get_object_path (s), name))
+ best = s;
+ }
+
+ if (best == NULL) {
if (error)
*error = g_error_new (G_IO_ERROR,
G_IO_ERROR_NOT_FOUND,
- "No sources registered");
- return NULL;
+ "Source not found");
}
-
- return priv->sources->data;
+ return best;
}
G_DEFINE_TYPE (PvDaemon, pv_daemon, G_TYPE_OBJECT);