Commit 946fcf95 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Basic support for RTP-Info

parent f35e96de
......@@ -1473,6 +1473,32 @@ void rtp_del_sink( sout_stream_id_t *id, int fd )
net_Close( sink.rtp_fd );
}
uint16_t rtp_get_seq( const sout_stream_id_t *id )
{
/* This will return values for the next packet.
* Accounting for caching would not be totally trivial. */
return id->i_sequence;
}
/* FIXME: this is pretty bad - if we remove and then insert an ES
* the number will get unsynched from inside RTSP */
unsigned rtp_get_num( const sout_stream_id_t *id )
{
sout_stream_sys_t *p_sys = id->p_stream->p_sys;
int i;
vlc_mutex_lock( &p_sys->lock_es );
for( i = 0; i < p_sys->i_es; i++ )
{
if( id == p_sys->es[i] )
break;
}
vlc_mutex_unlock( &p_sys->lock_es );
return i;
}
/****************************************************************************
* rtp_packetize_*:
****************************************************************************/
......
......@@ -38,6 +38,8 @@ char *SDPGenerate( const sout_stream_t *p_stream, const char *rtsp_url );
int rtp_add_sink( sout_stream_id_t *id, int fd, vlc_bool_t rtcp_mux );
void rtp_del_sink( sout_stream_id_t *id, int fd );
uint16_t rtp_get_seq( const sout_stream_id_t *id );
unsigned rtp_get_num( const sout_stream_id_t *id );
/* RTCP */
typedef struct rtcp_sender_t rtcp_sender_t;
......
......@@ -195,6 +195,7 @@ rtsp_stream_id_t *RtspAddId( rtsp_stream_t *rtsp, sout_stream_id_t *sid,
id->hiport = hiport;
}
/* FIXME: num screws up if any ES has been removed and re-added */
snprintf( urlbuf, sizeof( urlbuf ), rtsp->track_fmt, rtsp->psz_path,
num );
msg_Dbg( rtsp->owner, "RTSP: adding %s", urlbuf );
......@@ -603,15 +604,31 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
ses = RtspClientGet( rtsp, psz_session );
if( ses != NULL )
{
/* FIXME: we really need to limit the number of tracks... */
char info[ses->trackc * ( strlen( control )
+ sizeof("/trackID=123;seq=65535, ") ) + 1];
size_t infolen = 0;
for( int i = 0; i < ses->trackc; i++ )
{
rtsp_strack_t *tr = ses->trackv + i;
if( !tr->playing
&& ( ( id == NULL ) || ( tr->id == id->sout_id ) ) )
if( ( id == NULL ) || ( tr->id == id->sout_id ) )
{
if( !tr->playing )
{
tr->playing = VLC_TRUE;
rtp_add_sink( tr->id, tr->fd, VLC_FALSE );
}
infolen += sprintf( info + infolen,
"%s/trackID=%u;seq=%u, ", control,
rtp_get_num( tr->id ),
rtp_get_seq( tr->id ) );
}
}
if( infolen > 0 )
{
info[infolen - 2] = '\0'; /* remove trailing ", " */
httpd_MsgAdd( answer, "RTP-Info", "%s", info );
}
}
vlc_mutex_unlock( &rtsp->lock );
......
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