[PAL] Move MediaTimeAVFoundation into PAL
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Sep 2017 17:33:52 +0000 (17:33 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Sep 2017 17:33:52 +0000 (17:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177222

Patch by Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com> on 2017-09-21
Reviewed by Myles C. Maxfield.

Source/WebCore:

No new tests. No change in behavior..

* Configurations/WebCore.unexp:
* PlatformAppleWin.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/audio/mac/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::pushSamples):
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::process):
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
* platform/graphics/avfoundation/MediaSampleAVFObjC.h:
* platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::MediaPlayerPrivateAVFoundationCF::platformDuration const):
(WebCore::MediaPlayerPrivateAVFoundationCF::currentMediaTime const):
(WebCore::MediaPlayerPrivateAVFoundationCF::platformBufferedTimeRanges const):
(WebCore::MediaPlayerPrivateAVFoundationCF::platformMinTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationCF::platformMaxTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationCF::platformMaxTimeLoaded const):
(WebCore::AVFWrapper::seekToTime):
(WebCore::AVFWrapper::legibleOutputCallback):
(WebCore::AVFWrapper::createImageForTimeInRect):
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
(WebCore::ImageDecoderAVFObjC::readSampleMetadata):
(WebCore::ImageDecoderAVFObjC::storeSampleBuffer):
(WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformDuration const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::currentMediaTime const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformBufferedTimeRanges const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMinTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeLoaded const):
(WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
(-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
(-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::calculateTimelineOffset):
* platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
(WebCore::MediaSampleAVFObjC::presentationTime const):
(WebCore::MediaSampleAVFObjC::outputPresentationTime const):
(WebCore::MediaSampleAVFObjC::decodeTime const):
(WebCore::MediaSampleAVFObjC::duration const):
(WebCore::MediaSampleAVFObjC::outputDuration const):
(WebCore::MediaSampleAVFObjC::offsetTimestampsBy):
(WebCore::MediaSampleAVFObjC::setTimestamps):
(WebCore::MediaSampleAVFObjC::divide):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
(WebCore::WebCoreDecompressionSession::automaticDequeue):
(WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
(WebCore::WebCoreDecompressionSession::imageForTime):
* platform/mac/PlatformClockCM.mm:
(PlatformClockCM::setCurrentMediaTime):
(PlatformClockCM::currentMediaTime const):
* platform/mac/PlaybackSessionInterfaceMac.mm:
(WebCore::timeRangesToArray):
* platform/mac/VideoFullscreenInterfaceMac.mm:
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
* platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
(WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
* platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::OnData):
* platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:

Source/WebCore/PAL:

* config.h:
Include PALHeaderDetection.h.
Define AVFOUNDATION-releavant definitions.

* pal/PlatformWin.cmake:
Add PAL dereived sources directory to include paths.

* PAL.xcodeproj/project.pbxproj:
* pal/CMakeLists.txt:
* pal/PlatformAppleWin.cmake:
* pal/avfoundation/MediaTimeAVFoundation.cpp: Renamed from Source/WebCore/platform/graphics/avfoundation/MediaTimeAVFoundation.cpp.
* pal/avfoundation/MediaTimeAVFoundation.h: Renamed from Source/WebCore/platform/graphics/avfoundation/MediaTimeAVFoundation.h.
* pal/cf/CoreMediaSoftLink.cpp: Added.
* pal/cf/CoreMediaSoftLink.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222326 268f45cc-cd09-0410-ab3c-d52691b4dbfc

34 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Configurations/WebCore.unexp
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/PAL/config.h
Source/WebCore/PAL/pal/CMakeLists.txt
Source/WebCore/PAL/pal/PlatformAppleWin.cmake
Source/WebCore/PAL/pal/PlatformWin.cmake
Source/WebCore/PAL/pal/avfoundation/MediaTimeAVFoundation.cpp [moved from Source/WebCore/platform/graphics/avfoundation/MediaTimeAVFoundation.cpp with 99% similarity]
Source/WebCore/PAL/pal/avfoundation/MediaTimeAVFoundation.h [moved from Source/WebCore/platform/graphics/avfoundation/MediaTimeAVFoundation.h with 89% similarity]
Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp [new file with mode: 0644]
Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h [new file with mode: 0644]
Source/WebCore/PlatformAppleWin.cmake
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm
Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp
Source/WebCore/platform/graphics/avfoundation/MediaSampleAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm
Source/WebCore/platform/mac/PlatformClockCM.mm
Source/WebCore/platform/mac/PlaybackSessionInterfaceMac.mm
Source/WebCore/platform/mac/VideoFullscreenInterfaceMac.mm
Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp
Source/WebCore/platform/mediastream/mac/MockRealtimeAudioSourceMac.mm
Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.cpp
Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm

index 4f0a6ec..828fcd2 100644 (file)
@@ -1,3 +1,85 @@
+2017-09-21  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
+
+        [PAL] Move MediaTimeAVFoundation into PAL
+        https://bugs.webkit.org/show_bug.cgi?id=177222
+
+        Reviewed by Myles C. Maxfield.
+
+        No new tests. No change in behavior..
+
+        * Configurations/WebCore.unexp:
+        * PlatformAppleWin.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/audio/mac/AudioSampleDataSource.mm:
+        (WebCore::AudioSampleDataSource::pushSamples):
+        * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
+        (WebCore::AudioSourceProviderAVFObjC::process):
+        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
+        (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
+        * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
+        * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformDuration const):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::currentMediaTime const):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformBufferedTimeRanges const):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformMinTimeSeekable const):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformMaxTimeSeekable const):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformMaxTimeLoaded const):
+        (WebCore::AVFWrapper::seekToTime):
+        (WebCore::AVFWrapper::legibleOutputCallback):
+        (WebCore::AVFWrapper::createImageForTimeInRect):
+        * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
+        (WebCore::ImageDecoderAVFObjC::readSampleMetadata):
+        (WebCore::ImageDecoderAVFObjC::storeSampleBuffer):
+        (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::platformDuration const):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::currentMediaTime const):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::platformBufferedTimeRanges const):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMinTimeSeekable const):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable const):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMaxTimeLoaded const):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
+        (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
+        (-[WebCoreAVFMovieObserver legibleOutput:didOutputAttributedStrings:nativeSampleBuffers:forItemTime:]):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime const):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::calculateTimelineOffset):
+        * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
+        (WebCore::MediaSampleAVFObjC::presentationTime const):
+        (WebCore::MediaSampleAVFObjC::outputPresentationTime const):
+        (WebCore::MediaSampleAVFObjC::decodeTime const):
+        (WebCore::MediaSampleAVFObjC::duration const):
+        (WebCore::MediaSampleAVFObjC::outputDuration const):
+        (WebCore::MediaSampleAVFObjC::offsetTimestampsBy):
+        (WebCore::MediaSampleAVFObjC::setTimestamps):
+        (WebCore::MediaSampleAVFObjC::divide):
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+        (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
+        * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
+        (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
+        (WebCore::WebCoreDecompressionSession::automaticDequeue):
+        (WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
+        (WebCore::WebCoreDecompressionSession::imageForTime):
+        * platform/mac/PlatformClockCM.mm:
+        (PlatformClockCM::setCurrentMediaTime):
+        (PlatformClockCM::currentMediaTime const):
+        * platform/mac/PlaybackSessionInterfaceMac.mm:
+        (WebCore::timeRangesToArray):
+        * platform/mac/VideoFullscreenInterfaceMac.mm:
+        * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
+        (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
+        * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
+        (WebCore::RealtimeIncomingAudioSource::OnData):
+        * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
+
 2017-09-21  Alex Christensen  <achristensen@webkit.org>
 
         Fix ASAN build after r222306
index d120eb7..2357597 100644 (file)
@@ -59,3 +59,14 @@ _DDHighlightPointIsOnHighlight
 __ZTVN9Inspector17ScriptDebugServer4TaskE
 # Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
 __ZTVN9Inspector22InspectorDebuggerAgent8ListenerE
+
+# Member functions of an exported C++ class in WTF
+
+# Source/WTF/wtf/MediaTime.h
+__ZNK3WTF9MediaTime14hasBeenRoundedEv
+__ZNK3WTF9MediaTime14hasDoubleValueEv
+__ZNK3WTF9MediaTime18isNegativeInfiniteEv
+__ZNK3WTF9MediaTime18isPositiveInfiniteEv
+__ZNK3WTF9MediaTime7isValidEv
+__ZNK3WTF9MediaTime9timeScaleEv
+__ZNK3WTF9MediaTime9timeValueEv
index a8444a0..69880c1 100644 (file)
@@ -1,3 +1,25 @@
+2017-09-21  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
+
+        [PAL] Move MediaTimeAVFoundation into PAL
+        https://bugs.webkit.org/show_bug.cgi?id=177222
+
+        Reviewed by Myles C. Maxfield.
+
+        * config.h:
+        Include PALHeaderDetection.h.
+        Define AVFOUNDATION-releavant definitions.
+
+        * pal/PlatformWin.cmake:
+        Add PAL dereived sources directory to include paths.
+
+        * PAL.xcodeproj/project.pbxproj:
+        * pal/CMakeLists.txt:
+        * pal/PlatformAppleWin.cmake:
+        * pal/avfoundation/MediaTimeAVFoundation.cpp: Renamed from Source/WebCore/platform/graphics/avfoundation/MediaTimeAVFoundation.cpp.
+        * pal/avfoundation/MediaTimeAVFoundation.h: Renamed from Source/WebCore/platform/graphics/avfoundation/MediaTimeAVFoundation.h.
+        * pal/cf/CoreMediaSoftLink.cpp: Added.
+        * pal/cf/CoreMediaSoftLink.h: Added.
+
 2017-09-20  Antti Koivisto  <antti@apple.com>
 
         Remove DOM and styling support for CSS Regions
index f33c8d1..90d0b93 100644 (file)
@@ -23,6 +23,7 @@
 /* Begin PBXBuildFile section */
                0708AC331F4C874B001F788F /* Logger.h in Headers */ = {isa = PBXBuildFile; fileRef = 0708AC321F4C874A001F788F /* Logger.h */; };
                07377ADC1F5777D90027F16D /* LoggerHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 07377ADB1F5777D70027F16D /* LoggerHelper.h */; };
+               0C00CFD41F68CE4600AAC26D /* MediaTimeAVFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C00CFD21F68CE4600AAC26D /* MediaTimeAVFoundation.h */; };
                0C2D9E731EEF5AF600DBC317 /* ExportMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C2D9E721EEF5AF600DBC317 /* ExportMacros.h */; };
                0C2DA06D1F33CA8400DBC317 /* CFLocaleSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C2DA0671F33CA8400DBC317 /* CFLocaleSPI.h */; };
                0C2DA06E1F33CA8400DBC317 /* CFNetworkConnectionCacheSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C2DA0681F33CA8400DBC317 /* CFNetworkConnectionCacheSPI.h */; };
@@ -95,6 +96,9 @@
                0C77859F1F45130F00F4EBB6 /* QTKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C7785861F45130F00F4EBB6 /* QTKitSPI.h */; };
                0C7785A01F45130F00F4EBB6 /* QuickLookMacSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */; };
                0C7785A11F45130F00F4EBB6 /* TUCallSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C7785881F45130F00F4EBB6 /* TUCallSPI.h */; };
+               0CF99CA41F736375007EE793 /* MediaTimeAVFoundation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0C00CFD11F68CE4600AAC26D /* MediaTimeAVFoundation.cpp */; };
+               0CF99CA81F738437007EE793 /* CoreMediaSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0CF99CA61F738436007EE793 /* CoreMediaSoftLink.cpp */; };
+               0CF99CA91F738437007EE793 /* CoreMediaSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 0CF99CA71F738437007EE793 /* CoreMediaSoftLink.h */; };
                1C09D0531E31C44100725F18 /* CryptoDigest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C09D0521E31C44100725F18 /* CryptoDigest.h */; };
                1C09D0561E31C46500725F18 /* CryptoDigestCommonCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C09D0551E31C46500725F18 /* CryptoDigestCommonCrypto.cpp */; };
                1C09D0581E31C57E00725F18 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C09D0571E31C57E00725F18 /* config.h */; };
 /* Begin PBXFileReference section */
                0708AC321F4C874A001F788F /* Logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logger.h; sourceTree = "<group>"; };
                07377ADB1F5777D70027F16D /* LoggerHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggerHelper.h; sourceTree = "<group>"; };
+               0C00CFD11F68CE4600AAC26D /* MediaTimeAVFoundation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaTimeAVFoundation.cpp; path = avfoundation/MediaTimeAVFoundation.cpp; sourceTree = "<group>"; };
+               0C00CFD21F68CE4600AAC26D /* MediaTimeAVFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaTimeAVFoundation.h; path = avfoundation/MediaTimeAVFoundation.h; sourceTree = "<group>"; };
                0C2D9E721EEF5AF600DBC317 /* ExportMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExportMacros.h; sourceTree = "<group>"; };
                0C2DA0671F33CA8400DBC317 /* CFLocaleSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFLocaleSPI.h; sourceTree = "<group>"; };
                0C2DA0681F33CA8400DBC317 /* CFNetworkConnectionCacheSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFNetworkConnectionCacheSPI.h; sourceTree = "<group>"; };
                0C7785861F45130F00F4EBB6 /* QTKitSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QTKitSPI.h; sourceTree = "<group>"; };
                0C7785871F45130F00F4EBB6 /* QuickLookMacSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLookMacSPI.h; sourceTree = "<group>"; };
                0C7785881F45130F00F4EBB6 /* TUCallSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUCallSPI.h; sourceTree = "<group>"; };
+               0CF99CA61F738436007EE793 /* CoreMediaSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CoreMediaSoftLink.cpp; path = pal/cf/CoreMediaSoftLink.cpp; sourceTree = SOURCE_ROOT; };
+               0CF99CA71F738437007EE793 /* CoreMediaSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CoreMediaSoftLink.h; path = pal/cf/CoreMediaSoftLink.h; sourceTree = SOURCE_ROOT; };
                1C09D03D1E31C32800725F18 /* libPAL.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPAL.a; sourceTree = BUILT_PRODUCTS_DIR; };
                1C09D0521E31C44100725F18 /* CryptoDigest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoDigest.h; sourceTree = "<group>"; };
                1C09D0551E31C46500725F18 /* CryptoDigestCommonCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CryptoDigestCommonCrypto.cpp; path = commoncrypto/CryptoDigestCommonCrypto.cpp; sourceTree = "<group>"; };
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+               0C00CFCC1F68CE2300AAC26D /* avfoundation */ = {
+                       isa = PBXGroup;
+                       children = (
+                               0C00CFD11F68CE4600AAC26D /* MediaTimeAVFoundation.cpp */,
+                               0C00CFD21F68CE4600AAC26D /* MediaTimeAVFoundation.h */,
+                       );
+                       name = avfoundation;
+                       sourceTree = "<group>";
+               };
                0C2DA0651F33CA3300DBC317 /* spi */ = {
                        isa = PBXGroup;
                        children = (
                        path = mac;
                        sourceTree = "<group>";
                };
+               0CF99CA51F73841C007EE793 /* cf */ = {
+                       isa = PBXGroup;
+                       children = (
+                               0CF99CA61F738436007EE793 /* CoreMediaSoftLink.cpp */,
+                               0CF99CA71F738437007EE793 /* CoreMediaSoftLink.h */,
+                       );
+                       name = cf;
+                       path = "New Group";
+                       sourceTree = "<group>";
+               };
                1C09D0341E31C32800725F18 = {
                        isa = PBXGroup;
                        children = (
                1C09D03F1E31C32800725F18 /* pal */ = {
                        isa = PBXGroup;
                        children = (
+                               0C00CFCC1F68CE2300AAC26D /* avfoundation */,
+                               0CF99CA51F73841C007EE793 /* cf */,
                                1C09D0511E31C41200725F18 /* crypto */,
                                0C2DA0651F33CA3300DBC317 /* spi */,
                                A3788E9F1F05B7CE00679425 /* system */,
                                1C09D0581E31C57E00725F18 /* config.h in Headers */,
                                0C2DA0711F33CA8400DBC317 /* CoreAudioSPI.h in Headers */,
                                0C2DA11E1F3BE9E000DBC317 /* CoreGraphicsSPI.h in Headers */,
+                               0CF99CA91F738437007EE793 /* CoreMediaSoftLink.h in Headers */,
                                0C2DA0721F33CA8400DBC317 /* CoreMediaSPI.h in Headers */,
                                0C2DA1401F3BEB4900DBC317 /* CoreTextSPI.h in Headers */,
                                0C5AF9191F43A4C7002EAC02 /* CoreUISPI.h in Headers */,
                                0C2DA1481F3BEB4900DBC317 /* MachVMSPI.h in Headers */,
                                0C5AF91D1F43A4C7002EAC02 /* MediaPlayerSPI.h in Headers */,
                                0C77858C1F45130F00F4EBB6 /* MediaRemoteSPI.h in Headers */,
+                               0C00CFD41F68CE4600AAC26D /* MediaTimeAVFoundation.h in Headers */,
                                A1F55DCF1F5528EC00EDB75F /* MetadataSPI.h in Headers */,
                                0C5AF91E1F43A4C7002EAC02 /* MobileGestaltSPI.h in Headers */,
                                0C2DA1491F3BEB4900DBC317 /* NEFilterSourceSPI.h in Headers */,
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               0CF99CA81F738437007EE793 /* CoreMediaSoftLink.cpp in Sources */,
                                1C09D0561E31C46500725F18 /* CryptoDigestCommonCrypto.cpp in Sources */,
                                A1175B581F6B470500C4B9F0 /* DefaultSearchProvider.cpp in Sources */,
                                A30D41221F0DD0EA00B71954 /* KillRing.cpp in Sources */,
                                A30D41251F0DD12D00B71954 /* KillRingMac.mm in Sources */,
+                               0CF99CA41F736375007EE793 /* MediaTimeAVFoundation.cpp in Sources */,
                                A1175B4F1F6B337300C4B9F0 /* PopupMenu.mm in Sources */,
                                A3C66CDC1F462D6A009E6EE9 /* SessionID.cpp in Sources */,
                                A3AB6E521F3D1DC5009C14B1 /* SleepDisabler.cpp in Sources */,
index 5c3bcc3..e01af2f 100644 (file)
 #include "cmakeconfig.h"
 #endif
 
+#include <wtf/Platform.h>
+
+#if PLATFORM(WIN)
+#include <PALHeaderDetection.h>
+#endif
+
 #include <pal/ExportMacros.h>
 
 #ifdef __cplusplus
 #endif
 
 #include <wtf/DisallowCType.h>
+
+#if PLATFORM(WIN) && USE(CG) && HAVE(AVCF)
+#define USE_AVFOUNDATION 1
+
+#if HAVE(AVCF_LEGIBLE_OUTPUT)
+#define USE_AVFOUNDATION 1
+#define HAVE_AVFOUNDATION_MEDIA_SELECTION_GROUP 1
+#define HAVE_AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT 1
+#define HAVE_MEDIA_ACCESSIBILITY_FRAMEWORK 1
+#endif
+
+#endif
index 6fa1645..1f37e92 100644 (file)
@@ -17,7 +17,7 @@ set(PAL_PRIVATE_INCLUDE_DIRECTORIES
 )
 
 set(PAL_LIBRARIES
-    WTF
+    PRIVATE WTF
 )
 
 WEBKIT_FRAMEWORK_DECLARE(PAL)
index 595b33c..d16e256 100644 (file)
@@ -8,3 +8,13 @@ else ()
         spi/cg
     )
 endif ()
+
+list(APPEND PAL_SOURCES
+    avfoundation/MediaTimeAVFoundation.cpp
+
+    cf/CoreMediaSoftLink.cpp
+)
+
+list(APPEND PAL_PRIVATE_INCLUDE_DIRECTORIES
+    "${PAL_DIR}/pal/cf"
+)
index e8b1bb6..8f1ff88 100644 (file)
@@ -9,6 +9,7 @@ list(APPEND PAL_SOURCES
 list(APPEND PAL_INCLUDE_DIRECTORIES
     "${CMAKE_BINARY_DIR}"
     "${CMAKE_BINARY_DIR}/../include/private"
+    "${DERIVED_SOURCES_PAL_DIR}"
 )
 
 list(APPEND PAL_FORWARDING_HEADERS_DIRECTORIES .)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef MediaTimeAVFoundation_h
-#define MediaTimeAVFoundation_h
+#pragma once
 
 #if USE(AVFOUNDATION)
 
 #include <CoreMedia/CMTime.h>
 #include <wtf/MediaTime.h>
 
-namespace WebCore {
+namespace PAL {
 
-CMTime toCMTime(const MediaTime&);
-MediaTime toMediaTime(const CMTime&);
+PAL_EXPORT CMTime toCMTime(const MediaTime&);
+PAL_EXPORT MediaTime toMediaTime(const CMTime&);
 
 }
 
 #endif
-
-#endif
diff --git a/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp b/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp
new file mode 100644 (file)
index 0000000..bddd6bd
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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"
+
+#if USE(AVFOUNDATION)
+// FIXME: Should be USE(COREMEDIA), but this isn't currently defined on Windows.
+
+#include <pal/spi/cf/CoreMediaSPI.h>
+#include <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_SOURCE(PAL, CoreMedia)
+
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, CoreMedia, CMTimeMake, CMTime, (int64_t value, int32_t timescale), (value, timescale))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, CoreMedia, CMTimeMakeWithSeconds, CMTime, (Float64 seconds, int32_t preferredTimeScale), (seconds, preferredTimeScale))
+
+#endif // USE(AVFOUNDATION)
diff --git a/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h b/Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h
new file mode 100644 (file)
index 0000000..866118f
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#pragma once
+
+#if USE(AVFOUNDATION)
+// FIXME: Should be USE(COREMEDIA), but this isn't currently defined on Windows.
+
+#include <pal/spi/cf/CoreMediaSPI.h>
+#include <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, CoreMedia)
+
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, CoreMedia, CMTimeMake, CMTime, (int64_t value, int32_t timescale), (value, timescale))
+#define CMTimeMake softLink_CoreMedia_CMTimeMake
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, CoreMedia, CMTimeMakeWithSeconds, CMTime, (Float64 seconds, int32_t preferredTimeScale), (seconds, preferredTimeScale))
+#define CMTimeMakeWithSeconds softLink_CoreMedia_CMTimeMakeWithSeconds
+
+#endif // USE(AVFOUNDATION)
index b7955b8..66bcb16 100644 (file)
@@ -37,7 +37,6 @@ list(APPEND WebCore_SOURCES
     platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp
     platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp
     platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
-    platform/graphics/avfoundation/MediaTimeAVFoundation.cpp
     platform/graphics/avfoundation/WebMediaSessionManagerMac.cpp
 
     platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp
index 2a295e0..3101871 100644 (file)
                CD62FB961AF018E70012ED7D /* GenericTaskQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = CD62FB941AF018E70012ED7D /* GenericTaskQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CD641EB31818F5ED00EE4C41 /* MediaSourcePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EB11818F5ED00EE4C41 /* MediaSourcePrivate.h */; };
                CD641EB41818F5ED00EE4C41 /* SourceBufferPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */; };
-               CD641EBF1819B36000EE4C41 /* MediaTimeAVFoundation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD641EBD1819B35900EE4C41 /* MediaTimeAVFoundation.cpp */; };
-               CD641EC01819B36000EE4C41 /* MediaTimeAVFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EBE1819B35900EE4C41 /* MediaTimeAVFoundation.h */; };
                CD669D681D23364B004D1866 /* MediaSessionManagerCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.cpp */; };
                CD7D33431C7A123F00041293 /* PixelBufferConformerCV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD7D33411C7A123F00041293 /* PixelBufferConformerCV.cpp */; };
                CD7D33441C7A123F00041293 /* PixelBufferConformerCV.h in Headers */ = {isa = PBXBuildFile; fileRef = CD7D33421C7A123F00041293 /* PixelBufferConformerCV.h */; };
                CD62FB941AF018E70012ED7D /* GenericTaskQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericTaskQueue.h; sourceTree = "<group>"; };
                CD641EB11818F5ED00EE4C41 /* MediaSourcePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSourcePrivate.h; sourceTree = "<group>"; };
                CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivate.h; sourceTree = "<group>"; };
-               CD641EBD1819B35900EE4C41 /* MediaTimeAVFoundation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTimeAVFoundation.cpp; sourceTree = "<group>"; };
-               CD641EBE1819B35900EE4C41 /* MediaTimeAVFoundation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaTimeAVFoundation.h; sourceTree = "<group>"; };
                CD641EC7181ED60100EE4C41 /* MediaSample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaSample.h; sourceTree = "<group>"; };
                CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaSessionManagerCocoa.cpp; path = cocoa/MediaSessionManagerCocoa.cpp; sourceTree = "<group>"; };
                CD669D671D232E10004D1866 /* MediaSessionManagerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManagerMac.h; sourceTree = "<group>"; };
                                076F0D0A12B8192700C26AA4 /* MediaPlayerPrivateAVFoundation.h */,
                                CDBEAEAB19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h */,
                                CDBEAEAA19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.mm */,
-                               CD641EBD1819B35900EE4C41 /* MediaTimeAVFoundation.cpp */,
-                               CD641EBE1819B35900EE4C41 /* MediaTimeAVFoundation.h */,
                                CD336F6317FA0A4D00DDDCD0 /* VideoTrackPrivateAVF.h */,
                                0709D7901AE5557E004E42F8 /* WebMediaSessionManagerMac.cpp */,
                                0709D7911AE5557E004E42F8 /* WebMediaSessionManagerMac.h */,
                                078E091817D14D1C00420AA1 /* MediaStreamTrack.h in Headers */,
                                078E091917D14D1C00420AA1 /* MediaStreamTrackEvent.h in Headers */,
                                07FFDE69181AED420072D409 /* MediaStreamTrackPrivate.h in Headers */,
-                               CD641EC01819B36000EE4C41 /* MediaTimeAVFoundation.h in Headers */,
                                CD60C0C7193E87C7003C656B /* MediaTimeQTKit.h in Headers */,
                                932CC0B71DFFD158004C0F9F /* MediaTrackConstraints.h in Headers */,
                                07C1C0E21BFB600100BD2256 /* MediaTrackSupportedConstraints.h in Headers */,
                                078E090217D14CEE00420AA1 /* MediaStreamTrack.cpp in Sources */,
                                078E090317D14CEE00420AA1 /* MediaStreamTrackEvent.cpp in Sources */,
                                07FFDE68181AED420072D409 /* MediaStreamTrackPrivate.cpp in Sources */,
-                               CD641EBF1819B36000EE4C41 /* MediaTimeAVFoundation.cpp in Sources */,
                                CD60C0C6193E87C7003C656B /* MediaTimeQTKit.mm in Sources */,
                                932CC0F71DFFDA1F004C0F9F /* MediaTrackConstraints.cpp in Sources */,
                                51E1BAC21BD8064E0055D81F /* MemoryBackingStoreTransaction.cpp in Sources */,
index dd62c0e..90f36dc 100644 (file)
 #include "CAAudioStreamDescription.h"
 #include "CARingBuffer.h"
 #include "Logging.h"
-#include "MediaTimeAVFoundation.h"
 #include <AudioToolbox/AudioConverter.h>
 #include <mach/mach.h>
 #include <mach/mach_time.h>
 #include <mutex>
+#include <pal/avfoundation/MediaTimeAVFoundation.h>
 #include <syslog.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/StringPrintStream.h>
@@ -192,7 +192,7 @@ void AudioSampleDataSource::pushSamples(const AudioStreamBasicDescription& sampl
     ASSERT(m_ringBuffer);
     
     WebAudioBufferList list(*m_inputDescription, sampleBuffer);
-    pushSamplesInternal(list, toMediaTime(CMSampleBufferGetPresentationTimeStamp(sampleBuffer)), CMSampleBufferGetNumSamples(sampleBuffer));
+    pushSamplesInternal(list, PAL::toMediaTime(CMSampleBufferGetPresentationTimeStamp(sampleBuffer)), CMSampleBufferGetNumSamples(sampleBuffer));
 }
 
 void AudioSampleDataSource::pushSamples(const MediaTime& sampleTime, const PlatformAudioData& audioData, size_t sampleCount)
index 81f722f..642c716 100644 (file)
 #import "AudioSourceProviderClient.h"
 #import "CARingBuffer.h"
 #import "Logging.h"
-#import "MediaTimeAVFoundation.h"
 #import <AVFoundation/AVAssetTrack.h>
 #import <AVFoundation/AVAudioMix.h>
 #import <AVFoundation/AVMediaFormat.h>
 #import <AVFoundation/AVPlayerItem.h>
 #import <mutex>
 #import <objc/runtime.h>
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 #import <wtf/Lock.h>
 #import <wtf/MainThread.h>
 
@@ -367,13 +367,13 @@ void AudioSourceProviderAVFObjC::process(MTAudioProcessingTapRef tap, CMItemCoun
     if (status != noErr || !itemCount)
         return;
 
-    MediaTime rangeStart = toMediaTime(rangeOut.start);
-    MediaTime rangeDuration = toMediaTime(rangeOut.duration);
+    MediaTime rangeStart = PAL::toMediaTime(rangeOut.start);
+    MediaTime rangeDuration = PAL::toMediaTime(rangeOut.duration);
 
     if (rangeStart.isInvalid())
         return;
 
-    MediaTime currentTime = toMediaTime(CMTimebaseGetTime([m_avPlayerItem timebase]));
+    MediaTime currentTime = PAL::toMediaTime(CMTimebaseGetTime([m_avPlayerItem timebase]));
     if (currentTime.isInvalid())
         return;
 
index 8d45d37..e38d595 100644 (file)
 #include "InbandTextTrackPrivateClient.h"
 #include "Logging.h"
 #include "MediaPlayer.h"
-#include "MediaTimeAVFoundation.h"
+#include <pal/avfoundation/MediaTimeAVFoundation.h>
 #include <runtime/ArrayBuffer.h>
 #include <runtime/DataView.h>
 #include <runtime/Int8Array.h>
 #include <wtf/MediaTime.h>
+#include <wtf/StringPrintStream.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
 #include <wtf/unicode/CharacterNames.h>
-#include <wtf/StringPrintStream.h>
-
 #include "CoreMediaSoftLink.h"
 
 namespace WebCore {
@@ -555,7 +554,7 @@ bool InbandTextTrackPrivateAVF::readNativeSampleBuffer(CFArrayRef nativeSamples,
         return false;
     }
 
-    duration = toMediaTime(timingInfo.duration);
+    duration = PAL::toMediaTime(timingInfo.duration);
 
     CMBlockBufferRef blockBuffer = CMSampleBufferGetDataBuffer(sampleBuffer);
     size_t bufferLength = CMBlockBufferGetDataLength(blockBuffer);
index e334ca4..548034d 100644 (file)
@@ -26,7 +26,7 @@
 #pragma once
 
 #include "MediaSample.h"
-#include "MediaTimeAVFoundation.h"
+#include <pal/avfoundation/MediaTimeAVFoundation.h>
 
 #include <runtime/Uint8ClampedArray.h>
 #include <wtf/Forward.h>
index 0166d21..d4fec0b 100644 (file)
@@ -34,8 +34,8 @@
 #include "InbandTextTrackPrivate.h"
 #include "InbandTextTrackPrivateAVF.h"
 #include "Logging.h"
-#include "MediaTimeAVFoundation.h"
 #include <JavaScriptCore/ArrayBuffer.h>
+#include <pal/avfoundation/MediaTimeAVFoundation.h>
 #include <wtf/SoftLinking.h>
 
 #include <AVFoundationCF/AVCFPlayerItemLegibleOutput.h>
index 9035244..e24cac4 100644 (file)
 #else
 #include "InbandTextTrackPrivateLegacyAVCF.h"
 #endif
-#include "MediaTimeAVFoundation.h"
-#include "URL.h"
 #include "Logging.h"
 #include "PlatformCALayerClient.h"
 #include "PlatformCALayerWin.h"
 #include "TimeRanges.h"
+#include "URL.h"
 #include "WebCoreAVCFResourceLoader.h"
+#include <pal/avfoundation/MediaTimeAVFoundation.h>
 
 #include <AVFoundationCF/AVCFPlayerItem.h>
 #if HAVE(AVFOUNDATION_LEGIBLE_OUTPUT_SUPPORT)
@@ -592,7 +592,7 @@ MediaTime MediaPlayerPrivateAVFoundationCF::platformDuration() const
         cmDuration = AVCFAssetGetDuration(avAsset(m_avfWrapper));
 
     if (CMTIME_IS_NUMERIC(cmDuration))
-        return toMediaTime(cmDuration);
+        return PAL::toMediaTime(cmDuration);
 
     if (CMTIME_IS_INDEFINITE(cmDuration))
         return MediaTime::positiveInfiniteTime();
@@ -608,7 +608,7 @@ MediaTime MediaPlayerPrivateAVFoundationCF::currentMediaTime() const
 
     CMTime itemTime = AVCFPlayerItemGetCurrentTime(avPlayerItem(m_avfWrapper));
     if (CMTIME_IS_NUMERIC(itemTime))
-        return max(toMediaTime(itemTime), MediaTime::zeroTime());
+        return max(PAL::toMediaTime(itemTime), MediaTime::zeroTime());
 
     return MediaTime::zeroTime();
 }
@@ -694,8 +694,8 @@ std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateAVFoundationCF::platformBu
         CMTime duration = CMTimeMakeFromDictionary(static_cast<CFDictionaryRef>(CFDictionaryGetValue(range, CMTimeRangeDurationKey())));
         
         if (timeRangeIsValidAndNotEmpty(start, duration)) {
-            MediaTime rangeStart = toMediaTime(start);
-            MediaTime rangeEnd = rangeStart + toMediaTime(duration);
+            MediaTime rangeStart = PAL::toMediaTime(start);
+            MediaTime rangeEnd = rangeStart + PAL::toMediaTime(duration);
             timeRanges->add(rangeStart, rangeEnd);
         }
     }
@@ -720,7 +720,7 @@ MediaTime MediaPlayerPrivateAVFoundationCF::platformMinTimeSeekable() const
             continue;
 
         hasValidRange = true; 
-        MediaTime startOfRange = toMediaTime(start); 
+        MediaTime startOfRange = PAL::toMediaTime(start);
         if (minTimeSeekable > startOfRange) 
             minTimeSeekable = startOfRange; 
     } 
@@ -745,7 +745,7 @@ MediaTime MediaPlayerPrivateAVFoundationCF::platformMaxTimeSeekable() const
         if (!timeRangeIsValidAndNotEmpty(start, duration))
             continue;
         
-        MediaTime endOfRange = toMediaTime(CMTimeAdd(start, duration));
+        MediaTime endOfRange = PAL::toMediaTime(CMTimeAdd(start, duration));
         if (maxTimeSeekable < endOfRange)
             maxTimeSeekable = endOfRange;
     }
@@ -771,7 +771,7 @@ MediaTime MediaPlayerPrivateAVFoundationCF::platformMaxTimeLoaded() const
         if (!timeRangeIsValidAndNotEmpty(start, duration))
             continue;
         
-        MediaTime endOfRange = toMediaTime(CMTimeAdd(start, duration));
+        MediaTime endOfRange = PAL::toMediaTime(CMTimeAdd(start, duration));
         if (maxTimeLoaded < endOfRange)
             maxTimeLoaded = endOfRange;
     }
@@ -1795,9 +1795,9 @@ void AVFWrapper::seekCompletedCallback(AVCFPlayerItemRef, Boolean finished, void
 void AVFWrapper::seekToTime(const MediaTime& time, const MediaTime& negativeTolerance, const MediaTime& positiveTolerance)
 {
     ASSERT(avPlayerItem());
-    CMTime cmTime = toCMTime(time);
-    CMTime cmBefore = toCMTime(negativeTolerance);
-    CMTime cmAfter = toCMTime(positiveTolerance);
+    CMTime cmTime = PAL::toCMTime(time);
+    CMTime cmBefore = PAL::toCMTime(negativeTolerance);
+    CMTime cmAfter = PAL::toCMTime(positiveTolerance);
     AVCFPlayerItemSeekToTimeWithToleranceAndCompletionCallback(avPlayerItem(), cmTime, cmBefore, cmAfter, &seekCompletedCallback, callbackContext());
 }
 
@@ -1851,7 +1851,7 @@ void AVFWrapper::legibleOutputCallback(void* context, AVCFPlayerItemLegibleOutpu
 
     ASSERT(legibleOutput == self->m_legibleOutput);
 
-    auto legibleOutputData = std::make_unique<LegibleOutputData>(attributedStrings, nativeSampleBuffers, toMediaTime(itemTime), context);
+    auto legibleOutputData = std::make_unique<LegibleOutputData>(attributedStrings, nativeSampleBuffers, PAL::toMediaTime(itemTime), context);
 
     dispatch_async_f(dispatch_get_main_queue(), legibleOutputData.release(), processCue);
 }
@@ -2063,7 +2063,7 @@ RetainPtr<CGImageRef> AVFWrapper::createImageForTimeInRect(const MediaTime& time
 #endif
 
     AVCFAssetImageGeneratorSetMaximumSize(m_imageGenerator.get(), CGSize(rect.size()));
-    RetainPtr<CGImageRef> rawimage = adoptCF(AVCFAssetImageGeneratorCopyCGImageAtTime(m_imageGenerator.get(), toCMTime(time), 0, 0));
+    RetainPtr<CGImageRef> rawimage = adoptCF(AVCFAssetImageGeneratorCopyCGImageAtTime(m_imageGenerator.get(), PAL::toCMTime(time), 0, 0));
     RetainPtr<CGImageRef> image = adoptCF(CGImageCreateCopyWithColorSpace(rawimage.get(), adoptCF(CGColorSpaceCreateDeviceRGB()).get()));
 
 #if !LOG_DISABLED
index 2c8023c..5fddb85 100644 (file)
@@ -33,7 +33,6 @@
 #import "FloatRect.h"
 #import "FloatSize.h"
 #import "MIMETypeRegistry.h"
-#import "MediaTimeAVFoundation.h"
 #import "SharedBuffer.h"
 #import "UTIUtilities.h"
 #import "WebCoreDecompressionSession.h"
@@ -45,6 +44,7 @@
 #import <AVFoundation/AVTime.h>
 #import <VideoToolbox/VTUtilities.h>
 #import <map>
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 #import <wtf/MainThread.h>
 #import <wtf/MediaTime.h>
 #import <wtf/NeverDestroyed.h>
@@ -338,8 +338,8 @@ void ImageDecoderAVFObjC::readSampleMetadata()
     for (size_t index = 0; index < static_cast<size_t>(sampleCount); ++index) {
         auto& sampleData = m_sampleData[index];
         sampleData.duration = Seconds(CMTimeGetSeconds([cursor currentSampleDuration]));
-        sampleData.decodeTime = toMediaTime([cursor decodeTimeStamp]);
-        sampleData.presentationTime = toMediaTime([cursor presentationTimeStamp]);
+        sampleData.decodeTime = PAL::toMediaTime([cursor decodeTimeStamp]);
+        sampleData.presentationTime = PAL::toMediaTime([cursor presentationTimeStamp]);
         auto request = adoptNS([allocAVSampleBufferRequestInstance() initWithStartCursor:cursor.get()]);
         sampleData.sample = adoptCF([m_generator createSampleBufferForRequest:request.get()]);
         m_presentationTimeToIndex.insert(std::make_pair(sampleData.presentationTime, index));
@@ -368,7 +368,7 @@ bool ImageDecoderAVFObjC::storeSampleBuffer(CMSampleBufferRef sampleBuffer)
     if (!pixelBuffer)
         return false;
 
-    auto presentationTime = toMediaTime(CMSampleBufferGetPresentationTimeStamp(sampleBuffer));
+    auto presentationTime = PAL::toMediaTime(CMSampleBufferGetPresentationTimeStamp(sampleBuffer));
     auto indexIter = m_presentationTimeToIndex.find(presentationTime);
 
     if (m_rotation && !m_rotation.value().isIdentity()) {
@@ -547,7 +547,7 @@ NativeImagePtr ImageDecoderAVFObjC::createFrameImageAtIndex(size_t index, Subsam
     if (!m_cursor)
         m_cursor = [m_track makeSampleCursorAtFirstSampleInDecodeOrder];
 
-    auto frameCursor = [m_track makeSampleCursorWithPresentationTimeStamp:toCMTime(sampleData.presentationTime)];
+    auto frameCursor = [m_track makeSampleCursorWithPresentationTimeStamp:PAL::toCMTime(sampleData.presentationTime)];
     if ([frameCursor comparePositionInDecodeOrderWithPositionOfCursor:m_cursor.get()] == NSOrderedAscending)  {
         // Rewind cursor to the last sync sample to begin decoding
         m_cursor = [frameCursor copy];
@@ -566,7 +566,7 @@ NativeImagePtr ImageDecoderAVFObjC::createFrameImageAtIndex(size_t index, Subsam
         if ([frameCursor comparePositionInDecodeOrderWithPositionOfCursor:m_cursor.get()] == NSOrderedAscending)
             return nullptr;
 
-        auto presentationTime = toMediaTime(m_cursor.get().presentationTimeStamp);
+        auto presentationTime = PAL::toMediaTime(m_cursor.get().presentationTimeStamp);
         auto indexIter = m_presentationTimeToIndex.find(presentationTime);
         advanceCursor();
 
index d99427a..6a3eda1 100644 (file)
@@ -48,7 +48,6 @@
 #import "MediaPlaybackTargetMac.h"
 #import "MediaPlaybackTargetMock.h"
 #import "MediaSelectionGroupAVFObjC.h"
-#import "MediaTimeAVFoundation.h"
 #import "OutOfBandTextTrackPrivateAVF.h"
 #import "PixelBufferConformerCV.h"
 #import "PlatformTimeRanges.h"
@@ -68,6 +67,7 @@
 #import <functional>
 #import <map>
 #import <objc/runtime.h>
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 #import <pal/spi/mac/AVFoundationSPI.h>
 #import <runtime/DataView.h>
@@ -1366,7 +1366,7 @@ MediaTime MediaPlayerPrivateAVFoundationObjC::platformDuration() const
         cmDuration = [m_avAsset.get() duration];
 
     if (CMTIME_IS_NUMERIC(cmDuration))
-        return toMediaTime(cmDuration);
+        return PAL::toMediaTime(cmDuration);
 
     if (CMTIME_IS_INDEFINITE(cmDuration))
         return MediaTime::positiveInfiniteTime();
@@ -1382,7 +1382,7 @@ MediaTime MediaPlayerPrivateAVFoundationObjC::currentMediaTime() const
 
     CMTime itemTime = [m_avPlayerItem.get() currentTime];
     if (CMTIME_IS_NUMERIC(itemTime))
-        return std::max(toMediaTime(itemTime), MediaTime::zeroTime());
+        return std::max(PAL::toMediaTime(itemTime), MediaTime::zeroTime());
 
     return MediaTime::zeroTime();
 }
@@ -1395,9 +1395,9 @@ void MediaPlayerPrivateAVFoundationObjC::seekToTime(const MediaTime& time, const
     if (m_metadataTrack)
         m_metadataTrack->flushPartialCues();
 
-    CMTime cmTime = toCMTime(time);
-    CMTime cmBefore = toCMTime(negativeTolerance);
-    CMTime cmAfter = toCMTime(positiveTolerance);
+    CMTime cmTime = PAL::toCMTime(time);
+    CMTime cmBefore = PAL::toCMTime(negativeTolerance);
+    CMTime cmAfter = PAL::toCMTime(positiveTolerance);
 
     // [AVPlayerItem seekToTime] will throw an exception if toleranceBefore is negative.
     if (CMTimeCompare(cmBefore, kCMTimeZero) < 0)
@@ -1506,7 +1506,7 @@ std::unique_ptr<PlatformTimeRanges> MediaPlayerPrivateAVFoundationObjC::platform
     for (NSValue *thisRangeValue in m_cachedLoadedRanges.get()) {
         CMTimeRange timeRange = [thisRangeValue CMTimeRangeValue];
         if (CMTIMERANGE_IS_VALID(timeRange) && !CMTIMERANGE_IS_EMPTY(timeRange))
-            timeRanges->add(toMediaTime(timeRange.start), toMediaTime(CMTimeRangeGetEnd(timeRange)));
+            timeRanges->add(PAL::toMediaTime(timeRange.start), PAL::toMediaTime(CMTimeRangeGetEnd(timeRange)));
     }
     return timeRanges;
 }
@@ -1524,7 +1524,7 @@ MediaTime MediaPlayerPrivateAVFoundationObjC::platformMinTimeSeekable() const
             continue;
 
         hasValidRange = true;
-        MediaTime startOfRange = toMediaTime(timeRange.start);
+        MediaTime startOfRange = PAL::toMediaTime(timeRange.start);
         if (minTimeSeekable > startOfRange)
             minTimeSeekable = startOfRange;
     }
@@ -1542,7 +1542,7 @@ MediaTime MediaPlayerPrivateAVFoundationObjC::platformMaxTimeSeekable() const
         if (!CMTIMERANGE_IS_VALID(timeRange) || CMTIMERANGE_IS_EMPTY(timeRange))
             continue;
         
-        MediaTime endOfRange = toMediaTime(CMTimeRangeGetEnd(timeRange));
+        MediaTime endOfRange = PAL::toMediaTime(CMTimeRangeGetEnd(timeRange));
         if (maxTimeSeekable < endOfRange)
             maxTimeSeekable = endOfRange;
     }
@@ -1560,7 +1560,7 @@ MediaTime MediaPlayerPrivateAVFoundationObjC::platformMaxTimeLoaded() const
         if (!CMTIMERANGE_IS_VALID(timeRange) || CMTIMERANGE_IS_EMPTY(timeRange))
             continue;
         
-        MediaTime endOfRange = toMediaTime(CMTimeRangeGetEnd(timeRange));
+        MediaTime endOfRange = PAL::toMediaTime(CMTimeRangeGetEnd(timeRange));
         if (maxTimeLoaded < endOfRange)
             maxTimeLoaded = endOfRange;
     }
@@ -3183,17 +3183,17 @@ void MediaPlayerPrivateAVFoundationObjC::metadataDidArrive(RetainPtr<NSArray> me
     // Set the duration of all incomplete cues before adding new ones.
     MediaTime earliestStartTime = MediaTime::positiveInfiniteTime();
     for (AVMetadataItemType *item in m_currentMetaData.get()) {
-        MediaTime start = std::max(toMediaTime(item.time), MediaTime::zeroTime());
+        MediaTime start = std::max(PAL::toMediaTime(item.time), MediaTime::zeroTime());
         if (start < earliestStartTime)
             earliestStartTime = start;
     }
     m_metadataTrack->updatePendingCueEndTimes(earliestStartTime);
 
     for (AVMetadataItemType *item in m_currentMetaData.get()) {
-        MediaTime start = std::max(toMediaTime(item.time), MediaTime::zeroTime());
+        MediaTime start = std::max(PAL::toMediaTime(item.time), MediaTime::zeroTime());
         MediaTime end = MediaTime::positiveInfiniteTime();
         if (CMTIME_IS_VALID(item.duration))
-            end = start + toMediaTime(item.duration);
+            end = start + PAL::toMediaTime(item.duration);
 
         AtomicString type = nullAtom();
         if (item.keySpace)
@@ -3456,12 +3456,12 @@ NSArray* playerKVOProperties()
         else if ([keyPath isEqualToString:@"presentationSize"])
             function = std::bind(&MediaPlayerPrivateAVFoundationObjC::presentationSizeDidChange, m_callback, FloatSize([newValue sizeValue]));
         else if ([keyPath isEqualToString:@"duration"])
-            function = std::bind(&MediaPlayerPrivateAVFoundationObjC::durationDidChange, m_callback, toMediaTime([newValue CMTimeValue]));
+            function = std::bind(&MediaPlayerPrivateAVFoundationObjC::durationDidChange, m_callback, PAL::toMediaTime([newValue CMTimeValue]));
         else if ([keyPath isEqualToString:@"timedMetadata"] && newValue) {
             MediaTime now;
             CMTime itemTime = [(AVPlayerItemType *)object currentTime];
             if (CMTIME_IS_NUMERIC(itemTime))
-                now = std::max(toMediaTime(itemTime), MediaTime::zeroTime());
+                now = std::max(PAL::toMediaTime(itemTime), MediaTime::zeroTime());
             function = std::bind(&MediaPlayerPrivateAVFoundationObjC::metadataDidArrive, m_callback, RetainPtr<NSArray>(newValue), now);
             shouldLogValue = false;
         } else if ([keyPath isEqualToString:@"canPlayFastReverse"])
@@ -3490,7 +3490,7 @@ NSArray* playerKVOProperties()
 
         if (shouldLogValue) {
             if ([keyPath isEqualToString:@"duration"])
-                m_callback->logger().debug(m_callback->logChannel(), identifier, "did change '", [keyPath UTF8String], "' to ", toMediaTime([newValue CMTimeValue]));
+                m_callback->logger().debug(m_callback->logChannel(), identifier, "did change '", [keyPath UTF8String], "' to ", PAL::toMediaTime([newValue CMTimeValue]));
             else {
                 RetainPtr<NSString> valueString = adoptNS([[NSString alloc] initWithFormat:@"%@", newValue]);
                 m_callback->logger().debug(m_callback->logChannel(), identifier, "did change '", [keyPath UTF8String], "' to ", [valueString.get() UTF8String]);
@@ -3530,7 +3530,7 @@ NSArray* playerKVOProperties()
         MediaPlayerPrivateAVFoundationObjC* callback = protectedSelf->m_callback;
         if (!callback)
             return;
-        MediaTime time = std::max(toMediaTime(itemTime), MediaTime::zeroTime());
+        MediaTime time = std::max(PAL::toMediaTime(itemTime), MediaTime::zeroTime());
         callback->processCue(protectedStrings.get(), protectedNativeSamples.get(), time);
     });
 }
index 6a204a1..5c67119 100644 (file)
@@ -37,7 +37,6 @@
 #import "Logging.h"
 #import "MediaSourcePrivateAVFObjC.h"
 #import "MediaSourcePrivateClient.h"
-#import "MediaTimeAVFoundation.h"
 #import "PixelBufferConformerCV.h"
 #import "PlatformClockCM.h"
 #import "TextTrackRepresentation.h"
@@ -49,6 +48,7 @@
 #import <AVFoundation/AVTime.h>
 #import <QuartzCore/CALayer.h>
 #import <objc_runtime.h>
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 #import <pal/spi/mac/AVFoundationSPI.h>
 #import <wtf/Deque.h>
 #import <wtf/MainThread.h>
@@ -147,7 +147,7 @@ MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC(Media
     // addPeriodicTimeObserverForInterval: throws an exception if you pass a non-numeric CMTime, so just use
     // an arbitrarily large time value of once an hour:
     __block auto weakThis = createWeakPtr();
-    m_timeJumpedObserver = [m_synchronizer addPeriodicTimeObserverForInterval:toCMTime(MediaTime::createWithDouble(3600)) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {
+    m_timeJumpedObserver = [m_synchronizer addPeriodicTimeObserverForInterval:PAL::toCMTime(MediaTime::createWithDouble(3600)) queue:dispatch_get_main_queue() usingBlock:^(CMTime time) {
 #if LOG_DISABLED
         UNUSED_PARAM(time);
 #endif
@@ -156,7 +156,7 @@ MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC(Media
             return;
 
         if (m_seeking && !m_pendingSeek) {
-            LOG(MediaSource, "MediaPlayerPrivateMediaSourceAVFObjC::m_timeJumpedObserver(%p) - time(%s)", weakThis.get(), toString(toMediaTime(time)).utf8().data());
+            LOG(MediaSource, "MediaPlayerPrivateMediaSourceAVFObjC::m_timeJumpedObserver(%p) - time(%s)", weakThis.get(), toString(PAL::toMediaTime(time)).utf8().data());
             m_seeking = false;
 
             if (shouldBePlaying())
@@ -388,7 +388,7 @@ MediaTime MediaPlayerPrivateMediaSourceAVFObjC::durationMediaTime() const
 
 MediaTime MediaPlayerPrivateMediaSourceAVFObjC::currentMediaTime() const
 {
-    MediaTime synchronizerTime = toMediaTime(CMTimebaseGetTime([m_synchronizer timebase]));
+    MediaTime synchronizerTime = PAL::toMediaTime(CMTimebaseGetTime([m_synchronizer timebase]));
     if (synchronizerTime < MediaTime::zeroTime())
         return MediaTime::zeroTime();
     if (synchronizerTime < m_lastSeekTime)
@@ -436,11 +436,11 @@ void MediaPlayerPrivateMediaSourceAVFObjC::seekInternal()
 
     LOG(MediaSource, "MediaPlayerPrivateMediaSourceAVFObjC::seekInternal(%p) - seekTime(%s)", this, toString(m_lastSeekTime).utf8().data());
 
-    MediaTime synchronizerTime = toMediaTime(CMTimebaseGetTime([m_synchronizer timebase]));
+    MediaTime synchronizerTime = PAL::toMediaTime(CMTimebaseGetTime([m_synchronizer timebase]));
     bool doesNotRequireSeek = synchronizerTime == m_lastSeekTime;
 
     m_mediaSourcePrivate->willSeek();
-    [m_synchronizer setRate:0 time:toCMTime(m_lastSeekTime)];
+    [m_synchronizer setRate:0 time:PAL::toCMTime(m_lastSeekTime)];
     m_mediaSourcePrivate->seekToTime(m_lastSeekTime);
 
     // In cases where the destination seek time precisely matches the synchronizer's existing time
@@ -859,7 +859,7 @@ void MediaPlayerPrivateMediaSourceAVFObjC::durationChanged()
 
     MediaTime duration = m_mediaSourcePrivate->duration();
     auto weakThis = createWeakPtr();
-    NSArray* times = @[[NSValue valueWithCMTime:toCMTime(duration)]];
+    NSArray* times = @[[NSValue valueWithCMTime:PAL::toCMTime(duration)]];
 
     LOG(MediaSource, "MediaPlayerPrivateMediaSourceAVFObjC::durationChanged(%p) - duration = %s", this, toString(duration).utf8().data());
 
@@ -873,7 +873,7 @@ void MediaPlayerPrivateMediaSourceAVFObjC::durationChanged()
         weakThis->pauseInternal();
         if (now < duration) {
             LOG(MediaSource, "   ERROR: boundary time observer called before duration!", weakThis.get());
-            [weakThis->m_synchronizer setRate:0 time:toCMTime(duration)];
+            [weakThis->m_synchronizer setRate:0 time:PAL::toCMTime(duration)];
         }
         weakThis->m_player->timeChanged();
 
@@ -891,7 +891,7 @@ void MediaPlayerPrivateMediaSourceAVFObjC::effectiveRateChanged()
 void MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime(const MediaTime& time, const FloatSize& size)
 {
     auto weakThis = m_sizeChangeObserverWeakPtrFactory.createWeakPtr();
-    NSArray* times = @[[NSValue valueWithCMTime:toCMTime(time)]];
+    NSArray* times = @[[NSValue valueWithCMTime:PAL::toCMTime(time)]];
     RetainPtr<id> observer = [m_synchronizer addBoundaryTimeObserverForTimes:times queue:dispatch_get_main_queue() usingBlock:[this, weakThis, size] {
         if (!weakThis)
             return;
index c42e462..9055dbf 100644 (file)
 #import "GraphicsContextCG.h"
 #import "Logging.h"
 #import "MediaStreamPrivate.h"
-#import "MediaTimeAVFoundation.h"
 #import "PixelBufferConformerCV.h"
 #import "VideoTrackPrivateMediaStream.h"
 #import <AVFoundation/AVSampleBufferDisplayLayer.h>
 #import <QuartzCore/CALayer.h>
 #import <QuartzCore/CATransaction.h>
 #import <objc_runtime.h>
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 #import <pal/spi/mac/AVFoundationSPI.h>
 #import <wtf/Function.h>
 #import <wtf/MainThread.h>
@@ -304,7 +304,7 @@ MediaTime MediaPlayerPrivateMediaStreamAVFObjC::calculateTimelineOffset(const Me
         sampleTime = sample.presentationTime();
     MediaTime timelineOffset = streamTime() - sampleTime + MediaTime::createWithDouble(latency);
     if (timelineOffset.timeScale() != sampleTime.timeScale())
-        timelineOffset = toMediaTime(CMTimeConvertScale(toCMTime(timelineOffset), sampleTime.timeScale(), kCMTimeRoundingMethod_Default));
+        timelineOffset = PAL::toMediaTime(CMTimeConvertScale(PAL::toCMTime(timelineOffset), sampleTime.timeScale(), kCMTimeRoundingMethod_Default));
     return timelineOffset;
 }
 
index 0f895ae..1089a78 100644 (file)
@@ -74,27 +74,27 @@ RefPtr<MediaSampleAVFObjC> MediaSampleAVFObjC::createImageSample(Vector<uint8_t>
 
 MediaTime MediaSampleAVFObjC::presentationTime() const
 {
-    return toMediaTime(CMSampleBufferGetPresentationTimeStamp(m_sample.get()));
+    return PAL::toMediaTime(CMSampleBufferGetPresentationTimeStamp(m_sample.get()));
 }
 
 MediaTime MediaSampleAVFObjC::outputPresentationTime() const
 {
-    return toMediaTime(CMSampleBufferGetOutputPresentationTimeStamp(m_sample.get()));
+    return PAL::toMediaTime(CMSampleBufferGetOutputPresentationTimeStamp(m_sample.get()));
 }
 
 MediaTime MediaSampleAVFObjC::decodeTime() const
 {
-    return toMediaTime(CMSampleBufferGetDecodeTimeStamp(m_sample.get()));
+    return PAL::toMediaTime(CMSampleBufferGetDecodeTimeStamp(m_sample.get()));
 }
 
 MediaTime MediaSampleAVFObjC::duration() const
 {
-    return toMediaTime(CMSampleBufferGetDuration(m_sample.get()));
+    return PAL::toMediaTime(CMSampleBufferGetDuration(m_sample.get()));
 }
 
 MediaTime MediaSampleAVFObjC::outputDuration() const
 {
-    return toMediaTime(CMSampleBufferGetOutputDuration(m_sample.get()));
+    return PAL::toMediaTime(CMSampleBufferGetOutputDuration(m_sample.get()));
 }
 
 size_t MediaSampleAVFObjC::sizeInBytes() const
@@ -176,8 +176,8 @@ void MediaSampleAVFObjC::offsetTimestampsBy(const MediaTime& offset)
         return;
     
     for (auto& timing : timingInfoArray) {
-        timing.presentationTimeStamp = toCMTime(toMediaTime(timing.presentationTimeStamp) + offset);
-        timing.decodeTimeStamp = toCMTime(toMediaTime(timing.decodeTimeStamp) + offset);
+        timing.presentationTimeStamp = PAL::toCMTime(PAL::toMediaTime(timing.presentationTimeStamp) + offset);
+        timing.decodeTimeStamp = PAL::toCMTime(PAL::toMediaTime(timing.decodeTimeStamp) + offset);
     }
     
     CMSampleBufferRef newSample;
@@ -199,8 +199,8 @@ void MediaSampleAVFObjC::setTimestamps(const WTF::MediaTime &presentationTimesta
         return;
     
     for (auto& timing : timingInfoArray) {
-        timing.presentationTimeStamp = toCMTime(presentationTimestamp);
-        timing.decodeTimeStamp = toCMTime(decodeTimestamp);
+        timing.presentationTimeStamp = PAL::toCMTime(presentationTimestamp);
+        timing.decodeTimeStamp = PAL::toCMTime(decodeTimestamp);
     }
     
     CMSampleBufferRef newSample;
@@ -229,7 +229,7 @@ std::pair<RefPtr<MediaSample>, RefPtr<MediaSample>> MediaSampleAVFObjC::divide(c
     CFIndex samplesBeforePresentationTime = 0;
 
     CMSampleBufferCallBlockForEachSample(m_sample.get(), [&] (CMSampleBufferRef sampleBuffer, CMItemCount) -> OSStatus {
-        if (toMediaTime(CMSampleBufferGetPresentationTimeStamp(sampleBuffer)) >= presentationTime)
+        if (PAL::toMediaTime(CMSampleBufferGetPresentationTimeStamp(sampleBuffer)) >= presentationTime)
             return 1;
         ++samplesBeforePresentationTime;
         return noErr;
index c900e7e..cb6b352 100644 (file)
@@ -39,7 +39,6 @@
 #import "MediaSample.h"
 #import "MediaSampleAVFObjC.h"
 #import "MediaSourcePrivateAVFObjC.h"
-#import "MediaTimeAVFoundation.h"
 #import "NotImplemented.h"
 #import "SourceBufferPrivateClient.h"
 #import "TimeRanges.h"
@@ -49,6 +48,7 @@
 #import <QuartzCore/CALayer.h>
 #import <map>
 #import <objc/runtime.h>
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 #import <pal/spi/mac/AVFoundationSPI.h>
 #import <runtime/TypedArrayInlines.h>
 #import <wtf/BlockObjCExceptions.h>
@@ -526,10 +526,10 @@ void SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset(AVAsset* asset)
     SourceBufferPrivateClient::InitializationSegment segment;
 
     if ([m_asset respondsToSelector:@selector(overallDurationHint)])
-        segment.duration = toMediaTime([m_asset overallDurationHint]);
+        segment.duration = PAL::toMediaTime([m_asset overallDurationHint]);
 
     if (segment.duration.isInvalid() || segment.duration == MediaTime::zeroTime())
-        segment.duration = toMediaTime([m_asset duration]);
+        segment.duration = PAL::toMediaTime([m_asset duration]);
 
     for (AVAssetTrack* track in [m_asset tracks]) {
         if ([track hasMediaCharacteristic:AVMediaCharacteristicLegible]) {
index e9cdc54..e98b84e 100644 (file)
 #if USE(VIDEOTOOLBOX)
 
 #import "Logging.h"
-#import "MediaTimeAVFoundation.h"
 #import "PixelBufferConformerCV.h"
 #import <CoreMedia/CMBufferQueue.h>
 #import <CoreMedia/CMFormatDescription.h>
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 #import <wtf/MainThread.h>
 #import <wtf/MediaTime.h>
 #import <wtf/StringPrintStream.h>
@@ -306,7 +306,7 @@ void WebCoreDecompressionSession::handleDecompressionOutput(bool displaying, OSS
         auto currentTime = CMTimebaseGetTime(m_timebase.get());
         auto currentRate = CMTimebaseGetRate(m_timebase.get());
         if (currentRate > 0 && CMTimeCompare(presentationTimeStamp, currentTime) < 0)
-            m_totalFrameDelay += toMediaTime(CMTimeSubtract(currentTime, presentationTimeStamp));
+            m_totalFrameDelay += PAL::toMediaTime(CMTimeSubtract(currentTime, presentationTimeStamp));
     }
 
     dispatch_async(m_enqueingQueue.get(), [protectedThis = makeRefPtr(this), status, imageSampleBuffer = adoptCF(rawImageSampleBuffer), infoFlags, displaying] {
@@ -334,15 +334,15 @@ void WebCoreDecompressionSession::automaticDequeue()
     if (!m_timebase)
         return;
 
-    auto time = toMediaTime(CMTimebaseGetTime(m_timebase.get()));
+    auto time = PAL::toMediaTime(CMTimebaseGetTime(m_timebase.get()));
     LOG(Media, "WebCoreDecompressionSession::automaticDequeue(%p) - purging all samples before time(%s)", this, toString(time).utf8().data());
 
     MediaTime nextFireTime = MediaTime::positiveInfiniteTime();
     bool releasedImageBuffers = false;
 
     while (CMSampleBufferRef firstSample = (CMSampleBufferRef)CMBufferQueueGetHead(m_producerQueue.get())) {
-        MediaTime presentationTimestamp = toMediaTime(CMSampleBufferGetPresentationTimeStamp(firstSample));
-        MediaTime duration = toMediaTime(CMSampleBufferGetDuration(firstSample));
+        MediaTime presentationTimestamp = PAL::toMediaTime(CMSampleBufferGetPresentationTimeStamp(firstSample));
+        MediaTime duration = PAL::toMediaTime(CMSampleBufferGetDuration(firstSample));
         MediaTime presentationEndTimestamp = presentationTimestamp + duration;
         if (time > presentationEndTimestamp) {
             CFRelease(CMBufferQueueDequeueAndRetain(m_producerQueue.get()));
@@ -351,8 +351,8 @@ void WebCoreDecompressionSession::automaticDequeue()
         }
 
 #if !LOG_DISABLED
-        auto begin = toMediaTime(CMBufferQueueGetFirstPresentationTimeStamp(m_producerQueue.get()));
-        auto end = toMediaTime(CMBufferQueueGetEndPresentationTimeStamp(m_producerQueue.get()));
+        auto begin = PAL::toMediaTime(CMBufferQueueGetFirstPresentationTimeStamp(m_producerQueue.get()));
+        auto end = PAL::toMediaTime(CMBufferQueueGetEndPresentationTimeStamp(m_producerQueue.get()));
         LOG(Media, "WebCoreDecompressionSession::automaticDequeue(%p) - queue(%s -> %s)", this, toString(begin).utf8().data(), toString(end).utf8().data());
 #endif
 
@@ -364,7 +364,7 @@ void WebCoreDecompressionSession::automaticDequeue()
         maybeBecomeReadyForMoreMediaData();
 
     LOG(Media, "WebCoreDecompressionSession::automaticDequeue(%p) - queue empty", this, toString(time).utf8().data());
-    CMTimebaseSetTimerDispatchSourceNextFireTime(m_timebase.get(), m_timerSource.get(), toCMTime(nextFireTime), 0);
+    CMTimebaseSetTimerDispatchSourceNextFireTime(m_timebase.get(), m_timerSource.get(), PAL::toCMTime(nextFireTime), 0);
 }
 
 void WebCoreDecompressionSession::enqueueDecodedSample(CMSampleBufferRef sample, bool displaying)
@@ -382,9 +382,9 @@ void WebCoreDecompressionSession::enqueueDecodedSample(CMSampleBufferRef sample,
     CMBufferQueueEnqueue(m_producerQueue.get(), sample);
 
 #if !LOG_DISABLED
-    auto begin = toMediaTime(CMBufferQueueGetFirstPresentationTimeStamp(m_producerQueue.get()));
-    auto end = toMediaTime(CMBufferQueueGetEndPresentationTimeStamp(m_producerQueue.get()));
-    auto presentationTime = toMediaTime(CMSampleBufferGetPresentationTimeStamp(sample));
+    auto begin = PAL::toMediaTime(CMBufferQueueGetFirstPresentationTimeStamp(m_producerQueue.get()));
+    auto end = PAL::toMediaTime(CMBufferQueueGetEndPresentationTimeStamp(m_producerQueue.get()));
+    auto presentationTime = PAL::toMediaTime(CMSampleBufferGetPresentationTimeStamp(sample));
     LOG(Media, "WebCoreDecompressionSession::enqueueDecodedSample(%p) - presentationTime(%s), framesBeingDecoded(%d), producerQueue(%s -> %s)", this, toString(presentationTime).utf8().data(), m_framesBeingDecoded, toString(begin).utf8().data(), toString(end).utf8().data());
 #endif
 
@@ -395,9 +395,9 @@ void WebCoreDecompressionSession::enqueueDecodedSample(CMSampleBufferRef sample,
         return;
 
     if (m_timebase) {
-        auto currentTime = toMediaTime(CMTimebaseGetTime(m_timebase.get()));
-        auto presentationStartTime = toMediaTime(CMSampleBufferGetPresentationTimeStamp(sample));
-        auto presentationEndTime = presentationStartTime + toMediaTime(CMSampleBufferGetDuration(sample));
+        auto currentTime = PAL::toMediaTime(CMTimebaseGetTime(m_timebase.get()));
+        auto presentationStartTime = PAL::toMediaTime(CMSampleBufferGetPresentationTimeStamp(sample));
+        auto presentationEndTime = presentationStartTime + PAL::toMediaTime(CMSampleBufferGetDuration(sample));
         if (currentTime < presentationStartTime || currentTime >= presentationEndTime)
             return;
     }
@@ -454,8 +454,8 @@ RetainPtr<CVPixelBufferRef> WebCoreDecompressionSession::imageForTime(const Medi
     bool allowEarlier = flags == WebCoreDecompressionSession::AllowEarlier;
     bool allowLater = flags == WebCoreDecompressionSession::AllowLater;
 
-    MediaTime startTime = toMediaTime(CMBufferQueueGetFirstPresentationTimeStamp(m_producerQueue.get()));
-    MediaTime endTime = toMediaTime(CMBufferQueueGetEndPresentationTimeStamp(m_producerQueue.get()));
+    MediaTime startTime = PAL::toMediaTime(CMBufferQueueGetFirstPresentationTimeStamp(m_producerQueue.get()));
+    MediaTime endTime = PAL::toMediaTime(CMBufferQueueGetEndPresentationTimeStamp(m_producerQueue.get()));
     if (!allowLater && time < startTime) {
         LOG(Media, "WebCoreDecompressionSession::imageForTime(%p) - time(%s) too early for queue(%s -> %s)", this, toString(time).utf8().data(), toString(startTime).utf8().data(), toString(endTime).utf8().data());
         return nullptr;
@@ -464,8 +464,8 @@ RetainPtr<CVPixelBufferRef> WebCoreDecompressionSession::imageForTime(const Medi
     bool releasedImageBuffers = false;
 
     while (CMSampleBufferRef firstSample = (CMSampleBufferRef)CMBufferQueueGetHead(m_producerQueue.get())) {
-        MediaTime presentationTimestamp = toMediaTime(CMSampleBufferGetPresentationTimeStamp(firstSample));
-        MediaTime duration = toMediaTime(CMSampleBufferGetDuration(firstSample));
+        MediaTime presentationTimestamp = PAL::toMediaTime(CMSampleBufferGetPresentationTimeStamp(firstSample));
+        MediaTime duration = PAL::toMediaTime(CMSampleBufferGetDuration(firstSample));
         MediaTime presentationEndTimestamp = presentationTimestamp + duration;
         if (!allowLater && presentationTimestamp > time)
             return nullptr;
index f61228c..69485da 100644 (file)
@@ -29,7 +29,7 @@
 
 #import "PlatformClockCM.h"
 
-#import "MediaTimeAVFoundation.h"
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 
 #import "CoreMediaSoftLink.h"
 
@@ -81,12 +81,12 @@ double PlatformClockCM::currentTime() const
 
 void PlatformClockCM::setCurrentMediaTime(const MediaTime& time)
 {
-    CMTimebaseSetTime(m_timebase.get(), toCMTime(time));
+    CMTimebaseSetTime(m_timebase.get(), PAL::toCMTime(time));
 }
 
 MediaTime PlatformClockCM::currentMediaTime() const
 {
-    return toMediaTime(CMTimebaseGetTime(m_timebase.get()));
+    return PAL::toMediaTime(CMTimebaseGetTime(m_timebase.get()));
 }
 
 void PlatformClockCM::setPlayRate(double rate)
index 2e72aff..20e60fd 100644 (file)
 
 #import "IntRect.h"
 #import "MediaSelectionOption.h"
-#import "MediaTimeAVFoundation.h"
 #import "PlaybackSessionModel.h"
 #import "TimeRanges.h"
 #import "WebPlaybackControlsManager.h"
 #import <AVFoundation/AVTime.h>
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 #import <pal/spi/cocoa/AVKitSPI.h>
 
 #import "CoreMediaSoftLink.h"
@@ -122,7 +122,7 @@ static RetainPtr<NSMutableArray> timeRangesToArray(const TimeRanges& timeRanges)
 
     for (unsigned i = 0; i < timeRanges.length(); i++) {
         const PlatformTimeRanges& ranges = timeRanges.ranges();
-        CMTimeRange range = CMTimeRangeMake(toCMTime(ranges.start(i)), toCMTime(ranges.end(i)));
+        CMTimeRange range = CMTimeRangeMake(PAL::toCMTime(ranges.start(i)), PAL::toCMTime(ranges.end(i)));
         [rangeArray addObject:[NSValue valueWithCMTimeRange:range]];
     }
 
index ab41be8..dd0b463 100644 (file)
 
 #import "IntRect.h"
 #import "Logging.h"
-#import "MediaTimeAVFoundation.h"
 #import "PlaybackSessionInterfaceMac.h"
 #import "TimeRanges.h"
 #import "VideoFullscreenChangeObserver.h"
 #import "VideoFullscreenModel.h"
 #import "WebPlaybackControlsManager.h"
 #import <AVFoundation/AVTime.h>
+#import <pal/avfoundation/MediaTimeAVFoundation.h>
 #import <pal/spi/cocoa/AVKitSPI.h>
 #import <pal/spi/mac/PIPSPI.h>
 
index c37e463..2696243 100644 (file)
 #include "CoreAudioCaptureDeviceManager.h"
 #include "CoreAudioCaptureSourceIOS.h"
 #include "Logging.h"
-#include "MediaTimeAVFoundation.h"
 #include "Timer.h"
 #include "WebAudioSourceProviderAVFObjC.h"
 #include <AudioToolbox/AudioConverter.h>
 #include <AudioUnit/AudioUnit.h>
 #include <CoreMedia/CMSync.h>
 #include <mach/mach_time.h>
+#include <pal/avfoundation/MediaTimeAVFoundation.h>
 #include <pal/spi/cf/CoreAudioSPI.h>
 #include <sys/time.h>
 #include <wtf/MainThread.h>
index 0f1c708..e1b63a9 100644 (file)
@@ -106,7 +106,7 @@ void MockRealtimeAudioSourceMac::emitSampleBuffers(uint32_t frameCount)
     CMTime startTime = CMTimeMake(m_samplesEmitted, sampleRate());
     m_samplesEmitted += frameCount;
 
-    audioSamplesAvailable(toMediaTime(startTime), *m_audioBufferList, CAAudioStreamDescription(m_streamFormat), frameCount);
+    audioSamplesAvailable(PAL::toMediaTime(startTime), *m_audioBufferList, CAAudioStreamDescription(m_streamFormat), frameCount);
 }
 
 void MockRealtimeAudioSourceMac::reconfigure()
index 9fde1a2..87538cd 100644 (file)
@@ -36,9 +36,9 @@
 #include "AudioStreamDescription.h"
 #include "CAAudioStreamDescription.h"
 #include "LibWebRTCAudioFormat.h"
-#include "MediaTimeAVFoundation.h"
 #include "WebAudioBufferList.h"
 #include "WebAudioSourceProviderAVFObjC.h"
+#include <pal/avfoundation/MediaTimeAVFoundation.h>
 
 #include "CoreMediaSoftLink.h"
 
@@ -83,7 +83,7 @@ void RealtimeIncomingAudioSource::OnData(const void* audioData, int bitsPerSampl
     ASSERT(sampleRate == 48000);
 
     CMTime startTime = CMTimeMake(m_numberOfFrames, sampleRate);
-    auto mediaTime = toMediaTime(startTime);
+    auto mediaTime = PAL::toMediaTime(startTime);
     m_numberOfFrames += numberOfFrames;
 
     AudioStreamBasicDescription newDescription = streamDescription(sampleRate, numberOfChannels);
index 7e516df..a613aaf 100644 (file)
@@ -33,7 +33,6 @@
 #import "AudioSampleDataSource.h"
 #import "AudioSourceProviderClient.h"
 #import "Logging.h"
-#import "MediaTimeAVFoundation.h"
 #import "WebAudioBufferList.h"
 #import <objc/runtime.h>
 #import <wtf/MainThread.h>