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