-#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 ) )
- if( strcasestr( p_item->p_input->psz_name, psz_string ) ||
- META_MATCHES( artist ) || META_MATCHES( album ) )
+
+ if( !b_enable )
+ {
+ vlc_mutex_lock( &p_item->p_input->lock );
+ // Do we have some meta ?
+ if( p_item->p_input->p_meta )
+ {
+ // Use Title or fall back to psz_name
+ const char *psz_title = vlc_meta_Get( p_item->p_input->p_meta, vlc_meta_Title );
+ if( !psz_title )
+ psz_title = p_item->p_input->psz_name;
+ const char *psz_album = vlc_meta_Get( p_item->p_input->p_meta, vlc_meta_Album );
+ const char *psz_artist = vlc_meta_Get( p_item->p_input->p_meta, vlc_meta_Artist );
+ b_enable = ( psz_title && strcasestr( psz_title, psz_string ) ) ||
+ ( psz_album && strcasestr( psz_album, psz_string ) ) ||
+ ( psz_artist && strcasestr( psz_artist, psz_string ) );
+ }
+ else
+ b_enable = p_item->p_input->psz_name && strcasestr( p_item->p_input->psz_name, psz_string );
+ vlc_mutex_unlock( &p_item->p_input->lock );
+ }
+
+ if( b_enable )