summaryrefslogtreecommitdiff
path: root/gst/gstmessage.c
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2012-04-02 21:15:09 +0200
committerStefan Sauer <ensonic@users.sf.net>2012-04-02 21:33:10 +0200
commit1074a4e99a473efd5ee690da9ecd797c55cec23a (patch)
treeb83054c4f32247615ed06aa34aef2c574446aad6 /gst/gstmessage.c
parentf3aad8b4306d786848af9c612a03c81bec30d25b (diff)
parentea9cc8c871eab95e6fdc268122c13d2706b3b63d (diff)
Merge branch '0.10'
Conflicts: docs/gst/gstreamer-sections.txt gst/Makefile.am gst/gst.c gst/gst.h gst/gstevent.c gst/gstevent.h gst/gstmessage.h gst/gstquark.c gst/gstquark.h gst/gstquery.c gst/gstquery.h tests/check/Makefile.am
Diffstat (limited to 'gst/gstmessage.c')
-rw-r--r--gst/gstmessage.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/gst/gstmessage.c b/gst/gstmessage.c
index 7db7570a5..5c1e50a56 100644
--- a/gst/gstmessage.c
+++ b/gst/gstmessage.c
@@ -104,6 +104,7 @@ static GstMessageQuarks message_quarks[] = {
{GST_MESSAGE_STEP_START, "step-start", 0},
{GST_MESSAGE_QOS, "qos", 0},
{GST_MESSAGE_PROGRESS, "progress", 0},
+ {GST_MESSAGE_TOC, "toc", 0},
{0, NULL, 0}
};
@@ -2171,3 +2172,61 @@ gst_message_parse_progress (GstMessage * message, GstProgressType * type,
GST_QUARK (CODE), G_TYPE_STRING, code,
GST_QUARK (TEXT), G_TYPE_STRING, text, NULL);
}
+
+/**
+ * gst_message_new_toc:
+ * @src: the object originating the message.
+ * @toc: #GstToc structure for the message.
+ * @updated: whether TOC was updated or not.
+ *
+ * Create a new TOC message. The message is posted by elements
+ * that discovered or updated a TOC.
+ *
+ * Returns: a new TOC message.
+ *
+ * MT safe.
+ *
+ * Since: 0.10.37
+ */
+GstMessage *
+gst_message_new_toc (GstObject * src, GstToc * toc, gboolean updated)
+{
+ GstStructure *toc_struct;
+
+ g_return_val_if_fail (toc != NULL, NULL);
+
+ toc_struct = _gst_toc_to_structure (toc);
+
+ if (G_LIKELY (toc_struct != NULL)) {
+ _gst_toc_structure_set_updated (toc_struct, updated);
+ return gst_message_new_custom (GST_MESSAGE_TOC, src, toc_struct);
+ } else
+ return NULL;
+}
+
+/**
+ * gst_message_parse_toc:
+ * @message: a valid #GstMessage of type GST_MESSAGE_TOC.
+ * @toc: (out): return location for the TOC.
+ * @updated: (out): return location for the updated flag.
+ *
+ * Extract the TOC from the #GstMessage. The TOC returned in the
+ * output argument is a copy; the caller must free it with
+ * gst_toc_free() when done.
+ *
+ * MT safe.
+ *
+ * Since: 0.10.37
+ */
+void
+gst_message_parse_toc (GstMessage * message, GstToc ** toc, gboolean * updated)
+{
+ g_return_if_fail (GST_IS_MESSAGE (message));
+ g_return_if_fail (GST_MESSAGE_TYPE (message) == GST_MESSAGE_TOC);
+ g_return_if_fail (toc != NULL);
+
+ *toc = _gst_toc_from_structure (message->structure);
+
+ if (updated != NULL)
+ *updated = _gst_toc_structure_get_updated (message->structure);
+}