2008-10-06 Wim Taymans <wim.taymans@collabora.co.uk>
+ * docs/gst/gstreamer-sections.txt:
+ * gst/gstmessage.c: (gst_message_new_structure_change),
+ (gst_message_parse_structure_change):
+ * gst/gstmessage.h:
+ Implement STRUCTURE_CHANGED messages. These messages will be used to
+ signal the parent bin of link/unlink operations that could require a
+ resync when doing a state change. See ##510354.
+ API: gst_message_new_structure_change()
+ API: gst_message_parse_structure_change()
+
+2008-10-06 Wim Taymans <wim.taymans@collabora.co.uk>
+
* gst/gstquark.c:
* gst/gstquark.h:
Add some more quarks for new message. See #510354.
}
/**
+ * gst_message_new_structure_change:
+ * @src: The object originating the message.
+ * @type: The change type.
+ * @owner: The owner element of @src.
+ * @busy: Whether the structure change is busy.
+ *
+ * Create a new structure change message. This message is posted when the
+ * structure of a pipeline is in the process of being changed, for example
+ * when pads are linked or unlinked.
+ *
+ * @src should be the srcpad that unlinked or linked.
+ *
+ * Returns: The new structure change message.
+ *
+ * MT safe.
+ *
+ * Since: 0.10.22.
+ */
+GstMessage *
+gst_message_new_structure_change (GstObject * src, GstStructureChangeType type,
+ GstElement * owner, gboolean busy)
+{
+ GstMessage *message;
+ GstStructure *structure;
+
+ g_return_val_if_fail (GST_IS_PAD (src), NULL);
+ g_return_val_if_fail (GST_PAD_DIRECTION (src) == GST_PAD_SRC, NULL);
+ g_return_val_if_fail (GST_IS_ELEMENT (owner), NULL);
+
+ structure = gst_structure_empty_new ("GstMessageStructureChange");
+ gst_structure_id_set (structure,
+ GST_QUARK (TYPE), GST_TYPE_STRUCTURE_CHANGE_TYPE, type,
+ GST_QUARK (OWNER), GST_TYPE_ELEMENT, owner,
+ GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy, NULL);
+
+ message = gst_message_new_custom (GST_MESSAGE_STRUCTURE_CHANGE, src,
+ structure);
+
+ return message;
+}
+
+/**
* gst_message_new_segment_start:
* @src: The object originating the message.
* @format: The format of the position being played
}
/**
+ * gst_message_parse_structure_change:
+ * @message: A valid #GstMessage of type GST_MESSAGE_STRUCTURE_CHANGE.
+ * @type: A pointer to hold the change type
+ * @owner: The owner element of the message source
+ * @busy: A pointer to hold whether the change is in progress or has been
+ * completed
+ *
+ * Extracts the change type and completion status from the GstMessage.
+ *
+ * MT safe.
+ *
+ * Since: 0.10.22
+ */
+void
+gst_message_parse_structure_change (GstMessage * message,
+ GstStructureChangeType * type, GstElement ** owner, gboolean * busy)
+{
+ const GValue *owner_gvalue;
+
+ g_return_if_fail (GST_IS_MESSAGE (message));
+ g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STRUCTURE_CHANGE);
+
+ owner_gvalue =
+ gst_structure_id_get_value (message->structure, GST_QUARK (OWNER));
+ g_return_if_fail (owner_gvalue != NULL);
+ g_return_if_fail (G_VALUE_TYPE (owner_gvalue) == GST_TYPE_ELEMENT);
+
+ if (type)
+ *type = g_value_get_enum (gst_structure_id_get_value (message->structure,
+ GST_QUARK (TYPE)));
+ if (owner)
+ *owner = (GstElement *) g_value_get_object (owner_gvalue);
+ if (busy)
+ *busy =
+ g_value_get_boolean (gst_structure_id_get_value (message->structure,
+ GST_QUARK (BUSY)));
+}
+
+/**
* gst_message_parse_error:
* @message: A valid #GstMessage of type GST_MESSAGE_ERROR.
* @gerror: Location for the GError
* unusable. The pipeline will select a new clock on
* the next PLAYING state change.
* @GST_MESSAGE_NEW_CLOCK: a new clock was selected in the pipeline.
- * @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed. Not
- * implemented yet.
+ * @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed. This
+ * message is used internally and never forwarded to the application.
* @GST_MESSAGE_STREAM_STATUS: status about a stream, emitted when it starts,
* stops, errors, etc.. Not implemented yet.
* @GST_MESSAGE_APPLICATION: message posted by the application, possibly
#define GST_MESSAGE_SRC(message) (GST_MESSAGE(message)->src)
/**
+ * GstStructureChangeType:
+ * @GST_STRUCTURE_CHANGE_TYPE_PAD_LINK: Pad linking is starting or done.
+ * @GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK: Pad unlinking is starting or done.
+ *
+ * The type of a #GstMessageStructureChange.
+ *
+ * Since: 0.10.22
+ */
+typedef enum {
+ GST_STRUCTURE_CHANGE_TYPE_PAD_LINK = 0,
+ GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK = 1
+} GstStructureChangeType;
+
+/**
* GstMessage:
* @mini_object: the parent structure
* @type: the #GstMessageType of the message
/* ASYNC_DONE */
GstMessage * gst_message_new_async_done (GstObject * src);
+/* STRUCTURE CHANGE */
+GstMessage * gst_message_new_structure_change (GstObject * src, GstStructureChangeType type,
+ GstElement *owner, gboolean busy);
+void gst_message_parse_structure_change (GstMessage *message, GstStructureChangeType *type,
+ GstElement **owner, gboolean *busy);
+
/* custom messages */
GstMessage * gst_message_new_custom (GstMessageType type,
GstObject * src,