Ignore:
Timestamp:
07/20/09 06:03:15 (15 years ago)
Author:
Nicholas Riley
Message:

Remove last bits of QuickTime usage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/PSMovieAlertController.m

    r554 r569  
    1212#import "QTMovie-NJRExtensions.h"
    1313#import "NJRSoundManager.h"
    14 #import <QuickTime/Movies.h>
    1514
    1615@implementation PSMovieAlertController
     
    2827}
    2928
     29- (void)_movieRateDidChange:(NSNotification *)notification;
     30{
     31    float newRate = [[[notification userInfo] objectForKey: QTMovieRateDidChangeNotificationParameter]
     32                     floatValue];
     33    if (newRate != 0)
     34        return;
     35   
     36    if (repetitions == 0 || repetitionsRemaining == 0) {
     37        [[NSNotificationCenter defaultCenter] removeObserver: self
     38                                                        name: QTMovieRateDidChangeNotification
     39                                                      object: [movieView movie]];
     40   
     41        [self close];
     42        return;
     43    }
     44    repetitionsRemaining--;
     45    [movieView gotoBeginning: self];
     46    [movieView play: self];
     47}
     48
    3049- (void)play;
    3150{
    32     NSTimeInterval delay;
    33     if (repetitions == 0) return;
    34     if (IsMovieDone((Movie)theMovie) || repetitionsRemaining == repetitions) {
    35         if (repetitionsRemaining == 0) {
    36             [self close];
    37             return;
    38         }
    39         repetitionsRemaining--;
    40         [movieView gotoBeginning: self];
    41         [movieView play: self];
    42     }
    43     delay = (GetMovieDuration((Movie)theMovie) - GetMovieTime((Movie)theMovie, NULL)) / (double)GetMovieTimeScale((Movie)theMovie);
    44     // XXX should use a timebase callback for this instead (see NJRQTMediaPopUpButton); also, use QuickTimeÕs built-in loop functionality instead of rolling our own?
    45     [self performSelector: @selector(play) withObject: nil afterDelay: delay inModes: [NSArray arrayWithObject: NSDefaultRunLoopMode]];
     51    repetitionsRemaining = repetitions - 1;
     52
     53    [[NSNotificationCenter defaultCenter] addObserver: self
     54                                             selector: @selector(_movieRateDidChange:)
     55                                                 name: QTMovieRateDidChangeNotification
     56                                               object: [movieView movie]];
     57    [movieView play: self];
    4658}
    4759
     
    5365        alarm = anAlarm;
    5466        alert = anAlert;
    55         theMovie = [movie quickTimeMovie];
    5667        [movieView setMovie: movie];
    5768        if ([alert hasVideo]) {
     
    89100        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(close) name: PSAlarmAlertStopNotification object: nil];
    90101        repetitions = [alert repetitions];
    91         repetitionsRemaining = repetitions;
    92102        if ([movie NJR_hasAudio] && [NJRSoundManager volumeIsNotMutedOrInvalid: [alert outputVolume]] && [NJRSoundManager saveDefaultOutputVolume]) {
    93103            [NJRSoundManager setDefaultOutputVolume: [alert outputVolume]];
Note: See TracChangeset for help on using the changeset viewer.