Changeset 150014 in webkit
- Timestamp:
- May 13, 2013 8:14:46 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150013 r150014 1 2013-05-13 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> 2 3 [texmap][GStreamer] Composited Video support 4 https://bugs.webkit.org/show_bug.cgi?id=86410 5 6 Reviewed by Philippe Normand. 7 8 Enable the video accelerated compositing using the WebKit's 9 TextureMapper. 10 11 This patch does not use hardware accelerated video decoding. It 12 provides a generic path for system memory buffers. 13 14 No new tests, already covered by existing tests. 15 16 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 17 (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase): 18 (WebCore): 19 (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): update the 20 texture content with the new received video buffer. 21 (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): choose to 22 use the accelerated compositing or the normal code path 23 (WebCore::MediaPlayerPrivateGStreamerBase::paint): if accelerated 24 compositing is used this method is halted. 25 (WebCore::MediaPlayerPrivateGStreamerBase::paintToTextureMapper): get 26 a texture from the pool and draws it if it is already available. 27 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 28 (MediaPlayerPrivateGStreamerBase): 29 (WebCore::MediaPlayerPrivateGStreamerBase::platformLayer): returns itself 30 (WebCore::MediaPlayerPrivateGStreamerBase::supportsAcceleratedRendering): 31 returns true 32 1 33 2013-05-13 Andreas Kling <akling@apple.com> 2 34 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r149543 r150014 112 112 , m_volumeSignalHandler(0) 113 113 , m_muteSignalHandler(0) 114 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) 115 , m_texture(0) 116 #endif 114 117 { 115 118 } … … 298 301 } 299 302 303 304 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) 305 void MediaPlayerPrivateGStreamerBase::updateTexture(GstBuffer* buffer) 306 { 307 if (!m_texture) 308 return; 309 310 if (!client()) 311 return; 312 313 const void* srcData = 0; 314 IntSize size = naturalSize(); 315 316 if (m_texture->size() != size) 317 m_texture->reset(size); 318 319 #ifdef GST_API_VERSION_1 320 GstMapInfo srcInfo; 321 gst_buffer_map(buffer, &srcInfo, GST_MAP_READ); 322 srcData = srcInfo.data; 323 #else 324 srcData = GST_BUFFER_DATA(buffer); 325 #endif 326 327 // @TODO: support cropping 328 m_texture->updateContents(srcData, WebCore::IntRect(WebCore::IntPoint(0, 0), size), WebCore::IntPoint(0, 0), size.width() * 4, BitmapTexture::UpdateCannotModifyOriginalImageData); 329 330 #ifdef GST_API_VERSION_1 331 gst_buffer_unmap(buffer, &srcInfo); 332 #endif 333 334 client()->setPlatformLayerNeedsDisplay(); 335 } 336 #endif 337 300 338 void MediaPlayerPrivateGStreamerBase::triggerRepaint(GstBuffer* buffer) 301 339 { 302 340 g_return_if_fail(GST_IS_BUFFER(buffer)); 303 gst_buffer_replace(&m_buffer, buffer); 304 m_player->repaint(); 341 342 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) 343 if (supportsAcceleratedRendering() && m_player->mediaPlayerClient()->mediaPlayerRenderingCanBeAccelerated(m_player)) 344 updateTexture(buffer); 345 else 346 #endif 347 { 348 gst_buffer_replace(&m_buffer, buffer); 349 m_player->repaint(); 350 } 305 351 } 306 352 … … 312 358 void MediaPlayerPrivateGStreamerBase::paint(GraphicsContext* context, const IntRect& rect) 313 359 { 360 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) 361 if (m_texture) 362 return; 363 #endif 364 314 365 if (context->paintingDisabled()) 315 366 return; … … 332 383 rect, gstImage->rect(), CompositeCopy, DoNotRespectImageOrientation, false); 333 384 } 385 386 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) 387 void MediaPlayerPrivateGStreamerBase::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity) 388 { 389 if (textureMapper->accelerationMode() != TextureMapper::OpenGLMode) 390 return; 391 392 if (!m_texture) { 393 m_texture = textureMapper->acquireTextureFromPool(naturalSize()); 394 return; 395 } 396 397 textureMapper->drawTexture(*m_texture.get(), targetRect, matrix, opacity); 398 } 399 #endif 334 400 335 401 #if USE(NATIVE_FULLSCREEN_VIDEO) -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
r142406 r150014 30 30 #include <wtf/Forward.h> 31 31 32 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) 33 #include "TextureMapperPlatformLayer.h" 34 #endif 35 32 36 typedef struct _GstBuffer GstBuffer; 33 37 typedef struct _GstElement GstElement; … … 44 48 class GStreamerGWorld; 45 49 46 class MediaPlayerPrivateGStreamerBase : public MediaPlayerPrivateInterface { 50 class MediaPlayerPrivateGStreamerBase : public MediaPlayerPrivateInterface 51 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) 52 , public TextureMapperPlatformLayer 53 #endif 54 { 47 55 48 56 public: … … 94 102 unsigned videoDecodedByteCount() const; 95 103 104 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) 105 virtual PlatformLayer* platformLayer() const { return const_cast<MediaPlayerPrivateGStreamerBase*>(this); } 106 virtual bool supportsAcceleratedRendering() const { return true; } 107 virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float); 108 #endif 109 96 110 protected: 97 111 MediaPlayerPrivateGStreamerBase(MediaPlayer*); … … 120 134 GRefPtr<GstPad> m_videoSinkPad; 121 135 mutable IntSize m_videoSize; 136 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) 137 void updateTexture(GstBuffer*); 138 RefPtr<BitmapTexture> m_texture; 139 #endif 122 140 }; 123 141 }
Note: See TracChangeset
for help on using the changeset viewer.