diff options
author | Damiano Galassi <[email protected]> | 2015-10-06 19:52:42 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2015-10-06 19:52:42 +0200 |
commit | b4a0e952b323ce54616f5c1610454195b7b2445a (patch) | |
tree | e0c33961ff2b12f40f2a577a7f9b6ca9374ad1eb /macosx/QTKit+HBQTMovieExtensions.m | |
parent | de4e62133b9607101db3386bce78c0030ce6f883 (diff) |
MacGui: move some code out of HBPreviewController.m. Remember the windows size when going back from the Scale To Screen mode
Diffstat (limited to 'macosx/QTKit+HBQTMovieExtensions.m')
-rw-r--r-- | macosx/QTKit+HBQTMovieExtensions.m | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/macosx/QTKit+HBQTMovieExtensions.m b/macosx/QTKit+HBQTMovieExtensions.m new file mode 100644 index 000000000..903659ec9 --- /dev/null +++ b/macosx/QTKit+HBQTMovieExtensions.m @@ -0,0 +1,49 @@ +/* QTKit+HBQTMovieExtensions.m + + This file is part of the HandBrake source code. + Homepage: <http://handbrake.fr/>. + It may be used under the terms of the GNU General Public License. */ + +#import "QTKit+HBQTMovieExtensions.h" + +@implementation QTMovieView (HBQTMovieViewExtensions) + +- (void)mouseMoved:(NSEvent *)theEvent +{ + [super mouseMoved:theEvent]; +} + +@end + +@implementation QTMovie (HBQTMovieExtensions) + +- (BOOL)isPlaying +{ + if (self.rate > 0) + { + return YES; + } + else + { + return NO; + } +} + +- (NSString *)timecode +{ + QTTime time = [self currentTime]; + double timeInSeconds = (double)time.timeValue / time.timeScale; + UInt16 seconds = (UInt16)fmod(timeInSeconds, 60.0); + UInt16 minutes = (UInt16)fmod(timeInSeconds / 60.0, 60.0); + UInt16 hours = (UInt16)(timeInSeconds / (60.0 * 60.0)); + UInt16 milliseconds = (UInt16)(timeInSeconds - (int) timeInSeconds) * 1000; + return [NSString stringWithFormat:@"%02d:%02d:%02d.%03d", hours, minutes, seconds, milliseconds]; +} + +- (void)setCurrentTimeDouble:(double)value +{ + long timeScale = [[self attributeForKey:QTMovieTimeScaleAttribute] longValue]; + [self setCurrentTime:QTMakeTime((long long)value * timeScale, timeScale)]; +} + +@end
\ No newline at end of file |