MacOSX/Framework/VLCMediaListAspect.m: Implement -parentMediaList.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 28 Dec 2007 18:25:03 +0000 (18:25 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Fri, 28 Dec 2007 18:25:03 +0000 (18:25 +0000)
extras/MacOSX/Framework/Headers/Public/VLCMediaListAspect.h
extras/MacOSX/Framework/Sources/VLCMediaListAspect.m

index 2e84c82..35e8450 100644 (file)
 {
     void * p_mlv;                //< Internal instance of media list view
     NSMutableArray * cachedNode;
+    VLCMediaList *parentMediaList;
 }
-
 - (VLCMedia *)mediaAtIndex:(int)index;
 - (VLCMediaListAspectNode *)nodeAtIndex:(int)index;
 - (int)count;
-@end
\ No newline at end of file
+
+- (VLCMediaList *)parentMediaList;
+@end
index d4add8c..dd02aa9 100644 (file)
@@ -105,6 +105,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
     // Release allocated memory
     libvlc_media_list_view_release(p_mlv);
     [cachedNode release];
+    [parentMediaList release];
     [super dealloc];
 }
 - (VLCMedia *)mediaAtIndex:(int)index
@@ -150,6 +151,11 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
 
     return result;
 }
+
+- (VLCMediaList *)parentMediaList
+{
+    return [[parentMediaList retain] autorelease];
+}
 @end
 
 @implementation VLCMediaListAspect (LibVLCBridging)
@@ -164,6 +170,10 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
     {
         p_mlv = p_new_mlv;
         libvlc_media_list_view_retain(p_mlv);
+        libvlc_media_list_t * p_mlist = libvlc_media_list_view_parent_media_list(p_mlv, NULL);
+        parentMediaList = [[VLCMediaList mediaListWithLibVLCMediaList: p_mlist] retain];
+        libvlc_media_list_release( p_mlist );
+
         //libvlc_media_list_lock(p_mlv->p_mlist);
         cachedNode = [[NSMutableArray alloc] initWithCapacity:libvlc_media_list_view_count(p_mlv, NULL)];
         int i, count = libvlc_media_list_view_count(p_mlv, NULL);