WebKit Bugzilla
Attachment 369142 Details for
Bug 197581
: Adopt AVStreamDataParser.audiovisualMIMETypes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-197581-20190506110848.patch (text/plain), 47.36 KB, created by
Jer Noble
on 2019-05-06 11:08:48 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2019-05-06 11:08:48 PDT
Size:
47.36 KB
patch
obsolete
>Subversion Revision: 244840 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index da6bd98068f138874aae096f3d2ee4047b7677b5..04436d282a631d1157c908bb2f845311c729c7d2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,49 @@ >+2019-05-03 Jer Noble <jer.noble@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-01 Jer Noble <jer.noble@apple.com> > > Hide MediaCapabilities.encodingInfo() when the platform does not support it. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index d9934a1391edbe6de20f0f7e3ed4dcc0b7ad75b1..8afd06a5b9cf9bcd832eabecc6b453f4ab31199c 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,16 @@ >+2019-05-03 Jer Noble <jer.noble@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-01 Dean Jackson <dino@apple.com> > > Link Previews that use WKImagePreviewViewController are not always scaled correctly >diff --git a/Source/WebCore/SourcesCocoa.txt b/Source/WebCore/SourcesCocoa.txt >index 3e0ec4c1dc59d8eedcd4c87b517bd1e265f19629..c081198a172ab2094caa64c2d1a63a94873a844f 100644 >--- a/Source/WebCore/SourcesCocoa.txt >+++ b/Source/WebCore/SourcesCocoa.txt >@@ -231,8 +231,9 @@ platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp @no-unify > 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 >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 9c18885e85168ebca6bae3da3473c7460f52d5f4..4599d7ff0e7c37a7b81ea9307ea678514988140f 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -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; }; >@@ -25922,8 +25925,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 */, >@@ -28235,7 +28240,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 */, >@@ -32575,7 +32580,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 */, >@@ -33018,6 +33023,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 */, >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h b/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h >new file mode 100644 >index 0000000000000000000000000000000000000000..d6d92acb05aefc417e5b7e68a8624298573ad59a >--- /dev/null >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.h >@@ -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 >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm b/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..6468b6b7d0a656c63a4dc5c64d3b0b8258672a3f >--- /dev/null >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/AVAssetMIMETypeCache.mm >@@ -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::AVFoundationLibrary(); >+#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::AVFoundationLibrary()) >+ return; >+ >+ for (NSString* type in [PAL::getAVURLAssetClass() audiovisualMIMETypes]) >+ m_cache->add(type); >+ >+ if (m_cacheTypeCallback) >+ m_cacheTypeCallback(copyToVector(*m_cache)); >+ }); >+#endif >+} >+ >+} >+ >+#endif >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h b/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h >deleted file mode 100644 >index 58f52e2c604d9a479cf0831b36ecbd47ba12de88..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h >+++ /dev/null >@@ -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 >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm b/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm >deleted file mode 100644 >index 5a7bf691dda95d7e912492548df93f61bae49643..0000000000000000000000000000000000000000 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm >+++ /dev/null >@@ -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::AVFoundationLibrary(); >-#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::AVFoundationLibrary()) >- return; >- >- for (NSString* type in [PAL::getAVURLAssetClass() audiovisualMIMETypes]) >- m_cache->add(type); >- >- if (m_cacheTypeCallback) >- m_cacheTypeCallback(copyToVector(*m_cache)); >- }); >-#endif >-} >- >-} >- >-#endif >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h b/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0abcc3d21ac4eec3cccb0f352e64f3008756b886 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.h >@@ -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 >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm b/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..b91de4d4dc17812e0ff3ab7c0d7897e845ba6d93 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm >@@ -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 >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >index d3f547f99c46f5de47165e05f441462b374eaa44..5fbf505af7ce5a524eccdf83e8c3358b6ae2eac0 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >@@ -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 @@ ImageDecoderAVFObjCSample* toSample(Iterator iter) > 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 @@ ImageDecoderAVFObjC::~ImageDecoderAVFObjC() = default; > > 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() >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >index 4e5b82372e9b758c26d4a3e5d5801cfa7a1840bc..da0c2e88e55b6badbd813ffeff2c87505252cdbb 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >@@ -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 @@ void MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(MediaEngineRegistra > > 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 @@ RetainPtr<CGImageRef> MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRe > > 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 @@ MediaPlayer::SupportsType MediaPlayerPrivateAVFoundationObjC::supportsType(const > 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 @@ bool MediaPlayerPrivateAVFoundationObjC::supportsKeySystem(const String& keySyst > 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; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >index 7fb1a5ec305a854f66ee207579814c6618d1bec9..66385ecc41c03aa67a45bd78b99742102de9a7f4 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >@@ -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 @@ void MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine(MediaEngineRegist > > 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 @@ bool MediaPlayerPrivateMediaSourceAVFObjC::isAvailable() > > 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,7 +211,16 @@ MediaPlayer::SupportsType MediaPlayerPrivateMediaSourceAVFObjC::supportsType(con > 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: >@@ -211,15 +229,17 @@ MediaPlayer::SupportsType MediaPlayerPrivateMediaSourceAVFObjC::supportsType(con > if (codecs.isEmpty()) > return MediaPlayer::MayBeSupported; > >- NSString *outputCodecs = codecs; >+ String outputCodecs = codecs; > if ([PAL::getAVStreamDataParserClass() respondsToSelector:@selector(outputMIMECodecParameterForInputMIMECodecParameter:)]) > outputCodecs = [PAL::getAVStreamDataParserClass() outputMIMECodecParameterForInputMIMECodecParameter:outputCodecs]; > > 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 - >diff --git a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >index 73df75c86dda1237eaf5b9cc4d33639dbc83117d..f91c51c18f78ce30951b4a36ae2b8efe3a5db7fb 100644 >--- a/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >+++ b/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm >@@ -49,7 +49,7 @@ > #import "WebsiteDataStoreParameters.h" > #import <JavaScriptCore/ConfigFile.h> > #import <JavaScriptCore/Options.h> >-#import <WebCore/AVFoundationMIMETypeCache.h> >+#import <WebCore/AVAssetMIMETypeCache.h> > #import <WebCore/AXObjectCache.h> > #import <WebCore/CPUMonitor.h> > #import <WebCore/DisplayRefreshMonitorManager.h> >@@ -206,7 +206,7 @@ void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters& para > 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); > }); > } >@@ -469,7 +469,7 @@ void WebProcess::stopRunLoop() > > void WebProcess::platformTerminate() > { >- AVFoundationMIMETypeCache::singleton().setCacheMIMETypesCallback(nullptr); >+ AVAssetMIMETypeCache::singleton().setCacheMIMETypesCallback(nullptr); > } > > RetainPtr<CFDataRef> WebProcess::sourceApplicationAuditData() const >@@ -799,7 +799,7 @@ void WebProcess::backlightLevelDidChange(float backlightLevel) > > void WebProcess::setMediaMIMETypes(const Vector<String> types) > { >- AVFoundationMIMETypeCache::singleton().setSupportedTypes(types); >+ AVAssetMIMETypeCache::singleton().setSupportedTypes(types); > } > > } // namespace WebKit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197581
:
369005
|
369142
|
369157