2011-04-06 Alexis Menard <alexis.menard@openbossa.org>
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 18:43:29 +0000 (18:43 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 18:43:29 +0000 (18:43 +0000)
        Reviewed by Andreas Kling.

        [Qt] Implement fullscreen playback for the GStreamer backend.
        https://bugs.webkit.org/show_bug.cgi?id=56826

        Implement support for fullscreen playback when building the
        Qt port with the GStreamer backend (DEFINES+=USE_GSTREAMER=1).
        The implementation is done in FullScreenVideoQt alongside with
        the Qt Multimedia support.

        No new tests because layout tests cover it. They are not yet activated
        but will be any time soon.

        * platform/graphics/gstreamer/PlatformVideoWindowPrivate.h:
        * platform/graphics/gstreamer/PlatformVideoWindowQt.cpp:
        (FullScreenVideoWindow::FullScreenVideoWindow):
        (FullScreenVideoWindow::setVideoElement):
        (FullScreenVideoWindow::closeEvent):
        (FullScreenVideoWindow::keyPressEvent):
        (FullScreenVideoWindow::event):
        (FullScreenVideoWindow::showFullScreen):
        (FullScreenVideoWindow::hideCursor):
        (FullScreenVideoWindow::showCursor):
2011-04-06  Alexis Menard  <alexis.menard@openbossa.org>

        Reviewed by Andreas Kling.

        [Qt] Implement fullscreen playback for the GStreamer backend.
        https://bugs.webkit.org/show_bug.cgi?id=56826

        Implement support for fullscreen playback when building the
        Qt port with the GStreamer backend (DEFINES+=USE_GSTREAMER=1).
        The implementation is done in FullScreenVideoQt alongside with
        the Qt Multimedia support.

        No new tests because layout tests cover it. They are not yet activated
        but will be any time soon.

        * QtWebKit.pro:
        * WebCoreSupport/ChromeClientQt.cpp:
        (WebCore::ChromeClientQt::ChromeClientQt):
        (WebCore::ChromeClientQt::~ChromeClientQt):
        (WebCore::ChromeClientQt::enterFullscreenForNode):
        (WebCore::ChromeClientQt::exitFullscreenForNode):
        * WebCoreSupport/ChromeClientQt.h:
        * WebCoreSupport/FullScreenVideoQt.cpp:
        (WebCore::GStreamerFullScreenVideoHandler::GStreamerFullScreenVideoHandler):
        (WebCore::GStreamerFullScreenVideoHandler::setVideoElement):
        (WebCore::GStreamerFullScreenVideoHandler::enterFullScreen):
        (WebCore::GStreamerFullScreenVideoHandler::windowClosed):
        (WebCore::GStreamerFullScreenVideoHandler::exitFullScreen):
        (WebCore::DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler):
        (WebCore::FullScreenVideoQt::FullScreenVideoQt):
        (WebCore::FullScreenVideoQt::~FullScreenVideoQt):
        (WebCore::FullScreenVideoQt::enterFullScreenForNode):
        (WebCore::FullScreenVideoQt::exitFullScreenForNode):
        (WebCore::FullScreenVideoQt::requiresFullScreenForVideoPlayback):
        (WebCore::FullScreenVideoQt::isValid):
        * WebCoreSupport/FullScreenVideoQt.h:
        (WebCore::GStreamerFullScreenVideoHandler::~GStreamerFullScreenVideoHandler):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowPrivate.h
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/QtWebKit.pro
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 5371fc9e1057f2c2fdd9da27cf43f14b74fe9cdc..62fa2c486bb0f87ed7b0ef865c701129e4acf726 100644 (file)
@@ -1,3 +1,29 @@
+2011-04-06  Alexis Menard  <alexis.menard@openbossa.org>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] Implement fullscreen playback for the GStreamer backend.
+        https://bugs.webkit.org/show_bug.cgi?id=56826
+
+        Implement support for fullscreen playback when building the
+        Qt port with the GStreamer backend (DEFINES+=USE_GSTREAMER=1).
+        The implementation is done in FullScreenVideoQt alongside with
+        the Qt Multimedia support.
+
+        No new tests because layout tests cover it. They are not yet activated
+        but will be any time soon.
+
+        * platform/graphics/gstreamer/PlatformVideoWindowPrivate.h:
+        * platform/graphics/gstreamer/PlatformVideoWindowQt.cpp:
+        (FullScreenVideoWindow::FullScreenVideoWindow):
+        (FullScreenVideoWindow::setVideoElement):
+        (FullScreenVideoWindow::closeEvent):
+        (FullScreenVideoWindow::keyPressEvent):
+        (FullScreenVideoWindow::event):
+        (FullScreenVideoWindow::showFullScreen):
+        (FullScreenVideoWindow::hideCursor):
+        (FullScreenVideoWindow::showCursor):
+
 2011-04-06  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Dimitri Glazkov.
index 0ae4587900f3943f6ae760464b6d9eca60589a40..7b441f4b34989b7fa735bb484d06781ce70044c6 100644 (file)
 #ifndef PlatformVideoWindowPrivate_h
 #define PlatformVideoWindowPrivate_h
 
+#include <QTimer>
 #include <QWidget>
 
 class QKeyEvent;
 
 namespace WebCore {
 
+class HTMLVideoElement;
+
 class FullScreenVideoWindow: public QWidget {
 Q_OBJECT
 public:
     FullScreenVideoWindow();
+    void setVideoElement(HTMLVideoElement*);
 signals:
     void closed();
 protected:
-    void keyPressEvent(QKeyEvent* ev);
-    bool event(QEvent* ev);
+    void closeEvent(QCloseEvent*);
+    void keyPressEvent(QKeyEvent*);
+    bool event(QEvent*);
+
+public slots:
+    void showFullScreen();
+
+private slots:
+    void hideCursor();
+
+private:
+    void showCursor();
+    QTimer m_cursorTimer;
+    HTMLVideoElement* m_mediaElement;
 };
 
 
index 872d055798a03aed0f6b5a50f1dec00e4c2cc8c3..72707851af20c930800294f484204e39ce07bf97 100644 (file)
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "PlatformVideoWindow.h"
 
+#include "HTMLVideoElement.h"
 #include "PlatformVideoWindowPrivate.h"
 
 #include <QApplication>
 #include <QPalette>
 using namespace WebCore;
 
+static const int gHideMouseCursorDelay = 3000;
+
 FullScreenVideoWindow::FullScreenVideoWindow()
     : QWidget(0, Qt::Window)
+    , m_mediaElement(0)
 {
     setAttribute(Qt::WA_NativeWindow);
-    // Setting these values ensures smooth resizing since it
-    // will prevent the system from clearing the background.
+    setWindowModality(Qt::ApplicationModal);
     setAttribute(Qt::WA_NoSystemBackground, true);
     setAttribute(Qt::WA_PaintOnScreen, true);
+
+    m_cursorTimer.setSingleShot(true);
+    connect(&m_cursorTimer, SIGNAL(timeout()), this, SLOT(hideCursor()));
+}
+
+void FullScreenVideoWindow::setVideoElement(HTMLVideoElement* element)
+{
+    m_mediaElement = element;
+}
+
+void FullScreenVideoWindow::closeEvent(QCloseEvent*)
+{
+    m_cursorTimer.stop();
+    setMouseTracking(false);
+    releaseMouse();
+    QApplication::restoreOverrideCursor();
 }
 
 void FullScreenVideoWindow::keyPressEvent(QKeyEvent* ev)
 {
-    if (ev->key() == Qt::Key_Escape) {
-        close();
+    if (m_mediaElement && ev->key() == Qt::Key_Space) {
+        if (!m_mediaElement->paused())
+            m_mediaElement->pause(true);
+        else
+            m_mediaElement->play(true);
+    } else if (ev->key() == Qt::Key_Escape)
         emit closed();
-    }
+    QWidget::keyPressEvent(ev);
 }
 
 bool FullScreenVideoWindow::event(QEvent* ev)
 {
     switch (ev->type()) {
+    case QEvent::MouseMove:
+        showCursor();
+        ev->accept();
+        return true;
     case QEvent::MouseButtonDblClick:
-        close();
+        emit closed();
         ev->accept();
         return true;
     default:
@@ -58,6 +85,26 @@ bool FullScreenVideoWindow::event(QEvent* ev)
     }
 }
 
+void FullScreenVideoWindow::showFullScreen()
+{
+    QWidget::showFullScreen();
+    setMouseTracking(true);
+    raise();
+    setFocus();
+    hideCursor();
+}
+
+void FullScreenVideoWindow::hideCursor()
+{
+    QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
+}
+
+void FullScreenVideoWindow::showCursor()
+{
+    QApplication::restoreOverrideCursor();
+    m_cursorTimer.start(gHideMouseCursorDelay);
+}
+
 
 PlatformVideoWindow::PlatformVideoWindow()
 {
index e2ccdcea959b565350dc35b875c922395d82a2f3..c22446b422e0fc317455106e335c5d0179f82e1c 100644 (file)
@@ -1,3 +1,41 @@
+2011-04-06  Alexis Menard  <alexis.menard@openbossa.org>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] Implement fullscreen playback for the GStreamer backend.
+        https://bugs.webkit.org/show_bug.cgi?id=56826
+
+        Implement support for fullscreen playback when building the
+        Qt port with the GStreamer backend (DEFINES+=USE_GSTREAMER=1).
+        The implementation is done in FullScreenVideoQt alongside with
+        the Qt Multimedia support.
+
+        No new tests because layout tests cover it. They are not yet activated
+        but will be any time soon.
+
+        * QtWebKit.pro:
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::ChromeClientQt):
+        (WebCore::ChromeClientQt::~ChromeClientQt):
+        (WebCore::ChromeClientQt::enterFullscreenForNode):
+        (WebCore::ChromeClientQt::exitFullscreenForNode):
+        * WebCoreSupport/ChromeClientQt.h:
+        * WebCoreSupport/FullScreenVideoQt.cpp:
+        (WebCore::GStreamerFullScreenVideoHandler::GStreamerFullScreenVideoHandler):
+        (WebCore::GStreamerFullScreenVideoHandler::setVideoElement):
+        (WebCore::GStreamerFullScreenVideoHandler::enterFullScreen):
+        (WebCore::GStreamerFullScreenVideoHandler::windowClosed):
+        (WebCore::GStreamerFullScreenVideoHandler::exitFullScreen):
+        (WebCore::DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler):
+        (WebCore::FullScreenVideoQt::FullScreenVideoQt):
+        (WebCore::FullScreenVideoQt::~FullScreenVideoQt):
+        (WebCore::FullScreenVideoQt::enterFullScreenForNode):
+        (WebCore::FullScreenVideoQt::exitFullScreenForNode):
+        (WebCore::FullScreenVideoQt::requiresFullScreenForVideoPlayback):
+        (WebCore::FullScreenVideoQt::isValid):
+        * WebCoreSupport/FullScreenVideoQt.h:
+        (WebCore::GStreamerFullScreenVideoHandler::~GStreamerFullScreenVideoHandler):
+
 2011-04-06  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
 
         Reviewed by Kenneth Rohde Christiansen.
index 3cf998a1234c123995a4fc5873ce6c2144cf3335..cd1bfba4f9af65b175a5753d1896f50fe99b44cc 100644 (file)
@@ -211,13 +211,13 @@ contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=1) {
 
 contains(DEFINES, ENABLE_VIDEO=1) {
     !contains(DEFINES, USE_GSTREAMER=1):contains(MOBILITY_CONFIG, multimedia) {
-        HEADERS += \
-            $$PWD/WebCoreSupport/FullScreenVideoQt.h \
-            $$PWD/WebCoreSupport/FullScreenVideoWidget.h
+        HEADERS += $$PWD/WebCoreSupport/FullScreenVideoWidget.h
+        SOURCES += $$PWD/WebCoreSupport/FullScreenVideoWidget.cpp
+    }
 
-        SOURCES += \
-            $$PWD/WebCoreSupport/FullScreenVideoQt.cpp \
-            $$PWD/WebCoreSupport/FullScreenVideoWidget.cpp
+    contains(DEFINES, USE_GSTREAMER=1) | contains(MOBILITY_CONFIG, multimedia) {
+        HEADERS += $$PWD/WebCoreSupport/FullScreenVideoQt.h
+        SOURCES += $$PWD/WebCoreSupport/FullScreenVideoQt.cpp
     }
 }
 
index bec4bc4c3abdb5f3099680d963e0ad1e1fc06906..ab55e69ee9c3f7e17fe7ea24ad0ed7e99f8f3230 100644 (file)
 #include <qtooltip.h>
 #include <wtf/OwnPtr.h>
 
-#if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA)
+#if ENABLE(VIDEO)
 #include "FullScreenVideoQt.h"
 #include "HTMLMediaElement.h"
 #include "HTMLNames.h"
 #include "HTMLVideoElement.h"
+#if ENABLE(QT_MULTIMEDIA)
 #include "MediaPlayerPrivateQt.h"
 #endif
+#endif
 
 namespace WebCore {
 
@@ -90,7 +92,7 @@ bool ChromeClientQt::dumpVisitedLinksCallbacks = false;
 ChromeClientQt::ChromeClientQt(QWebPage* webPage)
     : m_webPage(webPage)
     , m_eventLoop(0)
-#if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA)
+#if ENABLE(VIDEO)
     , m_fullScreenVideo(0)
 #endif
 {
@@ -102,7 +104,7 @@ ChromeClientQt::~ChromeClientQt()
     if (m_eventLoop)
         m_eventLoop->exit();
 
-#if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA)
+#if ENABLE(VIDEO)
     delete m_fullScreenVideo;
 #endif
 }
@@ -650,7 +652,7 @@ IntRect ChromeClientQt::visibleRectForTiledBackingStore() const
 }
 #endif
 
-#if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA)
+#if ENABLE(VIDEO)
 FullScreenVideoQt* ChromeClientQt::fullScreenVideo()
 {
     if (!m_fullScreenVideo)
@@ -673,13 +675,6 @@ void ChromeClientQt::enterFullscreenForNode(Node* node)
 {
     ASSERT(node && node->hasTagName(HTMLNames::videoTag));
 
-    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node);
-    PlatformMedia platformMedia = videoElement->platformMedia();
-
-    ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType);
-    if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
-        return;
-
     fullScreenVideo()->enterFullScreenForNode(node);
 }
 
@@ -687,13 +682,6 @@ void ChromeClientQt::exitFullscreenForNode(Node* node)
 {
     ASSERT(node && node->hasTagName(HTMLNames::videoTag));
 
-    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node);
-    PlatformMedia platformMedia = videoElement->platformMedia();
-
-    ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType);
-    if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
-        return;
-
     fullScreenVideo()->exitFullScreenForNode(node);
 } 
 #endif
index 8b70e0b5bd9bc1007b05fbc3c19b6c4987b8dea1..c1ed42d398f36bdba94a4e9ff6e37d7a42ffa948 100644 (file)
@@ -50,7 +50,7 @@ class Page;
 struct FrameLoadRequest;
 class QtAbstractWebPopup;
 struct ViewportArguments;
-#if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA)
+#if ENABLE(VIDEO)
 class FullScreenVideoQt;
 #endif
 
@@ -163,7 +163,7 @@ public:
     virtual void needTouchEvents(bool) { }
 #endif
  
-#if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA)
+#if ENABLE(VIDEO)
     virtual bool supportsFullscreenForNode(const Node*);
     virtual void enterFullscreenForNode(Node*);
     virtual void exitFullscreenForNode(Node*);
@@ -202,7 +202,7 @@ public:
     bool menuBarVisible;
     QEventLoop* m_eventLoop;
 
-#if ENABLE(VIDEO) && ENABLE(QT_MULTIMEDIA)
+#if ENABLE(VIDEO)
     FullScreenVideoQt* m_fullScreenVideo;
 #endif
 
index ccca43c7d3a13726ffb033969d89cfad361cd0b3..e8d2e35084391710442058b388c8b1fb9b5f3107 100644 (file)
 #include "FullScreenVideoQt.h"
 
 #include "ChromeClientQt.h"
+#if ENABLE(QT_MULTIMEDIA)
 #include "FullScreenVideoWidget.h"
+#include "MediaPlayerPrivateQt.h"
+#endif
 #include "HTMLNames.h"
 #include "HTMLVideoElement.h"
-#include "MediaPlayerPrivateQt.h"
 #include "Node.h"
 
+#if USE(GSTREAMER)
+#include "GStreamerGWorld.h"
+#include "PlatformVideoWindowPrivate.h"
+#endif
 
+#if ENABLE(QT_MULTIMEDIA)
 #include <QGraphicsVideoItem>
 #include <QMediaPlayer>
+#endif
+#include <QWidget>
 
 namespace WebCore {
 
+#if USE(GSTREAMER)
+GStreamerFullScreenVideoHandler::GStreamerFullScreenVideoHandler()
+    : m_videoElement(0)
+    , m_fullScreenWidget(0)
+{
+}
+
+void GStreamerFullScreenVideoHandler::setVideoElement(HTMLVideoElement* element)
+{
+    m_videoElement = element;
+}
+
+void GStreamerFullScreenVideoHandler::enterFullScreen()
+{
+    if (m_videoElement->platformMedia().type != WebCore::PlatformMedia::GStreamerGWorldType)
+        return;
+
+    GStreamerGWorld* gstreamerGWorld = m_videoElement->platformMedia().media.gstreamerGWorld;
+
+    if (!gstreamerGWorld->enterFullscreen())
+        return;
+
+    m_fullScreenWidget = reinterpret_cast<FullScreenVideoWindow*>(gstreamerGWorld->platformVideoWindow()->window());
+    m_fullScreenWidget->setVideoElement(m_videoElement);
+    connect(m_fullScreenWidget, SIGNAL(closed()), this, SLOT(windowClosed()));
+    m_fullScreenWidget->showFullScreen();
+}
+
+void GStreamerFullScreenVideoHandler::windowClosed()
+{
+    m_videoElement->exitFullscreen();
+}
+
+void GStreamerFullScreenVideoHandler::exitFullScreen()
+{
+    if (m_videoElement->platformMedia().type == WebCore::PlatformMedia::GStreamerGWorldType)
+        m_videoElement->platformMedia().media.gstreamerGWorld->exitFullscreen();
+
+    m_fullScreenWidget->setVideoElement(0);
+    m_fullScreenWidget->close();
+}
+#endif
+
+#if ENABLE(QT_MULTIMEDIA)
 bool DefaultFullScreenVideoHandler::s_shouldForceFullScreenVideoPlayback = false;
 
 DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler()
@@ -42,6 +95,8 @@ DefaultFullScreenVideoHandler::DefaultFullScreenVideoHandler()
 {
     connect(m_fullScreenWidget, SIGNAL(didExitFullScreen()), this, SIGNAL(fullScreenClosed()));
     m_fullScreenWidget->hide();
+
+    m_fullScreenWidget->close();
 }
 
 DefaultFullScreenVideoHandler::~DefaultFullScreenVideoHandler()
@@ -72,24 +127,36 @@ void DefaultFullScreenVideoHandler::exitFullScreen()
 {
     m_fullScreenWidget->close();
 }
+#endif
 
 FullScreenVideoQt::FullScreenVideoQt(ChromeClientQt* chromeClient)
     : m_chromeClient(chromeClient)
     , m_videoElement(0)
 {
     Q_ASSERT(m_chromeClient);
-    m_FullScreenVideoHandler = m_chromeClient->m_platformPlugin.createFullScreenVideoHandler();
 
+#if ENABLE(QT_MULTIMEDIA)
+    m_FullScreenVideoHandler = m_chromeClient->m_platformPlugin.createFullScreenVideoHandler();
     if (!m_FullScreenVideoHandler)
         m_FullScreenVideoHandler = new DefaultFullScreenVideoHandler;
 
     if (m_FullScreenVideoHandler)
         connect(m_FullScreenVideoHandler, SIGNAL(fullScreenClosed()), this, SLOT(aboutToClose()));
+#endif
+
+#if USE(GSTREAMER)
+    m_FullScreenVideoHandlerGStreamer = new GStreamerFullScreenVideoHandler;
+#endif
 }
 
 FullScreenVideoQt::~FullScreenVideoQt()
 {
+#if ENABLE(QT_MULTIMEDIA)
     delete m_FullScreenVideoHandler;
+#endif
+#if USE(GSTREAMER)
+    delete m_FullScreenVideoHandlerGStreamer;
+#endif
 }
 
 void FullScreenVideoQt::enterFullScreenForNode(Node* node)
@@ -97,25 +164,54 @@ void FullScreenVideoQt::enterFullScreenForNode(Node* node)
     Q_ASSERT(node);
     Q_ASSERT(m_FullScreenVideoHandler);
 
+    m_videoElement = static_cast<HTMLVideoElement*>(node);
+
+#if ENABLE(QT_MULTIMEDIA)
+    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node);
+    PlatformMedia platformMedia = videoElement->platformMedia();
+
+    ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType);
+    if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
+        return;
+
     if (!m_FullScreenVideoHandler)
         return;
 
-    MediaPlayerPrivateQt* mediaPlayerQt = mediaPlayerForNode(node);
+    MediaPlayerPrivateQt* mediaPlayerQt = mediaPlayer();
     mediaPlayerQt->removeVideoItem();
     m_FullScreenVideoHandler->enterFullScreen(mediaPlayerQt->mediaPlayer());
+#endif
+
+#if USE(GSTREAMER)
+    m_FullScreenVideoHandlerGStreamer->setVideoElement(m_videoElement);
+    m_FullScreenVideoHandlerGStreamer->enterFullScreen();
+#endif
 }
 
 void FullScreenVideoQt::exitFullScreenForNode(Node* node)
 {
     Q_ASSERT(node);
+
+#if ENABLE(QT_MULTIMEDIA)
+    HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(node);
+    PlatformMedia platformMedia = videoElement->platformMedia();
+
+    ASSERT(platformMedia.type == PlatformMedia::QtMediaPlayerType);
+    if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
+        return;
+
     Q_ASSERT(m_FullScreenVideoHandler);
 
     if (!m_FullScreenVideoHandler)
         return;
 
     m_FullScreenVideoHandler->exitFullScreen();
-    MediaPlayerPrivateQt* mediaPlayerQt = mediaPlayerForNode(node);
+    MediaPlayerPrivateQt* mediaPlayerQt = mediaPlayer();
     mediaPlayerQt->restoreVideoItem();
+#endif
+#if USE(GSTREAMER)
+    m_FullScreenVideoHandlerGStreamer->exitFullScreen();
+#endif
 }
 
 void FullScreenVideoQt::aboutToClose()
@@ -124,24 +220,33 @@ void FullScreenVideoQt::aboutToClose()
     m_videoElement->exitFullscreen();
 }
 
+#if ENABLE(QT_MULTIMEDIA)
 MediaPlayerPrivateQt* FullScreenVideoQt::mediaPlayer()
 {
     Q_ASSERT(m_videoElement);
     PlatformMedia platformMedia = m_videoElement->platformMedia();
     return static_cast<MediaPlayerPrivateQt*>(platformMedia.media.qtMediaPlayer);
 }
+#endif
 
-MediaPlayerPrivateQt* FullScreenVideoQt::mediaPlayerForNode(Node* node)
+bool FullScreenVideoQt::requiresFullScreenForVideoPlayback()
 {
-    Q_ASSERT(node);
-    if (node)
-        m_videoElement = static_cast<HTMLVideoElement*>(node);
-    return mediaPlayer();
+#if ENABLE(QT_MULTIMEDIA)
+    return m_FullScreenVideoHandler ? m_FullScreenVideoHandler->requiresFullScreenForVideoPlayback() : false;
+#endif
+#if USE(GSTREAMER)
+    return false;
+#endif
 }
 
-bool FullScreenVideoQt::requiresFullScreenForVideoPlayback()
+bool FullScreenVideoQt::isValid() const
 {
-    return m_FullScreenVideoHandler ? m_FullScreenVideoHandler->requiresFullScreenForVideoPlayback() : false;
+#if ENABLE(QT_MULTIMEDIA)
+    return m_FullScreenVideoHandler;
+#endif
+#if USE(GSTREAMER)
+    return m_FullScreenVideoHandlerGStreamer;
+#endif
 }
 
 }
index a48a882c45a47d9715f5178236864e2501e60cbd..ac5cb051c4e358359c94b7458b4602cbab0ca86c 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "qwebkitplatformplugin.h"
 #include <QObject>
+#include <wtf/Platform.h>
 
 QT_BEGIN_NAMESPACE
 class QGraphicsVideoItem;
@@ -34,8 +35,35 @@ class ChromeClientQt;
 class FullScreenVideoWidget;
 class HTMLVideoElement;
 class Node;
+#if ENABLE(QT_MULTIMEDIA)
 class MediaPlayerPrivateQt;
+#endif
 
+// We do not use ENABLE or USE because moc does not expand these macros.
+#if defined(WTF_USE_GSTREAMER) && WTF_USE_GSTREAMER
+class FullScreenVideoWindow;
+
+class GStreamerFullScreenVideoHandler : public QObject {
+    Q_OBJECT
+public:
+    GStreamerFullScreenVideoHandler();
+    ~GStreamerFullScreenVideoHandler() { }
+    void setVideoElement(HTMLVideoElement*);
+
+    void enterFullScreen();
+    void exitFullScreen();
+
+public Q_SLOTS:
+    void windowClosed();
+
+private:
+    HTMLVideoElement* m_videoElement;
+    FullScreenVideoWindow* m_fullScreenWidget;
+};
+#endif
+
+// We do not use ENABLE or USE because moc does not expand these macros.
+#if defined(ENABLE_QT_MULTIMEDIA) && ENABLE_QT_MULTIMEDIA
 class DefaultFullScreenVideoHandler : public QWebFullScreenVideoHandler {
     Q_OBJECT
 public:
@@ -51,6 +79,7 @@ private:
     static bool s_shouldForceFullScreenVideoPlayback;
     FullScreenVideoWidget *m_fullScreenWidget;
 };
+#endif
 
 class FullScreenVideoQt : public QObject {
     Q_OBJECT
@@ -61,11 +90,12 @@ public:
     virtual void enterFullScreenForNode(Node*);
     virtual void exitFullScreenForNode(Node*);
     bool requiresFullScreenForVideoPlayback();
-    bool isValid() const {  return m_FullScreenVideoHandler; }
+    bool isValid() const;
 
 private:
+#if ENABLE(QT_MULTIMEDIA)
     MediaPlayerPrivateQt* mediaPlayer();
-    MediaPlayerPrivateQt* mediaPlayerForNode(Node* = 0);
+#endif
 
 private slots:
     void aboutToClose();
@@ -73,7 +103,12 @@ private slots:
 private:
     ChromeClientQt* m_chromeClient;
     HTMLVideoElement* m_videoElement;
+#if ENABLE(QT_MULTIMEDIA)
     QWebFullScreenVideoHandler* m_FullScreenVideoHandler;
+#endif
+#if USE(GSTREAMER)
+    GStreamerFullScreenVideoHandler* m_FullScreenVideoHandlerGStreamer;
+#endif
 };
 
 }