streams: sprinkle some Since: markers for docs
[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 occurred. 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 occurred.
40  * @GST_MESSAGE_INFO: an info message occurred
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_NEED_CONTEXT: Message indicating that an element wants a specific context (Since 1.2)
101  * @GST_MESSAGE_HAVE_CONTEXT: Message indicating that an element created a context (Since 1.2)
102  * @GST_MESSAGE_EXTENDED: Message is an extended message type (see below).
103  *     These extended message IDs can't be used directly with mask-based API
104  *     like gst_bus_poll() or gst_bus_timed_pop_filtered(), but you can still
105  *     filter for GST_MESSAGE_EXTENDED and then check the result for the
106  *     specific type. (Since 1.4)
107  * @GST_MESSAGE_DEVICE_ADDED: Message indicating a #GstDevice was added to
108  *     a #GstDeviceProvider (Since 1.4)
109  * @GST_MESSAGE_DEVICE_REMOVED: Message indicating a #GstDevice was removed
110  *     from a #GstDeviceProvider (Since 1.4)
111  * @GST_MESSAGE_PROPERTY_NOTIFY: Message indicating a #GObject property has
112  *     changed (Since 1.10)
113  * @GST_MESSAGE_STREAM_COLLECTION: Message indicating a new #GstStreamCollection
114  *     is available (Since 1.10)
115  * @GST_MESSAGE_STREAMS_SELECTED: Message indicating the active selection of
116  *     #GstStreams has changed (Since 1.10)
117  * @GST_MESSAGE_ANY: mask for all of the above messages.
118  *
119  * The different message types that are available.
120  */
121 /* NOTE: keep in sync with quark registration in gstmessage.c
122  * NOTE: keep GST_MESSAGE_ANY a valid gint to avoid compiler warnings.
123  */
124 /* FIXME: 2.0: Make it NOT flags, just a regular 1,2,3,4.. enumeration */
125 /* FIXME: For GST_MESSAGE_ANY ~0 -> 0xffffffff see
126  *        https://bugzilla.gnome.org/show_bug.cgi?id=732633
127  */
128 typedef enum
129 {
130   GST_MESSAGE_UNKNOWN           = 0,
131   GST_MESSAGE_EOS               = (1 << 0),
132   GST_MESSAGE_ERROR             = (1 << 1),
133   GST_MESSAGE_WARNING           = (1 << 2),
134   GST_MESSAGE_INFO              = (1 << 3),
135   GST_MESSAGE_TAG               = (1 << 4),
136   GST_MESSAGE_BUFFERING         = (1 << 5),
137   GST_MESSAGE_STATE_CHANGED     = (1 << 6),
138   GST_MESSAGE_STATE_DIRTY       = (1 << 7),
139   GST_MESSAGE_STEP_DONE         = (1 << 8),
140   GST_MESSAGE_CLOCK_PROVIDE     = (1 << 9),
141   GST_MESSAGE_CLOCK_LOST        = (1 << 10),
142   GST_MESSAGE_NEW_CLOCK         = (1 << 11),
143   GST_MESSAGE_STRUCTURE_CHANGE  = (1 << 12),
144   GST_MESSAGE_STREAM_STATUS     = (1 << 13),
145   GST_MESSAGE_APPLICATION       = (1 << 14),
146   GST_MESSAGE_ELEMENT           = (1 << 15),
147   GST_MESSAGE_SEGMENT_START     = (1 << 16),
148   GST_MESSAGE_SEGMENT_DONE      = (1 << 17),
149   GST_MESSAGE_DURATION_CHANGED  = (1 << 18),
150   GST_MESSAGE_LATENCY           = (1 << 19),
151   GST_MESSAGE_ASYNC_START       = (1 << 20),
152   GST_MESSAGE_ASYNC_DONE        = (1 << 21),
153   GST_MESSAGE_REQUEST_STATE     = (1 << 22),
154   GST_MESSAGE_STEP_START        = (1 << 23),
155   GST_MESSAGE_QOS               = (1 << 24),
156   GST_MESSAGE_PROGRESS          = (1 << 25),
157   GST_MESSAGE_TOC               = (1 << 26),
158   GST_MESSAGE_RESET_TIME        = (1 << 27),
159   GST_MESSAGE_STREAM_START      = (1 << 28),
160   GST_MESSAGE_NEED_CONTEXT      = (1 << 29),
161   GST_MESSAGE_HAVE_CONTEXT      = (1 << 30),
162   GST_MESSAGE_EXTENDED          = (1 << 31),
163   GST_MESSAGE_DEVICE_ADDED      = GST_MESSAGE_EXTENDED + 1,
164   GST_MESSAGE_DEVICE_REMOVED    = GST_MESSAGE_EXTENDED + 2,
165   GST_MESSAGE_PROPERTY_NOTIFY   = GST_MESSAGE_EXTENDED + 3,
166   GST_MESSAGE_STREAM_COLLECTION = GST_MESSAGE_EXTENDED + 4,
167   GST_MESSAGE_STREAMS_SELECTED  = GST_MESSAGE_EXTENDED + 5,
168   GST_MESSAGE_ANY               = (gint) (0xffffffff)
169 } GstMessageType;
170
171 #include <gst/gstminiobject.h>
172 #include <gst/gstobject.h>
173 #include <gst/gstelement.h>
174 #include <gst/gsttaglist.h>
175 #include <gst/gststructure.h>
176 #include <gst/gstquery.h>
177 #include <gst/gsttoc.h>
178 #include <gst/gstdevice.h>
179 #include <gst/gststreamcollection.h>
180
181 GST_EXPORT GType _gst_message_type;
182
183 #define GST_TYPE_MESSAGE                         (_gst_message_type)
184 #define GST_IS_MESSAGE(obj)                      (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_MESSAGE))
185 #define GST_MESSAGE_CAST(obj)                    ((GstMessage*)(obj))
186 #define GST_MESSAGE(obj)                         (GST_MESSAGE_CAST(obj))
187
188 /* the lock is used to handle the synchronous handling of messages,
189  * the emiting thread is block until the handling thread processed
190  * the message using this mutex/cond pair */
191 #define GST_MESSAGE_GET_LOCK(message)   (&GST_MESSAGE_CAST(message)->lock)
192 #define GST_MESSAGE_LOCK(message)       g_mutex_lock(GST_MESSAGE_GET_LOCK(message))
193 #define GST_MESSAGE_UNLOCK(message)     g_mutex_unlock(GST_MESSAGE_GET_LOCK(message))
194 #define GST_MESSAGE_GET_COND(message)   (&GST_MESSAGE_CAST(message)->cond)
195 #define GST_MESSAGE_WAIT(message)       g_cond_wait(GST_MESSAGE_GET_COND(message),GST_MESSAGE_GET_LOCK(message))
196 #define GST_MESSAGE_SIGNAL(message)     g_cond_signal(GST_MESSAGE_GET_COND(message))
197
198 /**
199  * GST_MESSAGE_TYPE:
200  * @message: a #GstMessage
201  *
202  * Get the #GstMessageType of @message.
203  */
204 #define GST_MESSAGE_TYPE(message)       (GST_MESSAGE_CAST(message)->type)
205 /**
206  * GST_MESSAGE_TYPE_IS_EXTENDED:
207  * @message: a #GstMessage
208  *
209  * Check if the message is in the extended message group
210  * Since: 1.4
211  */
212 #define GST_MESSAGE_TYPE_IS_EXTENDED(message)       (!!(GST_MESSAGE_CAST(message)->type & GST_MESSAGE_EXTENDED))
213
214 /**
215  * GST_MESSAGE_TYPE_NAME:
216  * @message: a #GstMessage
217  *
218  * Get a constant string representation of the #GstMessageType of @message.
219  */
220 #define GST_MESSAGE_TYPE_NAME(message)  gst_message_type_get_name(GST_MESSAGE_TYPE(message))
221 /**
222  * GST_MESSAGE_TIMESTAMP:
223  * @message: a #GstMessage
224  *
225  * Get the timestamp of @message. This is the timestamp when the message
226  * was created.
227  */
228 #define GST_MESSAGE_TIMESTAMP(message)  (GST_MESSAGE_CAST(message)->timestamp)
229 /**
230  * GST_MESSAGE_SRC:
231  * @message: a #GstMessage
232  *
233  * Get the object that posted @message.
234  */
235 #define GST_MESSAGE_SRC(message)        (GST_MESSAGE_CAST(message)->src)
236
237 /**
238  * GST_MESSAGE_SEQNUM:
239  * @message: a #GstMessage
240  *
241  * Get the sequence number of @message.
242  */
243 #define GST_MESSAGE_SEQNUM(message)     (GST_MESSAGE_CAST(message)->seqnum)
244
245 /**
246  * GST_MESSAGE_SRC_NAME:
247  * @message: a #GstMessage
248  *
249  * Get the name of the object that posted @message. Returns "(NULL)" if
250  * the message has no source object set.
251  */
252 #define GST_MESSAGE_SRC_NAME(message)   (GST_MESSAGE_SRC(message) ? \
253     GST_OBJECT_NAME (GST_MESSAGE_SRC(message)) : "(NULL)")
254
255 /**
256  * GstStructureChangeType:
257  * @GST_STRUCTURE_CHANGE_TYPE_PAD_LINK: Pad linking is starting or done.
258  * @GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK: Pad unlinking is starting or done.
259  *
260  * The type of a %GST_MESSAGE_STRUCTURE_CHANGE.
261  */
262 typedef enum {
263   GST_STRUCTURE_CHANGE_TYPE_PAD_LINK   = 0,
264   GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK = 1
265 } GstStructureChangeType;
266
267 /**
268  * GstStreamStatusType:
269  * @GST_STREAM_STATUS_TYPE_CREATE: A new thread need to be created.
270  * @GST_STREAM_STATUS_TYPE_ENTER: a thread entered its loop function
271  * @GST_STREAM_STATUS_TYPE_LEAVE: a thread left its loop function
272  * @GST_STREAM_STATUS_TYPE_DESTROY: a thread is destroyed
273  * @GST_STREAM_STATUS_TYPE_START: a thread is started
274  * @GST_STREAM_STATUS_TYPE_PAUSE: a thread is paused
275  * @GST_STREAM_STATUS_TYPE_STOP: a thread is stopped
276  *
277  * The type of a %GST_MESSAGE_STREAM_STATUS. The stream status messages inform the
278  * application of new streaming threads and their status.
279  */
280 typedef enum {
281   GST_STREAM_STATUS_TYPE_CREATE   = 0,
282   GST_STREAM_STATUS_TYPE_ENTER    = 1,
283   GST_STREAM_STATUS_TYPE_LEAVE    = 2,
284   GST_STREAM_STATUS_TYPE_DESTROY  = 3,
285
286   GST_STREAM_STATUS_TYPE_START    = 8,
287   GST_STREAM_STATUS_TYPE_PAUSE    = 9,
288   GST_STREAM_STATUS_TYPE_STOP     = 10
289 } GstStreamStatusType;
290
291 /**
292  * GstProgressType:
293  * @GST_PROGRESS_TYPE_START: A new task started.
294  * @GST_PROGRESS_TYPE_CONTINUE: A task completed and a new one continues.
295  * @GST_PROGRESS_TYPE_COMPLETE: A task completed.
296  * @GST_PROGRESS_TYPE_CANCELED: A task was canceled.
297  * @GST_PROGRESS_TYPE_ERROR: A task caused an error. An error message is also
298  *          posted on the bus.
299  *
300  * The type of a %GST_MESSAGE_PROGRESS. The progress messages inform the
301  * application of the status of asynchronous tasks.
302  */
303 typedef enum {
304   GST_PROGRESS_TYPE_START    = 0,
305   GST_PROGRESS_TYPE_CONTINUE = 1,
306   GST_PROGRESS_TYPE_COMPLETE = 2,
307   GST_PROGRESS_TYPE_CANCELED = 3,
308   GST_PROGRESS_TYPE_ERROR    = 4
309 } GstProgressType;
310
311 /**
312  * GstMessage:
313  * @mini_object: the parent structure
314  * @type: the #GstMessageType of the message
315  * @timestamp: the timestamp of the message
316  * @src: the src of the message
317  * @seqnum: the sequence number of the message
318  *
319  * A #GstMessage.
320  */
321 struct _GstMessage
322 {
323   GstMiniObject   mini_object;
324
325   /*< public > *//* with COW */
326   GstMessageType  type;
327   guint64         timestamp;
328   GstObject      *src;
329   guint32         seqnum;
330
331   /*< private >*//* with MESSAGE_LOCK */
332   GMutex          lock;                 /* lock and cond for async delivery */
333   GCond           cond;
334 };
335
336 GType           gst_message_get_type            (void);
337
338 const gchar*    gst_message_type_get_name       (GstMessageType type);
339 GQuark          gst_message_type_to_quark       (GstMessageType type);
340
341 /* refcounting */
342 /**
343  * gst_message_ref:
344  * @msg: the message to ref
345  *
346  * Convenience macro to increase the reference count of the message.
347  *
348  * Returns: @msg (for convenience when doing assignments)
349  */
350 static inline GstMessage *
351 gst_message_ref (GstMessage * msg)
352 {
353   return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg));
354 }
355
356 /**
357  * gst_message_unref:
358  * @msg: the message to unref
359  *
360  * Convenience macro to decrease the reference count of the message, possibly
361  * freeing it.
362  */
363 static inline void
364 gst_message_unref (GstMessage * msg)
365 {
366   gst_mini_object_unref (GST_MINI_OBJECT_CAST (msg));
367 }
368
369 /* copy message */
370 /**
371  * gst_message_copy:
372  * @msg: the message to copy
373  *
374  * Creates a copy of the message. Returns a copy of the message.
375  *
376  * Returns: (transfer full): a new copy of @msg.
377  *
378  * MT safe
379  */
380 static inline GstMessage *
381 gst_message_copy (const GstMessage * msg)
382 {
383   return GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (msg)));
384 }
385
386 /**
387  * gst_message_is_writable:
388  * @msg: a #GstMessage
389  *
390  * Tests if you can safely write into a message's structure or validly
391  * modify the seqnum and timestamp fields.
392  */
393 #define         gst_message_is_writable(msg)     gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (msg))
394 /**
395  * gst_message_make_writable:
396  * @msg: (transfer full): the message to make writable
397  *
398  * Checks if a message is writable. If not, a writable copy is made and
399  * returned.
400  *
401  * Returns: (transfer full): a message (possibly a duplicate) that is writable.
402  *
403  * MT safe
404  */
405 #define         gst_message_make_writable(msg)  GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg)))
406 /**
407  * gst_message_replace:
408  * @old_message: (inout) (transfer full) (nullable): pointer to a
409  *     pointer to a #GstMessage to be replaced.
410  * @new_message: (allow-none) (transfer none): pointer to a #GstMessage that will
411  *     replace the message pointed to by @old_message.
412  *
413  * Modifies a pointer to a #GstMessage to point to a different #GstMessage. The
414  * modification is done atomically (so this is useful for ensuring thread safety
415  * in some cases), and the reference counts are updated appropriately (the old
416  * message is unreffed, the new one is reffed).
417  *
418  * Either @new_message or the #GstMessage pointed to by @old_message may be %NULL.
419  *
420  * Returns: %TRUE if @new_message was different from @old_message
421  */
422 static inline gboolean
423 gst_message_replace (GstMessage **old_message, GstMessage *new_message)
424 {
425   return gst_mini_object_replace ((GstMiniObject **) old_message, (GstMiniObject *) new_message);
426 }
427
428
429 /* custom messages */
430 GstMessage *    gst_message_new_custom          (GstMessageType type,
431                                                  GstObject    * src,
432                                                  GstStructure * structure) G_GNUC_MALLOC;
433 const GstStructure *
434                 gst_message_get_structure       (GstMessage *message);
435
436 gboolean        gst_message_has_name            (GstMessage *message, const gchar *name);
437
438 /* identifiers for events and messages */
439 guint32         gst_message_get_seqnum          (GstMessage *message);
440 void            gst_message_set_seqnum          (GstMessage *message, guint32 seqnum);
441
442 /* EOS */
443 GstMessage *    gst_message_new_eos             (GstObject * src) G_GNUC_MALLOC;
444
445 /* ERROR */
446
447 GstMessage *    gst_message_new_error           (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
448 void            gst_message_parse_error         (GstMessage *message, GError **gerror, gchar **debug);
449
450 /* WARNING */
451 GstMessage *    gst_message_new_warning         (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
452 void            gst_message_parse_warning       (GstMessage *message, GError **gerror, gchar **debug);
453
454 /* INFO */
455 GstMessage *    gst_message_new_info            (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC;
456 void            gst_message_parse_info          (GstMessage *message, GError **gerror, gchar **debug);
457
458 /* TAG */
459 GstMessage *    gst_message_new_tag             (GstObject * src, GstTagList * tag_list) G_GNUC_MALLOC;
460 void            gst_message_parse_tag           (GstMessage *message, GstTagList **tag_list);
461
462 /* BUFFERING */
463 GstMessage *    gst_message_new_buffering         (GstObject * src, gint percent) G_GNUC_MALLOC;
464 void            gst_message_parse_buffering       (GstMessage *message, gint *percent);
465 void            gst_message_set_buffering_stats   (GstMessage *message, GstBufferingMode mode,
466                                                    gint avg_in, gint avg_out,
467                                                    gint64 buffering_left);
468 void            gst_message_parse_buffering_stats (GstMessage *message, GstBufferingMode *mode,
469                                                    gint *avg_in, gint *avg_out,
470                                                    gint64 *buffering_left);
471
472 /* STATE_CHANGED */
473 GstMessage *    gst_message_new_state_changed   (GstObject * src, GstState oldstate,
474                                                  GstState newstate, GstState pending) G_GNUC_MALLOC;
475 void            gst_message_parse_state_changed (GstMessage *message, GstState *oldstate,
476                                                  GstState *newstate, GstState *pending);
477
478 /* STATE_DIRTY */
479 GstMessage *    gst_message_new_state_dirty     (GstObject * src) G_GNUC_MALLOC;
480
481 /* STEP_DONE */
482 GstMessage *    gst_message_new_step_done       (GstObject * src, GstFormat format, guint64 amount,
483                                                  gdouble rate, gboolean flush, gboolean intermediate,
484                                                  guint64 duration, gboolean eos) G_GNUC_MALLOC;
485 void            gst_message_parse_step_done     (GstMessage * message, GstFormat *format, guint64 *amount,
486                                                  gdouble *rate, gboolean *flush, gboolean *intermediate,
487                                                  guint64 *duration, gboolean *eos);
488 /* CLOCK_PROVIDE */
489 GstMessage *    gst_message_new_clock_provide   (GstObject * src, GstClock *clock, gboolean ready) G_GNUC_MALLOC;
490 void            gst_message_parse_clock_provide (GstMessage *message, GstClock **clock,
491                                                  gboolean *ready);
492
493 /* CLOCK_LOST */
494 GstMessage *    gst_message_new_clock_lost      (GstObject * src, GstClock *clock) G_GNUC_MALLOC;
495 void            gst_message_parse_clock_lost    (GstMessage *message, GstClock **clock);
496
497 /* NEW_CLOCK */
498 GstMessage *    gst_message_new_new_clock       (GstObject * src, GstClock *clock) G_GNUC_MALLOC;
499 void            gst_message_parse_new_clock     (GstMessage *message, GstClock **clock);
500
501 /* APPLICATION */
502 GstMessage *    gst_message_new_application     (GstObject * src, GstStructure * structure) G_GNUC_MALLOC;
503
504 /* ELEMENT */
505 GstMessage *    gst_message_new_element         (GstObject * src, GstStructure * structure) G_GNUC_MALLOC;
506
507 /* SEGMENT_START */
508 GstMessage *    gst_message_new_segment_start   (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC;
509 void            gst_message_parse_segment_start (GstMessage *message, GstFormat *format,
510                                                  gint64 *position);
511
512 /* SEGMENT_DONE */
513 GstMessage *    gst_message_new_segment_done    (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC;
514 void            gst_message_parse_segment_done  (GstMessage *message, GstFormat *format,
515                                                  gint64 *position);
516
517 /* DURATION_CHANGED */
518 GstMessage *    gst_message_new_duration_changed (GstObject * src) G_GNUC_MALLOC;
519
520 /* LATENCY */
521 GstMessage *    gst_message_new_latency         (GstObject * src) G_GNUC_MALLOC;
522
523 /* ASYNC_START */
524 GstMessage *    gst_message_new_async_start     (GstObject * src) G_GNUC_MALLOC;
525
526 /* ASYNC_DONE */
527 GstMessage *    gst_message_new_async_done      (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
528 void            gst_message_parse_async_done    (GstMessage *message, GstClockTime *running_time);
529
530 /* STRUCTURE CHANGE */
531 GstMessage *    gst_message_new_structure_change   (GstObject * src, GstStructureChangeType type,
532                                                     GstElement *owner, gboolean busy) G_GNUC_MALLOC;
533 void            gst_message_parse_structure_change (GstMessage *message, GstStructureChangeType *type,
534                                                     GstElement **owner, gboolean *busy);
535
536 /* STREAM STATUS */
537 GstMessage *    gst_message_new_stream_status        (GstObject * src, GstStreamStatusType type,
538                                                       GstElement *owner) G_GNUC_MALLOC;
539 void            gst_message_parse_stream_status      (GstMessage *message, GstStreamStatusType *type,
540                                                       GstElement **owner);
541 void            gst_message_set_stream_status_object (GstMessage *message, const GValue *object);
542 const GValue *  gst_message_get_stream_status_object (GstMessage *message);
543
544 /* REQUEST_STATE */
545 GstMessage *    gst_message_new_request_state   (GstObject * src, GstState state) G_GNUC_MALLOC;
546 void            gst_message_parse_request_state (GstMessage * message, GstState *state);
547
548 /* STEP_START */
549 GstMessage *    gst_message_new_step_start      (GstObject * src, gboolean active, GstFormat format,
550                                                  guint64 amount, gdouble rate, gboolean flush,
551                                                  gboolean intermediate) G_GNUC_MALLOC;
552 void            gst_message_parse_step_start    (GstMessage * message, gboolean *active, GstFormat *format,
553                                                  guint64 *amount, gdouble *rate, gboolean *flush,
554                                                  gboolean *intermediate);
555
556 /* QOS */
557 GstMessage *    gst_message_new_qos             (GstObject * src, gboolean live, guint64 running_time,
558                                                  guint64 stream_time, guint64 timestamp, guint64 duration) G_GNUC_MALLOC;
559 void            gst_message_set_qos_values      (GstMessage * message, gint64 jitter, gdouble proportion,
560                                                  gint quality);
561 void            gst_message_set_qos_stats       (GstMessage * message, GstFormat format, guint64 processed,
562                                                  guint64 dropped);
563 void            gst_message_parse_qos           (GstMessage * message, gboolean * live, guint64 * running_time,
564                                                  guint64 * stream_time, guint64 * timestamp, guint64 * duration);
565 void            gst_message_parse_qos_values    (GstMessage * message, gint64 * jitter, gdouble * proportion,
566                                                  gint * quality);
567 void            gst_message_parse_qos_stats     (GstMessage * message, GstFormat * format, guint64 * processed,
568                                                  guint64 * dropped);
569 /* PROGRESS */
570 GstMessage *    gst_message_new_progress           (GstObject * src, GstProgressType type, const gchar *code,
571                                                     const gchar *text) G_GNUC_MALLOC;
572 void            gst_message_parse_progress         (GstMessage * message, GstProgressType * type, gchar ** code,
573                                                     gchar ** text);
574
575 /* TOC */
576 GstMessage *    gst_message_new_toc             (GstObject *src, GstToc *toc, gboolean updated);
577 void            gst_message_parse_toc           (GstMessage *message, GstToc **toc, gboolean *updated);
578
579 /* RESET_TIME */
580 GstMessage *    gst_message_new_reset_time      (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC;
581 void            gst_message_parse_reset_time    (GstMessage *message, GstClockTime *running_time);
582
583 /* STREAM_START */
584 GstMessage *    gst_message_new_stream_start    (GstObject * src) G_GNUC_MALLOC;
585
586 void            gst_message_set_group_id        (GstMessage *message, guint group_id);
587 gboolean        gst_message_parse_group_id      (GstMessage *message, guint *group_id);
588
589 /* NEED_CONTEXT */
590 GstMessage *    gst_message_new_need_context    (GstObject * src, const gchar * context_type) G_GNUC_MALLOC;
591 gboolean        gst_message_parse_context_type  (GstMessage * message, const gchar ** context_type);
592
593 /* HAVE_CONTEXT */
594 GstMessage *    gst_message_new_have_context    (GstObject * src, GstContext *context) G_GNUC_MALLOC;
595 void            gst_message_parse_have_context  (GstMessage *message, GstContext **context);
596
597 /* DEVICE_ADDED */
598 GstMessage *    gst_message_new_device_added    (GstObject * src, GstDevice * device) G_GNUC_MALLOC;
599 void            gst_message_parse_device_added  (GstMessage * message, GstDevice ** device);
600
601 /* DEVICE_REMOVED */
602 GstMessage *    gst_message_new_device_removed    (GstObject * src, GstDevice * device) G_GNUC_MALLOC;
603 void            gst_message_parse_device_removed  (GstMessage * message, GstDevice ** device);
604
605 /* PROPERTY_NOTIFY */
606 GstMessage *    gst_message_new_property_notify   (GstObject * src, const gchar * property_name, GValue * val) G_GNUC_MALLOC;
607 void            gst_message_parse_property_notify (GstMessage * message, GstObject ** object, const gchar ** property_name, const GValue ** property_value);
608
609 /* STREAM_COLLECTION */
610 GstMessage *    gst_message_new_stream_collection   (GstObject * src, GstStreamCollection * collection) G_GNUC_MALLOC;
611 void            gst_message_parse_stream_collection (GstMessage *message, GstStreamCollection **collection);
612
613 /* STREAMS_SELECTED */
614 GstMessage *    gst_message_new_streams_selected (GstObject *src, GstStreamCollection *collection);
615 void            gst_message_streams_selected_add (GstMessage *message, GstStream *stream);
616 void            gst_message_parse_streams_selected (GstMessage * message, GstStreamCollection **collection);
617 guint           gst_message_streams_selected_get_size (GstMessage * message);
618 GstStream      *gst_message_streams_selected_get_stream (GstMessage *message, guint idx);
619
620 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
621 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMessage, gst_message_unref)
622 #endif
623
624 G_END_DECLS
625
626 #endif /* __GST_MESSAGE_H__ */