<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[202897] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/202897">202897</a></dd>
<dt>Author</dt> <dd>philn@webkit.org</dd>
<dt>Date</dt> <dd>2016-07-06 23:58:19 -0700 (Wed, 06 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GStreamer][GL] switch to appsink
https://bugs.webkit.org/show_bug.cgi?id=159466

Reviewed by Carlos Garcia Campos.

Fakesink is mostly used for tests. Appsink provides the same
functionality and is actually meant to be used on application
side.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
(WebCore::newSampleCallback):
(WebCore::newPrerollCallback):
(WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):
(WebCore::MediaPlayerPrivateGStreamerBase::drawCallback): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBaseh">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (202896 => 202897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-07 06:22:23 UTC (rev 202896)
+++ trunk/Source/WebCore/ChangeLog        2016-07-07 06:58:19 UTC (rev 202897)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-07-07  Philippe Normand  &lt;pnormand@igalia.com&gt;
+
+        [GStreamer][GL] switch to appsink
+        https://bugs.webkit.org/show_bug.cgi?id=159466
+
+        Reviewed by Carlos Garcia Campos.
+
+        Fakesink is mostly used for tests. Appsink provides the same
+        functionality and is actually meant to be used on application
+        side.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
+        (WebCore::newSampleCallback):
+        (WebCore::newPrerollCallback):
+        (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL):
+        (WebCore::MediaPlayerPrivateGStreamerBase::drawCallback): Deleted.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+
</ins><span class="cx"> 2016-07-06  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Document.title setter does not work for SVG documents
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (202896 => 202897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2016-07-07 06:22:23 UTC (rev 202896)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2016-07-07 06:58:19 UTC (rev 202897)
</span><span class="lines">@@ -37,7 +37,6 @@
</span><span class="cx"> #include &quot;NotImplemented.h&quot;
</span><span class="cx"> #include &quot;VideoSinkGStreamer.h&quot;
</span><span class="cx"> #include &quot;WebKitWebSourceGStreamer.h&quot;
</span><del>-#include &lt;gst/gst.h&gt;
</del><span class="cx"> #include &lt;wtf/glib/GMutexLocker.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -45,6 +44,7 @@
</span><span class="cx"> #include &lt;gst/video/gstvideometa.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if USE(GSTREAMER_GL)
</span><ins>+#include &lt;gst/app/gstappsink.h&gt;
</ins><span class="cx"> #define GST_USE_UNSTABLE_API
</span><span class="cx"> #include &lt;gst/gl/gl.h&gt;
</span><span class="cx"> #undef GST_USE_UNSTABLE_API
</span><span class="lines">@@ -168,8 +168,15 @@
</span><span class="cx"> {
</span><span class="cx">     m_notifier.cancelPendingNotifications();
</span><span class="cx"> 
</span><del>-    if (m_videoSink)
</del><ins>+    if (m_videoSink) {
</ins><span class="cx">         g_signal_handlers_disconnect_matched(m_videoSink.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
</span><ins>+#if USE(GSTREAMER_GL)
+        if (GST_IS_BIN(m_videoSink.get())) {
+            GRefPtr&lt;GstElement&gt; appsink = adoptGRef(gst_bin_get_by_name(GST_BIN_CAST(m_videoSink.get()), &quot;webkit-gl-video-sink&quot;));
+            g_signal_handlers_disconnect_by_data(appsink.get(), this);
+        }
+#endif
+    }
</ins><span class="cx"> 
</span><span class="cx">     g_mutex_clear(&amp;m_sampleMutex);
</span><span class="cx"> 
</span><span class="lines">@@ -579,15 +586,19 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if USE(GSTREAMER_GL)
</span><del>-gboolean MediaPlayerPrivateGStreamerBase::drawCallback(MediaPlayerPrivateGStreamerBase* player, GstBuffer* buffer, GstPad* pad, GstBaseSink* sink)
</del><ins>+GstFlowReturn MediaPlayerPrivateGStreamerBase::newSampleCallback(GstElement* sink, MediaPlayerPrivateGStreamerBase* player)
</ins><span class="cx"> {
</span><del>-    GST_PAD_STREAM_LOCK(pad);
-    GRefPtr&lt;GstCaps&gt; caps = adoptGRef(gst_pad_get_current_caps(pad));
-    GRefPtr&lt;GstSample&gt; sample = adoptGRef(gst_sample_new(buffer, caps.get(), &amp;sink-&gt;segment, NULL));
-    GST_PAD_STREAM_UNLOCK(pad);
</del><ins>+    GRefPtr&lt;GstSample&gt; sample = adoptGRef(gst_app_sink_pull_sample(GST_APP_SINK(sink)));
</ins><span class="cx">     player-&gt;triggerRepaint(sample.get());
</span><del>-    return TRUE;
</del><ins>+    return GST_FLOW_OK;
</ins><span class="cx"> }
</span><ins>+
+GstFlowReturn MediaPlayerPrivateGStreamerBase::newPrerollCallback(GstElement* sink, MediaPlayerPrivateGStreamerBase* player)
+{
+    GRefPtr&lt;GstSample&gt; sample = adoptGRef(gst_app_sink_pull_preroll(GST_APP_SINK(sink)));
+    player-&gt;triggerRepaint(sample.get());
+    return GST_FLOW_OK;
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void MediaPlayerPrivateGStreamerBase::setSize(const IntSize&amp; size)
</span><span class="lines">@@ -780,23 +791,24 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    GstElement* fakesink = gst_element_factory_make(&quot;fakesink&quot;, nullptr);
</del><ins>+    GstElement* appsink = gst_element_factory_make(&quot;appsink&quot;, &quot;webkit-gl-video-sink&quot;);
</ins><span class="cx"> 
</span><del>-    gst_bin_add_many(GST_BIN(videoSink), upload, colorconvert, fakesink, nullptr);
</del><ins>+    gst_bin_add_many(GST_BIN(videoSink), upload, colorconvert, appsink, nullptr);
</ins><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GstCaps&gt; caps = adoptGRef(gst_caps_from_string(&quot;video/x-raw(&quot; GST_CAPS_FEATURE_MEMORY_GL_MEMORY &quot;), format = (string) { RGBA }&quot;));
</span><span class="cx"> 
</span><span class="cx">     result &amp;= gst_element_link_pads(upload, &quot;src&quot;, colorconvert, &quot;sink&quot;);
</span><del>-    result &amp;= gst_element_link_pads_filtered(colorconvert, &quot;src&quot;, fakesink, &quot;sink&quot;, caps.get());
</del><ins>+    result &amp;= gst_element_link_pads_filtered(colorconvert, &quot;src&quot;, appsink, &quot;sink&quot;, caps.get());
</ins><span class="cx"> 
</span><span class="cx">     GRefPtr&lt;GstPad&gt; pad = adoptGRef(gst_element_get_static_pad(upload, &quot;sink&quot;));
</span><span class="cx">     gst_element_add_pad(videoSink, gst_ghost_pad_new(&quot;sink&quot;, pad.get()));
</span><span class="cx"> 
</span><del>-    g_object_set(fakesink, &quot;enable-last-sample&quot;, FALSE, &quot;signal-handoffs&quot;, TRUE, &quot;silent&quot;, TRUE, &quot;sync&quot;, TRUE, nullptr);
</del><ins>+    g_object_set(appsink, &quot;enable-last-sample&quot;, FALSE, &quot;emit-signals&quot;, TRUE, &quot;max-buffers&quot;, 1, nullptr);
</ins><span class="cx"> 
</span><del>-    if (result)
-        g_signal_connect_swapped(fakesink, &quot;handoff&quot;, G_CALLBACK(drawCallback), this);
-    else {
</del><ins>+    if (result) {
+        g_signal_connect(appsink, &quot;new-sample&quot;, G_CALLBACK(newSampleCallback), this);
+        g_signal_connect(appsink, &quot;new-preroll&quot;, G_CALLBACK(newPrerollCallback), this);
+    } else {
</ins><span class="cx">         WARN_MEDIA_MESSAGE(&quot;Failed to link GstGL elements&quot;);
</span><span class="cx">         gst_object_unref(videoSink);
</span><span class="cx">         videoSink = nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (202896 => 202897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h        2016-07-07 06:22:23 UTC (rev 202896)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h        2016-07-07 06:58:19 UTC (rev 202897)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;MediaPlayerPrivate.h&quot;
</span><span class="cx"> #include &quot;PlatformLayer.h&quot;
</span><span class="cx"> #include &lt;glib.h&gt;
</span><ins>+#include &lt;gst/gst.h&gt;
</ins><span class="cx"> #include &lt;wtf/Condition.h&gt;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><span class="lines">@@ -41,8 +42,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-typedef struct _GstBaseSink GstBaseSink;
-typedef struct _GstMessage GstMessage;
</del><span class="cx"> typedef struct _GstStreamVolume GstStreamVolume;
</span><span class="cx"> typedef struct _GstVideoInfo GstVideoInfo;
</span><span class="cx"> typedef struct _GstGLContext GstGLContext;
</span><span class="lines">@@ -137,6 +136,8 @@
</span><span class="cx">     virtual GstElement* createVideoSink();
</span><span class="cx"> 
</span><span class="cx"> #if USE(GSTREAMER_GL)
</span><ins>+    static GstFlowReturn newSampleCallback(GstElement*, MediaPlayerPrivateGStreamerBase*);
+    static GstFlowReturn newPrerollCallback(GstElement*, MediaPlayerPrivateGStreamerBase*);
</ins><span class="cx">     GstElement* createVideoSinkGL();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -152,9 +153,6 @@
</span><span class="cx">     void repaint();
</span><span class="cx"> 
</span><span class="cx">     static void repaintCallback(MediaPlayerPrivateGStreamerBase*, GstSample*);
</span><del>-#if USE(GSTREAMER_GL)
-    static gboolean drawCallback(MediaPlayerPrivateGStreamerBase*, GstBuffer*, GstPad*, GstBaseSink*);
-#endif
</del><span class="cx"> 
</span><span class="cx">     void notifyPlayerOfVolumeChange();
</span><span class="cx">     void notifyPlayerOfMute();
</span></span></pre>
</div>
</div>

</body>
</html>