summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/gstreamer
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/gstreamer')
-rw-r--r--WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp44
-rw-r--r--WebCore/platform/graphics/gstreamer/GStreamerGWorld.h49
-rw-r--r--WebCore/platform/graphics/gstreamer/ImageGStreamer.h4
-rw-r--r--WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm57
-rw-r--r--WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp12
-rw-r--r--WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h3
6 files changed, 169 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp
new file mode 100644
index 0000000..c5022f9
--- /dev/null
+++ b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include "GStreamerGWorld.h"
+
+#include "MediaPlayerPrivateGStreamer.h"
+
+using namespace std;
+
+namespace WebCore {
+
+PassRefPtr<GStreamerGWorld> GStreamerGWorld::createGWorld(MediaPlayerPrivateGStreamer* player)
+{
+ return adoptRef(new GStreamerGWorld(player));
+}
+
+GStreamerGWorld::GStreamerGWorld(MediaPlayerPrivateGStreamer* player)
+ : m_player(player)
+{
+}
+
+GStreamerGWorld::~GStreamerGWorld()
+{
+}
+
+}
diff --git a/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h
new file mode 100644
index 0000000..b626298
--- /dev/null
+++ b/WebCore/platform/graphics/gstreamer/GStreamerGWorld.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef GStreamerGWorld_h
+#define GStreamerGWorld_h
+
+#if ENABLE(VIDEO)
+
+#include "RefCounted.h"
+#include "RefPtr.h"
+#include <glib.h>
+
+
+namespace WebCore {
+
+class MediaPlayerPrivateGStreamer;
+
+
+class GStreamerGWorld : public RefCounted<GStreamerGWorld> {
+
+public:
+ static PassRefPtr<GStreamerGWorld> createGWorld(MediaPlayerPrivateGStreamer*);
+ ~GStreamerGWorld();
+
+private:
+ GStreamerGWorld(MediaPlayerPrivateGStreamer*);
+ MediaPlayerPrivateGStreamer* m_player;
+};
+
+}
+#endif
+#endif
diff --git a/WebCore/platform/graphics/gstreamer/ImageGStreamer.h b/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
index 2e97b4d..3d6d74a 100644
--- a/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
+++ b/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
@@ -54,6 +54,10 @@ class ImageGStreamer : public RefCounted<ImageGStreamer> {
cairo_surface_t* m_surface;
#endif
+#if PLATFORM(MAC)
+ ImageGStreamer(GstBuffer*&, IntSize);
+#endif
+
};
}
diff --git a/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm b/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm
new file mode 100644
index 0000000..421b90f
--- /dev/null
+++ b/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010 Igalia S.L
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "ImageGStreamer.h"
+
+using namespace WebCore;
+
+PassRefPtr<ImageGStreamer> ImageGStreamer::createImage(GstBuffer* buffer)
+{
+ int width = 0, height = 0;
+ GstCaps* caps = gst_buffer_get_caps(buffer);
+ GstVideoFormat format;
+ if (!gst_video_format_parse_caps(caps, &format, &width, &height)) {
+ gst_caps_unref(caps);
+ return NULL;
+ }
+
+ return adoptRef(new ImageGStreamer(buffer, IntSize(width, height)));
+}
+
+ImageGStreamer::ImageGStreamer(GstBuffer*& buffer, IntSize size)
+ : m_image(0)
+{
+ ASSERT(GST_BUFFER_SIZE(buffer));
+
+ RetainPtr<CFDataRef> data(AdoptCF, CFDataCreateWithBytesNoCopy(0, static_cast<UInt8*>(GST_BUFFER_DATA(buffer)), GST_BUFFER_SIZE(buffer), kCFAllocatorNull));
+ RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithCFData(data.get()));
+ static CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+ CGImageRef frameImage = CGImageCreate(size.width(), size.height(), 8, 32, size.width()*4, colorSpace,
+ kCGBitmapByteOrder32Little | kCGImageAlphaFirst, provider.get(), 0, false, kCGRenderingIntentDefault);
+ m_image = BitmapImage::create(frameImage);
+}
+
+ImageGStreamer::~ImageGStreamer()
+{
+ if (m_image)
+ m_image.clear();
+
+ m_image = 0;
+}
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
index 8f6c9e0..d619e14 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
@@ -34,6 +34,7 @@
#include "Frame.h"
#include "FrameView.h"
#include "GOwnPtrGStreamer.h"
+#include "GStreamerGWorld.h"
#include "GraphicsContext.h"
#include "GraphicsTypes.h"
#include "ImageGStreamer.h"
@@ -1348,6 +1349,15 @@ bool MediaPlayerPrivateGStreamer::supportsFullscreen() const
return true;
}
+
+PlatformMedia MediaPlayerPrivateGStreamer::platformMedia() const
+{
+ PlatformMedia p;
+ p.type = PlatformMedia::GStreamerGWorldType;
+ p.media.gstreamerGWorld = m_gstGWorld.get();
+ return p;
+}
+
void MediaPlayerPrivateGStreamer::setPreload(MediaPlayer::Preload preload)
{
ASSERT(m_playBin);
@@ -1372,6 +1382,8 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
ASSERT(!m_playBin);
m_playBin = gst_element_factory_make("playbin2", "play");
+ m_gstGWorld = GStreamerGWorld::createGWorld(this);
+
GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(m_playBin));
gst_bus_add_signal_watch(bus);
g_signal_connect(bus, "message", G_CALLBACK(mediaPlayerPrivateMessageCallback), this);
diff --git a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
index 06519fa..81f90b8 100644
--- a/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
+++ b/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
@@ -43,6 +43,7 @@ class GraphicsContext;
class IntSize;
class IntRect;
class String;
+class GStreamerGWorld;
gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpointer data);
void mediaPlayerPrivateVolumeChangedCallback(GObject* element, GParamSpec* pspec, gpointer data);
@@ -116,6 +117,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
bool hasSingleSecurityOrigin() const;
bool supportsFullscreen() const;
+ PlatformMedia platformMedia() const;
GstElement* pipeline() const { return m_playBin; }
bool pipelineReset() const { return m_resetPipeline; }
@@ -172,6 +174,7 @@ class MediaPlayerPrivateGStreamer : public MediaPlayerPrivateInterface {
MediaPlayer::Preload m_preload;
bool m_delayingLoad;
bool m_mediaDurationKnown;
+ RefPtr<GStreamerGWorld> m_gstGWorld;
};
}