docs: update more documentation
[platform/upstream/gstreamer.git] / gst / gstevent.c
index a7abac3..a0b97f8 100644 (file)
  * elements will use gst_pad_send_event() or gst_pad_push_event().
  * The event should be unreffed with gst_event_unref() if it has not been sent.
  *
- * Events that have been received can be parsed with their respective 
+ * Events that have been received can be parsed with their respective
  * gst_event_parse_*() functions. It is valid to pass %NULL for unwanted details.
  *
  * Events are passed between elements in parallel to the data stream. Some events
  * are serialized with buffers, others are not. Some events only travel downstream,
- * others only upstream. Some events can travel both upstream and downstream. 
- * 
+ * others only upstream. Some events can travel both upstream and downstream.
+ *
  * The events are used to signal special conditions in the datastream such as
  * EOS (end of stream) or the start of a new stream-segment.
  * Events are also used to flush the pipeline of any pending data.
  *
- * Most of the event API is used inside plugins. Applications usually only 
- * construct and use seek events. 
+ * Most of the event API is used inside plugins. Applications usually only
+ * construct and use seek events.
  * To do that gst_event_new_seek() is used to create a seek event. It takes
  * the needed parameters to specify seeking time and mode.
  * <example>
@@ -72,7 +72,7 @@
  *   </programlisting>
  * </example>
  *
- * Last reviewed on 2006-09-6 (0.10.10)
+ * Last reviewed on 2012-03-28 (0.11.3)
  */
 
 
@@ -452,10 +452,6 @@ gst_event_set_seqnum (GstEvent * event, guint32 seqnum)
   GST_EVENT_SEQNUM (event) = seqnum;
 }
 
-/* FIXME 0.11: It would be nice to have flush events
- * that don't reset the running time in the sinks
- */
-
 /**
  * gst_event_new_flush_start:
  *
@@ -464,8 +460,8 @@ gst_event_set_seqnum (GstEvent * event, guint32 seqnum)
  *
  * It marks pads as being flushing and will make them return
  * #GST_FLOW_FLUSHING when used for data flow with gst_pad_push(),
- * gst_pad_chain(), gst_pad_alloc_buffer(), gst_pad_get_range() and
- * gst_pad_pull_range(). Any event (except a #GST_EVENT_FLUSH_STOP) received
+ * gst_pad_chain(), gst_pad_get_range() and gst_pad_pull_range().
+ * Any event (except a #GST_EVENT_FLUSH_STOP) received
  * on a flushing pad will return %FALSE immediately.
  *
  * Elements should unlock any blocking functions and exit their streaming
@@ -540,7 +536,7 @@ gst_event_parse_flush_stop (GstEvent * event, gboolean * reset_time)
  *
  * Create a new EOS event. The eos event can only travel downstream
  * synchronized with the buffer flow. Elements that receive the EOS
- * event on a pad can return #GST_FLOW_UNEXPECTED as a #GstFlowReturn
+ * event on a pad can return #GST_FLOW_EOS as a #GstFlowReturn
  * when data after the EOS event arrives.
  *
  * The EOS event will travel down to the sink elements in the pipeline
@@ -596,6 +592,7 @@ gst_event_new_gap (GstClockTime timestamp, GstClockTime duration)
 
 /**
  * gst_event_parse_gap:
+ * @event: a #GstEvent of type #GST_EVENT_GAP
  * @timestamp: (out) (allow-none): location where to store the
  *     start time (pts) of the gap, or %NULL
  * @duration: (out) (allow-none): location where to store the duration of
@@ -742,7 +739,7 @@ gst_event_set_stream_config_setup_data (GstEvent * event, GstBuffer * buf)
 }
 
 /**
- * gst_event_set_stream_config_setup_data:
+ * gst_event_parse_stream_config_setup_data:
  * @event: a stream config event
  * @buf: (out) (transfer none): location where to store the #GstBuffer with setup data
  *
@@ -750,16 +747,20 @@ gst_event_set_stream_config_setup_data (GstEvent * event, GstBuffer * buf)
  * %NULL in @buf if the event contains no setup data. The buffer returned
  * will remain valid as long as @event remains valid. The caller should
  * acquire a reference to to @buf if needed.
+ *
+ * Returns: TRUE if @event contained setup data and @buf has been set,
+ *     otherwise FALSE.
  */
-void
+gboolean
 gst_event_parse_stream_config_setup_data (GstEvent * event, GstBuffer ** buf)
 {
   const GValue *val;
   GstStructure *s;
 
-  g_return_if_fail (GST_IS_EVENT (event));
-  g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG);
-  g_return_if_fail (buf != NULL);
+  g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
+  g_return_val_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG,
+      FALSE);
+  g_return_val_if_fail (buf != NULL, FALSE);
 
   s = GST_EVENT_STRUCTURE (event);
   val = gst_structure_id_get_value (s, GST_QUARK (SETUP_DATA));
@@ -767,6 +768,8 @@ gst_event_parse_stream_config_setup_data (GstEvent * event, GstBuffer ** buf)
     *buf = g_value_get_boxed (val);
   else
     *buf = NULL;
+
+  return (*buf != NULL);
 }
 
 /**
@@ -851,8 +854,11 @@ gst_event_get_n_stream_config_headers (GstEvent * event)
  * Retrieves the n-th stream header buffer attached to the stream config
  * event and stores it in @buf. Will store %NULL in @buf if there is no such
  * stream header.
+ *
+ * Returns: TRUE if @event contained a stream header at @index and @buf has
+ *    been set, otherwise FALSE.
  */
-void
+gboolean
 gst_event_parse_nth_stream_config_header (GstEvent * event, guint index,
     GstBuffer ** buf)
 {
@@ -860,9 +866,10 @@ gst_event_parse_nth_stream_config_header (GstEvent * event, guint index,
   GstStructure *s;
   GstBuffer *ret = NULL;
 
-  g_return_if_fail (GST_IS_EVENT (event));
-  g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG);
-  g_return_if_fail (buf != NULL);
+  g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
+  g_return_val_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_STREAM_CONFIG,
+      FALSE);
+  g_return_val_if_fail (buf != NULL, FALSE);
 
   s = GST_EVENT_STRUCTURE (event);
   val = gst_structure_id_get_value (s, GST_QUARK (STREAM_HEADERS));
@@ -874,6 +881,7 @@ gst_event_parse_nth_stream_config_header (GstEvent * event, guint index,
   }
 
   *buf = ret;
+  return (ret != NULL);
 }
 
 /**