summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/gstreamer
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/gstreamer')
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp6
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h1
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp9
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h3
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h4
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/ImageGStreamerQt.cpp5
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp8
-rw-r--r--Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp14
8 files changed, 24 insertions, 26 deletions
diff --git a/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
index 37468bc5c..deeb339d2 100644
--- a/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp
@@ -86,6 +86,12 @@ template <> void derefGPtr<GstPadTemplate>(GstPadTemplate* ptr)
gst_object_unref(GST_OBJECT(ptr));
}
+template <> GRefPtr<GstCaps> adoptGRef(GstCaps* ptr)
+{
+ ASSERT(!ptr || !gstObjectIsFloating(GST_OBJECT(ptr)));
+ return GRefPtr<GstCaps>(ptr, GRefPtrAdopt);
+}
+
template <> GstCaps* refGPtr<GstCaps>(GstCaps* ptr)
{
if (ptr)
diff --git a/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
index a3dcda8ae..5b0ed0db2 100644
--- a/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
+++ b/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h
@@ -45,6 +45,7 @@ template<> GRefPtr<GstPadTemplate> adoptGRef(GstPadTemplate* ptr);
template<> GstPadTemplate* refGPtr<GstPadTemplate>(GstPadTemplate* ptr);
template<> void derefGPtr<GstPadTemplate>(GstPadTemplate* ptr);
+template<> GRefPtr<GstCaps> adoptGRef(GstCaps* ptr);
template<> GstCaps* refGPtr<GstCaps>(GstCaps* ptr);
template<> void derefGPtr<GstCaps>(GstCaps* ptr);
diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp
index 3c3f367b9..638f480ff 100644
--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp
@@ -34,20 +34,19 @@ void webkitGstObjectRefSink(GstObject* gstObject)
#endif
}
-GstCaps* webkitGstGetPadCaps(GstPad* pad)
+GRefPtr<GstCaps> webkitGstGetPadCaps(GstPad* pad)
{
if (!pad)
return 0;
- GstCaps* caps;
#ifdef GST_API_VERSION_1
- caps = gst_pad_get_current_caps(pad);
+ GstCaps* caps = gst_pad_get_current_caps(pad);
if (!caps)
caps = gst_pad_query_caps(pad, 0);
+ return adoptGRef(caps); // gst_pad_query_caps and gst_pad_get_current_caps return a new reference.
#else
- caps = GST_PAD_CAPS(pad);
+ return GST_PAD_CAPS(pad);
#endif
- return caps;
}
bool getVideoSizeAndFormatFromCaps(GstCaps* caps, WebCore::IntSize& size, GstVideoFormat& format, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride)
diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h b/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h
index a8e5182f6..2ecf08cef 100644
--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h
+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.h
@@ -20,6 +20,7 @@
#ifndef GStreamerVersioning_h
#define GStreamerVersioning_h
+#include "GRefPtrGStreamer.h"
#include <gst/gst.h>
#include <gst/video/video.h>
@@ -28,7 +29,7 @@ class IntSize;
};
void webkitGstObjectRefSink(GstObject*);
-GstCaps* webkitGstGetPadCaps(GstPad*);
+GRefPtr<GstCaps> webkitGstGetPadCaps(GstPad*);
bool getVideoSizeAndFormatFromCaps(GstCaps*, WebCore::IntSize&, GstVideoFormat&, int& pixelAspectRatioNumerator, int& pixelAspectRatioDenominator, int& stride);
GstBuffer* createGstBuffer(GstBuffer*);
void setGstElementClassMetadata(GstElementClass*, const char* name, const char* longName, const char* description, const char* author);
diff --git a/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
index 7a0e5ee56..83bdfe2b7 100644
--- a/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
+++ b/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
@@ -29,10 +29,6 @@
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
-#if PLATFORM(QT)
-#include <QImage>
-#endif
-
namespace WebCore {
class IntSize;
diff --git a/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerQt.cpp b/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerQt.cpp
index d6e6e2afc..375026d1f 100644
--- a/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerQt.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerQt.cpp
@@ -67,8 +67,9 @@ ImageGStreamer::ImageGStreamer(GstBuffer* buffer, GstCaps* caps)
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
image.invertPixels(invertMode);
#endif
-
- m_image = BitmapImage::create(new QImage(image));
+ QPixmap* surface = new QPixmap;
+ surface->convertFromImage(image);
+ m_image = BitmapImage::create(surface);
#ifdef GST_API_VERSION_1
if (GstVideoCropMeta* cropMeta = gst_buffer_get_video_crop_meta(buffer))
diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index 6f5736baa..a4d47451d 100644
--- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -540,7 +540,7 @@ IntSize MediaPlayerPrivateGStreamer::naturalSize() const
if (!m_videoSize.isEmpty())
return m_videoSize;
- GstCaps* caps = webkitGstGetPadCaps(m_videoSinkPad.get());
+ GRefPtr<GstCaps> caps = webkitGstGetPadCaps(m_videoSinkPad.get());
if (!caps)
return IntSize();
@@ -555,7 +555,7 @@ IntSize MediaPlayerPrivateGStreamer::naturalSize() const
int pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride;
IntSize originalSize;
GstVideoFormat format;
- if (!getVideoSizeAndFormatFromCaps(caps, originalSize, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride))
+ if (!getVideoSizeAndFormatFromCaps(caps.get(), originalSize, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride))
return IntSize();
LOG_MEDIA_MESSAGE("Original video size: %dx%d", originalSize.width(), originalSize.height());
@@ -1566,11 +1566,11 @@ void MediaPlayerPrivateGStreamer::paint(GraphicsContext* context, const IntRect&
if (!m_buffer)
return;
- GstCaps* caps = webkitGstGetPadCaps(m_videoSinkPad.get());
+ GRefPtr<GstCaps> caps = webkitGstGetPadCaps(m_videoSinkPad.get());
if (!caps)
return;
- RefPtr<ImageGStreamer> gstImage = ImageGStreamer::createImage(m_buffer, caps);
+ RefPtr<ImageGStreamer> gstImage = ImageGStreamer::createImage(m_buffer, caps.get());
if (!gstImage)
return;
diff --git a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp
index c2c0bd4e4..d852184c0 100644
--- a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp
+++ b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp
@@ -29,6 +29,7 @@
#if USE(GSTREAMER)
#include "VideoSinkGStreamer.h"
+#include "GRefPtrGStreamer.h"
#include "GStreamerVersioning.h"
#include "IntSize.h"
#include <glib.h>
@@ -172,27 +173,20 @@ static GstFlowReturn webkitVideoSinkRender(GstBaseSink* baseSink, GstBuffer* buf
gst_buffer_set_caps(priv->buffer, GST_PAD_CAPS(GST_BASE_SINK_PAD(baseSink)));
}
- GstCaps* caps = GST_BUFFER_CAPS(buffer);
+ GRefPtr<GstCaps> caps = GST_BUFFER_CAPS(buffer);
#else
- GstCaps* caps = gst_video_info_to_caps(&priv->info);
+ GRefPtr<GstCaps> caps = adoptGRef(gst_video_info_to_caps(&priv->info));
#endif
GstVideoFormat format;
WebCore::IntSize size;
int pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride;
- if (!getVideoSizeAndFormatFromCaps(caps, size, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride)) {
+ if (!getVideoSizeAndFormatFromCaps(caps.get(), size, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride)) {
gst_buffer_unref(buffer);
-#ifdef GST_API_VERSION_1
- gst_caps_unref(caps);
-#endif
g_mutex_unlock(priv->bufferMutex);
return GST_FLOW_ERROR;
}
-#ifdef GST_API_VERSION_1
- gst_caps_unref(caps);
-#endif
-
// Cairo's ARGB has pre-multiplied alpha while GStreamer's doesn't.
// Here we convert to Cairo's ARGB.
if (format == GST_VIDEO_FORMAT_ARGB || format == GST_VIDEO_FORMAT_BGRA) {