Commit 4db2dc94 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Cleanup RTP / RTSP boundary a little

parent 39d3b160
......@@ -514,8 +514,7 @@ static void Close( vlc_object_t * p_this )
}
}
while( p_sys->i_rtsp > 0 )
RtspClientDel( p_stream, p_sys->rtsp[0] );
RtspUnsetup( p_stream );
vlc_mutex_destroy( &p_sys->lock_sdp );
......@@ -1112,23 +1111,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
msg_Dbg( p_stream, "maximum RTP packet size: %d bytes", id->i_mtu );
if( p_sys->p_rtsp_url )
{
char psz_urlc[strlen( p_sys->psz_rtsp_control ) + 1 + 10];
sprintf( psz_urlc, "%s/trackID=%d", p_sys->psz_rtsp_path, p_sys->i_es );
msg_Dbg( p_stream, "rtsp: adding %s\n", psz_urlc );
id->p_rtsp_url = httpd_UrlNewUnique( p_sys->p_rtsp_host, psz_urlc, NULL, NULL, NULL );
if( id->p_rtsp_url )
{
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_DESCRIBE, RtspCallbackId, (void*)id );
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_SETUP, RtspCallbackId, (void*)id );
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_PLAY, RtspCallbackId, (void*)id );
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_PAUSE, RtspCallbackId, (void*)id );
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_TEARDOWN, RtspCallbackId, (void*)id );
}
}
RtspSetupId( p_stream, id );
/* Update p_sys context */
vlc_mutex_lock( &p_sys->lock_es );
......
......@@ -24,12 +24,9 @@
typedef struct rtsp_client_t rtsp_client_t;
int RtspSetup( sout_stream_t *p_stream, vlc_url_t * );
int RtspCallbackId( httpd_callback_sys_t *, httpd_client_t *,
httpd_message_t *, httpd_message_t * );
void RtspClientDel( sout_stream_t *, rtsp_client_t * );
int RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url );
int RtspSetupId( sout_stream_t *p_stream, sout_stream_id_t *id );
void RtspUnsetup( sout_stream_t *p_stream );
char *SDPGenerate( const sout_stream_t *p_stream,
const char *psz_destination, vlc_bool_t b_rtsp );
......
......@@ -52,10 +52,12 @@ struct rtsp_client_t
static int RtspCallback( httpd_callback_sys_t *p_args,
httpd_client_t *cl,
httpd_message_t *answer, httpd_message_t *query );
static int RtspCallbackId( httpd_callback_sys_t *p_args,
httpd_client_t *cl,
httpd_message_t *answer, httpd_message_t *query );
static void RtspClientDel( sout_stream_t *p_stream, rtsp_client_t *rtsp );
int RtspSetup( sout_stream_t *p_stream, vlc_url_t *url )
int RtspSetup( sout_stream_t *p_stream, const vlc_url_t *url )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
......@@ -73,7 +75,7 @@ int RtspSetup( sout_stream_t *p_stream, vlc_url_t *url )
url->psz_host, url->i_port > 0 ? url->i_port : 554, p_sys->psz_rtsp_path );
p_sys->p_rtsp_url = httpd_UrlNewUnique( p_sys->p_rtsp_host, p_sys->psz_rtsp_path, NULL, NULL, NULL );
if( p_sys->p_rtsp_url == 0 )
if( p_sys->p_rtsp_url == NULL )
{
return VLC_EGENERIC;
}
......@@ -87,6 +89,36 @@ int RtspSetup( sout_stream_t *p_stream, vlc_url_t *url )
}
int RtspSetupId( sout_stream_t *p_stream, sout_stream_id_t *id )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
char psz_urlc[strlen( p_sys->psz_rtsp_control ) + 1 + 10];
sprintf( psz_urlc, "%s/trackID=%d", p_sys->psz_rtsp_path, p_sys->i_es );
msg_Dbg( p_stream, "rtsp: adding %s\n", psz_urlc );
id->p_rtsp_url = httpd_UrlNewUnique( p_sys->p_rtsp_host, psz_urlc, NULL, NULL, NULL );
if( id->p_rtsp_url )
{
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_DESCRIBE, RtspCallbackId, (void*)id );
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_SETUP, RtspCallbackId, (void*)id );
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_PLAY, RtspCallbackId, (void*)id );
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_PAUSE, RtspCallbackId, (void*)id );
httpd_UrlCatch( id->p_rtsp_url, HTTPD_MSG_TEARDOWN, RtspCallbackId, (void*)id );
}
return VLC_SUCCESS;
}
void RtspUnsetup( sout_stream_t *p_stream )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
while( p_sys->i_rtsp > 0 )
RtspClientDel( p_stream, p_sys->rtsp[0] );
}
static rtsp_client_t *RtspClientNew( sout_stream_t *p_stream, const char *psz_session )
{
rtsp_client_t *rtsp = malloc( sizeof( rtsp_client_t ));
......@@ -122,7 +154,7 @@ static rtsp_client_t *RtspClientGet( sout_stream_t *p_stream, const char *psz_se
}
/*static*/ void RtspClientDel( sout_stream_t *p_stream, rtsp_client_t *rtsp )
static void RtspClientDel( sout_stream_t *p_stream, rtsp_client_t *rtsp )
{
int i;
TAB_REMOVE( p_stream->p_sys->i_rtsp, p_stream->p_sys->rtsp, rtsp );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment