Title: [244980] trunk/Source
Revision
244980
Author
jer.no...@apple.com
Date
2019-05-06 15:22:26 -0700 (Mon, 06 May 2019)

Log Message

Adopt AVStreamDataParser.audiovisualMIMETypes
https://bugs.webkit.org/show_bug.cgi?id=197581
<rdar://problem/50458981>

Reviewed by Eric Carlson.

Source/WebCore:

Add a new singleton class, AVStreamDataParserMIMETypeCache, and rename AVFoundationMIMETypeCache to the more precise
AVAssetMIMETypeCache.  Update all the old AVFoundationMIMETypeCache with the new name.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h.
(WebCore::AVAssetMIMETypeCache::setCacheMIMETypesCallback):
* platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm.
(WebCore::AVAssetMIMETypeCache::singleton):
(WebCore::AVAssetMIMETypeCache::setSupportedTypes):
(WebCore::AVAssetMIMETypeCache::types):
(WebCore::AVAssetMIMETypeCache::supportsContentType):
(WebCore::AVAssetMIMETypeCache::canDecodeType):
(WebCore::AVAssetMIMETypeCache::isAvailable const):
(WebCore::AVAssetMIMETypeCache::loadMIMETypes):
* platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h: Added.
* platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm: Added.
(WebCore::AVStreamDataParserMIMETypeCache::singleton):
(WebCore::AVStreamDataParserMIMETypeCache::types):
(WebCore::AVStreamDataParserMIMETypeCache::supportsContentType):
(WebCore::AVStreamDataParserMIMETypeCache::canDecodeType):
(WebCore::AVStreamDataParserMIMETypeCache::isAvailable const):
(WebCore::AVStreamDataParserMIMETypeCache::loadMIMETypes):
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
(WebCore::ImageDecoderAVFObjC::create):
(WebCore::ImageDecoderAVFObjC::supportsMediaType):
(WebCore::ImageDecoderAVFObjC::supportsContentType):
(WebCore::ImageDecoderAVFObjC::canDecodeType):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine):
(WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes):
(WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType):
(WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::getSupportedTypes):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType):

Source/WebKit:

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::platformTerminate):
(WebKit::WebProcess::setMediaMIMETypes):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (244979 => 244980)


--- trunk/Source/WebCore/ChangeLog	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebCore/ChangeLog	2019-05-06 22:22:26 UTC (rev 244980)
@@ -1,3 +1,49 @@
+2019-05-06  Jer Noble  <jer.no...@apple.com>
+
+        Adopt AVStreamDataParser.audiovisualMIMETypes
+        https://bugs.webkit.org/show_bug.cgi?id=197581
+        <rdar://problem/50458981>
+
+        Reviewed by Eric Carlson.
+
+        Add a new singleton class, AVStreamDataParserMIMETypeCache, and rename AVFoundationMIMETypeCache to the more precise
+        AVAssetMIMETypeCache.  Update all the old AVFoundationMIMETypeCache with the new name.
+
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h.
+        (WebCore::AVAssetMIMETypeCache::setCacheMIMETypesCallback):
+        * platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm.
+        (WebCore::AVAssetMIMETypeCache::singleton):
+        (WebCore::AVAssetMIMETypeCache::setSupportedTypes):
+        (WebCore::AVAssetMIMETypeCache::types):
+        (WebCore::AVAssetMIMETypeCache::supportsContentType):
+        (WebCore::AVAssetMIMETypeCache::canDecodeType):
+        (WebCore::AVAssetMIMETypeCache::isAvailable const):
+        (WebCore::AVAssetMIMETypeCache::loadMIMETypes):
+        * platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h: Added.
+        * platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm: Added.
+        (WebCore::AVStreamDataParserMIMETypeCache::singleton):
+        (WebCore::AVStreamDataParserMIMETypeCache::types):
+        (WebCore::AVStreamDataParserMIMETypeCache::supportsContentType):
+        (WebCore::AVStreamDataParserMIMETypeCache::canDecodeType):
+        (WebCore::AVStreamDataParserMIMETypeCache::isAvailable const):
+        (WebCore::AVStreamDataParserMIMETypeCache::loadMIMETypes):
+        * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
+        (WebCore::ImageDecoderAVFObjC::create):
+        (WebCore::ImageDecoderAVFObjC::supportsMediaType):
+        (WebCore::ImageDecoderAVFObjC::supportsContentType):
+        (WebCore::ImageDecoderAVFObjC::canDecodeType):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::getSupportedTypes):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType):
+
 2019-05-06  Youenn Fablet  <you...@apple.com>
 
         WebAudio Node JS wrappers should not be collected if events can be fired

Modified: trunk/Source/WebCore/SourcesCocoa.txt (244979 => 244980)


--- trunk/Source/WebCore/SourcesCocoa.txt	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2019-05-06 22:22:26 UTC (rev 244980)
@@ -231,8 +231,9 @@
 platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm @no-unify
 platform/graphics/avfoundation/WebMediaSessionManagerMac.cpp @no-unify
 
+platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm @no-unify
 platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm @no-unify
-platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm @no-unify
+platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm @no-unify
 platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm @no-unify
 platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.cpp @no-unify
 platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm @no-unify

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (244979 => 244980)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-05-06 22:22:26 UTC (rev 244980)
@@ -101,7 +101,7 @@
 		070E09191875EEFC003A1D3C /* PlatformMediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 070E09181875ED93003A1D3C /* PlatformMediaSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		070E81D11BF27656001FDA48 /* VideoTrackPrivateMediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 070E81D01BF27656001FDA48 /* VideoTrackPrivateMediaStream.h */; };
 		070F549817F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 070F549717F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h */; };
-		0719427F1D088F21002AA51D /* AVFoundationMIMETypeCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07C8AD111D073D630087C5CE /* AVFoundationMIMETypeCache.mm */; };
+		0719427F1D088F21002AA51D /* AVAssetMIMETypeCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07C8AD111D073D630087C5CE /* AVAssetMIMETypeCache.mm */; };
 		071A9EC2168FBC43002629F9 /* TextTrackCueGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 071A9EC0168FB56C002629F9 /* TextTrackCueGeneric.cpp */; };
 		071A9EC3168FBC55002629F9 /* TextTrackCueGeneric.h in Headers */ = {isa = PBXBuildFile; fileRef = 071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		071E496E1AD5AA0D008A50B4 /* MediaPlaybackTargetMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 071E496D1AD5AA0D008A50B4 /* MediaPlaybackTargetMac.mm */; };
@@ -227,7 +227,7 @@
 		07EE76EC1BE96DB000F89133 /* MockRealtimeVideoSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76EA1BE96DB000F89133 /* MockRealtimeVideoSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		07EE76EF1BEA619800F89133 /* MockRealtimeVideoSourceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76ED1BEA619800F89133 /* MockRealtimeVideoSourceMac.h */; };
 		07F04A942006B1E300AE2A0A /* ApplicationStateChangeListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F04A92200684BC00AE2A0A /* ApplicationStateChangeListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		07F4E93320B3587F002E3803 /* AVFoundationMIMETypeCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C8AD121D073D630087C5CE /* AVFoundationMIMETypeCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		07F4E93320B3587F002E3803 /* AVAssetMIMETypeCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C8AD121D073D630087C5CE /* AVAssetMIMETypeCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		07F876841AD580F900905849 /* MediaPlaybackTargetContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		07F944161864D046005D31CB /* PlatformMediaSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAE8C081746B95700532D78 /* PlatformMediaSessionManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		07FE99DD18807A7D00256648 /* MediaElementSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 07FE99DB18807A7D00256648 /* MediaElementSession.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3997,6 +3997,7 @@
 		CD063F821E23FA8900812BE3 /* InitDataRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD063F801E23FA8900812BE3 /* InitDataRegistry.cpp */; };
 		CD063F831E23FA8900812BE3 /* InitDataRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = CD063F811E23FA8900812BE3 /* InitDataRegistry.h */; };
 		CD0EEE0E14743F39003EAFA2 /* AudioDestinationIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD0EEE0B14743E35003EAFA2 /* AudioDestinationIOS.cpp */; };
+		CD11B3E1227CE6F30023AFC7 /* AVStreamDataParserMIMETypeCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD11B3E0227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.mm */; };
 		CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CD17A45D213740810079EC7B /* UnifiedSource62-mm.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD17A459213740160079EC7B /* UnifiedSource62-mm.mm */; };
 		CD19A2681A13E700008D650E /* DiagnosticLoggingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CD19A2671A13E700008D650E /* DiagnosticLoggingClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5493,8 +5494,8 @@
 		07C1C0E01BFB600100BD2256 /* MediaTrackSupportedConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTrackSupportedConstraints.h; sourceTree = "<group>"; };
 		07C1C0E11BFB600100BD2256 /* MediaTrackSupportedConstraints.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaTrackSupportedConstraints.idl; sourceTree = "<group>"; };
 		07C1C0E41BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealtimeMediaSourceSupportedConstraints.h; sourceTree = "<group>"; };
-		07C8AD111D073D630087C5CE /* AVFoundationMIMETypeCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVFoundationMIMETypeCache.mm; sourceTree = "<group>"; };
-		07C8AD121D073D630087C5CE /* AVFoundationMIMETypeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVFoundationMIMETypeCache.h; sourceTree = "<group>"; };
+		07C8AD111D073D630087C5CE /* AVAssetMIMETypeCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AVAssetMIMETypeCache.mm; sourceTree = "<group>"; };
+		07C8AD121D073D630087C5CE /* AVAssetMIMETypeCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVAssetMIMETypeCache.h; sourceTree = "<group>"; };
 		07CE77D416712A6A00C55A47 /* InbandTextTrackPrivateClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandTextTrackPrivateClient.h; sourceTree = "<group>"; };
 		07D60924214C5BFB00E7396C /* WindowDisplayCaptureSourceMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WindowDisplayCaptureSourceMac.mm; sourceTree = "<group>"; };
 		07D60926214C5BFC00E7396C /* WindowDisplayCaptureSourceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowDisplayCaptureSourceMac.h; sourceTree = "<group>"; };
@@ -13429,6 +13430,8 @@
 		CD0C8B582141C8CA0062F59D /* MediaCapabilitiesInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaCapabilitiesInfo.h; sourceTree = "<group>"; };
 		CD0EEE0A14743E34003EAFA2 /* AudioDestinationIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioDestinationIOS.h; sourceTree = "<group>"; };
 		CD0EEE0B14743E35003EAFA2 /* AudioDestinationIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioDestinationIOS.cpp; sourceTree = "<group>"; };
+		CD11B3DF227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AVStreamDataParserMIMETypeCache.h; sourceTree = "<group>"; };
+		CD11B3E0227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AVStreamDataParserMIMETypeCache.mm; sourceTree = "<group>"; };
 		CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWindow.h; sourceTree = "<group>"; };
 		CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenWindow.mm; sourceTree = "<group>"; };
 		CD17A459213740160079EC7B /* UnifiedSource62-mm.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "UnifiedSource62-mm.mm"; path = "DerivedSources/WebCore/unified-sources/UnifiedSource62-mm.mm"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -25920,8 +25923,10 @@
 				CD54A761180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.h */,
 				CDECA8991EDF447D00DCB08B /* AVAssetTrackUtilities.h */,
 				CDECA8981EDF447D00DCB08B /* AVAssetTrackUtilities.mm */,
-				07C8AD121D073D630087C5CE /* AVFoundationMIMETypeCache.h */,
-				07C8AD111D073D630087C5CE /* AVFoundationMIMETypeCache.mm */,
+				07C8AD121D073D630087C5CE /* AVAssetMIMETypeCache.h */,
+				07C8AD111D073D630087C5CE /* AVAssetMIMETypeCache.mm */,
+				CD11B3DF227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.h */,
+				CD11B3E0227CAAA90023AFC7 /* AVStreamDataParserMIMETypeCache.mm */,
 				CD78A2EE1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.h */,
 				CD78A2EC1F75648600DE371B /* CDMInstanceFairPlayStreamingAVFObjC.mm */,
 				CDE595941BF166D100A1CBE8 /* CDMSessionAVContentKeySession.h */,
@@ -28233,7 +28238,7 @@
 				CDC675271EAEA9D400727C84 /* AVAudioSessionCaptureDevice.h in Headers */,
 				CDC675231EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.h in Headers */,
 				070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */,
-				07F4E93320B3587F002E3803 /* AVFoundationMIMETypeCache.h in Headers */,
+				07F4E93320B3587F002E3803 /* AVAssetMIMETypeCache.h in Headers */,
 				CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */,
 				070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */,
 				29AE212D21AB9EEB00869283 /* AXIsolatedTree.h in Headers */,
@@ -32573,7 +32578,7 @@
 				CDECA89A1EDF447D00DCB08B /* AVAssetTrackUtilities.mm in Sources */,
 				CDC675221EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.mm in Sources */,
 				070363E3181A1CDC00C074A5 /* AVCaptureDeviceManager.mm in Sources */,
-				0719427F1D088F21002AA51D /* AVFoundationMIMETypeCache.mm in Sources */,
+				0719427F1D088F21002AA51D /* AVAssetMIMETypeCache.mm in Sources */,
 				CD336F6117F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.mm in Sources */,
 				070363E7181A1CDC00C074A5 /* AVVideoCaptureSource.mm in Sources */,
 				7A45032F18DB717200377B34 /* BufferedLineReader.cpp in Sources */,
@@ -33016,6 +33021,7 @@
 				DECA80391F9FED6A00E3B661 /* UnifiedSource248.cpp in Sources */,
 				DECA803A1F9FED6A00E3B661 /* UnifiedSource249.cpp in Sources */,
 				DECA803B1F9FED6A00E3B661 /* UnifiedSource250.cpp in Sources */,
+				CD11B3E1227CE6F30023AFC7 /* AVStreamDataParserMIMETypeCache.mm in Sources */,
 				DECA803C1F9FED6A00E3B661 /* UnifiedSource251.cpp in Sources */,
 				DECA803D1F9FED6A00E3B661 /* UnifiedSource252.cpp in Sources */,
 				DECA803E1F9FED6A00E3B661 /* UnifiedSource253.cpp in Sources */,

Copied: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h (from rev 244979, trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h) (0 => 244980)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h	2019-05-06 22:22:26 UTC (rev 244980)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2016-2018 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 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 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. 
+ */
+
+#pragma once
+
+#if PLATFORM(COCOA)
+
+#include <wtf/Forward.h>
+#include <wtf/HashSet.h>
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+class ContentType;
+
+class AVAssetMIMETypeCache {
+public:
+    WEBCORE_EXPORT static AVAssetMIMETypeCache& singleton();
+
+    bool supportsContentType(const ContentType&);
+    bool canDecodeType(const String&);
+
+    const HashSet<String, ASCIICaseInsensitiveHash>& types();
+    bool isEmpty();
+    bool isAvailable() const;
+
+    using CacheMIMETypesCallback = std::function<void(const Vector<String>&)>;
+    void setCacheMIMETypesCallback(CacheMIMETypesCallback&& callback) { m_cacheTypeCallback = WTFMove(callback); }
+
+    WEBCORE_EXPORT void setSupportedTypes(const Vector<String>&);
+
+private:
+    friend NeverDestroyed<AVAssetMIMETypeCache>;
+    AVAssetMIMETypeCache() = default;
+
+    void loadMIMETypes();
+
+    Optional<HashSet<String, ASCIICaseInsensitiveHash>> m_cache;
+    CacheMIMETypesCallback m_cacheTypeCallback;
+};
+
+}
+
+#endif

Copied: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm (from rev 244979, trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm) (0 => 244980)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm	2019-05-06 22:22:26 UTC (rev 244980)
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2016-2018 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 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 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. 
+ */
+
+#import "config.h"
+#import "AVAssetMIMETypeCache.h"
+
+#if PLATFORM(COCOA)
+
+#import "ContentType.h"
+#import <pal/cf/CoreMediaSoftLink.h>
+#import <pal/cocoa/AVFoundationSoftLink.h>
+#import <wtf/HashSet.h>
+
+#if !PLATFORM(IOSMAC)
+SOFT_LINK_FRAMEWORK_OPTIONAL_PREFLIGHT(AVFoundation)
+#endif
+
+namespace WebCore {
+
+AVAssetMIMETypeCache& AVAssetMIMETypeCache::singleton()
+{
+    static NeverDestroyed<AVAssetMIMETypeCache> cache;
+    return cache.get();
+}
+
+void AVAssetMIMETypeCache::setSupportedTypes(const Vector<String>& types)
+{
+    if (m_cache)
+        return;
+
+    m_cache = HashSet<String, ASCIICaseInsensitiveHash>();
+    for (auto& type : types)
+        m_cache->add(type);
+}
+
+const HashSet<String, ASCIICaseInsensitiveHash>& AVAssetMIMETypeCache::types()
+{
+    if (!m_cache)
+        loadMIMETypes();
+
+    return *m_cache;
+}
+
+bool AVAssetMIMETypeCache::supportsContentType(const ContentType& contentType)
+{
+    if (contentType.isEmpty())
+        return false;
+
+    return types().contains(contentType.containerType());
+}
+
+bool AVAssetMIMETypeCache::canDecodeType(const String& mimeType)
+{
+    if (mimeType.isEmpty())
+        return false;
+
+    if (!isAvailable() || !types().contains(ContentType { mimeType }.containerType()))
+        return false;
+
+#if ENABLE(VIDEO) && USE(AVFOUNDATION)
+    return [PAL::getAVURLAssetClass() isPlayableExtendedMIMEType:mimeType];
+#endif
+
+    return false;
+}
+
+bool AVAssetMIMETypeCache::isAvailable() const
+{
+#if ENABLE(VIDEO) && USE(AVFOUNDATION)
+#if PLATFORM(IOSMAC)
+    // FIXME: This should be using AVFoundationLibraryIsAvailable() instead, but doing so causes soft-linking
+    // to subsequently fail on certain symbols. See <rdar://problem/42224780> for more details.
+    return PAL::isAVFoundationFrameworkAvailable();
+#else
+    return AVFoundationLibraryIsAvailable();
+#endif
+#else
+    return false;
+#endif
+}
+
+void AVAssetMIMETypeCache::loadMIMETypes()
+{
+    m_cache = HashSet<String, ASCIICaseInsensitiveHash>();
+
+#if ENABLE(VIDEO) && USE(AVFOUNDATION)
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [this] {
+        if (!PAL::isAVFoundationFrameworkAvailable())
+            return;
+
+        for (NSString* type in [PAL::getAVURLAssetClass() audiovisualMIMETypes])
+            m_cache->add(type);
+
+        if (m_cacheTypeCallback)
+            m_cacheTypeCallback(copyToVector(*m_cache));
+    });
+#endif
+}
+
+}
+
+#endif

Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h (244979 => 244980)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h	2019-05-06 22:22:26 UTC (rev 244980)
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2016-2018 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 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 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. 
- */
-
-#pragma once
-
-#if PLATFORM(COCOA)
-
-#include <wtf/Forward.h>
-#include <wtf/HashSet.h>
-#include <wtf/text/StringHash.h>
-
-namespace WebCore {
-
-class ContentType;
-
-class AVFoundationMIMETypeCache {
-public:
-    WEBCORE_EXPORT static AVFoundationMIMETypeCache& singleton();
-
-    bool supportsContentType(const ContentType&);
-    bool canDecodeType(const String&);
-
-    const HashSet<String, ASCIICaseInsensitiveHash>& types();
-    bool isEmpty();
-    bool isAvailable() const;
-
-    using CacheMIMETypesCallback = std::function<void(const Vector<String>&)>;
-    void setCacheMIMETypesCallback(CacheMIMETypesCallback&& callback) { m_cacheTypeCallback = WTFMove(callback); }
-
-    WEBCORE_EXPORT void setSupportedTypes(const Vector<String>&);
-
-private:
-    friend NeverDestroyed<AVFoundationMIMETypeCache>;
-    AVFoundationMIMETypeCache() = default;
-
-    void loadMIMETypes();
-
-    Optional<HashSet<String, ASCIICaseInsensitiveHash>> m_cache;
-    CacheMIMETypesCallback m_cacheTypeCallback;
-};
-
-}
-
-#endif

Deleted: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm (244979 => 244980)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm	2019-05-06 22:22:26 UTC (rev 244980)
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2016-2018 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 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 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. 
- */
-
-#import "config.h"
-#import "AVFoundationMIMETypeCache.h"
-
-#if PLATFORM(COCOA)
-
-#import "ContentType.h"
-#import <wtf/HashSet.h>
-
-#import <pal/cf/CoreMediaSoftLink.h>
-#import <pal/cocoa/AVFoundationSoftLink.h>
-
-#if !PLATFORM(IOSMAC)
-SOFT_LINK_FRAMEWORK_OPTIONAL_PREFLIGHT(AVFoundation)
-#endif
-
-namespace WebCore {
-
-AVFoundationMIMETypeCache& AVFoundationMIMETypeCache::singleton()
-{
-    static NeverDestroyed<AVFoundationMIMETypeCache> cache;
-    return cache.get();
-}
-
-void AVFoundationMIMETypeCache::setSupportedTypes(const Vector<String>& types)
-{
-    if (m_cache)
-        return;
-
-    m_cache = HashSet<String, ASCIICaseInsensitiveHash>();
-    for (auto& type : types)
-        m_cache->add(type);
-}
-
-const HashSet<String, ASCIICaseInsensitiveHash>& AVFoundationMIMETypeCache::types()
-{
-    if (!m_cache)
-        loadMIMETypes();
-
-    return *m_cache;
-}
-
-bool AVFoundationMIMETypeCache::supportsContentType(const ContentType& contentType)
-{
-    if (contentType.isEmpty())
-        return false;
-
-    return types().contains(contentType.containerType());
-}
-
-bool AVFoundationMIMETypeCache::canDecodeType(const String& mimeType)
-{
-    if (mimeType.isEmpty())
-        return false;
-
-    if (!isAvailable() || !types().contains(ContentType { mimeType }.containerType()))
-        return false;
-
-#if ENABLE(VIDEO) && USE(AVFOUNDATION)
-    return [PAL::getAVURLAssetClass() isPlayableExtendedMIMEType:mimeType];
-#endif
-
-    return false;
-}
-
-bool AVFoundationMIMETypeCache::isAvailable() const
-{
-#if ENABLE(VIDEO) && USE(AVFOUNDATION)
-#if PLATFORM(IOSMAC)
-    // FIXME: This should be using AVFoundationLibraryIsAvailable() instead, but doing so causes soft-linking
-    // to subsequently fail on certain symbols. See <rdar://problem/42224780> for more details.
-    return PAL::isAVFoundationFrameworkAvailable();
-#else
-    return AVFoundationLibraryIsAvailable();
-#endif
-#else
-    return false;
-#endif
-}
-
-void AVFoundationMIMETypeCache::loadMIMETypes()
-{
-    m_cache = HashSet<String, ASCIICaseInsensitiveHash>();
-
-#if ENABLE(VIDEO) && USE(AVFOUNDATION)
-    static std::once_flag onceFlag;
-    std::call_once(onceFlag, [this] {
-        if (!PAL::isAVFoundationFrameworkAvailable())
-            return;
-
-        for (NSString* type in [PAL::getAVURLAssetClass() audiovisualMIMETypes])
-            m_cache->add(type);
-
-        if (m_cacheTypeCallback)
-            m_cacheTypeCallback(copyToVector(*m_cache));
-    });
-#endif
-}
-
-}
-
-#endif

Added: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h (0 => 244980)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h	2019-05-06 22:22:26 UTC (rev 244980)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2019 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 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 PLATFORM(COCOA)
+
+#include <wtf/Forward.h>
+#include <wtf/HashSet.h>
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+class ContentType;
+
+class AVStreamDataParserMIMETypeCache {
+public:
+    WEBCORE_EXPORT static AVStreamDataParserMIMETypeCache& singleton();
+
+    bool supportsContentType(const ContentType&);
+    bool canDecodeType(const String&);
+
+    const HashSet<String, ASCIICaseInsensitiveHash>& types();
+    bool isEmpty();
+    bool isAvailable() const;
+
+private:
+    friend NeverDestroyed<AVStreamDataParserMIMETypeCache>;
+    AVStreamDataParserMIMETypeCache() = default;
+
+    void loadMIMETypes();
+
+    Optional<HashSet<String, ASCIICaseInsensitiveHash>> m_cache;
+};
+
+}
+
+#endif

Added: trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm (0 => 244980)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm	2019-05-06 22:22:26 UTC (rev 244980)
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2019 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 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.
+ */
+
+#import "config.h"
+#import "AVStreamDataParserMIMETypeCache.h"
+
+#if PLATFORM(COCOA)
+
+#import "AVAssetMIMETypeCache.h"
+#import "ContentType.h"
+#import <pal/cf/CoreMediaSoftLink.h>
+#import <pal/cocoa/AVFoundationSoftLink.h>
+#import <wtf/HashSet.h>
+
+#if !PLATFORM(IOSMAC)
+SOFT_LINK_FRAMEWORK_OPTIONAL_PREFLIGHT(AVFoundation)
+#endif
+
+namespace WebCore {
+
+AVStreamDataParserMIMETypeCache& AVStreamDataParserMIMETypeCache::singleton()
+{
+    static NeverDestroyed<AVStreamDataParserMIMETypeCache> cache;
+    return cache.get();
+}
+
+const HashSet<String, ASCIICaseInsensitiveHash>& AVStreamDataParserMIMETypeCache::types()
+{
+    if (!m_cache)
+        loadMIMETypes();
+
+    return *m_cache;
+}
+
+bool AVStreamDataParserMIMETypeCache::supportsContentType(const ContentType& contentType)
+{
+    if (contentType.isEmpty())
+        return false;
+
+    return types().contains(contentType.containerType());
+}
+
+bool AVStreamDataParserMIMETypeCache::canDecodeType(const String& mimeType)
+{
+    if (mimeType.isEmpty())
+        return false;
+
+    ContentType type { mimeType };
+
+    if (!isAvailable() || !types().contains(type.containerType()))
+        return false;
+
+#if ENABLE(VIDEO) && USE(AVFOUNDATION)
+    // FIXME(rdar://50502771) AVStreamDataParser does not have an -isPlayableExtendedMIMEType: method, so just replace
+    // the container type with a valid one from AVAssetMIMETypeCache and ask that cache if it can decode this type:
+    auto& assetCache = AVAssetMIMETypeCache::singleton();
+    if (!assetCache.isAvailable() || assetCache.types().isEmpty())
+        return false;
+    String replacementType { mimeType };
+    replacementType.replace(type.containerType(), *assetCache.types().begin());
+    return assetCache.canDecodeType(replacementType);
+#endif
+
+    return false;
+}
+
+bool AVStreamDataParserMIMETypeCache::isAvailable() const
+{
+#if ENABLE(VIDEO) && USE(AVFOUNDATION)
+#if PLATFORM(IOSMAC)
+    // FIXME: This should be using AVFoundationLibraryIsAvailable() instead, but doing so causes soft-linking
+    // to subsequently fail on certain symbols. See <rdar://problem/42224780> for more details.
+    if (!PAL::AVFoundationLibrary())
+        return false;
+#else
+    if (!AVFoundationLibraryIsAvailable())
+        return false;
+#endif
+
+    return [PAL::getAVStreamDataParserClass() respondsToSelector:@selector(audiovisualMIMETypes)];
+#else
+    return false;
+#endif
+}
+
+void AVStreamDataParserMIMETypeCache::loadMIMETypes()
+{
+    m_cache = HashSet<String, ASCIICaseInsensitiveHash>();
+
+#if ENABLE(VIDEO) && USE(AVFOUNDATION)
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [this] {
+        if (!isAvailable())
+            return;
+
+        for (NSString* type in [PAL::getAVStreamDataParserClass() audiovisualMIMETypes])
+            m_cache->add(type);
+    });
+#endif
+}
+
+}
+
+#endif

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm (244979 => 244980)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm	2019-05-06 22:22:26 UTC (rev 244980)
@@ -28,7 +28,7 @@
 
 #if HAVE(AVASSETREADER)
 
-#import "AVFoundationMIMETypeCache.h"
+#import "AVAssetMIMETypeCache.h"
 #import "AffineTransform.h"
 #import "ContentType.h"
 #import "FloatQuad.h"
@@ -337,7 +337,7 @@
 RefPtr<ImageDecoderAVFObjC> ImageDecoderAVFObjC::create(SharedBuffer& data, const String& mimeType, AlphaOption alphaOption, GammaAndColorProfileOption gammaAndColorProfileOption)
 {
     // AVFoundation may not be available at runtime.
-    if (!AVFoundationMIMETypeCache::singleton().isAvailable())
+    if (!AVAssetMIMETypeCache::singleton().isAvailable())
         return nullptr;
 
     if (!canLoad_VideoToolbox_VTCreateCGImageFromCVPixelBuffer())
@@ -368,17 +368,17 @@
 
 bool ImageDecoderAVFObjC::supportsMediaType(MediaType type)
 {
-    return type == MediaType::Video && AVFoundationMIMETypeCache::singleton().isAvailable();
+    return type == MediaType::Video && AVAssetMIMETypeCache::singleton().isAvailable();
 }
 
 bool ImageDecoderAVFObjC::supportsContentType(const ContentType& type)
 {
-    return AVFoundationMIMETypeCache::singleton().supportsContentType(type);
+    return AVAssetMIMETypeCache::singleton().supportsContentType(type);
 }
 
 bool ImageDecoderAVFObjC::canDecodeType(const String& mimeType)
 {
-    return AVFoundationMIMETypeCache::singleton().canDecodeType(mimeType);
+    return AVAssetMIMETypeCache::singleton().canDecodeType(mimeType);
 }
 
 AVAssetTrack *ImageDecoderAVFObjC::firstEnabledTrack()

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (244979 => 244980)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2019-05-06 22:22:26 UTC (rev 244980)
@@ -28,8 +28,8 @@
 
 #if ENABLE(VIDEO) && USE(AVFOUNDATION)
 
+#import "AVAssetMIMETypeCache.h"
 #import "AVAssetTrackUtilities.h"
-#import "AVFoundationMIMETypeCache.h"
 #import "AVTrackPrivateAVFObjCImpl.h"
 #import "AudioSourceProviderAVFObjC.h"
 #import "AudioTrackPrivateAVFObjC.h"
@@ -240,7 +240,7 @@
 
     registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateAVFoundationObjC>(player); },
             getSupportedTypes, supportsType, originsInMediaCache, clearMediaCache, clearMediaCacheForOrigins, supportsKeySystem);
-    ASSERT(AVFoundationMIMETypeCache::singleton().isAvailable());
+    ASSERT(AVAssetMIMETypeCache::singleton().isAvailable());
 }
 
 static AVAssetCache *assetCacheForPath(const String& path)
@@ -1511,8 +1511,8 @@
 
 void MediaPlayerPrivateAVFoundationObjC::getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>& supportedTypes)
 {
-    supportedTypes = AVFoundationMIMETypeCache::singleton().types();
-} 
+    supportedTypes = AVAssetMIMETypeCache::singleton().types();
+}
 
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
 static bool keySystemIsSupported(const String& keySystem)
@@ -1538,7 +1538,7 @@
     if (isUnsupportedMIMEType(containerType))
         return MediaPlayer::IsNotSupported;
 
-    if (!staticMIMETypeList().contains(containerType) && !AVFoundationMIMETypeCache::singleton().canDecodeType(containerType))
+    if (!staticMIMETypeList().contains(containerType) && !AVAssetMIMETypeCache::singleton().canDecodeType(containerType))
         return MediaPlayer::IsNotSupported;
 
     // The spec says:
@@ -1567,7 +1567,7 @@
         if (!mimeType.isEmpty() && isUnsupportedMIMEType(mimeType))
             return false;
 
-        if (!mimeType.isEmpty() && !staticMIMETypeList().contains(mimeType) && !AVFoundationMIMETypeCache::singleton().canDecodeType(mimeType))
+        if (!mimeType.isEmpty() && !staticMIMETypeList().contains(mimeType) && !AVAssetMIMETypeCache::singleton().canDecodeType(mimeType))
             return false;
 
         return true;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (244979 => 244980)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2019-05-06 22:22:26 UTC (rev 244980)
@@ -28,8 +28,9 @@
 
 #if ENABLE(MEDIA_SOURCE) && USE(AVFOUNDATION)
 
+#import "AVAssetMIMETypeCache.h"
 #import "AVAssetTrackUtilities.h"
-#import "AVFoundationMIMETypeCache.h"
+#import "AVStreamDataParserMIMETypeCache.h"
 #import "CDMSessionAVStreamSession.h"
 #import "GraphicsContextCG.h"
 #import "Logging.h"
@@ -174,7 +175,7 @@
 
     registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateMediaSourceAVFObjC>(player); },
         getSupportedTypes, supportsType, 0, 0, 0, 0);
-    ASSERT(AVFoundationMIMETypeCache::singleton().isAvailable());
+    ASSERT(AVAssetMIMETypeCache::singleton().isAvailable());
 }
 
 bool MediaPlayerPrivateMediaSourceAVFObjC::isAvailable()
@@ -189,7 +190,15 @@
 
 void MediaPlayerPrivateMediaSourceAVFObjC::getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>& types)
 {
-    types = AVFoundationMIMETypeCache::singleton().types();
+    auto& streamDataParserCache = AVStreamDataParserMIMETypeCache::singleton();
+    if (streamDataParserCache.isAvailable()) {
+        types = streamDataParserCache.types();
+        return;
+    }
+
+    auto& assetCache = AVAssetMIMETypeCache::singleton();
+    if (assetCache.isAvailable())
+        types = assetCache.types();
 }
 
 MediaPlayer::SupportsType MediaPlayerPrivateMediaSourceAVFObjC::supportsType(const MediaEngineSupportParameters& parameters)
@@ -202,9 +211,18 @@
         return MediaPlayer::IsNotSupported;
 #endif
 
-    if (parameters.type.isEmpty() || !AVFoundationMIMETypeCache::singleton().canDecodeType(parameters.type.containerType()))
+    if (parameters.type.isEmpty())
         return MediaPlayer::IsNotSupported;
 
+    if (AVStreamDataParserMIMETypeCache::singleton().isAvailable()) {
+        if (!AVStreamDataParserMIMETypeCache::singleton().supportsContentType(parameters.type))
+            return MediaPlayer::IsNotSupported;
+    } else if (AVAssetMIMETypeCache::singleton().isAvailable()) {
+        if (!AVAssetMIMETypeCache::singleton().supportsContentType(parameters.type))
+            return MediaPlayer::IsNotSupported;
+    } else
+        return MediaPlayer::IsNotSupported;
+
     // The spec says:
     // "Implementors are encouraged to return "maybe" unless the type can be confidently established as being supported or not."
     auto codecs = parameters.type.parameter(ContentType::codecsParameter());
@@ -211,7 +229,7 @@
     if (codecs.isEmpty())
         return MediaPlayer::MayBeSupported;
 
-    NSString *outputCodecs = codecs;
+    String outputCodecs = codecs;
     if ([PAL::getAVStreamDataParserClass() respondsToSelector:@selector(outputMIMECodecParameterForInputMIMECodecParameter:)])
         outputCodecs = [PAL::getAVStreamDataParserClass() outputMIMECodecParameterForInputMIMECodecParameter:outputCodecs];
 
@@ -218,8 +236,10 @@
     if (!contentTypeMeetsHardwareDecodeRequirements(parameters.type, parameters.contentTypesRequiringHardwareSupport))
         return MediaPlayer::IsNotSupported;
 
-    NSString *typeString = [NSString stringWithFormat:@"%@; codecs=\"%@\"", (NSString *)parameters.type.containerType(), (NSString *)outputCodecs];
-    return [PAL::getAVURLAssetClass() isPlayableExtendedMIMEType:typeString] ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;;
+    String type = makeString(parameters.type.containerType(), "; codecs=\"", outputCodecs, "\"");
+    if (AVStreamDataParserMIMETypeCache::singleton().isAvailable())
+        return AVStreamDataParserMIMETypeCache::singleton().canDecodeType(type) ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;
+    return AVAssetMIMETypeCache::singleton().canDecodeType(type) ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;
 }
 
 #pragma mark -

Modified: trunk/Source/WebKit/ChangeLog (244979 => 244980)


--- trunk/Source/WebKit/ChangeLog	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebKit/ChangeLog	2019-05-06 22:22:26 UTC (rev 244980)
@@ -1,3 +1,16 @@
+2019-05-06  Jer Noble  <jer.no...@apple.com>
+
+        Adopt AVStreamDataParser.audiovisualMIMETypes
+        https://bugs.webkit.org/show_bug.cgi?id=197581
+        <rdar://problem/50458981>
+
+        Reviewed by Eric Carlson.
+
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+        (WebKit::WebProcess::platformTerminate):
+        (WebKit::WebProcess::setMediaMIMETypes):
+
 2019-05-06  Chris Dumez  <cdu...@apple.com>
 
         Terminate service workers that use too much CPU / power

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (244979 => 244980)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2019-05-06 21:44:01 UTC (rev 244979)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2019-05-06 22:22:26 UTC (rev 244980)
@@ -49,7 +49,7 @@
 #import "WebsiteDataStoreParameters.h"
 #import <_javascript_Core/ConfigFile.h>
 #import <_javascript_Core/Options.h>
-#import <WebCore/AVFoundationMIMETypeCache.h>
+#import <WebCore/AVAssetMIMETypeCache.h>
 #import <WebCore/AXObjectCache.h>
 #import <WebCore/CPUMonitor.h>
 #import <WebCore/DisplayRefreshMonitorManager.h>
@@ -207,7 +207,7 @@
     if (!parameters.mediaMIMETypes.isEmpty())
         setMediaMIMETypes(parameters.mediaMIMETypes);
     else {
-        AVFoundationMIMETypeCache::singleton().setCacheMIMETypesCallback([this](const Vector<String>& types) {
+        AVAssetMIMETypeCache::singleton().setCacheMIMETypesCallback([this](const Vector<String>& types) {
             parentProcessConnection()->send(Messages::WebProcessProxy::CacheMediaMIMETypes(types), 0);
         });
     }
@@ -470,7 +470,7 @@
 
 void WebProcess::platformTerminate()
 {
-    AVFoundationMIMETypeCache::singleton().setCacheMIMETypesCallback(nullptr);
+    AVAssetMIMETypeCache::singleton().setCacheMIMETypesCallback(nullptr);
 }
 
 RetainPtr<CFDataRef> WebProcess::sourceApplicationAuditData() const
@@ -806,7 +806,7 @@
 
 void WebProcess::setMediaMIMETypes(const Vector<String> types)
 {
-    AVFoundationMIMETypeCache::singleton().setSupportedTypes(types);
+    AVAssetMIMETypeCache::singleton().setSupportedTypes(types);
 }
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to