char *psz_rtsp_control;
char *psz_rtsp_path;
- char *psz_destination;
int i_port;
int i_port_audio;
int i_port_video;
static int RtspCallbackES( httpd_callback_sys_t *, httpd_client_t *,
httpd_message_t *, httpd_message_t * );
-static char *SDPGenerate( vod_media_t *, char * );
+static char *SDPGenerate( const vod_media_t * );
static void sprintf_hexa( char *s, uint8_t *p_data, int i_data )
{
{
vod_media_t *p_media = (vod_media_t*)p_args;
vod_t *p_vod = p_media->p_vod;
- char *psz_destination = p_media->psz_destination;
char *psz_session = NULL;
rtsp_client_t *p_rtsp;
case HTTPD_MSG_DESCRIBE:
{
char *psz_sdp =
- SDPGenerate( p_media, psz_destination ?
- psz_destination : "0.0.0.0" );
+ SDPGenerate( p_media );
answer->i_status = 200;
answer->psz_status = strdup( "OK" );
psz_transport = httpd_MsgGet( query, "Transport" );
fprintf( stderr, "HTTPD_MSG_SETUP: transport=%s\n", psz_transport );
- if( strstr( psz_transport, "multicast" ) && p_media->psz_destination )
- {
- fprintf( stderr, "HTTPD_MSG_SETUP: multicast\n" );
- answer->i_status = 200;
- answer->psz_status = strdup( "OK" );
- answer->i_body = 0;
- answer->p_body = NULL;
-
- psz_session = httpd_MsgGet( query, "Session" );
- if( !psz_session || !*psz_session )
- {
- asprintf( &psz_session, "%d", rand() );
- }
-
- httpd_MsgAdd( answer, "Transport",
- "RTP/AVP/UDP;destination=%s;port=%d-%d;ttl=%d",
- p_media->psz_destination, p_media->i_port,
- p_media->i_port+1, p_media->i_ttl );
- }
- else if( strstr( psz_transport, "unicast" ) &&
- strstr( psz_transport, "client_port=" ) )
+ if( strstr( psz_transport, "unicast" ) &&
+ strstr( psz_transport, "client_port=" ) )
{
rtsp_client_t *p_rtsp;
rtsp_client_es_t *p_rtsp_es;
if( !ip )
{
- answer->i_status = 400;
+ answer->i_status = 500;
answer->psz_status = strdup( "Internal server error" );
answer->i_body = 0;
answer->p_body = NULL;
if( !p_rtsp )
{
/* FIXME right error code */
- answer->i_status = 400;
+ answer->i_status = 454;
answer->psz_status = strdup( "Unknown session id" );
answer->i_body = 0;
answer->p_body = NULL;
}
else /* TODO strstr( psz_transport, "interleaved" ) ) */
{
- answer->i_status = 400;
- answer->psz_status = strdup( "Bad Request" );
+ answer->i_status = 461;
+ answer->psz_status = strdup( "Unsupported Transport" );
answer->i_body = 0;
answer->p_body = NULL;
}
* SDPGenerate: TODO
* FIXME: need to be moved to a common place ?
*****************************************************************************/
-static char *SDPGenerate( vod_media_t *p_media, char *psz_destination )
+static char *SDPGenerate( const vod_media_t *p_media )
{
int i, i_size;
char *p, *psz_sdp;
strlen( "e=*\r\n" ) + strlen( p_media->psz_session_email ) +
strlen( "t=0 0\r\n" ) + /* FIXME */
strlen( "a=tool:"PACKAGE_STRING"\r\n" ) +
- strlen( "c=IN IP4 */*\r\n" ) + 20 + 10 +
- strlen( psz_destination ? psz_destination : "0.0.0.0" ) +
+ strlen( "c=IN IPn */*\r\n" ) + 20 + 10 + NI_MAXNUMERICHOST +
strlen( "a=range:npt=0-1000000000.000\r\n" );
for( i = 0; i < p_media->i_es; i++ )
p += sprintf( p, "t=0 0\r\n" ); /* FIXME */
p += sprintf( p, "a=tool:"PACKAGE_STRING"\r\n" );
- p += sprintf( p, "c=IN IP4 %s", psz_destination ? psz_destination : "0.0.0.0" );
-
- if( ( psz_destination != NULL )
- && net_AddressIsMulticast( p_media->p_vod, psz_destination ) )
- {
- /* Add the ttl if it is a multicast address */
- p += sprintf( p, "/%d\r\n", p_media->i_ttl );
- }
- else
- {
- p += sprintf( p, "\r\n" );
- }
+ p += sprintf( p, "c=IN IP4 0.0.0.0\r\n" );
if( p_media->i_length > 0 )
p += sprintf( p, "a=range:npt=0-%.3f\r\n",