Commit 14c258d2 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* SDP should use \r\n instead of \n

* Added nice SDP TODO lists. 17 outstanding issues in RTP announces.
parent 2d1483b4
...@@ -402,17 +402,36 @@ static int Open( vlc_object_t *p_this ) ...@@ -402,17 +402,36 @@ static int Open( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* create the SDP only once */ /* create the SDP for a muxed stream (only once) */
/* FIXME http://www.faqs.org/rfcs/rfc2327.html
All text fields should be UTF-8 encoded. Use global a:charset to announce this.
o= - should be local username (no spaces allowed)
o= time should be hashed with some other value to garantue uniqueness
o= we need IP6 support?
o= don't use the localhost address. use fully qualified domain name or IP4 address
i= description of session (pass via vars?)
u= URI to more information on session (pass via vars?)
e= email address (pass via vars?) (multiple formats are supported)
p= international phone number (pass via vars?)
c= IP6 support
c= /ttl should only be added in case of multicast
t= missing (required)
a= tool param missing (highly recommended)
a= recvonly (missing)
a= type:broadcast (missing)
a= charset: (normally charset should be UTF-8, this can be used to override s= and i=)
a= x-plgroup: (missing)
RTP packets need to get the correct src IP address */
p_sys->psz_sdp = p_sys->psz_sdp =
malloc( 200 + 20 + 10 + strlen( p_sys->psz_destination ) + malloc( 200 + 20 + 10 + strlen( p_sys->psz_destination ) +
10 + 10 + 10 + 10 + strlen( psz_rtpmap ) ); 10 + 10 + 10 + 10 + strlen( psz_rtpmap ) );
sprintf( p_sys->psz_sdp, sprintf( p_sys->psz_sdp,
"v=0\n" "v=0\r\n"
"o=- "I64Fd" %d IN IP4 127.0.0.1\n" "o=- "I64Fd" %d IN IP4 127.0.0.1\r\n"
"s=%s\n" "s=%s\r\n"
"c=IN IP4 %s/%d\n" "c=IN IP4 %s/%d\r\n"
"m=video %d RTP/AVP %d\n" "m=video %d RTP/AVP %d\r\n"
"a=rtpmap:%d %s\n", "a=rtpmap:%d %s\r\n",
p_sys->i_sdp_id, p_sys->i_sdp_version, p_sys->i_sdp_id, p_sys->i_sdp_version,
p_sys->psz_session_name, p_sys->psz_session_name,
p_sys->psz_destination, p_sys->i_ttl, p_sys->psz_destination, p_sys->i_ttl,
...@@ -470,7 +489,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -470,7 +489,7 @@ static int Open( vlc_object_t *p_this )
} }
else else
{ {
msg_Warn( p_stream, "unknow protocol for SDP (%s)", msg_Warn( p_stream, "unknown protocol for SDP (%s)",
url.psz_protocol ); url.psz_protocol );
} }
vlc_UrlClean( &url ); vlc_UrlClean( &url );
...@@ -545,6 +564,25 @@ static void Close( vlc_object_t * p_this ) ...@@ -545,6 +564,25 @@ static void Close( vlc_object_t * p_this )
/***************************************************************************** /*****************************************************************************
* SDPGenerate * SDPGenerate
*****************************************************************************/ *****************************************************************************/
/* FIXME http://www.faqs.org/rfcs/rfc2327.html
All text fields should be UTF-8 encoded. Use global a:charset to announce this.
o= - should be local username (no spaces allowed)
o= time should be hashed with some other value to garantue uniqueness
o= we need IP6 support?
o= don't use the localhost address. use fully qualified domain name or IP4 address
i= description of session (pass via vars?)
u= URI to more information on session (pass via vars?)
e= email address (pass via vars?) (multiple formats are supported)
p= international phone number (pass via vars?)
c= IP6 support
c= /ttl should only be added in case of multicast
t= missing (required)
a= tool param missing (highly recommended)
a= recvonly (missing)
a= type:broadcast (missing)
a= charset: (normally charset should be UTF-8, this can be used to override s= and i=)
a= x-plgroup: (missing)
RTP packets need to get the correct src IP address */
static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bool_t b_rtsp ) static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bool_t b_rtsp )
{ {
sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_sys_t *p_sys = p_stream->p_sys;
...@@ -552,10 +590,10 @@ static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bo ...@@ -552,10 +590,10 @@ static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bo
char *psz_sdp, *p; char *psz_sdp, *p;
int i; int i;
i_size = strlen( "v=0\n" ) + i_size = strlen( "v=0\r\n" ) +
strlen( "o=- * * IN IP4 127.0.0.1\n" ) + strlen( "o=- * * IN IP4 127.0.0.1\r\n" ) +
strlen( "s=\n" ) + strlen( "s=\r\n" ) +
strlen( "c=IN IP4 */*\n" ) + strlen( "c=IN IP4 */*\r\n" ) +
strlen( psz_destination ? psz_destination : "0.0.0.0") + strlen( psz_destination ? psz_destination : "0.0.0.0") +
strlen( p_sys->psz_session_name ) + strlen( p_sys->psz_session_name ) +
20 + 10 + 10 + 1; 20 + 10 + 10 + 1;
...@@ -563,27 +601,27 @@ static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bo ...@@ -563,27 +601,27 @@ static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bo
{ {
sout_stream_id_t *id = p_sys->es[i]; sout_stream_id_t *id = p_sys->es[i];
i_size += strlen( "m=**d*o * RTP/AVP *\n" ) + 10 + 10; i_size += strlen( "m=**d*o * RTP/AVP *\r\n" ) + 10 + 10;
if( id->psz_rtpmap ) if( id->psz_rtpmap )
{ {
i_size += strlen( "a=rtpmap:* *\n" ) + strlen( id->psz_rtpmap )+10; i_size += strlen( "a=rtpmap:* *\r\n" ) + strlen( id->psz_rtpmap )+10;
} }
if( id->psz_fmtp ) if( id->psz_fmtp )
{ {
i_size += strlen( "a=fmtp:* *\n" ) + strlen( id->psz_fmtp ) + 10; i_size += strlen( "a=fmtp:* *\r\n" ) + strlen( id->psz_fmtp ) + 10;
} }
if( b_rtsp ) if( b_rtsp )
{ {
i_size += strlen( "a=control:*/trackid=*\n" ) + strlen( p_sys->psz_rtsp_control ) + 10; i_size += strlen( "a=control:*/trackid=*\r\n" ) + strlen( p_sys->psz_rtsp_control ) + 10;
} }
} }
p = psz_sdp = malloc( i_size ); p = psz_sdp = malloc( i_size );
p += sprintf( p, "v=0\n" ); p += sprintf( p, "v=0\r\n" );
p += sprintf( p, "o=- "I64Fd" %d IN IP4 127.0.0.1\n", p += sprintf( p, "o=- "I64Fd" %d IN IP4 127.0.0.1\r\n",
p_sys->i_sdp_id, p_sys->i_sdp_version ); p_sys->i_sdp_id, p_sys->i_sdp_version );
p += sprintf( p, "s=%s\n", p_sys->psz_session_name ); p += sprintf( p, "s=%s\r\n", p_sys->psz_session_name );
p += sprintf( p, "c=IN IP4 %s/%d\n", psz_destination ? psz_destination : "0.0.0.0", p += sprintf( p, "c=IN IP4 %s/%d\r\n", psz_destination ? psz_destination : "0.0.0.0",
p_sys->i_ttl ); p_sys->i_ttl );
for( i = 0; i < p_sys->i_es; i++ ) for( i = 0; i < p_sys->i_es; i++ )
...@@ -592,12 +630,12 @@ static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bo ...@@ -592,12 +630,12 @@ static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bo
if( id->i_cat == AUDIO_ES ) if( id->i_cat == AUDIO_ES )
{ {
p += sprintf( p, "m=audio %d RTP/AVP %d\n", p += sprintf( p, "m=audio %d RTP/AVP %d\r\n",
id->i_port, id->i_payload_type ); id->i_port, id->i_payload_type );
} }
else if( id->i_cat == VIDEO_ES ) else if( id->i_cat == VIDEO_ES )
{ {
p += sprintf( p, "m=video %d RTP/AVP %d\n", p += sprintf( p, "m=video %d RTP/AVP %d\r\n",
id->i_port, id->i_payload_type ); id->i_port, id->i_payload_type );
} }
else else
...@@ -606,17 +644,17 @@ static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bo ...@@ -606,17 +644,17 @@ static char *SDPGenerate( sout_stream_t *p_stream, char *psz_destination, vlc_bo
} }
if( id->psz_rtpmap ) if( id->psz_rtpmap )
{ {
p += sprintf( p, "a=rtpmap:%d %s\n", id->i_payload_type, p += sprintf( p, "a=rtpmap:%d %s\r\n", id->i_payload_type,
id->psz_rtpmap ); id->psz_rtpmap );
} }
if( id->psz_fmtp ) if( id->psz_fmtp )
{ {
p += sprintf( p, "a=fmtp:%d %s\n", id->i_payload_type, p += sprintf( p, "a=fmtp:%d %s\r\n", id->i_payload_type,
id->psz_fmtp ); id->psz_fmtp );
} }
if( b_rtsp ) if( b_rtsp )
{ {
p += sprintf( p, "a=control:%s/trackid=%d\n", p_sys->psz_rtsp_control, i ); p += sprintf( p, "a=control:%s/trackid=%d\r\n", p_sys->psz_rtsp_control, i );
} }
} }
......
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