Changeset 141265 in webkit


Ignore:
Timestamp:
Jan 30, 2013 6:55:50 AM (11 years ago)
Author:
Philippe Normand
Message:

[GStreamer] USE(NATIVE_FULLSCREEN_VIDEO) support
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):

Location:
trunk/Source
Files:
2 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141260 r141265  
     12013-01-20  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] USE(NATIVE_FULLSCREEN_VIDEO) support
     4        https://bugs.webkit.org/show_bug.cgi?id=106760
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Initial support for NATIVE_FULLSCREEN_VIDEO in the GStreamer media
     9        player. A new FullscreenVideoControllerGStreamer class is
     10        introduced, ports interested to implement native fullscreen video
     11        support should inherit from it (see FullscreenVideoControllerGtk)
     12        and hook it in the MediaPlayerPrivateGStreamer backend.
     13
     14        The GStreamerGWorld port to GStreamer 1.x is partly based on a
     15        patch by Sebastian Dröge <sebastian.droge@collabora.com>.
     16
     17        * GNUmakefile.am: Enable NATIVE_FULLSCREEN_VIDEO support.
     18        * GNUmakefile.list.am: New
     19        FullscreenVideoController{GStreamer,Gtk} modules.
     20        * platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp: Added.
     21        (WebCore):
     22        (WebCore::playerVolumeChangedCallback): Playbin notify::volume
     23        signal callback.
     24        (WebCore::playerMuteChangedCallback): Playbin notify::mute signal callback.
     25        (WebCore::FullscreenVideoControllerGStreamer::FullscreenVideoControllerGStreamer):
     26        (WebCore::FullscreenVideoControllerGStreamer::~FullscreenVideoControllerGStreamer):
     27        (WebCore::FullscreenVideoControllerGStreamer::enterFullscreen):
     28        Switch GStreamerGWorld to full screen, hook in to playbin's
     29        notify::volume and mute signals and initialize the full screen window.
     30        (WebCore::FullscreenVideoControllerGStreamer::exitFullscreen):
     31        Destroy the full screen window, disconnect from playbin signals
     32        and switch GStreamerGWorld out of full screen.
     33        (WebCore::FullscreenVideoControllerGStreamer::exitOnUserRequest):
     34        Trigger exit from full screen mode. This method is meant to be
     35        called when the user explicitely requests to exit from full screen
     36        by pressing a key or something similar.
     37        (WebCore::FullscreenVideoControllerGStreamer::togglePlay): Switch
     38        between play and pause states. Useful for child classes.
     39        (WebCore::FullscreenVideoControllerGStreamer::increaseVolume):
     40        Useful for child classes as well.
     41        (WebCore::FullscreenVideoControllerGStreamer::decreaseVolume): Ditto.
     42        (WebCore::FullscreenVideoControllerGStreamer::setVolume): Ditto.
     43        (WebCore::FullscreenVideoControllerGStreamer::timeToString): Ditto.
     44        * platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.h: Added.
     45        (WebCore):
     46        (FullscreenVideoControllerGStreamer):
     47        (WebCore::FullscreenVideoControllerGStreamer::playStateChanged):
     48        To be implemented by child class to reflect the player's state changed.
     49        (WebCore::FullscreenVideoControllerGStreamer::volumeChanged): To
     50        be implemented by child class as well.
     51        (WebCore::FullscreenVideoControllerGStreamer::muteChanged): Ditto.
     52        (WebCore::FullscreenVideoControllerGStreamer::initializeWindow): Ditto.
     53        (WebCore::FullscreenVideoControllerGStreamer::destroyWindow): Ditto.
     54        * platform/graphics/gstreamer/GStreamerGWorld.cpp:
     55        (WebCore::gstGWorldSyncMessageCallback): Adapt for GStreamer video
     56        overlay API changes.
     57        (WebCore::GStreamerGWorld::GStreamerGWorld):
     58        gst_bus_set_sync_handler takes one more argument in GStreamer 1.x.
     59        (WebCore::GStreamerGWorld::enterFullscreen): ffmpegcolorspace was
     60        renamed to videoconvert in GStreamer 1.x and the tee src pad
     61        template was renamed to src_%u. There is no need to send a new
     62        segment query either.
     63        (WebCore):
     64        (WebCore::gstGWorldPadProbeCallback): Remove the platform video
     65        sink branch once the tee source pad starting it has been blocked.
     66        (WebCore::GStreamerGWorld::exitFullscreen): Refactor to use an
     67        asynchronous pad probe.
     68        (WebCore::GStreamerGWorld::removePlatformVideoSink): Refactored
     69        from exitFullscreen.
     70        (WebCore::GStreamerGWorld::setWindowOverlay): Adapt for GStreamer video
     71        overlay API changes.
     72        * platform/graphics/gstreamer/GStreamerGWorld.h:
     73        (GStreamerGWorld):
     74        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     75        (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
     76        Hook NATIVE_FULLSCREEN_VIDEO support.
     77        (WebCore::MediaPlayerPrivateGStreamer::volume): Playbin volume
     78        query used by the FullscreenVideoController.
     79        (WebCore):
     80        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
     81        (WebCore):
     82        (MediaPlayerPrivateGStreamer): volume(), muted() and MediaPlayer
     83        accessor methods added. NATIVE_FULLSCREEN_VIDEO methods added as well.
     84        (WebCore::MediaPlayerPrivateGStreamer::canEnterFullscreen):
     85        (WebCore::MediaPlayerPrivateGStreamer::mediaPlayer):
     86        * platform/graphics/gstreamer/PlatformVideoWindow.h: Re-enable
     87        module if NATIVE_FULLSCREEN_VIDEO is turned on.
     88        * platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp: Ditto.
     89        * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: Re-enable
     90        GStreamerGWorld support.
     91        (_WebKitVideoSinkPrivate):
     92        (webkitVideoSinkRender):
     93        * platform/graphics/gstreamer/VideoSinkGStreamer.h: Ditto.
     94
    1952013-01-30  Pavel Feldman  <pfeldman@chromium.org>
    296
  • trunk/Source/WebCore/GNUmakefile.am

    r141241 r141265  
    162162webcore_cppflags += -DGST_DISABLE_DEPRECATED
    163163endif # END ENABLE_DEBUG
     164webcore_cppflags += -DWTF_USE_NATIVE_FULLSCREEN_VIDEO=1
    164165endif # END USE_GSTREAMER
    165166else
  • trunk/Source/WebCore/GNUmakefile.list.am

    r141219 r141265  
    60666066        Source/WebCore/platform/graphics/freetype/FontPlatformData.h \
    60676067        Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp \
     6068        Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.cpp \
     6069        Source/WebCore/platform/graphics/gstreamer/FullscreenVideoControllerGStreamer.h \
    60686070        Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp \
    60696071        Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h \
  • trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp

    r140443 r141265  
    1919
    2020#include "config.h"
     21
    2122#include "GStreamerGWorld.h"
    22 #if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     23
     24#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    2325
    2426#include "GRefPtrGStreamer.h"
    2527#include "GStreamerVersioning.h"
    2628#include <gst/gst.h>
     29#include <gst/pbutils/pbutils.h>
     30
     31#ifdef GST_API_VERSION_1
     32#include <gst/video/videooverlay.h>
     33#else
    2734#include <gst/interfaces/xoverlay.h>
    28 #include <gst/pbutils/pbutils.h>
     35#endif
     36
    2937
    3038#if PLATFORM(GTK)
     
    3543#endif
    3644
     45#ifndef GST_API_VERSION_1
     46static const char* gVideoConvertName = "ffmpegcolorspace";
     47#else
     48static const char* gVideoConvertName = "videoconvert";
     49#endif
     50
    3751using namespace std;
    3852
     
    4458
    4559    GStreamerGWorld* gstGWorld = static_cast<GStreamerGWorld*>(data);
     60#ifndef GST_API_VERSION_1
    4661    const GstStructure* structure = gst_message_get_structure(message);
    4762
     
    4964        || gst_structure_has_name(structure, "have-ns-view"))
    5065        gstGWorld->setWindowOverlay(message);
     66#else
     67    if (gst_is_video_overlay_prepare_window_handle_message(message))
     68        gstGWorld->setWindowOverlay(message);
     69#endif
    5170    return TRUE;
    5271}
     
    6281    // XOverlay messages need to be handled synchronously.
    6382    GRefPtr<GstBus> bus = webkitGstPipelineGetBus(GST_PIPELINE(m_pipeline));
     83#ifndef GST_API_VERSION_1
    6484    gst_bus_set_sync_handler(bus.get(), gst_bus_sync_signal_handler, this);
     85#else
     86    gst_bus_set_sync_handler(bus.get(), gst_bus_sync_signal_handler, this, 0);
     87#endif
    6588    g_signal_connect(bus.get(), "sync-message::element", G_CALLBACK(gstGWorldSyncMessageCallback), this);
    6689}
     
    82105
    83106    GstElement* platformVideoSink = gst_element_factory_make("autovideosink", "platformVideoSink");
    84     GstElement* colorspace = gst_element_factory_make("ffmpegcolorspace", "colorspace");
     107    GstElement* colorspace = gst_element_factory_make(gVideoConvertName, "colorspace");
    85108    GstElement* queue = gst_element_factory_make("queue", "queue");
    86109    GstElement* videoScale = gst_element_factory_make("videoscale", "videoScale");
     
    95118    GRefPtr<GstElement> tee = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoTee"));
    96119
    97     // Add and link a queue, ffmpegcolorspace, videoscale and sink in the bin.
    98120    gst_bin_add_many(GST_BIN(videoSink.get()), platformVideoSink, videoScale, colorspace, queue, NULL);
    99121
     
    104126
    105127    // Link a new src pad from tee to queue.
     128#ifndef GST_API_VERSION_1
    106129    GRefPtr<GstPad> srcPad = adoptGRef(gst_element_get_request_pad(tee.get(), "src%d"));
     130#else
     131    GRefPtr<GstPad> srcPad = adoptGRef(gst_element_get_request_pad(tee.get(), "src_%u"));
     132#endif
    107133    GRefPtr<GstPad> sinkPad = adoptGRef(gst_element_get_static_pad(queue, "sink"));
    108134    gst_pad_link(srcPad.get(), sinkPad.get());
     
    122148    gst_element_set_state(queue, state);
    123149
     150#ifndef GST_API_VERSION_1
    124151    // Query the current media segment informations and send them towards
    125152    // the new tee branch downstream.
    126 
    127153    GstQuery* query = gst_query_new_segment(GST_FORMAT_TIME);
    128154    gboolean queryResult = gst_element_query(m_pipeline, query);
     
    133159    }
    134160
     161    gint64 position;
    135162    GstFormat format;
    136     gint64 position;
    137163    if (!gst_element_query_position(m_pipeline, &format, &position))
    138164        position = 0;
     
    146172
    147173    gst_query_unref(query);
     174#endif
    148175    return true;
    149176}
     177
     178#ifdef GST_API_VERSION_1
     179static GstPadProbeReturn gstGWorldPadProbeCallback(GstPad* pad, GstPadProbeInfo* info, GStreamerGWorld* gstGWorld)
     180{
     181    gstGWorld->removePlatformVideoSink();
     182    return GST_PAD_PROBE_REMOVE;
     183}
     184#endif
    150185
    151186void GStreamerGWorld::exitFullscreen()
     
    154189        return;
    155190
     191    GstElement* sinkPtr = 0;
     192    g_object_get(m_pipeline, "video-sink", &sinkPtr, NULL);
     193    GRefPtr<GstElement> videoSink = adoptGRef(sinkPtr);
     194
     195    GRefPtr<GstElement> tee = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoTee"));
     196    GRefPtr<GstPad> srcPad = adoptGRef(gst_element_get_static_pad(tee.get(), m_dynamicPadName.get()));
     197
     198    // Block data flow towards the pipeline branch to remove. No need
     199    // for pad blocking if the pipeline is paused.
     200    GstState state;
     201    gst_element_get_state(m_pipeline, &state, 0, 0);
     202#ifdef GST_API_VERSION_1
     203    if (state >= GST_STATE_PLAYING)
     204        gst_pad_add_probe(srcPad.get(), GST_PAD_PROBE_TYPE_IDLE, reinterpret_cast<GstPadProbeCallback>(gstGWorldPadProbeCallback), this, 0);
     205    else
     206#else
     207    if (state < GST_STATE_PLAYING || gst_pad_set_blocked(srcPad.get(), true))
     208#endif
     209        removePlatformVideoSink();
     210
     211    m_videoWindow = 0;
     212}
     213
     214void GStreamerGWorld::removePlatformVideoSink()
     215{
     216    if (!m_dynamicPadName)
     217        return;
     218
    156219    // Get video sink bin and the elements to remove.
    157     GRefPtr<GstElement> videoSink;
    158220    GstElement* sinkPtr = 0;
    159 
    160221    g_object_get(m_pipeline, "video-sink", &sinkPtr, NULL);
    161     videoSink = adoptGRef(sinkPtr);
     222    GRefPtr<GstElement> videoSink = adoptGRef(sinkPtr);
    162223
    163224    GRefPtr<GstElement> tee = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoTee"));
     
    167228    GRefPtr<GstElement> videoScale = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoScale"));
    168229
    169     // Get pads to unlink and remove.
    170230    GRefPtr<GstPad> srcPad = adoptGRef(gst_element_get_static_pad(tee.get(), m_dynamicPadName.get()));
    171231    GRefPtr<GstPad> sinkPad = adoptGRef(gst_element_get_static_pad(queue.get(), "sink"));
    172 
    173     // Block data flow towards the pipeline branch to remove. No need
    174     // for pad blocking if the pipeline is paused.
    175     GstState state;
    176     gst_element_get_state(m_pipeline, &state, 0, 0);
    177     if (state < GST_STATE_PLAYING || gst_pad_set_blocked(srcPad.get(), true)) {
    178 
    179         // Unlink and release request pad.
    180         gst_pad_unlink(srcPad.get(), sinkPad.get());
    181         gst_element_release_request_pad(tee.get(), srcPad.get());
    182 
    183         // Unlink, remove and cleanup queue, ffmpegcolorspace, videoScale and sink.
    184         gst_element_unlink_many(queue.get(), colorspace.get(), videoScale.get(), platformVideoSink.get(), NULL);
    185         gst_bin_remove_many(GST_BIN(videoSink.get()), queue.get(), colorspace.get(), videoScale.get(), platformVideoSink.get(), NULL);
    186         gst_element_set_state(platformVideoSink.get(), GST_STATE_NULL);
    187         gst_element_set_state(videoScale.get(), GST_STATE_NULL);
    188         gst_element_set_state(colorspace.get(), GST_STATE_NULL);
    189         gst_element_set_state(queue.get(), GST_STATE_NULL);
    190     }
     232    gst_pad_unlink(srcPad.get(), sinkPad.get());
     233    gst_element_release_request_pad(tee.get(), srcPad.get());
     234
     235    gst_element_unlink_many(queue.get(), colorspace.get(), videoScale.get(), platformVideoSink.get(), NULL);
     236    gst_bin_remove_many(GST_BIN(videoSink.get()), queue.get(), colorspace.get(), videoScale.get(), platformVideoSink.get(), NULL);
     237    gst_element_set_state(platformVideoSink.get(), GST_STATE_NULL);
     238    gst_element_set_state(videoScale.get(), GST_STATE_NULL);
     239    gst_element_set_state(colorspace.get(), GST_STATE_NULL);
     240    gst_element_set_state(queue.get(), GST_STATE_NULL);
    191241
    192242    m_dynamicPadName.clear();
     
    197247    GstObject* sink = GST_MESSAGE_SRC(message);
    198248
     249#ifndef GST_API_VERSION_1
    199250    if (!GST_IS_X_OVERLAY(sink))
     251#else
     252    if (!GST_IS_VIDEO_OVERLAY(sink))
     253#endif
    200254        return;
    201255
     
    206260        m_videoWindow->prepareForOverlay(message);
    207261
     262#ifndef GST_API_VERSION_1
    208263// gst_x_overlay_set_window_handle was introduced in -plugins-base
    209264// 0.10.31, just like the macro for checking the version.
     
    213268        gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(sink), m_videoWindow->videoWindowId());
    214269#endif
     270#else
     271        gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(sink), m_videoWindow->videoWindowId());
     272#endif
    215273    }
    216274}
    217275
    218276}
    219 #endif // ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     277#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
  • trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h

    r111258 r141265  
    2121#ifndef GStreamerGWorld_h
    2222#define GStreamerGWorld_h
    23 #if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     23#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    2424
    2525#include <wtf/RefCounted.h>
     
    5050
    5151    GstElement* pipeline() const { return m_pipeline; }
     52    void removePlatformVideoSink();
    5253
    5354    // Returns the full-screen window created
     
    6869
    6970}
    70 #endif // ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     71#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    7172#endif
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r140685 r141265  
    269269    }
    270270
    271 #ifndef GST_API_VERSION_1
     271#if USE(NATIVE_FULLSCREEN_VIDEO)
    272272    if (m_videoSinkBin) {
    273273        gst_object_unref(m_videoSinkBin);
     
    659659    gst_stream_volume_set_volume(GST_STREAM_VOLUME(m_playBin.get()), GST_STREAM_VOLUME_FORMAT_CUBIC,
    660660                                 static_cast<double>(volume));
     661}
     662
     663float MediaPlayerPrivateGStreamer::volume() const
     664{
     665    if (!m_playBin)
     666        return 0;
     667
     668    return gst_stream_volume_get_volume(GST_STREAM_VOLUME(m_playBin.get()), GST_STREAM_VOLUME_FORMAT_CUBIC);
    661669}
    662670
     
    15411549
    15421550    g_object_set(m_playBin.get(), "mute", muted, NULL);
     1551}
     1552
     1553bool MediaPlayerPrivateGStreamer::muted() const
     1554{
     1555    if (!m_playBin)
     1556        return false;
     1557
     1558    bool muted;
     1559    g_object_get(m_playBin.get(), "mute", &muted, NULL);
     1560    return muted;
    15431561}
    15441562
     
    17411759}
    17421760
     1761#if USE(NATIVE_FULLSCREEN_VIDEO)
     1762void MediaPlayerPrivateGStreamer::enterFullscreen()
     1763{
     1764    notImplemented();
     1765}
     1766
     1767void MediaPlayerPrivateGStreamer::exitFullscreen()
     1768{
     1769    notImplemented();
     1770}
     1771#endif
     1772
    17431773bool MediaPlayerPrivateGStreamer::supportsFullscreen() const
    17441774{
     
    17541784{
    17551785    PlatformMedia p;
    1756 #ifndef GST_API_VERSION_1
     1786#if USE(NATIVE_FULLSCREEN_VIDEO)
    17571787    p.type = PlatformMedia::GStreamerGWorldType;
    17581788    p.media.gstreamerGWorld = m_gstGWorld.get();
     
    18441874    m_playBin = gst_element_factory_make(gPlaybinName, "play");
    18451875
    1846 #ifndef GST_API_VERSION_1
    1847     m_gstGWorld = GStreamerGWorld::createGWorld(m_playBin.get());
    1848 #endif
    1849 
    18501876    GRefPtr<GstBus> bus = webkitGstPipelineGetBus(GST_PIPELINE(m_playBin.get()));
    18511877    gst_bus_add_signal_watch(bus.get());
     
    18601886    g_signal_connect(m_playBin.get(), "audio-changed", G_CALLBACK(mediaPlayerPrivateAudioChangedCallback), this);
    18611887
    1862 #ifndef GST_API_VERSION_1
     1888#if USE(NATIVE_FULLSCREEN_VIDEO)
     1889    m_gstGWorld = GStreamerGWorld::createGWorld(m_playBin.get());
    18631890    m_webkitVideoSink = webkitVideoSinkNew(m_gstGWorld.get());
    18641891#else
     
    18701897
    18711898
    1872 #ifndef GST_API_VERSION_1
    1873     m_videoSinkBin = gst_bin_new("video-sink");
    1874 
    1875     GstElement* videoTee = gst_element_factory_make("tee", "videoTee");
    1876     GstElement* queue = gst_element_factory_make("queue", 0);
    1877 
    1878     // Take ownership.
    1879     gst_object_ref_sink(m_videoSinkBin);
    1880 
     1899#if USE(NATIVE_FULLSCREEN_VIDEO)
    18811900    // Build a new video sink consisting of a bin containing a tee
    18821901    // (meant to distribute data to multiple video sinks) and our
    18831902    // internal video sink. For fullscreen we create an autovideosink
    18841903    // and initially block the data flow towards it and configure it
     1904
     1905    m_videoSinkBin = gst_bin_new("video-sink");
     1906
     1907    // Take ownership.
     1908    gst_object_ref_sink(m_videoSinkBin);
     1909
     1910    GstElement* videoTee = gst_element_factory_make("tee", "videoTee");
     1911    GstElement* queue = gst_element_factory_make("queue", 0);
     1912
     1913#ifdef GST_API_VERSION_1
     1914    GRefPtr<GstPad> sinkPad = adoptGRef(gst_element_get_static_pad(videoTee, "sink"));
     1915    GST_OBJECT_FLAG_SET(GST_OBJECT(sinkPad.get()), GST_PAD_FLAG_PROXY_ALLOCATION);
     1916#endif
    18851917
    18861918    gst_bin_add_many(GST_BIN(m_videoSinkBin), videoTee, queue, NULL);
     
    19111943            if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_fpsSink), "video-sink")) {
    19121944                g_object_set(m_fpsSink, "video-sink", m_webkitVideoSink, NULL);
    1913 #ifndef GST_API_VERSION_1
     1945#if USE(NATIVE_FULLSCREEN_VIDEO)
    19141946                gst_bin_add(GST_BIN(m_videoSinkBin), m_fpsSink);
    19151947#endif
     
    19221954
    19231955    if (!m_fpsSink) {
    1924 #ifndef GST_API_VERSION_1
     1956#if USE(NATIVE_FULLSCREEN_VIDEO)
    19251957        gst_bin_add(GST_BIN(m_videoSinkBin), m_webkitVideoSink);
    19261958#endif
     
    19301962    ASSERT(actualVideoSink);
    19311963
    1932 #ifndef GST_API_VERSION_1
     1964#if USE(NATIVE_FULLSCREEN_VIDEO)
    19331965    // Faster elements linking.
    19341966    gst_element_link_pads_full(queue, "src", actualVideoSink, "sink", GST_PAD_LINK_CHECK_NOTHING);
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

    r140685 r141265  
    4040namespace WebCore {
    4141
     42#ifdef FullscreenVideoControllerClass
     43class FullscreenVideoControllerClass;
     44#endif
     45
    4246class GraphicsContext;
    4347class IntSize;
     
    7680
    7781            void setVolume(float);
     82            float volume() const;
    7883            void volumeChanged();
    7984            void notifyPlayerOfVolumeChange();
     
    8186            bool supportsMuting() const;
    8287            void setMuted(bool);
     88            bool muted() const;
    8389            void muteChanged();
    8490            void notifyPlayerOfMute();
     
    94100            bool didLoadingProgress() const;
    95101            unsigned totalBytes() const;
     102            float maxTimeLoaded() const;
    96103
    97104            void setVisible(bool);
     
    111118            bool hasSingleSecurityOrigin() const;
    112119
     120#if USE(NATIVE_FULLSCREEN_VIDEO)
     121            void enterFullscreen();
     122            void exitFullscreen();
     123            bool canEnterFullscreen() const { return true; }
     124#endif
     125
    113126            bool supportsFullscreen() const;
    114127            PlatformMedia platformMedia() const;
     
    128141            MediaPlayer::MovieLoadType movieLoadType() const;
    129142
     143            MediaPlayer* mediaPlayer() const { return m_player; }
     144
    130145        private:
    131146            MediaPlayerPrivateGStreamer(MediaPlayer*);
     
    145160            void cacheDuration();
    146161            void updateStates();
    147             float maxTimeLoaded() const;
    148162
    149163            void createGSTPlayBin();
     
    192206            bool m_mediaDurationKnown;
    193207            mutable float m_maxTimeLoadedAtLastDidLoadingProgress;
    194 #ifndef GST_API_VERSION_1
     208#if USE(NATIVE_FULLSCREEN_VIDEO)
    195209            RefPtr<GStreamerGWorld> m_gstGWorld;
     210#ifdef FullscreenVideoControllerClass
     211            OwnPtr<FullscreenVideoControllerClass> m_fullscreenVideoController;
     212#endif
    196213#endif
    197214            guint m_volumeTimerHandler;
  • trunk/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindow.h

    r109915 r141265  
    2020#ifndef PlatformVideoWindow_h
    2121#define PlatformVideoWindow_h
    22 #if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     22#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    2323
    2424#include "Widget.h"
     
    6262}
    6363
    64 #endif // USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     64#endif // USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    6565#endif
  • trunk/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowGtk.cpp

    r109915 r141265  
    2020#include "config.h"
    2121#include "PlatformVideoWindow.h"
    22 #if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     22#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    2323
    2424#include <gtk/gtk.h>
     
    4949PlatformVideoWindow::~PlatformVideoWindow()
    5050{
    51     if (m_videoWindow && m_window) {
    52         gtk_container_remove(GTK_CONTAINER(m_window), m_videoWindow);
     51    if (m_videoWindow) {
    5352        gtk_widget_destroy(m_videoWindow);
    5453        m_videoWindow = 0;
     
    6665{
    6766}
    68 #endif // ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     67#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    6968
  • trunk/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowPrivate.h

    r125603 r141265  
    2020#ifndef PlatformVideoWindowPrivate_h
    2121#define PlatformVideoWindowPrivate_h
     22#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    2223
    2324#include <QEvent>
     
    5657} // namespace WebCore
    5758
    58 
     59#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    5960#endif // PlatformVideoWindowPrivate_h
  • trunk/Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowQt.cpp

    r136707 r141265  
    2020#include "config.h"
    2121#include "PlatformVideoWindow.h"
    22 #if ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     22#if ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    2323
    2424#include "HTMLVideoElement.h"
     
    131131{
    132132}
    133 #endif // ENABLE(VIDEO) && USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     133#endif // ENABLE(VIDEO) && USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
  • trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp

    r131387 r141265  
    8282#endif
    8383
    84 #ifndef GST_API_VERSION_1
     84#if USE(NATIVE_FULLSCREEN_VIDEO)
    8585    WebCore::GStreamerGWorld* gstGWorld;
    8686#endif
     
    155155    }
    156156
    157 #ifndef GST_API_VERSION_1
     157#if USE(NATIVE_FULLSCREEN_VIDEO)
    158158    // Ignore buffers if the video is already in fullscreen using
    159159    // another sink.
     
    419419
    420420
    421 #ifndef GST_API_VERSION_1
     421#if USE(NATIVE_FULLSCREEN_VIDEO)
    422422GstElement* webkitVideoSinkNew(WebCore::GStreamerGWorld* gstGWorld)
    423423{
  • trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.h

    r120790 r141265  
    2323#if ENABLE(VIDEO) && USE(GSTREAMER)
    2424
    25 #ifndef GST_API_VERSION_1
     25#if USE(NATIVE_FULLSCREEN_VIDEO)
    2626#include "GStreamerGWorld.h"
    2727#endif
     
    6262GType webkit_video_sink_get_type() G_GNUC_CONST;
    6363
    64 #ifndef GST_API_VERSION_1
     64#if USE(NATIVE_FULLSCREEN_VIDEO)
    6565GstElement* webkitVideoSinkNew(WebCore::GStreamerGWorld*);
    6666#else
  • trunk/Source/WebKit/qt/ChangeLog

    r141259 r141265  
     12013-01-26  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] USE(NATIVE_FULLSCREEN_VIDEO) support
     4        https://bugs.webkit.org/show_bug.cgi?id=106760
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Build fixes for GStreamer NATIVE_FULLSCREEN_VIDEO support. Some
     9        more changes will be needed to use the new
     10        FullscreenVideoController though.
     11
     12        * WebCoreSupport/ChromeClientQt.cpp:
     13        (WebCore::ChromeClientQt::ChromeClientQt):
     14        (WebCore::ChromeClientQt::~ChromeClientQt):
     15        * WebCoreSupport/FullScreenVideoQt.cpp:
     16        (WebCore):
     17        (WebCore::FullScreenVideoQt::FullScreenVideoQt):
     18        (WebCore::FullScreenVideoQt::~FullScreenVideoQt):
     19        (WebCore::FullScreenVideoQt::enterFullScreenForNode):
     20        (WebCore::FullScreenVideoQt::exitFullScreenForNode):
     21        (WebCore::FullScreenVideoQt::isValid):
     22        * WebCoreSupport/FullScreenVideoQt.h:
     23        (WebCore):
     24        (FullScreenVideoQt):
     25
    1262013-01-30  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    227
  • trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r139078 r141265  
    7676#include <wtf/OwnPtr.h>
    7777
    78 #if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     78#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
    7979#include "FullScreenVideoQt.h"
    8080#include "HTMLMediaElement.h"
     
    127127    : m_webPage(webPageAdapter)
    128128    , m_eventLoop(0)
    129 #if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     129#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
    130130    , m_fullScreenVideo(0)
    131131#endif
     
    139139        m_eventLoop->exit();
    140140
    141 #if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     141#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
    142142    delete m_fullScreenVideo;
    143143#endif
     
    678678#endif
    679679
    680 #if ENABLE(VIDEO) && ((USE(GSTREAMER) && !defined(GST_API_VERSION_1)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     680#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
    681681FullScreenVideoQt* ChromeClientQt::fullScreenVideo()
    682682{
  • trunk/Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r139078 r141265  
    161161#endif
    162162
    163 #if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA) || USE(QTKIT))
     163#if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA) || USE(QTKIT))
    164164    virtual bool supportsFullscreenForNode(const Node*);
    165165    virtual void enterFullscreenForNode(Node*);
  • trunk/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp

    r135515 r141265  
    4545namespace WebCore {
    4646
    47 #if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     47#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    4848GStreamerFullScreenVideoHandler::GStreamerFullScreenVideoHandler()
    4949    : m_videoElement(0)
     
    100100#endif
    101101
    102 #if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     102#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    103103    m_FullScreenVideoHandlerGStreamer = new GStreamerFullScreenVideoHandler;
    104104#endif
     
    114114    delete m_FullScreenVideoHandler;
    115115#endif
    116 #if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     116#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    117117    delete m_FullScreenVideoHandlerGStreamer;
    118118#endif
     
    144144#endif
    145145
    146 #if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     146#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    147147    m_FullScreenVideoHandlerGStreamer->setVideoElement(m_videoElement);
    148148    m_FullScreenVideoHandlerGStreamer->enterFullScreen();
     
    175175    mediaPlayerQt->restoreVideoItem();
    176176#endif
    177 #if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     177#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    178178    m_FullScreenVideoHandlerGStreamer->exitFullScreen();
    179179#endif
     
    214214    return m_FullScreenVideoHandler;
    215215#endif
    216 #if USE(GSTREAMER) && !defined(GST_API_VERSION_1)
     216#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    217217    return m_FullScreenVideoHandlerGStreamer;
    218218#elif USE(QTKIT)
  • trunk/Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h

    r135515 r141265  
    4444
    4545// We do not use ENABLE or USE because moc does not expand these macros.
    46 #if defined(WTF_USE_GSTREAMER) && WTF_USE_GSTREAMER && !defined(GST_API_VERSION_1)
     46#if defined(WTF_USE_GSTREAMER) && WTF_USE_GSTREAMER && defined(WTF_USE_NATIVE_FULLSCREEN_VIDEO) && WTF_USE_NATIVE_FULLSCREEN_VIDEO
    4747class FullScreenVideoWindow;
    4848
     
    9191    QWebFullScreenVideoHandler* m_FullScreenVideoHandler;
    9292#endif
    93 #if USE(GSTREAMER)
     93#if USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)
    9494    GStreamerFullScreenVideoHandler* m_FullScreenVideoHandlerGStreamer;
    9595#endif
Note: See TracChangeset for help on using the changeset viewer.