stream: add method to check supported transport

Add a method to check if a transport is supported
This commit is contained in:
Wim Taymans 2014-01-07 12:14:15 +01:00
parent 43ec4e7c78
commit a1202effda
2 changed files with 54 additions and 0 deletions

View file

@ -545,6 +545,57 @@ gst_rtsp_stream_get_dscp_qos (GstRTSPStream * stream)
return priv->dscp_qos; return priv->dscp_qos;
} }
/**
* gst_rtsp_stream_is_transport_supported:
* @stream: a #GstRTSPStream
* @transport: a #GstRTSPTransport
*
* Check if @transport can be handled by stream
*
* Returns: %TRUE if @transport can be handled by @stream.
*/
gboolean
gst_rtsp_stream_is_transport_supported (GstRTSPStream * stream,
GstRTSPTransport * transport)
{
GstRTSPStreamPrivate *priv;
g_return_if_fail (GST_IS_RTSP_STREAM (stream));
priv = stream->priv;
g_mutex_lock (&priv->lock);
if (transport->trans != GST_RTSP_TRANS_RTP)
goto unsupported_transmode;
if (transport->profile != GST_RTSP_PROFILE_AVP)
goto unsupported_profile;
if (!(transport->lower_transport & priv->protocols))
goto unsupported_ltrans;
g_mutex_unlock (&priv->lock);
return TRUE;
/* ERRORS */
unsupported_transmode:
{
GST_DEBUG ("unsupported transport mode %d", transport->trans);
return FALSE;
}
unsupported_profile:
{
GST_DEBUG ("unsupported profile %d", transport->profile);
return FALSE;
}
unsupported_ltrans:
{
GST_DEBUG ("unsupported lower transport %d", transport->lower_transport);
return FALSE;
}
}
/** /**
* gst_rtsp_stream_set_protocols: * gst_rtsp_stream_set_protocols:
* @stream: a #GstRTSPStream * @stream: a #GstRTSPStream

View file

@ -82,6 +82,9 @@ guint gst_rtsp_stream_get_mtu (GstRTSPStream *stream);
void gst_rtsp_stream_set_dscp_qos (GstRTSPStream *stream, gint dscp_qos); void gst_rtsp_stream_set_dscp_qos (GstRTSPStream *stream, gint dscp_qos);
gint gst_rtsp_stream_get_dscp_qos (GstRTSPStream *stream); gint gst_rtsp_stream_get_dscp_qos (GstRTSPStream *stream);
gboolean gst_rtsp_stream_is_transport_supported (GstRTSPStream *stream,
GstRTSPTransport *transport);
void gst_rtsp_stream_set_protocols (GstRTSPStream *stream, GstRTSPLowerTrans protocols); void gst_rtsp_stream_set_protocols (GstRTSPStream *stream, GstRTSPLowerTrans protocols);
GstRTSPLowerTrans gst_rtsp_stream_get_protocols (GstRTSPStream *stream); GstRTSPLowerTrans gst_rtsp_stream_get_protocols (GstRTSPStream *stream);