Changeset 0a342122be23ccbb7d856c18f19323eb94a71e75

Show
Ignore:
Timestamp:
06/12/07 20:08:04 (1 year ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1196968084 +0000
git-parent:

[fde8b7fc53e178f59adc59e88df6eb623fa9797d]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1196968084 +0000
Message:

Cleanup.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/live555.cpp

    rcfd1271 r0a34212  
    220220    MediaSubsession         *sub    = NULL; 
    221221    int i, i_return; 
     222    int i_error = VLC_EGENERIC; 
    222223 
    223224    if( p_demux->s ) 
     
    293294        uint8_t *p_sdp      = (uint8_t*) malloc( i_sdp_max ); 
    294295 
     296        if( !p_sdp ) 
     297        { 
     298            i_error = VLC_ENOMEM; 
     299            goto error; 
     300        } 
     301 
    295302        for( ;; ) 
    296303        { 
     
    333340    { 
    334341        msg_Err( p_demux, "Failed to retrieve the RTSP Session Description" ); 
     342        i_error = VLC_ENOMEM; 
    335343        goto error; 
    336344    } 
     
    389397 
    390398    free( p_sys ); 
    391     return VLC_EGENERIC
     399    return i_error
    392400} 
    393401 
     
    448456    int  i_ret        = VLC_SUCCESS; 
    449457 
     458    psz_url = (char*)malloc( strlen( p_sys->psz_path ) + 8 ); 
     459    if( !psz_url ) return VLC_ENOMEM; 
     460 
     461    if( p_sys->url.psz_username || p_sys->url.psz_password ) 
     462    { 
     463        sprintf( psz_url, "rtsp://%s%s", p_sys->url.psz_host, 
     464                 p_sys->url.psz_path ); 
     465 
     466        psz_user = strdup( p_sys->url.psz_username ); 
     467        psz_pwd  = strdup( p_sys->url.psz_password ); 
     468    } 
     469    else 
     470    { 
     471        sprintf( psz_url, "rtsp://%s", p_sys->psz_path ); 
     472 
     473        psz_user = var_CreateGetString( p_demux, "rtsp-user" ); 
     474        psz_pwd  = var_CreateGetString( p_demux, "rtsp-pwd" ); 
     475    } 
     476 
    450477createnew: 
    451478    if( var_CreateGetBool( p_demux, "rtsp-http" ) ) 
     
    475502    } 
    476503 
    477  
    478     psz_url = (char*)malloc( strlen( p_sys->psz_path ) + 8 ); 
    479     if( !psz_url ) return VLC_ENOMEM; 
    480  
    481     if( p_sys->url.psz_username || p_sys->url.psz_password ) 
    482     { 
    483         sprintf( psz_url, "rtsp://%s%s", p_sys->url.psz_host, 
    484                  p_sys->url.psz_path ); 
    485  
    486         psz_user = strdup( p_sys->url.psz_username ); 
    487         psz_pwd  = strdup( p_sys->url.psz_password ); 
    488     } 
    489     else 
    490     { 
    491         sprintf( psz_url, "rtsp://%s", p_sys->psz_path ); 
    492  
    493         psz_user = var_CreateGetString( p_demux, "rtsp-user" ); 
    494         psz_pwd  = var_CreateGetString( p_demux, "rtsp-pwd" ); 
    495     } 
    496  
    497504describe: 
    498 msg_Info( p_demux, "[%s] user=%s pwd=%s", psz_url, psz_user, psz_pwd ); 
    499505    authenticator.setUsernameAndPassword( (const char*)psz_user, 
    500506                                          (const char*)psz_pwd ); 
     
    504510    if( psz_options ) delete [] psz_options; 
    505511 
    506     p_sdp = p_sys->rtsp->describeURL( psz_url, 
    507                 &authenticator, var_CreateGetBool( p_demux, "rtsp-kasenna" ) ); 
    508  
    509     if( psz_user ) free( psz_user ); 
    510     if( psz_pwd ) free( psz_pwd ); 
    511  
     512    p_sdp = p_sys->rtsp->describeURL( psz_url, &authenticator, 
     513                         var_CreateGetBool( p_demux, "rtsp-kasenna" ) ); 
    512514    if( p_sdp == NULL ) 
    513515    { 
     
    518520        msg_Dbg( p_demux, "DESCRIBE failed with %d: %s", i_code, psz_error ); 
    519521        if( var_CreateGetBool( p_demux, "rtsp-http" ) ) 
    520             sscanf( psz_error, "%*s %*s HTTP GET %*s HTTP/%*u.%*u %3u %*s", &i_code ); 
     522            sscanf( psz_error, "%*s %*s HTTP GET %*s HTTP/%*u.%*u %3u %*s", 
     523                    &i_code ); 
    521524        else sscanf( psz_error, "%*sRTSP/%*s%3u", &i_code ); 
    522525 
    523526        if( i_code == 401 ) 
    524527        { 
    525             char *psz_login = NULL; char *psz_password = NULL
     528            int i_result
    526529            msg_Dbg( p_demux, "authentication failed" ); 
    527530 
    528             i_ret = intf_UserLoginPassword( p_demux, _("RTSP authentication"), 
     531            if( psz_user ) free( psz_user ); 
     532            if( psz_pwd ) free( psz_pwd ); 
     533            psz_user = psz_pwd = NULL; 
     534 
     535            i_result = intf_UserLoginPassword( p_demux, _("RTSP authentication"), 
    529536                           _("Please enter a valid login name and a password."), 
    530                                                    &psz_login, &psz_password ); 
    531             if( i_ret == DIALOG_OK_YES ) 
     537                                                   &psz_user, &psz_pwd ); 
     538            if( i_result == DIALOG_OK_YES ) 
    532539            { 
    533540                msg_Dbg( p_demux, "retrying with user=%s, pwd=%s", 
    534                             psz_login, psz_password ); 
    535                 if( psz_login ) psz_user = psz_login; 
    536                 if( psz_password ) psz_pwd = psz_password; 
    537                 i_ret = VLC_SUCCESS; 
     541                         psz_user, psz_pwd ); 
    538542                goto describe; 
    539543            } 
    540             if( psz_login ) free( psz_login ); 
    541             if( psz_password ) free( psz_password ); 
    542544        } 
    543545        else if( !var_GetBool( p_demux, "rtsp-http" ) ) 
     
    548550            msg_Dbg( p_demux, "we will now try HTTP tunneling mode" ); 
    549551            var_Set( p_demux, "rtsp-http", val ); 
    550             if( psz_url ) free( psz_url ); 
    551552            if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp ); 
    552553            goto createnew; 
     
    557558 
    558559    /* malloc-ated copy */ 
     560    if( psz_user ) free( psz_user ); 
     561    if( psz_pwd ) free( psz_pwd ); 
     562 
    559563    if( p_sys->p_sdp ) free( p_sys->p_sdp ); 
    560564    p_sys->p_sdp = NULL;