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 if (!poster.isEmpty()) { | |
whywhat
2014/02/04 15:51:58
nit: you don't need the curly braces for a one-lin
| |
248 m_webMediaPlayer->setPoster(poster); | |
249 } | |
250 | |
245 // Tell WebMediaPlayer about any connected CDM (may be null). | 251 // Tell WebMediaPlayer about any connected CDM (may be null). |
246 m_webMediaPlayer->setContentDecryptionModule(m_cdm); | 252 m_webMediaPlayer->setContentDecryptionModule(m_cdm); |
247 | 253 |
248 WebMediaPlayer::CORSMode corsMode = static_cast<WebMediaPlayer::CORSMode >(m_client->mediaPlayerCORSMode()); | 254 WebMediaPlayer::CORSMode corsMode = static_cast<WebMediaPlayer::CORSMode >(m_client->mediaPlayerCORSMode()); |
249 m_webMediaPlayer->load(m_loadType, m_url, corsMode); | 255 m_webMediaPlayer->load(m_loadType, m_url, corsMode); |
250 } | 256 } |
251 } | 257 } |
252 | 258 |
253 void WebMediaPlayerClientImpl::play() | 259 void WebMediaPlayerClientImpl::play() |
254 { | 260 { |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 | 671 |
666 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) | 672 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) |
667 { | 673 { |
668 if (m_client) | 674 if (m_client) |
669 m_client->setFormat(numberOfChannels, sampleRate); | 675 m_client->setFormat(numberOfChannels, sampleRate); |
670 } | 676 } |
671 | 677 |
672 #endif | 678 #endif |
673 | 679 |
674 } // namespace blink | 680 } // namespace blink |
OLD | NEW |