Changeset 569 for trunk/Cocoa/Pester/Source/PSMovieAlertController.m
- Timestamp:
- 07/20/09 06:03:15 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cocoa/Pester/Source/PSMovieAlertController.m
r554 r569 12 12 #import "QTMovie-NJRExtensions.h" 13 13 #import "NJRSoundManager.h" 14 #import <QuickTime/Movies.h>15 14 16 15 @implementation PSMovieAlertController … … 28 27 } 29 28 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 30 49 - (void)play; 31 50 { 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]; 46 58 } 47 59 … … 53 65 alarm = anAlarm; 54 66 alert = anAlert; 55 theMovie = [movie quickTimeMovie];56 67 [movieView setMovie: movie]; 57 68 if ([alert hasVideo]) { … … 89 100 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(close) name: PSAlarmAlertStopNotification object: nil]; 90 101 repetitions = [alert repetitions]; 91 repetitionsRemaining = repetitions;92 102 if ([movie NJR_hasAudio] && [NJRSoundManager volumeIsNotMutedOrInvalid: [alert outputVolume]] && [NJRSoundManager saveDefaultOutputVolume]) { 93 103 [NJRSoundManager setDefaultOutputVolume: [alert outputVolume]];
Note:
See TracChangeset
for help on using the changeset viewer.