]> git.sesse.net Git - vlc/blobdiff - lib/media.c
input: Add support for AlbumArtist meta
[vlc] / lib / media.c
index ef845cd7e855bd2186c9a1a5302b51b62184fac4..3caaf5b98046b8c887af12c35e9c0283a51373c5 100644 (file)
@@ -26,6 +26,7 @@
 #endif
 
 #include <assert.h>
+#include <errno.h>
 
 #include <vlc/libvlc.h>
 #include <vlc/libvlc_media.h>
@@ -67,7 +68,8 @@ static const vlc_meta_type_t libvlc_to_vlc_meta[] =
     [libvlc_meta_Season]       = vlc_meta_Season,
     [libvlc_meta_Episode]      = vlc_meta_Episode,
     [libvlc_meta_ShowName]     = vlc_meta_ShowName,
-    [libvlc_meta_Actors]       = vlc_meta_Actors
+    [libvlc_meta_Actors]       = vlc_meta_Actors,
+    [libvlc_meta_AlbumArtist]  = vlc_meta_AlbumArtist
 };
 
 static const libvlc_meta_t vlc_to_libvlc_meta[] =
@@ -94,7 +96,8 @@ static const libvlc_meta_t vlc_to_libvlc_meta[] =
     [vlc_meta_Season]       = libvlc_meta_Season,
     [vlc_meta_Episode]      = libvlc_meta_Episode,
     [vlc_meta_ShowName]     = libvlc_meta_ShowName,
-    [vlc_meta_Actors]       = libvlc_meta_Actors
+    [vlc_meta_Actors]       = libvlc_meta_Actors,
+    [vlc_meta_AlbumArtist]  = libvlc_meta_AlbumArtist
 };
 
 /**************************************************************************
@@ -112,15 +115,14 @@ static void input_item_subitem_added( const vlc_event_t *p_event,
                 p_event->u.input_item_subitem_added.p_new_child );
 
     /* Add this to our media list */
-    if( !p_md->p_subitems )
+    if( p_md->p_subitems == NULL )
     {
         p_md->p_subitems = libvlc_media_list_new( p_md->p_libvlc_instance );
+        if( unlikely(p_md->p_subitems == NULL) )
+            abort();
         libvlc_media_list_set_media( p_md->p_subitems, p_md );
     }
-    if( p_md->p_subitems )
-    {
-        libvlc_media_list_add_media( p_md->p_subitems, p_md_child );
-    }
+    libvlc_media_list_add_media( p_md->p_subitems, p_md_child );
 
     /* Construct the event */
     event.type = libvlc_MediaSubItemAdded;
@@ -355,7 +357,7 @@ libvlc_media_t *libvlc_media_new_path( libvlc_instance_t *p_instance,
     char *mrl = vlc_path2uri( path, NULL );
     if( unlikely(mrl == NULL) )
     {
-        libvlc_printerr( "Not enough memory" );
+        libvlc_printerr( "%s", vlc_strerror_c(errno) );
         return NULL;
     }
 
@@ -633,8 +635,8 @@ static int media_parse(libvlc_media_t *media)
     input_item_t *item = media->p_input_item;
 
     /* TODO: Fetch art on need basis. But how not to break compatibility? */
-    libvlc_ArtRequest(libvlc, item);
-    return libvlc_MetaRequest(libvlc, item);
+    libvlc_ArtRequest(libvlc, item, META_REQUEST_OPTION_NONE);
+    return libvlc_MetaRequest(libvlc, item, META_REQUEST_OPTION_NONE);
 }
 
 /**************************************************************************