rtsp: add TLS support

Add flag to select TLS in the transport.
Enable TLS on the socketclient when we use a TLS uri.
This commit is contained in:
Wim Taymans 2013-05-28 17:06:14 +02:00
parent 057bbae6c5
commit 909e119a23
4 changed files with 18 additions and 2 deletions

View file

@ -212,12 +212,16 @@ gst_rtsp_connection_create (const GstRTSPUrl * url, GstRTSPConnection ** conn)
GstRTSPConnection *newconn;
g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
g_return_val_if_fail (url != NULL, GST_RTSP_EINVAL);
newconn = g_new0 (GstRTSPConnection, 1);
newconn->cancellable = g_cancellable_new ();
newconn->client = g_socket_client_new ();
if (url->transports & GST_RTSP_LOWER_TRANS_TLS)
g_socket_client_set_tls (newconn->client, TRUE);
newconn->url = gst_rtsp_url_copy (url);
newconn->timer = g_timer_new ();
newconn->timeout = 60;

View file

@ -124,6 +124,7 @@ gst_rtsp_lower_trans_get_type (void)
"udp-multicast"},
{GST_RTSP_LOWER_TRANS_TCP, "GST_RTSP_LOWER_TRANS_TCP", "tcp"},
{GST_RTSP_LOWER_TRANS_HTTP, "GST_RTSP_LOWER_TRANS_HTTP", "http"},
{GST_RTSP_LOWER_TRANS_TLS, "GST_RTSP_LOWER_TRANS_TLS", "tls"},
{0, NULL, NULL},
};

View file

@ -83,6 +83,7 @@ typedef enum {
* @GST_RTSP_LOWER_TRANS_UDP_MCAST: stream data over UDP multicast
* @GST_RTSP_LOWER_TRANS_TCP: stream data over TCP
* @GST_RTSP_LOWER_TRANS_HTTP: stream data tunneled over HTTP.
* @GST_RTSP_LOWER_TRANS_TLS: encrypt TCP and HTTP with TLS
*
* The different transport methods.
*/
@ -91,7 +92,8 @@ typedef enum {
GST_RTSP_LOWER_TRANS_UDP = (1 << 0),
GST_RTSP_LOWER_TRANS_UDP_MCAST = (1 << 1),
GST_RTSP_LOWER_TRANS_TCP = (1 << 2),
GST_RTSP_LOWER_TRANS_HTTP = (1 << 4)
GST_RTSP_LOWER_TRANS_HTTP = (1 << 4),
GST_RTSP_LOWER_TRANS_TLS = (1 << 5)
} GstRTSPLowerTrans;
#define GST_TYPE_RTSP_LOWER_TRANS (gst_rtsp_lower_trans_get_type())

View file

@ -67,7 +67,16 @@ static const struct
GST_RTSP_LOWER_TRANS_UDP_MCAST}, {
"rtspu", GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST}, {
"rtspt", GST_RTSP_LOWER_TRANS_TCP}, {
"rtsph", GST_RTSP_LOWER_TRANS_HTTP | GST_RTSP_LOWER_TRANS_TCP}
"rtsph", GST_RTSP_LOWER_TRANS_HTTP | GST_RTSP_LOWER_TRANS_TCP}, {
"rtsps", GST_RTSP_LOWER_TRANS_TCP | GST_RTSP_LOWER_TRANS_UDP |
GST_RTSP_LOWER_TRANS_UDP_MCAST | GST_RTSP_LOWER_TRANS_TLS}, {
"rtspsu",
GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST |
GST_RTSP_LOWER_TRANS_TLS}, {
"rtspst", GST_RTSP_LOWER_TRANS_TCP | GST_RTSP_LOWER_TRANS_TLS}, {
"rtspsh",
GST_RTSP_LOWER_TRANS_HTTP | GST_RTSP_LOWER_TRANS_TCP |
GST_RTSP_LOWER_TRANS_TLS}
};
/* format is rtsp[u]://[user:passwd@]host[:port]/abspath[?query] where host