int i_es;
media_es_t **es;
char *psz_mux;
+ int b_raw;
/* RTSP client */
int i_rtsp;
char *psz_playnow = NULL; /* support option: x-playNow */
char *psz_session = NULL;
rtsp_client_t *p_rtsp;
+ int i_port = 0;
if( answer == NULL || query == NULL ) return VLC_SUCCESS;
{
rtsp_client_t *p_rtsp;
char ip[NI_MAXNUMERICHOST];
- int i_port = atoi( strstr( psz_transport, "client_port=" ) +
+ i_port = atoi( strstr( psz_transport, "client_port=" ) +
strlen("client_port=") );
+ if( strstr( psz_transport, "MP2T/H2221/UDP" ) ||
+ strstr( psz_transport, "RAW/RAW/UDP" ) )
+ {
+ p_media->b_raw = 1;
+ }
if( httpd_ClientIP( cl, ip ) == NULL )
{
answer->i_status = 500;
}
}
- if( psz_playnow ) /* support option: x-playNow */
- goto rtsp_play_now;
-
answer->i_status = 200;
answer->psz_status = strdup( "OK" );
answer->i_body = 0;
answer->i_body = 0;
answer->p_body = NULL;
}
- break;
- }
-
- case HTTPD_MSG_DESCRIBE:
- {
- char *psz_sdp =
- SDPGenerate( p_media, cl );
-
- if( psz_sdp != NULL )
- {
- answer->i_status = 200;
- answer->psz_status = strdup( "OK" );
- httpd_MsgAdd( answer, "Content-type", "%s", "application/sdp" );
-
- answer->p_body = (uint8_t *)psz_sdp;
- answer->i_body = strlen( psz_sdp );
- }
- else
- {
- answer->i_status = 500;
- answer->psz_status = strdup( "Internal server error" );
- answer->p_body = NULL;
- answer->i_body = 0;
- }
- break;
+ if( !psz_playnow )
+ break;
}
case HTTPD_MSG_PLAY:
-
-rtsp_play_now: /* This avoids code duplications although it is ugly. */
{
char *psz_output, ip[NI_MAXNUMERICHOST];
int i, i_port_audio = 0, i_port_video = 0;
answer->i_body = 0;
answer->p_body = NULL;
- psz_session = httpd_MsgGet( query, "Session" );
+ if( !psz_session )
+ psz_session = httpd_MsgGet( query, "Session" );
msg_Dbg( p_vod, "HTTPD_MSG_PLAY for session: %s", psz_session );
p_rtsp = RtspClientGet( p_media, psz_session );
if( p_media->psz_mux )
{
- asprintf( &psz_output, "rtp{dst=%s,port=%i,mux=%s}",
- ip, i_port_video, p_media->psz_mux );
+ if( p_media->b_raw )
+ {
+ asprintf( &psz_output, "std{access=udp,dst=%s:%i,mux=%s}",
+ ip, i_port, p_media->psz_mux );
+ }
+ else
+ {
+ asprintf( &psz_output, "rtp{dst=%s,port=%i,mux=%s}",
+ ip, i_port_video, p_media->psz_mux );
+ }
}
else
{
break;
}
+ case HTTPD_MSG_DESCRIBE:
+ {
+ char *psz_sdp =
+ SDPGenerate( p_media, cl );
+
+ if( psz_sdp != NULL )
+ {
+ answer->i_status = 200;
+ answer->psz_status = strdup( "OK" );
+ httpd_MsgAdd( answer, "Content-type", "%s", "application/sdp" );
+
+ answer->p_body = (uint8_t *)psz_sdp;
+ answer->i_body = strlen( psz_sdp );
+ }
+ else
+ {
+ answer->i_status = 500;
+ answer->psz_status = strdup( "Internal server error" );
+ answer->p_body = NULL;
+ answer->i_body = 0;
+ }
+ break;
+ }
+
case HTTPD_MSG_PAUSE:
psz_session = httpd_MsgGet( query, "Session" );
msg_Dbg( p_vod, "HTTPD_MSG_PAUSE for session: %s", psz_session );
p_rtsp_es->p_media_es = p_es;
TAB_APPEND( p_rtsp->i_es, p_rtsp->es, p_rtsp_es );
- if( psz_playnow ) /* support option: x-playNow */
- goto rtsp_play_now;
-
answer->i_status = 200;
answer->psz_status = strdup( "OK" );
answer->i_body = 0;
answer->i_body = 0;
answer->p_body = NULL;
}
- break;
-
- case HTTPD_MSG_TEARDOWN:
- answer->i_status = 200;
- answer->psz_status = strdup( "OK" );
- answer->i_body = 0;
- answer->p_body = NULL;
-
- psz_session = httpd_MsgGet( query, "Session" );
- msg_Dbg( p_vod, "HTTPD_MSG_TEARDOWN for session: %s", psz_session);
-
- p_rtsp = RtspClientGet( p_media, psz_session );
- if( !p_rtsp ) break;
-
- for( i = 0; i < p_rtsp->i_es; i++ )
- {
- if( p_rtsp->es[i]->p_media_es == p_es )
- {
- if( p_rtsp->es[i]->psz_ip ) free( p_rtsp->es[i]->psz_ip );
- TAB_REMOVE( p_rtsp->i_es, p_rtsp->es, p_rtsp->es[i] );
- break;
- }
- }
-
- if( !p_rtsp->i_es )
- {
- vod_MediaControl( p_vod, p_media, psz_session,
- VOD_MEDIA_STOP );
- RtspClientDel( p_media, p_rtsp );
- }
- break;
+ if( !psz_playnow )
+ break;
case HTTPD_MSG_PLAY:
-/* This avoids code duplications although it is ugly. */
-rtsp_play_now:
-
/* This is kind of a kludge. Should we only support Aggregate
* Operations ? */
psz_session = httpd_MsgGet( query, "Session" );
answer->p_body = NULL;
break;
+ case HTTPD_MSG_TEARDOWN:
+ answer->i_status = 200;
+ answer->psz_status = strdup( "OK" );
+ answer->i_body = 0;
+ answer->p_body = NULL;
+
+ psz_session = httpd_MsgGet( query, "Session" );
+ msg_Dbg( p_vod, "HTTPD_MSG_TEARDOWN for session: %s", psz_session);
+
+ p_rtsp = RtspClientGet( p_media, psz_session );
+ if( !p_rtsp ) break;
+
+ for( i = 0; i < p_rtsp->i_es; i++ )
+ {
+ if( p_rtsp->es[i]->p_media_es == p_es )
+ {
+ if( p_rtsp->es[i]->psz_ip ) free( p_rtsp->es[i]->psz_ip );
+ TAB_REMOVE( p_rtsp->i_es, p_rtsp->es, p_rtsp->es[i] );
+ break;
+ }
+ }
+
+ if( !p_rtsp->i_es )
+ {
+ vod_MediaControl( p_vod, p_media, psz_session,
+ VOD_MEDIA_STOP );
+ RtspClientDel( p_media, p_rtsp );
+ }
+ break;
+
case HTTPD_MSG_PAUSE:
/* This is kind of a kludge. Should we only support Aggregate
* Operations ? */