gst: Add new GstContext miniobject for sharing contexts in a pipeline
[platform/upstream/gstreamer.git] / gst / gstmessage.h
1 /* GStreamer
2  * Copyright (C) 2004 Wim Taymans <wim@fluendo.com>
3  *
4  * gstmessage.h: Header for GstMessage subsystem
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 #ifndef __GST_MESSAGE_H__
23 #define __GST_MESSAGE_H__
24
25 G_BEGIN_DECLS
26
27 typedef struct _GstMessage GstMessage;
28
29 /**
30  * GstMessageType:
31  * @GST_MESSAGE_UNKNOWN: an undefined message
32  * @GST_MESSAGE_EOS: end-of-stream reached in a pipeline. The application will
33  * only receive this message in the PLAYING state and every time it sets a
34  * pipeline to PLAYING that is in the EOS state. The application can perform a
35  * flushing seek in the pipeline, which will undo the EOS state again.
36  * @GST_MESSAGE_ERROR: an error occured. When the application receives an error
37  * message it should stop playback of the pipeline and not assume that more
38  * data will be played.
39  * @GST_MESSAGE_WARNING: a warning occured.
40  * @GST_MESSAGE_INFO: an info message occured
41  * @GST_MESSAGE_TAG: a tag was found.
42  * @GST_MESSAGE_BUFFERING: the pipeline is buffering. When the application
43  * receives a buffering message in the PLAYING state for a non-live pipeline it
44  * must PAUSE the pipeline until the buffering completes, when the percentage
45  * field in the message is 100%. For live pipelines, no action must be
46  * performed and the buffering percentage can be used to inform the user about
47  * the progress.
48  * @GST_MESSAGE_STATE_CHANGED: a state change happened
49  * @GST_MESSAGE_STATE_DIRTY: an element changed state in a streaming thread.
50  * This message is deprecated.
51  * @GST_MESSAGE_STEP_DONE: a stepping operation finished.
52  * @GST_MESSAGE_CLOCK_PROVIDE: an element notifies its capability of providing
53  *                             a clock. This message is used internally and
54  *                             never forwarded to the application.
55  * @GST_MESSAGE_CLOCK_LOST: The current clock as selected by the pipeline became
56  *                          unusable. The pipeline will select a new clock on
57  *                          the next PLAYING state change. The application
58  *                          should set the pipeline to PAUSED and back to
59  *                          PLAYING when this message is received.
60  * @GST_MESSAGE_NEW_CLOCK: a new clock was selected in the pipeline.
61  * @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed. This
62  * message is used internally and never forwarded to the application.
63  * @GST_MESSAGE_STREAM_STATUS: status about a stream, emitted when it starts,
64  *                             stops, errors, etc..
65  * @GST_MESSAGE_APPLICATION: message posted by the application, possibly
66  *                           via an application-specific element.
67  * @GST_MESSAGE_ELEMENT: element-specific message, see the specific element's
68  *                       documentation
69  * @GST_MESSAGE_SEGMENT_START: pipeline started playback of a segment. This
70  * message is used internally and never forwarded to the application.
71  * @GST_MESSAGE_SEGMENT_DONE: pipeline completed playback of a segment. This
72  * message is forwarded to the application after all elements that posted
73  * @GST_MESSAGE_SEGMENT_START posted a GST_MESSAGE_SEGMENT_DONE message.
74  * @GST_MESSAGE_DURATION_CHANGED: The duration of a pipeline changed. The
75  * application can get the new duration with a duration query.
76  * @GST_MESSAGE_ASYNC_START: Posted by elements when they start an ASYNC
77  * #GstStateChange. This message is not forwarded to the application but is used
78  * internally.
79  * @GST_MESSAGE_ASYNC_DONE: Posted by elements when they complete an ASYNC
80  * #GstStateChange. The application will only receive this message from the toplevel
81  * pipeline.
82  * @GST_MESSAGE_LATENCY: Posted by elements when their latency changes. The
83  * application should recalculate and distribute a new latency.
84  * @GST_MESSAGE_REQUEST_STATE: Posted by elements when they want the pipeline to
85  * change state. This message is a suggestion to the application which can
86  * decide to perform the state change on (part of) the pipeline.
87  * @GST_MESSAGE_STEP_START: A stepping operation was started.
88  * @GST_MESSAGE_QOS: A buffer was dropped or an element changed its processing
89  * strategy for Quality of Service reasons.
90  * @GST_MESSAGE_PROGRESS: A progress message.
91  * @GST_MESSAGE_TOC: A new table of contents (TOC) was found or previously found TOC
92  * was updated.
93  * @GST_MESSAGE_RESET_TIME: Message to request resetting the pipeline's
94  *     running time from the pipeline. This is an internal message which
95  *     applications will likely never receive.
96  * @GST_MESSAGE_STREAM_START: Message indicating start of a new stream. Useful
97  *     e.g. when using playbin in gapless playback mode, to get notified when
98  *     the next title actually starts playing (which will be some time after
99  *     the URI for the next title has been set).
100  * @GST_MESSAGE_ANY: mask for all of the above messages.
101  *
102  * The different message types that are available.
103  */
104 /* NOTE: keep in sync with quark registration in gstmessage.c
105  * NOTE: keep GST_MESSAGE_ANY a valid gint to avoid compiler warnings.
106  */
107 typedef enum
108 {
109   GST_MESSAGE_UNKNOWN           = 0,
110   GST_MESSAGE_EOS               = (1 << 0),
111   GST_MESSAGE_ERROR             = (1 << 1),
112   GST_MESSAGE_WARNING           = (1 << 2),
113   GST_MESSAGE_INFO              = (1 << 3),
114   GST_MESSAGE_TAG               = (1 << 4),
115   GST_MESSAGE_BUFFERING         = (1 << 5),
116   GST_MESSAGE_STATE_CHANGED     = (1 << 6),
117   GST_MESSAGE_STATE_DIRTY       = (1 << 7),
118   GST_MESSAGE_STEP_DONE         = (1 << 8),
119   GST_MESSAGE_CLOCK_PROVIDE     = (1 << 9),
120   GST_MESSAGE_CLOCK_LOST        = (1 << 10),
121   GST_MESSAGE_NEW_CLOCK         = (1 << 11),
122   GST_MESSAGE_STRUCTURE_CHANGE  = (1 << 12),
123   GST_MESSAGE_STREAM_STATUS     = (1 << 13),
124   GST_MESSAGE_APPLICATION       = (1 << 14),
125   GST_MESSAGE_ELEMENT           = (1 << 15),
126   GST_MESSAGE_SEGMENT_START     = (1 << 16),
127   GST_MESSAGE_SEGMENT_DONE      = (1 << 17),
128   GST_MESSAGE_DURATION_CHANGED  = (1 << 18),
129   GST_MESSAGE_LATENCY           = (1 << 19),
130   GST_MESSAGE_ASYNC_START       = (1 << 20),
131   GST_MESSAGE_ASYNC_DONE        = (1 << 21),
132   GST_MESSAGE_REQUEST_STATE     = (1 << 22),
133   GST_MESSAGE_STEP_START        = (1 << 23),
134   GST_MESSAGE_QOS               = (1 << 24),
135   GST_MESSAGE_PROGRESS          = (1 << 25),
136   GST_MESSAGE_TOC               = (1 << 26),
137   GST_MESSAGE_RESET_TIME        = (1 << 27),
138   GST_MESSAGE_STREAM_START      = (1 << 28),
139   GST_MESSAGE_NEED_CONTEXT      = (1 << 29),
140   GST_MESSAGE_HAVE_CONTEXT      = (1 << 30),
141   GST_MESSAGE_ANY               = ~0
142 } GstMessageType;
143
144 #include <gst/gstminiobject.h>
145 #include <gst/gstobject.h>
146 #include <gst/gstelement.h>
147 #include <gst/gsttaglist.h>
148 #include <gst/gststructure.h>
149 #include <gst/gstquery.h>
150 #include <gst/gsttoc.h>
151
152 #define GST_TYPE_MESSAGE                         (gst_message_get_type())
153 #define GST_IS_MESSAGE(obj)                      (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_MESSAGE))
154 #define GST_MESSAGE_CAST(obj)                    ((GstMessage*)(obj))
155 #define GST_MESSAGE(obj)                         (GST_MESSAGE_CAST(obj))
156
157 /* the lock is used to handle the synchronous handling of messages,
158  * the emiting thread is block until the handling thread processed
159  * the message using this mutex/cond pair */
160 #define GST_MESSAGE_GET_LOCK(message)   (&GST_MESSAGE_CAST(message)->lock)
161 #define GST_MESSAGE_LOCK(message)       g_mutex_lock(GST_MESSAGE_GET_LOCK(message))
162 #define GST_MESSAGE_UNLOCK(message)     g_mutex_unlock(GST_MESSAGE_GET_LOCK(message))
163 #define GST_MESSAGE_GET_COND(message)   (&GST_MESSAGE_CAST(message)->cond)
164 #define GST_MESSAGE_WAIT(message)       g_cond_wait(GST_MESSAGE_GET_COND(message),GST_MESSAGE_GET_LOCK(message))
165 #define GST_MESSAGE_SIGNAL(message)     g_cond_signal(GST_MESSAGE_GET_COND(message))
166
167 /**
168  * GST_MESSAGE_TYPE:
169  * @message: a #GstMessage
170  *
171  * Get the #GstMessageType of @message.
172  */
173 #define GST_MESSAGE_TYPE(message)       (GST_MESSAGE_CAST(message)->type)
174 /**
175  * GST_MESSAGE_TYPE_NAME:
176  * @message: a #GstMessage
177  *
178  * Get a constant string representation of the #GstMessageType of @message.
179  */
180 #define GST_MESSAGE_TYPE_NAME(message)  gst_message_type_get_name(GST_MESSAGE_TYPE(message))
181 /**
182  * GST_MESSAGE_TIMESTAMP:
183  * @message: a #GstMessage
184  *
185  * Get the timestamp of @message. This is the timestamp when the message
186  * was created.
187  */
188 #define GST_MESSAGE_TIMESTAMP(message)  (GST_MESSAGE_CAST(message)->timestamp)
189 /**
190  * GST_MESSAGE_SRC:
191  * @message: a #GstMessage
192  *
193  * Get the object that posted @message.
194  */
195 #define GST_MESSAGE_SRC(message)        (GST_MESSAGE_CAST(message)->src)
196
197 /**
198  * GST_MESSAGE_SEQNUM:
199  * @message: a #GstMessage
200  *
201  * Get the sequence number of @message.
202  */
203 #define GST_MESSAGE_SEQNUM(message)     (GST_MESSAGE_CAST(message)->seqnum)
204
205 /**
206  * GST_MESSAGE_SRC_NAME:
207  * @message: a #GstMessage
208  *
209  * Get the name of the object that posted @message. Returns "(NULL)" if
210  * the message has no source object set.
211  */
212 #define GST_MESSAGE_SRC_NAME(message)   (GST_MESSAGE_SRC(message) ? \
213     GST_OBJECT_NAME (GST_MESSAGE_SRC(message)) : "(NULL)")
214
215 /**
216  * GstStructureChangeType:
217  * @GST_STRUCTURE_CHANGE_TYPE_PAD_LINK: Pad linking is starting or done.
218  * @GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK: Pad unlinking is starting or done.
219  *
220  * The type of a %GST_MESSAGE_STRUCTURE_CHANGE.
221  */
222 typedef enum {
223   GST_STRUCTURE_CHANGE_TYPE_PAD_LINK   = 0,
224   GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK = 1
225 } GstStructureChangeType;
226
227 /**
228  * GstStreamStatusType:
229  * @GST_STREAM_STATUS_TYPE_CREATE: A new thread need to be created.
230  * @GST_STREAM_STATUS_TYPE_ENTER: a thread entered its loop function
231  * @GST_STREAM_STATUS_TYPE_LEAVE: a thread left its loop function
232  * @GST_STREAM_STATUS_TYPE_DESTROY: a thread is destroyed
233  * @GST_STREAM_STATUS_TYPE_START: a thread is started
234  * @GST_STREAM_STATUS_TYPE_PAUSE: a thread is paused
235  * @GST_STREAM_STATUS_TYPE_STOP: a thread is stopped
236  *
237  * The type of a %GST_MESSAGE_STREAM_STATUS. The stream status messages inform the
238  * application of new streaming threads and their status.
239  */
240 typedef enum {
241   GST_STREAM_STATUS_TYPE_CREATE   = 0,
242   GST_STREAM_STATUS_TYPE_ENTER    = 1,
243   GST_STREAM_STATUS_TYPE_LEAVE    = 2,
244   GST_STREAM_STATUS_TYPE_DESTROY  = 3,
245
246   GST_STREAM_STATUS_TYPE_START    = 8,
247   GST_STREAM_STATUS_TYPE_PAUSE    = 9,
248   GST_STREAM_STATUS_TYPE_STOP     = 10
249 } GstStreamStatusType;
250
251 /**
252  * GstProgressType:
253  * @GST_PROGRESS_TYPE_START: A new task started.
254  * @GST_PROGRESS_TYPE_CONTINUE: A task completed and a new one continues.
255  * @GST_PROGRESS_TYPE_COMPLETE: A task completed.
256  * @GST_PROGRESS_TYPE_CANCELED: A task was canceled.
257  * @GST_PROGRESS_TYPE_ERROR: A task caused an error. An error message is also
258  *          posted on the bus.
259  *
260  * The type of a %GST_MESSAGE_PROGRESS. The progress messages inform the
261  * application of the status of assynchronous tasks.
262  */
263 typedef enum {
264   GST_PROGRESS_TYPE_START    = 0,
265   GST_PROGRESS_TYPE_CONTINUE = 1,
266   GST_PROGRESS_TYPE_COMPLETE = 2,
267   GST_PROGRESS_TYPE_CANCELED = 3,
268   GST_PROGRESS_TYPE_ERROR    = 4
269 } GstProgressType;
270
271 /**
272  * GstMessage:
273  * @mini_object: the parent structure
274  * @type: the #GstMessageType of the message
275  * @timestamp: the timestamp of the message
276  * @src: the src of the message
277  * @seqnum: the sequence number of the message
278  *
279  * A #GstMessage.
280  */
281 struct _GstMessage
282 {
283   GstMiniObject   mini_object;
284
285   /*< public > *//* with COW */
286   GstMessageType  type;
287   guint64         timestamp;
288   GstObject      *src;
289   guint32         seqnum;
290
291   /*< private >*//* with MESSAGE_LOCK */
292   GMutex          lock;                 /* lock and cond for async delivery */
293   GCond           cond;
294 };
295
296 GType           gst_message_get_type            (void);
297
298 const gchar*    gst_message_type_get_name       (GstMessageType type);
299 GQuark          gst_message_type_to_quark       (GstMessageType type);
300
301 /* refcounting */
302 /**
303  * gst_message_ref:
304  * @msg: the message to ref
305  *
306  * Convenience macro to increase the reference count of the message.
307  *
308  * Returns: @msg (for convenience when doing assignments)
309  */
310 #ifdef _FOOL_GTK_DOC_
311 G_INLINE_FUNC GstMessage * gst_message_ref (GstMessage * msg);
312 #endif
313
314 static inline GstMessage *
315 gst_message_ref (GstMessage * msg)
316 {
317   return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg));
318 }
319
320 /**
321  * gst_message_unref:
322  * @msg: the message to unref
323  *
324  * Convenience macro to decrease the reference count of the message, possibly
325  * freeing it.
326  */
327 #ifdef _FOOL_GTK_DOC_
328 G_INLINE_FUNC void gst_message_unref (GstMessage * msg);
329 #endif
330
331 static inline void
332 gst_message_unref (GstMessage * msg)
333 {
334   gst_mini_object_unref (GST_MINI_OBJECT_CAST (msg));
335 }
336
337 /* copy message */
338 /**
339  * gst_message_copy:
340  * @msg: the message to copy
341  *
342  * Creates a copy of the message. Returns a copy of the message.
343  *
344  * Returns: (transfer full): a new copy of @msg.
345  *
346  * MT safe
347  */
348 #ifdef _FOOL_GTK_DOC_
349 G_INLINE_FUNC GstMessage * gst_message_copy (const GstMessage * msg);
350 #endif
351
352 static inline GstMessage *
353 gst_message_copy (const GstMessage * msg)
354 {
355   return GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (msg)));
356 }
357
358 /**
359  * gst_message_is_writable:
360  * @msg: a #GstMessage
361  *
362  * Tests if you can safely write into a message's structure or validly
363  * modify the seqnum and timestamp fields.
364  */
365 #define         gst_message_is_writable(msg)     gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (msg))
366 /**
367  * gst_message_make_writable:
368  * @msg: (transfer full): the message to make writable
369  *
370  * Checks if a message is writable. If not, a writable copy is made and
371  * returned.
372  *
373  * Returns: (transfer full): a message (possibly a duplicate) that is writable.
374  *
375  * MT safe
376  */
377 #define         gst_message_make_writable(msg)  GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg)))
378 /**
379  * gst_message_replace:
380  * @old_message: (inout) (transfer full): pointer to a pointer to a #GstMessage
381  *     to be replaced.
382  * @new_message: (allow-none) (transfer none): pointer to a #GstMessage that will
383  *     replace the message pointed to by @old_message.
384  *
385  * Modifies a pointer to a #GstMessage to point to a different #GstMessage. The
386  * modification is done atomically (so this is useful for ensuring thread safety
387  * in some cases), and the reference counts are updated appropriately (the old
388  * message is unreffed, the new one is reffed).
389  *
390  * Either @new_message or the #GstMessage pointed to by @old_message may be NULL.
391  *
392  * Returns: TRUE if @new_message was different from @old_message
393  */
394 #ifdef _FOOL_GTK_DOC_
395 G_INLINE_FUNC gboolean gst_message_replace (GstMessage **old_message, GstMessage *new_message);
396 #endif
397
398 static inline gboolean
399 gst_message_replace (GstMessage **old_message, GstMessage *new_message)
400 {
401   return gst_mini_object_replace ((GstMiniObject **) old_message, (GstMiniObject *) new_message);
402 }
403
404
405 /* custom messages */
406 GstMessage *    gst_message_new_custom          (GstMessageType type,
407                                                  GstObject    * src,
408                                                  GstStructure * structure) G_GNUC_MALLOC;
409 const GstStructure *
410                 gst_message_get_structure       (GstMessage *message);
411
412 gboolean        gst_message_has_name            (GstMessage *message, const gchar *name);
413
414 /* identifiers for events and messages */
415 guint32         gst_message_get_seqnum          (GstMessage *message);
416 void            gst_message_set_seqnum          (GstMessage *message, guint32 seqnum);
417
418 /* EOS */
419 GstMessage *    gst_message_new_eos             (GstObject * src) G_GNUC_MALLOC;
420
421 /* ERROR */
422
423 GstMessage *    gst_message_new_error           (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
424 void            gst_message_parse_error         (GstMessage *message, GError **gerror, gchar **debug);
425
426 /* WARNING */
427 GstMessage *    gst_message_new_warning         (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
428 void            gst_message_parse_warning       (GstMessage *message, GError **gerror, gchar **debug);
429
430 /* INFO */
431 GstMessage *    gst_message_new_info            (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
432 void            gst_message_parse_info          (GstMessage *message, GError **gerror, gchar **debug);
433
434 /* TAG */
435 GstMessage *    gst_message_new_tag             (GstObject * src, GstTagList * tag_list) G_GNUC_MALLOC;
436 void            gst_message_parse_tag           (GstMessage *message, GstTagList **tag_list);
437
438 /* BUFFERING */
439 GstMessage *    gst_message_new_buffering         (GstObject * src, gint percent) G_GNUC_MALLOC;
440 void            gst_message_parse_buffering       (GstMessage *message, gint *percent);
441 void            gst_message_set_buffering_stats   (GstMessage *message, GstBufferingMode mode,
442                                                    gint avg_in, gint avg_out,
443                                                    gint64 buffering_left);
444 void            gst_message_parse_buffering_stats (GstMessage *message, GstBufferingMode *mode,
445                                                    gint *avg_in, gint *avg_out,
446                                                    gint64 *buffering_left);
447
448 /* STATE_CHANGED */
449 GstMessage *    gst_message_new_state_changed   (GstObject * src, GstState oldstate,
450                                                  GstState newstate, GstState pending) G_GNUC_MALLOC;
451 void            gst_message_parse_state_changed (GstMessage *message, GstState *oldstate,
452                                                  GstState *newstate, GstState *pending);
453
454 /* STATE_DIRTY */
455 GstMessage *    gst_message_new_state_dirty     (GstObject * src) G_GNUC_MALLOC;
456
457 /* STEP_DONE */
458 GstMessage *    gst_message_new_step_done       (GstObject * src, GstFormat format, guint64 amount,
459                                                  gdouble rate, gboolean flush, gboolean intermediate,
460                                                  guint64 duration, gboolean eos) G_GNUC_MALLOC;
461 void            gst_message_parse_step_done     (GstMessage * message, GstFormat *format, guint64 *amount,
462                                                  gdouble *rate, gboolean *flush, gboolean *intermediate,
463                                                  guint64 *duration, gboolean *eos);
464 /* CLOCK_PROVIDE */
465 GstMessage *    gst_message_new_clock_provide   (GstObject * src, GstClock *clock, gboolean ready) G_GNUC_MALLOC;
466 void            gst_message_parse_clock_provide (GstMessage *message, GstClock **clock,
467                                                  gboolean *ready);
468
469 /* CLOCK_LOST */
470 GstMessage *    gst_message_new_clock_lost      (GstObject * src, GstClock *clock) G_GNUC_MALLOC;
471 void            gst_message_parse_clock_lost    (GstMessage *message, GstClock **clock);
472
473 /* NEW_CLOCK */
474 GstMessage *    gst_message_new_new_clock       (GstObject * src, GstClock *clock) G_GNUC_MALLOC;
475 void            gst_message_parse_new_clock     (GstMessage *message, GstClock **clock);
476
477 /* APPLICATION */
478 GstMessage *    gst_message_new_application     (GstObject * src, GstStructure * structure) G_GNUC_MALLOC;
479
480 /* ELEMENT */
481 GstMessage *    gst_message_new_element         (GstObject * src, GstStructure * structure) G_GNUC_MALLOC;
482
483 /* SEGMENT_START */
484 GstMessage *    gst_message_new_segment_start   (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC;
485 void            gst_message_parse_segment_start (GstMessage *message, GstFormat *format,
486                                                  gint64 *position);
487
488 /* SEGMENT_DONE */
489 GstMessage *    gst_message_new_segment_done    (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC;
490 void            gst_message_parse_segment_done  (GstMessage *message, GstFormat *format,
491                                                  gint64 *position);
492
493 /* DURATION_CHANGED */
494 GstMessage *    gst_message_new_duration_changed (GstObject * src) G_GNUC_MALLOC;
495
496 /* LATENCY */
497 GstMessage *    gst_message_new_latency         (GstObject * src) G_GNUC_MALLOC;
498
499 /* ASYNC_START */
500 GstMessage *    gst_message_new_async_start     (GstObject * src) G_GNUC_MALLOC;
501
502 /* ASYNC_DONE */
503 GstMessage *    gst_message_new_async_done      (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
504 void            gst_message_parse_async_done    (GstMessage *message, GstClockTime *running_time);
505
506 /* STRUCTURE CHANGE */
507 GstMessage *    gst_message_new_structure_change   (GstObject * src, GstStructureChangeType type,
508                                                     GstElement *owner, gboolean busy) G_GNUC_MALLOC;
509 void            gst_message_parse_structure_change (GstMessage *message, GstStructureChangeType *type,
510                                                     GstElement **owner, gboolean *busy);
511
512 /* STREAM STATUS */
513 GstMessage *    gst_message_new_stream_status        (GstObject * src, GstStreamStatusType type,
514                                                       GstElement *owner) G_GNUC_MALLOC;
515 void            gst_message_parse_stream_status      (GstMessage *message, GstStreamStatusType *type,
516                                                       GstElement **owner);
517 void            gst_message_set_stream_status_object (GstMessage *message, const GValue *object);
518 const GValue *  gst_message_get_stream_status_object (GstMessage *message);
519
520 /* REQUEST_STATE */
521 GstMessage *    gst_message_new_request_state   (GstObject * src, GstState state) G_GNUC_MALLOC;
522 void            gst_message_parse_request_state (GstMessage * message, GstState *state);
523
524 /* STEP_START */
525 GstMessage *    gst_message_new_step_start      (GstObject * src, gboolean active, GstFormat format,
526                                                  guint64 amount, gdouble rate, gboolean flush,
527                                                  gboolean intermediate) G_GNUC_MALLOC;
528 void            gst_message_parse_step_start    (GstMessage * message, gboolean *active, GstFormat *format,
529                                                  guint64 *amount, gdouble *rate, gboolean *flush,
530                                                  gboolean *intermediate);
531
532 /* QOS */
533 GstMessage *    gst_message_new_qos             (GstObject * src, gboolean live, guint64 running_time,
534                                                  guint64 stream_time, guint64 timestamp, guint64 duration) G_GNUC_MALLOC;
535 void            gst_message_set_qos_values      (GstMessage * message, gint64 jitter, gdouble proportion,
536                                                  gint quality);
537 void            gst_message_set_qos_stats       (GstMessage * message, GstFormat format, guint64 processed,
538                                                  guint64 dropped);
539 void            gst_message_parse_qos           (GstMessage * message, gboolean * live, guint64 * running_time,
540                                                  guint64 * stream_time, guint64 * timestamp, guint64 * duration);
541 void            gst_message_parse_qos_values    (GstMessage * message, gint64 * jitter, gdouble * proportion,
542                                                  gint * quality);
543 void            gst_message_parse_qos_stats     (GstMessage * message, GstFormat * format, guint64 * processed,
544                                                  guint64 * dropped);
545 /* PROGRESS */
546 GstMessage *    gst_message_new_progress           (GstObject * src, GstProgressType type, const gchar *code,
547                                                     const gchar *text) G_GNUC_MALLOC;
548 void            gst_message_parse_progress         (GstMessage * message, GstProgressType * type, gchar ** code,
549                                                     gchar ** text);
550
551 /* TOC */
552 GstMessage *    gst_message_new_toc             (GstObject *src, GstToc *toc, gboolean updated);
553 void            gst_message_parse_toc           (GstMessage *message, GstToc **toc, gboolean *updated);
554
555 /* RESET_TIME */
556 GstMessage *    gst_message_new_reset_time      (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
557 void            gst_message_parse_reset_time    (GstMessage *message, GstClockTime *running_time);
558
559 /* STREAM_START */
560 GstMessage *    gst_message_new_stream_start    (GstObject * src) G_GNUC_MALLOC;
561
562 /* NEED_CONTEXT */
563 GstMessage *    gst_message_new_need_context    (GstObject * src) G_GNUC_MALLOC;
564 void            gst_message_add_context_type    (GstMessage * message, const gchar * context_type);
565 guint           gst_message_get_n_context_types (GstMessage * message);
566 gboolean        gst_message_parse_nth_context_type (GstMessage * message, guint i, const gchar ** context_type);
567
568 /* HAVE_CONTEXT */
569 GstMessage *    gst_message_new_have_context    (GstObject * src, GstContext *context) G_GNUC_MALLOC;
570 void            gst_message_parse_have_context  (GstMessage *message, GstContext **context);
571
572 G_END_DECLS
573
574 #endif /* __GST_MESSAGE_H__ */