WebCore
authorkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Dec 2009 01:50:28 +0000 (01:50 +0000)
committerkov@webkit.org <kov@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Dec 2009 01:50:28 +0000 (01:50 +0000)
2009-12-03  Philippe Normand  <pnormand@igalia.com>

        Reviewed by Gustavo Noronha.

        Advertize audio/ogg correctly and refactored mime-type cache
        building.

        [GTK] Recognize oga as audio/ogg
        https://bugs.webkit.org/show_bug.cgi?id=31990

        Test: media/media-can-play-ogg.html

        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
        (WebCore::mimeTypeCache):

LayoutTests

2009-12-05  Philippe Normand  <pnormand@igalia.com>

        Reviewed by Gustavo Noronha.

        New test for video.canPlayType and ogg containers.

        [GTK] Recognize oga as audio/ogg
        https://bugs.webkit.org/show_bug.cgi?id=31990

        * media/media-can-play-ogg-expected.txt: Added.
        * media/media-can-play-ogg.html: Added.
        * platform/mac-leopard/Skipped:
        * platform/mac-snowleopard/Skipped:
        * platform/mac-tiger/Skipped:
        * platform/mac/Skipped:
        * platform/qt-mac/Skipped:
        * platform/qt-win/Skipped:
        * platform/qt/Skipped:
        * platform/win/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@51734 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac-leopard/Skipped
LayoutTests/platform/mac-snowleopard/Skipped
LayoutTests/platform/mac-tiger/Skipped
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt-mac/Skipped
LayoutTests/platform/qt-win/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
WebCore/ChangeLog
WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp

index 9ac57fb33487032cfc1f2ee8d26455cf9742aa8d..8fb56dfb9264aa53b5f162a8b8a20b2aa8532200 100644 (file)
@@ -1,3 +1,23 @@
+2009-12-05  Philippe Normand  <pnormand@igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        New test for video.canPlayType and ogg containers.
+
+        [GTK] Recognize oga as audio/ogg
+        https://bugs.webkit.org/show_bug.cgi?id=31990
+
+        * media/media-can-play-ogg-expected.txt: Added.
+        * media/media-can-play-ogg.html: Added.
+        * platform/mac-leopard/Skipped:
+        * platform/mac-snowleopard/Skipped:
+        * platform/mac-tiger/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt-mac/Skipped:
+        * platform/qt-win/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+
 2009-12-05  Dan Bernstein  <mitz@apple.com>
 
         Rubber-stamped by Mark Rowe.
index 05bf9d37183ddfba6ce15a917808457ea3fe8b7d..c5877aa18b8b4413525b398591c6a2a4ce743bf2 100644 (file)
@@ -27,3 +27,6 @@ media/media-fullscreen-not-in-document.html
 
 # Tests of accessibility functionality not supported on Leopard
 accessibility/aria-list-and-listitem.html
+
+# This test requires ogg codecs
+media/media-can-play-ogg.html
index 06ddf1fcf5345efb8f204a678c24ee02ddc5bd7c..9ba2b405d8316256407a19da039607fa45f8e84a 100644 (file)
@@ -49,3 +49,5 @@ svg/css/glyph-orientation-rounding-test.xhtml
 # thrown
 plugins/netscape-invoke-failure.html
 
+# This test requires ogg codecs
+media/media-can-play-ogg.html
index 1dd7a88d16eb65eb3726ce42577e79fef1fdac2f..51ffb13216315a16a30017f1ef0e63a2060dad0c 100644 (file)
@@ -77,3 +77,6 @@ inspector/console-dirxml.html
 inspector/console-format-collections.html
 inspector/console-format.html
 inspector/console-tests.html
+
+# This test requires ogg codecs
+media/media-can-play-ogg.html
index a362e949bb6ad41d0026a73eda4bfaad5ea9f39a..5ca9c6bd566ad2f29be187c6b17f4de92e07f475 100644 (file)
@@ -108,3 +108,7 @@ plugins/reloadplugins-no-pages.html
 
 # These test require Qt Widgets
 plugins/qt-qwidget-plugin.html
+
+# This test requires ogg codecs
+media/media-can-play-ogg.html
+
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4148f87688f5b5826370fccd5769d0e34cd9ca2e 100644 (file)
@@ -0,0 +1,3 @@
+
+# This test requires ogg codecs
+media/media-can-play-ogg.html
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4148f87688f5b5826370fccd5769d0e34cd9ca2e 100644 (file)
@@ -0,0 +1,3 @@
+
+# This test requires ogg codecs
+media/media-can-play-ogg.html
index 5fe287b37eea9e8980792b93efc9ebcf4fe4e3e5..02b21467653c842319ebb09e8946a6e33bd49e3b 100644 (file)
@@ -5164,3 +5164,6 @@ http/tests/security/dataURL/xss-DENIED-from-data-url-in-foreign-domain-window-op
 http/tests/security/dataURL/xss-DENIED-from-javascript-url-window-open.html
 http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-window-open.html
 http/tests/security/javascriptURL/xss-DENIED-from-javascript-url-in-foreign-domain-window-open.html
+
+# This test requires ogg codecs
+media/media-can-play-ogg.html
index f255c38bf43d52bad1fac4bf69e231affa64fce5..c5de75494671c987f0ae96399e0fa4bdd08ba085 100644 (file)
@@ -723,3 +723,6 @@ inspector/timeline-network-resource.html
 
 # https://bugs.webkit.org/show_bug.cgi?id=32038 - Flaky on Windows
 http/tests/cache/subresource-failover-to-network.html
+
+# This test requires ogg codecs
+media/media-can-play-ogg.html
index 72bfcc2ad7a6288c5fa2f5c7859bc2c6401a3353..f0e98c74c1bbf4703618f7903766db1a801842f2 100644 (file)
@@ -1,3 +1,18 @@
+2009-12-03  Philippe Normand  <pnormand@igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        Advertize audio/ogg correctly and refactored mime-type cache
+        building.
+
+        [GTK] Recognize oga as audio/ogg
+        https://bugs.webkit.org/show_bug.cgi?id=31990
+
+        Test: media/media-can-play-ogg.html
+
+        * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::mimeTypeCache):
+
 2009-12-05  Alexey Proskuryakov  <ap@apple.com>
 
         Reviewed by Eric Seidel.
index 92de392a5b27603545f9d534c5c06b8ecc5ba4d8..d30c942d93040d4d78c675a91d223174e9d74d72 100644 (file)
@@ -777,56 +777,78 @@ static HashSet<String> mimeTypeCache()
             GstTypeFindFactory* factory = GST_TYPE_FIND_FACTORY(iterator->data);
             GstCaps* caps = gst_type_find_factory_get_caps(factory);
 
-            // Splitting the capability by comma and taking the first part
-            // as capability can be something like "audio/x-wavpack, framed=(boolean)false"
-            GOwnPtr<gchar> capabilityString(gst_caps_to_string(caps));
-            gchar** capability = g_strsplit(capabilityString.get(), ",", 2);
-            gchar** mimetype = g_strsplit(capability[0], "/", 2);
-
-            // GStreamer plugins can be capable of supporting types which WebKit supports
-            // by default. In that case, we should not consider these types supportable by GStreamer.
-            // Examples of what GStreamer can support but should not be added:
-            // text/plain, text/html, image/jpeg, application/xml
-            if (g_str_equal(mimetype[0], "audio")
-                || g_str_equal(mimetype[0], "video")
-                || (g_str_equal(mimetype[0], "application")
-                    && !ignoredApplicationSubtypes.contains(String(mimetype[1])))) {
-                cache.add(String(capability[0]));
-
-                // These formats are supported by GStreamer, but not correctly advertised
-                if (g_str_equal(capability[0], "video/x-h264")
-                    || g_str_equal(capability[0], "audio/x-m4a")) {
+            if (!caps)
+                continue;
+
+            for (guint structureIndex = 0; structureIndex < gst_caps_get_size(caps); structureIndex++) {
+                GstStructure* structure = gst_caps_get_structure(caps, structureIndex);
+                const gchar* name = gst_structure_get_name(structure);
+                bool cached = false;
+
+                // These formats are supported by GStreamer, but not
+                // correctly advertised.
+                if (g_str_equal(name, "video/x-h264")
+                    || g_str_equal(name, "audio/x-m4a")) {
                     cache.add(String("video/mp4"));
                     cache.add(String("audio/aac"));
+                    cached = true;
                 }
 
-                if (g_str_equal(capability[0], "video/x-theora"))
+                if (g_str_equal(name, "video/x-theora")) {
                     cache.add(String("video/ogg"));
+                    cached = true;
+                }
 
-                if (g_str_equal(capability[0], "audio/x-wav"))
-                    cache.add(String("audio/wav"));
+                if (g_str_equal(name, "audio/x-vorbis")) {
+                    cache.add(String("audio/ogg"));
+                    cached = true;
+                }
 
-                if (g_str_equal(capability[0], "audio/mpeg")) {
-                    // This is what we are handling: mpegversion=(int)1, layer=(int)[ 1, 3 ]
-                    gchar** versionAndLayer = g_strsplit(capability[1], ",", 2);
+                if (g_str_equal(name, "audio/x-wav")) {
+                    cache.add(String("audio/wav"));
+                    cached = true;
+                }
 
-                    if (g_str_has_suffix(versionAndLayer[0], "(int)1")) {
-                        for (int i = 0; versionAndLayer[1][i] != '\0'; i++) {
-                            if (versionAndLayer[1][i] == '1')
+                if (g_str_equal(name, "audio/mpeg")) {
+                    cache.add(String(name));
+                    cached = true;
+
+                    // This is what we are handling:
+                    // mpegversion=(int)1, layer=(int)[ 1, 3 ]
+                    gint mpegVersion = 0;
+                    if (gst_structure_get_int(structure, "mpegversion", &mpegVersion) && (mpegVersion == 1)) {
+                        const GValue* layer = gst_structure_get_value(structure, "layer");
+                        if (G_VALUE_TYPE(layer) == GST_TYPE_INT_RANGE) {
+                            gint minLayer = gst_value_get_int_range_min(layer);
+                            gint maxLayer = gst_value_get_int_range_max(layer);
+                            if (minLayer <= 1 <= maxLayer)
                                 cache.add(String("audio/mp1"));
-                            else if (versionAndLayer[1][i] == '2')
+                            if (minLayer <= 2 <= maxLayer)
                                 cache.add(String("audio/mp2"));
-                            else if (versionAndLayer[1][i] == '3')
+                            if (minLayer <= 3 <= maxLayer)
                                 cache.add(String("audio/mp3"));
                         }
                     }
+                }
 
-                    g_strfreev(versionAndLayer);
+                if (!cached) {
+                    // GStreamer plugins can be capable of supporting
+                    // types which WebKit supports by default. In that
+                    // case, we should not consider these types
+                    // supportable by GStreamer.  Examples of what
+                    // GStreamer can support but should not be added:
+                    // text/plain, text/html, image/jpeg,
+                    // application/xml
+                    gchar** mimetype = g_strsplit(name, "/", 2);
+                    if (g_str_equal(mimetype[0], "audio")
+                        || g_str_equal(mimetype[0], "video")
+                        || (g_str_equal(mimetype[0], "application")
+                            && !ignoredApplicationSubtypes.contains(String(mimetype[1]))))
+                        cache.add(String(name));
+
+                    g_strfreev(mimetype);
                 }
             }
-
-            g_strfreev(capability);
-            g_strfreev(mimetype);
         }
 
         gst_plugin_feature_list_free(factories);