C2F0F2D016BAEEE900187C19 /* StructureRareData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StructureRareData.cpp; sourceTree = "<group>"; };
C2FC9BD216644DFB00810D33 /* CopiedBlockInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CopiedBlockInlines.h; sourceTree = "<group>"; };
C2FE18A316BAEC4000AF3061 /* StructureRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureRareData.h; sourceTree = "<group>"; };
- FEE7D5A00D99AC04005351F6 /* iOS.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
D21202280AD4310C00ED79B6 /* DateConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DateConversion.cpp; sourceTree = "<group>"; };
D21202290AD4310C00ED79B6 /* DateConversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DateConversion.h; sourceTree = "<group>"; };
DDF7ABD211F60ED200108E36 /* GCActivityCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCActivityCallback.h; sourceTree = "<group>"; };
FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Watchdog.cpp; sourceTree = "<group>"; };
FED94F2C171E3E2300BE77A4 /* Watchdog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Watchdog.h; sourceTree = "<group>"; };
FED94F2D171E3E2300BE77A4 /* WatchdogMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WatchdogMac.cpp; sourceTree = "<group>"; };
+ FEE7D5A00D99AC04005351F6 /* iOS.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = iOS.xcconfig; sourceTree = "<group>"; };
FEF6835A174343CC00A32E25 /* JITStubsARM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubsARM.h; sourceTree = "<group>"; };
FEF6835B174343CC00A32E25 /* JITStubsARMv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubsARMv7.h; sourceTree = "<group>"; };
FEF6835C174343CC00A32E25 /* JITStubsX86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubsX86_64.h; sourceTree = "<group>"; };
+2013-10-24 Jer Noble <jer.noble@apple.com>
+
+ [Mac] Add helper methods to convert CMTime <--> MediaTime
+ https://bugs.webkit.org/show_bug.cgi?id=123285
+
+ Reviewed by Eric Carlson.
+
+ Add a #ifdef header_h protector.
+
+ * wtf/MediaTime.h:
+
2013-10-24 Mark Rowe <mrowe@apple.com>
Remove references to OS X 10.7 from Xcode configuration settings.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef MediaTime_h
+#define MediaTime_h
+
#include <wtf/FastMalloc.h>
#include <cmath>
using WTF::MediaTime;
using WTF::abs;
+
+#endif
+2013-10-24 Jer Noble <jer.noble@apple.com>
+
+ [Mac] Add helper methods to convert CMTime <--> MediaTime
+ https://bugs.webkit.org/show_bug.cgi?id=123285
+
+ Reviewed by Eric Carlson.
+
+ Add utility methods to convert between CMTime (a rational time class) and MediaTime.
+ Once there, PlatformClockCM can now vend and accept MediaTimes for currentTime.
+
+ * platform/mac/MediaTimeMac.h:
+ * platform/mac/MediaTimeMac.cpp:
+ (WebCore::toMediaTime): Added conversion utility method.
+ (WebCore::toCMTime): Ditto.
+
+ * platform/mac/PlatformClockCM.h:
+ * platform/mac/PlatformClockCM.mm:
+ (PlatformClockCM::setCurrentMediaTime): Added.
+ (PlatformClockCM::currentMediaTime): Added.
+
+ * WebCore.xcodeproj/project.pbxproj: Add new files to project.
+
2013-10-24 Mark Rowe <mrowe@apple.com>
Remove references to OS X 10.7 from Xcode configuration settings.
CD61FE851794CC59004101EB /* JSWebKitSourceBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = CD61FE811794CC59004101EB /* JSWebKitSourceBuffer.h */; };
CD61FE861794CC59004101EB /* JSWebKitSourceBufferList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD61FE821794CC59004101EB /* JSWebKitSourceBufferList.cpp */; };
CD61FE871794CC59004101EB /* JSWebKitSourceBufferList.h in Headers */ = {isa = PBXBuildFile; fileRef = CD61FE831794CC59004101EB /* JSWebKitSourceBufferList.h */; };
+ CD641EBF1819B36000EE4C41 /* MediaTimeMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD641EBD1819B35900EE4C41 /* MediaTimeMac.cpp */; };
+ CD641EC01819B36000EE4C41 /* MediaTimeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EBE1819B35900EE4C41 /* MediaTimeMac.h */; };
CD7E05221651C28200C1201F /* WebCoreAVFResourceLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD7E05211651A84100C1201F /* WebCoreAVFResourceLoader.mm */; };
CD82030A1395AB6A00F956C6 /* WebVideoFullscreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */; settings = {ATTRIBUTES = (Private, ); }; };
CD82030B1395AB6A00F956C6 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203071395AB6A00F956C6 /* WebVideoFullscreenController.mm */; settings = {COMPILER_FLAGS = "-Wno-undef -Wno-deprecated-declarations"; }; };
CD61FE811794CC59004101EB /* JSWebKitSourceBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitSourceBuffer.h; sourceTree = "<group>"; };
CD61FE821794CC59004101EB /* JSWebKitSourceBufferList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitSourceBufferList.cpp; sourceTree = "<group>"; };
CD61FE831794CC59004101EB /* JSWebKitSourceBufferList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitSourceBufferList.h; sourceTree = "<group>"; };
+ CD641EBD1819B35900EE4C41 /* MediaTimeMac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTimeMac.cpp; sourceTree = "<group>"; };
+ CD641EBE1819B35900EE4C41 /* MediaTimeMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaTimeMac.h; sourceTree = "<group>"; };
CD7E05201651A84100C1201F /* WebCoreAVFResourceLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebCoreAVFResourceLoader.h; path = objc/WebCoreAVFResourceLoader.h; sourceTree = "<group>"; };
CD7E05211651A84100C1201F /* WebCoreAVFResourceLoader.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WebCoreAVFResourceLoader.mm; path = objc/WebCoreAVFResourceLoader.mm; sourceTree = "<group>"; };
CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenController.h; sourceTree = "<group>"; };
06E81EEB0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm */,
BC25B528131C6D3900180E10 /* LocalizedStringsMac.cpp */,
1402645D0AFDC19B005919E2 /* LoggingMac.mm */,
+ CD641EBD1819B35900EE4C41 /* MediaTimeMac.cpp */,
+ CD641EBE1819B35900EE4C41 /* MediaTimeMac.h */,
657EDA0A1385CBD8004E0645 /* MemoryPressureHandlerMac.mm */,
BC772C5D0C4EB3440083285F /* MIMETypeRegistryMac.mm */,
93500F3113FDE3BE0099EC24 /* NSScrollerImpDetails.h */,
1A71D57C0F33819000F9CE4E /* IdentifierRep.h in Headers */,
5913A24213D49EBA00F5B05C /* IdentifiersFactory.h in Headers */,
49E911C50EF86D47009D0CAF /* IdentityTransformOperation.h in Headers */,
+ CD641EC01819B36000EE4C41 /* MediaTimeMac.h in Headers */,
C0C054CD1118C8E400CE2636 /* IDLParser.pm in Headers */,
C3CF17A515B0063F00276D39 /* IdTargetObserver.h in Headers */,
C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */,
CDA98E0616039E1F00FEA3B1 /* JSMediaKeySession.cpp in Sources */,
BC3C39B60C0D3D8D005F4D7A /* JSMediaList.cpp in Sources */,
D3A94A46122DC40F00A37BBC /* JSMediaQueryList.cpp in Sources */,
+ CD641EBF1819B36000EE4C41 /* MediaTimeMac.cpp in Sources */,
FDBD480C159BC6870093EB4F /* JSMediaStreamAudioSourceNode.cpp in Sources */,
E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */,
E1A5F99B0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp in Sources */,
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MediaTimeMac.h"
+
+#if USE(COREMEDIA)
+
+namespace WebCore {
+
+MediaTime toMediaTime(const CMTime& cmTime)
+{
+ uint32_t flags = 0;
+ if (CMTIME_IS_VALID(cmTime))
+ flags |= MediaTime::Valid;
+ if (CMTIME_HAS_BEEN_ROUNDED(cmTime))
+ flags |= MediaTime::HasBeenRounded;
+ if (CMTIME_IS_POSITIVE_INFINITY(cmTime))
+ flags |= MediaTime::PositiveInfinite;
+ if (CMTIME_IS_NEGATIVE_INFINITY(cmTime))
+ flags |= MediaTime::NegativeInfinite;
+ if (CMTIME_IS_INDEFINITE(cmTime))
+ flags |= MediaTime::Indefinite;
+
+ return MediaTime(cmTime.value, cmTime.timescale, flags);
+}
+
+CMTime toCMTime(const MediaTime& mediaTime)
+{
+ CMTime time = {mediaTime.timeValue(), mediaTime.timeScale(), 0, 0};
+
+ if (mediaTime.isValid())
+ time.flags |= kCMTimeFlags_Valid;
+ if (mediaTime.hasBeenRounded())
+ time.flags |= kCMTimeFlags_HasBeenRounded;
+ if (mediaTime.isPositiveInfinite())
+ time.flags |= kCMTimeFlags_PositiveInfinity;
+ if (mediaTime.isNegativeInfinite())
+ time.flags |= kCMTimeFlags_NegativeInfinity;
+
+ return time;
+}
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaTimeMac_h
+#define MediaTimeMac_h
+
+#if USE(COREMEDIA)
+
+#include <CoreMedia/CMTime.h>
+#include <wtf/MediaTime.h>
+
+namespace WebCore {
+
+CMTime toCMTime(const MediaTime&);
+MediaTime toMediaTime(const CMTime&);
+
+}
+
+#endif
+
+#endif
#if USE(COREMEDIA)
#include "Clock.h"
+#include <wtf/MediaTime.h>
#include <wtf/RetainPtr.h>
typedef struct OpaqueCMTimebase* CMTimebaseRef;
PlatformClockCM();
PlatformClockCM(CMClockRef);
-private:
- void initializeWithTimingSource(CMClockRef);
-
virtual void setCurrentTime(double) OVERRIDE;
virtual double currentTime() const OVERRIDE;
+ void setCurrentMediaTime(const MediaTime&);
+ MediaTime currentMediaTime() const;
+
virtual void setPlayRate(double) OVERRIDE;
virtual double playRate() const OVERRIDE { return m_rate; }
virtual void stop() OVERRIDE;
virtual bool isRunning() const OVERRIDE { return m_running; }
+private:
+ void initializeWithTimingSource(CMClockRef);
+
RetainPtr<CMTimebaseRef> m_timebase;
double m_rate;
bool m_running;
#import "PlatformClockCM.h"
+#import "MediaTimeMac.h"
#import "SoftLinking.h"
#import <CoreMedia/CMAudioDeviceClock.h>
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)