Title: [147279] trunk/Source/WebCore
Revision
147279
Author
[email protected]
Date
2013-03-30 06:08:24 -0700 (Sat, 30 Mar 2013)

Log Message

[GTK] Should use GStreamer codec installation infrastructure
https://bugs.webkit.org/show_bug.cgi?id=34085

Reviewed by Martin Robinson.

Initial support for the GStreamer codec installer. The player will
handle missing-plugins messages and use the pbutils codec
installer facilities to install the missing GStreamer
plugins. Once the plugins are installed reset the pipeline state.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::mediaPlayerPrivatePluginInstallerResultFunction): This
method is used to notify the player that the missing plugins were installed.
(WebCore):
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): Ignore
errors while installing plugins and handle the missing-plugin message.
(WebCore::MediaPlayerPrivateGStreamer::handlePluginInstallerResult):
This method is invoked after the installer finished its task.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(MediaPlayerPrivateGStreamer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (147278 => 147279)


--- trunk/Source/WebCore/ChangeLog	2013-03-30 10:41:17 UTC (rev 147278)
+++ trunk/Source/WebCore/ChangeLog	2013-03-30 13:08:24 UTC (rev 147279)
@@ -1,3 +1,27 @@
+2013-03-30  Philippe Normand  <[email protected]>
+
+        [GTK] Should use GStreamer codec installation infrastructure
+        https://bugs.webkit.org/show_bug.cgi?id=34085
+
+        Reviewed by Martin Robinson.
+
+        Initial support for the GStreamer codec installer. The player will
+        handle missing-plugins messages and use the pbutils codec
+        installer facilities to install the missing GStreamer
+        plugins. Once the plugins are installed reset the pipeline state.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::mediaPlayerPrivatePluginInstallerResultFunction): This
+        method is used to notify the player that the missing plugins were installed.
+        (WebCore):
+        (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
+        (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Ignore
+        errors while installing plugins and handle the missing-plugin message.
+        (WebCore::MediaPlayerPrivateGStreamer::handlePluginInstallerResult):
+        This method is invoked after the installer finished its task.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (MediaPlayerPrivateGStreamer):
+
 2013-03-30  Praveen R Jadhav  <[email protected]>
 
         g_slist_reverse() may not be required in webKitWebAudioSrcLoop

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (147278 => 147279)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2013-03-30 10:41:17 UTC (rev 147278)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2013-03-30 13:08:24 UTC (rev 147279)
@@ -37,6 +37,7 @@
 #include "TimeRanges.h"
 #include "WebKitWebSourceGStreamer.h"
 #include <gst/gst.h>
+#include <gst/pbutils/missing-plugins.h>
 #include <limits>
 #include <wtf/gobject/GOwnPtr.h>
 #include <wtf/text/CString.h>
@@ -131,6 +132,12 @@
     return FALSE;
 }
 
+static void mediaPlayerPrivatePluginInstallerResultFunction(GstInstallPluginsReturn result, gpointer userData)
+{
+    MediaPlayerPrivateGStreamer* player = reinterpret_cast<MediaPlayerPrivateGStreamer*>(userData);
+    player->handlePluginInstallerResult(result);
+}
+
 void MediaPlayerPrivateGStreamer::setAudioStreamProperties(GObject* object)
 {
     if (g_strcmp0(G_OBJECT_TYPE_NAME(object), "GstPulseSink"))
@@ -212,6 +219,7 @@
     , m_originalPreloadWasAutoAndWasOverridden(false)
     , m_preservesPitch(false)
     , m_requestedState(GST_STATE_VOID_PENDING)
+    , m_missingPlugins(false)
 {
 }
 
@@ -686,6 +694,8 @@
     case GST_MESSAGE_ERROR:
         if (m_resetPipeline)
             break;
+        if (m_missingPlugins)
+            break;
         gst_message_parse_error(message, &err.outPtr(), &debug.outPtr());
         LOG_MEDIA_MESSAGE("Error %d: %s (url="" err->code, err->message, m_url.string().utf8().data());
 
@@ -765,6 +775,13 @@
             changePipelineState(requestedState);
         }
         break;
+    case GST_MESSAGE_ELEMENT:
+        if (gst_is_missing_plugin_message(message)) {
+            char* detail = gst_missing_plugin_message_get_installer_detail(message);
+            GstInstallPluginsReturn result = gst_install_plugins_async(&detail, 0, mediaPlayerPrivatePluginInstallerResultFunction, this);
+            m_missingPlugins = result == GST_INSTALL_PLUGINS_STARTED_OK;
+        }
+        break;
     default:
         LOG_MEDIA_MESSAGE("Unhandled GStreamer message type: %s",
                     GST_MESSAGE_TYPE_NAME(message));
@@ -773,6 +790,15 @@
     return TRUE;
 }
 
+void MediaPlayerPrivateGStreamer::handlePluginInstallerResult(GstInstallPluginsReturn result)
+{
+    m_missingPlugins = false;
+    if (result == GST_INSTALL_PLUGINS_SUCCESS) {
+        gst_element_set_state(m_playBin.get(), GST_STATE_READY);
+        gst_element_set_state(m_playBin.get(), GST_STATE_PAUSED);
+    }
+}
+
 void MediaPlayerPrivateGStreamer::processBufferingStats(GstMessage* message)
 {
     // This is the immediate buffering that needs to happen so we have

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (147278 => 147279)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2013-03-30 10:41:17 UTC (rev 147278)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2013-03-30 13:08:24 UTC (rev 147279)
@@ -30,6 +30,7 @@
 
 #include <glib.h>
 #include <gst/gst.h>
+#include <gst/pbutils/install-plugins.h>
 #include <wtf/Forward.h>
 
 typedef struct _GstBuffer GstBuffer;
@@ -43,6 +44,7 @@
     ~MediaPlayerPrivateGStreamer();
     static void registerMediaEngine(MediaEngineRegistrar);
     gboolean handleMessage(GstMessage*);
+    void handlePluginInstallerResult(GstInstallPluginsReturn);
 
     bool hasVideo() const { return m_hasVideo; }
     bool hasAudio() const { return m_hasAudio; }
@@ -162,6 +164,7 @@
     bool m_preservesPitch;
     GstState m_requestedState;
     GRefPtr<GstElement> m_autoAudioSink;
+    bool m_missingPlugins;
 };
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to