Changeset 662ed774b9740eabf8b0203e53f51e6c35657e0d

Show
Ignore:
Timestamp:
18/08/07 16:59:31 (1 year ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1187449171 +0000
git-parent:

[a387a1ff337681b34c749ac762338ac673254574]

git-author:
Rafaël Carré <funman@videolan.org> 1187449171 +0000
Message:

Input access locking, part 2.
Fix [21193]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_input.h

    r07c9227 r662ed77  
    2727#endif 
    2828 
     29#ifndef __USE_GNU 
     30#define __USE_GNU 
     31#endif 
     32#include <string.h>                                     /* strcasestr() */ 
     33 
    2934/* __ is need because conflict with <vlc/input.h> */ 
    3035#ifndef _VLC__INPUT_H 
     
    223228    vlc_event_t event; 
    224229 
    225     //vlc_mutex_lock( &p_i->lock ); 
     230    vlc_mutex_lock( &p_i->lock ); 
    226231    if( !p_i->p_meta ) 
    227232        p_i->p_meta = vlc_meta_New(); 
    228233    vlc_meta_Set( p_i->p_meta, meta_type, psz_val ); 
    229     //vlc_mutex_unlock( &p_i->lock );  
     234    vlc_mutex_unlock( &p_i->lock );  
    230235 
    231236    /* Notify interested third parties */ 
     
    237242static inline vlc_bool_t input_item_MetaMatch( input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz ) 
    238243{ 
    239     //vlc_mutex_lock( &p_i->lock ); 
     244    vlc_mutex_lock( &p_i->lock ); 
    240245    const char * meta = vlc_meta_Get( p_i->p_meta, meta_type ); 
    241246    vlc_bool_t ret = meta && strcasestr( meta, psz ); 
    242     //vlc_mutex_unlock( &p_i->lock ); 
     247    vlc_mutex_unlock( &p_i->lock ); 
    243248 
    244249    return ret; 
     
    248253{ 
    249254    char * psz = NULL; 
    250     //vlc_mutex_lock( &p_i->lock ); 
     255    vlc_mutex_lock( &p_i->lock ); 
    251256 
    252257    if( !p_i->p_meta ) 
    253258    { 
    254         //vlc_mutex_unlock( &p_i->lock ); 
     259        vlc_mutex_unlock( &p_i->lock ); 
    255260        return NULL; 
    256261    } 
     
    259264        psz = strdup( vlc_meta_Get( p_i->p_meta, meta_type ) ); 
    260265 
    261     //vlc_mutex_unlock( &p_i->lock ); 
     266    vlc_mutex_unlock( &p_i->lock ); 
    262267    return psz; 
    263268} 
     
    265270static inline char * input_item_GetName( input_item_t * p_i ) 
    266271{ 
    267     //vlc_mutex_lock( &p_i->lock ); 
     272    vlc_mutex_lock( &p_i->lock ); 
    268273    char *psz_s = p_i->psz_name ? strdup( p_i->psz_name ) : NULL; 
    269     //vlc_mutex_unlock( &p_i->lock ); 
     274    vlc_mutex_unlock( &p_i->lock ); 
    270275    return psz_s; 
    271276} 
  • modules/misc/notify/growl.c

    r51880eb r662ed77  
    125125    vlc_object_yield( p_input ); 
    126126 
    127     if( p_input->b_dead || !input_GetItem(p_input)->psz_name ) 
     127    char *psz_name = input_item_GetName( input_GetItem( p_input ) ); 
     128    if( p_input->b_dead || !psz_name ) 
    128129    { 
    129130        /* Not playing anything ... */ 
     131        free( psz_name ); 
    130132        vlc_object_release( p_input ); 
    131133        return VLC_SUCCESS; 
    132134    } 
     135    free( psz_name ); 
    133136 
    134137    /* Playing something ... */ 
    135     psz_artist = input_item_GetArtist( input_GetItem(p_input) ) ? 
    136                   strdup( input_item_GetArtist( input_GetItem(p_input) ) ) : 
    137                   strdup( "" ); 
    138     psz_album = input_item_GetAlbum( input_GetItem(p_input) ) ? 
    139                   strdup( input_item_GetAlbum( input_GetItem(p_input) ) ) : 
    140                   strdup("" ); 
    141     psz_title = strdup( input_GetItem(p_input)->psz_name ); 
     138    psz_artist = input_item_GetArtist( input_GetItem( p_input ) ); 
     139    if( psz_artist == NULL ) psz_artist = strdup( "" ); 
     140    psz_album = input_item_GetAlbum( input_GetItem( p_input ) ) ; 
     141    if( psz_album == NULL ) psz_album = strdup( "" ); 
     142    psz_title = input_item_GetName( input_GetItem( p_input ) ); 
    142143    if( psz_title == NULL ) psz_title = strdup( N_("(no title)") ); 
    143144    snprintf( psz_tmp, GROWL_MAX_LENGTH, "%s %s %s", 
  • modules/misc/notify/notify.c

    r51880eb r662ed77  
    151151 
    152152    /* Playing something ... */ 
    153     psz_artist = input_item_GetArtist( input_GetItem(p_input) ) ? 
    154                   strdup( input_item_GetArtist( input_GetItem(p_input) ) ) : 
    155                   strdup( _("no artist") ); 
    156     psz_album = input_item_GetAlbum( input_GetItem(p_input) ) ? 
    157                   strdup( input_item_GetAlbum( input_GetItem(p_input) ) ) : 
    158                   strdup( _("no album") ); 
    159     psz_title = strdup( input_GetItem(p_input)->psz_name ); 
     153    psz_artist = input_item_GetArtist( input_GetItem( p_input ) ); 
     154    if( psz_artist == NULL ) psz_artist = strdup( _("no artist") ); 
     155    psz_album = input_item_GetAlbum( input_GetItem( p_input ) ) ; 
     156    if( psz_album == NULL ) psz_album = strdup( _("no album") ); 
     157    psz_title = input_item_GetName( input_GetItem( p_input ) ); 
    160158 
    161159    vlc_object_release( p_input ); 
  • modules/misc/playlist/m3u.c

    r51880eb r662ed77  
    6666 
    6767        /* General info */ 
    68         if( p_current->p_input->psz_name && 
    69              strcmp( p_current->p_input->psz_uri, 
    70                      p_current->p_input->psz_name ) ) 
     68        char *psz_name = input_item_GetName( p_current->p_input ); 
     69        if( psz_name && strcmp( p_current->p_input->psz_uri, psz_name ) ) 
    7170        { 
    72             char *psz_artist = input_item_GetArtist( p_current->p_input ) ? 
    73                                strdup( input_item_GetArtist( p_current->p_input ) ): 
    74                                strdup( "" ); 
     71            char *psz_artist = input_item_GetArtist( p_current->p_input ); 
     72            if( psz_artist == NULL ) psz_artist = strdup( "" ); 
    7573            if( psz_artist && *psz_artist ) 
    7674            { 
     
    8886                          p_current->p_input->psz_name); 
    8987            } 
    90             if( psz_artist ) 
    91                 free( psz_artist ); 
     88            free( psz_artist ); 
    9289        } 
     90        free( psz_name ); 
    9391 
    9492        /* VLC specific options */ 
  • modules/misc/playlist/xspf.c

    r51880eb r662ed77  
    164164 
    165165    /* -> the artist/creator */ 
    166     psz = input_item_GetArtist( p_item->p_input ) ? 
    167                         strdup( input_item_GetArtist( p_item->p_input ) ): 
    168                         strdup( "" ); 
     166    psz = input_item_GetArtist( p_item->p_input ); 
     167    if( psz == NULL ) psz = strdup( "" ); 
    169168    psz_temp = convert_xml_special_chars( psz ); 
    170     if( psz ) free( psz ); 
     169    free( psz ); 
    171170    if( *psz_temp ) 
    172171    { 
     
    176175 
    177176    /* -> the album */ 
    178     psz = input_item_GetAlbum( p_item->p_input ) ? 
    179                         strdup( input_item_GetAlbum( p_item->p_input ) ): 
    180                         strdup( "" ); 
     177    psz = input_item_GetAlbum( p_item->p_input ); 
     178    if( psz == NULL ) psz = strdup( "" ); 
    181179    psz_temp = convert_xml_special_chars( psz ); 
    182     if( psz ) free( psz ); 
     180    free( psz ); 
    183181    if( *psz_temp ) 
    184182    { 
     
    188186 
    189187    /* -> the track number */ 
    190     psz = input_item_GetTrackNum( p_item->p_input ) ? 
    191                         strdup( input_item_GetTrackNum( p_item->p_input ) ): 
    192                         strdup( "" ); 
     188    psz = input_item_GetTrackNum( p_item->p_input ); 
     189    if( psz == NULL ) psz = strdup( "" ); 
    193190    if( psz ) 
    194191    { 
     
    197194            fprintf( p_file, "\t\t\t<trackNum>%i</trackNum>\n", atoi( psz ) ); 
    198195        } 
    199         free( psz ); 
    200     } 
     196    } 
     197    free( psz ); 
    201198 
    202199    /* -> the description */ 
    203     psz = input_item_GetDescription( p_item->p_input ) ? 
    204                         strdup( input_item_GetDescription( p_item->p_input ) ): 
    205                         strdup( "" ); 
     200    psz = input_item_GetDescription( p_item->p_input ); 
     201    if( psz == NULL ) psz = strdup( "" ); 
    206202    psz_temp = convert_xml_special_chars( psz ); 
    207     if( psz ) free( psz ); 
     203    free( psz ); 
    208204    if( *psz_temp ) 
    209205    { 
  • modules/visualization/goom.c

    r51880eb r662ed77  
    417417    if( p_input ) 
    418418    { 
    419         if( !EMPTY_STR( input_item_GetTitle( input_GetItem(p_input) ) ) ) 
    420         { 
    421             psz_title = strdup( input_item_GetTitle( input_GetItem(p_input) ) ); 
    422         } 
    423         else 
    424         { 
     419        psz_title = strdup( input_item_GetTitle( input_GetItem( p_input ) ) ); 
     420        if( EMPTY_STR( psz_title ) ) 
     421        { 
     422            free( psz_title ); 
    425423            char *psz = strrchr( input_GetItem(p_input)->psz_uri, '/' ); 
    426424 
  • src/input/control.c

    rfbc7ad6 r662ed77  
    153153                if( !p_cat ) 
    154154                { 
    155                     vlc_mutex_lock( &p_input->p->input.p_item->lock ); 
     155                    vlc_mutex_unlock( &p_input->p->input.p_item->lock ); 
    156156                    return VLC_EGENERIC; 
    157157                } 
     
    181181                if( !p_info ) 
    182182                { 
    183                     vlc_mutex_lock( &p_input->p->input.p_item->lock ); 
     183                    vlc_mutex_unlock( &p_input->p->input.p_item->lock ); 
    184184                    return VLC_EGENERIC; 
    185185                } 
  • src/input/es_out.c

    r51880eb r662ed77  
    488488 
    489489    /* Update now playing */ 
    490     vlc_mutex_lock( &p_input->p->input.p_item->lock ); 
    491490    input_item_SetNowPlaying( p_input->p->input.p_item, 
    492491                              p_pgrm->psz_now_playing ); 
    493492    input_item_SetPublisher( p_input->p->input.p_item, 
    494493                             p_pgrm->psz_publisher ); 
    495     vlc_mutex_unlock( &p_input->p->input.p_item->lock ); 
    496494 
    497495    var_SetBool( p_sys->p_input, "intf-change", VLC_TRUE ); 
     
    673671    { 
    674672        if( p_sys->p_pgrm == p_pgrm ) 
    675         { 
    676             vlc_mutex_lock( &p_input->p->input.p_item->lock ); 
    677673            input_item_SetPublisher( p_input->p->input.p_item, psz_provider ); 
    678             vlc_mutex_unlock( &p_input->p->input.p_item->lock ); 
    679         } 
    680674        input_Control( p_input, INPUT_ADD_INFO, psz_cat, input_MetaTypeToLocalizedString(vlc_meta_Publisher), psz_provider ); 
    681675    } 
     
    799793        p_pgrm->psz_now_playing = strdup( p_epg->p_current->psz_name ); 
    800794 
    801     vlc_mutex_lock( &p_input->p->input.p_item->lock ); 
    802795    if( p_pgrm == p_sys->p_pgrm ) 
    803796        input_item_SetNowPlaying( p_input->p->input.p_item, p_pgrm->psz_now_playing ); 
    804     vlc_mutex_unlock( &p_input->p->input.p_item->lock ); 
    805797 
    806798    if( p_pgrm->psz_now_playing ) 
  • src/input/input.c

    rda8a2f9 r662ed77  
    255255        _(VLC_META_INFO_CAT), 
    256256        _(VLC_META_NOW_PLAYING) ); 
    257     vlc_mutex_lock( &p_item->lock ); 
    258257    input_item_SetNowPlaying( p_item, NULL ); 
    259     vlc_mutex_unlock( &p_item->lock ); 
    260258 
    261259    /* */ 
     
    25062504{ 
    25072505    input_item_t *p_item = p_input->p->input.p_item; 
    2508     char * psz_saved_arturl = NULL; 
    2509     const char * psz_arturl = NULL; 
     2506    char * psz_arturl = NULL; 
    25102507    char *psz_title = NULL; 
    25112508    int i; 
     2509    int i_arturl_event = VLC_FALSE; 
    25122510 
    25132511    if( !p_meta ) 
    25142512        return; 
     2513 
     2514    psz_arturl = input_item_GetArtURL( p_item ); 
    25152515 
    25162516    vlc_mutex_lock( &p_item->lock ); 
     
    25182518        psz_title = strdup( vlc_meta_Get( p_meta, vlc_meta_Title ) ); 
    25192519 
    2520     if( input_item_GetArtURL( p_item ) ) 
    2521         psz_saved_arturl = strdup( input_item_GetArtURL( p_item ) ); 
    2522  
    25232520    vlc_meta_Merge( p_item->p_meta, p_meta ); 
    25242521 
    2525     if( psz_saved_arturl && *psz_saved_arturl ) 
    2526         input_item_SetArtURL( p_item, psz_saved_arturl ); 
    2527  
    2528     free( psz_saved_arturl ); 
     2522    if( psz_arturl && *psz_arturl ) 
     2523    { 
     2524        vlc_meta_Set( p_item->p_meta, vlc_meta_ArtworkURL, psz_arturl ); 
     2525        i_arturl_event = VLC_TRUE; 
     2526    } 
     2527 
    25292528    vlc_meta_Delete( p_meta ); 
    25302529 
    2531     psz_arturl = input_item_GetArtURL( p_item ); 
    25322530    if( psz_arturl && !strncmp( psz_arturl, "attachment://", strlen("attachment") ) ) 
    25332531    { 
     
    25352533         * XXX It can change when sout has meta data support */ 
    25362534        if( p_input->p->p_sout && !p_input->b_preparsing ) 
    2537             input_item_SetArtURL( p_item, "" ); 
     2535        { 
     2536            vlc_meta_Set( p_item->p_meta, vlc_meta_ArtworkURL, "" ); 
     2537            i_arturl_event = VLC_TRUE; 
     2538 
     2539        } 
    25382540        else 
    25392541            input_ExtractAttachmentAndCacheArt( p_input ); 
    25402542    } 
     2543    free( psz_arturl ); 
    25412544     
    25422545    input_item_SetPreparsed( p_item, VLC_TRUE ); 
     
    25502553    } 
    25512554    vlc_mutex_unlock( &p_item->lock ); 
     2555 
     2556    if( i_arturl_event == VLC_TRUE ) 
     2557    { 
     2558        vlc_event_t event; 
     2559 
     2560        /* Notify interested third parties */ 
     2561        event.type = vlc_InputItemMetaChanged; 
     2562        event.u.input_item_meta_changed.meta_type = vlc_meta_ArtworkURL; 
     2563        vlc_event_send( &p_item->event_manager, &event ); 
     2564    } 
    25522565 
    25532566    if( psz_title ) 
  • src/input/meta.c

    r72b9e70 r662ed77  
    120120    int i_ret = VLC_EGENERIC; 
    121121    module_t *p_module; 
     122    char *psz_name, *psz_title, *psz_artist, *psz_album; 
    122123 
    123124    if( !p_item->p_meta ) 
    124125        return VLC_EGENERIC; 
    125126 
    126     if(  !p_item->psz_name && !input_item_GetTitle( p_item ) && 
    127         (!input_item_GetArtist( p_item ) || !input_item_GetAlbum( p_item )) ) 
     127    psz_name = input_item_GetName( p_item ); 
     128    psz_title = input_item_GetTitle( p_item ); 
     129    psz_artist = input_item_GetArtist( p_item ); 
     130    psz_album = input_item_GetAlbum( p_item ); 
     131 
     132    if(  !psz_name && !psz_title && !psz_artist && !psz_album ) 
    128133        return VLC_EGENERIC; 
     134    free( psz_name ); 
     135    free( psz_title ); 
    129136 
    130137    /* If we already checked this album in this session, skip */ 
    131     if( input_item_GetArtist( p_item ) && input_item_GetAlbum( p_item )
     138    if( psz_artist && psz_album
    132139    { 
    133140        FOREACH_ARRAY( playlist_album_t album, p_playlist->p_fetcher->albums ) 
    134             if( !strcmp( album.psz_artist, input_item_GetArtist( p_item ) ) && 
    135                 !strcmp( album.psz_album, input_item_GetAlbum( p_item ) ) ) 
     141            if( !strcmp( album.psz_artist, psz_artist ) && 
     142                !strcmp( album.psz_album, psz_album ) ) 
    136143            { 
    137144                msg_Dbg( p_playlist, " %s - %s has already been searched", 
    138                          input_item_GetArtist( p_item ),  input_item_GetAlbum( p_item ) ); 
     145                         psz_artist, psz_album ); 
    139146        /* TODO-fenrir if we cache art filename too, we can go faster */ 
     147                free( psz_artist ); 
     148                free( psz_album ); 
    140149                if( album.b_found ) 
    141150                { 
     
    151160        FOREACH_END(); 
    152161    } 
    153  
     162    free( psz_artist ); 
     163    free( psz_album ); 
     164 
     165    char *psz_arturl = input_item_GetArtURL( p_item ); 
    154166    input_FindArtInCache( p_playlist, p_item ); 
    155     if( !EMPTY_STR(input_item_GetArtURL( p_item )) ) 
     167    if( !EMPTY_STR( psz_arturl ) ) 
     168    { 
     169        free( psz_arturl ); 
    156170        return 0; 
     171    } 
     172    free( psz_arturl ); 
    157173 
    158174    PL_LOCK; 
    159175    p_playlist->p_private = p_item; 
    160     if( input_item_GetAlbum( p_item ) && input_item_GetArtist( p_item ) ) 
     176    psz_album = input_item_GetAlbum( p_item ); 
     177    psz_artist = input_item_GetArtist( p_item ); 
     178    psz_name = input_item_GetName( p_item ); 
     179    psz_title = input_item_GetTitle( p_item ); 
     180    if( psz_album && psz_artist ) 
    161181    { 
    162182        msg_Dbg( p_playlist, "searching art for %s - %s", 
    163              input_item_GetArtist( p_item ),  input_item_GetAlbum( p_item ) ); 
     183             psz_artist, psz_album ); 
    164184    } 
    165185    else 
    166186    { 
    167187        msg_Dbg( p_playlist, "searching art for %s", 
    168              input_item_GetTitle( p_item ) ? input_item_GetTitle( p_item ) : p_item->psz_name ); 
    169     } 
     188             psz_title ? psz_title : psz_name ); 
     189    } 
     190    free( psz_title ); 
     191    free( psz_name ); 
    170192 
    171193    p_module = module_Need( p_playlist, "art finder", 0, VLC_FALSE ); 
     
    177199 
    178200    /* Record this album */ 
    179     if( input_item_GetArtist( p_item ) && input_item_GetAlbum( p_item )
     201    if( psz_artist && psz_album
    180202    { 
    181203        playlist_album_t a; 
    182         a.psz_artist = strdup( input_item_GetArtist( p_item ) )
    183         a.psz_album = strdup( input_item_GetAlbum( p_item ) )
     204        a.psz_artist = psz_artist
     205        a.psz_album = psz_album
    184206        a.b_found = (i_ret == VLC_EGENERIC ? VLC_FALSE : VLC_TRUE ); 
    185207        ARRAY_APPEND( p_playlist->p_fetcher->albums, a ); 
     208    } 
     209    else 
     210    { 
     211        free( psz_artist ); 
     212        free( psz_album ); 
    186213    } 
    187214 
     
    281308static int __input_FindArtInCache( vlc_object_t *p_obj, input_item_t *p_item ) 
    282309{ 
    283     const char *psz_artist; 
    284     const char *psz_album; 
    285     const char *psz_title; 
     310    char *psz_artist; 
     311    char *psz_album; 
     312    char *psz_title; 
    286313    char psz_filename[MAX_PATH+1]; 
    287314    int i; 
     
    294321    psz_album = input_item_GetAlbum( p_item ); 
    295322    psz_title = input_item_GetTitle( p_item ); 
    296     if( !psz_title ) psz_title = p_item->psz_name; 
    297  
    298     if( (!psz_artist || !psz_album) && !psz_title ) return VLC_EGENERIC; 
     323    if( !psz_title ) psz_title = input_item_GetName( p_item ); 
     324 
     325    if( !psz_title && ( !psz_album || !psz_artist ) ) 
     326    { 
     327        free( psz_artist ); 
     328        free( psz_album ); 
     329        free( psz_title ); 
     330        return VLC_EGENERIC; 
     331    } 
     332    free( psz_title ); 
    299333 
    300334    for( i = 0; i < 5; i++ ) 
     
    307341        { 
    308342            input_item_SetArtURL( p_item, psz_filename ); 
     343            free( psz_artist ); 
     344            free( psz_album ); 
    309345            return VLC_SUCCESS; 
    310346        } 
    311347    } 
     348    free( psz_artist ); 
     349    free( psz_album ); 
    312350    return VLC_EGENERIC; 
    313351} 
     
    325363    char *psz_album = NULL; 
    326364    char *psz_title = NULL; 
     365    char *psz_artist_m, *psz_album_m, *psz_title_m, *psz_name_m, *psz_arturl_m; 
    327366    char *psz_type; 
    328     if( input_item_GetArtist( p_item ) ) 
    329         psz_artist = ArtCacheCreateString( input_item_GetArtist( p_item ) ); 
    330     if( input_item_GetAlbum( p_item ) ) 
    331         psz_album = ArtCacheCreateString( input_item_GetAlbum( p_item ) ); 
    332     if( input_item_GetTitle( p_item ) ) 
    333         psz_title = ArtCacheCreateString( input_item_GetTitle( p_item ) ); 
    334     else if( p_item->psz_name ) 
    335         psz_title = ArtCacheCreateString( p_item->psz_name ); 
     367 
     368    psz_artist_m = input_item_GetArtist( p_item ); 
     369    psz_album_m = input_item_GetAlbum( p_item ); 
     370    psz_title_m = input_item_GetTitle( p_item ); 
     371    psz_name_m = input_item_GetName( p_item ); 
     372 
     373    if( psz_artist_m ) psz_artist = ArtCacheCreateString( psz_artist_m ); 
     374    if( psz_album_m ) psz_album = ArtCacheCreateString( psz_album_m ); 
     375    if( psz_title_m ) psz_title = ArtCacheCreateString( psz_title_m ); 
     376    else if( psz_name_m ) psz_title = ArtCacheCreateString( psz_name_m ); 
     377 
     378    free( psz_artist_m ); 
     379    free( psz_album_m ); 
     380    free( psz_title_m ); 
     381    free( psz_name_m ); 
    336382 
    337383    if( !psz_title && (!psz_artist || !psz_album) ) 
     
    343389    } 
    344390 
    345     assert( !EMPTY_STR(input_item_GetArtURL( p_item )) ); 
    346  
    347     psz_type = strrchr( input_item_GetArtURL( p_item ), '.' ); 
     391    psz_arturl_m = input_item_GetArtURL( p_item ); 
     392    assert( !EMPTY_STR( psz_arturl_m ) ); 
     393 
     394    psz_type = strrchr( psz_arturl_m, '.' ); 
    348395 
    349396    /* */ 
     
    359406    free( psz_title ); 
    360407 
    361     if( !strncmp( input_item_GetArtURL( p_item ) , "APIC", 4 ) ) 
     408    if( !strncmp( psz_arturl_m , "APIC", 4 ) ) 
    362409    { 
    363410        msg_Warn( p_playlist, "APIC fetch not supported yet" ); 
     411        free( psz_arturl_m ); 
    364412        return VLC_EGENERIC; 
    365413    } 
    366414 
    367     p_stream = stream_UrlNew( p_playlist, input_item_GetArtURL( p_item ) ); 
     415    p_stream = stream_UrlNew( p_playlist, psz_arturl_m ); 
    368416    if( p_stream ) 
    369417    { 
     
    392440        i_status = VLC_SUCCESS; 
    393441    } 
     442    free( psz_arturl_m ); 
    394443    return i_status; 
    395444} 
     
    403452    char *psz_title = NULL; 
    404453    char *psz_type = NULL; 
     454    char *psz_artist_m, *psz_album_m, *psz_title_m, *psz_name_m; 
    405455    char psz_filename[MAX_PATH+1]; 
    406456    FILE *f; 
     
    412462     * and then set it here to to be faster */ 
    413463 
    414     psz_arturl = strdup( input_item_GetArtURL( p_item ) ); 
     464    psz_arturl = input_item_GetArtURL( p_item ); 
    415465    if( !psz_arturl || strncmp( psz_arturl, "attachment://", strlen("attachment://") ) ) 
    416466    { 
     467        free( psz_arturl ); 
    417468        msg_Err( p_input, "internal input error with input_ExtractAttachmentAndCacheArt" ); 
    418469        return; 
     
    446497    } 
    447498 
    448     if( input_item_GetArtist( p_item ) ) 
    449         psz_artist = ArtCacheCreateString( input_item_GetArtist( p_item ) ); 
    450     if( input_item_GetAlbum( p_item ) ) 
    451         psz_album = ArtCacheCreateString( input_item_GetAlbum( p_item ) ); 
    452     if( input_item_GetTitle( p_item ) ) 
    453         psz_title = ArtCacheCreateString( input_item_GetTitle( p_item ) ); 
    454     else if( p_item->psz_name ) 
    455         psz_title = ArtCacheCreateString( p_item->psz_name ); 
     499    psz_artist_m = input_item_GetArtist( p_item ); 
     500    psz_album_m = input_item_GetAlbum( p_item ); 
     501    psz_title_m = input_item_GetTitle( p_item ); 
     502    psz_name_m = input_item_GetName( p_item ); 
     503 
     504    if( psz_artist_m ) psz_artist = ArtCacheCreateString( psz_artist_m ); 
     505    if( psz_album_m ) psz_album = ArtCacheCreateString( psz_album_m ); 
     506    if( psz_title_m ) psz_title = ArtCacheCreateString( psz_title_m ); 
     507    else if( psz_name_m ) psz_title = ArtCacheCreateString( psz_name_m ); 
     508 
     509    free( psz_artist_m ); 
     510    free( psz_album_m ); 
     511    free( psz_title_m ); 
     512    free( psz_name_m ); 
    456513 
    457514    if( (!psz_artist || !psz_album ) && !psz_title ) 
  • src/playlist/control.c

    r51880eb r662ed77  
    455455        vlc_bool_t b_has_art; 
    456456 
    457         vlc_mutex_lock( &p_input->lock ); 
    458         /* p_input->p_meta should not be null after a successfull CreateThread */ 
    459         b_has_art = !EMPTY_STR( input_item_GetArtURL( p_input ) ); 
    460         vlc_mutex_unlock( &p_input->lock ); 
     457        char *psz_arturl, *psz_name; 
     458        psz_arturl = input_item_GetArtURL( p_input ); 
     459        psz_name = input_item_GetName( p_input ); 
     460 
     461        /* p_input->p_meta should not be null after a successfull CreateThread*/ 
     462        b_has_art = !EMPTY_STR( psz_arturl ); 
    461463 
    462464        if( !b_has_art ) 
    463465        { 
    464             PL_DEBUG( "requesting art for %s", p_input->psz_name ); 
     466            PL_DEBUG( "requesting art for %s", psz_name ); 
    465467            playlist_AskForArtEnqueue( p_playlist, p_input ); 
    466468        } 
     469        free( psz_arturl ); 
     470        free( psz_name ); 
    467471    } 
    468472 
  • src/playlist/engine.c

    r716d5bf r662ed77  
    528528             * \todo don't do this for things we won't get meta for, like vids 
    529529             */ 
     530            char *psz_arturl = input_item_GetArtURL( p_current ); 
     531            char *psz_name = input_item_GetName( p_current ); 
    530532            if( !input_MetaSatisfied( p_playlist, p_current, &i_m, &i_o ) ) 
    531533            { 
     
    543545            /* We already have all needed meta, but we need art right now */ 
    544546            else if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL && 
    545                      EMPTY_STR( input_item_GetArtURL( p_current ) ) ) 
     547                     EMPTY_STR( psz_arturl ) ) 
    546548            { 
    547549                preparse_item_t p; 
    548                 PL_DEBUG("meta ok for %s, need to fetch art", 
    549                                                          p_current->psz_name ); 
     550                PL_DEBUG("meta ok for %s, need to fetch art", psz_name ); 
    550551                p.p_item = p_current; 
    551552                p.b_fetch_art = VLC_TRUE; 
     
    560561            { 
    561562                PL_DEBUG( "no fetch required for %s (art currently %s)", 
    562                           p_current->psz_name, 
    563                           input_item_GetArtURL( p_current )); 
     563                          psz_name, psz_arturl ); 
    564564                vlc_gc_decref( p_current ); 
    565565            } 
     566            free( psz_name ); 
     567            free( psz_arturl ); 
    566568            PL_UNLOCK; 
    567569        } 
  • src/playlist/item.c

    r6dd4b20 r662ed77  
    658658    } 
    659659    /* Preparse if PREPARSE or SPREPARSE & not enough meta */ 
     660    char *psz_artist = input_item_GetArtist( p_item_cat->p_input ); 
     661    char *psz_album = input_item_GetAlbum( p_item_cat->p_input ); 
    660662    if( p_playlist->b_auto_preparse && 
    661663          (i_mode & PLAYLIST_PREPARSE || 
    662664          ( i_mode & PLAYLIST_SPREPARSE && 
    663             ( EMPTY_STR( input_item_GetArtist( p_item_cat->p_input ) ) || 
    664             ( EMPTY_STR( input_item_GetAlbum( p_item_cat->p_input ) ) ) ) 
     665            ( EMPTY_STR( psz_artist ) || ( EMPTY_STR( psz_album ) ) ) 
    665666          ) ) ) 
    666667        playlist_PreparseEnqueue( p_playlist, p_item_cat->p_input ); 
    667668    /* If we already have it, signal it */ 
    668     else if( !EMPTY_STR( input_item_GetArtist( p_item_cat->p_input ) ) && 
    669              !EMPTY_STR( input_item_GetAlbum( p_item_cat->p_input ) ) ) 
     669    else if( !EMPTY_STR( psz_artist ) && !EMPTY_STR( psz_album ) ) 
    670670        input_item_SetPreparsed( p_item_cat->p_input, VLC_TRUE ); 
     671    free( psz_artist ); 
     672    free( psz_album ); 
    671673} 
    672674 
  • src/text/strings.c

    r51880eb r662ed77  
    639639 
    640640#define INSERT_STRING( check, string )                              \ 
    641                     if( check && string )                           \ 
     641                    if( check )                                     \ 
    642642                    {                                               \ 
    643                         int len = strlen( string );                 \ 
    644                         dst = realloc( dst,                         \ 
    645                                        i_size = i_size + len + 1 ); \ 
    646                         strncpy( d, string, len+1 );                \ 
    647                         d += len;                                   \ 
    648                     }                                               \ 
    649                     else                                            \ 
    650                     {                                               \ 
    651                         *d = '-';                                   \ 
    652                         d++;                                        \ 
     643                        psz_meta = string;                          \ 
     644                        if( string )                                \ 
     645                        {                                           \ 
     646                            int len = strlen( psz_meta );           \ 
     647                            dst = realloc( dst,                     \ 
     648                                   i_size = i_size + len + 1 );     \ 
     649                            strncpy( d, psz_meta, len+1 );          \ 
     650                            d += len;                               \ 
     651                            free( psz_meta );                       \ 
     652                        }                                           \ 
     653                        else                                        \ 
     654                        {                                           \ 
     655                                *d = '-';                           \ 
     656                                d++;                                \ 
     657                        }                                           \ 
    653658                    } 
    654659char *__str_format_meta( vlc_object_t *p_object, const char *string ) 
     
    682687            switch( *s ) 
    683688            { 
     689                char *psz_meta; /* used by INSERT_STRING */ 
    684690                case 'a': 
    685691                    INSERT_STRING( p_item, input_item_GetArtist(p_item) ); 
  • src/video_output/video_output.c

    ra9e4de1 r662ed77  
    16431643        i_now = mdate(); 
    16441644        i_stop = i_now + (mtime_t)(p_vout->i_title_timeout * 1000); 
    1645         if( !EMPTY_STR(input_item_GetNowPlaying(input_GetItem(p_input))) ) 
     1645        char *psz_nowplaying =  
     1646            input_item_GetNowPlaying( input_GetItem( p_input ) ); 
     1647        char *psz_artist = input_item_GetArtist( input_GetItem( p_input ) ); 
     1648        char *psz_name = input_item_GetName( input_GetItem( p_input ) ); 
     1649        if( !EMPTY_STR( psz_nowplaying ) ) 
    16461650        { 
    16471651            vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN, 
    1648                                    input_item_GetNowPlaying(input_GetItem(p_input)), NULL, 
     1652                                   psz_nowplaying, NULL, 
    16491653                                   p_vout->i_title_position, 
    16501654                                   30 + p_vout->fmt_in.i_width 
     
    16541658                                   i_now, i_stop ); 
    16551659        } 
    1656         else if( !EMPTY_STR(input_item_GetArtist(input_GetItem(p_input))) ) 
     1660        else if( !EMPTY_STR( psz_artist ) ) 
    16571661        { 
    16581662            char *psz_string = NULL; 
    16591663 
    1660             psz_string = malloc( strlen(input_GetItem(p_input)->psz_name) ) + 
    1661                     strlen( input_item_GetArtist(input_GetItem(p_input)) ); 
     1664            psz_string = malloc( strlen( psz_name ) + strlen( psz_artist ) ); 
    16621665            if( psz_string ) 
    16631666            { 
    1664                 sprintf( psz_string, "%s - %s", 
    1665                          input_GetItem(p_input)->psz_name, 
    1666                          input_item_GetArtist(input_GetItem(p_input)) ); 
     1667                sprintf( psz_string, "%s - %s", psz_name, psz_artist ); 
    16671668 
    16681669                vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN, 
     
    16801681        { 
    16811682            vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN, 
    1682                                    input_GetItem(p_input)->psz_name, NULL, 
     1683                                   psz_name, NULL, 
    16831684                                   p_vout->i_title_position, 
    16841685                                   30 + p_vout->fmt_in.i_width 
     
    16891690        } 
    16901691        vlc_object_release( p_input ); 
    1691     } 
    1692 
     1692        free( psz_artist ); 
     1693        free( psz_name ); 
     1694        free( psz_nowplaying ); 
     1695    } 
     1696