diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 22:42:15 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 22:42:15 +0000 |
commit | 83f2a8a62298f97b0b8b7ccfb02da26d8abcf96e (patch) | |
tree | ec339f6512b03bf215bb64eb66b26097dbf1b36a /webkit | |
parent | 6f004f1b37d04d790bd8d15575705bc4840ed74e (diff) | |
download | chromium_src-83f2a8a62298f97b0b8b7ccfb02da26d8abcf96e.zip chromium_src-83f2a8a62298f97b0b8b7ccfb02da26d8abcf96e.tar.gz chromium_src-83f2a8a62298f97b0b8b7ccfb02da26d8abcf96e.tar.bz2 |
Finished implementation of hasAudio() to detect media without playback audio tracks.
There is a WebKit side to this patch out for review as well:
https://bugs.webkit.org/show_bug.cgi?id=28310
BUG=18970
TEST=play a video without audio (i.e., trek0.ogv), the UI should display a disabled audio icon
Review URL: http://codereview.chromium.org/171091
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23671 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/api/public/WebMediaPlayer.h | 3 | ||||
-rw-r--r-- | webkit/api/src/WebMediaPlayerClientImpl.cpp | 7 | ||||
-rw-r--r-- | webkit/api/src/WebMediaPlayerClientImpl.h | 1 | ||||
-rw-r--r-- | webkit/glue/webmediaplayer_impl.cc | 3 | ||||
-rw-r--r-- | webkit/glue/webmediaplayer_impl.h | 2 |
5 files changed, 14 insertions, 2 deletions
diff --git a/webkit/api/public/WebMediaPlayer.h b/webkit/api/public/WebMediaPlayer.h index 56bc967..ddd88e4 100644 --- a/webkit/api/public/WebMediaPlayer.h +++ b/webkit/api/public/WebMediaPlayer.h @@ -90,8 +90,9 @@ namespace WebKit { virtual void paint(WebCanvas*, const WebRect&) = 0; - // True if a video is loaded. + // True if the loaded media has a playable video/audio track. virtual bool hasVideo() const = 0; + virtual bool hasAudio() const = 0; // Dimension of the video. virtual WebSize naturalSize() const = 0; diff --git a/webkit/api/src/WebMediaPlayerClientImpl.cpp b/webkit/api/src/WebMediaPlayerClientImpl.cpp index 54cbce8..e9d5220 100644 --- a/webkit/api/src/WebMediaPlayerClientImpl.cpp +++ b/webkit/api/src/WebMediaPlayerClientImpl.cpp @@ -150,6 +150,13 @@ bool WebMediaPlayerClientImpl::hasVideo() const return false; } +bool WebMediaPlayerClientImpl::hasAudio() const +{ + if (m_webMediaPlayer.get()) + return m_webMediaPlayer->hasAudio(); + return false; +} + void WebMediaPlayerClientImpl::setVisible(bool visible) { if (m_webMediaPlayer.get()) diff --git a/webkit/api/src/WebMediaPlayerClientImpl.h b/webkit/api/src/WebMediaPlayerClientImpl.h index 721073c..c4d8063 100644 --- a/webkit/api/src/WebMediaPlayerClientImpl.h +++ b/webkit/api/src/WebMediaPlayerClientImpl.h @@ -70,6 +70,7 @@ namespace WebKit { virtual bool supportsSave() const; virtual WebCore::IntSize naturalSize() const; virtual bool hasVideo() const; + virtual bool hasAudio() const; virtual void setVisible(bool); virtual float duration() const; virtual float currentTime() const; diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index 00c6834..9eae37b 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -471,6 +471,9 @@ void WebMediaPlayerImpl::OnPipelineInitialize() { // as format error. Should post a task to call to |webmediaplayer_|. SetNetworkState(WebKit::WebMediaPlayer::FormatError); } + + // Repaint to trigger UI update. + Repaint(); } void WebMediaPlayerImpl::OnPipelineSeek() { diff --git a/webkit/glue/webmediaplayer_impl.h b/webkit/glue/webmediaplayer_impl.h index bd4a6e8..f6d7fd3 100644 --- a/webkit/glue/webmediaplayer_impl.h +++ b/webkit/glue/webmediaplayer_impl.h @@ -181,7 +181,7 @@ class WebMediaPlayerImpl : public WebKit::WebMediaPlayer, virtual void paint(WebKit::WebCanvas* canvas, const WebKit::WebRect& rect); - // True if a video is loaded. + // True if the loaded media has a playable video/audio track. virtual bool hasVideo() const; virtual bool hasAudio() const; |