Diff
Modified: trunk/Source/WTF/ChangeLog (217904 => 217905)
--- trunk/Source/WTF/ChangeLog 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WTF/ChangeLog 2017-06-07 22:15:50 UTC (rev 217905)
@@ -1,3 +1,15 @@
+2017-06-07 Jer Noble <jer.no...@apple.com>
+
+ Refactoring: MediaEngineSupportParameters should take a ContentType rather than separate type & codecs strings
+ https://bugs.webkit.org/show_bug.cgi?id=173038
+
+ Reviewed by Eric Carlson.
+
+ Drive by fix: add a version of split that takes a UChar and returns a Vector<String>.
+
+ * wtf/text/WTFString.h:
+ (WTF::String::split):
+
2017-06-07 Zan Dobersek <zdober...@igalia.com>
[GCrypt] RSA-PSS support
Modified: trunk/Source/WTF/wtf/text/WTFString.h (217904 => 217905)
--- trunk/Source/WTF/wtf/text/WTFString.h 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2017-06-07 22:15:50 UTC (rev 217905)
@@ -369,7 +369,12 @@
{
split(separator, false, result);
}
-
+ Vector<String> split(UChar separator) const
+ {
+ Vector<String> result;
+ split(separator, false, result);
+ return result;
+ }
Vector<String> split(const String& separator) const
{
Vector<String> result;
Modified: trunk/Source/WebCore/ChangeLog (217904 => 217905)
--- trunk/Source/WebCore/ChangeLog 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/ChangeLog 2017-06-07 22:15:50 UTC (rev 217905)
@@ -1,3 +1,65 @@
+2017-06-07 Jer Noble <jer.no...@apple.com>
+
+ Refactoring: MediaEngineSupportParameters should take a ContentType rather than separate type & codecs strings
+ https://bugs.webkit.org/show_bug.cgi?id=173038
+
+ Reviewed by Eric Carlson.
+
+ * Modules/encryptedmedia/CDM.cpp:
+ (WebCore::CDM::getSupportedCapabilitiesForAudioVideoType):
+ * Modules/mediasource/MediaSource.cpp:
+ (WebCore::MediaSource::addSourceBuffer):
+ (WebCore::MediaSource::isTypeSupported):
+ * dom/DOMImplementation.cpp:
+ (WebCore::DOMImplementation::createDocument):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::canPlayType):
+ (WebCore::HTMLMediaElement::selectNextSourceChild):
+ * platform/ContentType.cpp:
+ (WebCore::ContentType::codecsParameter):
+ (WebCore::ContentType::profilesParameter):
+ (WebCore::ContentType::containerType):
+ (WebCore::simplifyWhitespace):
+ (WebCore::ContentType::codecs):
+ (WebCore::ContentType::profiles):
+ (WebCore::ContentType::type): Deleted.
+ * platform/ContentType.h:
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::bestMediaEngineForSupportParameters):
+ (WebCore::MediaPlayer::load):
+ (WebCore::MediaPlayer::nextBestMediaEngine):
+ (WebCore::MediaPlayer::loadWithNextMediaEngine):
+ (WebCore::MediaPlayer::supportsType):
+ (WebCore::MediaPlayer::networkStateChanged):
+ (WebCore::codecs): Deleted.
+ * platform/graphics/MediaPlayer.h:
+ (WebCore::MediaPlayer::contentMIMEType):
+ (WebCore::MediaPlayer::contentTypeCodecs):
+ * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
+ (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType):
+ (WebCore::CDMPrivateMediaSourceAVFObjC::supportsMIMEType):
+ * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+ (WebCore::MediaPlayerPrivateAVFoundationCF::supportsType):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType):
+ * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
+ (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::supportsType):
+ * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivateQTKit::supportsType):
+ * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+ (WebCore::MediaPlayerPrivateMediaFoundation::supportsType):
+ * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
+ (WebCore::MockMediaPlayerMediaSource::supportsType):
+ * platform/mock/mediasource/MockMediaSourcePrivate.cpp:
+ (WebCore::MockMediaSourcePrivate::addSourceBuffer):
+
2017-06-07 Ryosuke Niwa <rn...@webkit.org>
Use a dedicated node flag to identify a Document node
Modified: trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp (217904 => 217905)
--- trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -488,8 +488,7 @@
// combination of container, media types, robustness and local accumulated configuration in combination
// with restrictions:
MediaEngineSupportParameters parameters;
- parameters.type = contentType.mimeType();
- parameters.codecs = codecs;
+ parameters.type = contentType;
if (!MediaPlayer::supportsType(parameters, nullptr)) {
// Try with Media Source:
parameters.isMediaSource = true;
Modified: trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp (217904 => 217905)
--- trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -656,7 +656,7 @@
// column of the byte stream format registry [MSE-REGISTRY] entry that is associated with type.
// NOTE: In the current byte stream format registry <http://www.w3.org/2013/12/byte-stream-format-registry/>
// only the "MPEG Audio Byte Stream Format" has the "Generate Timestamps Flag" value set.
- bool shouldGenerateTimestamps = contentType.type() == "audio/aac" || contentType.type() == "audio/mpeg";
+ bool shouldGenerateTimestamps = contentType.containerType() == "audio/aac" || contentType.containerType() == "audio/mpeg";
buffer->setShouldGenerateTimestamps(shouldGenerateTimestamps);
// 7. If the generate timestamps flag equals true:
@@ -836,7 +836,7 @@
String codecs = contentType.parameter("codecs");
// 2. If type does not contain a valid MIME type string, then return false.
- if (contentType.type().isEmpty())
+ if (contentType.containerType().isEmpty())
return false;
// 3. If type contains a media type or media subtype that the MediaSource does not support, then return false.
@@ -844,8 +844,7 @@
// 5. If the MediaSource does not support the specified combination of media type, media subtype, and codecs then return false.
// 6. Return true.
MediaEngineSupportParameters parameters;
- parameters.type = contentType.type();
- parameters.codecs = codecs;
+ parameters.type = contentType;
parameters.isMediaSource = true;
MediaPlayer::SupportsType supported = MediaPlayer::supportsType(parameters, 0);
Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (217904 => 217905)
--- trunk/Source/WebCore/dom/DOMImplementation.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -195,7 +195,7 @@
// Key system is not applicable here.
DOMImplementationSupportsTypeClient client(frame && frame->settings().needsSiteSpecificQuirks(), url.host());
MediaEngineSupportParameters parameters;
- parameters.type = type;
+ parameters.type = ContentType(type);
parameters.url = ""
if (MediaPlayer::supportsType(parameters, &client))
return MediaDocument::create(frame, url);
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (217904 => 217905)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -1108,8 +1108,7 @@
{
MediaEngineSupportParameters parameters;
ContentType contentType(mimeType);
- parameters.type = contentType.type().convertToASCIILowercase();
- parameters.codecs = contentType.parameter(ASCIILiteral("codecs"));
+ parameters.type = contentType;
MediaPlayer::SupportsType support = MediaPlayer::supportsType(parameters, this);
String canPlay;
@@ -4281,9 +4280,7 @@
LOG(Media, "HTMLMediaElement::selectNextSourceChild(%p) - 'type' is '%s'", this, type.utf8().data());
#endif
MediaEngineSupportParameters parameters;
- ContentType contentType(type);
- parameters.type = contentType.type().convertToASCIILowercase();
- parameters.codecs = contentType.parameter(ASCIILiteral("codecs"));
+ parameters.type = ContentType(type);
parameters.url = ""
#if ENABLE(MEDIA_SOURCE)
parameters.isMediaSource = mediaURL.protocolIs(mediaSourceBlobProtocol);
Modified: trunk/Source/WebCore/platform/ContentType.cpp (217904 => 217905)
--- trunk/Source/WebCore/platform/ContentType.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/ContentType.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -27,6 +27,8 @@
#include "config.h"
#include "ContentType.h"
+#include "HTMLParserIdioms.h"
+#include <wtf/NeverDestroyed.h>
namespace WebCore {
@@ -35,6 +37,18 @@
{
}
+const String& ContentType::codecsParameter()
+{
+ static NeverDestroyed<String> codecs { ASCIILiteral("codecs") };
+ return codecs;
+}
+
+const String& ContentType::profilesParameter()
+{
+ static NeverDestroyed<String> profiles { ASCIILiteral("profiles") };
+ return profiles;
+}
+
String ContentType::parameter(const String& parameterName) const
{
String parameterValue;
@@ -64,7 +78,7 @@
return parameterValue;
}
-String ContentType::type() const
+String ContentType::containerType() const
{
String strippedType = m_type.stripWhiteSpace();
@@ -76,19 +90,19 @@
return strippedType;
}
+static String stripHTMLWhiteSpace(const String& string)
+{
+ return string.stripWhiteSpace(isHTMLSpace);
+}
+
Vector<String> ContentType::codecs() const
{
- String codecsParameter = parameter(ASCIILiteral("codecs"));
+ return parameter(codecsParameter()).split(',').map(stripHTMLWhiteSpace);
+}
- if (codecsParameter.isEmpty())
- return Vector<String>();
-
- Vector<String> codecs;
- codecsParameter.split(',', codecs);
- for (size_t i = 0; i < codecs.size(); ++i)
- codecs[i] = codecs[i].simplifyWhiteSpace();
-
- return codecs;
+Vector<String> ContentType::profiles() const
+{
+ return parameter(profilesParameter()).split(',').map(stripHTMLWhiteSpace);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ContentType.h (217904 => 217905)
--- trunk/Source/WebCore/platform/ContentType.h 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/ContentType.h 2017-06-07 22:15:50 UTC (rev 217905)
@@ -27,6 +27,7 @@
#ifndef ContentType_h
#define ContentType_h
+#include <wtf/HashMap.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -37,9 +38,13 @@
explicit ContentType(const String& type);
ContentType() = default;
+ static const String& codecsParameter();
+ static const String& profilesParameter();
+
String parameter(const String& parameterName) const;
- String type() const;
+ String containerType() const;
Vector<String> codecs() const;
+ Vector<String> profiles() const;
const String& raw() const { return m_type; }
bool isEmpty() const { return m_type.isEmpty(); }
private:
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -288,12 +288,6 @@
return textPlain;
}
-static const AtomicString& codecs()
-{
- static NeverDestroyed<const AtomicString> codecs("codecs", AtomicString::ConstructFromLiteral);
- return codecs;
-}
-
static const MediaPlayerFactory* bestMediaEngineForSupportParameters(const MediaEngineSupportParameters& parameters, const MediaPlayerFactory* current = nullptr)
{
if (parameters.type.isEmpty() && !parameters.isMediaSource && !parameters.isMediaStream)
@@ -302,8 +296,8 @@
// 4.8.10.3 MIME types - In the absence of a specification to the contrary, the MIME type "application/octet-stream"
// when used with parameters, e.g. "application/octet-stream;codecs=theora", is a type that the user agent knows
// it cannot render.
- if (parameters.type == applicationOctetStream()) {
- if (!parameters.codecs.isEmpty())
+ if (parameters.type.containerType() == applicationOctetStream()) {
+ if (!parameters.type.codecs().isEmpty())
return nullptr;
}
@@ -381,8 +375,7 @@
// Protect against MediaPlayer being destroyed during a MediaPlayerClient callback.
Ref<MediaPlayer> protectedThis(*this);
- m_contentMIMEType = contentType.type().convertToASCIILowercase();
- m_contentTypeCodecs = contentType.parameter(codecs());
+ m_contentType = contentType;
m_url = url;
m_keySystem = keySystem.convertToASCIILowercase();
m_contentMIMETypeWasInferredFromExtension = false;
@@ -395,9 +388,10 @@
#endif
// If the MIME type is missing or is not meaningful, try to figure it out from the URL.
- if (m_contentMIMEType.isEmpty() || m_contentMIMEType == applicationOctetStream() || m_contentMIMEType == textPlain()) {
+ AtomicString containerType = m_contentType.containerType();
+ if (containerType.isEmpty() || containerType == applicationOctetStream() || containerType == textPlain()) {
if (m_url.protocolIsData())
- m_contentMIMEType = mimeTypeFromDataURL(m_url.string());
+ m_contentType = ContentType(mimeTypeFromDataURL(m_url.string()));
else {
String lastPathComponent = url.lastPathComponent();
size_t pos = lastPathComponent.reverseFind('.');
@@ -405,7 +399,7 @@
String extension = lastPathComponent.substring(pos + 1);
String mediaType = MIMETypeRegistry::getMediaMIMETypeForExtension(extension);
if (!mediaType.isEmpty()) {
- m_contentMIMEType = mediaType;
+ m_contentType = ContentType(mediaType);
m_contentMIMETypeWasInferredFromExtension = true;
}
}
@@ -423,8 +417,7 @@
ASSERT(mediaSource);
m_mediaSource = mediaSource;
- m_contentMIMEType = contentType.type().convertToASCIILowercase();
- m_contentTypeCodecs = contentType.parameter(codecs());
+ m_contentType = contentType;
m_url = url;
m_keySystem = emptyString();
m_contentMIMETypeWasInferredFromExtension = false;
@@ -440,7 +433,7 @@
m_mediaStream = &mediaStream;
m_keySystem = emptyString();
- m_contentMIMEType = emptyString();
+ m_contentType = { };
m_contentMIMETypeWasInferredFromExtension = false;
loadWithNextMediaEngine(0);
return m_currentMediaEngine;
@@ -450,8 +443,7 @@
const MediaPlayerFactory* MediaPlayer::nextBestMediaEngine(const MediaPlayerFactory* current) const
{
MediaEngineSupportParameters parameters;
- parameters.type = m_contentMIMEType;
- parameters.codecs = m_contentTypeCodecs;
+ parameters.type = m_contentType;
parameters.url = ""
#if ENABLE(MEDIA_SOURCE)
parameters.isMediaSource = !!m_mediaSource;
@@ -482,16 +474,16 @@
const MediaPlayerFactory* engine = nullptr;
- if (!m_contentMIMEType.isEmpty() || MEDIASTREAM || MEDIASOURCE)
+ if (!m_contentType.isEmpty() || MEDIASTREAM || MEDIASOURCE)
engine = nextBestMediaEngine(current);
// If no MIME type is specified or the type was inferred from the file extension, just use the next engine.
- if (!engine && (m_contentMIMEType.isEmpty() || m_contentMIMETypeWasInferredFromExtension))
+ if (!engine && (m_contentType.isEmpty() || m_contentMIMETypeWasInferredFromExtension))
engine = nextMediaEngine(current);
// Don't delete and recreate the player unless it comes from a different engine.
if (!engine) {
- LOG(Media, "MediaPlayer::loadWithNextMediaEngine - no media engine found for type \"%s\"", m_contentMIMEType.utf8().data());
+ LOG(Media, "MediaPlayer::loadWithNextMediaEngine - no media engine found for type \"%s\"", m_contentType.raw().utf8().data());
m_currentMediaEngine = engine;
m_private = nullptr;
} else if (m_currentMediaEngine != engine) {
@@ -879,7 +871,8 @@
{
// 4.8.10.3 MIME types - The canPlayType(type) method must return the empty string if type is a type that the
// user agent knows it cannot render or is the type "application/octet-stream"
- if (parameters.type == applicationOctetStream())
+ AtomicString containerType = parameters.type.containerType();
+ if (containerType == applicationOctetStream())
return IsNotSupported;
const MediaPlayerFactory* engine = bestMediaEngineForSupportParameters(parameters);
@@ -896,7 +889,7 @@
if (client && client->mediaPlayerNeedsSiteSpecificHacks()) {
String host = client->mediaPlayerDocumentHost();
if ((host.endsWith(".youtube.com", false) || equalLettersIgnoringASCIICase(host, "youtube.com"))
- && (parameters.type.startsWith("video/webm", false) || parameters.type.startsWith("video/x-flv", false)))
+ && (containerType.startsWith("video/webm", false) || containerType.startsWith("video/x-flv", false)))
return IsNotSupported;
}
#else
@@ -1130,7 +1123,7 @@
// let the next engine try.
if (m_private->networkState() >= FormatError && m_private->readyState() < HaveMetadata) {
client().mediaPlayerEngineFailedToLoad();
- if (installedMediaEngines().size() > 1 && (m_contentMIMEType.isEmpty() || nextBestMediaEngine(m_currentMediaEngine))) {
+ if (installedMediaEngines().size() > 1 && (m_contentType.isEmpty() || nextBestMediaEngine(m_currentMediaEngine))) {
m_reloadTimer.startOneShot(0_s);
return;
}
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2017-06-07 22:15:50 UTC (rev 217905)
@@ -110,8 +110,7 @@
MediaEngineSupportParameters() { }
- String type;
- String codecs;
+ ContentType type;
URL url;
bool isMediaSource { false };
bool isMediaStream { false };
@@ -586,8 +585,8 @@
void setShouldDisableSleep(bool);
bool shouldDisableSleep() const;
- const String& contentMIMEType() const { return m_contentMIMEType; }
- const String& contentTypeCodecs() const { return m_contentTypeCodecs; }
+ String contentMIMEType() const { return m_contentType.containerType(); }
+ String contentTypeCodecs() const { return m_contentType.parameter(ContentType::codecsParameter()); }
bool contentMIMETypeWasInferredFromExtension() const { return m_contentMIMETypeWasInferredFromExtension; }
const Vector<ContentType>& mediaContentTypesRequiringHardwareSupport() const;
@@ -604,8 +603,7 @@
std::unique_ptr<MediaPlayerPrivateInterface> m_private;
const MediaPlayerFactory* m_currentMediaEngine;
URL m_url;
- String m_contentMIMEType;
- String m_contentTypeCodecs;
+ ContentType m_contentType;
String m_keySystem;
IntSize m_size;
Preload m_preload;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm 2017-06-07 22:15:50 UTC (rev 217905)
@@ -82,7 +82,7 @@
MediaEngineSupportParameters parameters;
parameters.isMediaSource = true;
- parameters.type = mimeType;
+ parameters.type = ContentType(mimeType);
return MediaPlayerPrivateMediaSourceAVFObjC::supportsType(parameters) != MediaPlayer::IsNotSupported;
}
@@ -95,7 +95,7 @@
MediaEngineSupportParameters parameters;
parameters.isMediaSource = true;
- parameters.type = mimeType;
+ parameters.type = ContentType(mimeType);
return MediaPlayerPrivateMediaSourceAVFObjC::supportsType(parameters) != MediaPlayer::IsNotSupported;
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -912,23 +912,25 @@
MediaPlayer::SupportsType MediaPlayerPrivateAVFoundationCF::supportsType(const MediaEngineSupportParameters& parameters)
{
- if (isUnsupportedMIMEType(parameters.type))
+ auto containerType = parameters.type.containerType();
+ if (isUnsupportedMIMEType(containerType))
return MediaPlayer::IsNotSupported;
- if (!staticMIMETypeList().contains(parameters.type) && !avfMIMETypes().contains(parameters.type))
+ if (!staticMIMETypeList().contains(containerType) && !avfMIMETypes().contains(containerType))
return MediaPlayer::IsNotSupported;
+ auto codecs = parameters.type.parameter(ContentType::codecsParameter());
#if HAVE(AVCFURL_PLAYABLE_MIMETYPE)
// The spec says:
// "Implementors are encouraged to return "maybe" unless the type can be confidently established as being supported or not."
- if (parameters.codecs.isEmpty())
+ if (codecs.isEmpty())
return MediaPlayer::MayBeSupported;
- String typeString = parameters.type + "; codecs=\"" + parameters.codecs + "\"";
+ String typeString = containerType + "; codecs=\"" + codecs + "\"";
return AVCFURLAssetIsPlayableExtendedMIMEType(typeString.createCFString().get()) ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;
#else
- if (avfMIMETypes().contains(parameters.type))
- return parameters.codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
+ if (avfMIMETypes().contains(containerType))
+ return codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
return MediaPlayer::IsNotSupported;
#endif
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2017-06-07 22:15:50 UTC (rev 217905)
@@ -945,9 +945,9 @@
[options setObject:@YES forKey:AVURLAssetRequiresCustomURLLoadingKey];
#endif
- auto& type = player()->contentMIMEType();
+ auto type = player()->contentMIMEType();
if (AVURLAssetOutOfBandMIMETypeKey && !type.isEmpty() && !player()->contentMIMETypeWasInferredFromExtension()) {
- auto& codecs = player()->contentTypeCodecs();
+ auto codecs = player()->contentTypeCodecs();
if (!codecs.isEmpty()) {
NSString *typeString = [NSString stringWithFormat:@"%@; codecs=\"%@\"", (NSString *)type, (NSString *)codecs];
[options setObject:typeString forKey:AVURLAssetOutOfBandMIMETypeKey];
@@ -1715,18 +1715,20 @@
if (parameters.isMediaStream)
return MediaPlayer::IsNotSupported;
#endif
- if (isUnsupportedMIMEType(parameters.type))
+
+ auto containerType = parameters.type.containerType();
+ if (isUnsupportedMIMEType(containerType))
return MediaPlayer::IsNotSupported;
- if (!staticMIMETypeList().contains(parameters.type) && !AVFoundationMIMETypeCache::singleton().types().contains(parameters.type))
+ if (!staticMIMETypeList().contains(containerType) && !AVFoundationMIMETypeCache::singleton().types().contains(containerType))
return MediaPlayer::IsNotSupported;
// The spec says:
// "Implementors are encouraged to return "maybe" unless the type can be confidently established as being supported or not."
- if (parameters.codecs.isEmpty())
+ if (parameters.type.codecs().isEmpty())
return MediaPlayer::MayBeSupported;
- NSString *typeString = [NSString stringWithFormat:@"%@; codecs=\"%@\"", (NSString *)parameters.type, (NSString *)parameters.codecs];
+ NSString *typeString = [NSString stringWithFormat:@"%@; codecs=\"%@\"", (NSString *)containerType, (NSString *)parameters.type.parameter(ContentType::codecsParameter())];
return [AVURLAsset isPlayableExtendedMIMEType:typeString] ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2017-06-07 22:15:50 UTC (rev 217905)
@@ -214,19 +214,20 @@
return MediaPlayer::IsNotSupported;
#endif
- if (parameters.type.isEmpty() || !AVFoundationMIMETypeCache::singleton().types().contains(parameters.type))
+ if (parameters.type.isEmpty() || !AVFoundationMIMETypeCache::singleton().types().contains(parameters.type.containerType()))
return MediaPlayer::IsNotSupported;
// The spec says:
// "Implementors are encouraged to return "maybe" unless the type can be confidently established as being supported or not."
- if (parameters.codecs.isEmpty())
+ auto codecs = parameters.type.parameter(ContentType::codecsParameter());
+ if (codecs.isEmpty())
return MediaPlayer::MayBeSupported;
- NSString *outputCodecs = parameters.codecs;
+ NSString *outputCodecs = codecs;
if ([getAVStreamDataParserClass() respondsToSelector:@selector(outputMIMECodecParameterForInputMIMECodecParameter:)])
outputCodecs = [getAVStreamDataParserClass() outputMIMECodecParameterForInputMIMECodecParameter:outputCodecs];
- NSString *typeString = [NSString stringWithFormat:@"%@; codecs=\"%@\"", (NSString *)parameters.type, (NSString *)outputCodecs];
+ NSString *typeString = [NSString stringWithFormat:@"%@; codecs=\"%@\"", (NSString *)parameters.type.containerType(), (NSString *)outputCodecs];
return [getAVURLAssetClass() isPlayableExtendedMIMEType:typeString] ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;;
}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm 2017-06-07 22:15:50 UTC (rev 217905)
@@ -66,8 +66,7 @@
{
MediaEngineSupportParameters parameters;
parameters.isMediaSource = true;
- parameters.type = contentType.type();
- parameters.codecs = contentType.parameter(ASCIILiteral("codecs"));
+ parameters.type = contentType;
if (MediaPlayerPrivateMediaSourceAVFObjC::supportsType(parameters) == MediaPlayer::IsNotSupported)
return NotSupported;
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -1902,12 +1902,12 @@
if (parameters.isMediaStream)
return result;
- if (parameters.type.isNull() || parameters.type.isEmpty())
+ if (parameters.type.isEmpty())
return result;
// spec says we should not return "probably" if the codecs string is empty
- if (mimeTypeSet().contains(parameters.type))
- result = parameters.codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
+ if (mimeTypeSet().contains(parameters.type.containerType()))
+ result = parameters.type.codecs().isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
return extendedSupportsType(parameters, result);
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -858,22 +858,24 @@
if (!parameters.isMediaSource)
return result;
+ auto containerType = parameters.type.containerType();
// Disable VPX/Opus on MSE for now, mp4/avc1 seems way more reliable currently.
- if (parameters.type.endsWith("webm"))
+ if (containerType.endsWith("webm"))
return result;
// YouTube TV provides empty types for some videos and we want to be selected as best media engine for them.
- if (parameters.type.isEmpty()) {
+ if (containerType.isEmpty()) {
result = MediaPlayer::MayBeSupported;
return result;
}
// Spec says we should not return "probably" if the codecs string is empty.
- if (mimeTypeCache().contains(parameters.type)) {
- if (parameters.codecs.isEmpty())
+ if (mimeTypeCache().contains(containerType)) {
+ String codecs = parameters.type.parameter(ContentType::codecsParameter());
+ if (codecs.isEmpty())
result = MediaPlayer::MayBeSupported;
else
- result = supportsCodecs(parameters.codecs) ? MediaPlayer::IsSupported : MediaPlayer::IsNotSupported;
+ result = supportsCodecs(codecs) ? MediaPlayer::IsSupported : MediaPlayer::IsNotSupported;
}
return extendedSupportsType(parameters, result);
Modified: trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm 2017-06-07 22:15:50 UTC (rev 217905)
@@ -1317,12 +1317,13 @@
// Due to <rdar://problem/10777059>, avoid calling the mime types cache functions if at
// all possible:
- if (shouldRejectMIMEType(parameters.type))
+ auto containerType = parameters.type.containerType();
+ if (shouldRejectMIMEType(containerType))
return MediaPlayer::IsNotSupported;
// We check the "modern" type cache first, as it doesn't require QTKitServer to start.
- if (mimeModernTypesCache().contains(parameters.type) || mimeCommonTypesCache().contains(parameters.type))
- return parameters.codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
+ if (mimeModernTypesCache().contains(containerType) || mimeCommonTypesCache().contains(containerType))
+ return parameters.type.codecs().isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
return MediaPlayer::IsNotSupported;
}
Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp (217904 => 217905)
--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -158,10 +158,10 @@
MediaPlayer::SupportsType MediaPlayerPrivateMediaFoundation::supportsType(const MediaEngineSupportParameters& parameters)
{
- if (parameters.type.isNull() || parameters.type.isEmpty())
+ if (parameters.type.isEmpty())
return MediaPlayer::IsNotSupported;
- if (mimeTypeCache().contains(parameters.type))
+ if (mimeTypeCache().contains(parameters.type.containerType()))
return MediaPlayer::IsSupported;
return MediaPlayer::IsNotSupported;
Modified: trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp (217904 => 217905)
--- trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -68,13 +68,15 @@
if (!parameters.isMediaSource)
return MediaPlayer::IsNotSupported;
- if (parameters.type.isEmpty() || !mimeTypeCache().contains(parameters.type))
+ auto containerType = parameters.type.containerType();
+ if (containerType.isEmpty() || !mimeTypeCache().contains(containerType))
return MediaPlayer::IsNotSupported;
- if (parameters.codecs.isEmpty())
+ auto codecs = parameters.type.parameter(ContentType::codecsParameter());
+ if (codecs.isEmpty())
return MediaPlayer::MayBeSupported;
- return parameters.codecs == "mock" ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;
+ return codecs == "mock" ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;
}
MockMediaPlayerMediaSource::MockMediaPlayerMediaSource(MediaPlayer* player)
Modified: trunk/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp (217904 => 217905)
--- trunk/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp 2017-06-07 22:07:10 UTC (rev 217904)
+++ trunk/Source/WebCore/platform/mock/mediasource/MockMediaSourcePrivate.cpp 2017-06-07 22:15:50 UTC (rev 217905)
@@ -62,8 +62,7 @@
{
MediaEngineSupportParameters parameters;
parameters.isMediaSource = true;
- parameters.type = contentType.type();
- parameters.codecs = contentType.parameter(ASCIILiteral("codecs"));
+ parameters.type = contentType;
if (MockMediaPlayerMediaSource::supportsType(parameters) == MediaPlayer::IsNotSupported)
return NotSupported;