Changeset 1689169ec7248d0e18de86baf790d3ad86a1478d
- Timestamp:
- 25/11/07 13:40:20
(11 months ago)
- Author:
- Dennis van Amerongen <trax@videolan.org>
- git-committer:
- Dennis van Amerongen <trax@videolan.org> 1195994420 +0000
- git-parent:
[d0cd61dd25dcb01340ae257b861563bfca401fb9]
- git-author:
- Dennis van Amerongen <trax@videolan.org> 1195994420 +0000
- Message:
* modules/access_output/shout.c: automatic reconnect to server at startup.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rd0cd61d |
r1689169 |
|
| 365 | 365 | } |
|---|
| 366 | 366 | |
|---|
| 367 | | /* Shoutcast using ICY protocol */ |
|---|
| 368 | | i_ret = shout_open( p_shout ); |
|---|
| 369 | | if( i_ret == SHOUTERR_SUCCESS ) |
|---|
| 370 | | { |
|---|
| 371 | | i_ret = SHOUTERR_CONNECTED; |
|---|
| 372 | | msg_Dbg( p_access, "connected using 'icy' (shoutcast) protocol" ); |
|---|
| 373 | | } |
|---|
| 374 | | else |
|---|
| 375 | | { |
|---|
| 376 | | msg_Warn( p_access, "failed to connect using 'icy' (shoutcast) protocol" ); |
|---|
| 377 | | |
|---|
| | 367 | /* Connect at startup. Cycle through the possible protocols. */ |
|---|
| | 368 | i_ret = shout_get_connected( p_shout ); |
|---|
| | 369 | while ( i_ret != SHOUTERR_CONNECTED ) |
|---|
| | 370 | { |
|---|
| 378 | 371 | /* Shout parameters cannot be changed on an open connection */ |
|---|
| 379 | 372 | i_ret = shout_close( p_shout ); |
|---|
| … | … | |
| 383 | 376 | } |
|---|
| 384 | 377 | |
|---|
| 385 | | /* IceCAST using HTTP protocol */ |
|---|
| 386 | | i_ret = shout_set_protocol( p_shout, SHOUT_PROTOCOL_HTTP ); |
|---|
| | 378 | /* Re-initialize for Shoutcast using ICY protocol. Not needed for initial connection |
|---|
| | 379 | but it is when we are reconnecting after other protocol was tried. */ |
|---|
| | 380 | i_ret = shout_set_protocol( p_shout, SHOUT_PROTOCOL_ICY ); |
|---|
| 387 | 381 | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| 388 | 382 | { |
|---|
| 389 | | msg_Err( p_access, "failed to set the protocol to 'http'" ); |
|---|
| | 383 | msg_Err( p_access, "failed to set the protocol to 'icy'" ); |
|---|
| 390 | 384 | free( p_access->p_sys ); |
|---|
| 391 | 385 | free( psz_accessname ); |
|---|
| 392 | 386 | return VLC_EGENERIC; |
|---|
| 393 | 387 | } |
|---|
| 394 | | |
|---|
| 395 | 388 | i_ret = shout_open( p_shout ); |
|---|
| 396 | 389 | if( i_ret == SHOUTERR_SUCCESS ) |
|---|
| 397 | 390 | { |
|---|
| 398 | 391 | i_ret = SHOUTERR_CONNECTED; |
|---|
| 399 | | msg_Dbg( p_access, "connected using 'http' (icecast 2.x) protocol" ); |
|---|
| | 392 | msg_Dbg( p_access, "connected using 'icy' (shoutcast) protocol" ); |
|---|
| 400 | 393 | } |
|---|
| 401 | 394 | else |
|---|
| 402 | | msg_Warn( p_access, "failed to connect using 'http' (icecast 2.x) protocol " ); |
|---|
| 403 | | } |
|---|
| 404 | | |
|---|
| | 395 | { |
|---|
| | 396 | msg_Warn( p_access, "failed to connect using 'icy' (shoutcast) protocol" ); |
|---|
| | 397 | |
|---|
| | 398 | /* Shout parameters cannot be changed on an open connection */ |
|---|
| | 399 | i_ret = shout_close( p_shout ); |
|---|
| | 400 | if( i_ret == SHOUTERR_SUCCESS ) |
|---|
| | 401 | { |
|---|
| | 402 | i_ret = SHOUTERR_UNCONNECTED; |
|---|
| | 403 | } |
|---|
| | 404 | |
|---|
| | 405 | /* IceCAST using HTTP protocol */ |
|---|
| | 406 | i_ret = shout_set_protocol( p_shout, SHOUT_PROTOCOL_HTTP ); |
|---|
| | 407 | if( i_ret != SHOUTERR_SUCCESS ) |
|---|
| | 408 | { |
|---|
| | 409 | msg_Err( p_access, "failed to set the protocol to 'http'" ); |
|---|
| | 410 | free( p_access->p_sys ); |
|---|
| | 411 | free( psz_accessname ); |
|---|
| | 412 | return VLC_EGENERIC; |
|---|
| | 413 | } |
|---|
| | 414 | i_ret = shout_open( p_shout ); |
|---|
| | 415 | if( i_ret == SHOUTERR_SUCCESS ) |
|---|
| | 416 | { |
|---|
| | 417 | i_ret = SHOUTERR_CONNECTED; |
|---|
| | 418 | msg_Dbg( p_access, "connected using 'http' (icecast 2.x) protocol" ); |
|---|
| | 419 | } |
|---|
| | 420 | else |
|---|
| | 421 | msg_Warn( p_access, "failed to connect using 'http' (icecast 2.x) protocol " ); |
|---|
| | 422 | } |
|---|
| 405 | 423 | /* |
|---|
| 406 | | for non-blocking, use: |
|---|
| 407 | | while( i_ret == SHOUTERR_BUSY ) |
|---|
| 408 | | { |
|---|
| 409 | | sleep( 1 ); |
|---|
| 410 | | i_ret = shout_get_connected( p_shout ); |
|---|
| 411 | | } |
|---|
| | 424 | for non-blocking, use: |
|---|
| | 425 | while( i_ret == SHOUTERR_BUSY ) |
|---|
| | 426 | { |
|---|
| | 427 | sleep( 1 ); |
|---|
| | 428 | i_ret = shout_get_connected( p_shout ); |
|---|
| | 429 | } |
|---|
| 412 | 430 | */ |
|---|
| | 431 | /* Only wait when we have no connection */ |
|---|
| | 432 | if ( i_ret != SHOUTERR_CONNECTED ) |
|---|
| | 433 | { |
|---|
| | 434 | msg_Warn( p_access, "unable to establish connection. waiting 30 seconds to retry..." ); |
|---|
| | 435 | msleep( 30000000 ); |
|---|
| | 436 | } |
|---|
| | 437 | } |
|---|
| | 438 | |
|---|
| 413 | 439 | if( i_ret != SHOUTERR_CONNECTED ) |
|---|
| 414 | 440 | { |
|---|