Browse Source

macosx/framework: Added [VLCMediaList initWithArray:] method

Signed-off-by: Pierre d'Herbemont <pdherbemont@free.fr>
Emmanuel de Roux 15 years ago
parent
commit
cc437cbc70
2 changed files with 17 additions and 0 deletions
  1. 6 0
      Headers/Public/VLCMediaList.h
  2. 11 0
      Sources/VLCMediaList.m

+ 6 - 0
Headers/Public/VLCMediaList.h

@@ -57,6 +57,12 @@ extern NSString * VLCMediaListItemDeleted;
     NSMutableArray * cachedMedia;                   //< Private copy of media objects.
 }
 
+/**
+ * Init a MediaList with the media contained in array.
+ * \array an array of VLCMedia.
+ */
+- (id)initWithArray:(NSArray *)array;
+
 /* Operations */
 /**
  * TODO: Documentation - [VLCMediaList lock]

+ 11 - 0
Sources/VLCMediaList.m

@@ -86,6 +86,17 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
     return self;
 }
 
+- (id)initWithArray:(NSArray *)array
+{
+    self = [self init];
+    if (!self)
+        return nil;
+
+    for (VLCMedia *media in array)
+        [self addMedia:media];
+    return self;
+}
+
 - (void)release
 {
     @synchronized(self)