Commit 096ebc37 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework: Implement -canPause and the various setRate related functions.

parent 79179c9e
......@@ -104,8 +104,7 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (void)setVideoTeleText:(int)value;
- (int)videoTeleText;
- (void)setRate:(int)value;
- (int)rate;
@property float rate;
/* Video Information */
- (NSSize)videoSize;
......@@ -157,24 +156,24 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
/**
* Fast forwards through the feed at the standard 1x rate.
*/
//- (void)fastForward;
- (void)fastForward;
/**
* Fast forwards through the feed at the rate specified.
* \param rate Rate at which the feed should be fast forwarded.
*/
//- (void)fastForwardAtRate:(int)rate;
- (void)fastForwardAtRate:(float)rate;
/**
* Rewinds through the feed at the standard 1x rate.
*/
//- (void)rewind;
- (void)rewind;
/**
* Rewinds through the feed at the rate specified.
* \param rate Rate at which the feed should be fast rewound.
*/
//- (void)rewindAtRate:(int)rate;
- (void)rewindAtRate:(float)rate;
/* Playback Information */
/**
......@@ -204,4 +203,6 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
- (BOOL)isSeekable;
- (BOOL)canPause;
@end
......@@ -59,6 +59,7 @@ static void HandleMediaInstanceVolumeChanged(const libvlc_event_t * event, void
static void HandleMediaTimeChanged(const libvlc_event_t * event, void * self)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
[[VLCEventManager sharedManager] callOnMainThreadObject:self
withMethod:@selector(mediaPlayerTimeChanged:)
withArgumentAsObject:[NSNumber numberWithLongLong:event->u.media_instance_time_changed.new_time]];
......@@ -128,14 +129,22 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key
{
static NSDictionary * dict = nil;
NSSet * superKeyPaths;
if( !dict )
{
dict = [[NSDictionary dictionaryWithObjectsAndKeys:
[NSSet setWithObject:@"state"], @"playing",
[NSSet setWithObjects:@"state", @"media", nil], @"seekable",
[NSSet setWithObjects:@"state", @"media", nil], @"canPause",
[NSSet setWithObjects:@"state", @"media", nil], @"description",
nil] retain];
}
if( (superKeyPaths = [super keyPathsForValuesAffectingValueForKey: key]) )
{
NSMutableSet * ret = [NSMutableSet setWithSet:[dict objectForKey: key]];
[ret unionSet:superKeyPaths];
return ret;
}
return [dict objectForKey: key];
}
......@@ -261,12 +270,12 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return result;
}
- (void)setRate:(int)value
- (void)setRate:(float)value
{
libvlc_media_instance_set_rate( instance, value, NULL );
}
- (int)rate
- (float)rate
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
......@@ -467,10 +476,25 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
// TODO: Should we pause this or destroy the media instance so that it appears as being "stopped"?
}
//- (void)fastForward;
//- (void)fastForwardAtRate:(int)rate;
//- (void)rewind;
//- (void)rewindAtRate:(int)rate;
- (void)fastForward
{
[self fastForwardAtRate: 2.0];
}
- (void)fastForwardAtRate:(float)rate
{
[self setRate:rate];
}
- (void)rewind
{
[self rewindAtRate: 2.0];
}
- (void)rewindAtRate:(float)rate
{
[self setRate: -rate];
}
- (BOOL)isPlaying
{
......@@ -531,6 +555,14 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
return ret;
}
- (BOOL)canPause
{
libvlc_exception_t ex;
libvlc_exception_init( &ex );
BOOL ret = libvlc_media_instance_can_pause( instance, &ex );
catch_exception( &ex );
return ret;
}
@end
@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