Commit 7963ddf0 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

macosx/framework: Remove the newly removed exception parameter.

Most of them where already NULL, saying how meaningless it was.
parent 12a36253
...@@ -62,21 +62,21 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -62,21 +62,21 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
@protocol VLCMediaPlayerDelegate @protocol VLCMediaPlayerDelegate
/** /**
* Sent by the default notification center whenever the player's time has changed. * Sent by the default notification center whenever the player's time has changed.
* \details Discussion The value of aNotification is always an VLCMediaPlayerTimeChanged notification. You can retrieve * \details Discussion The value of aNotification is always an VLCMediaPlayerTimeChanged notification. You can retrieve
* the VLCMediaPlayer object in question by sending object to aNotification. * the VLCMediaPlayer object in question by sending object to aNotification.
*/ */
- (void)mediaPlayerTimeChanged:(NSNotification *)aNotification; - (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
/** /**
* Sent by the default notification center whenever the player's state has changed. * Sent by the default notification center whenever the player's state has changed.
* \details Discussion The value of aNotification is always an VLCMediaPlayerStateChanged notification. You can retrieve * \details Discussion The value of aNotification is always an VLCMediaPlayerStateChanged notification. You can retrieve
* the VLCMediaPlayer object in question by sending object to aNotification. * the VLCMediaPlayer object in question by sending object to aNotification.
*/ */
- (void)mediaPlayerStateChanged:(NSNotification *)aNotification; - (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
@end @end
// TODO: Should we use medialist_player or our own flavor of media player? // TODO: Should we use medialist_player or our own flavor of media player?
@interface VLCMediaPlayer : NSObject @interface VLCMediaPlayer : NSObject
{ {
id delegate; //< Object delegate id delegate; //< Object delegate
void * instance; // Internal void * instance; // Internal
...@@ -110,9 +110,6 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -110,9 +110,6 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (void)setVideoCropGeometry:(char *)value; - (void)setVideoCropGeometry:(char *)value;
- (char *)videoCropGeometry; - (char *)videoCropGeometry;
- (void)setVideoTeleText:(NSUInteger)value;
- (NSUInteger)videoTeleText;
/** /**
* Take a snapshot of the current video. * Take a snapshot of the current video.
* *
...@@ -148,7 +145,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -148,7 +145,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
*/ */
- (void)setTime:(VLCTime *)value; - (void)setTime:(VLCTime *)value;
/** /**
* Returns the current position (or time) of the feed. * Returns the current position (or time) of the feed.
* \return VLCTIme object with current time. * \return VLCTIme object with current time.
*/ */
...@@ -228,8 +225,8 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -228,8 +225,8 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
/* Playback Operations */ /* Playback Operations */
/** /**
* Plays a media resource using the currently selected media controller (or * Plays a media resource using the currently selected media controller (or
* default controller. If feed was paused then the feed resumes at the position * default controller. If feed was paused then the feed resumes at the position
* it was paused in. * it was paused in.
* \return A Boolean determining whether the stream was played or not. * \return A Boolean determining whether the stream was played or not.
*/ */
...@@ -339,7 +336,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -339,7 +336,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (VLCMediaPlayerState)state; - (VLCMediaPlayerState)state;
/** /**
* Returns the receiver's position in the reading. * Returns the receiver's position in the reading.
* \return A number between 0 and 1. indicating the position * \return A number between 0 and 1. indicating the position
*/ */
- (float)position; - (float)position;
......
...@@ -231,10 +231,10 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self) ...@@ -231,10 +231,10 @@ static void HandleMediaSubItemAdded(const libvlc_event_t * event, void * self)
* We also may receive a -retain in some event callback that may occcur * We also may receive a -retain in some event callback that may occcur
* Before libvlc_event_detach. So this can't happen in dealloc */ * Before libvlc_event_detach. So this can't happen in dealloc */
libvlc_event_manager_t * p_em = libvlc_media_event_manager(p_md); libvlc_event_manager_t * p_em = libvlc_media_event_manager(p_md);
libvlc_event_detach(p_em, libvlc_MediaMetaChanged, HandleMediaMetaChanged, self, NULL); libvlc_event_detach(p_em, libvlc_MediaMetaChanged, HandleMediaMetaChanged, self);
libvlc_event_detach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self, NULL); libvlc_event_detach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self);
libvlc_event_detach(p_em, libvlc_MediaStateChanged, HandleMediaStateChanged, self, NULL); libvlc_event_detach(p_em, libvlc_MediaStateChanged, HandleMediaStateChanged, self);
libvlc_event_detach(p_em, libvlc_MediaSubItemAdded, HandleMediaSubItemAdded, self, NULL); libvlc_event_detach(p_em, libvlc_MediaSubItemAdded, HandleMediaSubItemAdded, self);
} }
[super release]; [super release];
} }
......
...@@ -52,8 +52,8 @@ static void HandleMediaDiscovererStarted(const libvlc_event_t * event, void * us ...@@ -52,8 +52,8 @@ static void HandleMediaDiscovererStarted(const libvlc_event_t * event, void * us
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self [[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaDiscovererStarted) withMethod:@selector(mediaDiscovererStarted)
withArgumentAsObject:nil]; withArgumentAsObject:nil];
[pool release]; [pool release];
} }
...@@ -62,13 +62,13 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use ...@@ -62,13 +62,13 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self [[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaDiscovererEnded) withMethod:@selector(mediaDiscovererEnded)
withArgumentAsObject:nil]; withArgumentAsObject:nil];
[pool release]; [pool release];
} }
@implementation VLCMediaDiscoverer @implementation VLCMediaDiscoverer
+ (NSArray *)availableMediaDiscoverer + (NSArray *)availableMediaDiscoverer
{ {
...@@ -90,17 +90,19 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use ...@@ -90,17 +90,19 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
if (self = [super init]) if (self = [super init])
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init(&ex);
localizedName = nil; localizedName = nil;
discoveredMedia = nil; discoveredMedia = nil;
mdis = libvlc_media_discoverer_new_from_name( [VLCLibrary sharedInstance], mdis = libvlc_media_discoverer_new_from_name([VLCLibrary sharedInstance],
[aServiceName UTF8String], [aServiceName UTF8String],
&ex ); &ex);
catch_exception( &ex ); catch_exception(&ex);
libvlc_event_manager_t * p_em = libvlc_media_discoverer_event_manager(mdis); libvlc_event_manager_t * p_em = libvlc_media_discoverer_event_manager(mdis);
libvlc_event_attach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self, NULL); libvlc_event_attach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self, &ex);
libvlc_event_attach(p_em, libvlc_MediaDiscovererEnded, HandleMediaDiscovererEnded, self, NULL); libvlc_event_attach(p_em, libvlc_MediaDiscovererEnded, HandleMediaDiscovererEnded, self, &ex);
catch_exception( &ex );
running = libvlc_media_discoverer_is_running(mdis); running = libvlc_media_discoverer_is_running(mdis);
} }
return self; return self;
...@@ -115,9 +117,9 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use ...@@ -115,9 +117,9 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
/* We must make sure we won't receive new event after an upcoming dealloc /* We must make sure we won't receive new event after an upcoming dealloc
* We also may receive a -retain in some event callback that may occcur * We also may receive a -retain in some event callback that may occcur
* Before libvlc_event_detach. So this can't happen in dealloc */ * Before libvlc_event_detach. So this can't happen in dealloc */
libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(mdis, NULL); libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(mdis);
libvlc_event_detach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self, NULL); libvlc_event_detach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self);
libvlc_event_detach(p_em, libvlc_MediaDiscovererEnded, HandleMediaDiscovererEnded, self, NULL); libvlc_event_detach(p_em, libvlc_MediaDiscovererEnded, HandleMediaDiscovererEnded, self);
} }
[super release]; [super release];
} }
...@@ -148,7 +150,7 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use ...@@ -148,7 +150,7 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
{ {
if ( localizedName ) if ( localizedName )
return localizedName; return localizedName;
char * name = libvlc_media_discoverer_localized_name( mdis ); char * name = libvlc_media_discoverer_localized_name( mdis );
if (name) if (name)
{ {
......
...@@ -52,8 +52,8 @@ static void HandleMediaListItemAdded(const libvlc_event_t * event, void * user_d ...@@ -52,8 +52,8 @@ static void HandleMediaListItemAdded(const libvlc_event_t * event, void * user_d
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self [[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemAdded:) withMethod:@selector(mediaListItemAdded:)
withArgumentAsObject:[NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys: withArgumentAsObject:[NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media", [VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media",
[NSNumber numberWithInt:event->u.media_list_item_added.index], @"index", [NSNumber numberWithInt:event->u.media_list_item_added.index], @"index",
...@@ -65,8 +65,8 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -65,8 +65,8 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self [[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemRemoved:) withMethod:@selector(mediaListItemRemoved:)
withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]]; withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]];
[pool release]; [pool release];
} }
...@@ -81,7 +81,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -81,7 +81,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
libvlc_exception_init( &p_e ); libvlc_exception_init( &p_e );
p_mlist = libvlc_media_list_new( [VLCLibrary sharedInstance], &p_e ); p_mlist = libvlc_media_list_new( [VLCLibrary sharedInstance], &p_e );
catch_exception( &p_e ); catch_exception( &p_e );
// Initialize internals to defaults // Initialize internals to defaults
cachedMedia = [[NSMutableArray alloc] init]; cachedMedia = [[NSMutableArray alloc] init];
delegate = flatAspect = hierarchicalAspect = hierarchicalNodeAspect = nil; delegate = flatAspect = hierarchicalAspect = hierarchicalNodeAspect = nil;
...@@ -99,9 +99,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -99,9 +99,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
/* We must make sure we won't receive new event after an upcoming dealloc /* We must make sure we won't receive new event after an upcoming dealloc
* We also may receive a -retain in some event callback that may occcur * We also may receive a -retain in some event callback that may occcur
* Before libvlc_event_detach. So this can't happen in dealloc */ * Before libvlc_event_detach. So this can't happen in dealloc */
libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(p_mlist, NULL); libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(p_mlist);
libvlc_event_detach(p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self, NULL); libvlc_event_detach(p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self);
libvlc_event_detach(p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self, NULL); libvlc_event_detach(p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self);
} }
[super release]; [super release];
} }
...@@ -111,7 +111,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -111,7 +111,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{ {
// Release allocated memory // Release allocated memory
delegate = nil; delegate = nil;
libvlc_media_list_release( p_mlist ); libvlc_media_list_release( p_mlist );
[cachedMedia release]; [cachedMedia release];
[flatAspect release]; [flatAspect release];
...@@ -177,11 +177,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -177,11 +177,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (NSInteger)indexOfMedia:(VLCMedia *)media - (NSInteger)indexOfMedia:(VLCMedia *)media
{ {
libvlc_exception_t p_e; NSInteger result = libvlc_media_list_index_of_item(p_mlist, [media libVLCMediaDescriptor]);
libvlc_exception_init( &p_e );
NSInteger result = libvlc_media_list_index_of_item( p_mlist, [media libVLCMediaDescriptor], &p_e );
catch_exception( &p_e );
return result; return result;
} }
...@@ -209,7 +205,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -209,7 +205,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
libvlc_exception_init( &p_e ); libvlc_exception_init( &p_e );
BOOL isReadOnly = libvlc_media_list_is_readonly( p_mlist ); BOOL isReadOnly = libvlc_media_list_is_readonly( p_mlist );
catch_exception( &p_e ); catch_exception( &p_e );
return isReadOnly; return isReadOnly;
} }
...@@ -218,7 +214,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -218,7 +214,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{ {
if( hierarchicalAspect ) if( hierarchicalAspect )
return hierarchicalAspect; return hierarchicalAspect;
libvlc_media_list_view_t * p_mlv = libvlc_media_list_hierarchical_view( p_mlist, NULL ); libvlc_media_list_view_t * p_mlv = libvlc_media_list_hierarchical_view( p_mlist, NULL );
hierarchicalAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_mlv andMediaList:self] retain]; hierarchicalAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_mlv andMediaList:self] retain];
libvlc_media_list_view_release( p_mlv ); libvlc_media_list_view_release( p_mlv );
...@@ -229,7 +225,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -229,7 +225,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{ {
if( hierarchicalNodeAspect ) if( hierarchicalNodeAspect )
return hierarchicalNodeAspect; return hierarchicalNodeAspect;
libvlc_media_list_view_t * p_mlv = libvlc_media_list_hierarchical_node_view( p_mlist, NULL ); libvlc_media_list_view_t * p_mlv = libvlc_media_list_hierarchical_node_view( p_mlist, NULL );
hierarchicalNodeAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_mlv andMediaList:self] retain]; hierarchicalNodeAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_mlv andMediaList:self] retain];
libvlc_media_list_view_release( p_mlv ); libvlc_media_list_view_release( p_mlv );
...@@ -240,7 +236,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -240,7 +236,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{ {
if( flatAspect ) if( flatAspect )
return flatAspect; return flatAspect;
libvlc_media_list_view_t * p_mlv = libvlc_media_list_flat_view( p_mlist, NULL ); libvlc_media_list_view_t * p_mlv = libvlc_media_list_flat_view( p_mlist, NULL );
flatAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_mlv andMediaList:self] retain]; flatAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_mlv andMediaList:self] retain];
libvlc_media_list_view_release( p_mlv ); libvlc_media_list_view_release( p_mlv );
...@@ -262,9 +258,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -262,9 +258,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
p_mlist = p_new_mlist; p_mlist = p_new_mlist;
libvlc_media_list_retain( p_mlist ); libvlc_media_list_retain( p_mlist );
libvlc_media_list_lock( p_mlist ); libvlc_media_list_lock( p_mlist );
cachedMedia = [[NSMutableArray alloc] initWithCapacity:libvlc_media_list_count( p_mlist, NULL )]; cachedMedia = [[NSMutableArray alloc] initWithCapacity:libvlc_media_list_count(p_mlist)];
NSUInteger i, count = libvlc_media_list_count( p_mlist, NULL ); NSUInteger i, count = libvlc_media_list_count(p_mlist);
for( i = 0; i < count; i++ ) 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, NULL );
...@@ -290,10 +286,10 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -290,10 +286,10 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
libvlc_exception_t p_e; libvlc_exception_t p_e;
libvlc_exception_init( &p_e ); libvlc_exception_init( &p_e );
libvlc_event_manager_t * p_em = libvlc_media_list_event_manager( p_mlist, &p_e ); libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(p_mlist);
libvlc_event_attach( p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self, &p_e ); libvlc_event_attach( p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self, &p_e );
libvlc_event_attach( p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self, &p_e ); libvlc_event_attach( p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self, &p_e );
catch_exception( &p_e ); catch_exception( &p_e );
} }
...@@ -333,7 +329,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use ...@@ -333,7 +329,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:[index intValue]] forKey:@"media"]; [self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:[index intValue]] forKey:@"media"];
// Post the notification // Post the notification
[[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemDeleted [[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemDeleted
object:self object:self
userInfo:[NSDictionary dictionaryWithObjectsAndKeys: userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
index, @"index", index, @"index",
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
if(self = [super init]) if(self = [super init])
{ {
media = nil; media = nil;
children = nil; children = nil;
} }
return self; return self;
} }
...@@ -95,8 +95,8 @@ static void HandleMediaListViewItemAdded(const libvlc_event_t * event, void * us ...@@ -95,8 +95,8 @@ static void HandleMediaListViewItemAdded(const libvlc_event_t * event, void * us
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self [[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListViewItemAdded:) withMethod:@selector(mediaListViewItemAdded:)
withArgumentAsObject:[NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys: withArgumentAsObject:[NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media", [VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media",
[NSNumber numberWithInt:event->u.media_list_item_added.index], @"index", [NSNumber numberWithInt:event->u.media_list_item_added.index], @"index",
...@@ -108,8 +108,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void * ...@@ -108,8 +108,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data; id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self [[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListViewItemRemoved:) withMethod:@selector(mediaListViewItemRemoved:)
withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]]; withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]];
[pool release]; [pool release];
} }
...@@ -135,8 +135,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void * ...@@ -135,8 +135,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
* We also may receive a -retain in some event callback that may occcur * We also may receive a -retain in some event callback that may occcur
* Before libvlc_event_detach. So this can't happen in dealloc */ * Before libvlc_event_detach. So this can't happen in dealloc */
libvlc_event_manager_t * p_em = libvlc_media_list_view_event_manager(p_mlv); libvlc_event_manager_t * p_em = libvlc_media_list_view_event_manager(p_mlv);
libvlc_event_detach(p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self, NULL); libvlc_event_detach(p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self);
libvlc_event_detach(p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self, NULL); libvlc_event_detach(p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self);
} }
[super release]; [super release];
} }
...@@ -159,8 +159,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void * ...@@ -159,8 +159,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
libvlc_exception_init( &p_e ); libvlc_exception_init( &p_e );
libvlc_media_t * p_md = libvlc_media_list_view_item_at_index( p_mlv, index, &p_e ); libvlc_media_t * p_md = libvlc_media_list_view_item_at_index( p_mlv, index, &p_e );
catch_exception( &p_e ); catch_exception( &p_e );
// Returns local object for media descriptor, searchs for user data first. If not found it creates a // Returns local object for media descriptor, searchs for user data first. If not found it creates a
// new cocoa object representation of the media descriptor. // new cocoa object representation of the media descriptor.
return [VLCMedia mediaWithLibVLCMediaDescriptor:p_md]; return [VLCMedia mediaWithLibVLCMediaDescriptor:p_md];
} }
...@@ -175,7 +175,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void * ...@@ -175,7 +175,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
if( !p_sub_mlv ) if( !p_sub_mlv )
return nil; return nil;
// Returns local object for media descriptor, searchs for user data first. If not found it creates a // Returns local object for media descriptor, searchs for user data first. If not found it creates a
// new cocoa object representation of the media descriptor. // new cocoa object representation of the media descriptor.
return [VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_sub_mlv]; return [VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_sub_mlv];
} }
...@@ -276,14 +276,14 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void * ...@@ -276,14 +276,14 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
- (void)initInternalMediaListView - (void)initInternalMediaListView
{ {
libvlc_exception_t e; libvlc_exception_t e;
libvlc_exception_init( &e ); libvlc_exception_init(&e);
libvlc_event_manager_t * p_em = libvlc_media_list_event_manager( p_mlv, &e ); libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(p_mlv);
/* Add internal callback */ /* Add internal callback */
libvlc_event_attach( p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self, &e ); libvlc_event_attach(p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self, &e);
libvlc_event_attach( p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self, &e ); libvlc_event_attach(p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self, &e);
catch_exception( &e ); catch_exception(&e);
} }
- (void)mediaListViewItemAdded:(NSArray *)arrayOfArgs - (void)mediaListViewItemAdded:(NSArray *)arrayOfArgs
......
...@@ -41,8 +41,7 @@ ...@@ -41,8 +41,7 @@
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
instance = libvlc_media_list_player_new([VLCLibrary sharedInstance], &ex); instance = libvlc_media_list_player_new([VLCLibrary sharedInstance], &ex);
catch_exception(&ex); catch_exception(&ex);
libvlc_media_list_player_set_media_player(instance, [_mediaPlayer libVLCMediaPlayer], &ex); libvlc_media_list_player_set_media_player(instance, [_mediaPlayer libVLCMediaPlayer]);
catch_exception(&ex);
} }
return self; return self;
} }
...@@ -66,11 +65,8 @@ ...@@ -66,11 +65,8 @@
return; return;
[_mediaList release]; [_mediaList release];
_mediaList = [mediaList retain]; _mediaList = [mediaList retain];
libvlc_exception_t ex; libvlc_media_list_player_set_media_list(instance, [mediaList libVLCMediaList]);
libvlc_exception_init(&ex);
libvlc_media_list_player_set_media_list(instance, [mediaList libVLCMediaList], &ex);
catch_exception(&ex);
[self willChangeValueForKey:@"rootMedia"]; [self willChangeValueForKey:@"rootMedia"];
[_rootMedia release]; [_rootMedia release];
_rootMedia = nil; _rootMedia = nil;
...@@ -125,30 +121,28 @@ ...@@ -125,30 +121,28 @@
- (void)stop - (void)stop
{ {
libvlc_exception_t ex; libvlc_media_list_player_stop(instance);
libvlc_exception_init(&ex);
libvlc_media_list_player_stop(instance, &ex);
catch_exception(&ex);
} }
- (void)setRepeatMode:(VLCRepeatMode)repeatMode - (void)setRepeatMode:(VLCRepeatMode)repeatMode
{ {
libvlc_exception_t ex; libvlc_playback_mode_t mode;
libvlc_exception_init(&ex);
switch (repeatMode) { switch (repeatMode) {
case VLCRepeatAllItems: case VLCRepeatAllItems:
libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_default, &ex); mode = libvlc_playback_mode_loop;
break; break;
case VLCDoNotRepeat: case VLCDoNotRepeat:
libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_default, &ex); mode = libvlc_playback_mode_default;
break; break;
case VLCRepeatCurrentItem: case VLCRepeatCurrentItem:
libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_repeat, &ex); mode = libvlc_playback_mode_repeat;
break; break;
default: default:
NSAssert(0, @"Should not be reached");
break; break;
} }
catch_exception(&ex); libvlc_media_list_player_set_playback_mode(instance, mode);
_repeatMode = repeatMode; _repeatMode = repeatMode;
} }
......
...@@ -207,7 +207,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -207,7 +207,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (void)dealloc - (void)dealloc
{ {
NSAssert(libvlc_media_player_get_state(instance, NULL) == libvlc_Stopped, @"You released the media player before ensuring that it is stopped"); NSAssert(libvlc_media_player_get_state(instance) == libvlc_Stopped, @"You released the media player before ensuring that it is stopped");
// Always get rid of the delegate first so we can stop sending messages to it // Always get rid of the delegate first so we can stop sending messages to it
// TODO: Should we tell the delegate that we're shutting down? // TODO: Should we tell the delegate that we're shutting down?
...@@ -216,7 +216,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -216,7 +216,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
// Clear our drawable as we are going to release it, we don't // Clear our drawable as we are going to release it, we don't
// want the core to use it from this point. This won't happen as // want the core to use it from this point. This won't happen as
// the media player must be stopped. // the media player must be stopped.
libvlc_media_player_set_nsobject(instance, nil, NULL); libvlc_media_player_set_nsobject(instance, nil);
libvlc_media_player_release(instance); libvlc_media_player_release(instance);
...@@ -252,10 +252,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -252,10 +252,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (void)setDrawable:(id)aDrawable - (void)setDrawable:(id)aDrawable
{ {
// Make sure that this instance has been associated with the drawing canvas. // Make sure that this instance has been associated with the drawing canvas.
libvlc_exception_t ex; libvlc_media_player_set_nsobject(instance, aDrawable);
libvlc_exception_init( &ex );
libvlc_media_player_set_nsobject(instance, aDrawable, &ex);
catch_exception( &ex );
} }
- (id)drawable - (id)drawable
...@@ -316,7 +313,11 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -316,7 +313,11 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (NSArray *)videoSubTitles - (NSArray *)videoSubTitles
{ {
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_track_description_t *currentTrack = libvlc_video_get_spu_description( instance, &ex ); libvlc_track_description_t *currentTrack = libvlc_video_get_spu_description( instance, &ex );
catch_exception( &ex );
NSMutableArray *tempArray = [NSMutableArray array]; NSMutableArray *tempArray = [NSMutableArray array];
while (currentTrack) { while (currentTrack) {
[tempArray addObject:[NSString stringWithUTF8String:currentTrack->psz_name]]; [tempArray addObject:[NSString stringWithUTF8String:currentTrack->psz_name]];
...@@ -366,23 +367,6 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -366,23 +367,6 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
return result; return result;
} }
- (void)setVideoTeleText:(NSUInteger)value
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_video_set_teletext( instance, value, &ex );
catch_exception( &ex );
}
- (NSUInteger)videoTeleText
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
NSInteger result = libvlc_video_get_teletext( instance, &ex );
catch_exception( &ex );
return result;
}
- (void)saveVideoSnapshotAt: (NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height - (void)saveVideoSnapshotAt: (NSString *)path withWidth:(NSUInteger)width andHeight:(NSUInteger)height
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
...@@ -660,10 +644,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -660,10 +644,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
[media release]; [media release];
media = [value retain]; media = [value retain];
libvlc_exception_t ex; libvlc_media_player_set_media(instance, [media libVLCMediaDescriptor]);
libvlc_exception_init( &ex );
libvlc_media_player_set_media( instance, [media libVLCMediaDescriptor], &ex );
catch_exception( &ex );
} }
} }
...@@ -695,8 +676,8 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -695,8 +676,8 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
// Pause the stream // Pause the stream
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init(&ex);
libvlc_media_player_pause( (libvlc_media_player_t *)instance, &ex ); libvlc_media_player_pause(instance, &ex);
// fail gracefully // fail gracefully
// in most cases, it's just EOF so let's stop // in most cases, it's just EOF so let's stop
...@@ -708,10 +689,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s ...@@ -708,10 +689,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (void)stop - (void)stop
{ {
libvlc_exception_t ex; libvlc_media_player_stop(instance);
libvlc_exception_init( &ex );
libvlc_media_player_stop((libvlc_media_player_t *)instance, &ex);
catch_exception( &ex );
} }
- (void)fastForward - (void)fastForward
...@@ -904,28 +882,28 @@ static const VLCMediaPlayerState libvlc_to_local_state[] = ...@@ -904,28 +882,28 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
// Attach event observers into the media instance // Attach event observers into the media instance
libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, &ex ); libvlc_event_manager_t * p_em = libvlc_media_player_event_manager(instance);
libvlc_event_attach( p_em, libvlc_MediaPlayerPlaying, HandleMediaInstanceStateChanged, self, &ex ); libvlc_event_attach(p_em, libvlc_MediaPlayerPlaying, HandleMediaInstanceStateChanged, self, &ex);
libvlc_event_attach( p_em, libvlc_MediaPlayerPaused, HandleMediaInstanceStateChanged, self, &ex ); libvlc_event_attach(p_em, libvlc_MediaPlayerPaused, HandleMediaInstanceStateChanged, self, &ex);
libvlc_event_attach( p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self, &ex ); libvlc_event_attach(p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self, &ex);
libvlc_event_attach( p_em, libvlc_MediaPlayerEndReached, HandleMediaInstanceStateChanged, self, &ex ); libvlc_event_attach(p_em, libvlc_MediaPlayerEndReached, HandleMediaInstanceStateChanged, self, &ex);
/* FIXME: We may want to turn that off when none is interested by that */ /* FIXME: We may want to turn that off when none is interested by that */
libvlc_event_attach( p_em, libvlc_MediaPlayerPositionChanged, HandleMediaPositionChanged, self, &ex ); libvlc_event_attach(p_em, libvlc_MediaPlayerPositionChanged, HandleMediaPositionChanged, self, &ex);
libvlc_event_attach( p_em, libvlc_MediaPlayerTimeChanged, HandleMediaTimeChanged, self, &ex ); libvlc_event_attach(p_em, libvlc_MediaPlayerTimeChanged, HandleMediaTimeChanged, self, &ex);
libvlc_event_attach( p_em, libvlc_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, self, &ex ); libvlc_event_attach(p_em, libvlc_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, self, &ex);
catch_exception( &ex ); catch_exception(&ex);
} }
- (void)unregisterObservers - (void)unregisterObservers
{ {
libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, NULL ); libvlc_event_manager_t * p_em = libvlc_media_player_event_manager(instance);
libvlc_event_detach( p_em, libvlc_MediaPlayerPlaying, HandleMediaInstanceStateChanged, self, NULL ); libvlc_event_detach(p_em, libvlc_MediaPlayerPlaying, HandleMediaInstanceStateChanged, self);
libvlc_event_detach( p_em, libvlc_MediaPlayerPaused, HandleMediaInstanceStateChanged, self, NULL ); libvlc_event_detach(p_em, libvlc_MediaPlayerPaused, HandleMediaInstanceStateChanged, self);
libvlc_event_detach( p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self, NULL ); libvlc_event_detach(p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self);
libvlc_event_detach( p_em, libvlc_MediaPlayerEndReached, HandleMediaInstanceStateChanged, self, NULL ); libvlc_event_detach(p_em, libvlc_MediaPlayerEndReached, HandleMediaInstanceStateChanged, self);
libvlc_event_detach( p_em, libvlc_MediaPlayerPositionChanged, HandleMediaPositionChanged, self, NULL ); libvlc_event_detach(p_em, libvlc_MediaPlayerPositionChanged, HandleMediaPositionChanged, self);
libvlc_event_detach( p_em, libvlc_MediaPlayerTimeChanged, HandleMediaTimeChanged, self, NULL ); libvlc_event_detach(p_em, libvlc_MediaPlayerTimeChanged, HandleMediaTimeChanged, self);
libvlc_event_attach( p_em, libvlc_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, self, NULL ); libvlc_event_detach(p_em, libvlc_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, self);
} }
- (void)mediaPlayerTimeChanged:(NSNumber *)newTime - (void)mediaPlayerTimeChanged:(NSNumber *)newTime
......
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