#include "gstquark.h"
-static GType _gst_message_type = 0;
+typedef struct
+{
+ GstMessage message;
+
+ GstStructure *structure;
+} GstMessageImpl;
+
+#define GST_MESSAGE_STRUCTURE(m) (((GstMessageImpl *)(m))->structure)
typedef struct
{
{0, NULL, 0}
};
+static GType _gst_message_type = 0;
+GST_DEFINE_MINI_OBJECT_TYPE (GstMessage, gst_message);
+
void
-_gst_message_initialize (void)
+_priv_gst_message_initialize (void)
{
gint i;
message_quarks[i].quark =
g_quark_from_static_string (message_quarks[i].name);
}
+
+ _gst_message_type = gst_message_get_type ();
}
/**
return 0;
}
-GType
-gst_message_get_type (void)
-{
- if (G_UNLIKELY (_gst_message_type == 0)) {
- _gst_message_type = gst_mini_object_register ("GstMessage");
- }
- return _gst_message_type;
-}
-
-
static void
_gst_message_free (GstMessage * message)
{
+ GstStructure *structure;
+
g_return_if_fail (message != NULL);
- GST_CAT_LOG (GST_CAT_MESSAGE, "finalize message %p", message);
+ GST_CAT_LOG (GST_CAT_MESSAGE, "finalize message %p, %s from %s", message,
+ GST_MESSAGE_TYPE_NAME (message), GST_MESSAGE_SRC_NAME (message));
if (GST_MESSAGE_SRC (message)) {
gst_object_unref (GST_MESSAGE_SRC (message));
GST_MESSAGE_UNLOCK (message);
}
- if (message->structure) {
- gst_structure_set_parent_refcount (message->structure, NULL);
- gst_structure_free (message->structure);
+ structure = GST_MESSAGE_STRUCTURE (message);
+ if (structure) {
+ gst_structure_set_parent_refcount (structure, NULL);
+ gst_structure_free (structure);
}
g_slice_free1 (GST_MINI_OBJECT_SIZE (message), message);
static GstMessage *
_gst_message_copy (GstMessage * message)
{
- GstMessage *copy;
+ GstMessageImpl *copy;
+ GstStructure *structure;
- GST_CAT_LOG (GST_CAT_MESSAGE, "copy message %p", message);
+ GST_CAT_LOG (GST_CAT_MESSAGE, "copy message %p, %s from %s", message,
+ GST_MESSAGE_TYPE_NAME (message),
+ GST_OBJECT_NAME (GST_MESSAGE_SRC (message)));
- copy = g_slice_new0 (GstMessage);
+ copy = g_slice_new0 (GstMessageImpl);
gst_mini_object_init (GST_MINI_OBJECT_CAST (copy),
- _gst_message_type, sizeof (GstMessage));
+ _gst_message_type, sizeof (GstMessageImpl));
- copy->mini_object.copy = (GstMiniObjectCopyFunction) _gst_message_copy;
- copy->mini_object.free = (GstMiniObjectFreeFunction) _gst_message_free;
+ copy->message.mini_object.copy =
+ (GstMiniObjectCopyFunction) _gst_message_copy;
+ copy->message.mini_object.free =
+ (GstMiniObjectFreeFunction) _gst_message_free;
- GST_MESSAGE_GET_LOCK (copy) = GST_MESSAGE_GET_LOCK (message);
- GST_MESSAGE_COND (copy) = GST_MESSAGE_COND (message);
GST_MESSAGE_TYPE (copy) = GST_MESSAGE_TYPE (message);
GST_MESSAGE_TIMESTAMP (copy) = GST_MESSAGE_TIMESTAMP (message);
GST_MESSAGE_SEQNUM (copy) = GST_MESSAGE_SEQNUM (message);
-
if (GST_MESSAGE_SRC (message)) {
GST_MESSAGE_SRC (copy) = gst_object_ref (GST_MESSAGE_SRC (message));
}
- if (message->structure) {
- copy->structure = gst_structure_copy (message->structure);
+ GST_MESSAGE_GET_LOCK (copy) = GST_MESSAGE_GET_LOCK (message);
+ GST_MESSAGE_COND (copy) = GST_MESSAGE_COND (message);
+
+ structure = GST_MESSAGE_STRUCTURE (message);
+ if (structure) {
+ copy->structure = gst_structure_copy (structure);
gst_structure_set_parent_refcount (copy->structure,
- ©->mini_object.refcount);
+ ©->message.mini_object.refcount);
}
- return copy;
+ return GST_MESSAGE_CAST (copy);
}
/**
gst_message_new_custom (GstMessageType type, GstObject * src,
GstStructure * structure)
{
- GstMessage *message;
+ GstMessageImpl *message;
- message = g_slice_new0 (GstMessage);
+ message = g_slice_new0 (GstMessageImpl);
gst_mini_object_init (GST_MINI_OBJECT_CAST (message),
- _gst_message_type, sizeof (GstMessage));
+ _gst_message_type, sizeof (GstMessageImpl));
- message->mini_object.copy = (GstMiniObjectCopyFunction) _gst_message_copy;
- message->mini_object.free = (GstMiniObjectFreeFunction) _gst_message_free;
+ message->message.mini_object.copy =
+ (GstMiniObjectCopyFunction) _gst_message_copy;
+ message->message.mini_object.free =
+ (GstMiniObjectFreeFunction) _gst_message_free;
GST_CAT_LOG (GST_CAT_MESSAGE, "source %s: creating new message %p %s",
(src ? GST_OBJECT_NAME (src) : "NULL"), message,
gst_message_type_get_name (type));
- message->type = type;
-
+ GST_MESSAGE_TYPE (message) = type;
if (src)
gst_object_ref (src);
- message->src = src;
+ GST_MESSAGE_SRC (message) = src;
+ GST_MESSAGE_TIMESTAMP (message) = GST_CLOCK_TIME_NONE;
+ GST_MESSAGE_SEQNUM (message) = gst_util_seqnum_next ();
if (structure) {
gst_structure_set_parent_refcount (structure,
- &message->mini_object.refcount);
+ &message->message.mini_object.refcount);
}
message->structure = structure;
- GST_MESSAGE_TIMESTAMP (message) = GST_CLOCK_TIME_NONE;
- GST_MESSAGE_SEQNUM (message) = gst_util_seqnum_next ();
-
- return message;
+ return GST_MESSAGE_CAST (message);
}
/**
* it is not required.
*
* Note that events and messages share the same sequence number incrementor;
- * two events or messages will never not have the same sequence number unless
+ * two events or messages will never have the same sequence number unless
* that correspondence was made explicitly.
*
* Returns: The message's sequence number.
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_ERROR),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_ERROR),
GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
message = gst_message_new_custom (GST_MESSAGE_ERROR, src, structure);
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_WARNING),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_WARNING),
GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
message = gst_message_new_custom (GST_MESSAGE_WARNING, src, structure);
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_INFO),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_INFO),
GST_QUARK (GERROR), GST_TYPE_G_ERROR, error,
GST_QUARK (DEBUG), G_TYPE_STRING, debug, NULL);
message = gst_message_new_custom (GST_MESSAGE_INFO, src, structure);
}
/**
- * gst_message_new_tag_full:
- * @src: (transfer none): the object originating the message.
- * @pad: (transfer none): the originating pad for the tag.
- * @tag_list: (transfer full): the tag list for the message.
- *
- * Create a new tag message. The message will take ownership of the tag list.
- * The message is posted by elements that discovered a new taglist.
- *
- * MT safe.
- *
- * Returns: (transfer full): the new tag message.
- *
- * Since: 0.10.24
- */
-GstMessage *
-gst_message_new_tag_full (GstObject * src, GstPad * pad, GstTagList * tag_list)
-{
- GstMessage *message;
- GstStructure *s;
-
- g_return_val_if_fail (GST_IS_STRUCTURE (tag_list), NULL);
- g_return_val_if_fail (pad == NULL || GST_IS_PAD (pad), NULL);
-
- s = (GstStructure *) tag_list;
- if (pad)
- gst_structure_set (s, "source-pad", GST_TYPE_PAD, pad, NULL);
-
- message = gst_message_new_custom (GST_MESSAGE_TAG, src, s);
-
- return message;
-}
-
-/**
* gst_message_new_buffering:
* @src: (transfer none): The object originating the message.
* @percent: The buffering percent
g_return_val_if_fail (percent >= 0 && percent <= 100, NULL);
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_BUFFERING),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_BUFFERING),
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent,
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM,
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1,
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_STATE),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_STATE),
GST_QUARK (OLD_STATE), GST_TYPE_STATE, (gint) oldstate,
GST_QUARK (NEW_STATE), GST_TYPE_STATE, (gint) newstate,
GST_QUARK (PENDING_STATE), GST_TYPE_STATE, (gint) pending, NULL);
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_CLOCK_PROVIDE),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_CLOCK_PROVIDE),
GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock,
GST_QUARK (READY), G_TYPE_BOOLEAN, ready, NULL);
message = gst_message_new_custom (GST_MESSAGE_CLOCK_PROVIDE, src, structure);
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_CLOCK_LOST),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_CLOCK_LOST),
GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock, NULL);
message = gst_message_new_custom (GST_MESSAGE_CLOCK_LOST, src, structure);
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_NEW_CLOCK),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_NEW_CLOCK),
GST_QUARK (CLOCK), GST_TYPE_CLOCK, clock, NULL);
message = gst_message_new_custom (GST_MESSAGE_NEW_CLOCK, src, structure);
/* g_return_val_if_fail (GST_PAD_DIRECTION (src) == GST_PAD_SINK, NULL); */
g_return_val_if_fail (GST_IS_ELEMENT (owner), NULL);
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_STRUCTURE_CHANGE),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_STRUCTURE_CHANGE),
GST_QUARK (TYPE), GST_TYPE_STRUCTURE_CHANGE_TYPE, type,
GST_QUARK (OWNER), GST_TYPE_ELEMENT, owner,
GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy, NULL);
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_SEGMENT_START),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_SEGMENT_START),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (POSITION), G_TYPE_INT64, position, NULL);
message = gst_message_new_custom (GST_MESSAGE_SEGMENT_START, src, structure);
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_SEGMENT_DONE),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_SEGMENT_DONE),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (POSITION), G_TYPE_INT64, position, NULL);
message = gst_message_new_custom (GST_MESSAGE_SEGMENT_DONE, src, structure);
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_DURATION),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_DURATION),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL);
message = gst_message_new_custom (GST_MESSAGE_DURATION, src, structure);
/**
* gst_message_new_async_start:
* @src: (transfer none): The object originating the message.
- * @new_base_time: if a new base_time should be set on the element
*
- * This message is posted by elements when they start an ASYNC state change.
- * @new_base_time is set to TRUE when the element lost its state when it was
- * PLAYING.
+ * This message is posted by elements when they start an ASYNC state change.
*
* Returns: (transfer full): The new async_start message.
*
* MT safe.
- *
- * Since: 0.10.13
*/
GstMessage *
-gst_message_new_async_start (GstObject * src, gboolean new_base_time)
+gst_message_new_async_start (GstObject * src)
{
GstMessage *message;
- GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_ASYNC_START),
- GST_QUARK (NEW_BASE_TIME), G_TYPE_BOOLEAN, new_base_time, NULL);
- message = gst_message_new_custom (GST_MESSAGE_ASYNC_START, src, structure);
+ message = gst_message_new_custom (GST_MESSAGE_ASYNC_START, src, NULL);
return message;
}
/**
* gst_message_new_async_done:
* @src: (transfer none): The object originating the message.
+ * @reset_time: if the running_time should be reset
*
* The message is posted when elements completed an ASYNC state change.
+ * @reset_time is set to TRUE when the element requests a new running_time
+ * before going to PLAYING.
*
* Returns: (transfer full): The new async_done message.
*
* MT safe.
- *
- * Since: 0.10.13
*/
GstMessage *
-gst_message_new_async_done (GstObject * src)
+gst_message_new_async_done (GstObject * src, gboolean reset_time)
{
GstMessage *message;
+ GstStructure *structure;
- message = gst_message_new_custom (GST_MESSAGE_ASYNC_DONE, src, NULL);
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_ASYNC_DONE),
+ GST_QUARK (RESET_TIME), G_TYPE_BOOLEAN, reset_time, NULL);
+ message = gst_message_new_custom (GST_MESSAGE_ASYNC_DONE, src, structure);
return message;
}
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_REQUEST_STATE),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_REQUEST_STATE),
GST_QUARK (NEW_STATE), GST_TYPE_STATE, (gint) state, NULL);
message = gst_message_new_custom (GST_MESSAGE_REQUEST_STATE, src, structure);
{
g_return_val_if_fail (GST_IS_MESSAGE (message), NULL);
- return message->structure;
+ return GST_MESSAGE_STRUCTURE (message);
+}
+
+/**
+ * gst_message_has_name:
+ * @message: The #GstMessage.
+ * @name: name to check
+ *
+ * Checks if @message has the given @name. This function is usually used to
+ * check the name of a custom message.
+ *
+ * Returns: %TRUE if @name matches the name of the message structure.
+ *
+ * Since: 0.10.20
+ */
+gboolean
+gst_message_has_name (GstMessage * message, const gchar * name)
+{
+ GstStructure *structure;
+
+ g_return_val_if_fail (GST_IS_MESSAGE (message), FALSE);
+
+ structure = GST_MESSAGE_STRUCTURE (message);
+ if (structure == NULL)
+ return FALSE;
+
+ return gst_structure_has_name (structure, name);
}
/**
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG);
g_return_if_fail (tag_list != NULL);
- ret = gst_structure_copy (message->structure);
- gst_structure_remove_field (ret, "source-pad");
-
- *tag_list = (GstTagList *) ret;
-}
-
-/**
- * gst_message_parse_tag_full:
- * @message: A valid #GstMessage of type GST_MESSAGE_TAG.
- * @pad: (out callee-allocates): location where the originating pad is stored,
- * unref after usage
- * @tag_list: (out callee-allocates): return location for the tag-list.
- *
- * Extracts the tag list from the GstMessage. The tag list returned in the
- * output argument is a copy; the caller must free it when done.
- *
- * MT safe.
- *
- * Since: 0.10.24
- */
-void
-gst_message_parse_tag_full (GstMessage * message, GstPad ** pad,
- GstTagList ** tag_list)
-{
- GstStructure *ret;
-
- g_return_if_fail (GST_IS_MESSAGE (message));
- g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TAG);
- g_return_if_fail (tag_list != NULL);
-
- ret = gst_structure_copy (message->structure);
-
- if (gst_structure_has_field (ret, "source-pad") && pad) {
- const GValue *v;
-
- v = gst_structure_get_value (ret, "source-pad");
- if (v && G_VALUE_HOLDS (v, GST_TYPE_PAD))
- *pad = g_value_dup_object (v);
- else
- *pad = NULL;
- } else if (pad) {
- *pad = NULL;
- }
+ ret = gst_structure_copy (GST_MESSAGE_STRUCTURE (message));
gst_structure_remove_field (ret, "source-pad");
*tag_list = (GstTagList *) ret;
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING);
if (percent)
- *percent = g_value_get_int (gst_structure_id_get_value (message->structure,
- GST_QUARK (BUFFER_PERCENT)));
+ *percent =
+ g_value_get_int (gst_structure_id_get_value (GST_MESSAGE_STRUCTURE
+ (message), GST_QUARK (BUFFER_PERCENT)));
}
/**
{
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING);
- gst_structure_id_set (message->structure,
+ gst_structure_id_set (GST_MESSAGE_STRUCTURE (message),
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode,
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in,
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out,
GstBufferingMode * mode, gint * avg_in, gint * avg_out,
gint64 * buffering_left)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_BUFFERING);
+ structure = GST_MESSAGE_STRUCTURE (message);
if (mode)
- *mode = g_value_get_enum (gst_structure_id_get_value (message->structure,
+ *mode = (GstBufferingMode)
+ g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (BUFFERING_MODE)));
if (avg_in)
- *avg_in = g_value_get_int (gst_structure_id_get_value (message->structure,
+ *avg_in = g_value_get_int (gst_structure_id_get_value (structure,
GST_QUARK (AVG_IN_RATE)));
if (avg_out)
- *avg_out = g_value_get_int (gst_structure_id_get_value (message->structure,
+ *avg_out = g_value_get_int (gst_structure_id_get_value (structure,
GST_QUARK (AVG_OUT_RATE)));
if (buffering_left)
*buffering_left =
- g_value_get_int64 (gst_structure_id_get_value (message->structure,
+ g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (BUFFERING_LEFT)));
}
gst_message_parse_state_changed (GstMessage * message,
GstState * oldstate, GstState * newstate, GstState * pending)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STATE_CHANGED);
+ structure = GST_MESSAGE_STRUCTURE (message);
if (oldstate)
- *oldstate =
- g_value_get_enum (gst_structure_id_get_value (message->structure,
+ *oldstate = (GstState)
+ g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (OLD_STATE)));
if (newstate)
- *newstate =
- g_value_get_enum (gst_structure_id_get_value (message->structure,
+ *newstate = (GstState)
+ g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (NEW_STATE)));
if (pending)
- *pending = g_value_get_enum (gst_structure_id_get_value (message->structure,
+ *pending = (GstState)
+ g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (PENDING_STATE)));
}
gboolean * ready)
{
const GValue *clock_gvalue;
+ GstStructure *structure;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_PROVIDE);
- clock_gvalue =
- gst_structure_id_get_value (message->structure, GST_QUARK (CLOCK));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ clock_gvalue = gst_structure_id_get_value (structure, GST_QUARK (CLOCK));
g_return_if_fail (clock_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
if (ready)
*ready =
- g_value_get_boolean (gst_structure_id_get_value (message->structure,
+ g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (READY)));
if (clock)
*clock = (GstClock *) g_value_get_object (clock_gvalue);
gst_message_parse_clock_lost (GstMessage * message, GstClock ** clock)
{
const GValue *clock_gvalue;
+ GstStructure *structure;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_CLOCK_LOST);
- clock_gvalue =
- gst_structure_id_get_value (message->structure, GST_QUARK (CLOCK));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ clock_gvalue = gst_structure_id_get_value (structure, GST_QUARK (CLOCK));
g_return_if_fail (clock_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
gst_message_parse_new_clock (GstMessage * message, GstClock ** clock)
{
const GValue *clock_gvalue;
+ GstStructure *structure;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_NEW_CLOCK);
- clock_gvalue =
- gst_structure_id_get_value (message->structure, GST_QUARK (CLOCK));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ clock_gvalue = gst_structure_id_get_value (structure, GST_QUARK (CLOCK));
g_return_if_fail (clock_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (clock_gvalue) == GST_TYPE_CLOCK);
GstStructureChangeType * type, GstElement ** owner, gboolean * busy)
{
const GValue *owner_gvalue;
+ GstStructure *structure;
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));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ owner_gvalue = gst_structure_id_get_value (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,
+ *type = (GstStructureChangeType)
+ g_value_get_enum (gst_structure_id_get_value (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,
+ g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (BUSY)));
}
{
const GValue *error_gvalue;
GError *error_val;
+ GstStructure *structure;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR);
- error_gvalue =
- gst_structure_id_get_value (message->structure, GST_QUARK (GERROR));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ error_gvalue = gst_structure_id_get_value (structure, GST_QUARK (GERROR));
g_return_if_fail (error_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
if (debug)
*debug =
- g_value_dup_string (gst_structure_id_get_value (message->structure,
+ g_value_dup_string (gst_structure_id_get_value (structure,
GST_QUARK (DEBUG)));
}
{
const GValue *error_gvalue;
GError *error_val;
+ GstStructure *structure;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING);
- error_gvalue =
- gst_structure_id_get_value (message->structure, GST_QUARK (GERROR));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ error_gvalue = gst_structure_id_get_value (structure, GST_QUARK (GERROR));
g_return_if_fail (error_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
if (debug)
*debug =
- g_value_dup_string (gst_structure_id_get_value (message->structure,
+ g_value_dup_string (gst_structure_id_get_value (structure,
GST_QUARK (DEBUG)));
}
{
const GValue *error_gvalue;
GError *error_val;
+ GstStructure *structure;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_INFO);
- error_gvalue =
- gst_structure_id_get_value (message->structure, GST_QUARK (GERROR));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ error_gvalue = gst_structure_id_get_value (structure, GST_QUARK (GERROR));
g_return_if_fail (error_gvalue != NULL);
g_return_if_fail (G_VALUE_TYPE (error_gvalue) == GST_TYPE_G_ERROR);
if (debug)
*debug =
- g_value_dup_string (gst_structure_id_get_value (message->structure,
+ g_value_dup_string (gst_structure_id_get_value (structure,
GST_QUARK (DEBUG)));
}
gst_message_parse_segment_start (GstMessage * message, GstFormat * format,
gint64 * position)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_START);
+ structure = GST_MESSAGE_STRUCTURE (message);
if (format)
- *format =
- g_value_get_enum (gst_structure_id_get_value (message->structure,
+ *format = (GstFormat)
+ g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (position)
*position =
- g_value_get_int64 (gst_structure_id_get_value (message->structure,
+ g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (POSITION)));
}
gst_message_parse_segment_done (GstMessage * message, GstFormat * format,
gint64 * position)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_SEGMENT_DONE);
+ structure = GST_MESSAGE_STRUCTURE (message);
if (format)
- *format =
- g_value_get_enum (gst_structure_id_get_value (message->structure,
+ *format = (GstFormat)
+ g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (position)
*position =
- g_value_get_int64 (gst_structure_id_get_value (message->structure,
+ g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (POSITION)));
}
gst_message_parse_duration (GstMessage * message, GstFormat * format,
gint64 * duration)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_DURATION);
+ structure = GST_MESSAGE_STRUCTURE (message);
if (format)
- *format =
- g_value_get_enum (gst_structure_id_get_value (message->structure,
+ *format = (GstFormat)
+ g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (duration)
*duration =
- g_value_get_int64 (gst_structure_id_get_value (message->structure,
+ g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (DURATION)));
}
/**
- * gst_message_parse_async_start:
+ * gst_message_parse_async_done:
* @message: A valid #GstMessage of type GST_MESSAGE_ASYNC_DONE.
- * @new_base_time: (out): Result location for the new_base_time or NULL
+ * @reset_time: (out): Result location for the reset_time or NULL
*
- * Extract the new_base_time from the async_start message.
+ * Extract the reset_time from the async_done message.
*
* MT safe.
- *
- * Since: 0.10.13
*/
void
-gst_message_parse_async_start (GstMessage * message, gboolean * new_base_time)
+gst_message_parse_async_done (GstMessage * message, gboolean * reset_time)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
- g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ASYNC_START);
+ g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ASYNC_DONE);
- if (new_base_time)
- *new_base_time =
- g_value_get_boolean (gst_structure_id_get_value (message->structure,
- GST_QUARK (NEW_BASE_TIME)));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ if (reset_time)
+ *reset_time =
+ g_value_get_boolean (gst_structure_id_get_value (structure,
+ GST_QUARK (RESET_TIME)));
}
/**
void
gst_message_parse_request_state (GstMessage * message, GstState * state)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_REQUEST_STATE);
+ structure = GST_MESSAGE_STRUCTURE (message);
if (state)
- *state = g_value_get_enum (gst_structure_id_get_value (message->structure,
+ *state = (GstState)
+ g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (NEW_STATE)));
}
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_STREAM_STATUS),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_STREAM_STATUS),
GST_QUARK (TYPE), GST_TYPE_STREAM_STATUS_TYPE, (gint) type,
GST_QUARK (OWNER), GST_TYPE_ELEMENT, owner, NULL);
message = gst_message_new_custom (GST_MESSAGE_STREAM_STATUS, src, structure);
GstStreamStatusType * type, GstElement ** owner)
{
const GValue *owner_gvalue;
+ GstStructure *structure;
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS);
- owner_gvalue =
- gst_structure_id_get_value (message->structure, GST_QUARK (OWNER));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ owner_gvalue = gst_structure_id_get_value (structure, GST_QUARK (OWNER));
g_return_if_fail (owner_gvalue != NULL);
if (type)
- *type = g_value_get_enum (gst_structure_id_get_value (message->structure,
+ *type = (GstStreamStatusType)
+ g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (TYPE)));
if (owner)
*owner = (GstElement *) g_value_get_object (owner_gvalue);
gst_message_set_stream_status_object (GstMessage * message,
const GValue * object)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS);
- gst_structure_id_set_value (message->structure, GST_QUARK (OBJECT), object);
+ structure = GST_MESSAGE_STRUCTURE (message);
+ gst_structure_id_set_value (structure, GST_QUARK (OBJECT), object);
}
/**
gst_message_get_stream_status_object (GstMessage * message)
{
const GValue *result;
+ GstStructure *structure;
g_return_val_if_fail (GST_IS_MESSAGE (message), NULL);
g_return_val_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STREAM_STATUS,
NULL);
- result = gst_structure_id_get_value (message->structure, GST_QUARK (OBJECT));
+ structure = GST_MESSAGE_STRUCTURE (message);
+ result = gst_structure_id_get_value (structure, GST_QUARK (OBJECT));
return result;
}
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_STEP_DONE),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_STEP_DONE),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (AMOUNT), G_TYPE_UINT64, amount,
GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
guint64 * amount, gdouble * rate, gboolean * flush, gboolean * intermediate,
guint64 * duration, gboolean * eos)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STEP_DONE);
- gst_structure_id_get (message->structure,
+ structure = GST_MESSAGE_STRUCTURE (message);
+ gst_structure_id_get (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (AMOUNT), G_TYPE_UINT64, amount,
GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_STEP_START),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_STEP_START),
GST_QUARK (ACTIVE), G_TYPE_BOOLEAN, active,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (AMOUNT), G_TYPE_UINT64, amount,
GstFormat * format, guint64 * amount, gdouble * rate, gboolean * flush,
gboolean * intermediate)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_STEP_START);
- gst_structure_id_get (message->structure,
+ structure = GST_MESSAGE_STRUCTURE (message);
+ gst_structure_id_get (structure,
GST_QUARK (ACTIVE), G_TYPE_BOOLEAN, active,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (AMOUNT), G_TYPE_UINT64, amount,
GstMessage *message;
GstStructure *structure;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_QOS),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_QOS),
GST_QUARK (LIVE), G_TYPE_BOOLEAN, live,
GST_QUARK (RUNNING_TIME), G_TYPE_UINT64, running_time,
GST_QUARK (STREAM_TIME), G_TYPE_UINT64, stream_time,
gst_message_set_qos_values (GstMessage * message, gint64 jitter,
gdouble proportion, gint quality)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
- gst_structure_id_set (message->structure,
+ structure = GST_MESSAGE_STRUCTURE (message);
+ gst_structure_id_set (structure,
GST_QUARK (JITTER), G_TYPE_INT64, jitter,
GST_QUARK (PROPORTION), G_TYPE_DOUBLE, proportion,
GST_QUARK (QUALITY), G_TYPE_INT, quality, NULL);
gst_message_set_qos_stats (GstMessage * message, GstFormat format,
guint64 processed, guint64 dropped)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
- gst_structure_id_set (message->structure,
+ structure = GST_MESSAGE_STRUCTURE (message);
+ gst_structure_id_set (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (PROCESSED), G_TYPE_UINT64, processed,
GST_QUARK (DROPPED), G_TYPE_UINT64, dropped, NULL);
guint64 * running_time, guint64 * stream_time, guint64 * timestamp,
guint64 * duration)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
- gst_structure_id_get (message->structure,
+ structure = GST_MESSAGE_STRUCTURE (message);
+ gst_structure_id_get (structure,
GST_QUARK (LIVE), G_TYPE_BOOLEAN, live,
GST_QUARK (RUNNING_TIME), G_TYPE_UINT64, running_time,
GST_QUARK (STREAM_TIME), G_TYPE_UINT64, stream_time,
gst_message_parse_qos_values (GstMessage * message, gint64 * jitter,
gdouble * proportion, gint * quality)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
- gst_structure_id_get (message->structure,
+ structure = GST_MESSAGE_STRUCTURE (message);
+ gst_structure_id_get (structure,
GST_QUARK (JITTER), G_TYPE_INT64, jitter,
GST_QUARK (PROPORTION), G_TYPE_DOUBLE, proportion,
GST_QUARK (QUALITY), G_TYPE_INT, quality, NULL);
gst_message_parse_qos_stats (GstMessage * message, GstFormat * format,
guint64 * processed, guint64 * dropped)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_QOS);
- gst_structure_id_get (message->structure,
+ structure = GST_MESSAGE_STRUCTURE (message);
+ gst_structure_id_get (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (PROCESSED), G_TYPE_UINT64, processed,
GST_QUARK (DROPPED), G_TYPE_UINT64, dropped, NULL);
if (type == GST_PROGRESS_TYPE_START || type == GST_PROGRESS_TYPE_CONTINUE)
percent = 0;
- structure = gst_structure_id_new (GST_QUARK (MESSAGE_PROGRESS),
+ structure = gst_structure_new_id (GST_QUARK (MESSAGE_PROGRESS),
GST_QUARK (TYPE), GST_TYPE_PROGRESS_TYPE, type,
GST_QUARK (CODE), G_TYPE_STRING, code,
GST_QUARK (TEXT), G_TYPE_STRING, text,
gst_message_parse_progress (GstMessage * message, GstProgressType * type,
gchar ** code, gchar ** text)
{
+ GstStructure *structure;
+
g_return_if_fail (GST_IS_MESSAGE (message));
g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_PROGRESS);
- gst_structure_id_get (message->structure,
+ structure = GST_MESSAGE_STRUCTURE (message);
+ gst_structure_id_get (structure,
GST_QUARK (TYPE), GST_TYPE_PROGRESS_TYPE, type,
GST_QUARK (CODE), G_TYPE_STRING, code,
GST_QUARK (TEXT), G_TYPE_STRING, text, NULL);