| 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 "WebMediaPlayerClientImpl.h" | 6 #include "WebMediaPlayerClientImpl.h" |
| 7 | 7 |
| 8 #include "InbandTextTrackPrivateImpl.h" | 8 #include "InbandTextTrackPrivateImpl.h" |
| 9 #include "WebAudioSourceProvider.h" | 9 #include "WebAudioSourceProvider.h" |
| 10 #include "WebDocument.h" | 10 #include "WebDocument.h" |
| 11 #include "WebFrameClient.h" | 11 #include "WebFrameClient.h" |
| 12 #include "WebFrameImpl.h" | 12 #include "WebFrameImpl.h" |
| 13 #include "WebHelperPluginImpl.h" | 13 #include "WebHelperPluginImpl.h" |
| 14 #include "WebInbandTextTrack.h" | 14 #include "WebInbandTextTrack.h" |
| 15 #include "WebMediaPlayer.h" | 15 #include "WebMediaPlayer.h" |
| 16 #include "WebMediaSourceImpl.h" | 16 #include "WebMediaSourceImpl.h" |
| 17 #include "WebViewImpl.h" | 17 #include "WebViewImpl.h" |
| 18 #include "core/html/HTMLMediaElement.h" | 18 #include "core/html/HTMLMediaElement.h" |
| 19 #include "core/html/TimeRanges.h" | 19 #include "core/html/TimeRanges.h" |
| 20 #include "core/page/Frame.h" | 20 #include "core/page/Frame.h" |
| 21 #include "core/platform/KURL.h" | 21 #include "core/platform/KURL.h" |
| 22 #include "core/platform/NotImplemented.h" | 22 #include "core/platform/NotImplemented.h" |
| 23 #include "core/platform/audio/AudioBus.h" | 23 #include "core/platform/audio/AudioBus.h" |
| 24 #include "core/platform/audio/AudioSourceProvider.h" | 24 #include "core/platform/audio/AudioSourceProvider.h" |
| 25 #include "core/platform/audio/AudioSourceProviderClient.h" | 25 #include "core/platform/audio/AudioSourceProviderClient.h" |
| 26 #include "core/platform/chromium/support/GraphicsContext3DPrivate.h" | |
| 27 #include "core/platform/graphics/GraphicsContext.h" | 26 #include "core/platform/graphics/GraphicsContext.h" |
| 28 #include "core/platform/graphics/IntSize.h" | 27 #include "core/platform/graphics/IntSize.h" |
| 29 #include "core/platform/graphics/MediaPlayer.h" | 28 #include "core/platform/graphics/MediaPlayer.h" |
| 30 #include "core/platform/graphics/chromium/GraphicsLayerChromium.h" | 29 #include "core/platform/graphics/chromium/GraphicsLayerChromium.h" |
| 31 #include "core/rendering/RenderLayerCompositor.h" | 30 #include "core/rendering/RenderLayerCompositor.h" |
| 32 #include "core/rendering/RenderView.h" | 31 #include "core/rendering/RenderView.h" |
| 33 #include "modules/mediastream/MediaStreamRegistry.h" | 32 #include "modules/mediastream/MediaStreamRegistry.h" |
| 34 #include <public/Platform.h> | 33 #include <public/Platform.h> |
| 35 #include <public/WebCanvas.h> | 34 #include <public/WebCanvas.h> |
| 36 #include <public/WebCompositorSupport.h> | 35 #include <public/WebCompositorSupport.h> |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 } | 597 } |
| 599 | 598 |
| 600 bool WebMediaPlayerClientImpl::copyVideoTextureToPlatformTexture(WebCore::Graphi
csContext3D* context, Platform3DObject texture, GC3Dint level, GC3Denum type, GC
3Denum internalFormat, bool premultiplyAlpha, bool flipY) | 599 bool WebMediaPlayerClientImpl::copyVideoTextureToPlatformTexture(WebCore::Graphi
csContext3D* context, Platform3DObject texture, GC3Dint level, GC3Denum type, GC
3Denum internalFormat, bool premultiplyAlpha, bool flipY) |
| 601 { | 600 { |
| 602 if (!context || !m_webMediaPlayer) | 601 if (!context || !m_webMediaPlayer) |
| 603 return false; | 602 return false; |
| 604 Extensions3D* extensions = context->getExtensions(); | 603 Extensions3D* extensions = context->getExtensions(); |
| 605 if (!extensions || !extensions->supports("GL_CHROMIUM_copy_texture") || !ext
ensions->supports("GL_CHROMIUM_flipy") | 604 if (!extensions || !extensions->supports("GL_CHROMIUM_copy_texture") || !ext
ensions->supports("GL_CHROMIUM_flipy") |
| 606 || !extensions->canUseCopyTextureCHROMIUM(internalFormat, type, level) |
| !context->makeContextCurrent()) | 605 || !extensions->canUseCopyTextureCHROMIUM(internalFormat, type, level) |
| !context->makeContextCurrent()) |
| 607 return false; | 606 return false; |
| 608 WebGraphicsContext3D* webGraphicsContext3D = GraphicsContext3DPrivate::extra
ctWebGraphicsContext3D(context); | 607 WebGraphicsContext3D* webGraphicsContext3D = GraphicsContext3D::extractWebGr
aphicsContext3D(context); |
| 609 return m_webMediaPlayer->copyVideoTextureToPlatformTexture(webGraphicsContex
t3D, texture, level, internalFormat, type, premultiplyAlpha, flipY); | 608 return m_webMediaPlayer->copyVideoTextureToPlatformTexture(webGraphicsContex
t3D, texture, level, internalFormat, type, premultiplyAlpha, flipY); |
| 610 } | 609 } |
| 611 | 610 |
| 612 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) | 611 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) |
| 613 { | 612 { |
| 614 m_preload = preload; | 613 m_preload = preload; |
| 615 | 614 |
| 616 if (m_webMediaPlayer) | 615 if (m_webMediaPlayer) |
| 617 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); | 616 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa
d)); |
| 618 | 617 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 if (!ct) | 754 if (!ct) |
| 756 return; | 755 return; |
| 757 m_texture.reset(ct->createUncachedTexture(desc, NULL, 0)); | 756 m_texture.reset(ct->createUncachedTexture(desc, NULL, 0)); |
| 758 if (!m_texture.get()) | 757 if (!m_texture.get()) |
| 759 return; | 758 return; |
| 760 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, videoWidth, videoHeight)
; | 759 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, videoWidth, videoHeight)
; |
| 761 m_bitmap.setPixelRef(new SkGrPixelRef(m_texture))->unref(); | 760 m_bitmap.setPixelRef(new SkGrPixelRef(m_texture))->unref(); |
| 762 } | 761 } |
| 763 | 762 |
| 764 // Copy video texture to bitmap texture. | 763 // Copy video texture to bitmap texture. |
| 765 WebGraphicsContext3D* webGraphicsContext3D = GraphicsContext3DPrivate::extra
ctWebGraphicsContext3D(context3D); | 764 WebGraphicsContext3D* webGraphicsContext3D = GraphicsContext3D::extractWebGr
aphicsContext3D(context3D); |
| 766 WebCanvas* canvas = context->canvas(); | 765 WebCanvas* canvas = context->canvas(); |
| 767 unsigned int textureId = static_cast<unsigned int>(m_texture->getTextureHand
le()); | 766 unsigned int textureId = static_cast<unsigned int>(m_texture->getTextureHand
le()); |
| 768 if (!m_webMediaPlayer->copyVideoTextureToPlatformTexture(webGraphicsContext3
D, textureId, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, true
, false)) | 767 if (!m_webMediaPlayer->copyVideoTextureToPlatformTexture(webGraphicsContext3
D, textureId, 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, true
, false)) |
| 769 return; | 768 return; |
| 770 | 769 |
| 771 // 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, | 770 // 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, |
| 772 // the texture based bitmap will be readbacked to system memory then draw on
to the canvas. | 771 // the texture based bitmap will be readbacked to system memory then draw on
to the canvas. |
| 773 SkRect dest; | 772 SkRect dest; |
| 774 dest.set(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height
()); | 773 dest.set(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height
()); |
| 775 SkPaint paint; | 774 SkPaint paint; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 | 848 |
| 850 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) | 849 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel
s, float sampleRate) |
| 851 { | 850 { |
| 852 if (m_client) | 851 if (m_client) |
| 853 m_client->setFormat(numberOfChannels, sampleRate); | 852 m_client->setFormat(numberOfChannels, sampleRate); |
| 854 } | 853 } |
| 855 | 854 |
| 856 #endif | 855 #endif |
| 857 | 856 |
| 858 } // namespace WebKit | 857 } // namespace WebKit |
| OLD | NEW |