[vlc-devel] [PATCH] Allow giving rtp port number using adress of type '127.0.0.1:1234' as it done in que Qt interface.
Adrien Maglo
magsoft at videolan.org
Thu Jul 31 14:44:56 CEST 2008
Keep also the previous way : use of 'port=1234' option.
Also remove a trailling whitespace.
---
modules/stream_out/rtp.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index fb79a68..2ddac97 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -338,6 +338,7 @@ static int Open( vlc_object_t *p_this )
sout_stream_sys_t *p_sys = NULL;
config_chain_t *p_cfg = NULL;
char *psz;
+ char *psz_address;
bool b_rtsp = false;
config_ChainParse( p_stream, SOUT_CFG_PREFIX,
@@ -347,9 +348,24 @@ static int Open( vlc_object_t *p_this )
if( p_sys == NULL )
return VLC_ENOMEM;
- p_sys->psz_destination = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "dst" );
+ psz_address = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "dst" );
+
+ /* Try to extract the rtp port from the address */
+ psz = strchr( psz_address, ':' );
+ if( psz != NULL )
+ {
+ *psz = '\0';
+ p_sys->i_port = atoi( psz + 1 );
+ }
+ else /* Extract the port number from the port= option */
+ p_sys->i_port = var_GetInteger( p_stream, SOUT_CFG_PREFIX "port" );
+
+ p_sys->psz_destination = ( char *)malloc( strlen( psz_address ) + 1 );
+ if( p_sys->psz_destination == NULL )
+ return VLC_ENOMEM;
+ strcpy( p_sys->psz_destination, psz_address );
+ free( psz_address );
- p_sys->i_port = var_GetInteger( p_stream, SOUT_CFG_PREFIX "port" );
p_sys->i_port_audio = var_GetInteger( p_stream, SOUT_CFG_PREFIX "port-audio" );
p_sys->i_port_video = var_GetInteger( p_stream, SOUT_CFG_PREFIX "port-video" );
p_sys->rtcp_mux = var_GetBool( p_stream, SOUT_CFG_PREFIX "rtcp-mux" );
@@ -801,7 +817,7 @@ char *SDPGenerate( const sout_stream_t *p_stream, const char *rtsp_url )
if( id->listen_fd != NULL )
sdp_AddAttribute( &psz_sdp, "setup", "passive" );
if( p_sys->proto == IPPROTO_DCCP )
- sdp_AddAttribute( &psz_sdp, "dccp-service-code",
+ sdp_AddAttribute( &psz_sdp, "dccp-service-code",
"SC:RTP%c", toupper( mime_major[0] ) );
}
}
--
1.5.4.3
More information about the vlc-devel
mailing list