Commit dcebfbb0 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCMediaPlayer.m: -isSeekable.

parent 700e6aac
...@@ -192,4 +192,7 @@ extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state); ...@@ -192,4 +192,7 @@ extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
*/ */
- (float)position; - (float)position;
- (void)setPosition:(float)newPosition; - (void)setPosition:(float)newPosition;
- (BOOL)isSeekable;
@end @end
...@@ -58,7 +58,6 @@ static void HandleMediaInstanceVolumeChanged(const libvlc_event_t *event, void * ...@@ -58,7 +58,6 @@ static void HandleMediaInstanceVolumeChanged(const libvlc_event_t *event, void *
static void HandleMediaTimeChanged(const libvlc_event_t * event, void * self) static void HandleMediaTimeChanged(const libvlc_event_t * event, void * self)
{ {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog(@"time!");
[[VLCEventManager sharedManager] callOnMainThreadObject:self [[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaPlayerTimeChanged:) withMethod:@selector(mediaPlayerTimeChanged:)
withArgumentAsObject:[NSNumber numberWithLongLong:event->u.media_instance_time_changed.new_time]]; withArgumentAsObject:[NSNumber numberWithLongLong:event->u.media_instance_time_changed.new_time]];
...@@ -120,9 +119,6 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t *event, void *s ...@@ -120,9 +119,6 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t *event, void *s
@end @end
@implementation VLCMediaPlayer @implementation VLCMediaPlayer
+ (void)initialize {
[self setKeys:[NSArray arrayWithObject:@"state"] triggerChangeNotificationsForDependentKey:@"playing"];
}
- (id)init - (id)init
{ {
...@@ -133,6 +129,8 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t *event, void *s ...@@ -133,6 +129,8 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t *event, void *s
{ {
if (self = [super init]) if (self = [super init])
{ {
[VLCMediaPlayer setKeys:[NSArray arrayWithObject:@"state"] triggerChangeNotificationsForDependentKey:@"playing"];
[VLCMediaPlayer setKeys:[NSArray arrayWithObjects:@"state", @"media", nil] triggerChangeNotificationsForDependentKey:@"seekable"];
delegate = nil; delegate = nil;
media = nil; media = nil;
cachedTime = [[VLCTime nullTime] retain]; cachedTime = [[VLCTime nullTime] retain];
...@@ -542,10 +540,12 @@ static const VLCMediaPlayerState libvlc_to_local_state[] = ...@@ -542,10 +540,12 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
{ {
return cachedState; return cachedState;
} }
- (float)position - (float)position
{ {
return position; return position;
} }
- (void)setPosition:(float)newPosition - (void)setPosition:(float)newPosition
{ {
libvlc_exception_t ex; libvlc_exception_t ex;
...@@ -553,6 +553,16 @@ static const VLCMediaPlayerState libvlc_to_local_state[] = ...@@ -553,6 +553,16 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
libvlc_media_instance_set_position( instance, newPosition, &ex ); libvlc_media_instance_set_position( instance, newPosition, &ex );
quit_on_exception( &ex ); quit_on_exception( &ex );
} }
- (BOOL)isSeekable
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
BOOL ret = libvlc_media_instance_is_seekable( instance, &ex );
quit_on_exception( &ex );
return ret;
}
@end @end
@implementation VLCMediaPlayer (Private) @implementation VLCMediaPlayer (Private)
......
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