[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media",
[NSNumber numberWithInt:event->u.media_list_item_added.index], @"index",
nil]]];
- [pool release];
+ [pool drain];
}
static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * user_data)
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemRemoved:)
withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]];
- [pool release];
+ [pool drain];
}
@implementation VLCMediaList
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)
[media retain];
// Add it to the libvlc's medialist
- libvlc_exception_t p_e;
- libvlc_exception_init( &p_e );
- libvlc_media_list_insert_media( p_mlist, [media libVLCMediaDescriptor], index, &p_e );
- catch_exception( &p_e );
+ libvlc_media_list_insert_media(p_mlist, [media libVLCMediaDescriptor], index);
}
- (void)removeMediaAtIndex:(NSInteger)index
[[self mediaAtIndex:index] release];
// Remove it from the libvlc's medialist
- libvlc_exception_t p_e;
- libvlc_exception_init( &p_e );
- libvlc_media_list_remove_index( p_mlist, index, &p_e );
- catch_exception( &p_e );
+ libvlc_media_list_remove_index(p_mlist, index);
}
- (VLCMedia *)mediaAtIndex:(NSInteger)index
NSUInteger i, count = libvlc_media_list_count(p_mlist);
for( i = 0; i < count; i++ )
{
- libvlc_media_t * p_md = libvlc_media_list_item_at_index( p_mlist, i, NULL );
+ libvlc_media_t * p_md = libvlc_media_list_item_at_index(p_mlist, i);
[cachedMedia addObject:[VLCMedia mediaWithLibVLCMediaDescriptor:p_md]];
libvlc_media_release(p_md);
}