+
+ case HTTPD_MSG_PLAY:
+ {
+ rtsp_session_t *ses;
+ answer->i_status = 200;
+
+ psz_session = httpd_MsgGet( query, "Session" );
+ if( httpd_MsgGet( query, "Range" ) != NULL )
+ {
+ answer->i_status = 456; /* cannot seek */
+ break;
+ }
+
+ vlc_mutex_lock( &rtsp->lock );
+ 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( ( 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 );
+
+ if( httpd_MsgGet( query, "Scale" ) != NULL )
+ httpd_MsgAdd( answer, "Scale", "1." );
+ break;
+ }
+
+ case HTTPD_MSG_PAUSE:
+ answer->i_status = 405;
+ httpd_MsgAdd( answer, "Allow",
+ "%s, TEARDOWN, PLAY, GET_PARAMETER",
+ ( id != NULL ) ? "SETUP" : "DESCRIBE" );
+ break;
+
+ case HTTPD_MSG_GETPARAMETER:
+ if( query->i_body > 0 )
+ {
+ answer->i_status = 451;
+ break;
+ }
+
+ psz_session = httpd_MsgGet( query, "Session" );
+ answer->i_status = 200;
+ break;
+
+ case HTTPD_MSG_TEARDOWN:
+ {
+ rtsp_session_t *ses;
+
+ answer->i_status = 200;
+
+ psz_session = httpd_MsgGet( query, "Session" );
+
+ vlc_mutex_lock( &rtsp->lock );
+ ses = RtspClientGet( rtsp, psz_session );
+ if( ses != NULL )
+ {
+ if( id == NULL ) /* Delete the entire session */
+ RtspClientDel( rtsp, ses );
+ else /* Delete one track from the session */
+ for( int i = 0; i < ses->trackc; i++ )
+ {
+ if( ses->trackv[i].id == id->sout_id )
+ {
+ rtp_del_sink( id->sout_id, ses->trackv[i].fd );
+ REMOVE_ELEM( ses->trackv, ses->trackc, i );
+ }
+ }
+ }
+ vlc_mutex_unlock( &rtsp->lock );
+ break;