event: remove the sticky event index
[platform/upstream/gstreamer.git] / gst / gstevent.c
index 030b9d4..cad2018 100644 (file)
@@ -122,6 +122,7 @@ static GstEventQuarks event_quarks[] = {
   {GST_EVENT_CUSTOM_UPSTREAM, "custom-upstream", 0},
   {GST_EVENT_CUSTOM_DOWNSTREAM, "custom-downstream", 0},
   {GST_EVENT_CUSTOM_DOWNSTREAM_OOB, "custom-downstream-oob", 0},
+  {GST_EVENT_CUSTOM_DOWNSTREAM_STICKY, "custom-downstream-sticky", 0},
   {GST_EVENT_CUSTOM_BOTH, "custom-both", 0},
   {GST_EVENT_CUSTOM_BOTH_OOB, "custom-both-oob", 0},
 
@@ -198,7 +199,7 @@ gst_event_type_get_flags (GstEventType type)
 {
   GstEventTypeFlags ret;
 
-  ret = type & ((1 << GST_EVENT_STICKY_SHIFT) - 1);
+  ret = type & ((1 << GST_EVENT_NUM_SHIFT) - 1);
 
   return ret;
 }
@@ -366,7 +367,7 @@ gst_event_writable_structure (GstEvent * event)
 
   if (structure == NULL) {
     structure =
-        gst_structure_id_empty_new (gst_event_type_to_quark (GST_EVENT_TYPE
+        gst_structure_new_id_empty (gst_event_type_to_quark (GST_EVENT_TYPE
             (event)));
     gst_structure_set_parent_refcount (structure, &event->mini_object.refcount);
     GST_EVENT_STRUCTURE (event) = structure;
@@ -506,7 +507,7 @@ gst_event_new_flush_stop (gboolean reset_time)
   GST_CAT_INFO (GST_CAT_EVENT, "creating flush stop %d", reset_time);
 
   event = gst_event_new_custom (GST_EVENT_FLUSH_STOP,
-      gst_structure_id_new (GST_QUARK (EVENT_FLUSH_STOP),
+      gst_structure_new_id (GST_QUARK (EVENT_FLUSH_STOP),
           GST_QUARK (RESET_TIME), G_TYPE_BOOLEAN, reset_time, NULL));
 
   return event;
@@ -561,7 +562,7 @@ gst_event_new_eos (void)
 
 /**
  * gst_event_new_caps:
- * @caps: a #GstCaps
+ * @caps: (transfer none): a #GstCaps
  *
  * Create a new CAPS event for @caps. The caps event can only travel downstream
  * synchronized with the buffer flow and contains the format of the buffers
@@ -580,7 +581,7 @@ gst_event_new_caps (GstCaps * caps)
   GST_CAT_INFO (GST_CAT_EVENT, "creating caps event %" GST_PTR_FORMAT, caps);
 
   event = gst_event_new_custom (GST_EVENT_CAPS,
-      gst_structure_id_new (GST_QUARK (EVENT_CAPS),
+      gst_structure_new_id (GST_QUARK (EVENT_CAPS),
           GST_QUARK (CAPS), GST_TYPE_CAPS, caps, NULL));
 
   return event;
@@ -611,7 +612,7 @@ gst_event_parse_caps (GstEvent * event, GstCaps ** caps)
 
 /**
  * gst_event_new_segment:
- * @segment: a #GstSegment
+ * @segment: (transfer none): a #GstSegment
  *
  * Create a new SEGMENT event for @segment. The segment event can only travel
  * downstream synchronized with the buffer flow and contains timing information
@@ -648,17 +649,20 @@ gst_event_parse_caps (GstEvent * event, GstCaps ** caps)
  * Returns: (transfer full): the new SEGMENT event.
  */
 GstEvent *
-gst_event_new_segment (GstSegment * segment)
+gst_event_new_segment (const GstSegment * segment)
 {
   GstEvent *event;
 
   g_return_val_if_fail (segment != NULL, NULL);
+  g_return_val_if_fail (segment->rate != 0.0, NULL);
+  g_return_val_if_fail (segment->applied_rate != 0.0, NULL);
+  g_return_val_if_fail (segment->format != GST_FORMAT_UNDEFINED, NULL);
 
   GST_CAT_INFO (GST_CAT_EVENT, "creating segment event %" GST_SEGMENT_FORMAT,
       segment);
 
   event = gst_event_new_custom (GST_EVENT_SEGMENT,
-      gst_structure_id_new (GST_QUARK (EVENT_SEGMENT),
+      gst_structure_new_id (GST_QUARK (EVENT_SEGMENT),
           GST_QUARK (SEGMENT), GST_TYPE_SEGMENT, segment, NULL));
 
   return event;
@@ -774,7 +778,7 @@ gst_event_new_buffer_size (GstFormat format, gint64 minsize,
       ", maxsize %" G_GINT64_FORMAT ", async %d", gst_format_get_name (format),
       minsize, maxsize, async);
 
-  structure = gst_structure_id_new (GST_QUARK (EVENT_BUFFER_SIZE),
+  structure = gst_structure_new_id (GST_QUARK (EVENT_BUFFER_SIZE),
       GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
       GST_QUARK (MINSIZE), G_TYPE_INT64, minsize,
       GST_QUARK (MAXSIZE), G_TYPE_INT64, maxsize,
@@ -884,12 +888,12 @@ gst_event_new_qos (GstQOSType type, gdouble proportion,
   /* diff must be positive or timestamp + diff must be positive */
   g_return_val_if_fail (diff >= 0 || -diff <= timestamp, NULL);
 
-  GST_CAT_INFO (GST_CAT_EVENT,
+  GST_CAT_LOG (GST_CAT_EVENT,
       "creating qos type %d, proportion %lf, diff %" G_GINT64_FORMAT
       ", timestamp %" GST_TIME_FORMAT, type, proportion,
       diff, GST_TIME_ARGS (timestamp));
 
-  structure = gst_structure_id_new (GST_QUARK (EVENT_QOS),
+  structure = gst_structure_new_id (GST_QUARK (EVENT_QOS),
       GST_QUARK (TYPE), GST_TYPE_QOS_TYPE, type,
       GST_QUARK (PROPORTION), G_TYPE_DOUBLE, proportion,
       GST_QUARK (DIFF), G_TYPE_INT64, diff,
@@ -1007,7 +1011,7 @@ gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags,
         stop);
   }
 
-  structure = gst_structure_id_new (GST_QUARK (EVENT_SEEK),
+  structure = gst_structure_new_id (GST_QUARK (EVENT_SEEK),
       GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
       GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
       GST_QUARK (FLAGS), GST_TYPE_SEEK_FLAGS, flags,
@@ -1115,7 +1119,7 @@ gst_event_new_latency (GstClockTime latency)
   GST_CAT_INFO (GST_CAT_EVENT,
       "creating latency event %" GST_TIME_FORMAT, GST_TIME_ARGS (latency));
 
-  structure = gst_structure_id_new (GST_QUARK (EVENT_LATENCY),
+  structure = gst_structure_new_id (GST_QUARK (EVENT_LATENCY),
       GST_QUARK (LATENCY), G_TYPE_UINT64, latency, NULL);
   event = gst_event_new_custom (GST_EVENT_LATENCY, structure);
 
@@ -1155,8 +1159,9 @@ gst_event_parse_latency (GstEvent * event, GstClockTime * latency)
  * to skip @amount (expressed in @format) of media. It can be used to implement
  * stepping through the video frame by frame or for doing fast trick modes.
  *
- * A rate of <= 0.0 is not allowed, pause the pipeline or reverse the playback
- * direction of the pipeline to get the same effect.
+ * A rate of <= 0.0 is not allowed. Pause the pipeline, for the effect of rate
+ * = 0.0 or first reverse the direction of playback using a seek event to get
+ * the same effect as rate < 0.0.
  *
  * The @flush flag will clear any pending data in the pipeline before starting
  * the step operation.
@@ -1179,7 +1184,7 @@ gst_event_new_step (GstFormat format, guint64 amount, gdouble rate,
 
   GST_CAT_INFO (GST_CAT_EVENT, "creating step event");
 
-  structure = gst_structure_id_new (GST_QUARK (EVENT_STEP),
+  structure = gst_structure_new_id (GST_QUARK (EVENT_STEP),
       GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
       GST_QUARK (AMOUNT), G_TYPE_UINT64, amount,
       GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
@@ -1279,7 +1284,7 @@ gst_event_new_sink_message (GstMessage * msg)
 
   GST_CAT_INFO (GST_CAT_EVENT, "creating sink-message event");
 
-  structure = gst_structure_id_new (GST_QUARK (EVENT_SINK_MESSAGE),
+  structure = gst_structure_new_id (GST_QUARK (EVENT_SINK_MESSAGE),
       GST_QUARK (MESSAGE), GST_TYPE_MESSAGE, msg, NULL);
   event = gst_event_new_custom (GST_EVENT_SINK_MESSAGE, structure);