Commit 1334901b authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCMediaList.m: Implement -description: and fix -flatAspect...

MacOSX/Framework/VLCMediaList.m: Implement -description: and fix -flatAspect and -hierarchicalAspect when used with bindings.
parent 2ea15499
......@@ -44,6 +44,8 @@ extern NSString * VLCMediaListItemDeleted;
void * p_mlist; //< Internal instance of media list
id <VLCMediaListDelegate,NSObject> delegate; //< Delegate object
NSMutableArray *cachedMedia; /* We need that private copy because of Cocoa Bindings, that need to be working on first thread */
VLCMediaListAspect * flatAspect;
VLCMediaListAspect * hierarchicalAspect;
}
/* Properties */
......
......@@ -93,7 +93,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
// Initialize internals to defaults
cachedMedia = [[NSMutableArray alloc] init];
delegate = nil;
delegate = flatAspect = hierarchicalAspect = nil;
[self initInternalMediaList];
}
return self;
......@@ -121,9 +121,24 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
// Release allocated memory
libvlc_media_list_release(p_mlist);
[cachedMedia release];
[flatAspect release];
[hierarchicalAspect release];
[super dealloc];
}
- (NSString *)description
{
NSMutableString *content = [NSMutableString string];
int i;
[self lock];
for( i = 0; i < [self count]; i++)
{
[content appendFormat:@"%@\n", [self mediaAtIndex: i]];
}
[self unlock];
return [NSString stringWithFormat:@"<%@ %p> {\n%@}", [self className], self, content];
}
- (void)setDelegate:(id)value
{
delegate = value;
......@@ -196,18 +211,20 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
/* Media list aspect */
- (VLCMediaListAspect *)hierarchicalAspect
{
VLCMediaListAspect * hierarchicalAspect;
if( hierarchicalAspect )
return hierarchicalAspect;
libvlc_media_list_view_t * p_mlv = libvlc_media_list_hierarchical_view( p_mlist, NULL );
hierarchicalAspect = [VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv];
hierarchicalAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv] retain];
libvlc_media_list_view_release( p_mlv );
return hierarchicalAspect;
}
- (VLCMediaListAspect *)flatAspect
{
VLCMediaListAspect * flatAspect;
if( flatAspect )
return flatAspect;
libvlc_media_list_view_t * p_mlv = libvlc_media_list_flat_view( p_mlist, NULL );
flatAspect = [VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv];
flatAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView: p_mlv] retain];
libvlc_media_list_view_release( p_mlv );
return flatAspect;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment