mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
Implement STRUCTURE_CHANGED messages. These messages will be used to signal the parent bin of link/unlink operations ...
Original commit message from CVS: * 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()
This commit is contained in:
parent
11588b2db5
commit
cb98130213
4 changed files with 120 additions and 3 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
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>
|
2008-10-06 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* gst/gstquark.c:
|
* gst/gstquark.c:
|
||||||
|
|
|
@ -1019,6 +1019,7 @@ gst_iterator_result_get_type
|
||||||
<TITLE>GstMessage</TITLE>
|
<TITLE>GstMessage</TITLE>
|
||||||
GstMessage
|
GstMessage
|
||||||
GstMessageType
|
GstMessageType
|
||||||
|
GstStructureChangeType
|
||||||
GST_MESSAGE_SRC
|
GST_MESSAGE_SRC
|
||||||
GST_MESSAGE_TIMESTAMP
|
GST_MESSAGE_TIMESTAMP
|
||||||
GST_MESSAGE_TYPE
|
GST_MESSAGE_TYPE
|
||||||
|
@ -1067,7 +1068,8 @@ gst_message_new_latency
|
||||||
gst_message_new_async_start
|
gst_message_new_async_start
|
||||||
gst_message_parse_async_start
|
gst_message_parse_async_start
|
||||||
gst_message_new_async_done
|
gst_message_new_async_done
|
||||||
|
gst_message_new_structure_change
|
||||||
|
gst_message_parse_structure_change
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GstMessageClass
|
GstMessageClass
|
||||||
GST_MESSAGE
|
GST_MESSAGE
|
||||||
|
@ -1078,9 +1080,11 @@ GST_MESSAGE_CLASS
|
||||||
GST_IS_MESSAGE_CLASS
|
GST_IS_MESSAGE_CLASS
|
||||||
GST_MESSAGE_GET_CLASS
|
GST_MESSAGE_GET_CLASS
|
||||||
GST_TYPE_MESSAGE_TYPE
|
GST_TYPE_MESSAGE_TYPE
|
||||||
|
GST_TYPE_STRUCTURE_CHANGE_TYPE
|
||||||
<SUBSECTION Private>
|
<SUBSECTION Private>
|
||||||
gst_message_get_type
|
gst_message_get_type
|
||||||
gst_message_type_get_type
|
gst_message_type_get_type
|
||||||
|
gst_structure_change_type_get_type
|
||||||
GST_MESSAGE_COND
|
GST_MESSAGE_COND
|
||||||
GST_MESSAGE_GET_LOCK
|
GST_MESSAGE_GET_LOCK
|
||||||
GST_MESSAGE_LOCK
|
GST_MESSAGE_LOCK
|
||||||
|
|
|
@ -622,6 +622,48 @@ gst_message_new_new_clock (GstObject * src, GstClock * clock)
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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:
|
* gst_message_new_segment_start:
|
||||||
* @src: The object originating the message.
|
* @src: The object originating the message.
|
||||||
|
@ -1071,6 +1113,45 @@ gst_message_parse_new_clock (GstMessage * message, GstClock ** clock)
|
||||||
*clock = (GstClock *) g_value_get_object (clock_gvalue);
|
*clock = (GstClock *) g_value_get_object (clock_gvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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:
|
* gst_message_parse_error:
|
||||||
* @message: A valid #GstMessage of type GST_MESSAGE_ERROR.
|
* @message: A valid #GstMessage of type GST_MESSAGE_ERROR.
|
||||||
|
|
|
@ -58,8 +58,8 @@ typedef struct _GstMessageClass GstMessageClass;
|
||||||
* unusable. The pipeline will select a new clock on
|
* unusable. The pipeline will select a new clock on
|
||||||
* the next PLAYING state change.
|
* the next PLAYING state change.
|
||||||
* @GST_MESSAGE_NEW_CLOCK: a new clock was selected in the pipeline.
|
* @GST_MESSAGE_NEW_CLOCK: a new clock was selected in the pipeline.
|
||||||
* @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed. Not
|
* @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed. This
|
||||||
* implemented yet.
|
* message is used internally and never forwarded to the application.
|
||||||
* @GST_MESSAGE_STREAM_STATUS: status about a stream, emitted when it starts,
|
* @GST_MESSAGE_STREAM_STATUS: status about a stream, emitted when it starts,
|
||||||
* stops, errors, etc.. Not implemented yet.
|
* stops, errors, etc.. Not implemented yet.
|
||||||
* @GST_MESSAGE_APPLICATION: message posted by the application, possibly
|
* @GST_MESSAGE_APPLICATION: message posted by the application, possibly
|
||||||
|
@ -179,6 +179,20 @@ typedef enum
|
||||||
*/
|
*/
|
||||||
#define GST_MESSAGE_SRC(message) (GST_MESSAGE(message)->src)
|
#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:
|
* GstMessage:
|
||||||
* @mini_object: the parent structure
|
* @mini_object: the parent structure
|
||||||
|
@ -353,6 +367,12 @@ void gst_message_parse_async_start (GstMessage *message, gboolean *new_base_tim
|
||||||
/* ASYNC_DONE */
|
/* ASYNC_DONE */
|
||||||
GstMessage * gst_message_new_async_done (GstObject * src);
|
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 */
|
/* custom messages */
|
||||||
GstMessage * gst_message_new_custom (GstMessageType type,
|
GstMessage * gst_message_new_custom (GstMessageType type,
|
||||||
GstObject * src,
|
GstObject * src,
|
||||||
|
|
Loading…
Reference in a new issue