]> git.sesse.net Git - vlc/commitdiff
macosx/framework: Don't automatically fetch meta, only when asked.
authorPierre d'Herbemont <pdherbemont@free.fr>
Fri, 11 Dec 2009 15:17:33 +0000 (16:17 +0100)
committerPierre d'Herbemont <pdherbemont@free.fr>
Fri, 11 Dec 2009 15:19:53 +0000 (16:19 +0100)
This saves some precious memory if we don't browse them.

projects/macosx/framework/Headers/Public/VLCMedia.h
projects/macosx/framework/Sources/VLCMedia.m

index 6293ffc5561b7ff4868333f8ee8fcea6d0c58a3c..030275824c25c9b9c7b90cd2b9c3979d9597d1cc 100644 (file)
@@ -113,7 +113,8 @@ typedef enum VLCMediaState
     VLCTime *             length;            //< Cached duration of the media
     NSMutableDictionary * metaDictionary;    //< Meta data storage
     id                    delegate;          //< Delegate object
-    BOOL                  artFetched;        //< Value used to determine of the artwork has been preparsed
+    BOOL                  isArtFetched;      //< Value used to determine of the artwork has been preparsed
+    BOOL                  areOthersMetaFetched; //< Value used to determine of the other meta has been preparsed
     VLCMediaState         state;             //< Current state of the media
 }
 
index f22fb6f461837dfcad1c8d6de264f6925ee6c91d..11a0f334b21d2d09abb543056393cc569c20e13b 100644 (file)
@@ -428,8 +428,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     libvlc_exception_t ex;
     libvlc_exception_init( &ex );
 
-    artFetched = NO;
-
     char * p_url = libvlc_media_get_mrl( p_md );
 
     url = [[NSURL URLWithString:[NSString stringWithUTF8String:p_url]] retain];
@@ -456,10 +454,6 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
     }
 
     state = LibVLCStateToMediaState(libvlc_media_get_state( p_md ));
-
-    /* Force VLCMetaInformationTitle, that will trigger preparsing
-     * And all the other meta will be added through the libvlc event system */
-    [self fetchMetaInformationFromLibVLCWithType: VLCMetaInformationTitle];
 }
 
 - (void)fetchMetaInformationFromLibVLCWithType:(NSString *)metaType
@@ -542,12 +536,20 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
 
 - (id)valueForKeyPath:(NSString *)keyPath
 {
-    if( !artFetched && [keyPath isEqualToString:@"metaDictionary.artwork"])
+    if( !isArtFetched && [keyPath isEqualToString:@"metaDictionary.artwork"])
     {
-        artFetched = YES;
+        isArtFetched = YES;
         /* Force the retrieval of the artwork now that someone asked for it */
         [self fetchMetaInformationFromLibVLCWithType: VLCMetaInformationArtworkURL];
     }
+    else if( !areOthersMetaFetched && [keyPath hasPrefix:@"metaDictionary."])
+    {
+        areOthersMetaFetched = YES;
+        /* Force VLCMetaInformationTitle, that will trigger preparsing
+         * And all the other meta will be added through the libvlc event system */
+        [self fetchMetaInformationFromLibVLCWithType: VLCMetaInformationTitle];
+    }
+
     return [super valueForKeyPath:keyPath];
 }
 @end