| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 { | 227 { |
| 228 if (m_webMediaPlayer) | 228 if (m_webMediaPlayer) |
| 229 m_webMediaPlayer->exitFullscreen(); | 229 m_webMediaPlayer->exitFullscreen(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 bool WebMediaPlayerClientImpl::canShowFullscreenOverlay() const | 232 bool WebMediaPlayerClientImpl::canShowFullscreenOverlay() const |
| 233 { | 233 { |
| 234 return m_webMediaPlayer && m_webMediaPlayer->canEnterFullscreen(); | 234 return m_webMediaPlayer && m_webMediaPlayer->canEnterFullscreen(); |
| 235 } | 235 } |
| 236 | 236 |
| 237 IntSize WebMediaPlayerClientImpl::naturalSize() const | |
| 238 { | |
| 239 if (m_webMediaPlayer) | |
| 240 return m_webMediaPlayer->naturalSize(); | |
| 241 return IntSize(); | |
| 242 } | |
| 243 | |
| 244 bool WebMediaPlayerClientImpl::hasVideo() const | |
| 245 { | |
| 246 if (m_webMediaPlayer) | |
| 247 return m_webMediaPlayer->hasVideo(); | |
| 248 return false; | |
| 249 } | |
| 250 | |
| 251 bool WebMediaPlayerClientImpl::hasAudio() const | 237 bool WebMediaPlayerClientImpl::hasAudio() const |
| 252 { | 238 { |
| 253 if (m_webMediaPlayer) | 239 if (m_webMediaPlayer) |
| 254 return m_webMediaPlayer->hasAudio(); | 240 return m_webMediaPlayer->hasAudio(); |
| 255 return false; | 241 return false; |
| 256 } | 242 } |
| 257 | 243 |
| 258 double WebMediaPlayerClientImpl::duration() const | 244 double WebMediaPlayerClientImpl::duration() const |
| 259 { | 245 { |
| 260 if (m_webMediaPlayer) | 246 if (m_webMediaPlayer) |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); | 370 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); |
| 385 } | 371 } |
| 386 | 372 |
| 387 bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const | 373 bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const |
| 388 { | 374 { |
| 389 if (m_webMediaPlayer) | 375 if (m_webMediaPlayer) |
| 390 return m_webMediaPlayer->hasSingleSecurityOrigin(); | 376 return m_webMediaPlayer->hasSingleSecurityOrigin(); |
| 391 return false; | 377 return false; |
| 392 } | 378 } |
| 393 | 379 |
| 394 bool WebMediaPlayerClientImpl::didPassCORSAccessCheck() const | |
| 395 { | |
| 396 if (m_webMediaPlayer) | |
| 397 return m_webMediaPlayer->didPassCORSAccessCheck(); | |
| 398 return false; | |
| 399 } | |
| 400 | |
| 401 double WebMediaPlayerClientImpl::mediaTimeForTimeValue(double timeValue) const | 380 double WebMediaPlayerClientImpl::mediaTimeForTimeValue(double timeValue) const |
| 402 { | 381 { |
| 403 if (m_webMediaPlayer) | 382 if (m_webMediaPlayer) |
| 404 return m_webMediaPlayer->mediaTimeForTimeValue(timeValue); | 383 return m_webMediaPlayer->mediaTimeForTimeValue(timeValue); |
| 405 return timeValue; | 384 return timeValue; |
| 406 } | 385 } |
| 407 | 386 |
| 408 unsigned WebMediaPlayerClientImpl::decodedFrameCount() const | |
| 409 { | |
| 410 if (m_webMediaPlayer) | |
| 411 return m_webMediaPlayer->decodedFrameCount(); | |
| 412 return 0; | |
| 413 } | |
| 414 | |
| 415 unsigned WebMediaPlayerClientImpl::droppedFrameCount() const | |
| 416 { | |
| 417 if (m_webMediaPlayer) | |
| 418 return m_webMediaPlayer->droppedFrameCount(); | |
| 419 return 0; | |
| 420 } | |
| 421 | |
| 422 unsigned WebMediaPlayerClientImpl::corruptedFrameCount() const | |
| 423 { | |
| 424 if (m_webMediaPlayer) | |
| 425 return m_webMediaPlayer->corruptedFrameCount(); | |
| 426 return 0; | |
| 427 } | |
| 428 | |
| 429 unsigned WebMediaPlayerClientImpl::audioDecodedByteCount() const | 387 unsigned WebMediaPlayerClientImpl::audioDecodedByteCount() const |
| 430 { | 388 { |
| 431 if (m_webMediaPlayer) | 389 if (m_webMediaPlayer) |
| 432 return m_webMediaPlayer->audioDecodedByteCount(); | 390 return m_webMediaPlayer->audioDecodedByteCount(); |
| 433 return 0; | 391 return 0; |
| 434 } | 392 } |
| 435 | 393 |
| 436 unsigned WebMediaPlayerClientImpl::videoDecodedByteCount() const | 394 unsigned WebMediaPlayerClientImpl::videoDecodedByteCount() const |
| 437 { | 395 { |
| 438 if (m_webMediaPlayer) | 396 if (m_webMediaPlayer) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 462 if (!context || !context3D || !m_webMediaPlayer || context->paintingDisabled
()) | 420 if (!context || !context3D || !m_webMediaPlayer || context->paintingDisabled
()) |
| 463 return; | 421 return; |
| 464 | 422 |
| 465 if (!context3D->makeContextCurrent()) | 423 if (!context3D->makeContextCurrent()) |
| 466 return; | 424 return; |
| 467 | 425 |
| 468 // Copy video texture into a RGBA texture based bitmap first as video textur
e on Android is GL_TEXTURE_EXTERNAL_OES | 426 // Copy video texture into a RGBA texture based bitmap first as video textur
e on Android is GL_TEXTURE_EXTERNAL_OES |
| 469 // which is not supported by Skia yet. The bitmap's size needs to be the sam
e as the video and use naturalSize() here. | 427 // which is not supported by Skia yet. The bitmap's size needs to be the sam
e as the video and use naturalSize() here. |
| 470 // Check if we could reuse existing texture based bitmap. | 428 // Check if we could reuse existing texture based bitmap. |
| 471 // Otherwise, release existing texture based bitmap and allocate a new one b
ased on video size. | 429 // Otherwise, release existing texture based bitmap and allocate a new one b
ased on video size. |
| 472 if (!ensureTextureBackedSkBitmap(provider->grContext(), m_bitmap, naturalSiz
e(), kTopLeft_GrSurfaceOrigin, kSkia8888_GrPixelConfig)) | 430 if (!ensureTextureBackedSkBitmap(provider->grContext(), m_bitmap, m_webMedia
Player->naturalSize(), kTopLeft_GrSurfaceOrigin, kSkia8888_GrPixelConfig)) |
| 473 return; | 431 return; |
| 474 | 432 |
| 475 // Copy video texture to bitmap texture. | 433 // Copy video texture to bitmap texture. |
| 476 WebCanvas* canvas = context->canvas(); | 434 WebCanvas* canvas = context->canvas(); |
| 477 unsigned textureId = static_cast<unsigned>((m_bitmap.getTexture())->getTextu
reHandle()); | 435 unsigned textureId = static_cast<unsigned>((m_bitmap.getTexture())->getTextu
reHandle()); |
| 478 if (!m_webMediaPlayer->copyVideoTextureToPlatformTexture(context3D, textureI
d, 0, GL_RGBA, GL_UNSIGNED_BYTE, true, false)) | 436 if (!m_webMediaPlayer->copyVideoTextureToPlatformTexture(context3D, textureI
d, 0, GL_RGBA, GL_UNSIGNED_BYTE, true, false)) |
| 479 return; | 437 return; |
| 480 | 438 |
| 481 // Draw the texture based bitmap onto the Canvas. If the canvas is hardware
based, this will do a GPU-GPU texture copy. If the canvas is software based, | 439 // Draw the texture based bitmap onto the Canvas. If the canvas is hardware
based, this will do a GPU-GPU texture copy. If the canvas is software based, |
| 482 // the texture based bitmap will be readbacked to system memory then draw on
to the canvas. | 440 // the texture based bitmap will be readbacked to system memory then draw on
to the canvas. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 512 |
| 555 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 513 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
| 556 { | 514 { |
| 557 if (m_client) | 515 if (m_client) |
| 558 m_client->setFormat(numberOfChannels, sampleRate); | 516 m_client->setFormat(numberOfChannels, sampleRate); |
| 559 } | 517 } |
| 560 | 518 |
| 561 #endif | 519 #endif |
| 562 | 520 |
| 563 } // namespace blink | 521 } // namespace blink |
| OLD | NEW |