summaryrefslogtreecommitdiffstats
path: root/macosx/QTKit+HBQTMovieExtensions.m
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/QTKit+HBQTMovieExtensions.m')
-rw-r--r--macosx/QTKit+HBQTMovieExtensions.m49
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