Changeset 096ebc37110a1c2656a221c9820f0d9181e74490

Show
Ignore:
Timestamp:
07/01/08 20:30:38 (1 year ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1199734238 +0000
git-parent:

[79179c9e91d20221979ea176054b6ce724fe89de]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1199734238 +0000
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • extras/MacOSX/Framework/Headers/Public/VLCMediaPlayer.h

    r11c628e r096ebc3  
    105105- (int)videoTeleText; 
    106106 
    107 - (void)setRate:(int)value; 
    108 - (int)rate; 
     107@property float rate; 
    109108 
    110109/* Video Information */ 
     
    158157 * Fast forwards through the feed at the standard 1x rate. 
    159158 */ 
    160 //- (void)fastForward; 
     159- (void)fastForward; 
    161160 
    162161/** 
     
    164163 * \param rate Rate at which the feed should be fast forwarded. 
    165164 */ 
    166 //- (void)fastForwardAtRate:(int)rate; 
     165- (void)fastForwardAtRate:(float)rate; 
    167166 
    168167/** 
    169168 * Rewinds through the feed at the standard 1x rate. 
    170169 */ 
    171 //- (void)rewind; 
     170- (void)rewind; 
    172171 
    173172/** 
     
    175174 * \param rate Rate at which the feed should be fast rewound. 
    176175 */ 
    177 //- (void)rewindAtRate:(int)rate; 
     176- (void)rewindAtRate:(float)rate; 
    178177 
    179178/* Playback Information */ 
     
    205204- (BOOL)isSeekable; 
    206205 
     206- (BOOL)canPause; 
     207 
    207208@end 
  • extras/MacOSX/Framework/Sources/VLCMediaPlayer.m

    re3bc1e0 r096ebc3  
    6060{ 
    6161    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 
     62 
    6263    [[VLCEventManager sharedManager] callOnMainThreadObject:self  
    6364                                                 withMethod:@selector(mediaPlayerTimeChanged:)  
     
    8384{ 
    8485    VLCMediaPlayerState newState; 
    85      
     86 
    8687    if( event->type == libvlc_MediaInstancePlayed ) 
    8788        newState = VLCMediaPlayerStatePlaying; 
     
    129130{ 
    130131    static NSDictionary * dict = nil; 
     132    NSSet * superKeyPaths; 
    131133    if( !dict ) 
    132134    { 
     
    134136            [NSSet setWithObject:@"state"], @"playing", 
    135137            [NSSet setWithObjects:@"state", @"media", nil], @"seekable", 
     138            [NSSet setWithObjects:@"state", @"media", nil], @"canPause", 
    136139            [NSSet setWithObjects:@"state", @"media", nil], @"description", 
    137140            nil] retain]; 
     141    } 
     142    if( (superKeyPaths = [super keyPathsForValuesAffectingValueForKey: key]) ) 
     143    { 
     144        NSMutableSet * ret = [NSMutableSet setWithSet:[dict objectForKey: key]]; 
     145        [ret unionSet:superKeyPaths]; 
     146        return ret; 
    138147    } 
    139148    return [dict objectForKey: key]; 
     
    262271} 
    263272 
    264 - (void)setRate:(int)value 
     273- (void)setRate:(float)value 
    265274{ 
    266275    libvlc_media_instance_set_rate( instance, value, NULL ); 
    267276} 
    268277 
    269 - (int)rate 
     278- (float)rate 
    270279{ 
    271280    libvlc_exception_t ex; 
     
    468477} 
    469478 
    470 //- (void)fastForward; 
    471 //- (void)fastForwardAtRate:(int)rate; 
    472 //- (void)rewind; 
    473 //- (void)rewindAtRate:(int)rate; 
     479- (void)fastForward 
     480
     481    [self fastForwardAtRate: 2.0]; 
     482
     483 
     484- (void)fastForwardAtRate:(float)rate 
     485
     486    [self setRate:rate]; 
     487
     488 
     489- (void)rewind 
     490
     491    [self rewindAtRate: 2.0]; 
     492
     493 
     494- (void)rewindAtRate:(float)rate 
     495
     496    [self setRate: -rate]; 
     497
    474498 
    475499- (BOOL)isPlaying 
     
    532556} 
    533557 
     558- (BOOL)canPause 
     559{ 
     560    libvlc_exception_t ex; 
     561    libvlc_exception_init( &ex ); 
     562    BOOL ret = libvlc_media_instance_can_pause( instance, &ex ); 
     563    catch_exception( &ex ); 
     564    return ret; 
     565} 
    534566@end 
    535567