[Xfce4-commits] <midori:master> Video format availability in about:version

Christian Dywan noreply at xfce.org
Mon Apr 18 01:38:01 CEST 2011


Updating branch refs/heads/master
         to feb69e8fd9e8e9a7140d1cff1e53a2221f42763b (commit)
       from 3bd4c04ac93bcfdcee19760492302f67786b1c60 (commit)

commit feb69e8fd9e8e9a7140d1cff1e53a2221f42763b
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Apr 18 01:28:38 2011 +0200

    Video format availability in about:version

 midori/midori-view.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/midori/midori-view.c b/midori/midori-view.c
index 8e6a350..14cd571 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3878,10 +3878,32 @@ static gchar* list_netscape_plugins ()
             g_string_append (ns_plugins, "<tr><td>No plugins found</td></tr>");
         g_strfreev (items);
         g_free (value);
+    gtk_widget_destroy (web_view);
     return g_string_free (ns_plugins, FALSE);
 }
 
 static gchar*
+list_video_formats ()
+{
+    GtkWidget* web_view = webkit_web_view_new ();
+    WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
+    JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
+    gchar* value = sokoke_js_script_eval (js_context,
+        "var supported = function (format) { "
+        "var video = document.createElement('video');"
+        "return !!video.canPlayType && video.canPlayType (format) != 'no' };"
+        "'<tr><td>H264</td><td>' + "
+        "supported('video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"') + '</tr>' + "
+        "'<tr><td>Ogg Theora</td><td>' + "
+        "supported('video/ogg; codecs=\"theora, vorbis\"') + '</tr>' + "
+        "'<tr><td>WebM</td><td>' + "
+        "supported('video/webm; codecs=\"vp8, vorbis\"') + '</tr>'"
+        "", NULL);
+    gtk_widget_destroy (web_view);
+    return value;
+}
+
+static gchar*
 prepare_speed_dial_html (MidoriView* view)
 {
     MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (view));
@@ -4147,6 +4169,7 @@ midori_view_set_uri (MidoriView*  view,
                 gchar* command_line = g_strjoinv (" ", argument_vector);
                 gchar* ident = katze_object_get_string (view->settings, "user-agent");
                 gchar* netscape_plugins = list_netscape_plugins ();
+                gchar* video_formats = list_video_formats ();
                 #if defined (G_OS_WIN32)
                 gchar* sys_name = g_strdup ("Windows");
                 #else
@@ -4196,6 +4219,7 @@ midori_view_set_uri (MidoriView*  view,
                     "<tr><td>Identification</td><td>%s</td></tr>"
                     "</table>"
                     "<h2>Netscape Plugins:</h2><table>%s</table>"
+                    "<h2>Video Formats:</h2><table>%s</table>"
                     "</body></html>",
                     _("Version numbers in brackets show the version used at runtime."),
                     command_line,
@@ -4216,11 +4240,13 @@ midori_view_set_uri (MidoriView*  view,
                     HAVE_UNIQUE ? "Yes" : "No",
                     HAVE_HILDON ? "Yes" : "No",
                     sys_name, ident,
-                    netscape_plugins);
+                    netscape_plugins,
+                    video_formats);
                 g_free (command_line);
                 g_free (ident);
                 g_free (sys_name);
                 g_free (netscape_plugins);
+                g_free (video_formats);
            }
             else
             {



More information about the Xfce4-commits mailing list