Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: Source/web/WebMediaPlayerClientImpl.cpp

Issue 306123003: Eliminate MediaPlayer & MediaPlayerClient abstractions(seek, duration, poster APIs) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase with latest code Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 #if OS(ANDROID) 199 #if OS(ANDROID)
200 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream); 200 m_usePaintOnAndroid = (loadType != WebMediaPlayer::LoadTypeMediaStream);
201 #endif 201 #endif
202 202
203 // Tell WebMediaPlayer about any connected CDM (may be null). 203 // Tell WebMediaPlayer about any connected CDM (may be null).
204 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement())); 204 m_webMediaPlayer->setContentDecryptionModule(HTMLMediaElementEncryptedMedia: :contentDecryptionModule(mediaElement()));
205 m_webMediaPlayer->load(loadType, kurl, corsMode); 205 m_webMediaPlayer->load(loadType, kurl, corsMode);
206 } 206 }
207 207
208 double WebMediaPlayerClientImpl::duration() const
209 {
210 if (m_webMediaPlayer)
211 return m_webMediaPlayer->duration();
212 return 0.0;
213 }
214
215 double WebMediaPlayerClientImpl::currentTime() const
216 {
217 if (m_webMediaPlayer)
218 return m_webMediaPlayer->currentTime();
219 return 0.0;
220 }
221
222 void WebMediaPlayerClientImpl::seek(double time)
223 {
224 if (m_webMediaPlayer)
225 m_webMediaPlayer->seek(time);
226 }
227
228 bool WebMediaPlayerClientImpl::seeking() const
229 {
230 if (m_webMediaPlayer)
231 return m_webMediaPlayer->seeking();
232 return false;
233 }
234
235 double WebMediaPlayerClientImpl::rate() const 208 double WebMediaPlayerClientImpl::rate() const
236 { 209 {
237 return m_rate; 210 return m_rate;
238 } 211 }
239 212
240 void WebMediaPlayerClientImpl::setRate(double rate) 213 void WebMediaPlayerClientImpl::setRate(double rate)
241 { 214 {
242 m_rate = rate; 215 m_rate = rate;
243 if (m_webMediaPlayer) 216 if (m_webMediaPlayer)
244 m_webMediaPlayer->setRate(rate); 217 m_webMediaPlayer->setRate(rate);
245 } 218 }
246 219
247 void WebMediaPlayerClientImpl::setPoster(const KURL& poster)
248 {
249 if (m_webMediaPlayer)
250 m_webMediaPlayer->setPoster(WebURL(poster));
251 }
252
253 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const 220 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const
254 { 221 {
255 if (m_webMediaPlayer) 222 if (m_webMediaPlayer)
256 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate()); 223 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate());
257 return MediaPlayer::Empty; 224 return MediaPlayer::Empty;
258 } 225 }
259 226
260 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const 227 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const
261 { 228 {
262 if (m_webMediaPlayer) 229 if (m_webMediaPlayer)
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 401
435 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) 402 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate)
436 { 403 {
437 if (m_client) 404 if (m_client)
438 m_client->setFormat(numberOfChannels, sampleRate); 405 m_client->setFormat(numberOfChannels, sampleRate);
439 } 406 }
440 407
441 #endif 408 #endif
442 409
443 } // namespace blink 410 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698