[vlc-devel] commit: libvlc: Don't request art if it was already asked before. (Pierre d 'Herbemont )

git version control git at videolan.org
Sat Jan 16 18:26:15 CET 2010


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Sat Jan 16 16:22:09 2010 +0100| [427d73cdc8d5e9cae41a605cc658f82c58c64556] | committer: Pierre d'Herbemont 

libvlc: Don't request art if it was already asked before.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=427d73cdc8d5e9cae41a605cc658f82c58c64556
---

 src/control/media.c          |    7 +++----
 src/control/media_internal.h |    1 +
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/control/media.c b/src/control/media.c
index 07c8b08..cdcfb1c 100644
--- a/src/control/media.c
+++ b/src/control/media.c
@@ -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 );
diff --git a/src/control/media_internal.h b/src/control/media_internal.h
index 7afd8dc..650f71d 100644
--- a/src/control/media_internal.h
+++ b/src/control/media_internal.h
@@ -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 */




More information about the vlc-devel mailing list