Changeset 150890 in webkit
- Timestamp:
- May 29, 2013 6:24:51 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150882 r150890 1 2013-05-29 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> 2 3 [texmap][GStreamer][GTK] Composited Video support 4 https://bugs.webkit.org/show_bug.cgi?id=86410 5 6 Reviewed by Noam Rosenthal. 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 This new functionality is only available when the coordinated graphics 15 system is not used. 16 17 No new tests, already covered by existing tests. 18 19 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: 20 (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase): 21 (WebCore): 22 (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): update the 23 texture content with the new received video buffer. 24 (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): choose to 25 use the accelerated compositing or the normal code path 26 (WebCore::MediaPlayerPrivateGStreamerBase::paint): if accelerated 27 compositing is used this method is halted. 28 (WebCore::MediaPlayerPrivateGStreamerBase::paintToTextureMapper): get 29 a texture from the pool and draws it if it is already available. 30 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h: 31 (MediaPlayerPrivateGStreamerBase): 32 (WebCore::MediaPlayerPrivateGStreamerBase::platformLayer): returns itself 33 (WebCore::MediaPlayerPrivateGStreamerBase::supportsAcceleratedRendering): 34 returns true 35 1 36 2013-05-29 Peter Gal <galpeter@inf.u-szeged.hu> 2 37 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
r150035 r150890 112 112 , m_volumeSignalHandler(0) 113 113 , m_muteSignalHandler(0) 114 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS) 115 , m_texture(0) 116 #endif 114 117 { 115 118 } … … 298 301 } 299 302 303 304 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS) 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) && !USE(COORDINATED_GRAPHICS) 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) && !USE(COORDINATED_GRAPHICS) 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) && !USE(COORDINATED_GRAPHICS) 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
r150035 r150890 30 30 #include <wtf/Forward.h> 31 31 32 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS) 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) && !USE(COORDINATED_GRAPHICS) 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) && !USE(COORDINATED_GRAPHICS) 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) && !USE(COORDINATED_GRAPHICS) 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.