[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

vestbo at webkit.org vestbo at webkit.org
Wed Dec 22 12:13:00 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 08527e137fc1e85bbebb543521ac6ee5e56447f6
Author: vestbo at webkit.org <vestbo at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 17 12:15:25 2010 +0000

    [Qt] Add media element support for preload=none
    
    Reviewed by Antonio Gomes.
    
    * platform/graphics/qt/MediaPlayerPrivateQt.cpp:
    * platform/graphics/qt/MediaPlayerPrivateQt.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65495 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 67543fe..80b348d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,15 @@
 
         Reviewed by Antonio Gomes.
 
+        [Qt] Add media element support for preload=none
+
+        * platform/graphics/qt/MediaPlayerPrivateQt.cpp:
+        * platform/graphics/qt/MediaPlayerPrivateQt.h:
+
+2010-08-17  Tor Arne Vestbø  <tor.arne.vestbo at nokia.com>
+
+        Reviewed by Antonio Gomes.
+
         [Qt] Pre-roll media when loading media elements
 
         This ensures we get correct size-hints from QtMultimedia, as well as
diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
index dd0aad2..4ad5571 100644
--- a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
+++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
@@ -96,6 +96,7 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
     , m_isSeeking(false)
     , m_composited(false)
     , m_queuedSeek(-1)
+    , m_preload(MediaPlayer::Auto)
 {
     m_mediaPlayer->bind(m_videoItem);
     m_videoScene->addItem(m_videoItem);
@@ -148,6 +149,20 @@ bool MediaPlayerPrivate::hasAudio() const
 
 void MediaPlayerPrivate::load(const String& url)
 {
+    m_mediaUrl = url;
+
+    // QtMultimedia does not have an API to throttle loading
+    // so we handle this ourselves by delaying the load
+    if (m_preload == MediaPlayer::None) {
+        m_delayingLoad = true;
+        return;
+    }
+
+    commitLoad(url);
+}
+
+void MediaPlayerPrivate::commitLoad(const String& url)
+{
     // We are now loading
     if (m_networkState != MediaPlayer::Loading) {
         m_networkState = MediaPlayer::Loading;
@@ -220,12 +235,26 @@ void MediaPlayerPrivate::load(const String& url)
         m_mediaPlayer->play();
 }
 
+void MediaPlayerPrivate::resumeLoad()
+{
+    m_delayingLoad = false;
+
+    if (!m_mediaUrl.isNull())
+        commitLoad(m_mediaUrl);
+}
+
 void MediaPlayerPrivate::cancelLoad()
 {
     m_mediaPlayer->setMedia(QMediaContent());
     updateStates();
 }
 
+void MediaPlayerPrivate::prepareToPlay()
+{
+    if (m_mediaPlayer->media().isNull() || m_delayingLoad)
+        resumeLoad();
+}
+
 void MediaPlayerPrivate::play()
 {
     if (m_mediaPlayer->state() != QMediaPlayer::PlayingState)
@@ -347,6 +376,13 @@ unsigned MediaPlayerPrivate::totalBytes() const
     return 100;
 }
 
+void MediaPlayerPrivate::setPreload(MediaPlayer::Preload preload)
+{
+    m_preload = preload;
+    if (m_delayingLoad && m_preload != MediaPlayer::None)
+        resumeLoad();
+}
+
 void MediaPlayerPrivate::setRate(float rate)
 {
     m_mediaPlayer->setPlaybackRate(rate);
diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
index 8c0e1dd..165efde 100644
--- a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
+++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
@@ -50,10 +50,13 @@ public:
     bool hasAudio() const;
 
     void load(const String &url);
+    void commitLoad(const String& url);
+    void resumeLoad();
     void cancelLoad();
 
     void play();
     void pause();
+    void prepareToPlay();
 
     bool paused() const;
     bool seeking() const;
@@ -68,6 +71,8 @@ public:
     bool supportsMuting() const;
     void setMuted(bool);
 
+    void setPreload(MediaPlayer::Preload);
+
     MediaPlayer::NetworkState networkState() const;
     MediaPlayer::ReadyState readyState() const;
 
@@ -128,6 +133,10 @@ private:
     bool m_isSeeking;
     bool m_composited;
     qint64 m_queuedSeek;
+    MediaPlayer::Preload m_preload;
+    bool m_delayingLoad;
+    String m_mediaUrl;
+
 };
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list