Changeset f449bc75656316b692cfd7dce6a80cc363243f99

Show
Ignore:
Timestamp:
04/08/07 16:04:31 (1 year ago)
Author:
Dennis van Amerongen <trax@videolan.org>
git-committer:
Dennis van Amerongen <trax@videolan.org> 1176041071 +0000
git-parent:

[2ece18d460b0cc45527f3eaea9ba9d8fbcb9e3a5]

git-author:
Dennis van Amerongen <trax@videolan.org> 1176041071 +0000
Message:

* modules/access_output/shout.c: Initialize shout settings properly and make ICY the default protocol. This fixes some libshout Socket error messages on initialization. Closes #1003.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access_output/shout.c

    ra670334 rf449bc7  
    242242    if( !p_shout 
    243243         || shout_set_host( p_shout, psz_host ) != SHOUTERR_SUCCESS 
    244          || shout_set_protocol( p_shout, SHOUT_PROTOCOL_HTTP ) != SHOUTERR_SUCCESS 
     244         || shout_set_protocol( p_shout, SHOUT_PROTOCOL_ICY ) != SHOUTERR_SUCCESS 
    245245         || shout_set_port( p_shout, i_port ) != SHOUTERR_SUCCESS 
    246246         || shout_set_password( p_shout, psz_pass ) != SHOUTERR_SUCCESS 
     
    252252         || shout_set_genre( p_shout, psz_genre ) != SHOUTERR_SUCCESS 
    253253         || shout_set_url( p_shout, psz_url ) != SHOUTERR_SUCCESS 
    254 //       || shout_set_nonblocking( p_shout, 1 ) != SHOUTERR_SUCCESS 
     254         /* || shout_set_nonblocking( p_shout, 1 ) != SHOUTERR_SUCCESS */ 
    255255      ) 
    256256    { 
     
    281281    } 
    282282 
    283  
    284283    /* Don't force bitrate to 0 but only use when specified. This will otherwise 
    285284       show an empty field on icecast directory listing instead of NA */ 
     
    288287    { 
    289288        i_ret = shout_set_audio_info( p_shout, SHOUT_AI_BITRATE, val.psz_string ); 
     289        if( i_ret != SHOUTERR_SUCCESS ) 
     290        { 
     291            msg_Err( p_access, "failed to set the information about the bitrate" ); 
     292            free( p_access->p_sys ); 
     293            free( psz_accessname ); 
     294            return VLC_EGENERIC; 
     295        } 
    290296    } 
    291297    else 
     
    298304    } 
    299305 
    300     if( i_ret != SHOUTERR_SUCCESS ) 
    301     { 
    302         msg_Err( p_access, "failed to set the information about the bitrate" ); 
    303         free( p_access->p_sys ); 
    304         free( psz_accessname ); 
    305         return VLC_EGENERIC; 
    306     } 
    307  
    308306    /* Information about samplerate, channels and quality will not be propagated 
    309307       through the YP protocol for icecast to the public directory listing when 
     
    312310    var_Get( p_access, SOUT_CFG_PREFIX "samplerate", &val ); 
    313311    if( *val.psz_string ) 
     312    { 
    314313        i_ret = shout_set_audio_info( p_shout, SHOUT_AI_SAMPLERATE, val.psz_string ); 
    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" ); 
    383317            free( p_access->p_sys ); 
    384318            free( psz_accessname ); 
    385319            return VLC_EGENERIC; 
    386320        } 
     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" ); 
    387378 
    388379        /* Shout parameters cannot be changed on an open connection */ 
     
    393384        } 
    394385 
    395         i_ret = shout_set_protocol( p_shout, SHOUT_PROTOCOL_ICY ); 
     386        /* IceCAST using HTTP protocol */ 
     387        i_ret = shout_set_protocol( p_shout, SHOUT_PROTOCOL_HTTP ); 
    396388        if( i_ret != SHOUTERR_SUCCESS ) 
    397389        { 
    398             msg_Err( p_access, "failed to set the protocol to 'icy'" ); 
     390            msg_Err( p_access, "failed to set the protocol to 'http'" ); 
    399391            free( p_access->p_sys ); 
    400392            free( psz_accessname ); 
     
    406398        { 
    407399            i_ret = SHOUTERR_CONNECTED; 
    408         } 
     400            msg_Dbg( p_access, "connected using 'http' (icecast 2.x) protocol" ); 
     401        } 
     402        else 
     403            msg_Warn( p_access, "failed to connect using 'http' (icecast 2.x) protocol " ); 
    409404    } 
    410405