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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF
::String& url, WebMediaPlayer::CORSMode corsMode) | 184 void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF
::String& url, WebMediaPlayer::CORSMode corsMode) |
185 { | 185 { |
186 ASSERT(!m_webMediaPlayer); | 186 ASSERT(!m_webMediaPlayer); |
187 | 187 |
188 // FIXME: Remove this cast | 188 // FIXME: Remove this cast |
189 LocalFrame* frame = mediaElement().document().frame(); | 189 LocalFrame* frame = mediaElement().document().frame(); |
190 | 190 |
191 WebURL poster = m_client->mediaPlayerPosterURL(); | 191 WebURL poster = m_client->mediaPlayerPosterURL(); |
192 | 192 |
193 KURL kurl(ParsedURLString, url); | 193 KURL kurl(ParsedURLString, url); |
194 m_webMediaPlayer = createWebMediaPlayer(this, kurl, frame); | 194 m_webMediaPlayer = createWebMediaPlayer(this, kurl, frame, HTMLMediaElementE
ncryptedMedia::contentDecryptionModule(mediaElement())); |
195 if (!m_webMediaPlayer) | 195 if (!m_webMediaPlayer) |
196 return; | 196 return; |
197 | 197 |
198 #if ENABLE(WEB_AUDIO) | 198 #if ENABLE(WEB_AUDIO) |
199 // Make sure if we create/re-create the WebMediaPlayer that we update our wr
apper. | 199 // Make sure if we create/re-create the WebMediaPlayer that we update our wr
apper. |
200 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); | 200 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); |
201 #endif | 201 #endif |
202 | 202 |
203 m_webMediaPlayer->setVolume(mediaElement().effectiveMediaVolume()); | 203 m_webMediaPlayer->setVolume(mediaElement().effectiveMediaVolume()); |
204 | 204 |
205 m_webMediaPlayer->setPoster(poster); | 205 m_webMediaPlayer->setPoster(poster); |
206 | 206 |
207 // Tell WebMediaPlayer about any connected CDM (may be null). | |
208 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia:
:contentDecryptionModule(mediaElement())); | |
209 m_webMediaPlayer->load(loadType, kurl, corsMode); | 207 m_webMediaPlayer->load(loadType, kurl, corsMode); |
210 } | 208 } |
211 | 209 |
212 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) | 210 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) |
213 { | 211 { |
214 if (m_webMediaPlayer) | 212 if (m_webMediaPlayer) |
215 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); | 213 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); |
216 } | 214 } |
217 | 215 |
218 #if ENABLE(WEB_AUDIO) | 216 #if ENABLE(WEB_AUDIO) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 290 } |
293 | 291 |
294 void WebMediaPlayerClientImpl::AudioClientImpl::trace(Visitor* visitor) | 292 void WebMediaPlayerClientImpl::AudioClientImpl::trace(Visitor* visitor) |
295 { | 293 { |
296 visitor->trace(m_client); | 294 visitor->trace(m_client); |
297 } | 295 } |
298 | 296 |
299 #endif | 297 #endif |
300 | 298 |
301 } // namespace blink | 299 } // namespace blink |
OLD | NEW |