[Mac] Add helper methods to convert CMTime <--> MediaTime
[WebKit-https.git] / Source / WebCore / platform / mac / PlatformClockCM.mm
index 117514a23d48ce3086149d1ad4a0397ecf015f6d..33f54c9a14f30e4a252eb5b820b4eaaa65c7e035 100644 (file)
@@ -29,6 +29,7 @@
 
 #import "PlatformClockCM.h"
 
+#import "MediaTimeMac.h"
 #import "SoftLinking.h"
 #import <CoreMedia/CMAudioDeviceClock.h>
 
@@ -84,6 +85,16 @@ double PlatformClockCM::currentTime() const
     return CMTimeGetSeconds(cmTime);
 }
 
+void PlatformClockCM::setCurrentMediaTime(const MediaTime& time)
+{
+    CMTimebaseSetTime(m_timebase.get(), toCMTime(time));
+}
+
+MediaTime PlatformClockCM::currentMediaTime() const
+{
+    return toMediaTime(CMTimebaseGetTime(m_timebase.get()));
+}
+
 void PlatformClockCM::setPlayRate(double rate)
 {
     if (m_rate == rate)