* Protect input item's meta through setters and getters. That allows tracking of...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 15 Aug 2007 04:33:57 +0000 (04:33 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 15 Aug 2007 04:33:57 +0000 (04:33 +0000)
* vlc_meta_t gains a table for accessing its non-extra meta.

45 files changed:
include/vlc_input.h
include/vlc_meta.h
modules/access/cdda/info.c
modules/access/dvdnav.c
modules/access/http.c
modules/codec/vorbis.c
modules/control/dbus.c
modules/demux/flac.c
modules/demux/playlist/asx.c
modules/demux/playlist/b4s.c
modules/demux/playlist/luaplaylist.c
modules/demux/playlist/shoutcast.c
modules/demux/playlist/xspf.c
modules/gui/macosx/playlist.m
modules/gui/macosx/playlistinfo.m
modules/gui/qt4/components/infopanels.cpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/playlist_model.cpp
modules/gui/wxwidgets/dialogs/infopanels.cpp
modules/gui/wxwidgets/dialogs/playlist.cpp
modules/gui/wxwidgets/input_manager.cpp
modules/gui/wxwidgets/playlist_manager.cpp
modules/meta_engine/folder.c
modules/meta_engine/luameta.c
modules/meta_engine/musicbrainz.c
modules/meta_engine/taglib.cpp
modules/misc/audioscrobbler.c
modules/misc/notify/growl.c
modules/misc/notify/msn.c
modules/misc/notify/notify.c
modules/misc/playlist/m3u.c
modules/misc/playlist/xspf.c
modules/mux/mp4.c
modules/visualization/goom.c
src/control/media_descriptor.c
src/input/es_out.c
src/input/input.c
src/input/meta.c
src/playlist/control.c
src/playlist/engine.c
src/playlist/item.c
src/playlist/search.c
src/playlist/sort.c
src/text/strings.c
src/video_output/video_output.c

index 9b56dbe..66e22fd 100644 (file)
@@ -79,8 +79,8 @@ struct input_item_t
     int           i_nb_played;       /**< Number of times played */
 
     vlc_meta_t *p_meta;
-
-    vlc_mutex_t lock;                /**< Lock for the item */
+    
+    vlc_mutex_t lock;                 /**< Lock for the item */
 };
 
 #define ITEM_TYPE_UNKNOWN       0
@@ -185,6 +185,132 @@ static inline void input_ItemClean( input_item_t *p_i )
     vlc_mutex_destroy( &p_i->lock );
 }
 
+static inline void input_item_SetMeta( input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz_val )
+{
+    if( !p_i->p_meta )
+        p_i->p_meta = vlc_meta_New();
+    vlc_meta_Set( p_i->p_meta, meta_type, psz_val );
+}
+
+static inline const char * input_item_GetMeta( input_item_t *p_i, vlc_meta_type_t meta_type )
+{
+    if( !p_i->p_meta )
+        return NULL;
+    return vlc_meta_Get( p_i->p_meta, meta_type );
+}
+
+static inline void input_item_SetPreparsed( input_item_t *p_i, vlc_bool_t preparsed )
+{
+    if( !p_i->p_meta )
+        p_i->p_meta = vlc_meta_New();
+
+    if( preparsed )
+        p_i->p_meta->i_status |= ITEM_PREPARSED;
+    else
+        p_i->p_meta->i_status &= ~ITEM_PREPARSED;
+}
+
+static inline vlc_bool_t input_item_IsPreparsed( input_item_t *p_i )
+{
+    return p_i->p_meta ? p_i->p_meta->i_status & ITEM_PREPARSED : VLC_FALSE ;
+}
+
+static inline void input_item_SetMetaFetched( input_item_t *p_i, vlc_bool_t metafetched )
+{
+    if( !p_i->p_meta )
+        p_i->p_meta = vlc_meta_New();
+
+    if( metafetched )
+        p_i->p_meta->i_status |= ITEM_META_FETCHED;
+    else
+        p_i->p_meta->i_status &= ~ITEM_META_FETCHED;
+}
+
+static inline vlc_bool_t input_item_IsMetaFetched( input_item_t *p_i )
+{
+    return p_i->p_meta ? p_i->p_meta->i_status & ITEM_META_FETCHED : VLC_FALSE ;
+}
+
+
+static inline void input_item_SetArtNotFound( input_item_t *p_i, vlc_bool_t notfound )
+{
+    if( !p_i->p_meta )
+        p_i->p_meta = vlc_meta_New();
+
+    if( notfound )
+        p_i->p_meta->i_status |= ITEM_ART_NOTFOUND;
+    else
+        p_i->p_meta->i_status &= ~ITEM_ART_NOTFOUND;
+}
+
+static inline void input_item_SetArtFetched( input_item_t *p_i, vlc_bool_t artfetched )
+{
+    if( !p_i->p_meta )
+        p_i->p_meta = vlc_meta_New();
+
+    if( artfetched )
+        p_i->p_meta->i_status |= ITEM_ART_FETCHED;
+    else
+        p_i->p_meta->i_status &= ~ITEM_ART_FETCHED;
+}
+
+static inline vlc_bool_t input_item_IsArtFetched( input_item_t *p_i )
+{
+    return p_i->p_meta ? p_i->p_meta->i_status & ITEM_ART_FETCHED : VLC_FALSE ;
+}
+
+static inline const vlc_meta_t * input_item_GetMetaObject( input_item_t *p_i )
+{
+    if( !p_i->p_meta )
+        p_i->p_meta = vlc_meta_New();
+
+    return p_i->p_meta;
+}
+
+static inline void input_item_MetaMerge( input_item_t *p_i, const vlc_meta_t * p_new_meta )
+{
+    if( !p_i->p_meta )
+        p_i->p_meta = vlc_meta_New();
+
+    vlc_meta_Merge( p_i->p_meta, p_new_meta );
+}
+
+#define input_item_SetTitle( item, b )       input_item_SetMeta( item, vlc_meta_Title, b )
+#define input_item_SetArtist( item, b )      input_item_SetMeta( item, vlc_meta_Artist, b )
+#define input_item_SetGenre( item, b )       input_item_SetMeta( item, vlc_meta_Genre, b )
+#define input_item_SetCopyright( item, b )   input_item_SetMeta( item, vlc_meta_Copyright, b )
+#define input_item_SetAlbum( item, b )       input_item_SetMeta( item, vlc_meta_Album, b )
+#define input_item_SetTrackNum( item, b )    input_item_SetMeta( item, vlc_meta_TrackNumber, b )
+#define input_item_SetDescription( item, b ) input_item_SetMeta( item, vlc_meta_Description, b )
+#define input_item_SetRating( item, b )      input_item_SetMeta( item, vlc_meta_Rating, b )
+#define input_item_SetDate( item, b )        input_item_SetMeta( item, vlc_meta_Date, b )
+#define input_item_SetSetting( item, b )     input_item_SetMeta( item, vlc_meta_Setting, b )
+#define input_item_SetURL( item, b )         input_item_SetMeta( item, vlc_meta_URL, b )
+#define input_item_SetLanguage( item, b )    input_item_SetMeta( item, vlc_meta_Language, b )
+#define input_item_SetNowPlaying( item, b )  input_item_SetMeta( item, vlc_meta_NowPlaying, b )
+#define input_item_SetPublisher( item, b )   input_item_SetMeta( item, vlc_meta_Publisher, b )
+#define input_item_SetEncodedBy( item, b )   input_item_SetMeta( item, vlc_meta_EncodedBy, b )
+#define input_item_SetArtURL( item, b )      input_item_SetMeta( item, vlc_meta_ArtworkURL, b )
+#define input_item_SetTrackID( item, b )     input_item_SetMeta( item, vlc_meta_TrackID, b )
+
+#define input_item_GetTitle( item )          input_item_GetMeta( item, vlc_meta_Title )
+#define input_item_GetArtist( item )         input_item_GetMeta( item, vlc_meta_Artist )
+#define input_item_GetGenre( item )          input_item_GetMeta( item, vlc_meta_Genre )
+#define input_item_GetCopyright( item )      input_item_GetMeta( item, vlc_meta_Copyright )
+#define input_item_GetAlbum( item )          input_item_GetMeta( item, vlc_meta_Album )
+#define input_item_GetTrackNum( item )       input_item_GetMeta( item, vlc_meta_TrackNumber )
+#define input_item_GetDescription( item )    input_item_GetMeta( item, vlc_meta_Description )
+#define input_item_GetRating( item )         input_item_GetMeta( item, vlc_meta_Rating )
+#define input_item_GetDate( item )           input_item_GetMeta( item, vlc_meta_Date )
+#define input_item_GetGetting( item )        input_item_GetMeta( item, vlc_meta_Getting )
+#define input_item_GetURL( item )            input_item_GetMeta( item, vlc_meta_URL )
+#define input_item_GetLanguage( item )       input_item_GetMeta( item, vlc_meta_Language )
+#define input_item_GetNowPlaying( item )     input_item_GetMeta( item, vlc_meta_NowPlaying )
+#define input_item_GetPublisher( item )      input_item_GetMeta( item, vlc_meta_Publisher )
+#define input_item_GetEncodedBy( item )      input_item_GetMeta( item, vlc_meta_EncodedBy )
+#define input_item_GetArtURL( item )         input_item_GetMeta( item, vlc_meta_ArtworkURL )
+#define input_item_GetTrackID( item )        input_item_GetMeta( item, vlc_meta_TrackID )
+
 VLC_EXPORT( char *, input_ItemGetInfo, ( input_item_t *p_i, const char *psz_cat,const char *psz_name ) );
 VLC_EXPORT(int, input_ItemAddInfo, ( input_item_t *p_i, const char *psz_cat, const char *psz_name, const char *psz_format, ... ) );
 
index 36d514b..0c2ecef 100644 (file)
 
 #include <vlc_arrays.h>
 
-/* VLC meta name */
-#define VLC_META_INFO_CAT           N_("Meta-information")
-#define VLC_META_TITLE              N_("Title")
-#define VLC_META_ARTIST             N_("Artist")
-#define VLC_META_GENRE              N_("Genre")
-#define VLC_META_COPYRIGHT          N_("Copyright")
-#define VLC_META_COLLECTION         N_("Album/movie/show title")
-#define VLC_META_SEQ_NUM            N_("Track number/position in set")
-#define VLC_META_DESCRIPTION        N_("Description")
-#define VLC_META_RATING             N_("Rating")
-#define VLC_META_DATE               N_("Date")
-#define VLC_META_SETTING            N_("Setting")
-#define VLC_META_URL                N_("URL")
-#define VLC_META_LANGUAGE           N_("Language")
-#define VLC_META_NOW_PLAYING        N_("Now Playing")
-#define VLC_META_PUBLISHER          N_("Publisher")
-#define VLC_META_ENCODED_BY         N_("Encoded by")
-
-#define VLC_META_ART_URL            N_("Art URL")
+#define VLC_META_TYPE_COUNT 17
 
-#define VLC_META_CODEC_NAME         N_("Codec Name")
-#define VLC_META_CODEC_DESCRIPTION  N_("Codec Description")
+typedef enum vlc_meta_type_t
+{
+    vlc_meta_Title = 0,
+    vlc_meta_Artist,
+    vlc_meta_Genre,
+    vlc_meta_Copyright,
+    vlc_meta_Album,
+    vlc_meta_TrackNumber,
+    vlc_meta_Description,
+    vlc_meta_Rating,
+    vlc_meta_Date,
+    vlc_meta_Setting,
+    vlc_meta_URL,
+    vlc_meta_Language,
+    vlc_meta_NowPlaying,
+    vlc_meta_Publisher,
+    vlc_meta_EncodedBy,
+    vlc_meta_ArtworkURL,
+    vlc_meta_TrackID
+} vlc_meta_type_t;
+
+/* Returns a localizes string describing the meta */
+VLC_EXPORT(const char *, input_MetaTypeToLocalizedString, ( vlc_meta_type_t meta_type ) );
 
 #define ITEM_PREPARSED      0x01
 #define ITEM_META_FETCHED   0x02
 
 struct vlc_meta_t
 {
-    char *psz_title;
-    char *psz_artist;
-    char *psz_genre;
-    char *psz_copyright;
-    char *psz_album;
-    char *psz_tracknum;
-    char *psz_description;
-    char *psz_rating;
-    char *psz_date;
-    char *psz_setting;
-    char *psz_url;
-    char *psz_language;
-    char *psz_nowplaying;
-    char *psz_publisher;
-    char *psz_encodedby;
-    char *psz_arturl;
-    char *psz_trackid;
+    char * ppsz_meta[VLC_META_TYPE_COUNT];
 
     vlc_dictionary_t extra_tags;
 
@@ -85,51 +72,43 @@ struct vlc_meta_t
 
 };
 
-#define vlc_meta_Set( meta,var,val ) do { \
-    const char *str = val; \
-    if( meta->psz_##var ) free( meta->psz_##var ); \
-    meta->psz_##var = str ? strdup( str ) : NULL; } while(0)
-
-#define vlc_meta_SetTitle( meta, b ) vlc_meta_Set( meta, title, b )
-#define vlc_meta_SetArtist( meta, b ) vlc_meta_Set( meta, artist, b )
-#define vlc_meta_SetGenre( meta, b ) vlc_meta_Set( meta, genre, b )
-#define vlc_meta_SetCopyright( meta, b ) vlc_meta_Set( meta, copyright, b )
-#define vlc_meta_SetAlbum( meta, b ) vlc_meta_Set( meta, album, b )
-#define vlc_meta_SetTracknum( meta, b ) vlc_meta_Set( meta, tracknum, b )
-#define vlc_meta_SetDescription( meta, b ) vlc_meta_Set( meta, description, b )
-#define vlc_meta_SetRating( meta, b ) vlc_meta_Set( meta, rating, b )
-#define vlc_meta_SetDate( meta, b ) vlc_meta_Set( meta, date, b )
-#define vlc_meta_SetSetting( meta, b ) vlc_meta_Set( meta, setting, b )
-#define vlc_meta_SetURL( meta, b ) vlc_meta_Set( meta, url, b )
-#define vlc_meta_SetLanguage( meta, b ) vlc_meta_Set( meta, language, b )
-#define vlc_meta_SetNowPlaying( meta, b ) vlc_meta_Set( meta, nowplaying, b )
-#define vlc_meta_SetPublisher( meta, b ) vlc_meta_Set( meta, publisher, b )
-#define vlc_meta_SetEncodedBy( meta, b ) vlc_meta_Set( meta, encodedby, b )
-#define vlc_meta_SetArtURL( meta, b ) vlc_meta_Set( meta, arturl, b )
-#define vlc_meta_SetTrackID( meta, b ) vlc_meta_Set( meta, trackid, b )
+/* Setters for meta.
+ * Warning: Make sure to use the input_item meta setters (defined in vlc_input.h) 
+ * instead of those one. */
+#define vlc_meta_SetTitle( meta, b )       vlc_meta_Set( meta, vlc_meta_Title, b )
+#define vlc_meta_SetArtist( meta, b )      vlc_meta_Set( meta, vlc_meta_Artist, b )
+#define vlc_meta_SetGenre( meta, b )       vlc_meta_Set( meta, vlc_meta_Genre, b )
+#define vlc_meta_SetCopyright( meta, b )   vlc_meta_Set( meta, vlc_meta_Copyright, b )
+#define vlc_meta_SetAlbum( meta, b )       vlc_meta_Set( meta, vlc_meta_Album, b )
+#define vlc_meta_SetTracknum( meta, b )    vlc_meta_Set( meta, vlc_meta_TrackNumber, b )
+#define vlc_meta_SetDescription( meta, b ) vlc_meta_Set( meta, vlc_meta_Description, b )
+#define vlc_meta_SetRating( meta, b )      vlc_meta_Set( meta, vlc_meta_Rating, b )
+#define vlc_meta_SetDate( meta, b )        vlc_meta_Set( meta, vlc_meta_Date, b )
+#define vlc_meta_SetSetting( meta, b )     vlc_meta_Set( meta, vlc_meta_Setting, b )
+#define vlc_meta_SetURL( meta, b )         vlc_meta_Set( meta, vlc_meta_URL, b )
+#define vlc_meta_SetLanguage( meta, b )    vlc_meta_Set( meta, vlc_meta_Language, b )
+#define vlc_meta_SetNowPlaying( meta, b )  vlc_meta_Set( meta, vlc_meta_NowPlaying, b )
+#define vlc_meta_SetPublisher( meta, b )   vlc_meta_Set( meta, vlc_meta_Publisher, b )
+#define vlc_meta_SetEncodedBy( meta, b )   vlc_meta_Set( meta, vlc_meta_EncodedBy, b )
+#define vlc_meta_SetArtURL( meta, b )      vlc_meta_Set( meta, vlc_meta_ArtworkURL, b )
+#define vlc_meta_SetTrackID( meta, b )     vlc_meta_Set( meta, vlc_meta_TrackID, b )
+
+static inline void vlc_meta_Set( vlc_meta_t * p_meta, vlc_meta_type_t meta_type, const char * psz_val )
+{
+    if( p_meta->ppsz_meta[meta_type] ) free( p_meta->ppsz_meta[meta_type] );
+    p_meta->ppsz_meta[meta_type] = psz_val ? strdup( psz_val ) : NULL;
+}
+
+static inline const char * vlc_meta_Get( const vlc_meta_t * p_meta, vlc_meta_type_t meta_type )
+{
+    return p_meta->ppsz_meta[meta_type];
+}
 
 static inline vlc_meta_t *vlc_meta_New( void )
 {
     vlc_meta_t *m = (vlc_meta_t*)malloc( sizeof( vlc_meta_t ) );
     if( !m ) return NULL;
-    m->psz_title = NULL;
-    m->psz_artist = NULL;
-    m->psz_genre = NULL;
-    m->psz_copyright = NULL;
-    m->psz_album = NULL;
-    m->psz_tracknum = NULL;
-    m->psz_description = NULL;
-    m->psz_rating = NULL;
-    m->psz_date = NULL;
-    m->psz_setting = NULL;
-    m->psz_url = NULL;
-    m->psz_language = NULL;
-    m->psz_nowplaying = NULL;
-    m->psz_publisher = NULL;
-    m->psz_encodedby = NULL;
-    m->psz_arturl = NULL;
-    m->psz_trackid = NULL;
-
+    memset( m->ppsz_meta, 0, sizeof(m->ppsz_meta) );
     m->i_status = 0;
     vlc_dictionary_init( &m->extra_tags, 0 );
     return m;
@@ -137,26 +116,13 @@ static inline vlc_meta_t *vlc_meta_New( void )
 
 static inline void vlc_meta_Delete( vlc_meta_t *m )
 {
-    free( m->psz_title );
-    free( m->psz_artist );
-    free( m->psz_genre );
-    free( m->psz_copyright );
-    free( m->psz_album );
-    free( m->psz_tracknum );
-    free( m->psz_description );
-    free( m->psz_rating );
-    free( m->psz_date );
-    free( m->psz_setting );
-    free( m->psz_url );
-    free( m->psz_language );
-    free( m->psz_nowplaying );
-    free( m->psz_publisher );
-    free( m->psz_encodedby );
-    free( m->psz_trackid );
-    free( m->psz_arturl );
+    int i;
+    for( i = 0; i < 0; i++ )
+        free( m->ppsz_meta[i] );
     vlc_dictionary_clear( &m->extra_tags );
     free( m );
 }
+
 static inline void vlc_meta_AddExtra( vlc_meta_t *m, const char *psz_name, const char *psz_value )
 {
     char * psz_oldvalue = (char *)vlc_dictionary_value_for_key( &m->extra_tags, psz_name );
@@ -170,32 +136,20 @@ static inline void vlc_meta_AddExtra( vlc_meta_t *m, const char *psz_name, const
 
 static inline void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
 {
-    if( !dst || !src ) return;
-#define COPY_FIELD( a ) \
-    if( src->psz_ ## a ) { \
-        if( dst->psz_ ## a ) free( dst->psz_## a ); \
-        dst->psz_##a = strdup( src->psz_##a ); \
-    }
-    COPY_FIELD( title );
-    COPY_FIELD( artist );
-    COPY_FIELD( genre );
-    COPY_FIELD( copyright );
-    COPY_FIELD( album );
-    COPY_FIELD( tracknum );
-    COPY_FIELD( description );
-    COPY_FIELD( rating );
-    COPY_FIELD( date );
-    COPY_FIELD( setting );
-    COPY_FIELD( url );
-    COPY_FIELD( language );
-    COPY_FIELD( nowplaying );
-    COPY_FIELD( publisher );
-    COPY_FIELD( encodedby );
-    COPY_FIELD( trackid );
-    COPY_FIELD( arturl );
-#undef COPY_FIELD
     char ** ppsz_all_keys;
     int i;
+
+    if( !dst || !src ) return;
+
+    for( i = 0; i < VLC_META_TYPE_COUNT; i++ )
+    {
+        if( src->ppsz_meta[i] )
+        {
+            if( dst->ppsz_meta[i] ) free( dst->ppsz_meta[i] );
+            dst->ppsz_meta[i] = strdup( src->ppsz_meta[i] );
+        }
+    }
+
     /* XXX: If speed up are needed, it is possible */
     ppsz_all_keys = vlc_dictionary_all_keys( &src->extra_tags );
     for( i = 0; ppsz_all_keys[i]; i++ )
@@ -209,6 +163,27 @@ static inline void vlc_meta_Merge( vlc_meta_t *dst, const vlc_meta_t *src )
     free( ppsz_all_keys );
 }
 
+/* Shortcuts for the AddInfo */
+#define VLC_META_INFO_CAT           N_("Meta-information")
+#define VLC_META_TITLE              input_MetaTypeToLocalizedString( vlc_meta_Title )
+#define VLC_META_ARTIST             input_MetaTypeToLocalizedString( vlc_meta_Artist )
+#define VLC_META_GENRE              input_MetaTypeToLocalizedString( vlc_meta_Genre )
+#define VLC_META_COPYRIGHT          input_MetaTypeToLocalizedString( vlc_meta_Copyright )
+#define VLC_META_COLLECTION         input_MetaTypeToLocalizedString( vlc_meta_Album )
+#define VLC_META_SEQ_NUM            input_MetaTypeToLocalizedString( vlc_meta_TrackNumber )
+#define VLC_META_DESCRIPTION        input_MetaTypeToLocalizedString( vlc_meta_Description )
+#define VLC_META_RATING             input_MetaTypeToLocalizedString( vlc_meta_Rating )
+#define VLC_META_DATE               input_MetaTypeToLocalizedString( vlc_meta_Date )
+#define VLC_META_SETTING            input_MetaTypeToLocalizedString( vlc_meta_Setting )
+#define VLC_META_URL                input_MetaTypeToLocalizedString( vlc_meta_URL )
+#define VLC_META_LANGUAGE           input_MetaTypeToLocalizedString( vlc_meta_Language )
+#define VLC_META_NOW_PLAYING        input_MetaTypeToLocalizedString( vlc_meta_NowPlaying )
+#define VLC_META_PUBLISHER          input_MetaTypeToLocalizedString( vlc_meta_Publisher )
+#define VLC_META_ENCODED_BY         input_MetaTypeToLocalizedString( vlc_meta_EncodedBy )
+#define VLC_META_ART_URL            input_MetaTypeToLocalizedString( vlc_meta_ArtworkURL )
+#define VLC_META_CODEC_NAME         N_("Codec Name")
+#define VLC_META_CODEC_DESCRIPTION  N_("Codec Description")
+
 enum {
     ALBUM_ART_WHEN_ASKED,
     ALBUM_ART_WHEN_PLAYED,
index b136dd6..a3bc177 100644 (file)
@@ -156,11 +156,12 @@ cddb_end: ;
 }
 #endif /*HAVE_LIBCDDB*/
 
-#define add_meta_val(VLC_META, VAL)                                    \
-  if ( p_cdda->p_meta && VAL) {                                         \
-    /*vlc_meta_Add( p_cdda->p_meta, VLC_META, VAL );*/                      \
-    dbg_print( INPUT_DBG_META, "field %s: %s\n", VLC_META, VAL );       \
-  }                                                                     \
+#define add_meta_val(VLC_META, VAL)                           \
+  if ( p_cdda->p_meta && VAL) {                               \
+    /*vlc_meta_Add( p_cdda->p_meta, VLC_META, VAL );*/        \
+    dbg_print( INPUT_DBG_META, "field %s: %s\n",              \
+            input_MetaTypeToLocalizedString(VLC_META), VAL ); \
+  }                                                           \
 
 #define add_cddb_meta(FIELD, VLC_META)                                 \
   add_meta_val(VLC_META, cddb_disc_get_##FIELD(p_cdda->cddb.disc));
@@ -289,9 +290,9 @@ CDDAMetaInfo( access_t *p_access, track_t i_track )
            psz_meta_artist = (char *)cddb_disc_get_artist(p_cdda->cddb.disc);
            if ( cddb_disc_get_genre(p_cdda->cddb.disc) && 
                     strlen(cddb_disc_get_genre(p_cdda->cddb.disc)) )
-               add_cddb_meta(genre, VLC_META_GENRE);
+               add_cddb_meta(genre, vlc_meta_Genre);
            if ( 0 != cddb_disc_get_year(p_cdda->cddb.disc))
-               add_cddb_meta_fmt(year, "%d", VLC_META_DATE );
+               add_cddb_meta_fmt(year, "%d", vlc_meta_Date );
        }
        else
        {
@@ -300,11 +301,11 @@ CDDAMetaInfo( access_t *p_access, track_t i_track )
          {
              if( cddb_track_get_title(t) != NULL && ! p_cdda->b_nav_mode )
              {
-                 add_meta_val( VLC_META_TITLE, cddb_track_get_title(t) );
+            add_meta_val( vlc_meta_Title, cddb_track_get_title(t) );
              }
              if( cddb_track_get_artist(t) != NULL )
              {
-               add_meta_val( VLC_META_ARTIST, cddb_track_get_artist(t) );
+            add_meta_val( vlc_meta_Artist, cddb_track_get_artist(t) );
              }
          }
        }
@@ -454,14 +455,14 @@ CDDAMetaInfo( access_t *p_access, track_t i_track )
        {
            char *psz_name = CDDAFormatTitle( p_access, i_track ) ;
            if ( !p_cdda->b_nav_mode ) {
-               add_meta_val( VLC_META_TITLE, psz_name );
+               add_meta_val( vlc_meta_Title, psz_name );
            } else 
            { 
                input_Control( p_cdda->p_input, INPUT_SET_NAME, psz_name );
                free(psz_name);
            }
            if (psz_meta_artist) 
-             add_meta_val( VLC_META_ARTIST, psz_meta_artist );
+             add_meta_val( vlc_meta_Artist, psz_meta_artist );
        }
        
     }
index f5bed60..a89c57e 100644 (file)
@@ -548,7 +548,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             if( (NULL != title_name) && ('\0' != title_name[0]) )
             {
                 vlc_meta_t *p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
-                vlc_meta_SetTitle( p_meta, title_name );
+                vlc_meta_Set( p_meta, vlc_meta_Title, title_name );
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
index 6ef0dcf..51eae55 100644 (file)
@@ -740,11 +740,11 @@ static int Control( access_t *p_access, int i_query, va_list args )
             p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
 
             if( p_sys->psz_icy_name )
-                vlc_meta_SetTitle( p_meta, p_sys->psz_icy_name );
+                vlc_meta_Set( p_meta, vlc_meta_Title, p_sys->psz_icy_name );
             if( p_sys->psz_icy_genre )
-                vlc_meta_SetGenre( p_meta, p_sys->psz_icy_genre );
+                vlc_meta_Set( p_meta, vlc_meta_Genre, p_sys->psz_icy_genre );
             if( p_sys->psz_icy_title )
-                vlc_meta_SetNowPlaying( p_meta, p_sys->psz_icy_title );
+                vlc_meta_Set( p_meta, vlc_meta_NowPlaying, p_sys->psz_icy_title );
             break;
 
         case ACCESS_GET_TITLE_INFO:
index 7ca1511..c41d27a 100644 (file)
@@ -639,8 +639,7 @@ static void ParseVorbisComments( decoder_t *p_dec )
             {
                 if( psz_value && ( *psz_value != '\0' ) )
                 {
-                    vlc_meta_SetArtist( p_item->p_meta,
-                                        psz_value );
+                    input_item_SetArtist( p_item, psz_value );
                     input_ItemAddInfo( p_item,
                                         _(VLC_META_INFO_CAT),
                                         _(VLC_META_ARTIST),
@@ -651,8 +650,7 @@ static void ParseVorbisComments( decoder_t *p_dec )
             {
                 if( psz_value && ( *psz_value != '\0' ) )
                 {
-                    vlc_meta_SetTitle( p_item->p_meta,
-                                    psz_value );
+                    input_item_SetTitle( p_item, psz_value );
                     p_item->psz_name = strdup( psz_value );
                 }
             }
@@ -660,16 +658,14 @@ static void ParseVorbisComments( decoder_t *p_dec )
             {
                 if( psz_value && ( *psz_value != '\0' ) )
                 {
-                    vlc_meta_SetAlbum( p_item->p_meta,
-                                    psz_value );
+                    input_item_SetAlbum( p_item, psz_value );
                 }
             }
             else if( !strcasecmp( psz_name, "musicbrainz_trackid" ) )
             {
                 if( psz_value && ( *psz_value != '\0' ) )
                 {
-                    vlc_meta_SetTrackID( p_item->p_meta,
-                                    psz_value );
+                    input_item_SetTrackID( p_item, psz_value );
                 }
             }
             else if( !strcasecmp( psz_name, "REPLAYGAIN_TRACK_GAIN" ) ||
@@ -708,16 +704,14 @@ static void ParseVorbisComments( decoder_t *p_dec )
             {
                 if( psz_value && ( *psz_value != '\0' ) )
                 {
-                    vlc_meta_SetArtistID( p_item->p_meta,
-                                    psz_value );
+                    vlc_meta_SetArtistID( p_item, psz_value );
                 }
             }
             else if( !strcasecmp( psz_name, "musicbrainz_albumid" ) )
             {
                 if( psz_value && ( *psz_value != '\0' ) )
                 {
-                    vlc_meta_SetAlbumID( p_item->p_meta,
-                                    psz_value );
+                    input_item_SetAlbumID( p_item, psz_value );
                 }
             }
 #endif
index d6ed766..02dc369 100644 (file)
@@ -866,7 +866,7 @@ static int TrackChange( vlc_object_t *p_this, const char *psz_var,
 
 #define ADD_VLC_META_STRING( entry, item ) \
         ADD_META( entry, DBUS_TYPE_STRING, \
-                p_input->p_meta->psz_##item );
+                input_item_Get##item( p_input );
 
 static int GetInputMeta( input_item_t* p_input,
                         DBusMessageIter *args )
@@ -889,23 +889,23 @@ static int GetInputMeta( input_item_t* p_input,
 
     dbus_message_iter_open_container( args, DBUS_TYPE_ARRAY, "{sv}", &dict );
 
-    ADD_VLC_META_STRING( 0, title );
-    ADD_VLC_META_STRING( 1, artist );
-    ADD_VLC_META_STRING( 2, genre );
-    ADD_VLC_META_STRING( 3, copyright );
-    ADD_VLC_META_STRING( 4, album );
-    ADD_VLC_META_STRING( 5, tracknum );
-    ADD_VLC_META_STRING( 6, description );
-    ADD_VLC_META_STRING( 7, rating );
-    ADD_VLC_META_STRING( 8, date );
-    ADD_VLC_META_STRING( 9, setting );
-    ADD_VLC_META_STRING( 10, url );
-    ADD_VLC_META_STRING( 11, language );
-    ADD_VLC_META_STRING( 12, nowplaying );
-    ADD_VLC_META_STRING( 13, publisher );
-    ADD_VLC_META_STRING( 14, encodedby );
-    ADD_VLC_META_STRING( 15, arturl );
-    ADD_VLC_META_STRING( 16, trackid ); 
+    ADD_VLC_META_STRING( 0,  Title );
+    ADD_VLC_META_STRING( 1,  Artist );
+    ADD_VLC_META_STRING( 2,  Genre );
+    ADD_VLC_META_STRING( 3,  Copyright );
+    ADD_VLC_META_STRING( 4,  Album );
+    ADD_VLC_META_STRING( 5,  TrackNum );
+    ADD_VLC_META_STRING( 6,  Description );
+    ADD_VLC_META_STRING( 7,  Rating );
+    ADD_VLC_META_STRING( 8,  Date );
+    ADD_VLC_META_STRING( 9,  Setting );
+    ADD_VLC_META_STRING( 10, URL );
+    ADD_VLC_META_STRING( 11, Language );
+    ADD_VLC_META_STRING( 12, NowPlaying );
+    ADD_VLC_META_STRING( 13, Publisher );
+    ADD_VLC_META_STRING( 14, EncodedBy );
+    ADD_VLC_META_STRING( 15, ArtURL );
+    ADD_VLC_META_STRING( 16, TrackID ); 
 
     ADD_META( 17, DBUS_TYPE_INT32, p_input->p_meta->i_status );
     ADD_META( 18, DBUS_TYPE_STRING, p_input->psz_uri );
index d9dd781..831b126 100644 (file)
@@ -179,7 +179,7 @@ static int Open( vlc_object_t * p_this )
             p_sys->p_meta = vlc_meta_New();
         snprintf( psz_url, sizeof(psz_url), "attachment://%s",
                   p_sys->attachment[p_sys->i_cover_idx]->psz_name );
-        vlc_meta_SetArtURL( p_sys->p_meta, psz_url );
+        vlc_meta_Set( p_sys->p_meta, vlc_meta_ArtworkURL, psz_url );
     }
     vlc_audio_replay_gain_MergeFromMeta( &p_sys->replay_gain, p_sys->p_meta );
     return VLC_SUCCESS;
@@ -566,25 +566,6 @@ static void ParseSeekTable( demux_t *p_demux, const uint8_t *p_data, int i_data,
     /* TODO sort it by size and remove wrong seek entry (time not increasing) */
 }
 
-static inline void astrcat( char **ppsz_dst, const char *psz_src )
-{
-    char *psz_old = *ppsz_dst;
-
-    if( !psz_src || !psz_src[0] )
-        return;
-
-    if( psz_old )
-    {
-        if( asprintf( ppsz_dst, "%s,%s", psz_old, psz_src ) == -1 )
-            *ppsz_dst = NULL;
-        free( psz_old );
-    }
-    else
-    {
-        *ppsz_dst = strdup( psz_src );
-    }
-}
-
 #define RM(x) do { i_data -= (x); p_data += (x); } while(0)
 static void ParseComment( demux_t *p_demux, const uint8_t *p_data, int i_data )
 {
@@ -636,15 +617,28 @@ static void ParseComment( demux_t *p_demux, const uint8_t *p_data, int i_data )
 
         EnsureUTF8( psz );
 
-#define IF_EXTRACT(txt,var) if( !strncasecmp(psz, txt, strlen(txt)) ) { astrcat( &p_sys->p_meta->var, &psz[strlen(txt)] ); }
-        IF_EXTRACT("TITLE=", psz_title )
-        else IF_EXTRACT("ALBUM=", psz_album )
-        else IF_EXTRACT("TRACKNUMBER=", psz_tracknum )
-        else IF_EXTRACT("ARTIST=", psz_artist )
-        else IF_EXTRACT("COPYRIGHT=", psz_copyright )
-        else IF_EXTRACT("DESCRIPTION=", psz_description )
-        else IF_EXTRACT("GENRE=", psz_genre )
-        else IF_EXTRACT("DATE=", psz_date )
+#define IF_EXTRACT(txt,var) \
+    if( !strncasecmp(psz, txt, strlen(txt)) ) \
+    { \
+        const char * oldval = vlc_meta_Get( p_sys->p_meta, vlc_meta_ ## var ); \
+        if( oldval ) \
+        { \
+            char * newval; \
+            asprintf( &newval, "%s,%s", oldval, &psz[strlen(txt)] ); \
+            vlc_meta_Set( p_sys->p_meta, vlc_meta_ ## var, newval ); \
+            free( newval ); \
+        } \
+        else \
+            vlc_meta_Set( p_sys->p_meta, vlc_meta_ ## var, &psz[strlen(txt)] ); \
+    }
+        IF_EXTRACT("TITLE=", Title )
+        else IF_EXTRACT("ALBUM=", Album )
+        else IF_EXTRACT("TRACKNUMBER=", TrackNumber )
+        else IF_EXTRACT("ARTIST=", Artist )
+        else IF_EXTRACT("COPYRIGHT=", Copyright )
+        else IF_EXTRACT("DESCRIPTION=", Description )
+        else IF_EXTRACT("GENRE=", Genre )
+        else IF_EXTRACT("DATE=", Date )
         else if( strchr( psz, '=' ) )
         {
             /* generic (PERFORMER/LICENSE/ORGANIZATION/LOCATION/CONTACT/ISRC,
index 313351f..3749ba0 100644 (file)
@@ -529,12 +529,11 @@ static int Demux( demux_t *p_demux )
                         FREENULL(psz_name);
                     }
 
-                    p_entry->p_meta = vlc_meta_New();
-                    if( psz_title_entry ) vlc_meta_SetTitle( p_entry->p_meta, psz_title_entry );
-                    if( psz_artist_entry ) vlc_meta_SetArtist( p_entry->p_meta, psz_artist_entry );
-                    if( psz_copyright_entry ) vlc_meta_SetCopyright( p_entry->p_meta, psz_copyright_entry );
-                    if( psz_moreinfo_entry ) vlc_meta_SetURL( p_entry->p_meta, psz_moreinfo_entry );
-                    if( psz_abstract_entry ) vlc_meta_SetDescription( p_entry->p_meta, psz_abstract_entry );
+                    if( psz_title_entry ) input_item_SetTitle( p_entry, psz_title_entry );
+                    if( psz_artist_entry ) input_item_SetArtist( p_entry, psz_artist_entry );
+                    if( psz_copyright_entry ) input_item_SetCopyright( p_entry, psz_copyright_entry );
+                    if( psz_moreinfo_entry ) input_item_SetURL( p_entry, psz_moreinfo_entry );
+                    if( psz_abstract_entry ) input_item_SetDescription( p_entry, psz_abstract_entry );
                     playlist_BothAddInput( p_playlist, p_entry,
                                          p_item_in_category,
                                          PLAYLIST_APPEND | PLAYLIST_SPREPARSE
@@ -677,12 +676,11 @@ static int Demux( demux_t *p_demux )
             else if( !strncasecmp( psz_parse, "</ASX", 5 ) )
             {
                 vlc_mutex_lock( &p_current->p_input->lock );
-                if( !p_current->p_input->p_meta ) p_current->p_input->p_meta = vlc_meta_New();
-                if( psz_title_asx ) vlc_meta_SetTitle( p_current->p_input->p_meta, psz_title_asx );
-                if( psz_artist_asx ) vlc_meta_SetArtist( p_current->p_input->p_meta, psz_artist_asx );
-                if( psz_copyright_asx ) vlc_meta_SetCopyright( p_current->p_input->p_meta, psz_copyright_asx );
-                if( psz_moreinfo_asx ) vlc_meta_SetURL( p_current->p_input->p_meta, psz_moreinfo_asx );
-                if( psz_abstract_asx ) vlc_meta_SetDescription( p_current->p_input->p_meta, psz_abstract_asx );
+                if( psz_title_asx ) input_item_SetTitle( p_current->p_input, psz_title_asx );
+                if( psz_artist_asx ) input_item_SetArtist( p_current->p_input, psz_artist_asx );
+                if( psz_copyright_asx ) input_item_SetCopyright( p_current->p_input, psz_copyright_asx );
+                if( psz_moreinfo_asx ) input_item_SetURL( p_current->p_input, psz_moreinfo_asx );
+                if( psz_abstract_asx ) input_item_SetDescription( p_current->p_input, psz_abstract_asx );
                 vlc_mutex_unlock( &p_current->p_input->lock );
                 FREENULL( psz_base_asx );
                 FREENULL( psz_title_asx );
index 99a9129..6a916a0 100644 (file)
@@ -257,11 +257,10 @@ static int Demux( demux_t *p_demux )
                 {
                     p_input = input_ItemNewExt( p_playlist, psz_mrl, psz_name,
                                                 0, NULL, -1 );
-                    p_input->p_meta = vlc_meta_New();
                     if( psz_now )
-                        vlc_meta_SetNowPlaying( p_input->p_meta, psz_now );
+                        input_item_SetNowPlaying( p_input, psz_now );
                     if( psz_genre )
-                        vlc_meta_SetGenre( p_input->p_meta, psz_genre );
+                        input_item_SetGenre( p_input, psz_genre );
                     if( psz_listeners )
                         msg_Err( p_playlist, "Unsupported meta listeners" );
                     if( psz_bitrate )
index c537f43..13705b7 100644 (file)
@@ -467,7 +467,7 @@ static inline void read_meta_data( demux_t *p_demux,
     {                                                       \
         psz_value = lua_tostring( p_state, t );             \
         msg_Dbg( p_demux, #b ": %s", psz_value );           \
-        vlc_meta_Set ## b ( p_input->p_meta, psz_value );   \
+        input_item_Set ## b ( p_input, psz_value );   \
     }                                                       \
     lua_pop( p_state, 1 ); /* pop a */
     TRY_META( "title", Title );
@@ -475,7 +475,7 @@ static inline void read_meta_data( demux_t *p_demux,
     TRY_META( "genre", Genre );
     TRY_META( "copyright", Copyright );
     TRY_META( "album", Album );
-    TRY_META( "tracknum", Tracknum );
+    TRY_META( "tracknum", TrackNum );
     TRY_META( "description", Description );
     TRY_META( "rating", Rating );
     TRY_META( "date", Date );
@@ -636,7 +636,6 @@ static int Demux( demux_t *p_demux )
                         lua_pop( p_state, 1 ); /* pop "name" */
 
                         /* Read meta data */
-                        p_input->p_meta = vlc_meta_New();
                         read_meta_data( p_demux, p_state, t+2, t+4, p_input );
 
                         /* Read custom meta data */
index 1b3e1de..64103f8 100644 (file)
@@ -423,13 +423,12 @@ static int DemuxStation( demux_t *p_demux )
                     SADD_INFO( "Bitrate", psz_br );
                     SADD_INFO( "Listeners", psz_lc );
                     SADD_INFO( "Load", psz_load );
-                    p_input->p_meta = vlc_meta_New();
                     if( psz_genre )
-                        vlc_meta_SetGenre( p_input->p_meta, psz_genre );
+                        input_item_SetGenre( p_input, psz_genre );
                     if( psz_ct )
-                        vlc_meta_SetNowPlaying( p_input->p_meta, psz_ct );
+                        input_item_SetNowPlaying( p_input, psz_ct );
                     if( psz_rt )
-                        vlc_meta_SetRating( p_input->p_meta, psz_rt );
+                        input_item_SetRating( p_input, psz_rt );
 
                     playlist_BothAddInput( p_sys->p_playlist, p_input,
                                            p_sys->p_item_in_category,
index 724f410..6d243b7 100644 (file)
@@ -548,7 +548,6 @@ static vlc_bool_t parse_track_node COMPLEX_INTERFACE
                         }
                         p_new_input = input_ItemNewExt( p_playlist, psz_uri,
                                                         NULL, 0, NULL, -1 );
-                        p_new_input->p_meta = vlc_meta_New();
                         free( psz_uri );
                         input_ItemCopyOptions( p_item->p_input, p_new_input );
                         psz_uri = NULL;
@@ -620,16 +619,16 @@ static vlc_bool_t set_item_info SIMPLE_INTERFACE
     }
     else if( !strcmp( psz_name, "creator" ) )
     {
-        vlc_meta_SetArtist( p_input->p_meta, psz_value );
+        input_item_SetArtist( p_input, psz_value );
     }
     else if( !strcmp( psz_name, "album" ) )
     {
-        vlc_meta_SetAlbum( p_input->p_meta, psz_value );
+        input_item_SetAlbum( p_input, psz_value );
 
     }
     else if( !strcmp( psz_name, "trackNum" ) )
     {
-        vlc_meta_SetTracknum( p_input->p_meta, psz_value );
+        input_item_SetTrackNum( p_input, psz_value );
     }
     else if( !strcmp( psz_name, "duration" ) )
     {
@@ -638,7 +637,7 @@ static vlc_bool_t set_item_info SIMPLE_INTERFACE
     }
     else if( !strcmp( psz_name, "annotation" ) )
     {
-        vlc_meta_SetDescription( p_input->p_meta, psz_value );
+        input_item_SetDescription( p_input, psz_value );
     }
     return VLC_TRUE;
 }
index 8a05d7d..cadeb91 100644 (file)
     if( [[o_tc identifier] isEqualToString:@"1"] )
     {
         /* sanity check to prevent the NSString class from crashing */
-        if( p_item->p_input->p_meta && p_item->p_input->p_meta->psz_title && 
-            *p_item->p_input->p_meta->psz_title )
+        if( !EMPTY_STR( input_item_GetTitle( p_item->p_input ) ) )
         {
-            o_value = [NSString stringWithUTF8String:
-                p_item->p_input->p_meta->psz_title];
+            o_value = [NSString stringWithUTF8String: input_item_GetTitle( p_item->p_input )];
             if( o_value == NULL )
-                o_value = [NSString stringWithCString:
-                    p_item->p_input->p_meta->psz_title];
+                o_value = [NSString stringWithCString: input_item_GetTitle( p_item->p_input )];
         } 
         else if( p_item->p_input->psz_name != NULL )
         {
-            o_value = [NSString stringWithUTF8String:
-                p_item->p_input->psz_name];
+            o_value = [NSString stringWithUTF8String: p_item->p_input->psz_name];
             if( o_value == NULL )
-                o_value = [NSString stringWithCString:
-                    p_item->p_input->psz_name];
+                o_value = [NSString stringWithCString: p_item->p_input->psz_name];
         }
     }
-    else if( [[o_tc identifier] isEqualToString:@"2"] && p_item->p_input->p_meta &&
-        p_item->p_input->p_meta->psz_artist && *p_item->p_input->p_meta->psz_artist )
+    else if( [[o_tc identifier] isEqualToString:@"2"] && !EMPTY_STR( input_item_GetArtist( p_item->p_input ) ) )
     {
-        o_value = [NSString stringWithUTF8String:
-            p_item->p_input->p_meta->psz_artist];
+        o_value = [NSString stringWithUTF8String: input_item_GetArtist( p_item->p_input )];
         if( o_value == NULL )
-            o_value = [NSString stringWithCString:
-                p_item->p_input->p_meta->psz_artist];
+            o_value = [NSString stringWithCString: input_item_GetArtist( p_item->p_input )];
     }
     else if( [[o_tc identifier] isEqualToString:@"3"] )
     {
index 34482ad..6c927be 100644 (file)
     }
 
     /* fill the other fields */
-#define p_m p_item->p_input->p_meta
-    [self setMeta: p_m->psz_title forLabel: o_title_txt];
-    [self setMeta: p_m->psz_artist forLabel: o_author_txt];
-    [self setMeta: p_m->psz_album forLabel: o_collection_txt];
-    [self setMeta: p_m->psz_tracknum forLabel: o_seqNum_txt];
-    [self setMeta: p_m->psz_genre forLabel: o_genre_txt];
-    [self setMeta: p_m->psz_copyright forLabel: o_copyright_txt];
-    [self setMeta: p_m->psz_rating forLabel: o_rating_txt];
-    [self setMeta: p_m->psz_publisher forLabel: o_publisher_txt];
-    [self setMeta: p_m->psz_nowplaying forLabel: o_nowPlaying_txt];
-    [self setMeta: p_m->psz_language forLabel: o_language_txt];
-    [self setMeta: p_m->psz_date forLabel: o_date_txt];
-#undef p_m
+    [self setMeta: input_item_GetTitle( p_item->p_input )      forLabel: o_title_txt];
+    [self setMeta: input_item_GetArtist( p_item->p_input )     forLabel: o_author_txt];
+    [self setMeta: input_item_GetAlbum( p_item->p_input )      forLabel: o_collection_txt];
+    [self setMeta: input_item_GetTrackNum( p_item->p_input )   forLabel: o_seqNum_txt];
+    [self setMeta: input_item_GetGenre( p_item->p_input )      forLabel: o_genre_txt];
+    [self setMeta: input_item_GetCopyright( p_item->p_input )  forLabel: o_copyright_txt];
+    [self setMeta: input_item_GetRating( p_item->p_input )     forLabel: o_rating_txt];
+    [self setMeta: input_item_GetPublisher( p_item->p_input )  forLabel: o_publisher_txt];
+    [self setMeta: input_item_GetNowPlaying( p_item->p_input ) forLabel: o_nowPlaying_txt];
+    [self setMeta: input_item_GetLanguage( p_item->p_input )   forLabel: o_language_txt];
+    [self setMeta: input_item_GetDate( p_item->p_input )       forLabel: o_date_txt];
+
     vlc_mutex_unlock( &p_item->p_input->lock );
 
     /* reload the advanced table */
 
         p_item->p_input->psz_uri = strdup( [[o_uri_txt stringValue] UTF8String] );
         p_item->p_input->psz_name = strdup( [[o_title_txt stringValue] UTF8String] );
-        vlc_meta_SetArtist( p_item->p_input->p_meta, [[o_author_txt stringValue] UTF8String] );
+        input_item_SetArtist( p_item->p_input, [[o_author_txt stringValue] UTF8String] );
         vlc_mutex_unlock( &p_item->p_input->lock );
 
         val.b_bool = VLC_TRUE;
index f0284da..97ff37a 100644 (file)
@@ -136,6 +136,7 @@ MetaPanel::~MetaPanel(){}
 void MetaPanel::saveMeta()
 {
     playlist_t *p_playlist;
+    char * psz;
 
     meta_export_t p_export;
     p_export.p_item = p_input;
@@ -158,20 +159,19 @@ void MetaPanel::saveMeta()
         return;
 
     /* now we read the modified meta data */
-    free( p_input->p_meta->psz_artist );
-    p_input->p_meta->psz_artist = strdup( qtu( artist_text->text() ) );
-    free( p_input->p_meta->psz_album );
-    p_input->p_meta->psz_album = strdup( qtu( collection_text->text() ) );
-    free( p_input->p_meta->psz_genre );
-    p_input->p_meta->psz_genre = strdup( qtu( genre_text->text() ) );
-    free( p_input->p_meta->psz_date );
-    p_input->p_meta->psz_date = (char*) malloc(5);
-    snprintf( p_input->p_meta->psz_date, 5, "%d", date_text->value() );
-    free( p_input->p_meta->psz_tracknum );
-    p_input->p_meta->psz_tracknum = (char*) malloc(5);
-    snprintf( p_input->p_meta->psz_tracknum, 5, "%d", seqnum_text->value() );
-    free( p_input->p_meta->psz_title );
-    p_input->p_meta->psz_title = strdup( qtu( title_text->text() ) );
+    input_item_SetArtist( p_input, qtu( artist_text->text() ) );
+    input_item_SetAlbum(  p_input, qtu( collection_text->text() ) );
+    input_item_SetGenre(  p_input, qtu( genre_text->text() ) );
+    
+    asnprintf( &psz, 5, "%d", date_text->value() );
+    input_item_SetDate(  p_input, psz );
+    free( psz );
+
+    asnprintf( &psz, 5, "%d", seqnum_text->value() );
+    input_item_SetTrackNum(  p_input, psz );
+    free( psz );
+
+    input_item_SetTitle(  p_input, qtu( title_text->text() ) );
 
     p_playlist = pl_Yield( p_intf );
 
@@ -190,23 +190,21 @@ void MetaPanel::saveMeta()
  **/
 void MetaPanel::update( input_item_t *p_item )
 {
-    if( !p_item->p_meta )
-        return;
     char *psz_meta; 
 #define UPDATE_META( meta, widget ) {               \
-    psz_meta = p_item->p_meta->psz_##meta;          \
+    psz_meta = input_item_Get##meta( p_item );      \
     if( !EMPTY_STR( psz_meta ) )                    \
         widget->setText( qfu( psz_meta ) );         \
     else                                            \
         widget->setText( "" ); }
 
 #define UPDATE_META_INT( meta, widget ) {           \
-    psz_meta = p_item->p_meta->psz_##meta;          \
+    psz_meta = input_item_Get##meta( p_item );      \
     if( !EMPTY_STR( psz_meta ) )                    \
         widget->setValue( atoi( psz_meta ) ); }
 
     /* Name / Title */
-    psz_meta = p_item->p_meta->psz_title;
+    psz_meta = input_item_GetTitle( p_item );
     if( !EMPTY_STR( psz_meta ) )
         title_text->setText( qfu( psz_meta ) );
     else if( !EMPTY_STR( p_item->psz_name ) )
@@ -214,31 +212,32 @@ void MetaPanel::update( input_item_t *p_item )
     else title_text->setText( "" );
 
     /* URL / URI */
-    psz_meta = p_item->p_meta->psz_url;
+    psz_meta = input_item_GetURL( p_item );
     if( !EMPTY_STR( psz_meta ) )
         emit uriSet( QString( psz_meta ) );
     else if( !EMPTY_STR( p_item->psz_uri ) )
         emit uriSet( QString( p_item->psz_uri ) );
 
     /* Other classic though */
-    UPDATE_META( artist, artist_text );
-    UPDATE_META( genre, genre_text );
-    UPDATE_META( copyright, copyright_text );
-    UPDATE_META( album, collection_text );
-    UPDATE_META( description, description_text );
-    UPDATE_META( language, language_text );
-    UPDATE_META( nowplaying, nowplaying_text );
-    UPDATE_META( publisher, publisher_text );
-    UPDATE_META( setting, setting_text );
-
-    UPDATE_META_INT( date, date_text );
-    UPDATE_META_INT( tracknum, seqnum_text );
-    UPDATE_META_INT( rating, rating_text );
-
+    UPDATE_META( Artist, artist_text );
+    UPDATE_META( Genre, genre_text );
+    UPDATE_META( Copyright, copyright_text );
+    UPDATE_META( Album, collection_text );
+    UPDATE_META( Description, description_text );
+    UPDATE_META( Language, language_text );
+    UPDATE_META( NowPlaying, nowplaying_text );
+    UPDATE_META( Publisher, publisher_text );
+    UPDATE_META( Setting, setting_text );
+
+    UPDATE_META_INT( Date, date_text );
+    UPDATE_META_INT( Tracknum, seqnum_text );
+    UPDATE_META_INT( Rating, rating_text );
+
+#undef UPDATE_META_INT
 #undef UPDATE_META
 
     /* Art Urls */
-    psz_meta = p_item->p_meta->psz_arturl;
+    psz_meta = input_item_GetArtURL( p_item );
     if( psz_meta && !strncmp( psz_meta, "file://", 7 ) )
     {
         QString artUrl = qfu( psz_meta ).replace( "file://",QString("" ) );
index 0f171e1..3a5b0ce 100644 (file)
@@ -132,20 +132,16 @@ void InputManager::update()
 
     /* Update text */
     QString text;
-    if( input_GetItem(p_input)->p_meta &&
-        input_GetItem(p_input)->p_meta->psz_nowplaying &&
-        *input_GetItem(p_input)->p_meta->psz_nowplaying )
+    if( !EMPTY_STR(input_item_GetNowPlaying( input_GetItem(p_input) )) )
     {
         text.sprintf( "%s - %s",
-                  input_GetItem(p_input)->p_meta->psz_nowplaying,
+                  input_item_GetNowPlaying( input_GetItem(p_input) ),
                   input_GetItem(p_input)->psz_name );
     }
-    else if( input_GetItem(p_input)->p_meta &&
-             input_GetItem(p_input)->p_meta->psz_artist &&
-             *input_GetItem(p_input)->p_meta->psz_artist )
+    else if( !EMPTY_STR(input_item_GetNowPlaying( input_GetArtist(p_input) )) )
     {
         text.sprintf( "%s - %s",
-                  input_GetItem(p_input)->p_meta->psz_artist,
+                  input_item_GetNowPlaying( input_GetArtist(p_input) ),
                   input_GetItem(p_input)->psz_name );
     }
     else
index 9af6251..01d097d 100644 (file)
@@ -184,10 +184,9 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
     type = p_item->p_input->i_type;
     current = iscurrent;
 
-    if( current && p_item->p_input->p_meta &&
-        p_item->p_input->p_meta->psz_arturl &&
-        !strncmp( p_item->p_input->p_meta->psz_arturl, "file://", 7 ) )
-        model->sendArt( qfu( p_item->p_input->p_meta->psz_arturl ) );
+    if( current && input_item_GetArtURL( p_item ) &&
+        !strncmp( input_item_GetArtURL( p_item ), "file://", 7 ) )
+        model->sendArt( qfu( input_item_GetArtURL( p_item ) ) );
     else if( current )
         model->removeArt();
 
@@ -200,11 +199,8 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
     }
 
 
-#define ADD_META( meta ) {             \
-   if( p_item->p_input->p_meta )       \
-      strings.append( qfu( meta ) );   \
-   else                                \
-      strings.append( qtr( "" ) ); }
+#define ADD_META( item, meta ) {             \
+      strings.append( qfu( input_item_Get ## meta ( item->p_input ) ) );   \
 
     for( int i_index=1; i_index <= VLC_META_ENGINE_MB_TRM_ID; i_index = i_index * 2 )
     {
@@ -213,34 +209,34 @@ void PLItem::update( playlist_item_t *p_item, bool iscurrent )
             switch( i_index )
             {
                 case VLC_META_ENGINE_ARTIST:
-                    ADD_META( p_item->p_input->p_meta->psz_artist );
+                    ADD_META( p_item, Artist );
                     break;
                 case VLC_META_ENGINE_TITLE:
-                    if( p_item->p_input->p_meta && p_item->p_input->p_meta->psz_title )
+                    if( input_item_GetTitle( p_item->p_input ) )
                     {
-                        ADD_META( p_item->p_input->p_meta->psz_title );
+                        ADD_META( p_item, Title );
                     } else {
                         strings.append( qfu( p_item->p_input->psz_name ) );
                     }
                     break;
                 case VLC_META_ENGINE_DESCRIPTION:
-                    ADD_META( p_item->p_input->p_meta->psz_description );
+                    ADD_META( p_item, Description );
                     break;
                 case VLC_META_ENGINE_DURATION:
                     secstotimestr( psz_duration, p_item->p_input->i_duration / 1000000 );
                     strings.append( QString( psz_duration ) );
                     break;
                 case VLC_META_ENGINE_GENRE:
-                    ADD_META( p_item->p_input->p_meta->psz_genre );
+                    ADD_META( p_item, Genre );
                     break;
                 case VLC_META_ENGINE_COLLECTION:
-                    ADD_META( p_item->p_input->p_meta->psz_album );
+                    ADD_META( p_item, Album );
                     break;
                 case VLC_META_ENGINE_SEQ_NUM:
-                    ADD_META( p_item->p_input->p_meta->psz_tracknum);
+                    ADD_META( p_item, TrackNum );
                     break;
                 case VLC_META_ENGINE_RATING:
-                    ADD_META( p_item->p_input->p_meta->psz_rating );
+                    ADD_META( p_item, Rating );
                 default:
                     break;
             }
index 4797640..20d6f6c 100644 (file)
@@ -121,7 +121,7 @@ void MetaDataPanel::Update( input_item_t *p_item )
     name_text->SetValue( wxU( p_item->psz_name ) );
 
 #define UPDATE_META( meta, widget ) {                                       \
-    char *psz_meta = p_item->p_meta->psz_##meta;                            \
+    const char *psz_meta = input_item_Get##meta( p_item );                  \
     if( psz_meta != NULL && *psz_meta)                                      \
     {                                                                       \
         widget->SetLabel( wxU( psz_meta ) );                                \
@@ -129,18 +129,18 @@ void MetaDataPanel::Update( input_item_t *p_item )
     else { widget->SetLabel( wxU( "-" ) ); }                                \
     }
 
-    UPDATE_META( artist, artist_text );
-    UPDATE_META( genre, genre_text );
-    UPDATE_META( copyright, copyright_text );
-    UPDATE_META( album, collection_text );
-    UPDATE_META( tracknum, seqnum_text );
-    UPDATE_META( description, description_text );
-    UPDATE_META( rating, rating_text );
-    UPDATE_META( date, date_text );
-    UPDATE_META( language, language_text );
-    UPDATE_META( nowplaying, nowplaying_text );
-    UPDATE_META( publisher, publisher_text );
-    UPDATE_META( setting, setting_text );
+    UPDATE_META( Artist, artist_text );
+    UPDATE_META( Genre, genre_text );
+    UPDATE_META( Copyright, copyright_text );
+    UPDATE_META( Album, collection_text );
+    UPDATE_META( TrackNum, seqnum_text );
+    UPDATE_META( Description, description_text );
+    UPDATE_META( Rating, rating_text );
+    UPDATE_META( Date, date_text );
+    UPDATE_META( Language, language_text );
+    UPDATE_META( NowPlaying, nowplaying_text );
+    UPDATE_META( Publisher, publisher_text );
+    UPDATE_META( Setting, setting_text );
 
 #undef UPDATE_META
 }
index 337a686..4f91dc6 100644 (file)
@@ -513,14 +513,9 @@ void Playlist::UpdateTreeItem( wxTreeItemId item )
     wxString duration = wxU( "" );
 
     char *psz_artist;
-    if( p_item->p_input->p_meta )
-    {
-        psz_artist= p_item->p_input->p_meta->psz_artist ?
-                        strdup( p_item->p_input->p_meta->psz_artist ) :
-                        strdup("");
-    }
-    else
-        psz_artist = strdup( "" );
+    psz_artist = input_item_GetArtist( p_item->p_input ) ?
+                    strdup( input_item_GetArtist( p_item->p_input ) ) :
+                    strdup("");
 
     char psz_duration[MSTRTIME_MAX_SIZE];
     mtime_t dur = p_item->p_input->i_duration;
index 7787d2e..80e6191 100644 (file)
@@ -210,7 +210,8 @@ void InputManager::UpdateInput()
 
 void InputManager::UpdateNowPlaying()
 {
-    char *psz_now_playing = input_GetItem(p_input)->p_meta->psz_nowplaying ?
+    const char *psz_now_playing = 
+        input_item_GetNowPlaying( input_GetItem(p_input) ) ?
                     strdup( input_GetItem(p_input)->p_meta->psz_nowplaying ):
                     strdup( "" );
     if( psz_now_playing && *psz_now_playing )
index bf091b1..d9ba453 100644 (file)
@@ -300,10 +300,9 @@ void PlaylistManager::UpdateTreeItem( wxTreeItemId item )
     wxString duration = wxU( "" );
 
     char *psz_artist;
-    if( p_item->p_input->p_meta &&
-        p_item->p_input->p_meta->psz_artist )
+    if( input_item_GetArtist( o_item->p_input ) )
     {
-        psz_artist = strdup( p_item->p_input->p_meta->psz_artist );
+        psz_artist = strdup( input_item_GetArtist( o_item->p_input ) );
     }
     else psz_artist = strdup( "" );
 
index 287d547..c6ed4b5 100644 (file)
@@ -73,7 +73,6 @@ static int FindMeta( vlc_object_t *p_this )
     char *psz_dir = strdup( p_item->psz_uri );
     char *psz_buf = strrchr( psz_dir, '/' );
 
-    if( !p_item->p_meta ) return VLC_EGENERIC;
     if( psz_buf )
     {
         psz_buf++;
@@ -113,7 +112,7 @@ static int FindMeta( vlc_object_t *p_this )
 
         if( utf8_stat( psz_filename+7, &a ) != -1 )
         {
-            vlc_meta_SetArtURL( p_item->p_meta, psz_filename );
+            input_item_SetArtURL( p_item, psz_filename );
             b_have_art = VLC_TRUE;
         }
     }
index 98a1ba9..9b531c7 100644 (file)
@@ -230,13 +230,13 @@ static lua_State * vlclua_meta_init( vlc_object_t *p_this, input_item_t * p_item
     lua_pushstring( p_state, p_item->psz_name );
     lua_setfield( p_state, lua_gettop( p_state ) - 1, "name" );
     
-    lua_pushstring( p_state, p_item->p_meta->psz_title );
+    lua_pushstring( p_state, input_item_GetTitle( p_item ) );
     lua_setfield( p_state, lua_gettop( p_state ) - 1, "title" );
     
-    lua_pushstring( p_state, p_item->p_meta->psz_album );
+    lua_pushstring( p_state, input_item_GetAlbum( p_item ) );
     lua_setfield( p_state, lua_gettop( p_state ) - 1, "album" );
 
-    lua_pushstring( p_state, p_item->p_meta->psz_arturl );
+    lua_pushstring( p_state, input_item_GetArtURL( p_item ) );
     lua_setfield( p_state, lua_gettop( p_state ) - 1, "arturl" );
     /* XXX: all should be passed */
 
@@ -347,7 +347,7 @@ static inline void read_meta_data( vlc_object_t *p_this,
     {                                                       \
         psz_value = lua_tostring( p_state, t );             \
         msg_Dbg( p_this, #b ": %s", psz_value );           \
-        vlc_meta_Set ## b ( p_input->p_meta, psz_value );   \
+        input_item_Set ## b ( p_input, psz_value );   \
     }                                                       \
     lua_pop( p_state, 1 ); /* pop a */
     TRY_META( "title", Title );
@@ -355,7 +355,7 @@ static inline void read_meta_data( vlc_object_t *p_this,
     TRY_META( "genre", Genre );
     TRY_META( "copyright", Copyright );
     TRY_META( "album", Album );
-    TRY_META( "tracknum", Tracknum );
+    TRY_META( "tracknum", TrackNum );
     TRY_META( "description", Description );
     TRY_META( "rating", Rating );
     TRY_META( "date", Date );
@@ -482,7 +482,7 @@ static int fetch_art( vlc_object_t *p_this, const char * psz_filename,
             if( psz_value && *psz_value != 0 )
             {
                 msg_Dbg( p_this, "setting arturl: %s", psz_value );
-                vlc_meta_SetArtURL ( p_input->p_meta, psz_value );
+                input_item_SetArtURL ( p_input, psz_value );
                 i_ret = VLC_SUCCESS;
             }
         }
index b33186c..6a6c150 100644 (file)
@@ -81,9 +81,8 @@ static int GetData( vlc_object_t *p_obj, input_item_t *p_item,
     char *psz_artist;
     char *psz_album;
 
-    if( !p_item->p_meta ) return VLC_EGENERIC;
-    psz_artist = p_item->p_meta->psz_artist;
-    psz_album = p_item->p_meta->psz_album;
+    psz_artist = input_item_GetArtist( p_item );
+    psz_album = input_item_GetAlbum( p_item );
     psz_title = p_item->psz_name;
 
     if( !psz_artist || !psz_album )
@@ -143,7 +142,7 @@ static int GetData( vlc_object_t *p_obj, input_item_t *p_item,
             snprintf( psz_data, 255,
                     "http://images.amazon.com/images/P/%s.01._SCLZZZZZZZ_.jpg",
                     psz_buf );
-            vlc_meta_SetArtURL( p_item->p_meta, psz_data );
+            input_item_SetArtURL( p_item, psz_data );
             break;
         }
     }
@@ -155,7 +154,7 @@ static int GetData( vlc_object_t *p_obj, input_item_t *p_item,
     if( !b_art )
         return VLC_SUCCESS;
     else
-        return p_item->p_meta->psz_arturl && *p_item->p_meta->psz_arturl ?
+        return EMPTY_STR( input_item_GetArtURL( p_item ) ) ?
                VLC_SUCCESS : VLC_EGENERIC;
 }
 
@@ -168,7 +167,7 @@ static int FindMetaMBId( vlc_object_t *p_this )
 
     if( !i_ret )
     {
-        uint32_t i_meta = input_CurrentMetaFlags( p_item->p_meta );
+        uint32_t i_meta = input_CurrentMetaFlags( input_item_GetMetaObject( p_item ) );
         p_me->i_mandatory &= ~i_meta;
         p_me->i_optional &= ~i_meta;
         return p_me->i_mandatory ? VLC_EGENERIC : VLC_SUCCESS;
index 2c575d2..4364ce4 100644 (file)
@@ -193,22 +193,22 @@ static int WriteMeta( vlc_object_t *p_this )
 
         TagLib::Tag *tag = f.tag();
 
-        SET( Artist, p_item->p_meta->psz_artist );
+        SET( Artist, input_item_GetArtist( p_item ) );
 
-        char *psz_titlec = ( p_item->p_meta->psz_title ?
-            p_item->p_meta->psz_title : p_item->psz_name );
+        const char *psz_titlec = ( input_item_GetTitle( p_item ) ?
+            input_item_GetTitle( p_item ) : p_item->psz_name );
         TagLib::String *psz_title = new TagLib::String( psz_titlec,
             TagLib::String::UTF8 );
         tag->setTitle( *psz_title );
         delete psz_title;
 
-        SET( Album, p_item->p_meta->psz_album );
-        SET( Genre, p_item->p_meta->psz_genre );
+        SET( Album, input_item_GetAlbum( p_item ) );
+        SET( Genre, input_item_GetGenre( p_item ) );
 
-        if( p_item->p_meta->psz_date )
-            tag->setYear( atoi( p_item->p_meta->psz_date ) );
-        if( p_item->p_meta->psz_tracknum )
-            tag->setTrack( atoi( p_item->p_meta->psz_tracknum ) );
+        if( input_item_GetDate( p_item ) )
+            tag->setYear( atoi( input_item_GetDate( p_item ) ) );
+        if( input_item_GetTrackNum( p_item ) )
+            tag->setTrack( atoi( input_item_GetTrackNum( p_item ) ) );
 
         f.save();
         return VLC_SUCCESS;
index 154ee6f..7a9b3c6 100644 (file)
@@ -1039,10 +1039,10 @@ static int ReadMetaData( intf_thread_t *p_this )
         }
 
     #define ALLOC_ITEM_META( a, b ) \
-        if ( input_GetItem(p_input)->b ) \
+        if ( input_item_Get##b( input_GetItem(p_input) ) ) \
         { \
             a = encode_URI_component( \
-                input_GetItem(p_input)->b ); \
+                input_item_Get##b( input_GetItem(p_input) )); \
             if( !a ) \
             { \
                 FREE_INPUT_AND_CHARS \
@@ -1058,25 +1058,33 @@ static int ReadMetaData( intf_thread_t *p_this )
 
     if( i_status & ( !b_waiting ? ITEM_PREPARSED : ITEM_META_FETCHED ) )
     {
-        ALLOC_ITEM_META( psz_artist, p_meta->psz_artist )
+        ALLOC_ITEM_META( psz_artist, Artist )
         else
         {
             msg_Dbg( p_this, "No artist.." );
             WAIT_METADATA_FETCHING( psz_artist )
         }
 
-        ALLOC_ITEM_META( psz_title, psz_name )
+        if( input_GetItem(p_input)->psz_name )
+        {
+            psz_title = encode_URI_component( input_GetItem(p_input)->psz_name );
+            if( !psz_title )
+            {
+                FREE_INPUT_AND_CHARS
+                return VLC_ENOMEM;
+            }
+        }
         else
         {
             msg_Dbg( p_this, "No track name.." );
             WAIT_METADATA_FETCHING( psz_title );
         }
 
-        ALLOC_ITEM_META( psz_album, p_meta->psz_album )
+        ALLOC_ITEM_META( psz_album, Album )
         else
             psz_album = calloc( 1, 1 );
 
-        ALLOC_ITEM_META( psz_trackid, p_meta->psz_trackid )
+        ALLOC_ITEM_META( psz_trackid, TrackID )
         else
             psz_trackid = calloc( 1, 1 );
 
index 6e29eca..a4629c4 100644 (file)
@@ -132,12 +132,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     }
 
     /* Playing something ... */
-    psz_artist = input_GetItem(p_input)->p_meta->psz_artist ?
-                  strdup( input_GetItem(p_input)->p_meta->psz_artist ) :
-                  strdup( "" );
-    psz_album = input_GetItem(p_input)->p_meta->psz_album ?
-                  strdup( input_GetItem(p_input)->p_meta->psz_album ) :
+    psz_artist = input_item_GetArtist( input_GetItem(p_input) ) ?
+                  strdup( input_item_GetArtist( input_GetItem(p_input) ) ) :
                   strdup( "" );
+    psz_album = input_item_GetAlbum( input_GetItem(p_input) ) ?
+                  strdup( input_item_GetAlbum( input_GetItem(p_input) ) ) :
+                  strdup("" );
     psz_title = strdup( input_GetItem(p_input)->psz_name );
     if( psz_title == NULL ) psz_title = strdup( N_("(no title)") );
     snprintf( psz_tmp, GROWL_MAX_LENGTH, "%s %s %s",
index ce17397..a95d167 100644 (file)
@@ -154,12 +154,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     }
 
     /* Playing something ... */
-    psz_artist = input_GetItem(p_input)->p_meta->psz_artist ?
-                  strdup( input_GetItem(p_input)->p_meta->psz_artist ) :
-                  strdup( "" );
-    psz_album = input_GetItem(p_input)->p_meta->psz_album ?
-                  strdup( input_GetItem(p_input)->p_meta->psz_album ) :
+    psz_artist = input_item_GetArtist( input_GetItem(p_input) ) ?
+                  strdup( input_item_GetArtist( input_GetItem(p_input) ) ) :
                   strdup( "" );
+    psz_album = input_item_GetAlbum( input_GetItem(p_input) ) ?
+                  strdup( input_item_GetAlbum( input_GetItem(p_input) ) ) :
+                  strdup("" );
     psz_title = strdup( input_GetItem(p_input)->psz_name );
     if( psz_title == NULL ) psz_title = strdup( N_("(no title)") );
 
index 76485e5..ff1d09e 100644 (file)
@@ -150,11 +150,11 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
     }
 
     /* Playing something ... */
-    psz_artist = input_GetItem(p_input)->p_meta->psz_artist ?
-                  strdup( input_GetItem(p_input)->p_meta->psz_artist ) :
+    psz_artist = input_item_GetArtist( input_GetItem(p_input) ) ?
+                  strdup( input_item_GetArtist( input_GetItem(p_input) ) ) :
                   strdup( _("no artist") );
-    psz_album = input_GetItem(p_input)->p_meta->psz_album ?
-                  strdup( input_GetItem(p_input)->p_meta->psz_album ) :
+    psz_album = input_item_GetAlbum( input_GetItem(p_input) ) ?
+                  strdup( input_item_GetAlbum( input_GetItem(p_input) ) ) :
                   strdup( _("no album") );
     psz_title = strdup( input_GetItem(p_input)->psz_name );
 
index 2eb4e34..eb7071a 100644 (file)
@@ -69,8 +69,8 @@ static void DoChildren( playlist_t *p_playlist, playlist_export_t *p_export,
              strcmp( p_current->p_input->psz_uri,
                      p_current->p_input->psz_name ) )
         {
-            char *psz_artist = p_current->p_input->p_meta->psz_artist ?
-                               strdup( p_current->p_input->p_meta->psz_artist ):
+            char *psz_artist = input_item_GetArtist( p_current->p_input ) ?
+                               strdup( input_item_GetArtist( p_current->p_input ) ):
                                strdup( "" );
             if( psz_artist && *psz_artist )
             {
index 0e2e0c7..1c8a201 100644 (file)
@@ -163,8 +163,8 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_file,
     }
 
     /* -> the artist/creator */
-    psz = p_item->p_input->p_meta->psz_artist ?
-                        strdup( p_item->p_input->p_meta->psz_artist ):
+    psz = input_item_GetArtist( p_item->p_input ) ?
+                        strdup( input_item_GetArtist( p_item->p_input ) ):
                         strdup( "" );
     psz_temp = convert_xml_special_chars( psz );
     if( psz ) free( psz );
@@ -175,8 +175,8 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_file,
     free( psz_temp );
 
     /* -> the album */
-    psz = p_item->p_input->p_meta->psz_album ?
-                        strdup( p_item->p_input->p_meta->psz_album ):
+    psz = input_item_GetAlbum( p_item->p_input ) ?
+                        strdup( input_item_GetAlbum( p_item->p_input ) ):
                         strdup( "" );
     psz_temp = convert_xml_special_chars( psz );
     if( psz ) free( psz );
@@ -187,8 +187,8 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_file,
     free( psz_temp );
 
     /* -> the track number */
-    psz = p_item->p_input->p_meta->psz_tracknum ?
-                        strdup( p_item->p_input->p_meta->psz_tracknum ):
+    psz = input_item_GetTrackNum( p_item->p_input ) ?
+                        strdup( input_item_GetTrackNum( p_item->p_input ) ):
                         strdup( "" );
     if( psz )
     {
@@ -200,8 +200,8 @@ static void xspf_export_item( playlist_item_t *p_item, FILE *p_file,
     }
 
     /* -> the description */
-    psz = p_item->p_input->p_meta->psz_description ?
-                        strdup( p_item->p_input->p_meta->psz_description ):
+    psz = input_item_GetDescription( p_item->p_input ) ?
+                        strdup( input_item_GetDescription( p_item->p_input ) ):
                         strdup( "" );
     psz_temp = convert_xml_special_chars( psz );
     if( psz ) free( psz );
index 7b6f425..db3249b 100644 (file)
@@ -1053,24 +1053,24 @@ static bo_t *GetUdtaTag( sout_mux_t *p_mux )
     {
 #define ADD_META_BOX( type, box_string ) { \
         bo_t *box = NULL;  \
-        if( p_meta->psz_##type ) box = box_new( "\251" box_string ); \
+        if( vlc_meta_Get( p_meta, vlc_meta_##type ) ) box = box_new( "\251" box_string ); \
         if( box ) \
         { \
-            bo_add_16be( box, strlen( p_meta->psz_##type ) ); \
+            bo_add_16be( box, strlen( vlc_meta_Get( p_meta, vlc_meta_##type ) )); \
             bo_add_16be( box, 0 ); \
-            bo_add_mem( box, strlen( p_meta->psz_##type ), \
-                        (uint8_t*)(p_meta->psz_##type ) ); \
+            bo_add_mem( box, strlen( vlc_meta_Get( p_meta, vlc_meta_##type ) ), \
+                        (uint8_t*)(vlc_meta_Get( p_meta, vlc_meta_##type ) ) ); \
             box_fix( box ); \
             box_gather( udta, box ); \
         } }
 
-        ADD_META_BOX( title, "nam" );
-        ADD_META_BOX( artist, "ART" );
-        ADD_META_BOX( genre, "gen" );
-        ADD_META_BOX( copyright, "cpy" );
-        ADD_META_BOX( description, "des" );
-        ADD_META_BOX( date, "day" );
-        ADD_META_BOX( url, "url" );
+        ADD_META_BOX( Title, "nam" );
+        ADD_META_BOX( Artist, "ART" );
+        ADD_META_BOX( Genre, "gen" );
+        ADD_META_BOX( Copyright, "cpy" );
+        ADD_META_BOX( Description, "des" );
+        ADD_META_BOX( Date, "day" );
+        ADD_META_BOX( URL, "url" );
 #undef ADD_META_BOX
     }
 
index 694f1a3..06481d7 100644 (file)
@@ -416,10 +416,9 @@ static char *TitleGet( vlc_object_t *p_this )
 
     if( p_input )
     {
-        if( input_GetItem(p_input)->p_meta->psz_title &&
-                *input_GetItem(p_input)->p_meta->psz_title )
+        if( !EMPTY_STR( input_item_GetTitle( input_GetItem(p_input) ) ) )
         {
-            psz_title = strdup( input_GetItem(p_input)->p_meta->psz_title );
+            psz_title = strdup( input_item_GetTitle( input_GetItem(p_input) ) );
         }
         else
         {
index 7d2d68e..a0f2c82 100644 (file)
@@ -163,44 +163,41 @@ libvlc_media_descriptor_get_mrl( libvlc_media_descriptor_t * p_md,
 /**************************************************************************
  * Getter for meta information
  **************************************************************************/
-static const int meta_conversion[] =
+static const vlc_meta_type_t meta_conversion[] =
 {
-    [libvlc_meta_Title]        = 0, /* Offset in the vlc_meta_t structure */
-    [libvlc_meta_Artist]       = 1,
-    [libvlc_meta_Genre]        = 2,
-    [libvlc_meta_Copyright]    = 3,
-    [libvlc_meta_Album]        = 4,
-    [libvlc_meta_TrackNumber]  = 5,
-    [libvlc_meta_Description]  = 6,
-    [libvlc_meta_Rating]       = 7,
-    [libvlc_meta_Date]         = 8,
-    [libvlc_meta_Settings]     = 9,
-    [libvlc_meta_URL]          = 10,
-    [libvlc_meta_Language]     = 11,
-    [libvlc_meta_NowPlaying]   = 12,
-    [libvlc_meta_Publisher]    = 13,
-    [libvlc_meta_EncodedBy]    = 14,
-    [libvlc_meta_ArtworkURL]   = 15,
-    [libvlc_meta_TrackID]      = 16
+    [libvlc_meta_Artist]       = vlc_meta_Artist,
+    [libvlc_meta_Genre]        = vlc_meta_Genre,
+    [libvlc_meta_Copyright]    = vlc_meta_Copyright,
+    [libvlc_meta_Album]        = vlc_meta_Album,
+    [libvlc_meta_TrackNumber]  = vlc_meta_TrackNumber,
+    [libvlc_meta_Description]  = vlc_meta_Description,
+    [libvlc_meta_Rating]       = vlc_meta_Rating,
+    [libvlc_meta_Date]         = vlc_meta_Date,
+    [libvlc_meta_Settings]     = vlc_meta_Setting,
+    [libvlc_meta_URL]          = vlc_meta_URL,
+    [libvlc_meta_Language]     = vlc_meta_Language,
+    [libvlc_meta_NowPlaying]   = vlc_meta_NowPlaying,
+    [libvlc_meta_Publisher]    = vlc_meta_Publisher,
+    [libvlc_meta_EncodedBy]    = vlc_meta_EncodedBy,
+    [libvlc_meta_ArtworkURL]   = vlc_meta_ArtworkURL,
+    [libvlc_meta_TrackID]      = vlc_meta_TrackID
 };
 
 char * libvlc_media_descriptor_get_meta( libvlc_media_descriptor_t *p_md,
                                          libvlc_meta_t e_meta,
                                          libvlc_exception_t *p_e )
 {
-    char ** ppsz_meta;
-    char *ppz_meta;
+    const char * psz_meta;
 
     /* XXX: locking */
 
     preparse_if_needed( p_md );
 
-    ppsz_meta = (char**)p_md->p_input_item->p_meta;
-    ppz_meta = ppsz_meta[ meta_conversion[e_meta] ];
+    psz_meta = input_item_GetMeta( p_md->p_input_item, meta_conversion[e_meta] );
 
-    if( !ppz_meta )
+    if( !psz_meta )
         return NULL;
 
-    return strdup( ppz_meta );
+    return strdup( psz_meta );
 }
 
index 2b542c3..04dd3f2 100644 (file)
@@ -488,10 +488,10 @@ static void EsOutProgramSelect( es_out_t *out, es_out_pgrm_t *p_pgrm )
 
     /* Update now playing */
     vlc_mutex_lock( &p_input->p->input.p_item->lock );
-    vlc_meta_SetNowPlaying( p_input->p->input.p_item->p_meta,
-                            p_pgrm->psz_now_playing );
-    vlc_meta_SetPublisher( p_input->p->input.p_item->p_meta,
-                           p_pgrm->psz_publisher );
+    input_item_SetNowPlaying( p_input->p->input.p_item,
+                              p_pgrm->psz_now_playing );
+    input_item_SetPublisher( p_input->p->input.p_item,
+                             p_pgrm->psz_publisher );
     vlc_mutex_unlock( &p_input->p->input.p_item->lock );
 
     var_SetBool( p_sys->p_input, "intf-change", VLC_TRUE );
@@ -605,15 +605,18 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
     es_out_pgrm_t     *p_pgrm = NULL;
     input_thread_t    *p_input = p_sys->p_input;
     char              *psz_cat;
-    char              *psz_title = NULL;
-    char              *psz_provider = NULL;
+    const char        *psz_title = NULL;
+    const char        *psz_provider = NULL;
     int i;
 
     msg_Dbg( p_input, "EsOutProgramMeta: number=%d", i_group );
 
     /* Check against empty meta data (empty for what we handle) */
-    if( !p_meta->psz_title && !p_meta->psz_nowplaying && !p_meta->psz_publisher && vlc_dictionary_keys_count( &p_meta->extra_tags ) <= 0 )
-        return;
+    if( !vlc_meta_Get( p_meta, vlc_meta_Title) &&
+        !vlc_meta_Get( p_meta, vlc_meta_NowPlaying) &&
+        !vlc_meta_Get( p_meta, vlc_meta_Publisher) &&
+        vlc_dictionary_keys_count( &p_meta->extra_tags ) <= 0 )
+            return;
     /* Find program */
     for( i = 0; i < p_sys->i_pgrm; i++ )
     {
@@ -627,8 +630,8 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
         p_pgrm = EsOutProgramAdd( out, i_group );   /* Create it */
 
     /* */
-    psz_title = p_meta->psz_title;
-    psz_provider = p_meta->psz_publisher;
+    psz_title = vlc_meta_Get( p_meta, vlc_meta_Title);
+    psz_provider = vlc_meta_Get( p_meta, vlc_meta_Publisher);
 
     /* Update the description text of the program */
     if( psz_title && *psz_title )
@@ -660,7 +663,7 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
         }
         else
         {
-            text.psz_string = psz_title;
+            text.psz_string = (char *)psz_title;
             var_Change( p_input, "program", VLC_VAR_ADDCHOICE, &val, &text );
         }
     }
@@ -671,10 +674,10 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, vlc_meta_t *p_meta )
         if( p_sys->p_pgrm == p_pgrm )
         {
             vlc_mutex_lock( &p_input->p->input.p_item->lock );
-            vlc_meta_SetPublisher( p_input->p->input.p_item->p_meta, psz_provider );
+            input_item_SetPublisher( p_input->p->input.p_item, psz_provider );
             vlc_mutex_unlock( &p_input->p->input.p_item->lock );
         }
-        input_Control( p_input, INPUT_ADD_INFO, psz_cat, _(VLC_META_PUBLISHER), psz_provider );
+        input_Control( p_input, INPUT_ADD_INFO, psz_cat, input_MetaTypeToLocalizedString(vlc_meta_Publisher), psz_provider );
     }
     char ** ppsz_all_keys = vlc_dictionary_all_keys( &p_meta->extra_tags );
     for( i = 0; ppsz_all_keys[i]; i++ )
@@ -797,13 +800,20 @@ static void EsOutProgramEpg( es_out_t *out, int i_group, vlc_epg_t *p_epg )
 
     vlc_mutex_lock( &p_input->p->input.p_item->lock );
     if( p_pgrm == p_sys->p_pgrm )
-        vlc_meta_SetNowPlaying( p_input->p->input.p_item->p_meta, p_pgrm->psz_now_playing );
+        input_item_SetNowPlaying( p_input->p->input.p_item, p_pgrm->psz_now_playing );
     vlc_mutex_unlock( &p_input->p->input.p_item->lock );
 
     if( p_pgrm->psz_now_playing )
-        input_Control( p_input, INPUT_ADD_INFO, psz_cat, _(VLC_META_NOW_PLAYING), p_pgrm->psz_now_playing );
+    {
+        input_Control( p_input, INPUT_ADD_INFO, psz_cat,
+            input_MetaTypeToLocalizedString(vlc_meta_NowPlaying),
+            p_pgrm->psz_now_playing );
+    }
     else
-        input_Control( p_input, INPUT_DEL_INFO, psz_cat, _(VLC_META_NOW_PLAYING) );
+    {
+        input_Control( p_input, INPUT_DEL_INFO, psz_cat,
+            input_MetaTypeToLocalizedString(vlc_meta_NowPlaying) );
+    }
 
     free( psz_cat );
 }
index 46b5759..0b990c8 100644 (file)
@@ -175,8 +175,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     p_input->p->input.i_cr_average = 0;
 
     vlc_mutex_lock( &p_item->lock );
-    if( !p_input->p->input.p_item->p_meta )
-        p_input->p->input.p_item->p_meta = vlc_meta_New();
 
     if( !p_item->p_stats )
         p_item->p_stats = stats_NewInputStats( p_input );
@@ -253,9 +251,11 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     }
 
     /* Remove 'Now playing' info as it is probably outdated */
-    input_Control( p_input, INPUT_DEL_INFO, _(VLC_META_INFO_CAT), VLC_META_NOW_PLAYING );
+    input_Control( p_input, INPUT_DEL_INFO,
+        _(VLC_META_INFO_CAT),
+        _(VLC_META_NOW_PLAYING) );
     vlc_mutex_lock( &p_item->lock );
-    vlc_meta_SetNowPlaying( p_item->p_meta, NULL );
+    input_item_SetNowPlaying( p_item, NULL );
     vlc_mutex_unlock( &p_item->lock );
 
     /* */
@@ -2484,19 +2484,17 @@ static void InputMetaUser( input_thread_t *p_input, vlc_meta_t *p_meta )
     /* Get meta information from user */
 #define GET_META( field, s ) \
     var_Get( p_input, (s), &val );  \
-    if( *val.psz_string ) { \
-        if( p_meta->psz_ ## field ) free ( p_meta->psz_ ## field ); \
-        p_meta->psz_ ## field = strdup( val.psz_string ); \
-    } \
+    if( *val.psz_string ) \
+        vlc_meta_Set( p_meta, vlc_meta_ ## field, val.psz_string ); \
     free( val.psz_string )
 
-    GET_META( title, "meta-title" );
-    GET_META( artist, "meta-artist" );
-    GET_META( genre, "meta-genre" );
-    GET_META( copyright, "meta-copyright" );
-    GET_META( description, "meta-description" );
-    GET_META( date, "meta-date" );
-    GET_META( url, "meta-url" );
+    GET_META( Title, "meta-title" );
+    GET_META( Artist, "meta-artist" );
+    GET_META( Genre, "meta-genre" );
+    GET_META( Copyright, "meta-copyright" );
+    GET_META( Description, "meta-description" );
+    GET_META( Date, "meta-date" );
+    GET_META( URL, "meta-url" );
 #undef GET_META
 }
 
@@ -2507,6 +2505,8 @@ static void InputMetaUser( input_thread_t *p_input, vlc_meta_t *p_meta )
 static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
 {
     input_item_t *p_item = p_input->p->input.p_item;
+    char * psz_saved_arturl = NULL;
+    const char * psz_arturl = NULL;
     char *psz_title = NULL;
     int i;
 
@@ -2514,43 +2514,39 @@ static void InputUpdateMeta( input_thread_t *p_input, vlc_meta_t *p_meta )
         return;
 
     vlc_mutex_lock( &p_item->lock );
-    if( p_meta->psz_title && !p_item->b_fixed_name )
-        psz_title = strdup( p_meta->psz_title );
+    if( vlc_meta_Get( p_meta, vlc_meta_Title ) && !p_item->b_fixed_name )
+        psz_title = strdup( vlc_meta_Get( p_meta, vlc_meta_Title ) );
 
-    if( p_item->p_meta )
-    {
-        char *psz_arturl = p_item->p_meta->psz_arturl;
-        p_item->p_meta->psz_arturl = NULL;
+    if( input_item_GetArtURL( p_item ) )
+        psz_saved_arturl = strdup( input_item_GetArtURL( p_item ) );
 
-        vlc_meta_Merge( p_item->p_meta, p_meta );
+    vlc_meta_Merge( p_item->p_meta, p_meta );
 
-        if( psz_arturl && *psz_arturl )
-            vlc_meta_SetArtURL( p_item->p_meta, psz_arturl );
+    if( psz_saved_arturl && *psz_saved_arturl )
+        input_item_SetArtURL( p_item, psz_saved_arturl );
 
-        vlc_meta_Delete( p_meta );
-    }
-    else
-    {
-        p_item->p_meta = p_meta;
-    }
-    if( p_item->p_meta->psz_arturl && !strncmp( p_item->p_meta->psz_arturl, "attachment://", strlen("attachment") ) )
+    free( psz_saved_arturl );
+    vlc_meta_Delete( p_meta );
+
+    psz_arturl = input_item_GetArtURL( p_item );
+    if( psz_arturl && !strncmp( psz_arturl, "attachment://", strlen("attachment") ) )
     {
         /* Don't look for art cover if sout
          * XXX It can change when sout has meta data support */
         if( p_input->p->p_sout && !p_input->b_preparsing )
-            vlc_meta_SetArtURL( p_item->p_meta, "" );
+            input_item_SetArtURL( p_item, "" );
         else
             input_ExtractAttachmentAndCacheArt( p_input );
     }
-
-    p_item->p_meta->i_status |= ITEM_PREPARSED;
+    
+    input_item_SetPreparsed( p_item, VLC_TRUE );
 
     /* A bit ugly */
     p_meta = NULL;
     if( vlc_dictionary_keys_count( &p_item->p_meta->extra_tags ) > 0 )
     {
         p_meta = vlc_meta_New();
-        vlc_meta_Merge( p_meta, p_item->p_meta );
+        vlc_meta_Merge( p_meta, input_item_GetMetaObject( p_item ) );
     }
     vlc_mutex_unlock( &p_item->lock );
 
index f9cf410..419835e 100644 (file)
 
 // FIXME be sure to not touch p_meta without lock on p_item
 
+static const char * meta_type_to_string[VLC_META_TYPE_COUNT] =
+{
+    [vlc_meta_Title]            = N_("Title"),
+    [vlc_meta_Artist]           = N_("Artist"),
+    [vlc_meta_Genre]            = N_("Genre"),
+    [vlc_meta_Copyright]        = N_("Copyright"),
+    [vlc_meta_Album]            = N_("Album/movie/show title"),
+    [vlc_meta_TrackNumber]      = N_("Track number/position in set"),
+    [vlc_meta_Description]      = N_("Description"),
+    [vlc_meta_Rating]           = N_("Rating"),
+    [vlc_meta_Date]             = N_("Date"),
+    [vlc_meta_Setting]          = N_("Setting"),
+    [vlc_meta_URL]              = N_("URL"),
+    [vlc_meta_Language]         = N_("Language"),
+    [vlc_meta_NowPlaying]       = N_("Language"),
+    [vlc_meta_Publisher]        = N_("Publisher"),
+    [vlc_meta_EncodedBy]        = N_("Encoded by"),
+    [vlc_meta_ArtworkURL]       = N_("Artwork URL"),
+    [vlc_meta_TrackID]          = N_("Track ID"),
+};
+
+const char *
+input_MetaTypeToLocalizedString( vlc_meta_type_t meta_type )
+{
+    return _(meta_type_to_string[meta_type]);
+}
+
 #define input_FindArtInCache(a,b) __input_FindArtInCache(VLC_OBJECT(a),b)
 static int __input_FindArtInCache( vlc_object_t *, input_item_t *p_item );
 
@@ -80,6 +107,9 @@ int input_MetaFetch( playlist_t *p_playlist, input_item_t *p_item )
     }
     module_Unneed( p_me, p_me->p_module );
     vlc_object_destroy( p_me );
+
+    input_item_SetMetaFetched( p_item, VLC_TRUE );
+
     return VLC_SUCCESS;
 }
 
@@ -96,19 +126,19 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
     if( !p_item->p_meta )
         return VLC_EGENERIC;
 
-    if(  !p_item->psz_name && !p_item->p_meta->psz_title &&
-        (!p_item->p_meta->psz_artist || !p_item->p_meta->psz_album) )
+    if(  !p_item->psz_name && !input_item_GetTitle( p_item ) &&
+        (!input_item_GetArtist( p_item ) || !input_item_GetAlbum( p_item )) )
         return VLC_EGENERIC;
 
     /* If we already checked this album in this session, skip */
-    if( p_item->p_meta->psz_artist && p_item->p_meta->psz_album )
+    if( input_item_GetArtist( p_item ) && input_item_GetAlbum( p_item ) )
     {
         FOREACH_ARRAY( playlist_album_t album, p_playlist->p_fetcher->albums )
-            if( !strcmp( album.psz_artist, p_item->p_meta->psz_artist ) &&
-                !strcmp( album.psz_album, p_item->p_meta->psz_album ) )
+            if( !strcmp( album.psz_artist, input_item_GetArtist( p_item ) ) &&
+                !strcmp( album.psz_album, input_item_GetAlbum( p_item ) ) )
             {
                 msg_Dbg( p_playlist, " %s - %s has already been searched",
-                         p_item->p_meta->psz_artist,  p_item->p_meta->psz_album );
+                         input_item_GetArtist( p_item ),  input_item_GetAlbum( p_item ) );
         /* TODO-fenrir if we cache art filename too, we can go faster */
                 if( album.b_found )
                 {
@@ -125,20 +155,20 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
     }
 
     input_FindArtInCache( p_playlist, p_item );
-    if( !EMPTY_STR( p_item->p_meta->psz_arturl ) )
+    if( !EMPTY_STR(input_item_GetArtURL( p_item )) )
         return 0;
 
     PL_LOCK;
     p_playlist->p_private = p_item;
-    if( p_item->p_meta->psz_artist && p_item->p_meta->psz_album )
+    if( input_item_GetAlbum( p_item ) && input_item_GetArtist( p_item ) )
     {
         msg_Dbg( p_playlist, "searching art for %s - %s",
-             p_item->p_meta->psz_artist,  p_item->p_meta->psz_album );
+             input_item_GetArtist( p_item ),  input_item_GetAlbum( p_item ) );
     }
     else
     {
         msg_Dbg( p_playlist, "searching art for %s",
-             p_item->p_meta->psz_title ? p_item->p_meta->psz_title : p_item->psz_name );
+             input_item_GetTitle( p_item ) ? input_item_GetTitle( p_item ) : p_item->psz_name );
     }
 
     p_module = module_Need( p_playlist, "art finder", 0, VLC_FALSE );
@@ -149,11 +179,11 @@ int input_ArtFind( playlist_t *p_playlist, input_item_t *p_item )
         msg_Dbg( p_playlist, "unable to find art" );
 
     /* Record this album */
-    if( p_item->p_meta->psz_artist && p_item->p_meta->psz_album )
+    if( input_item_GetArtist( p_item ) && input_item_GetAlbum( p_item ) )
     {
         playlist_album_t a;
-        a.psz_artist = strdup( p_item->p_meta->psz_artist );
-        a.psz_album = strdup( p_item->p_meta->psz_album );
+        a.psz_artist = strdup( input_item_GetArtist( p_item ) );
+        a.psz_album = strdup( input_item_GetAlbum( p_item ) );
         a.b_found = (i_ret == VLC_EGENERIC ? VLC_FALSE : VLC_TRUE );
         ARRAY_APPEND( p_playlist->p_fetcher->albums, a );
     }
@@ -253,9 +283,9 @@ static char *ArtCacheCreateString( const char *psz )
 
 static int __input_FindArtInCache( vlc_object_t *p_obj, input_item_t *p_item )
 {
-    char *psz_artist;
-    char *psz_album;
-    char *psz_title;
+    const char *psz_artist;
+    const char *psz_album;
+    const char *psz_title;
     char psz_filename[MAX_PATH+1];
     int i;
     struct stat a;
@@ -263,9 +293,9 @@ static int __input_FindArtInCache( vlc_object_t *p_obj, input_item_t *p_item )
 
     if( !p_item->p_meta ) return VLC_EGENERIC;
 
-    psz_artist = p_item->p_meta->psz_artist;
-    psz_album = p_item->p_meta->psz_album;
-    psz_title = p_item->p_meta->psz_title;
+    psz_artist = input_item_GetArtist( p_item );
+    psz_album = input_item_GetAlbum( p_item );
+    psz_title = input_item_GetTitle( p_item );
     if( !psz_title ) psz_title = p_item->psz_name;
 
     if( (!psz_artist || !psz_album) && !psz_title ) return VLC_EGENERIC;
@@ -278,7 +308,7 @@ static int __input_FindArtInCache( vlc_object_t *p_obj, input_item_t *p_item )
         /* Check if file exists */
         if( utf8_stat( psz_filename+7, &a ) == 0 )
         {
-            vlc_meta_SetArtURL( p_item->p_meta, psz_filename );
+            input_item_SetArtURL( p_item, psz_filename );
             return VLC_SUCCESS;
         }
     }
@@ -298,12 +328,12 @@ int input_DownloadAndCacheArt( playlist_t *p_playlist, input_item_t *p_item )
     char *psz_album = NULL;
     char *psz_title = NULL;
     char *psz_type;
-    if( p_item->p_meta->psz_artist )
-        psz_artist = ArtCacheCreateString( p_item->p_meta->psz_artist );
-    if( p_item->p_meta->psz_album )
-        psz_album = ArtCacheCreateString( p_item->p_meta->psz_album );
-    if( p_item->p_meta->psz_title )
-        psz_title = ArtCacheCreateString( p_item->p_meta->psz_title );
+    if( input_item_GetArtist( p_item ) )
+        psz_artist = ArtCacheCreateString( input_item_GetArtist( p_item ) );
+    if( input_item_GetAlbum( p_item ) )
+        psz_album = ArtCacheCreateString( input_item_GetAlbum( p_item ) );
+    if( input_item_GetTitle( p_item ) )
+        psz_title = ArtCacheCreateString( input_item_GetTitle( p_item ) );
     else if( p_item->psz_name )
         psz_title = ArtCacheCreateString( p_item->psz_name );
 
@@ -315,9 +345,9 @@ int input_DownloadAndCacheArt( playlist_t *p_playlist, input_item_t *p_item )
         return VLC_EGENERIC;
     }
 
-    assert( p_item->p_meta && !EMPTY_STR(p_item->p_meta->psz_arturl) );
+    assert( !EMPTY_STR(input_item_GetArtURL( p_item )) );
 
-    psz_type = strrchr( p_item->p_meta->psz_arturl, '.' );
+    psz_type = strrchr( input_item_GetArtURL( p_item ), '.' );
 
     /* */
     ArtCacheCreateName( p_playlist, psz_filename, psz_title /* Used only if needed*/,
@@ -331,13 +361,13 @@ int input_DownloadAndCacheArt( playlist_t *p_playlist, input_item_t *p_item )
     free( psz_album );
     free( psz_title );
 
-    if( !strncmp( p_item->p_meta->psz_arturl , "APIC", 4 ) )
+    if( !strncmp( input_item_GetArtURL( p_item ) , "APIC", 4 ) )
     {
         msg_Warn( p_playlist, "APIC fetch not supported yet" );
         return VLC_EGENERIC;
     }
 
-    p_stream = stream_UrlNew( p_playlist, p_item->p_meta->psz_arturl );
+    p_stream = stream_UrlNew( p_playlist, input_item_GetArtURL( p_item ) );
     if( p_stream )
     {
         uint8_t p_buffer[65536];
@@ -355,14 +385,13 @@ int input_DownloadAndCacheArt( playlist_t *p_playlist, input_item_t *p_item )
         if( fclose( p_file ) && !err )
             err = errno;
         stream_Delete( p_stream );
-        free( p_item->p_meta->psz_arturl );
 
         if( err )
             msg_Err( p_playlist, "%s: %s", psz_filename, strerror( err ) );
         else
             msg_Dbg( p_playlist, "album art saved to %s\n", psz_filename );
 
-        p_item->p_meta->psz_arturl = strdup( psz_filename );
+        input_item_SetArtURL( p_item, psz_filename );
         i_status = VLC_SUCCESS;
     }
     return i_status;
@@ -385,16 +414,15 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
     /* TODO-fenrir merge input_ArtFind with download and make it set the flags FETCH
      * and then set it here to to be faster */
 
-    assert( p_item->p_meta );
-    psz_arturl = p_item->p_meta->psz_arturl;
+    psz_arturl = strdup( input_item_GetArtURL( p_item ) );
     if( !psz_arturl || strncmp( psz_arturl, "attachment://", strlen("attachment://") ) )
     {
         msg_Err( p_input, "internal input error with input_ExtractAttachmentAndCacheArt" );
         return;
     }
-    p_item->p_meta->psz_arturl = NULL;
+    input_item_SetArtURL( p_item, NULL );
 
-    if( p_item->p_meta->i_status & ITEM_ART_FETCHED )
+    if( input_item_IsArtFetched( p_item ) )
     {
         /* XXX Weird, we should not have end up with attachment:// art url unless there is a race
          * condition */
@@ -420,12 +448,12 @@ void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input )
         goto end;
     }
 
-    if( p_item->p_meta->psz_artist )
-        psz_artist = ArtCacheCreateString( p_item->p_meta->psz_artist );
-    if( p_item->p_meta->psz_album )
-        psz_album = ArtCacheCreateString( p_item->p_meta->psz_album );
-    if( p_item->p_meta->psz_title )
-        psz_title = ArtCacheCreateString( p_item->p_meta->psz_title );
+    if( input_item_GetArtist( p_item ) )
+        psz_artist = ArtCacheCreateString( input_item_GetArtist( p_item ) );
+    if( input_item_GetAlbum( p_item ) )
+        psz_album = ArtCacheCreateString( input_item_GetAlbum( p_item ) );
+    if( input_item_GetTitle( p_item ) )
+        psz_title = ArtCacheCreateString( input_item_GetTitle( p_item ) );
     else if( p_item->psz_name )
         psz_title = ArtCacheCreateString( p_item->psz_name );
 
@@ -465,25 +493,25 @@ uint32_t input_CurrentMetaFlags( vlc_meta_t *p_meta )
     uint32_t i_meta = 0;
 
 #define CHECK( a, b ) \
-    if( p_meta->psz_ ## a && *p_meta->psz_ ## a ) \
+    if( !EMPTY_STR( vlc_meta_Get( p_meta, vlc_meta_ ## a ) ) ) \
         i_meta |= VLC_META_ENGINE_ ## b;
 
-    CHECK( title, TITLE )
-    CHECK( artist, ARTIST )
-    CHECK( album, COLLECTION )
+    CHECK( Title, TITLE )
+    CHECK( Artist, ARTIST )
+    CHECK( Album, COLLECTION )
 #if 0
     /* As this is not used at the moment, don't uselessly check for it.
      * Re-enable this when it is used */
-    CHECK( genre, GENRE )
-    CHECK( copyright, COPYRIGHT )
-    CHECK( tracknum, SEQ_NUM )
-    CHECK( description, DESCRIPTION )
-    CHECK( rating, RATING )
-    CHECK( date, DATE )
-    CHECK( url, URL )
-    CHECK( language, LANGUAGE )
+    CHECK( Genre, GENRE )
+    CHECK( Copyright, COPYRIGHT )
+    CHECK( Tracknum, SEQ_NUM )
+    CHECK( Description, DESCRIPTION )
+    CHECK( Rating, RATING )
+    CHECK( Date, DATE )
+    CHECK( URL, URL )
+    CHECK( Language, LANGUAGE )
 #endif
-    CHECK( arturl, ART_URL )
+    CHECK( ArtworkURL, ART_URL )
 
     return i_meta;
 }
index 7b1880a..fa476bd 100644 (file)
@@ -456,7 +456,7 @@ int playlist_PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
 
         vlc_mutex_lock( &p_input->lock );
         /* p_input->p_meta should not be null after a successfull CreateThread */
-        b_has_art = p_input->p_meta && !EMPTY_STR( p_input->p_meta->psz_arturl );
+        b_has_art = !EMPTY_STR( input_item_GetArtURL( p_input ) );
         vlc_mutex_unlock( &p_input->lock );
 
         if( !b_has_art )
index 6d41431..af61df2 100644 (file)
@@ -506,7 +506,7 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
                 stats_TimerStart( p_playlist, "Preparse run",
                                   STATS_TIMER_PREPARSE );
                 /* Do not preparse if it is already done (like by playing it) */
-                if( !p_current->p_meta || !(p_current->p_meta->i_status & ITEM_PREPARSED ) )
+                if( !input_item_IsPreparsed( p_current ) )
                 {
                     PL_UNLOCK;
                     input_Preparse( p_playlist, p_current );
@@ -517,7 +517,7 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
             PL_UNLOCK;
             if( b_preparsed )
             {
-                p_current->p_meta->i_status |= ITEM_PREPARSED;
+                input_item_SetPreparsed( p_current, VLC_TRUE );
                 var_SetInteger( p_playlist, "item-change", p_current->i_id );
             }
             PL_LOCK;
@@ -527,8 +527,7 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
              * This only checks for meta, not for art
              * \todo don't do this for things we won't get meta for, like vids
              */
-            if( p_current->p_meta &&
-                !input_MetaSatisfied( p_playlist, p_current, &i_m, &i_o ) )
+            if( !input_MetaSatisfied( p_playlist, p_current, &i_m, &i_o ) )
             {
                 preparse_item_t p;
                 PL_DEBUG("need to fetch meta for %s", p_current->psz_name );
@@ -542,9 +541,8 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
                 vlc_cond_signal( &p_playlist->p_fetcher->object_wait );
             }
             /* We already have all needed meta, but we need art right now */
-            else if( p_current->p_meta &&
-                     p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL &&
-                     EMPTY_STR( p_current->p_meta->psz_arturl ) )
+            else if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL &&
+                     EMPTY_STR( input_item_GetArtURL( p_current ) ) )
             {
                 preparse_item_t p;
                 PL_DEBUG("meta ok for %s, need to fetch art",
@@ -562,8 +560,7 @@ void playlist_PreparseLoop( playlist_preparse_t *p_obj )
             {
                 PL_DEBUG( "no fetch required for %s (art currently %s)",
                           p_current->psz_name,
-                          p_current->p_meta ? p_current->p_meta->psz_arturl:
-                                              "null" );
+                          input_item_GetArtURL( p_current ));
                 vlc_gc_decref( p_current );
             }
             PL_UNLOCK;
@@ -607,11 +604,9 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
         vlc_mutex_unlock( &p_obj->object_lock );
         if( p_item )
         {
-            assert( p_item->p_meta );
             if( !b_fetch_art )
             {
                 input_MetaFetch( p_playlist, p_item );
-                p_item->p_meta->i_status |= ITEM_META_FETCHED;
                 var_SetInteger( p_playlist, "item-change", p_item->i_id );
                 /*  Fetch right now */
                 if( p_playlist->p_fetcher->i_art_policy == ALBUM_ART_ALL )
@@ -637,7 +632,7 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
                 /* Check if it is not yet preparsed and if so wait for it (at most 0.5s)
                  * (This can happen if we fetch art on play)
                  * FIXME this doesn't work if we need to fetch meta before art ... */
-                for( i_ret = 0; i_ret < 10 && !(p_item->p_meta->i_status & ITEM_PREPARSED ); i_ret++ )
+                for( i_ret = 0; i_ret < 10 && !input_item_IsPreparsed( p_item ); i_ret++ )
                 {
                     vlc_bool_t b_break;
                     PL_LOCK;
@@ -654,9 +649,9 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
                 {
                     PL_DEBUG("downloading art for %s", p_item->psz_name );
                     if( input_DownloadAndCacheArt( p_playlist, p_item ) )
-                        p_item->p_meta->i_status |= ITEM_ART_NOTFOUND;
+                        input_item_SetArtNotFound( p_item, VLC_TRUE );
                     else {
-                        p_item->p_meta->i_status |= ITEM_ART_FETCHED;
+                        input_item_SetArtFetched( p_item, VLC_TRUE );
                         var_SetInteger( p_playlist, "item-change",
                                         p_item->i_id );
                     }
@@ -664,13 +659,13 @@ void playlist_FetcherLoop( playlist_fetcher_t *p_obj )
                 else if( i_ret == 0 ) /* Was in cache */
                 {
                     PL_DEBUG("found art for %s in cache", p_item->psz_name );
-                    p_item->p_meta->i_status |= ITEM_ART_FETCHED;
+                    input_item_SetArtFetched( p_item, VLC_TRUE );
                     var_SetInteger( p_playlist, "item-change", p_item->i_id );
                 }
                 else
                 {
                     PL_DEBUG("art not found for %s", p_item->psz_name );
-                    p_item->p_meta->i_status |= ITEM_ART_NOTFOUND;
+                    input_item_SetArtNotFound( p_item, VLC_TRUE );
                 }
                 vlc_gc_decref( p_item );
            }
index ff67441..f8364a1 100644 (file)
@@ -556,18 +556,14 @@ static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
     if( p_playlist->b_auto_preparse &&
           (i_mode & PLAYLIST_PREPARSE ||
           ( i_mode & PLAYLIST_SPREPARSE &&
-            ( !p_item_cat->p_input->p_meta || (p_item_cat->p_input->p_meta &&
-              ( EMPTY_STR( p_item_cat->p_input->p_meta->psz_artist ) ||
-                EMPTY_STR( p_item_cat->p_input->p_meta->psz_album ) )
-              )
-            )
+            ( EMPTY_STR( input_item_GetArtist( p_item_cat->p_input ) ) ||
+            ( EMPTY_STR( input_item_GetAlbum( p_item_cat->p_input ) ) ) )
           ) ) )
         playlist_PreparseEnqueue( p_playlist, p_item_cat->p_input );
     /* If we already have it, signal it */
-    else if( p_item_cat->p_input->p_meta &&
-             !EMPTY_STR( p_item_cat->p_input->p_meta->psz_artist ) &&
-             !EMPTY_STR( p_item_cat->p_input->p_meta->psz_album ) )
-        p_item_cat->p_input->p_meta->i_status = ITEM_PREPARSED;
+    else if( !EMPTY_STR( input_item_GetArtist( p_item_cat->p_input ) ) &&
+             !EMPTY_STR( input_item_GetAlbum( p_item_cat->p_input ) ) )
+        input_item_SetPreparsed( p_item_cat->p_input, VLC_TRUE );
 }
 
 /* Add the playlist item to the requested node and fire a notification */
index c831566..e7e6916 100644 (file)
@@ -120,13 +120,12 @@ int playlist_LiveSearchUpdate( playlist_t *p_playlist, playlist_item_t *p_root,
         {
             playlist_LiveSearchUpdate( p_playlist, p_item, psz_string );
         }
-#define META_MATCHES( field ) ( p_item->p_input->p_meta && \
-                                p_item->p_input->p_meta->psz_##field && \
-                                strcasestr( p_item->p_input->p_meta->psz_##field, psz_string ) )
+#define META_MATCHES( field ) ( input_item_GetMeta( p_item->p_input, vlc_meta_##field ) && \
+                                strcasestr( input_item_GetMeta( p_item->p_input, vlc_meta_##field ), psz_string ) )
         else
         {
             if( strcasestr( p_item->p_input->psz_name, psz_string ) ||
-                META_MATCHES( artist ) || META_MATCHES( album ) )
+                META_MATCHES( Artist ) || META_MATCHES( Album ) )
                 p_item->i_flags &= ~PLAYLIST_DBL_FLAG;
             else
                 p_item->i_flags |= PLAYLIST_DBL_FLAG;
index ca80834..9eab21f 100644 (file)
@@ -105,10 +105,8 @@ static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
     }
 
 #define DO_META_SORT( node ) { \
-    char *psz_a = pp_items[i]->p_input->p_meta ?  \
-                       pp_items[i]->p_input->p_meta->psz_##node : NULL ; \
-    char *psz_b = pp_items[i_small]->p_input->p_meta ?  \
-                       pp_items[i_small]->p_input->p_meta->psz_##node : NULL; \
+    const char *psz_a = input_item_GetMeta( pp_items[i]->p_input, vlc_meta_##node ); \
+    const char *psz_b = input_item_GetMeta( pp_items[i_small]->p_input, vlc_meta_##node ); \
     /* Nodes go first */ \
     if( pp_items[i]->i_children == -1 && pp_items[i_small]->i_children >= 0 ) \
         i_test = 1;\
@@ -163,11 +161,11 @@ static int playlist_ItemArraySort( playlist_t *p_playlist, int i_items,
             }
             else if( i_mode == SORT_ARTIST )
             {
-                DO_META_SORT( artist );
+                DO_META_SORT( Artist );
             }
             else if( i_mode == SORT_ALBUM )
             {
-                DO_META_SORT( album );
+                DO_META_SORT( Album );
             }
             else if( i_mode == SORT_TITLE_NODES_FIRST )
             {
index c699613..1f9aea3 100644 (file)
@@ -682,44 +682,34 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
             switch( *s )
             {
                 case 'a':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_artist );
+                    INSERT_STRING( p_item, input_item_GetArtist(p_item) );
                     break;
                 case 'b':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_album );
+                    INSERT_STRING( p_item, input_item_GetAlbum(p_item) );
                     break;
                 case 'c':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_copyright );
+                    INSERT_STRING( p_item, input_item_GetCopyright(p_item) );
                     break;
                 case 'd':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_description );
+                    INSERT_STRING( p_item, input_item_GetDescription(p_item) );
                     break;
                 case 'e':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_encodedby );
+                    INSERT_STRING( p_item, input_item_GetEncodedBy(p_item) );
                     break;
                 case 'g':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_genre );
+                    INSERT_STRING( p_item, input_item_GetGenre(p_item) );
                     break;
                 case 'l':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_language );
+                    INSERT_STRING( p_item, input_item_GetLanguage(p_item) );
                     break;
                 case 'n':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_tracknum );
+                    INSERT_STRING( p_item, input_item_GetTrackNum(p_item) );
                     break;
                 case 'p':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_nowplaying );
+                    INSERT_STRING( p_item, input_item_GetNowPlaying(p_item) );
                     break;
                 case 'r':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_rating );
+                    INSERT_STRING( p_item, input_item_GetRating(p_item) );
                     break;
                 case 's':
                 {
@@ -737,16 +727,13 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
                     break;
                 }
                 case 't':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_title );
+                    INSERT_STRING( p_item, input_item_GetTitle(p_item) );
                     break;
                 case 'u':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_url );
+                    INSERT_STRING( p_item, input_item_GetURL(p_item) );
                     break;
                 case 'A':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_date );
+                    INSERT_STRING( p_item, input_item_GetDate(p_item) );
                     break;
                 case 'B':
                     if( p_input )
@@ -884,8 +871,7 @@ char *__str_format_meta( vlc_object_t *p_object, const char *string )
                     INSERT_STRING( 1, buf );
                     break;
                 case 'U':
-                    INSERT_STRING( p_item && p_item->p_meta,
-                                   p_item->p_meta->psz_publisher );
+                    INSERT_STRING( p_item, input_item_GetPublisher(p_item) );
                     break;
                 case 'V':
                 {
index f9849d3..4ebc7a3 100644 (file)
@@ -1646,12 +1646,10 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout )
     {
         i_now = mdate();
         i_stop = i_now + (mtime_t)(p_vout->i_title_timeout * 1000);
-        if( input_GetItem(p_input)->p_meta &&
-            input_GetItem(p_input)->p_meta->psz_nowplaying &&
-            *input_GetItem(p_input)->p_meta->psz_nowplaying )
+        if( !EMPTY_STR(input_item_GetNowPlaying(input_GetItem(p_input))) )
         {
             vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
-                                   input_GetItem(p_input)->p_meta->psz_nowplaying, NULL,
+                                   input_item_GetNowPlaying(input_GetItem(p_input)), NULL,
                                    p_vout->i_title_position,
                                    30 + p_vout->fmt_in.i_width
                                       - p_vout->fmt_in.i_visible_width
@@ -1659,19 +1657,17 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout )
                                    20 + p_vout->fmt_in.i_y_offset,
                                    i_now, i_stop );
         }
-        else if( input_GetItem(p_input)->p_meta &&
-                 input_GetItem(p_input)->p_meta->psz_artist &&
-                 *input_GetItem(p_input)->p_meta->psz_artist )
+        else if( !EMPTY_STR(input_item_GetArtist(input_GetItem(p_input))) )
         {
             char *psz_string = NULL;
 
-            psz_string = malloc( strlen(input_GetItem(p_input)->psz_name) +
-                    strlen(input_GetItem(p_input)->p_meta->psz_artist) );
+            psz_string = malloc( strlen(input_GetItem(p_input)->psz_name) +
+                    strlen( input_item_GetArtist(input_GetItem(p_input)) );
             if( psz_string )
             {
                 sprintf( psz_string, "%s - %s",
                          input_GetItem(p_input)->psz_name,
-                         input_GetItem(p_input)->p_meta->psz_artist );
+                         input_item_GetArtist(input_GetItem(p_input)) );
 
                 vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
                                        psz_string, NULL,