Changeset 144097 in webkit
- Timestamp:
- Feb 26, 2013, 1:09:54 PM (14 years ago)
- Location:
- tags/Safari-537.31.10/Source/WebCore
- Files:
-
- 6 edited
- 2 copied
-
ChangeLog (modified) (1 diff)
-
Modules/encryptedmedia/CDM.cpp (modified) (2 diffs)
-
Modules/encryptedmedia/CDM.h (modified) (1 diff)
-
Modules/encryptedmedia/CDMPrivateAVFoundation.h (copied) (copied from trunk/Source/WebCore/Modules/encryptedmedia/CDMPrivateAVFoundation.h )
-
Modules/encryptedmedia/CDMPrivateAVFoundation.mm (copied) (copied from trunk/Source/WebCore/Modules/encryptedmedia/CDMPrivateAVFoundation.mm )
-
WebCore.xcodeproj/project.pbxproj (modified) (5 diffs)
-
platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (modified) (1 diff)
-
platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/Safari-537.31.10/Source/WebCore/ChangeLog
r144095 r144097 1 2013-02-26 Lucas Forschler <lforschler@apple.com> 2 3 Merge r143259 4 5 2013-02-18 Jer Noble <jer.noble@apple.com> 6 7 EME: Add a CDMPrivate implementation using AVFoundation. 8 https://bugs.webkit.org/show_bug.cgi?id=109739 9 10 Reviewed by Eric Carlson. 11 12 Add a CDMPrivate implementation using AVFoundation, similar to the EME v1 implementation 13 in MediaPlayerPrivateAVFoundationObjC. This requires passing the AVAssetResourceLoadingRequest 14 from the MediaPlayerPrivateAVFoundationObjC instance to CDMSessionAVFoundation. To do so 15 without adding platform-specific API to MediaPlayer, add a static map from MediaPlayer -> 16 MediaPlayerPrivateAVFoundationObjC instances to be used to vend the AVAssetResourceLoadingRequest 17 to CDMSessionAVFoundation. 18 19 * Modules/encryptedmedia/CDM.cpp: 20 (WebCore::installedCDMFactories): Add the factory for CDMPrivateAVFoundation. 21 * Modules/encryptedmedia/CDM.h: 22 * Modules/encryptedmedia/CDMPrivateAVFoundation.h: Added. 23 (WebCore::CDMPrivateAVFoundation::create): Simple factory method. 24 (WebCore::CDMPrivateAVFoundation::~CDMPrivateAVFoundation): Simple virtual destructor. 25 (WebCore::CDMPrivateAVFoundation::cdm): Simple getter. 26 (WebCore::CDMPrivateAVFoundation::CDMPrivateAVFoundation): Simple constructor. 27 * Modules/encryptedmedia/CDMPrivateAVFoundation.mm: Added. 28 (WebCore::CDMSessionAVFoundation::~CDMSessionAVFoundation): Simple destructor. 29 (WebCore::CDMPrivateAVFoundation::supportsKeySytem): Check whether the given key system is supported. 30 (WebCore::CDMPrivateAVFoundation::supportsMIMEType): Check whether the given MIME type is supported. 31 (WebCore::CDMPrivateAVFoundation::createSession): Return a new CDMSessionAVFoundation. 32 (WebCore::CDMSessionAVFoundation::CDMSessionAVFoundation): Simple constructor. 33 (WebCore::CDMSessionAVFoundation::generateKeyRequest): Retrieve the AVAssetResourceLoadingRequest 34 from the MediaPlayer, and use it to generate a key request. 35 (WebCore::CDMSessionAVFoundation::releaseKeys): No-op. 36 (WebCore::CDMSessionAVFoundation::update): Add the passed in key to the AVAssetResourceLoadingRequest. 37 * WebCore.xcodeproj/project.pbxproj: 38 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: 39 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 40 (WebCore::playerToPrivateMap): Lazily instantiate static map. 41 (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC): Register with the playerToPrivateMap. 42 (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC): Unregister from same. 43 (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource): Also send keyNeeded event in ENCRYPTED_MEDIA_V2. 44 (WebCore::MediaPlayerPrivateAVFoundationObjC::extractKeyURIKeyIDAndCertificateFromInitData): Convert this 45 method from file-static to class static. 46 (WebCore::MediaPlayerPrivateAVFoundationObjC::takeRequestForPlayerAndKeyURI): Pull the AVAssetResourceLoadingRequest 47 from m_keyURIToRequestMap and return it, if present. 48 1 49 2013-02-26 Lucas Forschler <lforschler@apple.com> 2 50 -
tags/Safari-537.31.10/Source/WebCore/Modules/encryptedmedia/CDM.cpp
r144095 r144097 35 35 #include <wtf/text/WTFString.h> 36 36 37 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 38 #include "CDMPrivateAVFoundation.h" 39 #endif 40 37 41 namespace WebCore { 38 42 … … 58 62 59 63 // FIXME: initialize specific UA CDMs. http://webkit.org/b/109318, http://webkit.org/b/109320 64 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 65 cdms.append(new CDMFactory(CDMPrivateAVFoundation::create, CDMPrivateAVFoundation::supportsKeySytem)); 66 #endif 67 60 68 } 61 69 -
tags/Safari-537.31.10/Source/WebCore/Modules/encryptedmedia/CDM.h
r144095 r144097 64 64 class CDM { 65 65 public: 66 67 enum CDMErrorCode { UnknownError = 1, ClientError, ServiceError, OutputError, HardwareChangeError, DomainError }; 66 68 static bool supportsKeySystem(const String&); 67 69 static PassOwnPtr<CDM> create(const String& keySystem); -
tags/Safari-537.31.10/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r142698 r144097 5988 5988 CD27F6E7145770D30078207D /* MediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E6145770D30078207D /* MediaController.cpp */; }; 5989 5989 CD37B39815C1B971006DC898 /* DiagnosticLoggingKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */; }; 5990 CD47B3FC16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD47B3FA16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm */; }; 5990 5991 CD4AC52A1496AE9A0087C4EF /* Composite.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD4AC5281496AE2F0087C4EF /* Composite.wav */; }; 5991 5992 CD7E05221651C28200C1201F /* WebCoreAVFResourceLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD7E05211651A84100C1201F /* WebCoreAVFResourceLoader.mm */; }; … … 13572 13573 CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiagnosticLoggingKeys.cpp; sourceTree = "<group>"; }; 13573 13574 CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagnosticLoggingKeys.h; sourceTree = "<group>"; }; 13575 CD47B3F916CC34F800A21EC8 /* CDMPrivateAVFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDMPrivateAVFoundation.h; path = Modules/encryptedmedia/CDMPrivateAVFoundation.h; sourceTree = "<group>"; }; 13576 CD47B3FA16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CDMPrivateAVFoundation.mm; path = Modules/encryptedmedia/CDMPrivateAVFoundation.mm; sourceTree = "<group>"; }; 13574 13577 CD4AC5281496AE2F0087C4EF /* Composite.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = Composite.wav; path = platform/audio/resources/Composite.wav; sourceTree = SOURCE_ROOT; }; 13575 13578 CD4E0AFA11F7BC27009D3811 /* fullscreen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreen.css; sourceTree = "<group>"; }; … … 21632 21635 CDA98E091603CD5900FEA3B1 /* CDM.cpp */, 21633 21636 CDA98E0A1603CD5900FEA3B1 /* CDM.h */, 21637 CDA98E0C1603CF3C00FEA3B1 /* CDMPrivate.h */, 21638 CD47B3F916CC34F800A21EC8 /* CDMPrivateAVFoundation.h */, 21639 CD47B3FA16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm */, 21634 21640 CDA98DD516025BED00FEA3B1 /* MediaKeyMessageEvent.cpp */, 21635 21641 CDA98DD616025BED00FEA3B1 /* MediaKeyMessageEvent.h */, … … 21644 21650 CDA98DC816014F2C00FEA3B1 /* MediaKeySession.h */, 21645 21651 CDA98DC916014F4000FEA3B1 /* MediaKeySession.idl */, 21646 CDA98E0C1603CF3C00FEA3B1 /* Modules/encryptedmedia/CDMPrivate.h */,21647 21652 ); 21648 21653 name = encryptedmedia; … … 27388 27393 8502AB490AD438C000378540 /* DOMSVGFEDiffuseLightingElement.mm in Sources */, 27389 27394 8502AB4B0AD438C000378540 /* DOMSVGFEDisplacementMapElement.mm in Sources */, 27395 CD47B3FC16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm in Sources */, 27390 27396 8502AB4D0AD438C000378540 /* DOMSVGFEDistantLightElement.mm in Sources */, 27391 27397 4358E86B1360A21600E4748C /* DOMSVGFEDropShadowElement.mm in Sources */, -
tags/Safari-537.31.10/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
r142327 r144097 75 75 #endif 76 76 77 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2) 78 static bool extractKeyURIKeyIDAndCertificateFromInitData(Uint8Array* initData, String& keyURI, String& keyID, RefPtr<Uint8Array>& certificate); 79 #endif 80 81 #if ENABLE(ENCRYPTED_MEDIA_V2) 82 static RetainPtr<AVAssetResourceLoadingRequest> takeRequestForPlayerAndKeyURI(MediaPlayer*, const String&); 83 #endif 84 77 85 private: 78 86 MediaPlayerPrivateAVFoundationObjC(MediaPlayer*); -
tags/Safari-537.31.10/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r142375 r144097 187 187 #endif 188 188 189 #if ENABLE(ENCRYPTED_MEDIA_V2) 190 typedef HashMap<MediaPlayer*, MediaPlayerPrivateAVFoundationObjC*> PlayerToPrivateMapType; 191 static PlayerToPrivateMapType& playerToPrivateMap() 192 { 193 DEFINE_STATIC_LOCAL(PlayerToPrivateMapType, map, ()); 194 return map; 195 }; 196 #endif 197 198 189 199 PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateAVFoundationObjC::create(MediaPlayer* player) 190 200 { … … 214 224 #endif 215 225 { 226 #if ENABLE(ENCRYPTED_MEDIA_V2) 227 playerToPrivateMap().set(player, this); 228 #endif 216 229 } 217 230 218 231 MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC() 219 232 { 233 #if ENABLE(ENCRYPTED_MEDIA_V2) 234 playerToPrivateMap().remove(player()); 235 #endif 220 236 cancelLoad(); 221 237 } … … 871 887 String keyURI = [[[avRequest request] URL] absoluteString]; 872 888 873 #if ENABLE(ENCRYPTED_MEDIA) 889 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2) 874 890 if (scheme == "skd") { 875 891 // Create an initData with the following layout: … … 883 899 keyURIArray->setRange(keyURI.characters(), keyURI.length() / sizeof(unsigned char), 0); 884 900 901 #if ENABLE(ENCRYPTED_MEDIA) 885 902 if (!player()->keyNeeded("com.apple.lskd", emptyString(), static_cast<const unsigned char*>(initDataBuffer->data()), initDataBuffer->byteLength())) 903 #elif ENABLE(ENCRYPTED_MEDIA_V2) 904 RefPtr<Uint8Array> initData = Uint8Array::create(initDataBuffer, 0, initDataBuffer->byteLength()); 905 if (!player()->keyNeeded(initData.get())) 906 #endif 886 907 return false; 887 908 … … 1117 1138 #endif 1118 1139 1119 #if ENABLE(ENCRYPTED_MEDIA) 1120 1121 static bool extractKeyURIKeyIDAndCertificateFromInitData(Uint8Array* initData, String& keyURI, String& keyID, RefPtr<Uint8Array>& certificate) 1140 #if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2) 1141 bool MediaPlayerPrivateAVFoundationObjC::extractKeyURIKeyIDAndCertificateFromInitData(Uint8Array* initData, String& keyURI, String& keyID, RefPtr<Uint8Array>& certificate) 1122 1142 { 1123 1143 // initData should have the following layout: … … 1168 1188 return true; 1169 1189 } 1170 1190 #endif 1191 1192 #if ENABLE(ENCRYPTED_MEDIA) 1171 1193 MediaPlayer::MediaKeyException MediaPlayerPrivateAVFoundationObjC::generateKeyRequest(const String& keySystem, const unsigned char* initDataPtr, unsigned initDataLength) 1172 1194 { … … 1242 1264 m_sessionIDToRequestMap.remove(sessionID); 1243 1265 return MediaPlayer::NoError; 1266 } 1267 #endif 1268 1269 #if ENABLE(ENCRYPTED_MEDIA_V2) 1270 RetainPtr<AVAssetResourceLoadingRequest> MediaPlayerPrivateAVFoundationObjC::takeRequestForPlayerAndKeyURI(MediaPlayer* player, const String& keyURI) 1271 { 1272 MediaPlayerPrivateAVFoundationObjC* _this = playerToPrivateMap().get(player); 1273 if (!_this) 1274 return nullptr; 1275 1276 return _this->m_keyURIToRequestMap.take(keyURI); 1277 1244 1278 } 1245 1279 #endif
Note:
See TracChangeset
for help on using the changeset viewer.