Diff
Modified: trunk/Source/WebCore/ChangeLog (164512 => 164513)
--- trunk/Source/WebCore/ChangeLog 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/ChangeLog 2014-02-22 00:12:51 UTC (rev 164513)
@@ -1,3 +1,41 @@
+2014-02-21 Jer Noble <jer.no...@apple.com>
+
+ Add a supportsKeySystem media engine factory parameter.
+ https://bugs.webkit.org/show_bug.cgi?id=129161
+
+ Reviewed by Eric Carlson.
+
+ Add a new parameter to the MediaPlayerFactory to allow registered media
+ engines to be queried for keySystem support:
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayerFactory::MediaPlayerFactory):
+ (WebCore::MediaPlayer::supportsKeySystem):
+ * platform/graphics/MediaPlayer.h:
+
+ Support this new field in MediaPlayerPrivateAVFoundationObjC:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine):
+ (WebCore::keySystemIsSupported):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
+
+ Add an empty field for SupportsKeySystem to the remaining media engines:
+ * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+ (WebCore::MediaPlayerPrivateAVFoundationCF::registerMediaEngine):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine):
+ * platform/graphics/ios/MediaPlayerPrivateIOS.mm:
+ (WebCore::MediaPlayerPrivateIOS::registerMediaEngine):
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivateQTKit::registerMediaEngine):
+ * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+ (WebCore::MediaPlayerPrivateQuickTimeVisualContext::registerMediaEngine):
+ * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
+ (WebCore::MockMediaPlayerMediaSource::registerMediaEngine):
+
2014-02-21 Benjamin Poulain <bpoul...@apple.com>
Fix WebCore's internals after r164505
Modified: trunk/Source/WebCore/WebCore.exp.in (164512 => 164513)
--- trunk/Source/WebCore/WebCore.exp.in 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-02-22 00:12:51 UTC (rev 164513)
@@ -3136,11 +3136,11 @@
#endif
#if ENABLE(VIDEO)
-__ZN7WebCore25MediaPlayerFactorySupport23callRegisterMediaEngineEPFvPFvPFN3WTF10PassOwnPtrINS_27MediaPlayerPrivateInterfaceEEEPNS_11MediaPlayerEEPFvRNS1_7HashSetINS1_6StringENS1_10StringHashENS1_10HashTraitsISA_EEEEEPFNS5_12SupportsTypeERKNS_28MediaEngineSupportParametersEEPFvRNS1_6VectorISA_Lm0ENS1_15CrashOnOverflowEEEEPFvvEPFvRKSA_EEE
+__ZN7WebCore25MediaPlayerFactorySupport23callRegisterMediaEngineEPFvPFvPFN3WTF10PassOwnPtrINS_27MediaPlayerPrivateInterfaceEEEPNS_11MediaPlayerEEPFvRNS1_7HashSetINS1_6StringENS1_10StringHashENS1_10HashTraitsISA_EEEEEPFNS5_12SupportsTypeERKNS_28MediaEngineSupportParametersEEPFvRNS1_6VectorISA_Lm0ENS1_15CrashOnOverflowEEEEPFvvEPFvRKSA_EPFbSX_SX_EEE
#endif
#if ENABLE(MEDIA_SOURCE)
-__ZN7WebCore26MockMediaPlayerMediaSource19registerMediaEngineEPFvPFN3WTF10PassOwnPtrINS_27MediaPlayerPrivateInterfaceEEEPNS_11MediaPlayerEEPFvRNS1_7HashSetINS1_6StringENS1_10StringHashENS1_10HashTraitsISA_EEEEEPFNS5_12SupportsTypeERKNS_28MediaEngineSupportParametersEEPFvRNS1_6VectorISA_Lm0ENS1_15CrashOnOverflowEEEEPFvvEPFvRKSA_EE
+__ZN7WebCore26MockMediaPlayerMediaSource19registerMediaEngineEPFvPFN3WTF10PassOwnPtrINS_27MediaPlayerPrivateInterfaceEEEPNS_11MediaPlayerEEPFvRNS1_7HashSetINS1_6StringENS1_10StringHashENS1_10HashTraitsISA_EEEEEPFNS5_12SupportsTypeERKNS_28MediaEngineSupportParametersEEPFvRNS1_6VectorISA_Lm0ENS1_15CrashOnOverflowEEEEPFvvEPFvRKSA_EPFbSX_SX_EE
#endif
#if ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-02-22 00:12:51 UTC (rev 164513)
@@ -166,13 +166,14 @@
WTF_MAKE_NONCOPYABLE(MediaPlayerFactory); WTF_MAKE_FAST_ALLOCATED;
public:
MediaPlayerFactory(CreateMediaEnginePlayer constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsTypeAndCodecs,
- MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite)
+ MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite, MediaEngineSupportsKeySystem supportsKeySystem)
: constructor(constructor)
, getSupportedTypes(getSupportedTypes)
, supportsTypeAndCodecs(supportsTypeAndCodecs)
, getSitesInMediaCache(getSitesInMediaCache)
, clearMediaCache(clearMediaCache)
, clearMediaCacheForSite(clearMediaCacheForSite)
+ , supportsKeySystem(supportsKeySystem)
{
}
@@ -182,9 +183,10 @@
MediaEngineGetSitesInMediaCache getSitesInMediaCache;
MediaEngineClearMediaCache clearMediaCache;
MediaEngineClearMediaCacheForSite clearMediaCacheForSite;
+ MediaEngineSupportsKeySystem supportsKeySystem;
};
-static void addMediaEngine(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType, MediaEngineGetSitesInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForSite);
+static void addMediaEngine(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType, MediaEngineGetSitesInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForSite, MediaEngineSupportsKeySystem);
static MediaPlayerFactory* bestMediaEngineForSupportParameters(const MediaEngineSupportParameters&, MediaPlayerFactory* current = 0);
static MediaPlayerFactory* nextMediaEngine(MediaPlayerFactory* current);
@@ -237,13 +239,13 @@
}
static void addMediaEngine(CreateMediaEnginePlayer constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsType,
- MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite)
+ MediaEngineGetSitesInMediaCache getSitesInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForSite clearMediaCacheForSite, MediaEngineSupportsKeySystem supportsKeySystem)
{
ASSERT(constructor);
ASSERT(getSupportedTypes);
ASSERT(supportsType);
- installedMediaEngines().append(new MediaPlayerFactory(constructor, getSupportedTypes, supportsType, getSitesInMediaCache, clearMediaCache, clearMediaCacheForSite));
+ installedMediaEngines().append(new MediaPlayerFactory(constructor, getSupportedTypes, supportsType, getSitesInMediaCache, clearMediaCache, clearMediaCacheForSite, supportsKeySystem));
}
static const AtomicString& applicationOctetStream()
@@ -1008,6 +1010,15 @@
}
}
+bool MediaPlayer::supportsKeySystem(const String& keySystem, const String& mimeType)
+{
+ for (auto& engine : installedMediaEngines()) {
+ if (engine->supportsKeySystem && engine->supportsKeySystem(keySystem, mimeType))
+ return true;
+ }
+ return false;
+}
+
void MediaPlayer::setPrivateBrowsingMode(bool privateBrowsingMode)
{
m_privateBrowsing = privateBrowsingMode;
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-02-22 00:12:51 UTC (rev 164513)
@@ -283,6 +283,7 @@
static void getSitesInMediaCache(Vector<String>&);
static void clearMediaCache();
static void clearMediaCacheForSite(const String&);
+ static bool supportsKeySystem(const String& keySystem, const String& mimeType);
bool supportsFullscreen() const;
bool supportsSave() const;
@@ -592,9 +593,10 @@
typedef void (*MediaEngineGetSitesInMediaCache)(Vector<String>&);
typedef void (*MediaEngineClearMediaCache)();
typedef void (*MediaEngineClearMediaCacheForSite)(const String&);
+typedef bool (*MediaEngineSupportsKeySystem)(const String& keySystem, const String& mimeType);
typedef void (*MediaEngineRegistrar)(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType,
- MediaEngineGetSitesInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForSite);
+ MediaEngineGetSitesInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForSite, MediaEngineSupportsKeySystem);
typedef void (*MediaEngineRegister)(MediaEngineRegistrar);
class MediaPlayerFactorySupport {
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2014-02-22 00:12:51 UTC (rev 164513)
@@ -297,7 +297,7 @@
void MediaPlayerPrivateAVFoundationCF::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
}
MediaPlayerPrivateAVFoundationCF::MediaPlayerPrivateAVFoundationCF(MediaPlayer* player)
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h 2014-02-22 00:12:51 UTC (rev 164513)
@@ -122,6 +122,7 @@
static PassOwnPtr<MediaPlayerPrivateInterface> create(MediaPlayer*);
static void getSupportedTypes(HashSet<String>& types);
static MediaPlayer::SupportsType supportsType(const MediaEngineSupportParameters&);
+ static bool supportsKeySystem(const String& keySystem, const String& mimeType);
static bool isAvailable();
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2014-02-22 00:12:51 UTC (rev 164513)
@@ -270,7 +270,7 @@
void MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0, supportsKeySystem);
}
MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC(MediaPlayer* player)
@@ -966,10 +966,10 @@
supportedTypes = mimeTypeCache();
}
-#if ENABLE(ENCRYPTED_MEDIA)
+#if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2)
static bool keySystemIsSupported(const String& keySystem)
{
- if (equalIgnoringCase(keySystem, "com.apple.lskd") || equalIgnoringCase(keySystem, "com.apple.lskd.1_0"))
+ if (equalIgnoringCase(keySystem, "com.apple.fps") || equalIgnoringCase(keySystem, "com.apple.fps.1_0"))
return true;
return false;
}
@@ -1012,6 +1012,25 @@
return [AVURLAsset isPlayableExtendedMIMEType:typeString] ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;;
}
+bool MediaPlayerPrivateAVFoundationObjC::supportsKeySystem(const String& keySystem, const String& mimeType)
+{
+#if ENABLE(ENCRYPTED_MEDIA) || ENABLE(ENCRYPTED_MEDIA_V2)
+ if (!keySystem.isEmpty()) {
+ if (!keySystemIsSupported(keySystem))
+ return false;
+
+ if (!mimeType.isEmpty() && !mimeTypeCache().contains(mimeType))
+ return false;
+
+ return true;
+ }
+#else
+ UNUSED_PARAM(keySystem);
+ UNUSED_PARAM(mimeType);
+#endif
+ return false;
+}
+
#if HAVE(AVFOUNDATION_LOADER_DELEGATE)
bool MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource(AVAssetResourceLoadingRequest* avRequest)
{
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-02-22 00:12:51 UTC (rev 164513)
@@ -165,7 +165,7 @@
void MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
}
PassOwnPtr<MediaPlayerPrivateInterface> MediaPlayerPrivateMediaSourceAVFObjC::create(MediaPlayer* player)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2014-02-22 00:12:51 UTC (rev 164513)
@@ -187,7 +187,7 @@
void MediaPlayerPrivateGStreamer::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
}
bool initializeGStreamerAndRegisterWebKitElements()
Modified: trunk/Source/WebCore/platform/graphics/ios/MediaPlayerPrivateIOS.mm (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/ios/MediaPlayerPrivateIOS.mm 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/ios/MediaPlayerPrivateIOS.mm 2014-02-22 00:12:51 UTC (rev 164513)
@@ -114,7 +114,7 @@
void MediaPlayerPrivateIOS::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
}
MediaPlayerPrivateIOS::MediaPlayerPrivateIOS(MediaPlayer* player)
Modified: trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm 2014-02-22 00:12:51 UTC (rev 164513)
@@ -185,7 +185,7 @@
void MediaPlayerPrivateQTKit::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType, getSitesInMediaCache, clearMediaCache, clearMediaCacheForSite);
+ registrar(create, getSupportedTypes, supportsType, getSitesInMediaCache, clearMediaCache, clearMediaCacheForSite, 0);
}
MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit(MediaPlayer* player)
Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp (164512 => 164513)
--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp 2014-02-22 00:12:51 UTC (rev 164513)
@@ -152,7 +152,7 @@
void MediaPlayerPrivateQuickTimeVisualContext::registerMediaEngine(MediaEngineRegistrar registrar)
{
if (isAvailable())
- registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
}
MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualContext(MediaPlayer* player)
Modified: trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp (164512 => 164513)
--- trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp 2014-02-22 00:10:53 UTC (rev 164512)
+++ trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp 2014-02-22 00:12:51 UTC (rev 164513)
@@ -41,7 +41,7 @@
// MediaPlayer Enigne Support
void MockMediaPlayerMediaSource::registerMediaEngine(MediaEngineRegistrar registrar)
{
- registrar(create, getSupportedTypes, supportsType, 0, 0, 0);
+ registrar(create, getSupportedTypes, supportsType, 0, 0, 0, 0);
}
PassOwnPtr<MediaPlayerPrivateInterface> MockMediaPlayerMediaSource::create(MediaPlayer* player)