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" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 void WebMediaPlayerClientImpl::loadInternal() | 223 void WebMediaPlayerClientImpl::loadInternal() |
224 { | 224 { |
225 #if ENABLE(WEB_AUDIO) | 225 #if ENABLE(WEB_AUDIO) |
226 m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's
WebAudioSourceProvider. | 226 m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's
WebAudioSourceProvider. |
227 #endif | 227 #endif |
228 | 228 |
229 // FIXME: Remove this cast | 229 // FIXME: Remove this cast |
230 Frame* frame = static_cast<HTMLMediaElement*>(m_client)->document().frame(); | 230 Frame* frame = static_cast<HTMLMediaElement*>(m_client)->document().frame(); |
231 | 231 |
| 232 WebURL poster = m_client->mediaPlayerPosterURL(); |
| 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) |
| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 676 |
666 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 677 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
667 { | 678 { |
668 if (m_client) | 679 if (m_client) |
669 m_client->setFormat(numberOfChannels, sampleRate); | 680 m_client->setFormat(numberOfChannels, sampleRate); |
670 } | 681 } |
671 | 682 |
672 #endif | 683 #endif |
673 | 684 |
674 } // namespace blink | 685 } // namespace blink |
OLD | NEW |