-#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; \
+ if( asprintf( &newval, "%s,%s", oldval, &psz[strlen(txt)] ) == -1 ) \
+ newval = NULL; \
+ 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 )