stream: add protocols property

This commit is contained in:
Wim Taymans 2013-08-16 16:08:43 +02:00
parent cdbb6bcc15
commit a84b71c0f0
2 changed files with 67 additions and 1 deletions

View file

@ -68,6 +68,8 @@ struct _GstRTSPStreamPrivate
gboolean is_joined;
gchar *control;
GstRTSPLowerTrans protocols;
/* pads on the rtpbin */
GstPad *send_rtp_sink;
GstPad *recv_sink[2];
@ -120,12 +122,14 @@ struct _GstRTSPStreamPrivate
gint dscp_qos;
};
#define DEFAULT_CONTROL NULL
#define DEFAULT_CONTROL NULL
#define DEFAULT_PROTOCOLS GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_TCP
enum
{
PROP_0,
PROP_CONTROL,
PROP_PROTOCOLS,
PROP_LAST
};
@ -161,6 +165,11 @@ gst_rtsp_stream_class_init (GstRTSPStreamClass * klass)
"The control string for this stream", DEFAULT_CONTROL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PROTOCOLS,
g_param_spec_flags ("protocols", "Protocols",
"Allowed lower transport protocols", GST_TYPE_RTSP_LOWER_TRANS,
DEFAULT_PROTOCOLS, 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");
@ -177,6 +186,7 @@ gst_rtsp_stream_init (GstRTSPStream * stream)
priv->dscp_qos = -1;
priv->control = g_strdup (DEFAULT_CONTROL);
priv->protocols = DEFAULT_PROTOCOLS;
g_mutex_init (&priv->lock);
}
@ -223,6 +233,9 @@ gst_rtsp_stream_get_property (GObject * object, guint propid,
case PROP_CONTROL:
g_value_take_string (value, gst_rtsp_stream_get_control (stream));
break;
case PROP_PROTOCOLS:
g_value_set_flags (value, gst_rtsp_stream_get_protocols (stream));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
}
@ -238,6 +251,9 @@ gst_rtsp_stream_set_property (GObject * object, guint propid,
case PROP_CONTROL:
gst_rtsp_stream_set_control (stream, g_value_get_string (value));
break;
case PROP_PROTOCOLS:
gst_rtsp_stream_set_protocols (stream, g_value_get_flags (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, propid, pspec);
}
@ -498,6 +514,53 @@ gst_rtsp_stream_get_dscp_qos (GstRTSPStream * stream)
return priv->dscp_qos;
}
/**
* gst_rtsp_stream_set_protocols:
* @stream: a #GstRTSPStream
* @protocols: the new flags
*
* Configure the allowed lower transport for @stream.
*/
void
gst_rtsp_stream_set_protocols (GstRTSPStream * stream,
GstRTSPLowerTrans protocols)
{
GstRTSPStreamPrivate *priv;
g_return_if_fail (GST_IS_RTSP_STREAM (stream));
priv = stream->priv;
g_mutex_lock (&priv->lock);
priv->protocols = protocols;
g_mutex_unlock (&priv->lock);
}
/**
* gst_rtsp_stream_get_protocols:
* @stream: a #GstRTSPStream
*
* Get the allowed protocols of @stream.
*
* Returns: a #GstRTSPLowerTrans
*/
GstRTSPLowerTrans
gst_rtsp_stream_get_protocols (GstRTSPStream * stream)
{
GstRTSPStreamPrivate *priv;
GstRTSPLowerTrans res;
g_return_val_if_fail (GST_IS_RTSP_STREAM (stream),
GST_RTSP_LOWER_TRANS_UNKNOWN);
priv = stream->priv;
g_mutex_lock (&priv->lock);
res = priv->protocols;
g_mutex_unlock (&priv->lock);
return res;
}
/**
* gst_rtsp_stream_set_address_pool:

View file

@ -77,6 +77,9 @@ guint gst_rtsp_stream_get_mtu (GstRTSPStream *stream);
void gst_rtsp_stream_set_dscp_qos (GstRTSPStream *stream, gint dscp_qos);
gint gst_rtsp_stream_get_dscp_qos (GstRTSPStream *stream);
void gst_rtsp_stream_set_protocols (GstRTSPStream *stream, GstRTSPLowerTrans protocols);
GstRTSPLowerTrans gst_rtsp_stream_get_protocols (GstRTSPStream *stream);
void gst_rtsp_stream_set_address_pool (GstRTSPStream *stream, GstRTSPAddressPool *pool);
GstRTSPAddressPool *
gst_rtsp_stream_get_address_pool (GstRTSPStream *stream);