Changeset 956087a83e8ff3653bcc2b87340a593bad6388ab

Show
Ignore:
Timestamp:
06/07/06 22:43:21 (2 years ago)
Author:
Derk-Jan Hartman <hartman@videolan.org>
git-committer:
Derk-Jan Hartman <hartman@videolan.org> 1152218601 +0000
git-parent:

[c158aecdaf63c3b1490e04147915c32425cd4d3b]

git-author:
Derk-Jan Hartman <hartman@videolan.org> 1152218601 +0000
Message:

* Fix SDP file parsing of the SAP module.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/services_discovery/sap.c

    r4ec4955 r956087a  
    412412    p_demux->pf_demux = Demux; 
    413413 
    414     free( psz_sdp ); 
     414    FREE( psz_sdp ); 
    415415    return VLC_SUCCESS; 
    416416 
    417417error: 
    418     free( psz_sdp ); 
    419     if( p_sdp ) FreeSDP( p_sdp ); 
     418    FREE( psz_sdp ); 
     419    if( p_sdp ) FreeSDP( p_sdp ); p_sdp = NULL; 
    420420    stream_Seek( p_demux->s, 0 ); 
    421421    return VLC_EGENERIC; 
     
    471471    if( p_demux->p_sys ) 
    472472    { 
    473         if( p_demux->p_sys->p_sdp ) FreeSDP( p_demux->p_sys->p_sdp ); 
     473        if( p_demux->p_sys->p_sdp ) { FreeSDP( p_demux->p_sys->p_sdp ); p_demux->p_sys->p_sdp = NULL; } 
    474474        free( p_demux->p_sys ); 
    475475    } 
     
    572572    sdp_t *p_sdp = p_demux->p_sys->p_sdp; 
    573573    playlist_t *p_playlist; 
     574    input_thread_t *p_input; 
     575    input_item_t *p_parent_input; 
    574576 
    575577    p_playlist = (playlist_t *)vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST, 
    576578                                               FIND_ANYWHERE ); 
    577  
    578     /* TODO FIXME !! Add at the correct place */ 
    579     playlist_PlaylistAdd( p_playlist, p_sdp->psz_uri, EnsureUTF8( p_sdp->psz_sessionname ), 
    580                           PLAYLIST_APPEND, PLAYLIST_END ); 
    581  
     579    if( !p_playlist ) 
     580    { 
     581        msg_Err( p_demux, "playlist could not be found" ); 
     582        return VLC_EGENERIC; 
     583    } 
     584 
     585    p_input = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, 
     586                                               FIND_PARENT ); 
     587    if( !p_input ) 
     588    { 
     589        msg_Err( p_demux, "parent input could not be found" ); 
     590        return VLC_EGENERIC; 
     591    } 
     592 
     593    p_parent_input = p_input->input.p_item; 
     594 
     595    vlc_mutex_lock( &p_parent_input->lock ); 
     596    FREE( p_parent_input->psz_uri ); 
     597    p_parent_input->psz_uri = strdup( p_sdp->psz_uri ); 
     598    FREE( p_parent_input->psz_name ); 
     599    p_parent_input->psz_name = strdup( EnsureUTF8( p_sdp->psz_sessionname ) ); 
     600    p_parent_input->i_type = ITEM_TYPE_NET; 
     601 
     602    if( p_playlist->status.p_item && 
     603             p_playlist->status.p_item->p_input == p_parent_input ) 
     604    { 
     605        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, 
     606                          p_playlist->status.p_node, p_playlist->status.p_item ); 
     607    } 
     608 
     609    vlc_mutex_unlock( &p_parent_input->lock ); 
     610    vlc_object_release( p_input ); 
    582611    vlc_object_release( p_playlist ); 
    583     if( p_sdp ) FreeSDP( p_sdp ); 
    584612 
    585613    return VLC_SUCCESS; 
     
    763791                p_sd->p_sys->pp_announces[i]->i_last = mdate(); 
    764792            } 
    765             FreeSDP( p_sdp ); 
     793            FreeSDP( p_sdp ); p_sdp = NULL; 
    766794            return VLC_SUCCESS; 
    767795        } 
     
    11291157        { 
    11301158            msg_Warn( p_obj, "invalid packet" ) ; 
    1131             FreeSDP( p_sdp ); 
     1159            FreeSDP( p_sdp ); p_sdp = NULL; 
    11321160            return NULL; 
    11331161        } 
     
    12411269        if( b_invalid ) 
    12421270        { 
    1243             FreeSDP( p_sdp ); 
     1271            FreeSDP( p_sdp ); p_sdp = NULL; 
    12441272            return NULL; 
    12451273        } 
     
    13391367        FREE( p_attr ); 
    13401368    } 
    1341     free( p_sdp ); 
     1369    FREE( p_sdp ); 
    13421370} 
    13431371 
     
    13471375    int i; 
    13481376 
    1349     if( p_announce->p_sdp ) FreeSDP( p_announce->p_sdp ); 
     1377    if( p_announce->p_sdp ) 
     1378    { 
     1379        FreeSDP( p_announce->p_sdp ); 
     1380        p_announce->p_sdp = NULL; 
     1381    } 
    13501382 
    13511383    if( p_announce->i_input_id > -1 )