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

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

Issue 304353005: Eliminate MediaPlayer & MediaPlayerClient abstractions(rate, setRate and other APIs) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase with latest Created 6 years, 5 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 m_webMediaPlayer->seek(time); 257 m_webMediaPlayer->seek(time);
258 } 258 }
259 259
260 bool WebMediaPlayerClientImpl::seeking() const 260 bool WebMediaPlayerClientImpl::seeking() const
261 { 261 {
262 if (m_webMediaPlayer) 262 if (m_webMediaPlayer)
263 return m_webMediaPlayer->seeking(); 263 return m_webMediaPlayer->seeking();
264 return false; 264 return false;
265 } 265 }
266 266
267 double WebMediaPlayerClientImpl::rate() const
268 {
269 return m_rate;
270 }
271
272 void WebMediaPlayerClientImpl::setRate(double rate)
273 {
274 m_rate = rate;
275 if (m_webMediaPlayer)
276 m_webMediaPlayer->setRate(rate);
277 }
278
279 bool WebMediaPlayerClientImpl::paused() const 267 bool WebMediaPlayerClientImpl::paused() const
280 { 268 {
281 if (m_webMediaPlayer) 269 if (m_webMediaPlayer)
282 return m_webMediaPlayer->paused(); 270 return m_webMediaPlayer->paused();
283 return false; 271 return false;
284 } 272 }
285 273
286 bool WebMediaPlayerClientImpl::supportsSave() const 274 bool WebMediaPlayerClientImpl::supportsSave() const
287 { 275 {
288 if (m_webMediaPlayer) 276 if (m_webMediaPlayer)
289 return m_webMediaPlayer->supportsSave(); 277 return m_webMediaPlayer->supportsSave();
290 return false; 278 return false;
291 } 279 }
292 280
293 void WebMediaPlayerClientImpl::setPoster(const KURL& poster) 281 void WebMediaPlayerClientImpl::setPoster(const KURL& poster)
294 { 282 {
295 if (m_webMediaPlayer) 283 if (m_webMediaPlayer)
296 m_webMediaPlayer->setPoster(WebURL(poster)); 284 m_webMediaPlayer->setPoster(WebURL(poster));
297 } 285 }
298 286
299 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const 287 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const
300 { 288 {
301 if (m_webMediaPlayer) 289 if (m_webMediaPlayer)
302 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate()); 290 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate());
303 return MediaPlayer::Empty; 291 return MediaPlayer::Empty;
304 } 292 }
305 293
306 double WebMediaPlayerClientImpl::maxTimeSeekable() const
307 {
308 if (m_webMediaPlayer)
309 return m_webMediaPlayer->maxTimeSeekable();
310 return 0.0;
311 }
312
313 PassRefPtr<TimeRanges> WebMediaPlayerClientImpl::buffered() const
314 {
315 if (m_webMediaPlayer)
316 return TimeRanges::create(m_webMediaPlayer->buffered());
317 return TimeRanges::create();
318 }
319
320 bool WebMediaPlayerClientImpl::didLoadingProgress() const
321 {
322 return m_webMediaPlayer && m_webMediaPlayer->didLoadingProgress();
323 }
324
325 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re ct) 294 void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re ct)
326 { 295 {
327 // Normally GraphicsContext operations do nothing when painting is disabled. 296 // Normally GraphicsContext operations do nothing when painting is disabled.
328 // Since we're accessing platformContext() directly we have to manually 297 // Since we're accessing platformContext() directly we have to manually
329 // check. 298 // check.
330 if (m_webMediaPlayer && !context->paintingDisabled()) { 299 if (m_webMediaPlayer && !context->paintingDisabled()) {
331 // On Android, video frame is emitted as GL_TEXTURE_EXTERNAL_OES texture . We use a different path to 300 // On Android, video frame is emitted as GL_TEXTURE_EXTERNAL_OES texture . We use a different path to
332 // paint the video frame into the context. 301 // paint the video frame into the context.
333 #if OS(ANDROID) 302 #if OS(ANDROID)
334 if (m_usePaintOnAndroid) { 303 if (m_usePaintOnAndroid) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 SkPaint paint; 387 SkPaint paint;
419 paint.setAlpha(alpha); 388 paint.setAlpha(alpha);
420 // It is not necessary to pass the dest into the drawBitmap call since all t he context have been set up before calling paintCurrentFrameInContext. 389 // It is not necessary to pass the dest into the drawBitmap call since all t he context have been set up before calling paintCurrentFrameInContext.
421 canvas->drawBitmapRect(m_bitmap, NULL, dest, &paint); 390 canvas->drawBitmapRect(m_bitmap, NULL, dest, &paint);
422 } 391 }
423 #endif 392 #endif
424 393
425 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client) 394 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client)
426 : m_client(client) 395 : m_client(client)
427 , m_preload(MediaPlayer::Auto) 396 , m_preload(MediaPlayer::Auto)
428 , m_rate(1.0)
429 #if OS(ANDROID) 397 #if OS(ANDROID)
430 , m_usePaintOnAndroid(false) 398 , m_usePaintOnAndroid(false)
431 #endif 399 #endif
432 { 400 {
433 ASSERT(m_client); 401 ASSERT(m_client);
434 } 402 }
435 403
436 WebCore::HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const 404 WebCore::HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const
437 { 405 {
438 return *static_cast<HTMLMediaElement*>(m_client); 406 return *static_cast<HTMLMediaElement*>(m_client);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 455
488 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) 456 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate)
489 { 457 {
490 if (m_client) 458 if (m_client)
491 m_client->setFormat(numberOfChannels, sampleRate); 459 m_client->setFormat(numberOfChannels, sampleRate);
492 } 460 }
493 461
494 #endif 462 #endif
495 463
496 } // namespace blink 464 } // 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