Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "WebMediaPlayerClientImpl.h" | 6 #include "WebMediaPlayerClientImpl.h" |
| 7 | 7 |
| 8 #include "WebDocument.h" | 8 #include "WebDocument.h" |
| 9 #include "WebFrameClient.h" | 9 #include "WebFrameClient.h" |
| 10 #include "WebFrameImpl.h" | 10 #include "WebFrameImpl.h" |
| 11 #include "WebHelperPlugin.h" | 11 #include "WebHelperPlugin.h" |
| 12 #include "WebViewImpl.h" | 12 #include "WebViewImpl.h" |
| 13 #include "core/frame/Frame.h" | 13 #include "core/frame/Frame.h" |
| 14 #include "core/html/HTMLMediaElement.h" | 14 #include "core/html/HTMLMediaElement.h" |
| 15 #include "core/html/HTMLVideoElement.h" | |
| 15 #include "core/html/TimeRanges.h" | 16 #include "core/html/TimeRanges.h" |
| 16 #include "core/rendering/RenderLayerCompositor.h" | 17 #include "core/rendering/RenderLayerCompositor.h" |
| 17 #include "core/rendering/RenderView.h" | 18 #include "core/rendering/RenderView.h" |
| 18 #include "modules/mediastream/MediaStreamRegistry.h" | 19 #include "modules/mediastream/MediaStreamRegistry.h" |
| 19 #include "platform/audio/AudioBus.h" | 20 #include "platform/audio/AudioBus.h" |
| 20 #include "platform/audio/AudioSourceProviderClient.h" | 21 #include "platform/audio/AudioSourceProviderClient.h" |
| 21 #include "platform/geometry/IntSize.h" | 22 #include "platform/geometry/IntSize.h" |
| 22 #include "platform/graphics/GraphicsContext.h" | 23 #include "platform/graphics/GraphicsContext.h" |
| 23 #include "platform/graphics/GraphicsContext3D.h" | 24 #include "platform/graphics/GraphicsContext3D.h" |
| 24 #include "platform/graphics/GraphicsLayer.h" | 25 #include "platform/graphics/GraphicsLayer.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 } | 222 } |
| 222 | 223 |
| 223 void WebMediaPlayerClientImpl::loadInternal() | 224 void WebMediaPlayerClientImpl::loadInternal() |
| 224 { | 225 { |
| 225 #if ENABLE(WEB_AUDIO) | 226 #if ENABLE(WEB_AUDIO) |
| 226 m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's WebAudioSourceProvider. | 227 m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's WebAudioSourceProvider. |
| 227 #endif | 228 #endif |
| 228 | 229 |
| 229 // FIXME: Remove this cast | 230 // FIXME: Remove this cast |
| 230 Frame* frame = static_cast<HTMLMediaElement*>(m_client)->document().frame(); | 231 Frame* frame = static_cast<HTMLMediaElement*>(m_client)->document().frame(); |
| 232 WebURL poster = static_cast<HTMLVideoElement*>(m_client)->posterImageURL(); | |
| 231 | 233 |
| 232 // This does not actually check whether the hardware can support accelerated | 234 // This does not actually check whether the hardware can support accelerated |
| 233 // compositing, but only if the flag is set. However, this is checked lazily | 235 // compositing, but only if the flag is set. However, this is checked lazily |
| 234 // in WebViewImpl::setIsAcceleratedCompositingActive() and will fail there | 236 // in WebViewImpl::setIsAcceleratedCompositingActive() and will fail there |
| 235 // if necessary. | 237 // if necessary. |
| 236 m_needsWebLayerForVideo = frame->contentRenderer()->compositor()->hasAcceler atedCompositing(); | 238 m_needsWebLayerForVideo = frame->contentRenderer()->compositor()->hasAcceler atedCompositing(); |
| 237 | 239 |
| 238 m_webMediaPlayer = createWebMediaPlayer(this, m_url, frame); | 240 m_webMediaPlayer = createWebMediaPlayer(this, m_url, frame); |
| 239 if (m_webMediaPlayer) { | 241 if (m_webMediaPlayer) { |
| 240 #if ENABLE(WEB_AUDIO) | 242 #if ENABLE(WEB_AUDIO) |
| 241 // Make sure if we create/re-create the WebMediaPlayer that we update ou r wrapper. | 243 // Make sure if we create/re-create the WebMediaPlayer that we update ou r wrapper. |
| 242 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); | 244 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); |
| 243 #endif | 245 #endif |
| 244 | 246 |
| 247 // Tell WebMediaPlayer about the poster image URL. | |
| 248 m_webMediaPlayer->setPoster(poster); | |
| 249 | |
| 245 // Tell WebMediaPlayer about any connected CDM (may be null). | 250 // Tell WebMediaPlayer about any connected CDM (may be null). |
| 246 m_webMediaPlayer->setContentDecryptionModule(m_cdm); | 251 m_webMediaPlayer->setContentDecryptionModule(m_cdm); |
| 247 | 252 |
| 248 WebMediaPlayer::CORSMode corsMode = static_cast<WebMediaPlayer::CORSMode >(m_client->mediaPlayerCORSMode()); | 253 WebMediaPlayer::CORSMode corsMode = static_cast<WebMediaPlayer::CORSMode >(m_client->mediaPlayerCORSMode()); |
| 249 m_webMediaPlayer->load(m_loadType, m_url, corsMode); | 254 m_webMediaPlayer->load(m_loadType, m_url, corsMode); |
| 250 } | 255 } |
| 251 } | 256 } |
| 252 | 257 |
| 253 void WebMediaPlayerClientImpl::play() | 258 void WebMediaPlayerClientImpl::play() |
| 254 { | 259 { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 m_webMediaPlayer->setVolume(volume); | 405 m_webMediaPlayer->setVolume(volume); |
| 401 } | 406 } |
| 402 | 407 |
| 403 void WebMediaPlayerClientImpl::setMuted(bool muted) | 408 void WebMediaPlayerClientImpl::setMuted(bool muted) |
| 404 { | 409 { |
| 405 m_muted = muted; | 410 m_muted = muted; |
| 406 if (m_webMediaPlayer) | 411 if (m_webMediaPlayer) |
| 407 m_webMediaPlayer->setVolume(muted ? 0 : m_volume); | 412 m_webMediaPlayer->setVolume(muted ? 0 : m_volume); |
| 408 } | 413 } |
| 409 | 414 |
| 415 void WebMediaPlayerClientImpl::setPoster(const KURL& poster) | |
| 416 { | |
| 417 if (m_webMediaPlayer && !poster.isEmpty()) | |
|
jochen (gone - plz use gerrit)
2014/02/07 14:41:36
why is it not possible to clear the poster url?
cimamoglu (inactive)
2014/02/07 14:52:10
Good point, missed that! Done.
| |
| 418 m_webMediaPlayer->setPoster(WebURL(poster)); | |
| 419 } | |
| 420 | |
| 410 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const | 421 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const |
| 411 { | 422 { |
| 412 if (m_webMediaPlayer) | 423 if (m_webMediaPlayer) |
| 413 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate()); | 424 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate()); |
| 414 return MediaPlayer::Empty; | 425 return MediaPlayer::Empty; |
| 415 } | 426 } |
| 416 | 427 |
| 417 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const | 428 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const |
| 418 { | 429 { |
| 419 if (m_webMediaPlayer) | 430 if (m_webMediaPlayer) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 | 680 |
| 670 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) | 681 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) |
| 671 { | 682 { |
| 672 if (m_client) | 683 if (m_client) |
| 673 m_client->setFormat(numberOfChannels, sampleRate); | 684 m_client->setFormat(numberOfChannels, sampleRate); |
| 674 } | 685 } |
| 675 | 686 |
| 676 #endif | 687 #endif |
| 677 | 688 |
| 678 } // namespace blink | 689 } // namespace blink |
| OLD | NEW |