<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[185958] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/185958">185958</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-06-25 12:37:43 -0700 (Thu, 25 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Win] Update MediaPlayerPrivateAVFoundationCF::supportsType
https://bugs.webkit.org/show_bug.cgi?id=146302
&lt;rdar://problem/19726553&gt;

Reviewed by Eric Carlson.

Tested by existing media tests.

Update the AVFoundationCF version of 'supportsType' to more closely match the AVFoundation
version. Use this new code when the necessary AVFoundationCF functions are present.

* AVFoundationSupport.py: Check for presence of AVCFURLAssetIsPlayableExtendedMIMEType.
(fileContains): Added helper function.
* WebCore.vcxproj/WebCoreGenerated.vcxproj: Add AVFoundationSupport.py to project file to make
maintenance easier.
* WebCore.vcxproj/WebCoreGenerated.vcxproj.filters: Ditto.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::isUnsupportedMIMEType): Moved from ObjC version.
(WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList): Ditto.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
* platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h: Add missing declaration.
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::avfMIMETypes): Added CF version of AVFoundation code.
(WebCore::MediaPlayerPrivateAVFoundationCF::supportsType): Update to use new AVCF
method if it is available.
(WebCore::MediaPlayerPrivateAVFoundationCF::languageOfPrimaryAudioTrack): Handle case of a
null language locale. This is a drive-by fix of a bug found during testing.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::isUnsupportedMIMEType): Deleted.
(WebCore::staticMIMETypeList): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreAVFoundationSupportpy">trunk/Source/WebCore/AVFoundationSupport.py</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCoreGeneratedvcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCoreGeneratedvcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationcpp">trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationh">trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationcfAVFoundationCFSoftLinkingh">trunk/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationcfMediaPlayerPrivateAVFoundationCFcpp">trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreAVFoundationSupportpy"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/AVFoundationSupport.py (185957 => 185958)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/AVFoundationSupport.py        2015-06-25 19:22:22 UTC (rev 185957)
+++ trunk/Source/WebCore/AVFoundationSupport.py        2015-06-25 19:37:43 UTC (rev 185958)
</span><span class="lines">@@ -26,13 +26,22 @@
</span><span class="cx"> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
</span><span class="cx"> # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> 
</span><ins>+import re
</ins><span class="cx"> import sys
</span><span class="cx"> import os
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> def lookFor(relativePath):
</span><span class="cx">     return os.path.isfile(os.environ['WEBKIT_LIBRARIES'] + relativePath)
</span><span class="cx"> 
</span><ins>+
+def fileContains(relativePath, regexp):
+    with open(os.environ['WEBKIT_LIBRARIES'] + relativePath) as file:
+        for line in file:
+            if regexp.search(line):
+                return True
+    return False
+
+
</ins><span class="cx"> print &quot;/* Identifying AVFoundation Support */&quot;
</span><span class="cx"> if lookFor(&quot;/include/AVFoundationCF/AVCFBase.h&quot;):
</span><span class="cx">     print &quot;#define HAVE_AVCF 1&quot;
</span><span class="lines">@@ -40,3 +49,7 @@
</span><span class="cx">     print &quot;#define HAVE_AVCF_LEGIBLE_OUTPUT 1&quot;
</span><span class="cx"> if lookFor(&quot;/include/AVFoundationCF/AVCFAssetResourceLoader.h&quot;):
</span><span class="cx">     print &quot;#define HAVE_AVFOUNDATION_LOADER_DELEGATE 1&quot;
</span><ins>+if lookFor(&quot;/include/AVFoundationCF/AVCFAsset.h&quot;):
+    regexp = re.compile(&quot;AVCFURLAssetIsPlayableExtendedMIMEType&quot;)
+    if fileContains(&quot;/include/AVFoundationCF/AVCFAsset.h&quot;, regexp):
+        print &quot;#define HAVE_AVCFURL_PLAYABLE_MIMETYPE 1&quot;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (185957 => 185958)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-25 19:22:22 UTC (rev 185957)
+++ trunk/Source/WebCore/ChangeLog        2015-06-25 19:37:43 UTC (rev 185958)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-06-25  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        [Win] Update MediaPlayerPrivateAVFoundationCF::supportsType
+        https://bugs.webkit.org/show_bug.cgi?id=146302
+        &lt;rdar://problem/19726553&gt;
+
+        Reviewed by Eric Carlson.
+
+        Tested by existing media tests.
+
+        Update the AVFoundationCF version of 'supportsType' to more closely match the AVFoundation
+        version. Use this new code when the necessary AVFoundationCF functions are present.
+
+        * AVFoundationSupport.py: Check for presence of AVCFURLAssetIsPlayableExtendedMIMEType.
+        (fileContains): Added helper function.
+        * WebCore.vcxproj/WebCoreGenerated.vcxproj: Add AVFoundationSupport.py to project file to make
+        maintenance easier.
+        * WebCore.vcxproj/WebCoreGenerated.vcxproj.filters: Ditto.
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundation::isUnsupportedMIMEType): Moved from ObjC version.
+        (WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList): Ditto.
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+        * platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h: Add missing declaration.
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::avfMIMETypes): Added CF version of AVFoundation code.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::supportsType): Update to use new AVCF
+        method if it is available.
+        (WebCore::MediaPlayerPrivateAVFoundationCF::languageOfPrimaryAudioTrack): Handle case of a
+        null language locale. This is a drive-by fix of a bug found during testing.
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::isUnsupportedMIMEType): Deleted.
+        (WebCore::staticMIMETypeList): Deleted.
+
</ins><span class="cx"> 2015-06-25  Matthew Daiter  &lt;mdaiter@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Enabling MEDIA_STREAM
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCoreGeneratedvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.vcxproj (185957 => 185958)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.vcxproj        2015-06-25 19:22:22 UTC (rev 185957)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.vcxproj        2015-06-25 19:37:43 UTC (rev 185958)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx">     &lt;/ProjectConfiguration&gt;
</span><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx">   &lt;ItemGroup&gt;
</span><ins>+    &lt;None Include=&quot;..\AVFoundationSupport.py&quot; /&gt;
</ins><span class="cx">     &lt;None Include=&quot;..\DerivedSources.make&quot; /&gt;
</span><span class="cx">     &lt;None Include=&quot;build-generated-files.pl&quot; /&gt;
</span><span class="cx">     &lt;None Include=&quot;copyForwardingHeaders.cmd&quot; /&gt;
</span><span class="lines">@@ -201,4 +202,4 @@
</span><span class="cx">   &lt;Import Project=&quot;$(VCTargetsPath)\Microsoft.Cpp.targets&quot; /&gt;
</span><span class="cx">   &lt;ImportGroup Label=&quot;ExtensionTargets&quot;&gt;
</span><span class="cx">   &lt;/ImportGroup&gt;
</span><del>-&lt;/Project&gt;
</del><ins>+&lt;/Project&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCoreGeneratedvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.vcxproj.filters (185957 => 185958)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.vcxproj.filters        2015-06-25 19:22:22 UTC (rev 185957)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCoreGenerated.vcxproj.filters        2015-06-25 19:37:43 UTC (rev 185958)
</span><span class="lines">@@ -8,5 +8,6 @@
</span><span class="cx">     &lt;None Include=&quot;..\DerivedSources.make&quot; /&gt;
</span><span class="cx">     &lt;None Include=&quot;build-generated-files.pl&quot; /&gt;
</span><span class="cx">     &lt;None Include=&quot;migrate-scripts.pl&quot; /&gt;
</span><ins>+    &lt;None Include=&quot;..\AVFoundationSupport.py&quot; /&gt;
</ins><span class="cx">   &lt;/ItemGroup&gt;
</span><span class="cx"> &lt;/Project&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (185957 => 185958)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp        2015-06-25 19:22:22 UTC (rev 185957)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp        2015-06-25 19:37:43 UTC (rev 185958)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #include &lt;runtime/DataView.h&gt;
</span><span class="cx"> #include &lt;runtime/Uint16Array.h&gt;
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><ins>+#include &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #include &lt;wtf/StringPrintStream.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -1077,6 +1078,77 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MediaPlayerPrivateAVFoundation::isUnsupportedMIMEType(const String&amp; type)
+{
+    String lowerCaseType = type.convertToASCIILowercase();
+
+    // AVFoundation will return non-video MIME types which it claims to support, but which we
+    // do not support in the &lt;video&gt; element. Reject all non video/, audio/, and application/ types.
+    if (!lowerCaseType.startsWith(&quot;video/&quot;) &amp;&amp; !lowerCaseType.startsWith(&quot;audio/&quot;) &amp;&amp; !lowerCaseType.startsWith(&quot;application/&quot;))
+        return true;
+
+    // Reject types we know AVFoundation does not support that sites commonly ask about.
+    if (lowerCaseType == &quot;video/webm&quot; || lowerCaseType == &quot;audio/webm&quot; || lowerCaseType == &quot;video/x-webm&quot;)
+        return true;
+
+    if (lowerCaseType == &quot;video/x-flv&quot;)
+        return true;
+
+    if (lowerCaseType == &quot;audio/ogg&quot; || lowerCaseType == &quot;video/ogg&quot; || lowerCaseType == &quot;application/ogg&quot;)
+        return true;
+
+    if (lowerCaseType == &quot;video/h264&quot;)
+        return true;
+
+    return false;
+}
+
+const HashSet&lt;String&gt;&amp; MediaPlayerPrivateAVFoundation::staticMIMETypeList()
+{
+    static NeverDestroyed&lt;HashSet&lt;String&gt;&gt; cache = []() {
+        HashSet&lt;String&gt; types;
+
+        static const char* typeNames[] = {
+            &quot;application/vnd.apple.mpegurl&quot;,
+            &quot;application/x-mpegurl&quot;,
+            &quot;audio/3gpp&quot;,
+            &quot;audio/aac&quot;,
+            &quot;audio/aacp&quot;,
+            &quot;audio/aiff&quot;,
+            &quot;audio/basic&quot;,
+            &quot;audio/mp3&quot;,
+            &quot;audio/mp4&quot;,
+            &quot;audio/mpeg&quot;,
+            &quot;audio/mpeg3&quot;,
+            &quot;audio/mpegurl&quot;,
+            &quot;audio/mpg&quot;,
+            &quot;audio/wav&quot;,
+            &quot;audio/wave&quot;,
+            &quot;audio/x-aac&quot;,
+            &quot;audio/x-aiff&quot;,
+            &quot;audio/x-m4a&quot;,
+            &quot;audio/x-mpegurl&quot;,
+            &quot;audio/x-wav&quot;,
+            &quot;video/3gpp&quot;,
+            &quot;video/3gpp2&quot;,
+            &quot;video/mp4&quot;,
+            &quot;video/mpeg&quot;,
+            &quot;video/mpeg2&quot;,
+            &quot;video/mpg&quot;,
+            &quot;video/quicktime&quot;,
+            &quot;video/x-m4v&quot;,
+            &quot;video/x-mpeg&quot;,
+            &quot;video/x-mpg&quot;,
+        };
+        for (size_t i = 0; i &lt; WTF_ARRAY_LENGTH(typeNames); ++i)
+            types.add(typeNames[i]);
+
+        return types;
+    }();
+
+    return cache;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationMediaPlayerPrivateAVFoundationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h (185957 => 185958)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h        2015-06-25 19:22:22 UTC (rev 185957)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h        2015-06-25 19:37:43 UTC (rev 185958)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;MediaPlayerPrivate.h&quot;
</span><span class="cx"> #include &quot;Timer.h&quot;
</span><span class="cx"> #include &lt;functional&gt;
</span><ins>+#include &lt;wtf/HashSet.h&gt;
</ins><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/WeakPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -256,6 +257,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void updateVideoLayerGravity() = 0;
</span><span class="cx"> 
</span><ins>+    static bool isUnsupportedMIMEType(const String&amp;);
+    static const HashSet&lt;String&gt;&amp; staticMIMETypeList();
+
</ins><span class="cx"> protected:
</span><span class="cx">     void updateStates();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationcfAVFoundationCFSoftLinkingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h (185957 => 185958)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h        2015-06-25 19:22:22 UTC (rev 185957)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h        2015-06-25 19:37:43 UTC (rev 185958)
</span><span class="lines">@@ -305,6 +305,8 @@
</span><span class="cx"> SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFAssetResourceLoadingRequestFinishLoadingWithResponse, void, __cdecl, (AVCFAssetResourceLoadingRequestRef loadingRequest, CFURLResponseRef response, CFDataRef data, CFURLRequestRef redirect), (loadingRequest, response, data, redirect))
</span><span class="cx"> #define AVCFAssetResourceLoadingRequestFinishLoadingWithResponse  softLink_AVCFAssetResourceLoadingRequestFinishLoadingWithResponse 
</span><span class="cx"> 
</span><ins>+SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFURLAssetIsPlayableExtendedMIMEType, Boolean, __cdecl, (CFStringRef extendedMIMEType), (extendedMIMEType))
+#define AVCFURLAssetIsPlayableExtendedMIMEType  softLink_AVCFURLAssetIsPlayableExtendedMIMEType 
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> // Variables
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationcfMediaPlayerPrivateAVFoundationCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (185957 => 185958)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp        2015-06-25 19:22:22 UTC (rev 185957)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp        2015-06-25 19:37:43 UTC (rev 185958)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx"> #include &lt;runtime/Uint16Array.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><ins>+#include &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> #include &lt;wtf/Threading.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringView.h&gt;
</span><span class="lines">@@ -906,14 +907,45 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+static const HashSet&lt;String&gt;&amp; avfMIMETypes()
+{
+    static NeverDestroyed&lt;HashSet&lt;String&gt;&gt; cache = []() {
+        HashSet&lt;String&gt; types;
+        RetainPtr&lt;CFArrayRef&gt; avTypes = AVCFURLAssetCopyAudiovisualMIMETypes();
+
+        CFIndex typeCount = CFArrayGetCount(avTypes.get());
+        for (CFIndex i = 0; i &lt; typeCount; ++i) {
+            String mimeType = (CFStringRef)(CFArrayGetValueAtIndex(avTypes.get(), i));
+            types.add(mimeType.lower());
+        }
+
+        return types;
+    }();
+
+    return cache;
+}
+
</ins><span class="cx"> MediaPlayer::SupportsType MediaPlayerPrivateAVFoundationCF::supportsType(const MediaEngineSupportParameters&amp; parameters)
</span><span class="cx"> {
</span><del>-    // Only return &quot;IsSupported&quot; if there is no codecs parameter for now as there is no way to ask if it supports an
-    // extended MIME type until rdar://8721715 is fixed.
</del><ins>+    if (isUnsupportedMIMEType(parameters.type))
+        return MediaPlayer::IsNotSupported;
+
+    if (!staticMIMETypeList().contains(parameters.type) &amp;&amp; !avfMIMETypes().contains(parameters.type))
+        return MediaPlayer::IsNotSupported;
+
+#if HAVE(AVCFURL_PLAYABLE_MIMETYPE)
+    // The spec says:
+    // &quot;Implementors are encouraged to return &quot;maybe&quot; unless the type can be confidently established as being supported or not.&quot;
+    if (parameters.codecs.isEmpty())
+        return MediaPlayer::MayBeSupported;
+
+    String typeString = parameters.type + &quot;; codecs=\&quot;&quot; + parameters.codecs + &quot;\&quot;&quot;;
+    return AVCFURLAssetIsPlayableExtendedMIMEType(typeString.createCFString().get()) ? MediaPlayer::IsSupported : MediaPlayer::MayBeSupported;
+#else
</ins><span class="cx">     if (mimeTypeCache().contains(parameters.type))
</span><span class="cx">         return parameters.codecs.isEmpty() ? MediaPlayer::MayBeSupported : MediaPlayer::IsSupported;
</span><del>-
</del><span class="cx">     return MediaPlayer::IsNotSupported;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool MediaPlayerPrivateAVFoundationCF::supportsKeySystem(const String&amp; keySystem, const String&amp; mimeType)
</span><span class="lines">@@ -1273,7 +1305,11 @@
</span><span class="cx">     AVCFMediaSelectionOptionRef currentlySelectedAudibleOption = AVCFPlayerItemGetSelectedMediaOptionInMediaSelectionGroup(avPlayerItem(m_avfWrapper), audibleGroup);
</span><span class="cx">     if (currentlySelectedAudibleOption) {
</span><span class="cx">         RetainPtr&lt;CFLocaleRef&gt; audibleOptionLocale = adoptCF(AVCFMediaSelectionOptionCopyLocale(currentlySelectedAudibleOption));
</span><del>-        m_languageOfPrimaryAudioTrack = CFLocaleGetIdentifier(audibleOptionLocale.get());
</del><ins>+        if (audibleOptionLocale)
+            m_languageOfPrimaryAudioTrack = CFLocaleGetIdentifier(audibleOptionLocale.get());
+        else
+            m_languageOfPrimaryAudioTrack = emptyString();
+
</ins><span class="cx">         LOG(Media, &quot;MediaPlayerPrivateAVFoundationCF::languageOfPrimaryAudioTrack(%p) - returning language of selected audible option: %s&quot;, this, m_languageOfPrimaryAudioTrack.utf8().data());
</span><span class="cx"> 
</span><span class="cx">         return m_languageOfPrimaryAudioTrack;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateAVFoundationObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (185957 => 185958)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2015-06-25 19:22:22 UTC (rev 185957)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm        2015-06-25 19:37:43 UTC (rev 185958)
</span><span class="lines">@@ -1532,77 +1532,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool isUnsupportedMIMEType(const String&amp; type)
-{
-    String lowerCaseType = type.convertToASCIILowercase();
-
-    // AVFoundation will return non-video MIME types which it claims to support, but which we
-    // do not support in the &lt;video&gt; element. Reject all non video/, audio/, and application/ types.
-    if (!lowerCaseType.startsWith(&quot;video/&quot;) &amp;&amp; !lowerCaseType.startsWith(&quot;audio/&quot;) &amp;&amp; !lowerCaseType.startsWith(&quot;application/&quot;))
-        return true;
-
-    // Reject types we know AVFoundation does not support that sites commonly ask about.
-    if (lowerCaseType == &quot;video/webm&quot; || lowerCaseType == &quot;audio/webm&quot; || lowerCaseType == &quot;video/x-webm&quot;)
-        return true;
-
-    if (lowerCaseType == &quot;video/x-flv&quot;)
-        return true;
-
-    if (lowerCaseType == &quot;audio/ogg&quot; || lowerCaseType == &quot;video/ogg&quot; || lowerCaseType == &quot;application/ogg&quot;)
-        return true;
-
-    if (lowerCaseType == &quot;video/h264&quot;)
-        return true;
-
-    return false;
-}
-
-static const HashSet&lt;String&gt;&amp; staticMIMETypeList()
-{
-    static NeverDestroyed&lt;HashSet&lt;String&gt;&gt; cache = [] () {
-        HashSet&lt;String&gt; types;
-
-        static const char* typeNames[] = {
-            &quot;application/vnd.apple.mpegurl&quot;,
-            &quot;application/x-mpegurl&quot;,
-            &quot;audio/3gpp&quot;,
-            &quot;audio/aac&quot;,
-            &quot;audio/aacp&quot;,
-            &quot;audio/aiff&quot;,
-            &quot;audio/basic&quot;,
-            &quot;audio/mp3&quot;,
-            &quot;audio/mp4&quot;,
-            &quot;audio/mpeg&quot;,
-            &quot;audio/mpeg3&quot;,
-            &quot;audio/mpegurl&quot;,
-            &quot;audio/mpg&quot;,
-            &quot;audio/wav&quot;,
-            &quot;audio/wave&quot;,
-            &quot;audio/x-aac&quot;,
-            &quot;audio/x-aiff&quot;,
-            &quot;audio/x-m4a&quot;,
-            &quot;audio/x-mpegurl&quot;,
-            &quot;audio/x-wav&quot;,
-            &quot;video/3gpp&quot;,
-            &quot;video/3gpp2&quot;,
-            &quot;video/mp4&quot;,
-            &quot;video/mpeg&quot;,
-            &quot;video/mpeg2&quot;,
-            &quot;video/mpg&quot;,
-            &quot;video/quicktime&quot;,
-            &quot;video/x-m4v&quot;,
-            &quot;video/x-mpeg&quot;,
-            &quot;video/x-mpg&quot;,
-        };
-        for (size_t i = 0; i &lt; WTF_ARRAY_LENGTH(typeNames); ++i)
-            types.add(typeNames[i]);
-
-        return types;
-    }();
-
-    return cache;
-}
-
</del><span class="cx"> static const HashSet&lt;String&gt;&amp; avfMIMETypes()
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;HashSet&lt;String&gt;&gt; cache = [] () {
</span></span></pre>
</div>
</div>

</body>
</html>