瀏覽代碼

MacOSX/Framework/VLCMediaListAspect.m: Implement -parentMediaList.

Pierre d'Herbemont 17 年之前
父節點
當前提交
bbae8953c4
共有 2 個文件被更改,包括 14 次插入2 次删除
  1. 4 2
      Headers/Public/VLCMediaListAspect.h
  2. 10 0
      Sources/VLCMediaListAspect.m

+ 4 - 2
Headers/Public/VLCMediaListAspect.h

@@ -41,9 +41,11 @@
 {
     void * p_mlv;                //< Internal instance of media list view
     NSMutableArray * cachedNode;
+    VLCMediaList *parentMediaList;
 }
-
 - (VLCMedia *)mediaAtIndex:(int)index;
 - (VLCMediaListAspectNode *)nodeAtIndex:(int)index;
 - (int)count;
-@end
+
+- (VLCMediaList *)parentMediaList;
+@end

+ 10 - 0
Sources/VLCMediaListAspect.m

@@ -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);