aggregator: Simplify clip function
authorOlivier Crête <olivier.crete@collabora.com>
Wed, 6 Jul 2016 20:41:44 +0000 (16:41 -0400)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 2 Dec 2017 15:10:27 +0000 (15:10 +0000)
The return value was ignored anyway

https://bugzilla.gnome.org/show_bug.cgi?id=781673

libs/gst/base/gstaggregator.c
libs/gst/base/gstaggregator.h

index 88b71bc..6661bdf 100644 (file)
@@ -2141,7 +2141,6 @@ static GstFlowReturn
 gst_aggregator_pad_chain_internal (GstAggregator * self,
     GstAggregatorPad * aggpad, GstBuffer * buffer, gboolean head)
 {
-  GstBuffer *actual_buf = buffer;
   GstAggregatorClass *aggclass = GST_AGGREGATOR_GET_CLASS (self);
   GstFlowReturn flow_return;
   GstClockTime buf_pts;
@@ -2161,15 +2160,15 @@ gst_aggregator_pad_chain_internal (GstAggregator * self,
   PAD_UNLOCK (aggpad);
 
   if (aggclass->clip && head) {
-    aggclass->clip (self, aggpad, buffer, &actual_buf);
+    buffer = aggclass->clip (self, aggpad, buffer);
   }
 
-  if (actual_buf == NULL) {
-    GST_LOG_OBJECT (actual_buf, "Buffer dropped by clip function");
+  if (buffer == NULL) {
+    GST_LOG_OBJECT (aggpad, "Buffer dropped by clip function");
     goto done;
   }
 
-  buf_pts = GST_BUFFER_PTS (actual_buf);
+  buf_pts = GST_BUFFER_PTS (buffer);
 
   aggpad->priv->first_buffer = FALSE;
 
@@ -2180,12 +2179,12 @@ gst_aggregator_pad_chain_internal (GstAggregator * self,
     if (gst_aggregator_pad_has_space (self, aggpad)
         && aggpad->priv->flow_return == GST_FLOW_OK) {
       if (head)
-        g_queue_push_head (&aggpad->priv->buffers, actual_buf);
+        g_queue_push_head (&aggpad->priv->buffers, buffer);
       else
-        g_queue_push_tail (&aggpad->priv->buffers, actual_buf);
-      apply_buffer (aggpad, actual_buf, head);
+        g_queue_push_tail (&aggpad->priv->buffers, buffer);
+      apply_buffer (aggpad, buffer, head);
       aggpad->priv->num_buffers++;
-      actual_buf = buffer = NULL;
+      buffer = NULL;
       SRC_BROADCAST (self);
       break;
     }
index 700373e..e6238b7 100644 (file)
@@ -155,9 +155,13 @@ struct _GstAggregator
  *                  stops have been received. Flush pad-specific data in
  *                  #GstAggregatorPad->flush.
  * @clip:           Optional.
- *                  Called when a buffer is received on a sink pad, the task
- *                  of clipping it and translating it to the current segment
- *                  falls on the subclass.
+ *                  Called when a buffer is received on a sink pad, the task of
+ *                  clipping it and translating it to the current segment falls
+ *                  on the subclass. The function should use the segment of data
+ *                  and the negotiated media type on the pad to perform
+ *                  clipping of inbuffer. This function takes ownership of
+ *                  buf and should output a buffer or return NULL in
+ *                  if the buffer should be dropped.
  * @sink_event:     Optional.
  *                  Called when an event is received on a sink pad, the subclass
  *                  should always chain up.
@@ -211,10 +215,9 @@ struct _GstAggregatorClass {
 
   GstFlowReturn     (*flush)          (GstAggregator    *  aggregator);
 
-  GstFlowReturn     (*clip)           (GstAggregator    *  aggregator,
+  GstBuffer *       (*clip)           (GstAggregator    *  aggregator,
                                        GstAggregatorPad *  aggregator_pad,
-                                       GstBuffer        *  buf,
-                                       GstBuffer        ** outbuf);
+                                       GstBuffer        *  buf);
 
   /* sinkpads virtual methods */
   gboolean          (*sink_event)     (GstAggregator    *  aggregator,