Browse Source

MacOSX/Framework/VLCMediaListAspect.m: Implement -hierarchicalAspect and -flatAspect. (And add an internal @interface for VLCMediaListAspect (LibVLCBridging)).

Pierre d'Herbemont 17 years ago
parent
commit
0d75472491

+ 9 - 2
Headers/Internal/VLCLibVLCBridging.h

@@ -1,5 +1,5 @@
 /*****************************************************************************
-* VLCLibVLCbridging.h: VLC.framework VLCLibVLCBridging header
+* VLCLibVLCbridging.h: VLC.framework VLCLibVLCBridging (Private) header
 *****************************************************************************
 * Copyright (C) 2007 Pierre d'Herbemont
 * Copyright (C) 2007 the VideoLAN team
@@ -22,7 +22,7 @@
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/
 
-#include "VLCLibrary.h"
+#import "VLCLibrary.h"
 
 // TODO: Documentation
 @interface VLCMediaList (LibVLCBridging)
@@ -57,6 +57,7 @@
 - (void *)libVLCMediaDescriptor;
 @end
 
+
 // TODO: Documentation
 @interface VLCMedia (VLCMediaPlayerBridging)
 - (void)setLength:(VLCTime *)value;
@@ -68,6 +69,12 @@
 - (void *)instance;
 @end
 
+@interface VLCMediaListAspect (VLCLibVLCBridging)
++ (id)mediaListAspectWithLibVLCMediaListView:(libvlc_media_list_view_t *)p_new_mlv;
+- (id)initWithLibVLCMediaListView:(libvlc_media_list_view_t *)p_new_mlv;
+- (libvlc_media_list_view_t *)libVLCMediaListView;
+@end
+
 // TODO: Documentation
 @interface VLCLibrary (VLCAudioBridging)
 - (void)setAudio:(VLCAudio *)value;

+ 1 - 0
Headers/Public/VLC.h

@@ -28,6 +28,7 @@
 #import <VLC/VLCMedia.h>
 #import <VLC/VLCMediaLibrary.h>
 #import <VLC/VLCMediaList.h>
+#import <VLC/VLCMediaListAspect.h>
 #import <VLC/VLCTime.h>
 #import <VLC/VLCVideoView.h>
 

+ 5 - 0
Headers/Public/VLCMediaList.h

@@ -30,6 +30,7 @@ extern NSString * VLCMediaListItemDeleted;
 
 @class VLCMedia;
 @class VLCMediaList;
+@class VLCMediaListAspect;
 
 // TODO: Documentation
 @protocol VLCMediaListDelegate
@@ -58,4 +59,8 @@ extern NSString * VLCMediaListItemDeleted;
 - (VLCMedia *)mediaAtIndex:(int)index;
 - (int)indexOfMedia:(VLCMedia *)media;
 - (int)count;
+
+/* Media list aspect */
+- (VLCMediaListAspect *)hierarchicalAspect;
+- (VLCMediaListAspect *)flatAspect;
 @end

+ 20 - 0
Sources/VLCMediaList.m

@@ -222,6 +222,26 @@ static void HandleMediaListWillDeleteItem(const libvlc_event_t *event, void *use
     
     return result;
 }
+
+/* Media list aspect */
+- (VLCMediaListAspect *)hierarchicalAspect
+{
+    VLCMediaListAspect * hierarchicalAspect;
+    libvlc_media_list_view_t * p_mlv = libvlc_media_list_hierarchical_view( p_mlist, NULL );
+    hierarchicalAspect = [VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv];
+    libvlc_media_list_view_release( p_mlv );
+    return hierarchicalAspect;
+}
+
+- (VLCMediaListAspect *)flatAspect
+{
+    VLCMediaListAspect * flatAspect;
+    libvlc_media_list_view_t * p_mlv = libvlc_media_list_flat_view( p_mlist, NULL );
+    flatAspect = [VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv];
+    libvlc_media_list_view_release( p_mlv );
+    return flatAspect;
+}
+
 @end
 
 @implementation VLCMediaList (LibVLCBridging)

+ 4 - 4
Sources/VLCMediaListAspect.m

@@ -105,12 +105,12 @@ static void HandleMediaListViewWillDeleteItem(const libvlc_event_t *event, void
 @end
 
 @implementation VLCMediaListAspect (LibVLCBridging)
-+ (id)mediaListAspectWithLibVLCMediaListView:(void *)p_new_mlv;
++ (id)mediaListAspectWithLibVLCMediaListView:(libvlc_media_list_view_t *)p_new_mlv;
 {
     return [[[VLCMediaList alloc] initWithLibVLCMediaList:p_new_mlv] autorelease];
 }
 
-- (id)initWithLibVLCMediaListView:(void *)p_new_mlv;
+- (id)initWithLibVLCMediaListView:(libvlc_media_list_view_t *)p_new_mlv;
 {
     if( self = [super init] )
     {
@@ -121,9 +121,9 @@ static void HandleMediaListViewWillDeleteItem(const libvlc_event_t *event, void
     return self;
 }
 
-- (void *)libVLCMediaListView
+- (libvlc_media_list_view_t *)libVLCMediaListView
 {
-    return p_mlv;
+    return (libvlc_media_list_view_t *)p_mlv;
 }
 @end