[EME] Implement MediaKeys.isTypeSupported()
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Aug 2013 19:17:47 +0000 (19:17 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Aug 2013 19:17:47 +0000 (19:17 +0000)
commit6fd7b4f5f40bb8442e78b70886e7a6f17b105e79
tree709b691c11baedb6081d7dead35e61d398b92fad
parentaa90b9d5cc0636e41135a23829310c7e7eebef23
[EME] Implement MediaKeys.isTypeSupported()
https://bugs.webkit.org/show_bug.cgi?id=119586

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/encrypted-media/encrypted-media-is-type-supported.html

The EME spec has removed the extra keySystem parameter from
HTMLMediaElement.canPlayType() in favor of a new isTypeSupported()
method on MediaKeys.

To implement this method, the CDMFactory needs to know whether the
registered CDM supports the specified mime type.  CDMs must register
this new factory method, which requires changes to CDMPrivateAVFoundation
and MockCDM.

Add the new MediaKeys.isTypeSupported() method:
* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::isTypeSupported):
* Modules/encryptedmedia/MediaKeys.h:
* Modules/encryptedmedia/MediaKeys.idl:

Add the new factory CDMSupportsKeySystemAndMimeType method:
* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDMFactory::CDMFactory): Now takes a third parameter.
(WebCore::installedCDMFactories): When adding the AVFoundation CDM, pass its new method.
(WebCore::CDM::registerCDMFactory): Now takes a third parameter.
(WebCore::CDM::keySystemSupportsMimeType): Added.
* Modules/encryptedmedia/CDM.h:
* WebCore.exp.in:

Register this new method with the factory for all concrete CDMs:
* Modules/encryptedmedia/CDMPrivateAVFoundation.h:
* Modules/encryptedmedia/CDMPrivateAVFoundation.mm:
(WebCore::CDMPrivateAVFoundation::supportsKeySystem):
(WebCore::CDMPrivateAVFoundation::supportsKeySystemAndMimeType):
* testing/Internals.cpp:
(WebCore::Internals::initializeMockCDM):
* testing/MockCDM.cpp:
(WebCore::MockCDM::supportsKeySystem):
(WebCore::MockCDM::supportsKeySystemAndMimeType):
* testing/MockCDM.h:

LayoutTests:

* media/encrypted-media/encrypted-media-is-type-supported-expected.txt: Added.
* media/encrypted-media/encrypted-media-is-type-supported.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153838 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/media/encrypted-media/encrypted-media-is-type-supported-expected.txt [new file with mode: 0644]
LayoutTests/media/encrypted-media/encrypted-media-is-type-supported.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/CDM.cpp
Source/WebCore/Modules/encryptedmedia/CDM.h
Source/WebCore/Modules/encryptedmedia/CDMPrivateAVFoundation.h
Source/WebCore/Modules/encryptedmedia/CDMPrivateAVFoundation.mm
Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp
Source/WebCore/Modules/encryptedmedia/MediaKeys.h
Source/WebCore/Modules/encryptedmedia/MediaKeys.idl
Source/WebCore/WebCore.exp.in
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/MockCDM.cpp
Source/WebCore/testing/MockCDM.h