GstElement *payloader;
guint buffer_size;
gboolean is_joined;
+ gchar *control;
/* pads on the rtpbin */
GstPad *send_rtp_sink;
gint dscp_qos;
};
+#define DEFAULT_CONTROL NULL
enum
{
PROP_0,
+ PROP_CONTROL,
PROP_LAST
};
static GQuark ssrc_stream_map_key;
+static void gst_rtsp_stream_get_property (GObject * object, guint propid,
+ GValue * value, GParamSpec * pspec);
+static void gst_rtsp_stream_set_property (GObject * object, guint propid,
+ const GValue * value, GParamSpec * pspec);
+
static void gst_rtsp_stream_finalize (GObject * obj);
G_DEFINE_TYPE (GstRTSPStream, gst_rtsp_stream, G_TYPE_OBJECT);
gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->get_property = gst_rtsp_stream_get_property;
+ gobject_class->set_property = gst_rtsp_stream_set_property;
gobject_class->finalize = gst_rtsp_stream_finalize;
+ g_object_class_install_property (gobject_class, PROP_CONTROL,
+ g_param_spec_string ("control", "Control",
+ "The control string for this stream", DEFAULT_CONTROL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
GST_DEBUG_CATEGORY_INIT (rtsp_stream_debug, "rtspstream", 0, "GstRTSPStream");
ssrc_stream_map_key = g_quark_from_static_string ("GstRTSPServer.stream");
stream->priv = priv;
- stream->priv->dscp_qos = -1;
+ priv->dscp_qos = -1;
+ priv->control = g_strdup (DEFAULT_CONTROL);
g_mutex_init (&priv->lock);
}
g_object_unref (priv->pool);
gst_object_unref (priv->payloader);
gst_object_unref (priv->srcpad);
+ g_free (priv->control);
g_mutex_clear (&priv->lock);
G_OBJECT_CLASS (gst_rtsp_stream_parent_class)->finalize (obj);
}
+static void
+gst_rtsp_stream_get_property (GObject * object, guint propid,
+ GValue * value, GParamSpec * pspec)
+{
+ GstRTSPStream *stream = GST_RTSP_STREAM (object);
+
+ switch (propid) {
+ case PROP_CONTROL:
+ g_value_take_string (value, gst_rtsp_stream_get_control (stream));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
+ }
+}
+
+static void
+gst_rtsp_stream_set_property (GObject * object, guint propid,
+ const GValue * value, GParamSpec * pspec)
+{
+ GstRTSPStream *stream = GST_RTSP_STREAM (object);
+
+ switch (propid) {
+ case PROP_CONTROL:
+ gst_rtsp_stream_set_control (stream, g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
+ }
+}
+
/**
* gst_rtsp_stream_new:
* @idx: an index
return stream->priv->idx;
}
- /**
+/**
* gst_rtsp_stream_get_srcpad:
* @stream: a #GstRTSPStream
*
}
/**
+ * gst_rtsp_stream_get_control:
+ * @stream: a #GstRTSPStream
+ *
+ * Get the control string to identify this stream.
+ *
+ * Return: the control string. free after usage.
+ */
+gchar *
+gst_rtsp_stream_get_control (GstRTSPStream * stream)
+{
+ GstRTSPStreamPrivate *priv;
+ gchar *result;
+
+ g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL);
+
+ priv = stream->priv;
+
+ g_mutex_lock (&priv->lock);
+ if ((result = g_strdup (priv->control)) == NULL)
+ result = g_strdup_printf ("stream=%d", priv->idx);
+ g_mutex_unlock (&priv->lock);
+
+ return result;
+}
+
+/**
+ * gst_rtsp_stream_set_control:
+ * @stream: a #GstRTSPStream
+ * @control: a control string
+ *
+ * Set the control string in @stream.
+ */
+void
+gst_rtsp_stream_set_control (GstRTSPStream * stream, const gchar * control)
+{
+ GstRTSPStreamPrivate *priv;
+
+ g_return_if_fail (GST_IS_RTSP_STREAM (stream));
+
+ priv = stream->priv;
+
+ g_mutex_lock (&priv->lock);
+ g_free (priv->control);
+ priv->control = g_strdup (control);
+ g_mutex_unlock (&priv->lock);
+}
+
+/**
* gst_rtsp_stream_set_mtu:
* @stream: a #GstRTSPStream
* @mtu: a new MTU