]> git.sesse.net Git - vlc/commitdiff
libvlc: Don't request art if it was already asked before.
authorPierre d'Herbemont <pdherbemont@free.fr>
Sat, 16 Jan 2010 15:22:09 +0000 (16:22 +0100)
committerPierre d'Herbemont <pdherbemont@free.fr>
Sat, 16 Jan 2010 17:26:08 +0000 (18:26 +0100)
src/control/media.c
src/control/media_internal.h

index 07c8b081975f05d8cb9fac7a1f53c39c23fcfec1..cdcfb1cb1e57b1529d0d5b12247d260e88a60783 100644 (file)
@@ -252,7 +252,7 @@ libvlc_media_t * libvlc_media_new_from_input_item(
         return NULL;
     }
 
-    p_md = malloc( sizeof(libvlc_media_t) );
+    p_md = calloc( sizeof(libvlc_media_t), 1 );
     if( !p_md )
     {
         libvlc_exception_raise( p_e );
@@ -262,9 +262,7 @@ libvlc_media_t * libvlc_media_new_from_input_item(
 
     p_md->p_libvlc_instance = p_instance;
     p_md->p_input_item      = p_input_item;
-    p_md->b_preparsed       = false;
     p_md->i_refcount        = 1;
-    p_md->p_user_data       = NULL;
 
     p_md->state = libvlc_NothingSpecial;
 
@@ -453,8 +451,9 @@ char *libvlc_media_get_meta( libvlc_media_t *p_md, libvlc_meta_t e_meta )
     psz_meta = input_item_GetMeta( p_md->p_input_item,
                                    libvlc_to_vlc_meta[e_meta] );
 
-    if( e_meta == libvlc_meta_ArtworkURL && !psz_meta )
+    if( e_meta == libvlc_meta_ArtworkURL && !psz_meta && !p_md->has_asked_art )
     {
+        p_md->has_asked_art = true;
         playlist_AskForArtEnqueue(
                 libvlc_priv(p_md->p_libvlc_instance->p_libvlc_int)->p_playlist,
                 p_md->p_input_item, pl_Unlocked );
index 7afd8dc477b707277fd3ca65897d4525c935b045..650f71d14e837a58b3506bae6727db0c3387f038 100644 (file)
@@ -41,6 +41,7 @@ struct libvlc_media_t
     libvlc_state_t     state;
     VLC_FORWARD_DECLARE_OBJECT(libvlc_media_list_t*) p_subitems; /* A media descriptor can have Sub items. This is the only dependancy we really have on media_list */
     void *p_user_data;
+    bool has_asked_art;
 };
 
 /* Media Descriptor */