Changeset 116d261645f35f4acd87b595935d4f3a2b44895f
- Timestamp:
- 24/04/04 05:38:10 (5 years ago)
- git-parent:
- Files:
-
- modules/stream_out/display.c (modified) (4 diffs)
- modules/stream_out/es.c (modified) (15 diffs)
- modules/stream_out/rtp.c (modified) (10 diffs)
- modules/stream_out/standard.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/stream_out/display.c
r8547ffa r116d261 38 38 static void Close( vlc_object_t * ); 39 39 40 #define SOUT_CFG_PREFIX "sout-display-" 41 40 42 vlc_module_begin(); 41 43 set_description( _("Display stream output") ); 42 44 set_capability( "sout stream", 50 ); 43 45 add_shortcut( "display" ); 46 add_bool( SOUT_CFG_PREFIX "audio", 1, NULL, "audio", "", VLC_TRUE ); 47 add_bool( SOUT_CFG_PREFIX "video", 1, NULL, "video", "", VLC_TRUE ); 48 add_integer( SOUT_CFG_PREFIX "delay", 100, NULL, "delay", "", VLC_TRUE ); 44 49 set_callbacks( Open, Close ); 45 50 vlc_module_end(); … … 49 54 * Exported prototypes 50 55 *****************************************************************************/ 56 static const char *ppsz_sout_options[] = { 57 "audio", "video", "delay", NULL 58 }; 59 51 60 static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); 52 61 static int Del ( sout_stream_t *, sout_stream_id_t * ); … … 70 79 sout_stream_t *p_stream = (sout_stream_t*)p_this; 71 80 sout_stream_sys_t *p_sys; 72 char *val; 81 vlc_value_t val; 82 83 sout_ParseCfg( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg ); 84 73 85 p_sys = malloc( sizeof( sout_stream_sys_t ) ); 74 86 p_sys->p_input = vlc_object_find( p_stream, VLC_OBJECT_INPUT, FIND_ANYWHERE ); … … 80 92 } 81 93 82 p_sys->b_audio = VLC_TRUE; 83 p_sys->b_video = VLC_TRUE; 84 p_sys->i_delay = 100*1000; 85 if( sout_cfg_find( p_stream->p_cfg, "noaudio" ) ) 86 { 87 p_sys->b_audio = VLC_FALSE; 88 } 89 if( sout_cfg_find( p_stream->p_cfg, "novideo" ) ) 90 { 91 p_sys->b_video = VLC_FALSE; 92 } 93 if( ( val = sout_cfg_find_value( p_stream->p_cfg, "delay" ) ) ) 94 { 95 p_sys->i_delay = (mtime_t)atoi( val ) * (mtime_t)1000; 96 } 94 var_Get( p_stream, SOUT_CFG_PREFIX "audio", &val ); 95 p_sys->b_audio = val.b_bool; 96 97 var_Get( p_stream, SOUT_CFG_PREFIX "video", &val ); 98 p_sys->b_video = val.b_bool; 99 100 var_Get( p_stream, SOUT_CFG_PREFIX "delay", &val ); 101 p_sys->i_delay = (int64_t)val.i_int * 1000; 97 102 98 103 p_stream->pf_add = Add; modules/stream_out/es.c
r8547ffa r116d261 32 32 #include <vlc/sout.h> 33 33 34 #define FREE( p ) if( p ) { free( p ); (p) = NULL; } 35 /***************************************************************************** 36 * Exported prototypes 34 /***************************************************************************** 35 * Module descriptor 37 36 *****************************************************************************/ 38 37 static int Open ( vlc_object_t * ); 39 38 static void Close ( vlc_object_t * ); 40 39 41 static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); 42 static int Del ( sout_stream_t *, sout_stream_id_t * ); 43 static int Send( sout_stream_t *, sout_stream_id_t *, block_t* ); 44 45 /***************************************************************************** 46 * Module descriptor 47 *****************************************************************************/ 40 #define SOUT_CFG_PREFIX "sout-es-" 41 48 42 vlc_module_begin(); 49 43 set_description( _("Elementary stream output") ); 50 44 set_capability( "sout stream", 50 ); 51 45 add_shortcut( "es" ); 46 47 add_string( SOUT_CFG_PREFIX "access", "", NULL, "access", "", VLC_TRUE ); 48 add_string( SOUT_CFG_PREFIX "access-audio", "", NULL, "access audio", "", VLC_TRUE ); 49 add_string( SOUT_CFG_PREFIX "access-video", "", NULL, "access video", "", VLC_TRUE ); 50 51 add_string( SOUT_CFG_PREFIX "mux", "", NULL, "mux", "", VLC_TRUE ); 52 add_string( SOUT_CFG_PREFIX "mux-audio", "", NULL, "mux audio", "", VLC_TRUE ); 53 add_string( SOUT_CFG_PREFIX "mux-video", "", NULL, "mux video", "", VLC_TRUE ); 54 55 add_string( SOUT_CFG_PREFIX "dst", "", NULL, "dst", "", VLC_TRUE ); 56 add_string( SOUT_CFG_PREFIX "dst-audio", "", NULL, "dst audio", "", VLC_TRUE ); 57 add_string( SOUT_CFG_PREFIX "dst-video", "", NULL, "dst video", "", VLC_TRUE ); 58 52 59 set_callbacks( Open, Close ); 53 60 vlc_module_end(); 61 62 63 #define FREE( p ) if( p ) { free( p ); (p) = NULL; } 64 /***************************************************************************** 65 * Exported prototypes 66 *****************************************************************************/ 67 static const char *ppsz_sout_options[] = { 68 "access", "access-audio", "access-video", 69 "mux", "mux-audio", "mux-video", 70 "dst", "dst-audio", "dst-video", 71 NULL 72 }; 73 74 static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); 75 static int Del ( sout_stream_t *, sout_stream_id_t * ); 76 static int Send( sout_stream_t *, sout_stream_id_t *, block_t* ); 54 77 55 78 struct sout_stream_sys_t … … 67 90 char *psz_access_video; 68 91 69 char *psz_ url;70 char *psz_ url_audio;71 char *psz_ url_video;92 char *psz_dst; 93 char *psz_dst_audio; 94 char *psz_dst_video; 72 95 }; 73 96 … … 79 102 sout_stream_t *p_stream = (sout_stream_t*)p_this; 80 103 sout_stream_sys_t *p_sys; 81 82 /* p_sout->i_preheader = __MAX( p_sout->i_preheader, p_mux->i_preheader ); */ 83 104 vlc_value_t val; 105 106 sout_ParseCfg( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg ); 84 107 p_sys = malloc( sizeof( sout_stream_sys_t ) ); 85 108 … … 88 111 p_sys->i_count_video = 0; 89 112 90 p_sys->psz_access = sout_cfg_find_value( p_stream->p_cfg, "access" ); 91 p_sys->psz_access_audio = sout_cfg_find_value( p_stream->p_cfg, "access_audio" ); 92 p_sys->psz_access_video = sout_cfg_find_value( p_stream->p_cfg, "access_video" ); 93 94 p_sys->psz_mux = sout_cfg_find_value( p_stream->p_cfg, "mux" ); 95 p_sys->psz_mux_audio = sout_cfg_find_value( p_stream->p_cfg, "mux_audio" ); 96 p_sys->psz_mux_video = sout_cfg_find_value( p_stream->p_cfg, "mux_video" ); 97 98 p_sys->psz_url = sout_cfg_find_value( p_stream->p_cfg, "url" ); 99 p_sys->psz_url_audio = sout_cfg_find_value( p_stream->p_cfg, "url_audio" ); 100 p_sys->psz_url_video = sout_cfg_find_value( p_stream->p_cfg, "url_video" ); 113 var_Get( p_stream, SOUT_CFG_PREFIX "access", &val ); 114 p_sys->psz_access = val.psz_string; 115 var_Get( p_stream, SOUT_CFG_PREFIX "access-audio", &val ); 116 p_sys->psz_access_audio = val.psz_string; 117 var_Get( p_stream, SOUT_CFG_PREFIX "access-video", &val ); 118 p_sys->psz_access_video = val.psz_string; 119 120 var_Get( p_stream, SOUT_CFG_PREFIX "mux", &val ); 121 p_sys->psz_mux = val.psz_string; 122 var_Get( p_stream, SOUT_CFG_PREFIX "mux-audio", &val ); 123 p_sys->psz_mux_audio = val.psz_string; 124 var_Get( p_stream, SOUT_CFG_PREFIX "mux-video", &val ); 125 p_sys->psz_mux_video = val.psz_string; 126 127 var_Get( p_stream, SOUT_CFG_PREFIX "dst", &val ); 128 p_sys->psz_dst = val.psz_string; 129 var_Get( p_stream, SOUT_CFG_PREFIX "dst-audio", &val ); 130 p_sys->psz_dst_audio = val.psz_string; 131 var_Get( p_stream, SOUT_CFG_PREFIX "dst-video", &val ); 132 p_sys->psz_dst_video = val.psz_string; 101 133 102 134 p_stream->pf_add = Add; … … 118 150 sout_stream_sys_t *p_sys = p_stream->p_sys; 119 151 152 free( p_sys->psz_access ); 153 free( p_sys->psz_access_audio ); 154 free( p_sys->psz_access_video ); 155 156 free( p_sys->psz_mux ); 157 free( p_sys->psz_mux_audio ); 158 free( p_sys->psz_mux_video ); 159 160 free( p_sys->psz_dst ); 161 free( p_sys->psz_dst_audio ); 162 free( p_sys->psz_dst_video ); 163 120 164 free( p_sys ); 121 165 } … … 130 174 char *psz_access, char *psz_mux ) 131 175 { 132 char *psz_ url, *p;176 char *psz_dst, *p; 133 177 134 178 if( psz_fmt == NULL || !*psz_fmt ) … … 137 181 } 138 182 139 p = psz_ url= malloc( 4096 );183 p = psz_dst = malloc( 4096 ); 140 184 memset( p, 0, 4096 ); 141 185 for( ;; ) … … 183 227 } 184 228 185 return( psz_ url);229 return( psz_dst ); 186 230 } 187 231 … … 194 238 char *psz_access; 195 239 char *psz_mux; 196 char *psz_ url;240 char *psz_dst; 197 241 198 242 sout_access_out_t *p_access; … … 200 244 201 245 /* *** get access name *** */ 202 if( p_fmt->i_cat == AUDIO_ES && p_sys->psz_access_audio )246 if( p_fmt->i_cat == AUDIO_ES && p_sys->psz_access_audio && *p_sys->psz_access_audio ) 203 247 { 204 248 psz_access = p_sys->psz_access_audio; 205 249 } 206 else if( p_fmt->i_cat == VIDEO_ES && p_sys->psz_access_video )250 else if( p_fmt->i_cat == VIDEO_ES && p_sys->psz_access_video && *p_sys->psz_access_video ) 207 251 { 208 252 psz_access = p_sys->psz_access_video; … … 214 258 215 259 /* *** get mux name *** */ 216 if( p_fmt->i_cat == AUDIO_ES && p_sys->psz_mux_audio )260 if( p_fmt->i_cat == AUDIO_ES && p_sys->psz_mux_audio && *p_sys->psz_mux_audio ) 217 261 { 218 262 psz_mux = p_sys->psz_mux_audio; 219 263 } 220 else if( p_fmt->i_cat == VIDEO_ES && p_sys->psz_mux_video )264 else if( p_fmt->i_cat == VIDEO_ES && p_sys->psz_mux_video && *p_sys->psz_mux_video ) 221 265 { 222 266 psz_mux = p_sys->psz_mux_video; … … 228 272 229 273 /* Get url (%d expanded as a codec count, %c expanded as codec fcc ) */ 230 if( p_fmt->i_cat == AUDIO_ES && p_sys->psz_ url_audio )231 { 232 psz_ url = es_print_url( p_sys->psz_url_audio, p_fmt->i_codec,274 if( p_fmt->i_cat == AUDIO_ES && p_sys->psz_dst_audio && *p_sys->psz_dst_audio ) 275 { 276 psz_dst = es_print_url( p_sys->psz_dst_audio, p_fmt->i_codec, 233 277 p_sys->i_count_audio, psz_access, psz_mux ); 234 278 } 235 else if( p_fmt->i_cat == VIDEO_ES && p_sys->psz_ url_video )236 { 237 psz_ url = es_print_url( p_sys->psz_url_video, p_fmt->i_codec,279 else if( p_fmt->i_cat == VIDEO_ES && p_sys->psz_dst_video && *p_sys->psz_dst_video ) 280 { 281 psz_dst = es_print_url( p_sys->psz_dst_video, p_fmt->i_codec, 238 282 p_sys->i_count_video, psz_access, psz_mux ); 239 283 } … … 254 298 } 255 299 256 psz_ url = es_print_url( p_sys->psz_url, p_fmt->i_codec,300 psz_dst = es_print_url( p_sys->psz_dst, p_fmt->i_codec, 257 301 i_count, psz_access, psz_mux ); 258 302 } … … 268 312 } 269 313 msg_Dbg( p_stream, "creating `%s/%s://%s'", 270 psz_access, psz_mux, psz_ url);314 psz_access, psz_mux, psz_dst ); 271 315 272 316 /* *** find and open appropriate access module *** */ 273 p_access = sout_AccessOutNew( p_sout, psz_access, psz_ url);317 p_access = sout_AccessOutNew( p_sout, psz_access, psz_dst ); 274 318 if( p_access == NULL ) 275 319 { 276 320 msg_Err( p_stream, "no suitable sout access module for `%s/%s://%s'", 277 psz_access, psz_mux, psz_ url);321 psz_access, psz_mux, psz_dst ); 278 322 return( NULL ); 279 323 } … … 284 328 { 285 329 msg_Err( p_stream, "no suitable sout mux module for `%s/%s://%s'", 286 psz_access, psz_mux, psz_ url);330 psz_access, psz_mux, psz_dst ); 287 331 sout_AccessOutDelete( p_access ); 288 332 return( NULL ); modules/stream_out/rtp.c
rfab59c0 r116d261 40 40 static void Close( vlc_object_t * ); 41 41 42 #define SOUT_CFG_PREFIX "sout-rtp-" 43 42 44 vlc_module_begin(); 43 45 set_description( _("RTP stream output") ); 44 46 set_capability( "sout stream", 0 ); 45 47 add_shortcut( "rtp" ); 48 add_string( SOUT_CFG_PREFIX "dst", "", NULL, "destination", "", VLC_TRUE ); 49 add_string( SOUT_CFG_PREFIX "name", "", NULL, "name", "", VLC_TRUE ); 50 add_string( SOUT_CFG_PREFIX "sdp", "", NULL, "sdp", "", VLC_TRUE ); 51 add_string( SOUT_CFG_PREFIX "mux", "", NULL, "mux", "", VLC_TRUE ); 52 53 add_integer( SOUT_CFG_PREFIX "port", 1234, NULL, "port", "", VLC_TRUE ); 54 add_integer( SOUT_CFG_PREFIX "ttl", 0, NULL, "port", "", VLC_TRUE ); 55 46 56 set_callbacks( Open, Close ); 47 57 vlc_module_end(); … … 50 60 * Exported prototypes 51 61 *****************************************************************************/ 62 static const char *ppsz_sout_options[] = { 63 "dst", "name", "port", "sdp", "ttl", "mux", NULL 64 }; 65 52 66 static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); 53 67 static int Del ( sout_stream_t *, sout_stream_id_t * ); … … 183 197 sout_instance_t *p_sout = p_stream->p_sout; 184 198 sout_stream_sys_t *p_sys; 185 186 char *val; 199 vlc_value_t val; 200 201 sout_ParseCfg( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg ); 187 202 188 203 p_sys = malloc( sizeof( sout_stream_sys_t ) ); 189 p_sys->psz_destination = sout_cfg_find_value( p_stream->p_cfg, "dst" ); 190 p_sys->psz_session_name = sout_cfg_find_value( p_stream->p_cfg, "name");191 if( ( val = sout_cfg_find_value( p_stream->p_cfg, "port" ) ) )192 { 193 p_sys->i_port = atoi(val );194 }195 else 196 {197 p_sys->i_port = 1234;198 } 204 205 var_Get( p_stream, SOUT_CFG_PREFIX "dst", &val ); 206 p_sys->psz_destination = *val.psz_string ? val.psz_string : NULL; 207 208 var_Get( p_stream, SOUT_CFG_PREFIX "name", &val ); 209 p_sys->psz_session_name = *val.psz_string ? val.psz_string : NULL; 210 211 var_Get( p_stream, SOUT_CFG_PREFIX "port", &val ); 212 p_sys->i_port = val.i_int; 213 199 214 200 215 if( !p_sys->psz_session_name ) 201 216 { 202 217 if( p_sys->psz_destination ) 203 {204 218 p_sys->psz_session_name = strdup( p_sys->psz_destination ); 205 }206 219 else 207 {208 220 p_sys->psz_session_name = strdup( "NONE" ); 209 }210 221 } 211 222 212 223 if( !p_sys->psz_destination || *p_sys->psz_destination == '\0' ) 213 224 { 214 val = sout_cfg_find_value( p_stream->p_cfg, "sdp" ); 215 if( val == NULL || strncasecmp( val, "rtsp", 4 ) ) 225 var_Get( p_stream, SOUT_CFG_PREFIX "sdp", &val ); 226 227 if( strncasecmp( val.psz_string, "rtsp", 4 ) ) 216 228 { 217 229 msg_Err( p_stream, "missing destination and not in rtsp mode" ); … … 220 232 } 221 233 p_sys->psz_destination = NULL; 234 free( val.psz_string ); 222 235 } 223 236 else if( p_sys->i_port <= 0 ) … … 228 241 } 229 242 230 if( ( val = sout_cfg_find_value( p_stream->p_cfg, "ttl" ) ) ) 231 { 232 p_sys->i_ttl = atoi( val ); 233 } 234 else 235 { 236 p_sys->i_ttl = config_GetInt( p_stream, "ttl" ); 237 } 243 var_Get( p_stream, SOUT_CFG_PREFIX "ttl", &val ); 244 p_sys->i_ttl = val.i_int; 238 245 239 246 p_sys->i_payload_type = 96; … … 267 274 p_stream->p_sys = p_sys; 268 275 269 if( ( val = sout_cfg_find_value( p_stream->p_cfg, "mux" ) ) ) 276 var_Get( p_stream, SOUT_CFG_PREFIX "mux", &val ); 277 if( *val.psz_string ) 270 278 { 271 279 sout_access_out_t *p_grab; … … 276 284 277 285 /* Check muxer type */ 278 if( !strncasecmp( val , "ps", 2 ) || !strncasecmp( val, "mpeg1", 5 ) )286 if( !strncasecmp( val.psz_string, "ps", 2 ) || !strncasecmp( val.psz_string, "mpeg1", 5 ) ) 279 287 { 280 288 psz_rtpmap = "MP2P/90000"; 281 289 } 282 else if( !strncasecmp( val , "ts", 2 ) )290 else if( !strncasecmp( val.psz_string, "ts", 2 ) ) 283 291 { 284 292 psz_rtpmap = "MP2T/90000"; … … 328 336 329 337 /* the muxer */ 330 if( !( p_sys->p_mux = sout_MuxNew( p_sout, val , p_sys->p_grab ) ) )331 { 332 msg_Err( p_stream, "cannot create the muxer (%s)", val );338 if( !( p_sys->p_mux = sout_MuxNew( p_sout, val.psz_string, p_sys->p_grab ) ) ) 339 { 340 msg_Err( p_stream, "cannot create the muxer (%s)", val.psz_string ); 333 341 sout_AccessOutDelete( p_sys->p_grab ); 334 342 sout_AccessOutDelete( p_sys->p_access ); … … 370 378 p_sys->p_grab = NULL; 371 379 } 372 373 if( ( val = sout_cfg_find_value( p_stream->p_cfg, "sdp" ) ) ) 380 free( val.psz_string ); 381 382 383 var_Get( p_stream, SOUT_CFG_PREFIX "sdp", &val ); 384 if( *val.psz_string ) 374 385 { 375 386 vlc_url_t url; 376 387 377 vlc_UrlParse( &url, val , 0 );388 vlc_UrlParse( &url, val.psz_string, 0 ); 378 389 if( url.psz_protocol && !strcasecmp( url.psz_protocol, "http" ) ) 379 390 { … … 403 414 vlc_UrlClean( &url ); 404 415 } 416 free( val.psz_string ); 405 417 406 418 /* update p_sout->i_out_pace_nocontrol */ modules/stream_out/standard.c
rfab59c0 r116d261 35 35 #include "network.h" 36 36 37 #define DEFAULT_IPV6_SCOPE '8' 38 #define DEFAULT_PORT 1234 39 40 /***************************************************************************** 41 * Exported prototypes 37 /***************************************************************************** 38 * Module descriptor 42 39 *****************************************************************************/ 43 40 static int Open ( vlc_object_t * ); 44 41 static void Close ( vlc_object_t * ); 45 42 46 static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); 47 static int Del ( sout_stream_t *, sout_stream_id_t * ); 48 static int Send( sout_stream_t *, sout_stream_id_t *, block_t* ); 49 50 /***************************************************************************** 51 * Module descriptor 52 *****************************************************************************/ 43 #define SOUT_CFG_PREFIX "sout-standard-" 44 53 45 vlc_module_begin(); 54 46 set_description( _("Standard stream output") ); … … 56 48 add_shortcut( "standard" ); 57 49 add_shortcut( "std" ); 50 51 add_string( SOUT_CFG_PREFIX "access", "", NULL, "access", "", VLC_TRUE ); 52 add_string( SOUT_CFG_PREFIX "mux", "", NULL, "mux", "", VLC_TRUE ); 53 add_string( SOUT_CFG_PREFIX "url", "", NULL, "url", "", VLC_TRUE ); 54 58 55 set_callbacks( Open, Close ); 59 56 vlc_module_end(); 57 58 59 /***************************************************************************** 60 * Exported prototypes 61 *****************************************************************************/ 62 static const char *ppsz_sout_options[] = { 63 "access", "mux", "url", NULL 64 }; 65 66 #define DEFAULT_IPV6_SCOPE '8' 67 #define DEFAULT_PORT 1234 68 69 static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * ); 70 static int Del ( sout_stream_t *, sout_stream_id_t * ); 71 static int Send( sout_stream_t *, sout_stream_id_t *, block_t* ); 60 72 61 73 struct sout_stream_sys_t … … 74 86 sout_instance_t *p_sout = p_stream->p_sout; 75 87 slp_session_t *p_slp = NULL; 76 session_descriptor_t *p_session = NULL; 77 78 char *psz_mux = sout_cfg_find_value( p_stream->p_cfg, "mux" ); 79 char *psz_access = sout_cfg_find_value( p_stream->p_cfg, "access" ); 80 char *psz_url = sout_cfg_find_value( p_stream->p_cfg, "url" ); 81 char *psz_sdp = NULL; 82 83 vlc_url_t *p_url; 88 89 char *psz_mux; 90 char *psz_access; 91 char *psz_url; 92 84 93 sout_cfg_t *p_sap_cfg = sout_cfg_find( p_stream->p_cfg, "sap" ); 85 94 #ifdef HAVE_SLP_H … … 87 96 #endif 88 97 98 vlc_value_t val; 99 89 100 sout_access_out_t *p_access; 90 101 sout_mux_t *p_mux; 91 102 92 103 char *psz_mux_byext = NULL; 104 105 sout_ParseCfg( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg ); 106 107 var_Get( p_stream, SOUT_CFG_PREFIX "access", &val ); 108 psz_access = *val.psz_string ? val.psz_string : NULL; 109 110 var_Get( p_stream, SOUT_CFG_PREFIX "mux", &val ); 111 psz_mux = *val.psz_string ? val.psz_string : NULL; 112 113 var_Get( p_stream, SOUT_CFG_PREFIX "url", &val ); 114 psz_url = *val.psz_string ? val.psz_string : NULL; 93 115 94 116 p_stream->p_sys = malloc( sizeof( sout_stream_sys_t) ); … … 138 160 /* We fix access/mux to valid couple */ 139 161 140 if( ( psz_access == NULL || *psz_access == '\0' )&& 141 ( psz_mux == NULL || *psz_mux == '\0' ) ) 162 if( psz_access == NULL && psz_mux == NULL ) 142 163 { 143 164 if( psz_mux_byext ) … … 156 177 } 157 178 158 if( psz_access && *psz_access && 159 ( psz_mux == NULL || *psz_mux == '\0' ) ) 179 if( psz_access && psz_mux == NULL ) 160 180 { 161 181 /* access given, no mux */ … … 173 193 } 174 194 } 175 else if( psz_mux && *psz_mux && 176 ( psz_access == NULL || *psz_access == '\0' ) ) 195 else if( psz_mux && psz_access == NULL ) 177 196 { 178 197 /* mux given, no access */ … … 189 208 190 209 /* fix or warm of incompatible couple */ 191 if( psz_mux && *psz_mux && psz_access && *psz_access )210 if( psz_mux && psz_access ) 192 211 { 193 212 if( !strncmp( psz_access, "mmsh", 4 ) && strncmp( psz_mux, "asfh", 4 ) ) … … 246 265 247 266 /* *** Create the SAP Session structure *** */ 248 if( psz_access && p_sap_cfg && ( strstr( psz_access, "udp" ) || 249 strstr( psz_access , "rtp" ) ) ) 250 { 251 session_descriptor_t *p_session= sout_AnnounceSessionCreate(); 252 announce_method_t *p_method = sout_AnnounceMethodCreate( 253 METHOD_TYPE_SAP); 267 if( psz_access && p_sap_cfg && 268 ( strstr( psz_access, "udp" ) || strstr( psz_access , "rtp" ) ) ) 269 { 270 session_descriptor_t *p_session = sout_AnnounceSessionCreate(); 271 announce_method_t *p_method = 272 sout_AnnounceMethodCreate( METHOD_TYPE_SAP ); 273 vlc_url_t url; 254 274 255 275 /* Parse user input */ … … 277 297 if( psz_curr != NULL) 278 298 { 279 p_method->i_ip_version = atoi( psz_curr ) != 0 ? 280 atoi(psz_curr) : 281 4; 299 p_method->i_ip_version = 300 atoi( psz_curr ) != 0 ? atoi(psz_curr) : 4; 282 301 } 283 302 } … … 293 312 294 313 /* Now, parse the URL to extract host and port */ 295 p_url = (vlc_url_t *)malloc( sizeof(vlc_url_t ) ); 296 if ( ! p_url ) 297 { 298 return NULL; 299 } 300 301 vlc_UrlParse( p_url, psz_url , 0); 302 303 if (!p_url->psz_host) 304 { 305 return NULL; 306 } 307 308 if(p_url->i_port == 0) 309 { 310 p_url->i_port = DEFAULT_PORT; 311 } 312 313 p_session->psz_uri = p_url->psz_host; 314 p_session->i_port = p_url->i_port; 315 p_session->psz_sdp = NULL; 316 317 p_session->i_ttl = config_GetInt( p_sout,"ttl" ); 318 p_session->i_payload = 33; 319 320 msg_Info( p_this, "SAP Enabled"); 321 322 sout_AnnounceRegister( p_sout, p_session, p_method ); 323 324 /* FIXME: Free p_method */ 325 326 p_stream->p_sys->p_session = p_session; 327 328 if( p_url ) 329 { 330 vlc_UrlClean( p_url ); 331 free( p_url ); 332 p_url = NULL; 333 } 314 vlc_UrlParse( &url, psz_url , 0); 315 316 if( url.psz_host ) 317 { 318 if( url.i_port == 0 ) 319 { 320 url.i_port = DEFAULT_PORT; 321 } 322 323 p_session->psz_uri = url.psz_host; 324 p_session->i_port = url.i_port; 325 p_session->psz_sdp = NULL; 326 327 p_session->i_ttl = config_GetInt( p_sout, "ttl" ); 328 p_session->i_payload = 33; 329 330 msg_Info( p_this, "SAP Enabled"); 331 332 sout_AnnounceRegister( p_sout, p_session, p_method ); 333 334 /* FIXME: Free p_method */ 335 336 p_stream->p_sys->p_session = p_session; 337 } 338 vlc_UrlClean( &url ); 334 339 } 335 340 … … 347 352 else 348 353 { 349 p_slp = (slp_session_t*)malloc(sizeof(slp_session_t)); 350 if(!p_slp) 351 { 352 msg_Warn(p_sout,"out of memory"); 353 // if( p_sap ) free( p_sap ); 354 return -1; 355 } 354 p_slp = malloc(sizeof(slp_session_t)); 356 355 p_slp->psz_url= strdup(psz_url); 357 356 p_slp->psz_name = strdup( … … 439 438 { 440 439 sout_stream_sys_t *p_sys = p_stream->p_sys; 441 sout_instance_t *p_sout = p_stream->p_sout;442 440 443 441 sout_MuxSendBuffer( p_sys->p_mux, id->p_input, p_buffer );
