Changeset 141695 in webkit


Ignore:
Timestamp:
Feb 2, 2013 8:00:53 AM (11 years ago)
Author:
Philippe Normand
Message:

[GStreamer] webkitwebsrc is exposed to application-side
https://bugs.webkit.org/show_bug.cgi?id=108088

Reviewed by Martin Robinson.

Switch the webkitwebsrc to handle webkit+http(s) uris so it is now
explicit that this element is meant to be used preferrably inside
WebKit. This change is internal to the player.

No new tests, covered by existing http/tests/media tests.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:

(WebCore::MediaPlayerPrivateGStreamer::setPlaybinURL):
(WebCore):
(WebCore::MediaPlayerPrivateGStreamer::load):

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:

(MediaPlayerPrivateGStreamer):

  • platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:

(webKitWebSrcGetProtocols):
(webKitWebSrcSetUri):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141694 r141695  
     12013-02-01  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] webkitwebsrc is exposed to application-side
     4        https://bugs.webkit.org/show_bug.cgi?id=108088
     5
     6        Reviewed by Martin Robinson.
     7
     8        Switch the webkitwebsrc to handle webkit+http(s) uris so it is now
     9        explicit that this element is meant to be used preferrably inside
     10        WebKit. This change is internal to the player.
     11
     12        No new tests, covered by existing http/tests/media tests.
     13
     14        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     15        (WebCore::MediaPlayerPrivateGStreamer::setPlaybinURL):
     16        (WebCore):
     17        (WebCore::MediaPlayerPrivateGStreamer::load):
     18        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
     19        (MediaPlayerPrivateGStreamer):
     20        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
     21        (webKitWebSrcGetProtocols):
     22        (webKitWebSrcSetUri):
     23
    1242013-02-02  Simon Hausmann  <simon.hausmann@digia.com>
    225
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r141566 r141695  
    305305}
    306306
     307KURL MediaPlayerPrivateGStreamer::convertPlaybinURL(const gchar* uri)
     308{
     309    KURL url(KURL(), uri);
     310
     311    ASSERT(url.protocol().substring(0, 7) == "webkit+");
     312    url.setProtocol(url.protocol().substring(7));
     313    return url;
     314}
     315
     316void MediaPlayerPrivateGStreamer::setPlaybinURL(KURL& url)
     317{
     318    // Clean out everything after file:// url path.
     319    if (url.isLocalFile())
     320        url.removeFragmentIdentifier();
     321
     322    m_url = url;
     323
     324    if (url.protocolIsInHTTPFamily())
     325        url.setProtocol("webkit+" + url.protocol());
     326
     327    LOG_MEDIA_MESSAGE("Load %s", url.string().utf8().data());
     328    g_object_set(m_playBin.get(), "uri", url.string().utf8().data(), NULL);
     329}
     330
    307331void MediaPlayerPrivateGStreamer::load(const String& url)
    308332{
    309333    if (!initializeGStreamerAndRegisterWebKitElements())
    310334        return;
    311 
    312     KURL kurl(KURL(), url);
    313     String cleanUrl(url);
    314 
    315     // Clean out everything after file:// url path.
    316     if (kurl.isLocalFile())
    317         cleanUrl = cleanUrl.substring(0, kurl.pathEnd());
    318335
    319336    if (!m_playBin) {
     
    324341    ASSERT(m_playBin);
    325342
    326     m_url = KURL(KURL(), cleanUrl);
    327     g_object_set(m_playBin.get(), "uri", cleanUrl.utf8().data(), NULL);
    328 
    329     LOG_MEDIA_MESSAGE("Load %s", cleanUrl.utf8().data());
     343    KURL kurl(KURL(), url);
     344    setPlaybinURL(kurl);
    330345
    331346    if (m_preload == MediaPlayer::None) {
     
    14161431        // append the value of new-location to it.
    14171432
    1418         gchar* currentLocation = 0;
    1419         g_object_get(m_playBin.get(), "uri", &currentLocation, NULL);
    1420 
    1421         KURL currentUrl(KURL(), currentLocation);
    1422         g_free(currentLocation);
    1423 
    14241433        KURL newUrl;
    1425 
    14261434        if (gst_uri_is_valid(newLocation))
    14271435            newUrl = KURL(KURL(), newLocation);
    14281436        else
    1429             newUrl = KURL(KURL(), currentUrl.baseAsString() + newLocation);
    1430 
    1431         RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(currentUrl);
     1437            newUrl = KURL(KURL(), m_url.baseAsString() + newLocation);
     1438
     1439        RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(m_url);
    14321440        if (securityOrigin->canRequest(newUrl)) {
    14331441            LOG_MEDIA_MESSAGE("New media url: %s", newUrl.string().utf8().data());
     
    14471455            if (state <= GST_STATE_READY) {
    14481456                // Set the new uri and start playing.
    1449                 g_object_set(m_playBin.get(), "uri", newUrl.string().utf8().data(), NULL);
     1457                setPlaybinURL(newUrl);
    14501458                gst_element_set_state(m_playBin.get(), GST_STATE_PLAYING);
    14511459                return true;
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

    r141566 r141695  
    140140            MediaPlayer* mediaPlayer() const { return m_player; }
    141141
     142            static KURL convertPlaybinURL(const gchar* uri);
     143
    142144        private:
    143145            MediaPlayerPrivateGStreamer(MediaPlayer*);
     
    147149            static void getSupportedTypes(HashSet<String>&);
    148150            static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs, const KURL&);
     151
     152            void setPlaybinURL(KURL&);
    149153
    150154            static bool isAvailable();
  • trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp

    r140425 r141695  
    2727#include "GStreamerVersioning.h"
    2828#include "MediaPlayer.h"
     29#include "MediaPlayerPrivateGStreamer.h"
    2930#include "NetworkingContext.h"
    3031#include "NotImplemented.h"
     
    549550const gchar* const* webKitWebSrcGetProtocols(GType)
    550551{
    551     static const char* protocols[] = {"http", "https", 0 };
     552    static const char* const protocols[] = {"webkit+http", "webkit+https", 0 };
    552553    return protocols;
    553554}
     
    574575        return TRUE;
    575576
    576     KURL url(KURL(), uri);
     577    KURL url = WebCore::MediaPlayerPrivateGStreamer::convertPlaybinURL(uri);
    577578
    578579    if (!url.isValid() || !url.protocolIsInHTTPFamily()) {
     
    593594static gchar** webKitWebSrcGetProtocols(void)
    594595{
    595     static gchar* protocols[] = {(gchar*) "http", (gchar*) "https", 0 };
     596    static gchar* protocols[] = {(gchar*) "webkit+http", (gchar*) "webkit+https", 0 };
    596597    return protocols;
    597598}
     
    618619        return TRUE;
    619620
    620     KURL url(KURL(), uri);
     621    KURL url = WebCore::MediaPlayerPrivateGStreamer::convertPlaybinURL(uri);
    621622
    622623    if (!url.isValid() || !url.protocolIsInHTTPFamily()) {
Note: See TracChangeset for help on using the changeset viewer.