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 "web/WebMediaPlayerClientImpl.h" | 6 #include "web/WebMediaPlayerClientImpl.h" |
7 | 7 |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "core/html/HTMLMediaElement.h" | 9 #include "core/html/HTMLMediaElement.h" |
10 #include "core/html/TimeRanges.h" | 10 #include "core/html/TimeRanges.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "SkCanvas.h" | 43 #include "SkCanvas.h" |
44 #include "SkGrPixelRef.h" | 44 #include "SkGrPixelRef.h" |
45 #endif | 45 #endif |
46 | 46 |
47 | 47 |
48 #include "wtf/Assertions.h" | 48 #include "wtf/Assertions.h" |
49 #include "wtf/text/CString.h" | 49 #include "wtf/text/CString.h" |
50 | 50 |
51 namespace blink { | 51 namespace blink { |
52 | 52 |
53 static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* cli
ent, const WebURL& url, LocalFrame* frame) | 53 static PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(WebMediaPlayerClient* cli
ent, const WebURL& url, LocalFrame* frame, WebContentDecryptionModule* initialCd
m) |
54 { | 54 { |
55 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); | 55 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(frame); |
56 | 56 |
57 if (!webFrame || !webFrame->client()) | 57 if (!webFrame || !webFrame->client()) |
58 return nullptr; | 58 return nullptr; |
59 return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, url, client)
); | 59 return adoptPtr(webFrame->client()->createMediaPlayer(webFrame, url, client,
initialCdm)); |
60 } | 60 } |
61 | 61 |
62 WebMediaPlayer* WebMediaPlayerClientImpl::webMediaPlayer() const | 62 WebMediaPlayer* WebMediaPlayerClientImpl::webMediaPlayer() const |
63 { | 63 { |
64 return m_webMediaPlayer.get(); | 64 return m_webMediaPlayer.get(); |
65 } | 65 } |
66 | 66 |
67 // WebMediaPlayerClient -------------------------------------------------------- | 67 // WebMediaPlayerClient -------------------------------------------------------- |
68 | 68 |
69 WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl() | 69 WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl() |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF
::String& url, WebMediaPlayer::CORSMode corsMode) | 199 void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF
::String& url, WebMediaPlayer::CORSMode corsMode) |
200 { | 200 { |
201 ASSERT(!m_webMediaPlayer); | 201 ASSERT(!m_webMediaPlayer); |
202 | 202 |
203 // FIXME: Remove this cast | 203 // FIXME: Remove this cast |
204 LocalFrame* frame = mediaElement().document().frame(); | 204 LocalFrame* frame = mediaElement().document().frame(); |
205 | 205 |
206 WebURL poster = m_client->mediaPlayerPosterURL(); | 206 WebURL poster = m_client->mediaPlayerPosterURL(); |
207 | 207 |
208 KURL kurl(ParsedURLString, url); | 208 KURL kurl(ParsedURLString, url); |
209 m_webMediaPlayer = createWebMediaPlayer(this, kurl, frame); | 209 m_webMediaPlayer = createWebMediaPlayer(this, kurl, frame, HTMLMediaElementE
ncryptedMedia::contentDecryptionModule(mediaElement())); |
210 if (!m_webMediaPlayer) | 210 if (!m_webMediaPlayer) |
211 return; | 211 return; |
212 | 212 |
213 #if ENABLE(WEB_AUDIO) | 213 #if ENABLE(WEB_AUDIO) |
214 // Make sure if we create/re-create the WebMediaPlayer that we update our wr
apper. | 214 // Make sure if we create/re-create the WebMediaPlayer that we update our wr
apper. |
215 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); | 215 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); |
216 #endif | 216 #endif |
217 | 217 |
218 m_webMediaPlayer->setVolume(mediaElement().effectiveMediaVolume()); | 218 m_webMediaPlayer->setVolume(mediaElement().effectiveMediaVolume()); |
219 | 219 |
220 m_webMediaPlayer->setPoster(poster); | 220 m_webMediaPlayer->setPoster(poster); |
221 | 221 |
222 // Tell WebMediaPlayer about any connected CDM (may be null). | |
223 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia:
:contentDecryptionModule(mediaElement())); | |
224 m_webMediaPlayer->load(loadType, kurl, corsMode); | 222 m_webMediaPlayer->load(loadType, kurl, corsMode); |
225 } | 223 } |
226 | 224 |
227 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) | 225 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) |
228 { | 226 { |
229 if (m_webMediaPlayer) | 227 if (m_webMediaPlayer) |
230 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); | 228 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); |
231 } | 229 } |
232 | 230 |
233 #if ENABLE(WEB_AUDIO) | 231 #if ENABLE(WEB_AUDIO) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } | 305 } |
308 | 306 |
309 void WebMediaPlayerClientImpl::AudioClientImpl::trace(Visitor* visitor) | 307 void WebMediaPlayerClientImpl::AudioClientImpl::trace(Visitor* visitor) |
310 { | 308 { |
311 visitor->trace(m_client); | 309 visitor->trace(m_client); |
312 } | 310 } |
313 | 311 |
314 #endif | 312 #endif |
315 | 313 |
316 } // namespace blink | 314 } // namespace blink |
OLD | NEW |