Source/WebCore/ChangeLog

 12013-06-07 Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
 2
 3 [GStreamer] [texmap] upload a video buffer into the video texture
 4 https://bugs.webkit.org/show_bug.cgi?id=116042
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Handle the new buffer's metadata available in GStreamer 1.2 for
 9 uploading buffers into a texture.
 10
 11 If the decoder provides buffers with this metadata, the buffer will be
 12 uploaded into the texture used for the video display and it will be
 13 rendered, avoiding a expensive mem copies. This is particularly useful
 14 for Full HD videos, where all the processing and display will be done
 15 in the GPU.
 16
 17 No new tests, covered by existing tests.
 18
 19 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
 20 (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
 21 (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):
 22 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
 23 * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
 24 (webkitVideoSinkProposeAllocation):
 25
1262013-06-06 Carlos Garcia Campos <cgarcia@igalia.com>
227
328 Make CachedResource virtual methods overridden in derived classes private

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

5151#include <gst/interfaces/streamvolume.h>
5252#endif
5353
 54#ifdef GST_API_VERSION_1
 55#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
 56#include "TextureMapperGL.h"
 57#endif
 58#endif
 59
5460GST_DEBUG_CATEGORY(webkit_media_player_debug);
5561#define GST_CAT_DEFAULT webkit_media_player_debug
5662

@@void MediaPlayerPrivateGStreamerBase::updateTexture(GstBuffer* buffer)
339345 if (m_texture->size() != size)
340346 m_texture->reset(size);
341347
 348#if GST_CHECK_VERSION(1, 1, 0)
 349 GstVideoGLTextureUploadMeta* meta = gst_buffer_get_video_gl_texture_upload_meta(buffer);
 350 bool ret = false;
 351
 352 if (meta) {
 353 const BitmapTextureGL* textureGL = static_cast<const BitmapTextureGL*>(m_texture.get());
 354 guint ids[4] = { textureGL->id(), 0, 0, 0 };
 355
 356 ret = gst_video_gl_texture_upload_meta_upload(meta, ids);
 357 }
 358
 359 if (!ret) // fallback
 360#endif
 361
 362 { // copy the buffer into the texture
342363#ifdef GST_API_VERSION_1
343  GstMapInfo srcInfo;
344  gst_buffer_map(buffer, &srcInfo, GST_MAP_READ);
345  srcData = srcInfo.data;
 364 GstMapInfo srcInfo;
 365 gst_buffer_map(buffer, &srcInfo, GST_MAP_READ);
 366 srcData = srcInfo.data;
346367#else
347  srcData = GST_BUFFER_DATA(buffer);
 368 srcData = GST_BUFFER_DATA(buffer);
348369#endif
349370
350  // @TODO: support cropping
351  m_texture->updateContents(srcData, WebCore::IntRect(WebCore::IntPoint(0, 0), size), WebCore::IntPoint(0, 0), size.width() * 4, BitmapTexture::UpdateCannotModifyOriginalImageData);
 371 // @TODO: support cropping
 372 m_texture->updateContents(srcData, WebCore::IntRect(WebCore::IntPoint(0, 0), size), WebCore::IntPoint(0, 0), size.width() * 4, BitmapTexture::UpdateCannotModifyOriginalImageData);
352373
353374#ifdef GST_API_VERSION_1
354  gst_buffer_unmap(buffer, &srcInfo);
 375 gst_buffer_unmap(buffer, &srcInfo);
355376#endif
 377 }
356378
357379 client()->setPlatformLayerNeedsDisplay();
358380}

Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp

4040#endif
4141#include <wtf/FastAllocBase.h>
4242
 43#if GST_CHECK_VERSION(1, 1, 0)
 44#define GST_SURFACE_CAPS "video/x-surface, opengl=true; "
 45#else
 46#define GST_SURFACE_CAPS
 47#endif
 48
4349// CAIRO_FORMAT_RGB24 used to render the video buffers is little/big endian dependant.
4450#if G_BYTE_ORDER == G_LITTLE_ENDIAN
4551#ifndef GST_API_VERSION_1
4652#define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_BGRx ";" GST_VIDEO_CAPS_BGRA
4753#else
48 #define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_MAKE("{ BGRx, BGRA }")
 54#define WEBKIT_VIDEO_SINK_PAD_CAPS GST_SURFACE_CAPS GST_VIDEO_CAPS_MAKE("{ BGRx, BGRA }")
4955#endif
5056#else
5157#ifndef GST_API_VERSION_1
5258#define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_ARGB
5359#else
54 #define WEBKIT_VIDEO_SINK_PAD_CAPS GST_VIDEO_CAPS_MAKE("{ xRGB, ARGB }")
 60#define WEBKIT_VIDEO_SINK_PAD_CAPS GST_SURFACE_CAPS GST_VIDEO_CAPS_MAKE("{ xRGB, ARGB }")
5561#endif
5662#endif
5763static GstStaticPadTemplate s_sinkTemplate = GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS(WEBKIT_VIDEO_SINK_PAD_CAPS));

@@static gboolean webkitVideoSinkProposeAllocation(GstBaseSink* baseSink, GstQuery
351357
352358 gst_query_add_allocation_meta(query, GST_VIDEO_META_API_TYPE, 0);
353359 gst_query_add_allocation_meta(query, GST_VIDEO_CROP_META_API_TYPE, 0);
 360#if GST_CHECK_VERSION(1, 1, 0)
 361 gst_query_add_allocation_meta(query, GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, 0);
 362#endif
354363 return TRUE;
355364}
356365#endif