+2008-04-29 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ * docs/gst/gstreamer-sections.txt:
+ * gst/gstevent.c: (gst_event_has_name):
+ * gst/gstevent.h:
+ * tests/check/gst/gstevent.c: (GST_START_TEST):
+ Add method to conveniently check the name of a custom event with
+ gst_event_has_name().
+ Reformat the event docs so that related methods are put together instead
+ of the default alphabetical sort.
+ Update unit test with new method.
+ API: GstEvent::gst_event_has_name()
+
2008-04-28 Michael Smith <msmith@songbirdnest.com>
* libs/gst/check/Makefile.am:
<FILE>gstevent</FILE>
<TITLE>GstEvent</TITLE>
GstEvent
+
+GstEventTypeFlags
+GST_EVENT_TYPE_BOTH
+GST_EVENT_MAKE_TYPE
+
GstEventType
+
GST_EVENT_TRACE_NAME
+
GST_EVENT_TYPE
GST_EVENT_TYPE_NAME
-GST_EVENT_TYPE_BOTH
GST_EVENT_TIMESTAMP
GST_EVENT_SRC
+GST_EVENT_IS_UPSTREAM
GST_EVENT_IS_DOWNSTREAM
GST_EVENT_IS_SERIALIZED
-GST_EVENT_IS_UPSTREAM
-GstSeekType
-GstSeekFlags
-GstEventTypeFlags
-GST_EVENT_MAKE_TYPE
+gst_event_type_get_flags
+gst_event_type_get_name
+gst_event_type_to_quark
+gst_event_ref
+gst_event_unref
+gst_event_replace
gst_event_copy
-gst_event_get_structure
-gst_event_new_buffer_size
+
+
gst_event_new_custom
-gst_event_new_eos
+gst_event_get_structure
+gst_event_has_name
+
gst_event_new_flush_start
gst_event_new_flush_stop
-gst_event_new_latency
-gst_event_new_navigation
+
+gst_event_new_eos
+
gst_event_new_new_segment
gst_event_new_new_segment_full
-gst_event_new_qos
-gst_event_new_seek
-gst_event_new_tag
-gst_event_parse_buffer_size
-gst_event_parse_latency
gst_event_parse_new_segment
gst_event_parse_new_segment_full
+
+gst_event_new_tag
+gst_event_parse_tag
+
+gst_event_new_buffer_size
+gst_event_parse_buffer_size
+
+gst_event_new_qos
gst_event_parse_qos
+
+GstSeekType
+GstSeekFlags
+gst_event_new_seek
gst_event_parse_seek
-gst_event_parse_tag
-gst_event_ref
-gst_event_unref
-gst_event_replace
-gst_event_type_get_flags
-gst_event_type_get_name
-gst_event_type_to_quark
+
+gst_event_new_navigation
+
+gst_event_new_latency
+gst_event_parse_latency
<SUBSECTION Standard>
GstEventClass
GST_EVENT
}
/**
+ * gst_event_has_name:
+ * @event: The #GstEvent.
+ * @name: name to check
+ *
+ * Checks if @event has the given @name. This function is usually used to
+ * check the name of a custom event.
+ *
+ * Returns: %TRUE if @name matches the name of the event structure.
+ *
+ * Since: 0.10.20
+ */
+gboolean
+gst_event_has_name (GstEvent * event, const gchar * name)
+{
+ g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
+
+ if (event->structure == NULL)
+ return FALSE;
+
+ return gst_structure_has_name (event->structure, name);
+}
+
+/**
* gst_event_new_flush_start:
*
* Allocate a new flush start event. The flush start event can be sent
const GstStructure *
gst_event_get_structure (GstEvent *event);
+gboolean gst_event_has_name (GstEvent *event, const gchar *name);
+
/* flush events */
GstEvent * gst_event_new_flush_start (void);
GstEvent * gst_event_new_flush_stop (void);
fail_if (GST_EVENT_IS_DOWNSTREAM (event));
fail_if (GST_EVENT_IS_SERIALIZED (event));
fail_unless (gst_event_get_structure (event) == structure);
+ fail_unless (gst_event_has_name (event, "application/x-custom"));
gst_event_unref (event);
/* Decided not to test the other custom enum types, as they
event2 = gst_event_copy (event);
fail_if (event2 == NULL);
fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_TYPE (event2));
+ fail_unless (gst_event_has_name (event, "application/x-custom"));
/* The structure should have been duplicated */
fail_if (gst_event_get_structure (event) ==
/* this should fail if the structure isn't writable */
ASSERT_CRITICAL (gst_structure_remove_all_fields ((GstStructure *)
gst_event_get_structure (event)));
+ fail_unless (gst_event_has_name (event, "application/x-custom"));
/* now make writable */
event2 =
/* this fail if the structure isn't writable */
gst_structure_remove_all_fields ((GstStructure *)
gst_event_get_structure (event2));
+ fail_unless (gst_event_has_name (event2, "application/x-custom"));
gst_event_unref (event);
gst_event_unref (event);