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);
@protocol VLCMediaPlayerDelegate
/**
* 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.
*/
- (void)mediaPlayerTimeChanged:(NSNotification *)aNotification;
/**
* 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.
*/
- (void)mediaPlayerStateChanged:(NSNotification *)aNotification;
@end
// TODO: Should we use medialist_player or our own flavor of media player?
@interface VLCMediaPlayer : NSObject
@interface VLCMediaPlayer : NSObject
{
id delegate; //< Object delegate
void * instance; // Internal
......@@ -110,9 +110,6 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (void)setVideoCropGeometry:(char *)value;
- (char *)videoCropGeometry;
- (void)setVideoTeleText:(NSUInteger)value;
- (NSUInteger)videoTeleText;
/**
* Take a snapshot of the current video.
*
......@@ -148,7 +145,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
*/
- (void)setTime:(VLCTime *)value;
/**
/**
* Returns the current position (or time) of the feed.
* \return VLCTIme object with current time.
*/
......@@ -228,8 +225,8 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
/* Playback Operations */
/**
* Plays a media resource using the currently selected media controller (or
* default controller. If feed was paused then the feed resumes at the position
* Plays a media resource using the currently selected media controller (or
* default controller. If feed was paused then the feed resumes at the position
* it was paused in.
* \return A Boolean determining whether the stream was played or not.
*/
......@@ -339,7 +336,7 @@ extern NSString * VLCMediaPlayerStateToString(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
*/
- (float)position;
......
......@@ -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
* 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_detach(p_em, libvlc_MediaMetaChanged, HandleMediaMetaChanged, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaStateChanged, HandleMediaStateChanged, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaSubItemAdded, HandleMediaSubItemAdded, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaMetaChanged, HandleMediaMetaChanged, self);
libvlc_event_detach(p_em, libvlc_MediaDurationChanged, HandleMediaDurationChanged, self);
libvlc_event_detach(p_em, libvlc_MediaStateChanged, HandleMediaStateChanged, self);
libvlc_event_detach(p_em, libvlc_MediaSubItemAdded, HandleMediaSubItemAdded, self);
}
[super release];
}
......
......@@ -52,8 +52,8 @@ static void HandleMediaDiscovererStarted(const libvlc_event_t * event, void * us
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaDiscovererStarted)
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaDiscovererStarted)
withArgumentAsObject:nil];
[pool release];
}
......@@ -62,13 +62,13 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaDiscovererEnded)
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaDiscovererEnded)
withArgumentAsObject:nil];
[pool release];
}
@implementation VLCMediaDiscoverer
+ (NSArray *)availableMediaDiscoverer
{
......@@ -90,17 +90,19 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
if (self = [super init])
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_exception_init(&ex);
localizedName = nil;
discoveredMedia = nil;
mdis = libvlc_media_discoverer_new_from_name( [VLCLibrary sharedInstance],
[aServiceName UTF8String],
&ex );
catch_exception( &ex );
mdis = libvlc_media_discoverer_new_from_name([VLCLibrary sharedInstance],
[aServiceName UTF8String],
&ex);
catch_exception(&ex);
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_MediaDiscovererEnded, HandleMediaDiscovererEnded, self, NULL);
libvlc_event_attach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self, &ex);
libvlc_event_attach(p_em, libvlc_MediaDiscovererEnded, HandleMediaDiscovererEnded, self, &ex);
catch_exception( &ex );
running = libvlc_media_discoverer_is_running(mdis);
}
return self;
......@@ -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 also may receive a -retain in some event callback that may occcur
* 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_detach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaDiscovererEnded, HandleMediaDiscovererEnded, self, NULL);
libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(mdis);
libvlc_event_detach(p_em, libvlc_MediaDiscovererStarted, HandleMediaDiscovererStarted, self);
libvlc_event_detach(p_em, libvlc_MediaDiscovererEnded, HandleMediaDiscovererEnded, self);
}
[super release];
}
......@@ -148,7 +150,7 @@ static void HandleMediaDiscovererEnded( const libvlc_event_t * event, void * use
{
if ( localizedName )
return localizedName;
char * name = libvlc_media_discoverer_localized_name( mdis );
if (name)
{
......
......@@ -52,8 +52,8 @@ static void HandleMediaListItemAdded(const libvlc_event_t * event, void * user_d
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemAdded:)
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemAdded:)
withArgumentAsObject:[NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media",
[NSNumber numberWithInt:event->u.media_list_item_added.index], @"index",
......@@ -65,8 +65,8 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemRemoved:)
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListItemRemoved:)
withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]];
[pool release];
}
......@@ -81,7 +81,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
libvlc_exception_init( &p_e );
p_mlist = libvlc_media_list_new( [VLCLibrary sharedInstance], &p_e );
catch_exception( &p_e );
// Initialize internals to defaults
cachedMedia = [[NSMutableArray alloc] init];
delegate = flatAspect = hierarchicalAspect = hierarchicalNodeAspect = nil;
......@@ -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 also may receive a -retain in some event callback that may occcur
* 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_detach(p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self, NULL);
libvlc_event_manager_t * p_em = libvlc_media_list_event_manager(p_mlist);
libvlc_event_detach(p_em, libvlc_MediaListItemDeleted, HandleMediaListItemDeleted, self);
libvlc_event_detach(p_em, libvlc_MediaListItemAdded, HandleMediaListItemAdded, self);
}
[super release];
}
......@@ -111,7 +111,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{
// Release allocated memory
delegate = nil;
libvlc_media_list_release( p_mlist );
[cachedMedia release];
[flatAspect release];
......@@ -177,11 +177,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
- (NSInteger)indexOfMedia:(VLCMedia *)media
{
libvlc_exception_t p_e;
libvlc_exception_init( &p_e );
NSInteger result = libvlc_media_list_index_of_item( p_mlist, [media libVLCMediaDescriptor], &p_e );
catch_exception( &p_e );
NSInteger result = libvlc_media_list_index_of_item(p_mlist, [media libVLCMediaDescriptor]);
return result;
}
......@@ -209,7 +205,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
libvlc_exception_init( &p_e );
BOOL isReadOnly = libvlc_media_list_is_readonly( p_mlist );
catch_exception( &p_e );
return isReadOnly;
}
......@@ -218,7 +214,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{
if( hierarchicalAspect )
return hierarchicalAspect;
libvlc_media_list_view_t * p_mlv = libvlc_media_list_hierarchical_view( p_mlist, NULL );
hierarchicalAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_mlv andMediaList:self] retain];
libvlc_media_list_view_release( p_mlv );
......@@ -229,7 +225,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{
if( hierarchicalNodeAspect )
return hierarchicalNodeAspect;
libvlc_media_list_view_t * p_mlv = libvlc_media_list_hierarchical_node_view( p_mlist, NULL );
hierarchicalNodeAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_mlv andMediaList:self] retain];
libvlc_media_list_view_release( p_mlv );
......@@ -240,7 +236,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{
if( flatAspect )
return flatAspect;
libvlc_media_list_view_t * p_mlv = libvlc_media_list_flat_view( p_mlist, NULL );
flatAspect = [[VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_mlv andMediaList:self] retain];
libvlc_media_list_view_release( p_mlv );
......@@ -262,9 +258,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
p_mlist = p_new_mlist;
libvlc_media_list_retain( 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++ )
{
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
libvlc_exception_t 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_MediaListItemDeleted, HandleMediaListItemDeleted, self, &p_e );
catch_exception( &p_e );
}
......@@ -333,7 +329,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:[NSIndexSet indexSetWithIndex:[index intValue]] forKey:@"media"];
// Post the notification
[[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemDeleted
[[NSNotificationCenter defaultCenter] postNotificationName:VLCMediaListItemDeleted
object:self
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
index, @"index",
......
......@@ -48,7 +48,7 @@
if(self = [super init])
{
media = nil;
children = nil;
children = nil;
}
return self;
}
......@@ -95,8 +95,8 @@ static void HandleMediaListViewItemAdded(const libvlc_event_t * event, void * us
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListViewItemAdded:)
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListViewItemAdded:)
withArgumentAsObject:[NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
[VLCMedia mediaWithLibVLCMediaDescriptor:event->u.media_list_item_added.item], @"media",
[NSNumber numberWithInt:event->u.media_list_item_added.index], @"index",
......@@ -108,8 +108,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
id self = user_data;
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListViewItemRemoved:)
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaListViewItemRemoved:)
withArgumentAsObject:[NSNumber numberWithInt:event->u.media_list_item_deleted.index]];
[pool release];
}
......@@ -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
* 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_detach(p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self, NULL);
libvlc_event_detach(p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self);
libvlc_event_detach(p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self);
}
[super release];
}
......@@ -159,8 +159,8 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
libvlc_exception_init( &p_e );
libvlc_media_t * p_md = libvlc_media_list_view_item_at_index( p_mlv, index, &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.
return [VLCMedia mediaWithLibVLCMediaDescriptor:p_md];
}
......@@ -175,7 +175,7 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
if( !p_sub_mlv )
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.
return [VLCMediaListAspect mediaListAspectWithLibVLCMediaListView:p_sub_mlv];
}
......@@ -276,14 +276,14 @@ static void HandleMediaListViewItemDeleted( const libvlc_event_t * event, void *
- (void)initInternalMediaListView
{
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 */
libvlc_event_attach( p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self, &e );
libvlc_event_attach( p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self, &e );
catch_exception( &e );
libvlc_event_attach(p_em, libvlc_MediaListViewItemAdded, HandleMediaListViewItemAdded, self, &e);
libvlc_event_attach(p_em, libvlc_MediaListViewItemDeleted, HandleMediaListViewItemDeleted, self, &e);
catch_exception(&e);
}
- (void)mediaListViewItemAdded:(NSArray *)arrayOfArgs
......
......@@ -41,8 +41,7 @@
libvlc_exception_init(&ex);
instance = libvlc_media_list_player_new([VLCLibrary sharedInstance], &ex);
catch_exception(&ex);
libvlc_media_list_player_set_media_player(instance, [_mediaPlayer libVLCMediaPlayer], &ex);
catch_exception(&ex);
libvlc_media_list_player_set_media_player(instance, [_mediaPlayer libVLCMediaPlayer]);
}
return self;
}
......@@ -66,11 +65,8 @@
return;
[_mediaList release];
_mediaList = [mediaList retain];
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_media_list_player_set_media_list(instance, [mediaList libVLCMediaList], &ex);
catch_exception(&ex);
libvlc_media_list_player_set_media_list(instance, [mediaList libVLCMediaList]);
[self willChangeValueForKey:@"rootMedia"];
[_rootMedia release];
_rootMedia = nil;
......@@ -125,30 +121,28 @@
- (void)stop
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_media_list_player_stop(instance, &ex);
catch_exception(&ex);
libvlc_media_list_player_stop(instance);
}
- (void)setRepeatMode:(VLCRepeatMode)repeatMode
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_playback_mode_t mode;
switch (repeatMode) {
case VLCRepeatAllItems:
libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_default, &ex);
mode = libvlc_playback_mode_loop;
break;
case VLCDoNotRepeat:
libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_default, &ex);
mode = libvlc_playback_mode_default;
break;
case VLCRepeatCurrentItem:
libvlc_media_list_player_set_playback_mode(instance, libvlc_playback_mode_repeat, &ex);
mode = libvlc_playback_mode_repeat;
break;
default:
NSAssert(0, @"Should not be reached");
break;
}
catch_exception(&ex);
libvlc_media_list_player_set_playback_mode(instance, mode);
_repeatMode = repeatMode;
}
......
......@@ -207,7 +207,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (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
// 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
// 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
// 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);
......@@ -252,10 +252,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (void)setDrawable:(id)aDrawable
{
// Make sure that this instance has been associated with the drawing canvas.
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_media_player_set_nsobject(instance, aDrawable, &ex);
catch_exception( &ex );
libvlc_media_player_set_nsobject(instance, aDrawable);
}
- (id)drawable
......@@ -316,7 +313,11 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
- (NSArray *)videoSubTitles
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_track_description_t *currentTrack = libvlc_video_get_spu_description( instance, &ex );
catch_exception( &ex );
NSMutableArray *tempArray = [NSMutableArray array];
while (currentTrack) {
[tempArray addObject:[NSString stringWithUTF8String:currentTrack->psz_name]];
......@@ -366,23 +367,6 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
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
{
libvlc_exception_t ex;
......@@ -660,10 +644,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
[media release];
media = [value retain];
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_media_player_set_media( instance, [media libVLCMediaDescriptor], &ex );
catch_exception( &ex );
libvlc_media_player_set_media(instance, [media libVLCMediaDescriptor]);
}
}
......@@ -695,8 +676,8 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
// Pause the stream
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_media_player_pause( (libvlc_media_player_t *)instance, &ex );
libvlc_exception_init(&ex);
libvlc_media_player_pause(instance, &ex);
// fail gracefully
// 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
- (void)stop
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
libvlc_media_player_stop((libvlc_media_player_t *)instance, &ex);
catch_exception( &ex );
libvlc_media_player_stop(instance);
}
- (void)fastForward
......@@ -904,28 +882,28 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
libvlc_exception_init( &ex );
// Attach event observers into the media instance
libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, &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_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self, &ex );
libvlc_event_attach( p_em, libvlc_MediaPlayerEndReached, HandleMediaInstanceStateChanged, self, &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_MediaPlayerPaused, HandleMediaInstanceStateChanged, self, &ex);
libvlc_event_attach(p_em, libvlc_MediaPlayerEncounteredError, 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 */
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_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, self, &ex );
catch_exception( &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_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, self, &ex);
catch_exception(&ex);
}
- (void)unregisterObservers
{
libvlc_event_manager_t * p_em = libvlc_media_player_event_manager( instance, NULL );
libvlc_event_detach( p_em, libvlc_MediaPlayerPlaying, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaPlayerPaused, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaPlayerEndReached, HandleMediaInstanceStateChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaPlayerPositionChanged, HandleMediaPositionChanged, self, NULL );
libvlc_event_detach( p_em, libvlc_MediaPlayerTimeChanged, HandleMediaTimeChanged, self, NULL );
libvlc_event_attach( p_em, libvlc_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, self, NULL );
libvlc_event_manager_t * p_em = libvlc_media_player_event_manager(instance);
libvlc_event_detach(p_em, libvlc_MediaPlayerPlaying, HandleMediaInstanceStateChanged, self);
libvlc_event_detach(p_em, libvlc_MediaPlayerPaused, HandleMediaInstanceStateChanged, self);
libvlc_event_detach(p_em, libvlc_MediaPlayerEncounteredError, HandleMediaInstanceStateChanged, self);
libvlc_event_detach(p_em, libvlc_MediaPlayerEndReached, HandleMediaInstanceStateChanged, self);
libvlc_event_detach(p_em, libvlc_MediaPlayerPositionChanged, HandleMediaPositionChanged, self);
libvlc_event_detach(p_em, libvlc_MediaPlayerTimeChanged, HandleMediaTimeChanged, self);
libvlc_event_detach(p_em, libvlc_MediaPlayerMediaChanged, HandleMediaPlayerMediaChanged, self);
}
- (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