Diff
Modified: trunk/Source/WTF/ChangeLog (157623 => 157624)
--- trunk/Source/WTF/ChangeLog 2013-10-18 05:23:38 UTC (rev 157623)
+++ trunk/Source/WTF/ChangeLog 2013-10-18 07:17:29 UTC (rev 157624)
@@ -1,3 +1,13 @@
+2013-10-18 Brendan Long <[email protected]>
+
+ [GStreamer][GTK] Add GRefPtr::outPtr()
+ https://bugs.webkit.org/show_bug.cgi?id=122996
+
+ Reviewed by Philippe Normand.
+
+ * wtf/gobject/GRefPtr.h:
+ (WTF::GRefPtr::outPtr): Added.
+
2013-10-17 Geoffrey Garen <[email protected]>
Tidied up the Vector<T> move constructor
Modified: trunk/Source/WTF/wtf/gobject/GRefPtr.h (157623 => 157624)
--- trunk/Source/WTF/wtf/gobject/GRefPtr.h 2013-10-18 05:23:38 UTC (rev 157623)
+++ trunk/Source/WTF/wtf/gobject/GRefPtr.h 2013-10-18 07:17:29 UTC (rev 157624)
@@ -85,6 +85,12 @@
return ptr;
}
+ T*& outPtr()
+ {
+ ASSERT(!m_ptr);
+ return m_ptr;
+ }
+
// Hash table deleted values, which are only constructed and never copied or destroyed.
GRefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
Modified: trunk/Source/WebCore/ChangeLog (157623 => 157624)
--- trunk/Source/WebCore/ChangeLog 2013-10-18 05:23:38 UTC (rev 157623)
+++ trunk/Source/WebCore/ChangeLog 2013-10-18 07:17:29 UTC (rev 157624)
@@ -1,3 +1,27 @@
+2013-10-18 Brendan Long <[email protected]>
+
+ [GStreamer][GTK] Add GRefPtr::outPtr()
+ https://bugs.webkit.org/show_bug.cgi?id=122996
+
+ Reviewed by Philippe Normand.
+
+ No new tests because this is just simplifying existing code.
+
+ * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: Add GRefPtr specialization for GstToc.
+ * platform/graphics/gstreamer/GRefPtrGStreamer.h: Same.
+ * platform/graphics/gstreamer/GStreamerGWorld.cpp: Use GRefPtr::outPtr() to simplify code.
+ (WebCore::GStreamerGWorld::enterFullscreen):
+ (WebCore::GStreamerGWorld::exitFullscreen):
+ (WebCore::GStreamerGWorld::removePlatformVideoSink):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: Same.
+ (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText):
+ (WebCore::MediaPlayerPrivateGStreamer::newTextSample):
+ (WebCore::MediaPlayerPrivateGStreamer::processTableOfContents):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: Same.
+ (WebCore::MediaPlayerPrivateGStreamerBase::currentVideoSinkCaps):
+ * platform/network/soup/ResourceHandleSoup.cpp: Same.
+ (WebCore::HostTLSCertificateSet::computeCertificateHash):
+
2013-10-17 Alexey Proskuryakov <[email protected]>
Don't add an include for return type of a [Custom] function in generated bindings code
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp (157623 => 157624)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp 2013-10-18 05:23:38 UTC (rev 157623)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp 2013-10-18 07:17:29 UTC (rev 157624)
@@ -22,7 +22,7 @@
#include "GStreamerVersioning.h"
#if USE(GSTREAMER)
-#include <gst/gstelement.h>
+#include <gst/gst.h>
namespace WTF {
@@ -223,5 +223,24 @@
if (ptr)
gst_event_unref(ptr);
}
+
+template<> GRefPtr<GstToc> adoptGRef(GstToc* ptr)
+{
+ return GRefPtr<GstToc>(ptr, GRefPtrAdopt);
}
+
+template<> GstToc* refGPtr<GstToc>(GstToc* ptr)
+{
+ if (ptr)
+ gst_toc_ref(ptr);
+
+ return ptr;
+}
+
+template<> void derefGPtr<GstToc>(GstToc* ptr)
+{
+ if (ptr)
+ gst_toc_unref(ptr);
+}
+}
#endif // USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h (157623 => 157624)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h 2013-10-18 05:23:38 UTC (rev 157623)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h 2013-10-18 07:17:29 UTC (rev 157624)
@@ -35,6 +35,7 @@
typedef struct _GstSample GstSample;
#endif
typedef struct _GstEvent GstEvent;
+typedef struct _GstToc GstToc;
namespace WTF {
@@ -79,6 +80,10 @@
template<> GRefPtr<GstEvent> adoptGRef(GstEvent* ptr);
template<> GstEvent* refGPtr<GstEvent>(GstEvent* ptr);
template<> void derefGPtr<GstEvent>(GstEvent* ptr);
+
+template<> GRefPtr<GstToc> adoptGRef(GstToc* ptr);
+template<> GstToc* refGPtr<GstToc>(GstToc* ptr);
+template<> void derefGPtr<GstToc>(GstToc* ptr);
}
#endif // USE(GSTREAMER)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp (157623 => 157624)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp 2013-10-18 05:23:38 UTC (rev 157623)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerGWorld.cpp 2013-10-18 07:17:29 UTC (rev 157624)
@@ -118,11 +118,8 @@
// Get video sink bin and the tee inside.
GRefPtr<GstElement> videoSink;
- GstElement* sinkPtr = 0;
+ g_object_get(m_pipeline, "video-sink", &videoSink.outPtr(), NULL);
- g_object_get(m_pipeline, "video-sink", &sinkPtr, NULL);
- videoSink = adoptGRef(sinkPtr);
-
GRefPtr<GstElement> tee = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoTee"));
gst_bin_add_many(GST_BIN(videoSink.get()), platformVideoSink, videoScale, colorspace, queue, NULL);
@@ -196,9 +193,8 @@
if (!m_dynamicPadName)
return;
- GstElement* sinkPtr = 0;
- g_object_get(m_pipeline, "video-sink", &sinkPtr, NULL);
- GRefPtr<GstElement> videoSink = adoptGRef(sinkPtr);
+ GRefPtr<GstElement> videoSink;
+ g_object_get(m_pipeline, "video-sink", &videoSink.outPtr(), NULL);
GRefPtr<GstElement> tee = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoTee"));
GRefPtr<GstPad> srcPad = adoptGRef(gst_element_get_static_pad(tee.get(), m_dynamicPadName.get()));
@@ -225,9 +221,8 @@
return;
// Get video sink bin and the elements to remove.
- GstElement* sinkPtr = 0;
- g_object_get(m_pipeline, "video-sink", &sinkPtr, NULL);
- GRefPtr<GstElement> videoSink = adoptGRef(sinkPtr);
+ GRefPtr<GstElement> videoSink;
+ g_object_get(m_pipeline, "video-sink", &videoSink.outPtr(), NULL);
GRefPtr<GstElement> tee = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "videoTee"));
GRefPtr<GstElement> platformVideoSink = adoptGRef(gst_bin_get_by_name(GST_BIN(videoSink.get()), "platformVideoSink"));
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (157623 => 157624)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2013-10-18 05:23:38 UTC (rev 157623)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2013-10-18 07:17:29 UTC (rev 157624)
@@ -680,20 +680,18 @@
g_object_get(m_playBin.get(), "n-text", &numTracks, NULL);
for (gint i = 0; i < numTracks; ++i) {
- GstPad* pad;
- g_signal_emit_by_name(m_playBin.get(), "get-text-pad", i, &pad, NULL);
+ GRefPtr<GstPad> pad;
+ g_signal_emit_by_name(m_playBin.get(), "get-text-pad", i, &pad.outPtr(), NULL);
ASSERT(pad);
if (i < static_cast<gint>(m_textTracks.size())) {
RefPtr<InbandTextTrackPrivateGStreamer> existingTrack = m_textTracks[i];
existingTrack->setIndex(i);
- if (existingTrack->pad() == pad) {
- gst_object_unref(pad);
+ if (existingTrack->pad() == pad)
continue;
- }
}
- RefPtr<InbandTextTrackPrivateGStreamer> track = InbandTextTrackPrivateGStreamer::create(i, adoptGRef(pad));
+ RefPtr<InbandTextTrackPrivateGStreamer> track = InbandTextTrackPrivateGStreamer::create(i, pad);
m_textTracks.insert(i, track);
m_player->addTextTrack(track.release());
}
@@ -714,8 +712,8 @@
GRefPtr<GstEvent> streamStartEvent = adoptGRef(
gst_pad_get_sticky_event(m_textAppSinkPad.get(), GST_EVENT_STREAM_START, 0));
- GstSample* sample;
- g_signal_emit_by_name(m_textAppSink.get(), "pull-sample", &sample, NULL);
+ GRefPtr<GstSample> sample;
+ g_signal_emit_by_name(m_textAppSink.get(), "pull-sample", &sample.outPtr(), NULL);
ASSERT(sample);
if (streamStartEvent) {
@@ -734,7 +732,6 @@
WARN_MEDIA_MESSAGE("Got sample with unknown stream ID.");
} else
WARN_MEDIA_MESSAGE("Unable to handle sample with no stream start event.");
- gst_sample_unref(sample);
}
#endif
@@ -1000,15 +997,13 @@
m_chaptersTrack = InbandMetadataTextTrackPrivateGStreamer::create(InbandTextTrackPrivate::Chapters);
m_player->addTextTrack(m_chaptersTrack);
- GstToc* toc;
+ GRefPtr<GstToc> toc;
gboolean updated;
- gst_message_parse_toc(message, &toc, &updated);
+ gst_message_parse_toc(message, &toc.outPtr(), &updated);
ASSERT(toc);
- for (GList* i = gst_toc_get_entries(toc); i; i = i->next)
+ for (GList* i = gst_toc_get_entries(toc.get()); i; i = i->next)
processTableOfContentsEntry(static_cast<GstTocEntry*>(i->data), 0);
-
- gst_toc_unref(toc);
}
void MediaPlayerPrivateGStreamer::processTableOfContentsEntry(GstTocEntry* entry, GstTocEntry* parent)
@@ -1202,11 +1197,8 @@
if (!m_playBin)
return;
- GstElement* sinkPtr = 0;
-
- g_object_get(m_playBin.get(), "audio-sink", &sinkPtr, NULL);
- m_webkitAudioSink = adoptGRef(sinkPtr);
-
+ m_webkitAudioSink.clear();
+ g_object_get(m_playBin.get(), "audio-sink", &m_webkitAudioSink.outPtr(), NULL);
}
GstElement* MediaPlayerPrivateGStreamer::audioSink() const
@@ -1216,11 +1208,9 @@
void MediaPlayerPrivateGStreamer::sourceChanged()
{
- GstElement* srcPtr = 0;
+ m_source.clear();
+ g_object_get(m_playBin.get(), "source", &m_source.outPtr(), NULL);
- g_object_get(m_playBin.get(), "source", &srcPtr, NULL);
- m_source = adoptGRef(srcPtr);
-
if (WEBKIT_IS_WEB_SRC(m_source.get()))
webKitWebSrcSetMediaPlayer(WEBKIT_WEB_SRC(m_source.get()), m_player);
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (157623 => 157624)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2013-10-18 05:23:38 UTC (rev 157623)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2013-10-18 07:17:29 UTC (rev 157624)
@@ -515,9 +515,9 @@
if (!m_webkitVideoSink)
return 0;
- GstCaps* currentCaps = 0;
- g_object_get(G_OBJECT(m_webkitVideoSink.get()), "current-caps", ¤tCaps, NULL);
- return adoptGRef(currentCaps);
+ GRefPtr<GstCaps> currentCaps;
+ g_object_get(G_OBJECT(m_webkitVideoSink.get()), "current-caps", ¤tCaps.outPtr(), NULL);
+ return currentCaps;
}
// This function creates and initializes some internal variables, and returns a
Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (157623 => 157624)
--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2013-10-18 05:23:38 UTC (rev 157623)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2013-10-18 07:17:29 UTC (rev 157624)
@@ -200,13 +200,12 @@
private:
static String computeCertificateHash(GTlsCertificate* certificate)
{
- GByteArray* data = ""
- g_object_get(G_OBJECT(certificate), "certificate", &data, NULL);
- if (!data)
+ GRefPtr<GByteArray> certificateData;
+ g_object_get(G_OBJECT(certificate), "certificate", &certificateData.outPtr(), NULL);
+ if (!certificateData)
return String();
static const size_t sha1HashSize = 20;
- GRefPtr<GByteArray> certificateData = adoptGRef(data);
SHA1 sha1;
sha1.addBytes(certificateData->data, certificateData->len);