⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 144097 in webkit


Ignore:
Timestamp:
Feb 26, 2013, 1:09:54 PM (14 years ago)
Author:
Lucas Forschler
Message:

Merged r143259. <rdar://problem/13254985>

Location:
tags/Safari-537.31.10/Source/WebCore
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • tags/Safari-537.31.10/Source/WebCore/ChangeLog

    r144095 r144097  
     12013-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
    1492013-02-26  Lucas Forschler  <lforschler@apple.com>
    250
  • tags/Safari-537.31.10/Source/WebCore/Modules/encryptedmedia/CDM.cpp

    r144095 r144097  
    3535#include <wtf/text/WTFString.h>
    3636
     37#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     38#include "CDMPrivateAVFoundation.h"
     39#endif
     40
    3741namespace WebCore {
    3842
     
    5862
    5963        // 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
    6068    }
    6169
  • tags/Safari-537.31.10/Source/WebCore/Modules/encryptedmedia/CDM.h

    r144095 r144097  
    6464class CDM {
    6565public:
     66
     67    enum CDMErrorCode { UnknownError = 1, ClientError, ServiceError, OutputError, HardwareChangeError, DomainError };
    6668    static bool supportsKeySystem(const String&);
    6769    static PassOwnPtr<CDM> create(const String& keySystem);
  • tags/Safari-537.31.10/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r142698 r144097  
    59885988                CD27F6E7145770D30078207D /* MediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD27F6E6145770D30078207D /* MediaController.cpp */; };
    59895989                CD37B39815C1B971006DC898 /* DiagnosticLoggingKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */; };
     5990                CD47B3FC16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD47B3FA16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm */; };
    59905991                CD4AC52A1496AE9A0087C4EF /* Composite.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD4AC5281496AE2F0087C4EF /* Composite.wav */; };
    59915992                CD7E05221651C28200C1201F /* WebCoreAVFResourceLoader.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD7E05211651A84100C1201F /* WebCoreAVFResourceLoader.mm */; };
     
    1357213573                CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DiagnosticLoggingKeys.cpp; sourceTree = "<group>"; };
    1357313574                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>"; };
    1357413577                CD4AC5281496AE2F0087C4EF /* Composite.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = Composite.wav; path = platform/audio/resources/Composite.wav; sourceTree = SOURCE_ROOT; };
    1357513578                CD4E0AFA11F7BC27009D3811 /* fullscreen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreen.css; sourceTree = "<group>"; };
     
    2163221635                                CDA98E091603CD5900FEA3B1 /* CDM.cpp */,
    2163321636                                CDA98E0A1603CD5900FEA3B1 /* CDM.h */,
     21637                                CDA98E0C1603CF3C00FEA3B1 /* CDMPrivate.h */,
     21638                                CD47B3F916CC34F800A21EC8 /* CDMPrivateAVFoundation.h */,
     21639                                CD47B3FA16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm */,
    2163421640                                CDA98DD516025BED00FEA3B1 /* MediaKeyMessageEvent.cpp */,
    2163521641                                CDA98DD616025BED00FEA3B1 /* MediaKeyMessageEvent.h */,
     
    2164421650                                CDA98DC816014F2C00FEA3B1 /* MediaKeySession.h */,
    2164521651                                CDA98DC916014F4000FEA3B1 /* MediaKeySession.idl */,
    21646                                 CDA98E0C1603CF3C00FEA3B1 /* Modules/encryptedmedia/CDMPrivate.h */,
    2164721652                        );
    2164821653                        name = encryptedmedia;
     
    2738827393                                8502AB490AD438C000378540 /* DOMSVGFEDiffuseLightingElement.mm in Sources */,
    2738927394                                8502AB4B0AD438C000378540 /* DOMSVGFEDisplacementMapElement.mm in Sources */,
     27395                                CD47B3FC16CC34F800A21EC8 /* CDMPrivateAVFoundation.mm in Sources */,
    2739027396                                8502AB4D0AD438C000378540 /* DOMSVGFEDistantLightElement.mm in Sources */,
    2739127397                                4358E86B1360A21600E4748C /* DOMSVGFEDropShadowElement.mm in Sources */,
  • tags/Safari-537.31.10/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h

    r142327 r144097  
    7575#endif
    7676
     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
    7785private:
    7886    MediaPlayerPrivateAVFoundationObjC(MediaPlayer*);
  • tags/Safari-537.31.10/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r142375 r144097  
    187187#endif
    188188
     189#if ENABLE(ENCRYPTED_MEDIA_V2)
     190typedef HashMap<MediaPlayer*, MediaPlayerPrivateAVFoundationObjC*> PlayerToPrivateMapType;
     191static PlayerToPrivateMapType& playerToPrivateMap()
     192{
     193    DEFINE_STATIC_LOCAL(PlayerToPrivateMapType, map, ());
     194    return map;
     195};
     196#endif
     197
     198
    189199PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateAVFoundationObjC::create(MediaPlayer* player)
    190200{
     
    214224#endif
    215225{
     226#if ENABLE(ENCRYPTED_MEDIA_V2)
     227    playerToPrivateMap().set(player, this);
     228#endif
    216229}
    217230
    218231MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC()
    219232{
     233#if ENABLE(ENCRYPTED_MEDIA_V2)
     234    playerToPrivateMap().remove(player());
     235#endif
    220236    cancelLoad();
    221237}
     
    871887    String keyURI = [[[avRequest request] URL] absoluteString];
    872888
    873 #if ENABLE(ENCRYPTED_MEDIA)
     889#if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2)
    874890    if (scheme == "skd") {
    875891        // Create an initData with the following layout:
     
    883899        keyURIArray->setRange(keyURI.characters(), keyURI.length() / sizeof(unsigned char), 0);
    884900
     901#if ENABLE(ENCRYPTED_MEDIA)
    885902        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
    886907            return false;
    887908
     
    11171138#endif
    11181139
    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)
     1141bool MediaPlayerPrivateAVFoundationObjC::extractKeyURIKeyIDAndCertificateFromInitData(Uint8Array* initData, String& keyURI, String& keyID, RefPtr<Uint8Array>& certificate)
    11221142{
    11231143    // initData should have the following layout:
     
    11681188    return true;
    11691189}
    1170 
     1190#endif
     1191
     1192#if ENABLE(ENCRYPTED_MEDIA)
    11711193MediaPlayer::MediaKeyException MediaPlayerPrivateAVFoundationObjC::generateKeyRequest(const String& keySystem, const unsigned char* initDataPtr, unsigned initDataLength)
    11721194{
     
    12421264    m_sessionIDToRequestMap.remove(sessionID);
    12431265    return MediaPlayer::NoError;
     1266}
     1267#endif
     1268
     1269#if ENABLE(ENCRYPTED_MEDIA_V2)
     1270RetainPtr<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
    12441278}
    12451279#endif
Note: See TracChangeset for help on using the changeset viewer.