| 315 | | else |
|---|
| 316 | | free( val.psz_string ); |
|---|
| 317 | | |
|---|
| 318 | | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| 319 | | { |
|---|
| 320 | | msg_Err( p_access, "failed to set the information about the samplerate" ); |
|---|
| 321 | | free( p_access->p_sys ); |
|---|
| 322 | | free( psz_accessname ); |
|---|
| 323 | | return VLC_EGENERIC; |
|---|
| 324 | | } |
|---|
| 325 | | |
|---|
| 326 | | var_Get( p_access, SOUT_CFG_PREFIX "channels", &val ); |
|---|
| 327 | | if( *val.psz_string ) |
|---|
| 328 | | i_ret = shout_set_audio_info( p_shout, SHOUT_AI_CHANNELS, val.psz_string ); |
|---|
| 329 | | else |
|---|
| 330 | | free( val.psz_string ); |
|---|
| 331 | | |
|---|
| 332 | | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| 333 | | { |
|---|
| 334 | | msg_Err( p_access, "failed to set the information about the number of channels" ); |
|---|
| 335 | | free( p_access->p_sys ); |
|---|
| 336 | | free( psz_accessname ); |
|---|
| 337 | | return VLC_EGENERIC; |
|---|
| 338 | | } |
|---|
| 339 | | |
|---|
| 340 | | var_Get( p_access, SOUT_CFG_PREFIX "quality", &val ); |
|---|
| 341 | | if( *val.psz_string ) |
|---|
| 342 | | i_ret = shout_set_audio_info( p_shout, SHOUT_AI_QUALITY, val.psz_string ); |
|---|
| 343 | | else |
|---|
| 344 | | free( val.psz_string ); |
|---|
| 345 | | |
|---|
| 346 | | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| 347 | | { |
|---|
| 348 | | msg_Err( p_access, "failed to set the information about Ogg Vorbis quality" ); |
|---|
| 349 | | free( p_access->p_sys ); |
|---|
| 350 | | free( psz_accessname ); |
|---|
| 351 | | return VLC_EGENERIC; |
|---|
| 352 | | } |
|---|
| 353 | | |
|---|
| 354 | | var_Get( p_access, SOUT_CFG_PREFIX "public", &val ); |
|---|
| 355 | | if( val.b_bool == VLC_TRUE ) |
|---|
| 356 | | i_ret = shout_set_public( p_shout, 1 ); |
|---|
| 357 | | |
|---|
| 358 | | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| 359 | | { |
|---|
| 360 | | msg_Err( p_access, "failed to set the server status setting to public" ); |
|---|
| 361 | | free( p_access->p_sys ); |
|---|
| 362 | | free( psz_accessname ); |
|---|
| 363 | | return VLC_EGENERIC; |
|---|
| 364 | | } |
|---|
| 365 | | |
|---|
| 366 | | i_ret = shout_open( p_shout ); |
|---|
| 367 | | if( i_ret == SHOUTERR_SUCCESS ) |
|---|
| 368 | | { |
|---|
| 369 | | i_ret = SHOUTERR_CONNECTED; |
|---|
| 370 | | } |
|---|
| 371 | | else |
|---|
| 372 | | { |
|---|
| 373 | | /* If default 'http' protocol for icecast 2.x fails, fall back to 'icy' |
|---|
| 374 | | for shoutcast server */ |
|---|
| 375 | | msg_Warn( p_access, "failed to connect using 'http' (icecast 2.x) protocol, " |
|---|
| 376 | | "switching to 'icy' (shoutcast)" ); |
|---|
| 377 | | |
|---|
| 378 | | i_ret = shout_get_format( p_shout ); |
|---|
| 379 | | if( i_ret != SHOUT_FORMAT_MP3 ) |
|---|
| 380 | | { |
|---|
| 381 | | msg_Err( p_access, "failed to use 'icy' protocol: only MP3 " \ |
|---|
| 382 | | "streaming to shoutcast is supported" ); |
|---|
| | 314 | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| | 315 | { |
|---|
| | 316 | msg_Err( p_access, "failed to set the information about the samplerate" ); |
|---|
| | 321 | } |
|---|
| | 322 | else |
|---|
| | 323 | free( val.psz_string ); |
|---|
| | 324 | |
|---|
| | 325 | var_Get( p_access, SOUT_CFG_PREFIX "channels", &val ); |
|---|
| | 326 | if( *val.psz_string ) |
|---|
| | 327 | { |
|---|
| | 328 | i_ret = shout_set_audio_info( p_shout, SHOUT_AI_CHANNELS, val.psz_string ); |
|---|
| | 329 | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| | 330 | { |
|---|
| | 331 | msg_Err( p_access, "failed to set the information about the number of channels" ); |
|---|
| | 332 | free( p_access->p_sys ); |
|---|
| | 333 | free( psz_accessname ); |
|---|
| | 334 | return VLC_EGENERIC; |
|---|
| | 335 | } |
|---|
| | 336 | } |
|---|
| | 337 | else |
|---|
| | 338 | free( val.psz_string ); |
|---|
| | 339 | |
|---|
| | 340 | var_Get( p_access, SOUT_CFG_PREFIX "quality", &val ); |
|---|
| | 341 | if( *val.psz_string ) |
|---|
| | 342 | { |
|---|
| | 343 | i_ret = shout_set_audio_info( p_shout, SHOUT_AI_QUALITY, val.psz_string ); |
|---|
| | 344 | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| | 345 | { |
|---|
| | 346 | msg_Err( p_access, "failed to set the information about Ogg Vorbis quality" ); |
|---|
| | 347 | free( p_access->p_sys ); |
|---|
| | 348 | free( psz_accessname ); |
|---|
| | 349 | return VLC_EGENERIC; |
|---|
| | 350 | } |
|---|
| | 351 | } |
|---|
| | 352 | else |
|---|
| | 353 | free( val.psz_string ); |
|---|
| | 354 | |
|---|
| | 355 | var_Get( p_access, SOUT_CFG_PREFIX "public", &val ); |
|---|
| | 356 | if( val.b_bool == VLC_TRUE ) |
|---|
| | 357 | { |
|---|
| | 358 | i_ret = shout_set_public( p_shout, 1 ); |
|---|
| | 359 | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| | 360 | { |
|---|
| | 361 | msg_Err( p_access, "failed to set the server status setting to public" ); |
|---|
| | 362 | free( p_access->p_sys ); |
|---|
| | 363 | free( psz_accessname ); |
|---|
| | 364 | return VLC_EGENERIC; |
|---|
| | 365 | } |
|---|
| | 366 | } |
|---|
| | 367 | |
|---|
| | 368 | /* Shoutcast using ICY protocol */ |
|---|
| | 369 | i_ret = shout_open( p_shout ); |
|---|
| | 370 | if( i_ret == SHOUTERR_SUCCESS ) |
|---|
| | 371 | { |
|---|
| | 372 | i_ret = SHOUTERR_CONNECTED; |
|---|
| | 373 | msg_Dbg( p_access, "connected using 'icy' (shoutcast) protocol" ); |
|---|
| | 374 | } |
|---|
| | 375 | else |
|---|
| | 376 | { |
|---|
| | 377 | msg_Warn( p_access, "failed to connect using 'icy' (shoutcast) protocol" ); |
|---|