[queue] add new property - "empty-buffers" 61/56161/1 accepted/tizen/mobile/20160106.003059 accepted/tizen/tv/20160106.003018 accepted/tizen/wearable/20160106.003114 submit/tizen/20160105.053024
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 5 Jan 2016 05:03:12 +0000 (14:03 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 5 Jan 2016 05:03:12 +0000 (14:03 +0900)
Change-Id: Ie8d05b575701947e3e6b7bfea532950b90074cc2
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/gstreamer.spec
plugins/elements/gstqueue.c
plugins/elements/gstqueue.h

index 2420509a35c0aae754803b13942b9a8a994b599c..1853dd6c41ac9542f4ceb0785efaedf2af7cf12a 100644 (file)
@@ -2,7 +2,7 @@
 
 Name:           gstreamer
 Version:        1.6.1
-Release:        3
+Release:        4
 Summary:        Streaming-Media Framework Runtime
 License:        LGPL-2.0+
 Group:          Multimedia/Framework
@@ -70,6 +70,7 @@ export CFLAGS="%{optflags} \
        -DGST_EXT_CURRENT_BYTES\
        -DGST_TIZEN_MODIFICATION\
        -DGST_BASEPARSE_MODIFICATION\
+       -DGST_QUEUE_MODIFICATION\
        -fno-strict-aliasing"
 
 %configure\
index 1d5552258c8c67316037115137c2b45ea4154f8d..c01b5dc172db88aede8d5596bb1f1f5eb3cbc1bb 100644 (file)
@@ -120,6 +120,9 @@ enum
   PROP_MIN_THRESHOLD_TIME,
   PROP_LEAKY,
   PROP_SILENT,
+#ifdef GST_QUEUE_MODIFICATION
+  PROP_EMPTY_BUFFERS,
+#endif /* GST_QUEUE_MODIFICATION */
   PROP_FLUSH_ON_EOS
 };
 
@@ -381,6 +384,13 @@ gst_queue_class_init (GstQueueClass * klass)
           G_PARAM_READWRITE | GST_PARAM_MUTABLE_PLAYING |
           G_PARAM_STATIC_STRINGS));
 
+#ifdef GST_QUEUE_MODIFICATION
+  g_object_class_install_property (gobject_class, PROP_EMPTY_BUFFERS,
+      g_param_spec_boolean ("empty-buffers", "empty_buffers",
+          "Drop all the incomming buffers and flush buffers in queue",
+         FALSE, G_PARAM_READWRITE));
+#endif /* GST_QUEUE_MODIFICATION */
+
   /**
    * GstQueue:flush-on-eos
    *
@@ -475,6 +485,10 @@ gst_queue_init (GstQueue * queue)
 
   queue->newseg_applied_to_src = FALSE;
 
+#ifdef GST_QUEUE_MODIFICATION
+  queue->empty_buffers = FALSE;
+#endif /* GST_QUEUE_MODIFICATION */
+
   GST_DEBUG_OBJECT (queue,
       "initialized queue's not_empty & not_full conditions");
 }
@@ -1142,6 +1156,16 @@ gst_queue_chain_buffer_or_list (GstPad * pad, GstObject * parent,
   if (queue->unexpected)
     goto out_unexpected;
 
+#ifdef GST_QUEUE_MODIFICATION
+  /* Added to not enqueue buffers in the queue while paused */
+  if (queue->empty_buffers) {
+    GST_CAT_LOG_OBJECT(queue_dataflow, queue, "drop buffer %p", obj);
+    gst_mini_object_unref(obj);
+    GST_QUEUE_MUTEX_UNLOCK(queue);
+    return GST_FLOW_OK;
+  }
+#endif /* GST_QUEUE_MODIFICATION */
+
   if (!is_list) {
     GstClockTime duration, timestamp;
     GstBuffer *buffer = GST_BUFFER_CAST (obj);
@@ -1781,6 +1805,16 @@ gst_queue_set_property (GObject * object,
     case PROP_SILENT:
       queue->silent = g_value_get_boolean (value);
       break;
+#ifdef GST_QUEUE_MODIFICATION
+    case PROP_EMPTY_BUFFERS:
+      queue->empty_buffers = g_value_get_boolean (value);
+      GST_INFO_OBJECT(queue, "set empty buffer : %d", queue->empty_buffers);
+      if (queue->empty_buffers) {
+        gst_queue_locked_flush(queue, FALSE);
+      }
+      GST_INFO_OBJECT(queue, "done");
+      break;
+#endif /* GST_QUEUE_MODIFICATION */
     case PROP_FLUSH_ON_EOS:
       queue->flush_on_eos = g_value_get_boolean (value);
       break;
@@ -1834,6 +1868,11 @@ gst_queue_get_property (GObject * object,
     case PROP_SILENT:
       g_value_set_boolean (value, queue->silent);
       break;
+#ifdef GST_QUEUE_MODIFICATION
+    case PROP_EMPTY_BUFFERS:
+      g_value_set_boolean(value, queue->empty_buffers);
+      break;
+#endif /* GST_QUEUE_MODIFICATION */
     case PROP_FLUSH_ON_EOS:
       g_value_set_boolean (value, queue->flush_on_eos);
       break;
index 513457803be1a907792c857bd70466a53efc5100..33c8b4bdaf1d5679c0bdc460840a6cf5c0baa6c3 100644 (file)
@@ -107,6 +107,11 @@ struct _GstQueue {
   gboolean      unexpected;
   gboolean      eos;
 
+#ifdef GST_QUEUE_MODIFICATION
+  /* drop incomming buffers and flush buffers in queue */
+  gboolean empty_buffers;
+#endif /* GST_QUEUE_MODIFICATION */
+
   /* the queue of data we're keeping our grubby hands on */
   GstQueueArray *queue;