[GStreamer] USE(NATIVE_FULLSCREEN_VIDEO) support
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 14:55:50 +0000 (14:55 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Jan 2013 14:55:50 +0000 (14:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106760

Reviewed by Gustavo Noronha Silva.

Source/WebCore:

Initial support for NATIVE_FULLSCREEN_VIDEO in the GStreamer media
player. A new FullscreenVideoControllerGStreamer class is
introduced, ports interested to implement native fullscreen video
support should inherit from it (see FullscreenVideoControllerGtk)
and hook it in the MediaPlayerPrivateGStreamer backend.

The GStreamerGWorld port to GStreamer 1.x is partly based on a
patch by Sebastian Dröge <sebastian.droge@collabora.com>.

* GNUmakefile.am: Enable NATIVE_FULLSCREEN_VIDEO support.
* GNUmakefile.list.am: New
FullscreenVideoController{GStreamer,Gtk} modules.
* platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp: Added.
(WebCore):
(WebCore::playerVolumeChangedCallback): Playbin notify::volume
signal callback.
(WebCore::playerMuteChangedCallback): Playbin notify::mute signal callback.
(WebCore::FullscreenVideoControllerGStreamer::FullscreenVideoControllerGStreamer):
(WebCore::FullscreenVideoControllerGStreamer::~FullscreenVideoControllerGStreamer):
(WebCore::FullscreenVideoControllerGStreamer::enterFullscreen):
Switch GStreamerGWorld to full screen, hook in to playbin's
notify::volume and mute signals and initialize the full screen window.
(WebCore::FullscreenVideoControllerGStreamer::exitFullscreen):
Destroy the full screen window, disconnect from playbin signals
and switch GStreamerGWorld out of full screen.
(WebCore::FullscreenVideoControllerGStreamer::exitOnUserRequest):
Trigger exit from full screen mode. This method is meant to be
called when the user explicitely requests to exit from full screen
by pressing a key or something similar.
(WebCore::FullscreenVideoControllerGStreamer::togglePlay): Switch
between play and pause states. Useful for child classes.
(WebCore::FullscreenVideoControllerGStreamer::increaseVolume):
Useful for child classes as well.
(WebCore::FullscreenVideoControllerGStreamer::decreaseVolume): Ditto.
(WebCore::FullscreenVideoControllerGStreamer::setVolume): Ditto.
(WebCore::FullscreenVideoControllerGStreamer::timeToString): Ditto.
* platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.h: Added.
(WebCore):
(FullscreenVideoControllerGStreamer):
(WebCore::FullscreenVideoControllerGStreamer::playStateChanged):
To be implemented by child class to reflect the player's state changed.
(WebCore::FullscreenVideoControllerGStreamer::volumeChanged): To
be implemented by child class as well.
(WebCore::FullscreenVideoControllerGStreamer::muteChanged): Ditto.
(WebCore::FullscreenVideoControllerGStreamer::initializeWindow): Ditto.
(WebCore::FullscreenVideoControllerGStreamer::destroyWindow): Ditto.
* platform/graphics/gstreamer/GStreamerGWorld.cpp:
(WebCore::gstGWorldSyncMessageCallback): Adapt for GStreamer video
overlay API changes.
(WebCore::GStreamerGWorld::GStreamerGWorld):
gst_bus_set_sync_handler takes one more argument in GStreamer 1.x.
(WebCore::GStreamerGWorld::enterFullscreen): ffmpegcolorspace was
renamed to videoconvert in GStreamer 1.x and the tee src pad
template was renamed to src_%u. There is no need to send a new
segment query either.
(WebCore):
(WebCore::gstGWorldPadProbeCallback): Remove the platform video
sink branch once the tee source pad starting it has been blocked.
(WebCore::GStreamerGWorld::exitFullscreen): Refactor to use an
asynchronous pad probe.
(WebCore::GStreamerGWorld::removePlatformVideoSink): Refactored
from exitFullscreen.
(WebCore::GStreamerGWorld::setWindowOverlay): Adapt for GStreamer video
overlay API changes.
* platform/graphics/gstreamer/GStreamerGWorld.h:
(GStreamerGWorld):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
Hook NATIVE_FULLSCREEN_VIDEO support.
(WebCore::MediaPlayerPrivateGStreamer::volume): Playbin volume
query used by the FullscreenVideoController.
(WebCore):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore):
(MediaPlayerPrivateGStreamer): volume(), muted() and MediaPlayer
accessor methods added. NATIVE_FULLSCREEN_VIDEO methods added as well.
(WebCore::MediaPlayerPrivateGStreamer::canEnterFullscreen):
(WebCore::MediaPlayerPrivateGStreamer::mediaPlayer):
* platform/graphics/gstreamer/PlatformVideoWindow.h: Re-enable
module if NATIVE_FULLSCREEN_VIDEO is turned on.
* platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp: Ditto.
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp: Re-enable
GStreamerGWorld support.
(_WebKitVideoSinkPrivate):
(webkitVideoSinkRender):
* platform/graphics/gstreamer/VideoSinkGStreamer.h: Ditto.

Source/WebKit/qt:

Build fixes for GStreamer NATIVE_FULLSCREEN_VIDEO support. Some
more changes will be needed to use the new
FullscreenVideoController though.

* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::ChromeClientQt):
(WebCore::ChromeClientQt::~ChromeClientQt):
* WebCoreSupport/FullScreenVideoQt.cpp:
(WebCore):
(WebCore::FullScreenVideoQt::FullScreenVideoQt):
(WebCore::FullScreenVideoQt::~FullScreenVideoQt):
(WebCore::FullScreenVideoQt::enterFullScreenForNode):
(WebCore::FullScreenVideoQt::exitFullScreenForNode):
(WebCore::FullScreenVideoQt::isValid):
* WebCoreSupport/FullScreenVideoQt.h:
(WebCore):
(FullScreenVideoQt):

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

20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/GNUmakefile.list.am
Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.h [new file with mode: 0644]
Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp
Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindow.h
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowPrivate.h
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp
Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp
Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h

index e0db9cd..ca4e843 100644 (file)
@@ -1,3 +1,97 @@
+2013-01-20  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] USE(NATIVE_FULLSCREEN_VIDEO) support
+        https://bugs.webkit.org/show_bug.cgi?id=106760
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Initial support for NATIVE_FULLSCREEN_VIDEO in the GStreamer media
+        player. A new FullscreenVideoControllerGStreamer class is
+        introduced, ports interested to implement native fullscreen video
+        support should inherit from it (see FullscreenVideoControllerGtk)
+        and hook it in the MediaPlayerPrivateGStreamer backend.
+
+        The GStreamerGWorld port to GStreamer 1.x is partly based on a
+        patch by Sebastian Dröge <sebastian.droge@collabora.com>.
+
+        * GNUmakefile.am: Enable NATIVE_FULLSCREEN_VIDEO support.
+        * GNUmakefile.list.am: New
+        FullscreenVideoController{GStreamer,Gtk} modules.
+        * platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp: Added.
+        (WebCore):
+        (WebCore::playerVolumeChangedCallback): Playbin notify::volume
+        signal callback.
+        (WebCore::playerMuteChangedCallback): Playbin notify::mute signal callback.
+        (WebCore::FullscreenVideoControllerGStreamer::FullscreenVideoControllerGStreamer):
+        (WebCore::FullscreenVideoControllerGStreamer::~FullscreenVideoControllerGStreamer):
+        (WebCore::FullscreenVideoControllerGStreamer::enterFullscreen):
+        Switch GStreamerGWorld to full screen, hook in to playbin's
+        notify::volume and mute signals and initialize the full screen window.
+        (WebCore::FullscreenVideoControllerGStreamer::exitFullscreen):
+        Destroy the full screen window, disconnect from playbin signals
+        and switch GStreamerGWorld out of full screen.
+        (WebCore::FullscreenVideoControllerGStreamer::exitOnUserRequest):
+        Trigger exit from full screen mode. This method is meant to be
+        called when the user explicitely requests to exit from full screen
+        by pressing a key or something similar.
+        (WebCore::FullscreenVideoControllerGStreamer::togglePlay): Switch
+        between play and pause states. Useful for child classes.
+        (WebCore::FullscreenVideoControllerGStreamer::increaseVolume):
+        Useful for child classes as well.
+        (WebCore::FullscreenVideoControllerGStreamer::decreaseVolume): Ditto.
+        (WebCore::FullscreenVideoControllerGStreamer::setVolume): Ditto.
+        (WebCore::FullscreenVideoControllerGStreamer::timeToString): Ditto.
+        * platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.h: Added.
+        (WebCore):
+        (FullscreenVideoControllerGStreamer):
+        (WebCore::FullscreenVideoControllerGStreamer::playStateChanged):
+        To be implemented by child class to reflect the player's state changed.
+        (WebCore::FullscreenVideoControllerGStreamer::volumeChanged): To
+        be implemented by child class as well.
+        (WebCore::FullscreenVideoControllerGStreamer::muteChanged): Ditto.
+        (WebCore::FullscreenVideoControllerGStreamer::initializeWindow): Ditto.
+        (WebCore::FullscreenVideoControllerGStreamer::destroyWindow): Ditto.
+        * platform/graphics/gstreamer/GStreamerGWorld.cpp:
+        (WebCore::gstGWorldSyncMessageCallback): Adapt for GStreamer video
+        overlay API changes.
+        (WebCore::GStreamerGWorld::GStreamerGWorld):
+        gst_bus_set_sync_handler takes one more argument in GStreamer 1.x.
+        (WebCore::GStreamerGWorld::enterFullscreen): ffmpegcolorspace was
+        renamed to videoconvert in GStreamer 1.x and the tee src pad
+        template was renamed to src_%u. There is no need to send a new
+        segment query either.
+        (WebCore):
+        (WebCore::gstGWorldPadProbeCallback): Remove the platform video
+        sink branch once the tee source pad starting it has been blocked.
+        (WebCore::GStreamerGWorld::exitFullscreen): Refactor to use an
+        asynchronous pad probe.
+        (WebCore::GStreamerGWorld::removePlatformVideoSink): Refactored
+        from exitFullscreen.
+        (WebCore::GStreamerGWorld::setWindowOverlay): Adapt for GStreamer video
+        overlay API changes.
+        * platform/graphics/gstreamer/GStreamerGWorld.h:
+        (GStreamerGWorld):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
+        Hook NATIVE_FULLSCREEN_VIDEO support.
+        (WebCore::MediaPlayerPrivateGStreamer::volume): Playbin volume
+        query used by the FullscreenVideoController.
+        (WebCore):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (WebCore):
+        (MediaPlayerPrivateGStreamer): volume(), muted() and MediaPlayer
+        accessor methods added. NATIVE_FULLSCREEN_VIDEO methods added as well.
+        (WebCore::MediaPlayerPrivateGStreamer::canEnterFullscreen):
+        (WebCore::MediaPlayerPrivateGStreamer::mediaPlayer):
+        * platform/graphics/gstreamer/PlatformVideoWindow.h: Re-enable
+        module if NATIVE_FULLSCREEN_VIDEO is turned on.
+        * platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp: Ditto.
+        * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: Re-enable
+        GStreamerGWorld support.
+        (_WebKitVideoSinkPrivate):
+        (webkitVideoSinkRender):
+        * platform/graphics/gstreamer/VideoSinkGStreamer.h: Ditto.
+
 2013-01-30  Pavel Feldman  <pfeldman@chromium.org>
 
         Web Inspector: beautify file selector dialog to render as two rows
index 0a4ac25..faefbfe 100644 (file)
@@ -161,6 +161,7 @@ if USE_GSTREAMER
 if ENABLE_DEBUG
 webcore_cppflags += -DGST_DISABLE_DEPRECATED
 endif # END ENABLE_DEBUG
+webcore_cppflags += -DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1
 endif # END USE_GSTREAMER
 else
 feature_defines_overrides += ENABLE_VIDEO=0 ENABLE_VIDEO_TRACK=0
index 0fba6cd..996379f 100644 (file)
@@ -6065,6 +6065,8 @@ webcoregtk_sources += \
        Source/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h \
        Source/WebCore/platform/graphics/freetype/FontPlatformData.h \
        Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp \
+       Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp \
+       Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.h \
        Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp \
        Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h \
        Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp \
diff --git a/Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp
new file mode 100644 (file)
index 0000000..53faf78
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ *  Copyright (C) 2013 Igalia S.L
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
+
+#include "FullscreenVideoControllerGStreamer.h"
+
+#include "GStreamerGWorld.h"
+#include "MediaPlayer.h"
+#include "MediaPlayerPrivateGStreamer.h"
+#include <gst/gst.h>
+#include <wtf/text/CString.h>
+
+#define VOLUME_UP_OFFSET 0.05 // 5%
+#define VOLUME_DOWN_OFFSET 0.05 // 5%
+
+namespace WebCore {
+
+void playerVolumeChangedCallback(GObject *element, GParamSpec *pspec, FullscreenVideoControllerGStreamer* controller)
+{
+    controller->volumeChanged();
+}
+
+void playerMuteChangedCallback(GObject *element, GParamSpec *pspec, FullscreenVideoControllerGStreamer* controller)
+{
+    controller->muteChanged();
+}
+
+
+FullscreenVideoControllerGStreamer::FullscreenVideoControllerGStreamer(MediaPlayerPrivateGStreamer* player)
+    : m_player(player)
+    , m_client(player->mediaPlayer()->mediaPlayerClient())
+    , m_gstreamerGWorld(player->platformMedia().media.gstreamerGWorld)
+    , m_playerVolumeSignalHandler(0)
+    , m_playerMuteSignalHandler(0)
+{
+}
+
+FullscreenVideoControllerGStreamer::~FullscreenVideoControllerGStreamer()
+{
+    exitFullscreen();
+}
+
+void FullscreenVideoControllerGStreamer::enterFullscreen()
+{
+    if (!m_gstreamerGWorld)
+        return;
+
+    if (!m_gstreamerGWorld->enterFullscreen())
+        return;
+
+    GstElement* pipeline = m_gstreamerGWorld->pipeline();
+    m_playerVolumeSignalHandler = g_signal_connect(pipeline, "notify::volume", G_CALLBACK(playerVolumeChangedCallback), this);
+    m_playerMuteSignalHandler = g_signal_connect(pipeline, "notify::mute", G_CALLBACK(playerMuteChangedCallback), this);
+
+    initializeWindow();
+}
+
+void FullscreenVideoControllerGStreamer::exitFullscreen()
+{
+    destroyWindow();
+
+    GstElement* pipeline = m_gstreamerGWorld->pipeline();
+    if (m_playerVolumeSignalHandler) {
+        g_signal_handler_disconnect(pipeline, m_playerVolumeSignalHandler);
+        m_playerVolumeSignalHandler = 0;
+    }
+
+    if (m_playerMuteSignalHandler) {
+        g_signal_handler_disconnect(pipeline, m_playerMuteSignalHandler);
+        m_playerMuteSignalHandler = 0;
+    }
+
+    m_gstreamerGWorld->exitFullscreen();
+}
+
+void FullscreenVideoControllerGStreamer::exitOnUserRequest()
+{
+    m_client->mediaPlayerExitFullscreen();
+}
+
+void FullscreenVideoControllerGStreamer::togglePlay()
+{
+    if (m_client->mediaPlayerIsPaused())
+        m_client->mediaPlayerPlay();
+    else
+        m_client->mediaPlayerPause();
+    playStateChanged();
+}
+
+void FullscreenVideoControllerGStreamer::increaseVolume()
+{
+    setVolume(m_player->volume() + VOLUME_UP_OFFSET);
+}
+
+void FullscreenVideoControllerGStreamer::decreaseVolume()
+{
+    setVolume(m_player->volume() - VOLUME_DOWN_OFFSET);
+}
+
+void FullscreenVideoControllerGStreamer::setVolume(float volume)
+{
+    volume = CLAMP(volume, 0.0, 1.0);
+    m_player->setVolume(volume);
+}
+
+String FullscreenVideoControllerGStreamer::timeToString(float time)
+{
+    if (!isfinite(time))
+        time = 0;
+    int seconds = fabsf(time);
+    int hours = seconds / (60 * 60);
+    int minutes = (seconds / 60) % 60;
+    seconds %= 60;
+
+    if (hours) {
+        if (hours > 9)
+            return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
+        return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds);
+    }
+
+    return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds);
+}
+
+} // namespace WebCore
+#endif
diff --git a/Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.h
new file mode 100644 (file)
index 0000000..d1c1c76
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ *  Copyright (C) 2013 Igalia S.L
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef FullscreenVideoControllerGStreamer_h
+#define FullscreenVideoControllerGStreamer_h
+
+#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
+
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebCore {
+
+class GStreamerGWorld;
+class MediaPlayerPrivateGStreamer;
+class MediaPlayerClient;
+
+class FullscreenVideoControllerGStreamer {
+    WTF_MAKE_NONCOPYABLE(FullscreenVideoControllerGStreamer);
+public:
+    FullscreenVideoControllerGStreamer(MediaPlayerPrivateGStreamer*);
+    virtual ~FullscreenVideoControllerGStreamer();
+
+    void enterFullscreen();
+    void exitFullscreen();
+    void exitOnUserRequest();
+
+    void togglePlay();
+    virtual void playStateChanged() { }
+
+    void increaseVolume();
+    void decreaseVolume();
+    void setVolume(float);
+
+    virtual void volumeChanged() { }
+    virtual void muteChanged() { }
+
+protected:
+    String timeToString(float time);
+
+    MediaPlayerPrivateGStreamer* m_player;
+    MediaPlayerClient* m_client;
+    GStreamerGWorld* m_gstreamerGWorld;
+
+private:
+    virtual void initializeWindow() { }
+    virtual void destroyWindow() { }
+
+    unsigned long m_playerVolumeSignalHandler;
+    unsigned long m_playerMuteSignalHandler;
+};
+
+}
+#endif
+
+#endif // FullscreenVideoControllerGStreamer_h
index e6b908e..b1dbb4b 100644 (file)
  */
 
 #include "config.h"
+
 #include "GStreamerGWorld.h"
-#if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+
+#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 
 #include "GRefPtrGStreamer.h"
 #include "GStreamerVersioning.h"
 #include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
 #include <gst/pbutils/pbutils.h>
 
+#ifdef GST_API_VERSION_1
+#include <gst/video/videooverlay.h>
+#else
+#include <gst/interfaces/xoverlay.h>
+#endif
+
+
 #if PLATFORM(GTK)
 #include <gtk/gtk.h>
 #ifdef GDK_WINDOWING_X11
 #endif
 #endif
 
+#ifndef GST_API_VERSION_1
+static const char* gVideoConvertName = "ffmpegcolorspace";
+#else
+static const char* gVideoConvertName = "videoconvert";
+#endif
+
 using namespace std;
 
 namespace WebCore {
@@ -43,11 +57,16 @@ gboolean gstGWorldSyncMessageCallback(GstBus*, GstMessage* message, gpointer dat
     ASSERT(GST_MESSAGE_TYPE(message) == GST_MESSAGE_ELEMENT);
 
     GStreamerGWorld* gstGWorld = static_cast<GStreamerGWorld*>(data);
+#ifndef GST_API_VERSION_1
     const GstStructure* structure = gst_message_get_structure(message);
 
     if (gst_structure_has_name(structure, "prepare-xwindow-id")
         || gst_structure_has_name(structure, "have-ns-view"))
         gstGWorld->setWindowOverlay(message);
+#else
+    if (gst_is_video_overlay_prepare_window_handle_message(message))
+        gstGWorld->setWindowOverlay(message);
+#endif
     return TRUE;
 }
 
@@ -61,7 +80,11 @@ GStreamerGWorld::GStreamerGWorld(GstElement* pipeline)
 {
     // XOverlay messages need to be handled synchronously.
     GRefPtr<GstBus> bus = webkitGstPipelineGetBus(GST_PIPELINE(m_pipeline));
+#ifndef GST_API_VERSION_1
     gst_bus_set_sync_handler(bus.get(), gst_bus_sync_signal_handler, this);
+#else
+    gst_bus_set_sync_handler(bus.get(), gst_bus_sync_signal_handler, this, 0);
+#endif
     g_signal_connect(bus.get(), "sync-message::element", G_CALLBACK(gstGWorldSyncMessageCallback), this);
 }
 
@@ -81,7 +104,7 @@ bool GStreamerGWorld::enterFullscreen()
         m_videoWindow = PlatformVideoWindow::createWindow();
 
     GstElement* platformVideoSink = gst_element_factory_make("autovideosink", "platformVideoSink");
-    GstElement* colorspace = gst_element_factory_make("ffmpegcolorspace", "colorspace");
+    GstElement* colorspace = gst_element_factory_make(gVideoConvertName, "colorspace");
     GstElement* queue = gst_element_factory_make("queue", "queue");
     GstElement* videoScale = gst_element_factory_make("videoscale", "videoScale");
 
@@ -94,7 +117,6 @@ bool GStreamerGWorld::enterFullscreen()
 
     GRefPtr<GstElement> tee = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoTee"));
 
-    // Add and link a queue, ffmpegcolorspace, videoscale and sink in the bin.
     gst_bin_add_many(GST_BIN(videoSink.get()), platformVideoSink, videoScale, colorspace, queue, NULL);
 
     // Faster elements linking.
@@ -103,7 +125,11 @@ bool GStreamerGWorld::enterFullscreen()
     gst_element_link_pads_full(videoScale, "src", platformVideoSink, "sink", GST_PAD_LINK_CHECK_NOTHING);
 
     // Link a new src pad from tee to queue.
+#ifndef GST_API_VERSION_1
     GRefPtr<GstPad> srcPad = adoptGRef(gst_element_get_request_pad(tee.get(), "src%d"));
+#else
+    GRefPtr<GstPad> srcPad = adoptGRef(gst_element_get_request_pad(tee.get(), "src_%u"));
+#endif
     GRefPtr<GstPad> sinkPad = adoptGRef(gst_element_get_static_pad(queue, "sink"));
     gst_pad_link(srcPad.get(), sinkPad.get());
 
@@ -121,9 +147,9 @@ bool GStreamerGWorld::enterFullscreen()
     gst_element_set_state(colorspace, state);
     gst_element_set_state(queue, state);
 
+#ifndef GST_API_VERSION_1
     // Query the current media segment informations and send them towards
     // the new tee branch downstream.
-
     GstQuery* query = gst_query_new_segment(GST_FORMAT_TIME);
     gboolean queryResult = gst_element_query(m_pipeline, query);
 
@@ -132,8 +158,8 @@ bool GStreamerGWorld::enterFullscreen()
         return true;
     }
 
-    GstFormat format;
     gint64 position;
+    GstFormat format;
     if (!gst_element_query_position(m_pipeline, &format, &position))
         position = 0;
 
@@ -145,20 +171,55 @@ bool GStreamerGWorld::enterFullscreen()
     gst_pad_push_event(srcPad.get(), event);
 
     gst_query_unref(query);
+#endif
     return true;
 }
 
+#ifdef GST_API_VERSION_1
+static GstPadProbeReturn gstGWorldPadProbeCallback(GstPad* pad, GstPadProbeInfo* info, GStreamerGWorld* gstGWorld)
+{
+    gstGWorld->removePlatformVideoSink();
+    return GST_PAD_PROBE_REMOVE;
+}
+#endif
+
 void GStreamerGWorld::exitFullscreen()
 {
     if (!m_dynamicPadName)
         return;
 
-    // Get video sink bin and the elements to remove.
-    GRefPtr<GstElement> videoSink;
     GstElement* sinkPtr = 0;
+    g_object_get(m_pipeline, "video-sink", &sinkPtr, NULL);
+    GRefPtr<GstElement> videoSink = adoptGRef(sinkPtr);
 
+    GRefPtr<GstElement> tee = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoTee"));
+    GRefPtr<GstPad> srcPad = adoptGRef(gst_element_get_static_pad(tee.get(), m_dynamicPadName.get()));
+
+    // Block data flow towards the pipeline branch to remove. No need
+    // for pad blocking if the pipeline is paused.
+    GstState state;
+    gst_element_get_state(m_pipeline, &state, 0, 0);
+#ifdef GST_API_VERSION_1
+    if (state >= GST_STATE_PLAYING)
+        gst_pad_add_probe(srcPad.get(), GST_PAD_PROBE_TYPE_IDLE, reinterpret_cast<GstPadProbeCallback>(gstGWorldPadProbeCallback), this, 0);
+    else
+#else
+    if (state < GST_STATE_PLAYING || gst_pad_set_blocked(srcPad.get(), true))
+#endif
+        removePlatformVideoSink();
+
+    m_videoWindow = 0;
+}
+
+void GStreamerGWorld::removePlatformVideoSink()
+{
+    if (!m_dynamicPadName)
+        return;
+
+    // Get video sink bin and the elements to remove.
+    GstElement* sinkPtr = 0;
     g_object_get(m_pipeline, "video-sink", &sinkPtr, NULL);
-    videoSink = adoptGRef(sinkPtr);
+    GRefPtr<GstElement> videoSink = adoptGRef(sinkPtr);
 
     GRefPtr<GstElement> tee = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoTee"));
     GRefPtr<GstElement> platformVideoSink = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "platformVideoSink"));
@@ -166,28 +227,17 @@ void GStreamerGWorld::exitFullscreen()
     GRefPtr<GstElement> colorspace = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "colorspace"));
     GRefPtr<GstElement> videoScale = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoScale"));
 
-    // Get pads to unlink and remove.
     GRefPtr<GstPad> srcPad = adoptGRef(gst_element_get_static_pad(tee.get(), m_dynamicPadName.get()));
     GRefPtr<GstPad> sinkPad = adoptGRef(gst_element_get_static_pad(queue.get(), "sink"));
+    gst_pad_unlink(srcPad.get(), sinkPad.get());
+    gst_element_release_request_pad(tee.get(), srcPad.get());
 
-    // Block data flow towards the pipeline branch to remove. No need
-    // for pad blocking if the pipeline is paused.
-    GstState state;
-    gst_element_get_state(m_pipeline, &state, 0, 0);
-    if (state < GST_STATE_PLAYING || gst_pad_set_blocked(srcPad.get(), true)) {
-
-        // Unlink and release request pad.
-        gst_pad_unlink(srcPad.get(), sinkPad.get());
-        gst_element_release_request_pad(tee.get(), srcPad.get());
-
-        // Unlink, remove and cleanup queue, ffmpegcolorspace, videoScale and sink.
-        gst_element_unlink_many(queue.get(), colorspace.get(), videoScale.get(), platformVideoSink.get(), NULL);
-        gst_bin_remove_many(GST_BIN(videoSink.get()), queue.get(), colorspace.get(), videoScale.get(), platformVideoSink.get(), NULL);
-        gst_element_set_state(platformVideoSink.get(), GST_STATE_NULL);
-        gst_element_set_state(videoScale.get(), GST_STATE_NULL);
-        gst_element_set_state(colorspace.get(), GST_STATE_NULL);
-        gst_element_set_state(queue.get(), GST_STATE_NULL);
-    }
+    gst_element_unlink_many(queue.get(), colorspace.get(), videoScale.get(), platformVideoSink.get(), NULL);
+    gst_bin_remove_many(GST_BIN(videoSink.get()), queue.get(), colorspace.get(), videoScale.get(), platformVideoSink.get(), NULL);
+    gst_element_set_state(platformVideoSink.get(), GST_STATE_NULL);
+    gst_element_set_state(videoScale.get(), GST_STATE_NULL);
+    gst_element_set_state(colorspace.get(), GST_STATE_NULL);
+    gst_element_set_state(queue.get(), GST_STATE_NULL);
 
     m_dynamicPadName.clear();
 }
@@ -196,7 +246,11 @@ void GStreamerGWorld::setWindowOverlay(GstMessage* message)
 {
     GstObject* sink = GST_MESSAGE_SRC(message);
 
+#ifndef GST_API_VERSION_1
     if (!GST_IS_X_OVERLAY(sink))
+#else
+    if (!GST_IS_VIDEO_OVERLAY(sink))
+#endif
         return;
 
     if (g_object_class_find_property(G_OBJECT_GET_CLASS(sink), "force-aspect-ratio"))
@@ -205,6 +259,7 @@ void GStreamerGWorld::setWindowOverlay(GstMessage* message)
     if (m_videoWindow) {
         m_videoWindow->prepareForOverlay(message);
 
+#ifndef GST_API_VERSION_1
 // gst_x_overlay_set_window_handle was introduced in -plugins-base
 // 0.10.31, just like the macro for checking the version.
 #ifdef GST_CHECK_PLUGINS_BASE_VERSION
@@ -212,8 +267,11 @@ void GStreamerGWorld::setWindowOverlay(GstMessage* message)
 #else
         gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(sink), m_videoWindow->videoWindowId());
 #endif
+#else
+        gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sink), m_videoWindow->videoWindowId());
+#endif
     }
 }
 
 }
-#endif // ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
index dff47b0..22806b4 100644 (file)
@@ -20,7 +20,7 @@
 
 #ifndef GStreamerGWorld_h
 #define GStreamerGWorld_h
-#if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
@@ -49,6 +49,7 @@ public:
     ~GStreamerGWorld();
 
     GstElement* pipeline() const { return m_pipeline; }
+    void removePlatformVideoSink();
 
     // Returns the full-screen window created
     bool enterFullscreen();
@@ -67,5 +68,5 @@ private:
 };
 
 }
-#endif // ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 #endif
index d63216b..df12709 100644 (file)
@@ -268,7 +268,7 @@ MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer()
         m_mediaLocations = 0;
     }
 
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
     if (m_videoSinkBin) {
         gst_object_unref(m_videoSinkBin);
         m_videoSinkBin = 0;
@@ -660,6 +660,14 @@ void MediaPlayerPrivateGStreamer::setVolume(float volume)
                                  static_cast<double>(volume));
 }
 
+float MediaPlayerPrivateGStreamer::volume() const
+{
+    if (!m_playBin)
+        return 0;
+
+    return gst_stream_volume_get_volume(GST_STREAM_VOLUME(m_playBin.get()), GST_STREAM_VOLUME_FORMAT_CUBIC);
+}
+
 void MediaPlayerPrivateGStreamer::notifyPlayerOfVolumeChange()
 {
     m_volumeTimerHandler = 0;
@@ -1542,6 +1550,16 @@ void MediaPlayerPrivateGStreamer::setMuted(bool muted)
     g_object_set(m_playBin.get(), "mute", muted, NULL);
 }
 
+bool MediaPlayerPrivateGStreamer::muted() const
+{
+    if (!m_playBin)
+        return false;
+
+    bool muted;
+    g_object_get(m_playBin.get(), "mute", &muted, NULL);
+    return muted;
+}
+
 void MediaPlayerPrivateGStreamer::notifyPlayerOfMute()
 {
     m_muteTimerHandler = 0;
@@ -1740,6 +1758,18 @@ bool MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin() const
     return true;
 }
 
+#if USE(NATIVE_FULLSCREEN_VIDEO)
+void MediaPlayerPrivateGStreamer::enterFullscreen()
+{
+    notImplemented();
+}
+
+void MediaPlayerPrivateGStreamer::exitFullscreen()
+{
+    notImplemented();
+}
+#endif
+
 bool MediaPlayerPrivateGStreamer::supportsFullscreen() const
 {
 #if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
@@ -1753,7 +1783,7 @@ bool MediaPlayerPrivateGStreamer::supportsFullscreen() const
 PlatformMedia MediaPlayerPrivateGStreamer::platformMedia() const
 {
     PlatformMedia p;
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
     p.type = PlatformMedia::GStreamerGWorldType;
     p.media.gstreamerGWorld = m_gstGWorld.get();
 #endif
@@ -1843,10 +1873,6 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
     // we should not adopt.
     m_playBin = gst_element_factory_make(gPlaybinName, "play");
 
-#ifndef GST_API_VERSION_1
-    m_gstGWorld = GStreamerGWorld::createGWorld(m_playBin.get());
-#endif
-
     GRefPtr<GstBus> bus = webkitGstPipelineGetBus(GST_PIPELINE(m_playBin.get()));
     gst_bus_add_signal_watch(bus.get());
     g_signal_connect(bus.get(), "message", G_CALLBACK(mediaPlayerPrivateMessageCallback), this);
@@ -1859,7 +1885,8 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
     g_signal_connect(m_playBin.get(), "video-changed", G_CALLBACK(mediaPlayerPrivateVideoChangedCallback), this);
     g_signal_connect(m_playBin.get(), "audio-changed", G_CALLBACK(mediaPlayerPrivateAudioChangedCallback), this);
 
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
+    m_gstGWorld = GStreamerGWorld::createGWorld(m_playBin.get());
     m_webkitVideoSink = webkitVideoSinkNew(m_gstGWorld.get());
 #else
     m_webkitVideoSink = webkitVideoSinkNew();
@@ -1869,19 +1896,24 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
     g_signal_connect(m_webkitVideoSink, "repaint-requested", G_CALLBACK(mediaPlayerPrivateRepaintCallback), this);
 
 
-#ifndef GST_API_VERSION_1
-    m_videoSinkBin = gst_bin_new("video-sink");
+#if USE(NATIVE_FULLSCREEN_VIDEO)
+    // Build a new video sink consisting of a bin containing a tee
+    // (meant to distribute data to multiple video sinks) and our
+    // internal video sink. For fullscreen we create an autovideosink
+    // and initially block the data flow towards it and configure it
 
-    GstElement* videoTee = gst_element_factory_make("tee", "videoTee");
-    GstElement* queue = gst_element_factory_make("queue", 0);
+    m_videoSinkBin = gst_bin_new("video-sink");
 
     // Take ownership.
     gst_object_ref_sink(m_videoSinkBin);
 
-    // Build a new video sink consisting of a bin containing a tee
-    // (meant to distribute data to multiple video sinks) and our
-    // internal video sink. For fullscreen we create an autovideosink
-    // and initially block the data flow towards it and configure it
+    GstElement* videoTee = gst_element_factory_make("tee", "videoTee");
+    GstElement* queue = gst_element_factory_make("queue", 0);
+
+#ifdef GST_API_VERSION_1
+    GRefPtr<GstPad> sinkPad = adoptGRef(gst_element_get_static_pad(videoTee, "sink"));
+    GST_OBJECT_FLAG_SET(GST_OBJECT(sinkPad.get()), GST_PAD_FLAG_PROXY_ALLOCATION);
+#endif
 
     gst_bin_add_many(GST_BIN(m_videoSinkBin), videoTee, queue, NULL);
 
@@ -1910,7 +1942,7 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
 
             if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_fpsSink), "video-sink")) {
                 g_object_set(m_fpsSink, "video-sink", m_webkitVideoSink, NULL);
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
                 gst_bin_add(GST_BIN(m_videoSinkBin), m_fpsSink);
 #endif
                 actualVideoSink = m_fpsSink;
@@ -1921,7 +1953,7 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
     }
 
     if (!m_fpsSink) {
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
         gst_bin_add(GST_BIN(m_videoSinkBin), m_webkitVideoSink);
 #endif
         actualVideoSink = m_webkitVideoSink;
@@ -1929,7 +1961,7 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
 
     ASSERT(actualVideoSink);
 
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
     // Faster elements linking.
     gst_element_link_pads_full(queue, "src", actualVideoSink, "sink", GST_PAD_LINK_CHECK_NOTHING);
 
index 7e5dbf8..7398e2f 100644 (file)
@@ -39,6 +39,10 @@ typedef struct _GstElement GstElement;
 
 namespace WebCore {
 
+#ifdef FullscreenVideoControllerClass
+class FullscreenVideoControllerClass;
+#endif
+
 class GraphicsContext;
 class IntSize;
 class IntRect;
@@ -75,11 +79,13 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
             void setPreservesPitch(bool);
 
             void setVolume(float);
+            float volume() const;
             void volumeChanged();
             void notifyPlayerOfVolumeChange();
 
             bool supportsMuting() const;
             void setMuted(bool);
+            bool muted() const;
             void muteChanged();
             void notifyPlayerOfMute();
 
@@ -93,6 +99,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
             float maxTimeSeekable() const;
             bool didLoadingProgress() const;
             unsigned totalBytes() const;
+            float maxTimeLoaded() const;
 
             void setVisible(bool);
             void setSize(const IntSize&);
@@ -110,6 +117,12 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
 
             bool hasSingleSecurityOrigin() const;
 
+#if USE(NATIVE_FULLSCREEN_VIDEO)
+            void enterFullscreen();
+            void exitFullscreen();
+            bool canEnterFullscreen() const { return true; }
+#endif
+
             bool supportsFullscreen() const;
             PlatformMedia platformMedia() const;
 
@@ -127,6 +140,8 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
 
             MediaPlayer::MovieLoadType movieLoadType() const;
 
+            MediaPlayer* mediaPlayer() const { return m_player; }
+
         private:
             MediaPlayerPrivateGStreamer(MediaPlayer*);
 
@@ -144,7 +159,6 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
 
             void cacheDuration();
             void updateStates();
-            float maxTimeLoaded() const;
 
             void createGSTPlayBin();
             bool changePipelineState(GstState state);
@@ -191,8 +205,11 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
             bool m_delayingLoad;
             bool m_mediaDurationKnown;
             mutable float m_maxTimeLoadedAtLastDidLoadingProgress;
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
             RefPtr<GStreamerGWorld> m_gstGWorld;
+#ifdef FullscreenVideoControllerClass
+            OwnPtr<FullscreenVideoControllerClass> m_fullscreenVideoController;
+#endif
 #endif
             guint m_volumeTimerHandler;
             guint m_muteTimerHandler;
index 2f8d365..4a1bc9f 100644 (file)
@@ -19,7 +19,7 @@
 
 #ifndef PlatformVideoWindow_h
 #define PlatformVideoWindow_h
-#if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 
 #include "Widget.h"
 #include <wtf/PassRefPtr.h>
@@ -61,5 +61,5 @@ class PlatformVideoWindow : public RefCounted<PlatformVideoWindow> {
     };
 }
 
-#endif // USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#endif // USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 #endif
index b838811..0c3572b 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "PlatformVideoWindow.h"
-#if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 
 #include <gtk/gtk.h>
 
@@ -48,8 +48,7 @@ PlatformVideoWindow::PlatformVideoWindow()
 
 PlatformVideoWindow::~PlatformVideoWindow()
 {
-    if (m_videoWindow && m_window) {
-        gtk_container_remove(GTK_CONTAINER(m_window), m_videoWindow);
+    if (m_videoWindow) {
         gtk_widget_destroy(m_videoWindow);
         m_videoWindow = 0;
     }
@@ -65,5 +64,5 @@ PlatformVideoWindow::~PlatformVideoWindow()
 void PlatformVideoWindow::prepareForOverlay(GstMessage*)
 {
 }
-#endif // ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 
index f48ff83..972b522 100644 (file)
@@ -19,6 +19,7 @@
 
 #ifndef PlatformVideoWindowPrivate_h
 #define PlatformVideoWindowPrivate_h
+#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 
 #include <QEvent>
 #include <QTimer>
@@ -55,5 +56,5 @@ private:
 
 } // namespace WebCore
 
-
+#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 #endif // PlatformVideoWindowPrivate_h
index 11b6fb7..1dcfd01 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "PlatformVideoWindow.h"
-#if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 
 #include "HTMLVideoElement.h"
 #include "PlatformVideoWindowPrivate.h"
@@ -130,4 +130,4 @@ PlatformVideoWindow::~PlatformVideoWindow()
 void PlatformVideoWindow::prepareForOverlay(GstMessage*)
 {
 }
-#endif // ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
index d852184..88a6cd3 100644 (file)
@@ -81,7 +81,7 @@ struct _WebKitVideoSinkPrivate {
     GstVideoInfo info;
 #endif
 
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
     WebCore::GStreamerGWorld* gstGWorld;
 #endif
 
@@ -154,7 +154,7 @@ static GstFlowReturn webkitVideoSinkRender(GstBaseSink* baseSink, GstBuffer* buf
         return GST_FLOW_OK;
     }
 
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
     // Ignore buffers if the video is already in fullscreen using
     // another sink.
     if (priv->gstGWorld->isFullscreen()) {
@@ -418,7 +418,7 @@ static void webkit_video_sink_class_init(WebKitVideoSinkClass* klass)
 }
 
 
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
 GstElement* webkitVideoSinkNew(WebCore::GStreamerGWorld* gstGWorld)
 {
     GstElement* element = GST_ELEMENT(g_object_new(WEBKIT_TYPE_VIDEO_SINK, 0));
index 061b694..8cfd2ae 100644 (file)
@@ -22,7 +22,7 @@
 
 #if ENABLE(VIDEO) && USE(GSTREAMER)
 
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
 #include "GStreamerGWorld.h"
 #endif
 
@@ -61,7 +61,7 @@ struct _WebKitVideoSinkClass {
 
 GType webkit_video_sink_get_type() G_GNUC_CONST;
 
-#ifndef GST_API_VERSION_1
+#if USE(NATIVE_FULLSCREEN_VIDEO)
 GstElement* webkitVideoSinkNew(WebCore::GStreamerGWorld*);
 #else
 GstElement* webkitVideoSinkNew();
index d45c14d..76a36ce 100644 (file)
@@ -1,3 +1,28 @@
+2013-01-26  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] USE(NATIVE_FULLSCREEN_VIDEO) support
+        https://bugs.webkit.org/show_bug.cgi?id=106760
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Build fixes for GStreamer NATIVE_FULLSCREEN_VIDEO support. Some
+        more changes will be needed to use the new
+        FullscreenVideoController though.
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::ChromeClientQt):
+        (WebCore::ChromeClientQt::~ChromeClientQt):
+        * WebCoreSupport/FullScreenVideoQt.cpp:
+        (WebCore):
+        (WebCore::FullScreenVideoQt::FullScreenVideoQt):
+        (WebCore::FullScreenVideoQt::~FullScreenVideoQt):
+        (WebCore::FullScreenVideoQt::enterFullScreenForNode):
+        (WebCore::FullScreenVideoQt::exitFullScreenForNode):
+        (WebCore::FullScreenVideoQt::isValid):
+        * WebCoreSupport/FullScreenVideoQt.h:
+        (WebCore):
+        (FullScreenVideoQt):
+
 2013-01-30  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         [Qt][WK1] Support better testing of Web Notifications
index 5374f76..0958ff4 100644 (file)
@@ -75,7 +75,7 @@
 #include <qwindow.h>
 #include <wtf/OwnPtr.h>
 
-#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
+#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
 #include "FullScreenVideoQt.h"
 #include "HTMLMediaElement.h"
 #include "HTMLNames.h"
@@ -126,7 +126,7 @@ bool ChromeClientQt::dumpVisitedLinksCallbacks = false;
 ChromeClientQt::ChromeClientQt(QWebPageAdapter* webPageAdapter)
     : m_webPage(webPageAdapter)
     , m_eventLoop(0)
-#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
+#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     , m_fullScreenVideo(0)
 #endif
 {
@@ -138,7 +138,7 @@ ChromeClientQt::~ChromeClientQt()
     if (m_eventLoop)
         m_eventLoop->exit();
 
-#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
+#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     delete m_fullScreenVideo;
 #endif
 }
@@ -677,7 +677,7 @@ IntRect ChromeClientQt::visibleRectForTiledBackingStore() const
 }
 #endif
 
-#if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
+#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
 FullScreenVideoQt* ChromeClientQt::fullScreenVideo()
 {
     if (!m_fullScreenVideo)
index 21f50bf..cee9e01 100644 (file)
@@ -160,7 +160,7 @@ public:
     virtual void needTouchEvents(bool) { }
 #endif
 
-#if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT))
+#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     virtual bool supportsFullscreenForNode(const Node*);
     virtual void enterFullscreenForNode(Node*);
     virtual void exitFullscreenForNode(Node*);
index 25e357a..86d354e 100644 (file)
@@ -44,7 +44,7 @@
 
 namespace WebCore {
 
-#if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
 GStreamerFullScreenVideoHandler::GStreamerFullScreenVideoHandler()
     : m_videoElement(0)
     , m_fullScreenWidget(0)
@@ -99,7 +99,7 @@ FullScreenVideoQt::FullScreenVideoQt(ChromeClientQt* chromeClient)
         connect(m_FullScreenVideoHandler, SIGNAL(fullScreenClosed()), this, SLOT(aboutToClose()));
 #endif
 
-#if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
     m_FullScreenVideoHandlerGStreamer = new GStreamerFullScreenVideoHandler;
 #endif
 
@@ -113,7 +113,7 @@ FullScreenVideoQt::~FullScreenVideoQt()
 #if USE(QT_MULTIMEDIA)
     delete m_FullScreenVideoHandler;
 #endif
-#if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
     delete m_FullScreenVideoHandlerGStreamer;
 #endif
 #if USE(QTKIT)
@@ -143,7 +143,7 @@ void FullScreenVideoQt::enterFullScreenForNode(Node* node)
     m_FullScreenVideoHandler->enterFullScreen(mediaPlayerQt->mediaPlayer());
 #endif
 
-#if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
     m_FullScreenVideoHandlerGStreamer->setVideoElement(m_videoElement);
     m_FullScreenVideoHandlerGStreamer->enterFullScreen();
 #endif
@@ -174,7 +174,7 @@ void FullScreenVideoQt::exitFullScreenForNode(Node* node)
     MediaPlayerPrivateQt* mediaPlayerQt = mediaPlayer();
     mediaPlayerQt->restoreVideoItem();
 #endif
-#if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
     m_FullScreenVideoHandlerGStreamer->exitFullScreen();
 #endif
 
@@ -213,7 +213,7 @@ bool FullScreenVideoQt::isValid() const
 #if USE(QT_MULTIMEDIA)
     return m_FullScreenVideoHandler;
 #endif
-#if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
+#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
     return m_FullScreenVideoHandlerGStreamer;
 #elif USE(QTKIT)
     return m_FullScreenVideoHandlerQTKit;
index 81a288d..438ab3f 100644 (file)
@@ -43,7 +43,7 @@ class QTKitFullScreenVideoHandler;
 #endif
 
 // We do not use ENABLE or USE because moc does not expand these macros.
-#if defined(WTF_USE_GSTREAMER) && WTF_USE_GSTREAMER && !defined(GST_API_VERSION_1)
+#if defined(WTF_USE_GSTREAMER) && WTF_USE_GSTREAMER && defined(WTF_USE_NATIVE_FULLSCREEN_VIDEO) && WTF_USE_NATIVE_FULLSCREEN_VIDEO
 class FullScreenVideoWindow;
 
 class GStreamerFullScreenVideoHandler : public QObject {
@@ -90,7 +90,7 @@ private:
 #if USE(QT_MULTIMEDIA)
     QWebFullScreenVideoHandler* m_FullScreenVideoHandler;
 #endif
-#if USE(GSTREAMER)
+#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
     GStreamerFullScreenVideoHandler* m_FullScreenVideoHandlerGStreamer;
 #endif
 #if USE(QTKIT)