Commit 7f88d114 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

VLCMediaPlayer.m: Be closer to libvlc.

parent 3f6da3f3
...@@ -421,20 +421,13 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t *event, void *s ...@@ -421,20 +421,13 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t *event, void *s
// usleep(1000); // usleep(1000);
} }
[self willChangeValueForKey:@"media"];
[media release]; [media release];
media = [value retain]; media = [value retain];
[self didChangeValueForKey:@"media"];
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
libvlc_media_instance_set_media_descriptor( instance, [media libVLCMediaDescriptor], &ex ); libvlc_media_instance_set_media_descriptor( instance, [media libVLCMediaDescriptor], &ex );
quit_on_exception( &ex ); quit_on_exception( &ex );
if (media) {
if (wasPlaying)
[self play];
}
} }
} }
...@@ -444,17 +437,11 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t *event, void *s ...@@ -444,17 +437,11 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t *event, void *s
} }
- (BOOL)play - (BOOL)play
{ {
// Return if there is no media available or if the stream is already playing something
if (!media || [self isPlaying])
return [self isPlaying];
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init( &ex ); libvlc_exception_init( &ex );
libvlc_media_instance_play( (libvlc_media_instance_t *)instance, &ex ); libvlc_media_instance_play( (libvlc_media_instance_t *)instance, &ex );
quit_on_exception( &ex ); quit_on_exception( &ex );
return YES; return YES;
} }
......
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