1 | /* GStreamer |
2 | * Copyright (C) 2004 Wim Taymans <[email protected]> |
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 | #include <glib.h> |
26 | |
27 | G_BEGIN_DECLS |
28 | |
29 | typedef struct _GstMessage GstMessage; |
30 | |
31 | /** |
32 | * GstMessageType: |
33 | * @GST_MESSAGE_UNKNOWN: an undefined message |
34 | * @GST_MESSAGE_EOS: end-of-stream reached in a pipeline. The application will |
35 | * only receive this message in the PLAYING state and every time it sets a |
36 | * pipeline to PLAYING that is in the EOS state. The application can perform a |
37 | * flushing seek in the pipeline, which will undo the EOS state again. |
38 | * @GST_MESSAGE_ERROR: an error occurred. When the application receives an error |
39 | * message it should stop playback of the pipeline and not assume that more |
40 | * data will be played. |
41 | * @GST_MESSAGE_WARNING: a warning occurred. |
42 | * @GST_MESSAGE_INFO: an info message occurred |
43 | * @GST_MESSAGE_TAG: a tag was found. |
44 | * @GST_MESSAGE_BUFFERING: the pipeline is buffering. When the application |
45 | * receives a buffering message in the PLAYING state for a non-live pipeline it |
46 | * must PAUSE the pipeline until the buffering completes, when the percentage |
47 | * field in the message is 100%. For live pipelines, no action must be |
48 | * performed and the buffering percentage can be used to inform the user about |
49 | * the progress. |
50 | * @GST_MESSAGE_STATE_CHANGED: a state change happened |
51 | * @GST_MESSAGE_STATE_DIRTY: an element changed state in a streaming thread. |
52 | * This message is deprecated. |
53 | * @GST_MESSAGE_STEP_DONE: a stepping operation finished. |
54 | * @GST_MESSAGE_CLOCK_PROVIDE: an element notifies its capability of providing |
55 | * a clock. This message is used internally and |
56 | * never forwarded to the application. |
57 | * @GST_MESSAGE_CLOCK_LOST: The current clock as selected by the pipeline became |
58 | * unusable. The pipeline will select a new clock on |
59 | * the next PLAYING state change. The application |
60 | * should set the pipeline to PAUSED and back to |
61 | * PLAYING when this message is received. |
62 | * @GST_MESSAGE_NEW_CLOCK: a new clock was selected in the pipeline. |
63 | * @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed. This |
64 | * message is used internally and never forwarded to the application. |
65 | * @GST_MESSAGE_STREAM_STATUS: status about a stream, emitted when it starts, |
66 | * stops, errors, etc.. |
67 | * @GST_MESSAGE_APPLICATION: message posted by the application, possibly |
68 | * via an application-specific element. |
69 | * @GST_MESSAGE_ELEMENT: element-specific message, see the specific element's |
70 | * documentation |
71 | * @GST_MESSAGE_SEGMENT_START: pipeline started playback of a segment. This |
72 | * message is used internally and never forwarded to the application. |
73 | * @GST_MESSAGE_SEGMENT_DONE: pipeline completed playback of a segment. This |
74 | * message is forwarded to the application after all elements that posted |
75 | * @GST_MESSAGE_SEGMENT_START posted a GST_MESSAGE_SEGMENT_DONE message. |
76 | * @GST_MESSAGE_DURATION_CHANGED: The duration of a pipeline changed. The |
77 | * application can get the new duration with a duration query. |
78 | * @GST_MESSAGE_ASYNC_START: Posted by elements when they start an ASYNC |
79 | * #GstStateChange. This message is not forwarded to the application but is used |
80 | * internally. |
81 | * @GST_MESSAGE_ASYNC_DONE: Posted by elements when they complete an ASYNC |
82 | * #GstStateChange. The application will only receive this message from the toplevel |
83 | * pipeline. |
84 | * @GST_MESSAGE_LATENCY: Posted by elements when their latency changes. The |
85 | * application should recalculate and distribute a new latency. |
86 | * @GST_MESSAGE_REQUEST_STATE: Posted by elements when they want the pipeline to |
87 | * change state. This message is a suggestion to the application which can |
88 | * decide to perform the state change on (part of) the pipeline. |
89 | * @GST_MESSAGE_STEP_START: A stepping operation was started. |
90 | * @GST_MESSAGE_QOS: A buffer was dropped or an element changed its processing |
91 | * strategy for Quality of Service reasons. |
92 | * @GST_MESSAGE_PROGRESS: A progress message. |
93 | * @GST_MESSAGE_TOC: A new table of contents (TOC) was found or previously found TOC |
94 | * was updated. |
95 | * @GST_MESSAGE_RESET_TIME: Message to request resetting the pipeline's |
96 | * running time from the pipeline. This is an internal message which |
97 | * applications will likely never receive. |
98 | * @GST_MESSAGE_STREAM_START: Message indicating start of a new stream. Useful |
99 | * e.g. when using playbin in gapless playback mode, to get notified when |
100 | * the next title actually starts playing (which will be some time after |
101 | * the URI for the next title has been set). |
102 | * @GST_MESSAGE_NEED_CONTEXT: Message indicating that an element wants a specific context (Since 1.2) |
103 | * @GST_MESSAGE_HAVE_CONTEXT: Message indicating that an element created a context (Since 1.2) |
104 | * @GST_MESSAGE_EXTENDED: Message is an extended message type (see below). |
105 | * These extended message IDs can't be used directly with mask-based API |
106 | * like gst_bus_poll() or gst_bus_timed_pop_filtered(), but you can still |
107 | * filter for GST_MESSAGE_EXTENDED and then check the result for the |
108 | * specific type. (Since 1.4) |
109 | * @GST_MESSAGE_DEVICE_ADDED: Message indicating a #GstDevice was added to |
110 | * a #GstDeviceProvider (Since 1.4) |
111 | * @GST_MESSAGE_DEVICE_REMOVED: Message indicating a #GstDevice was removed |
112 | * from a #GstDeviceProvider (Since 1.4) |
113 | * @GST_MESSAGE_PROPERTY_NOTIFY: Message indicating a #GObject property has |
114 | * changed (Since 1.10) |
115 | * @GST_MESSAGE_STREAM_COLLECTION: Message indicating a new #GstStreamCollection |
116 | * is available (Since 1.10) |
117 | * @GST_MESSAGE_STREAMS_SELECTED: Message indicating the active selection of |
118 | * #GstStreams has changed (Since 1.10) |
119 | * @GST_MESSAGE_REDIRECT: Message indicating to request the application to |
120 | * try to play the given URL(s). Useful if for example a HTTP 302/303 |
121 | * response is received with a non-HTTP URL inside. (Since 1.10) |
122 | * @GST_MESSAGE_DEVICE_CHANGED: Message indicating a #GstDevice was changed |
123 | * a #GstDeviceProvider (Since 1.16) |
124 | * @GST_MESSAGE_ANY: mask for all of the above messages. |
125 | * |
126 | * The different message types that are available. |
127 | */ |
128 | /* NOTE: keep in sync with quark registration in gstmessage.c |
129 | * NOTE: keep GST_MESSAGE_ANY a valid gint to avoid compiler warnings. |
130 | */ |
131 | /* FIXME: 2.0: Make it NOT flags, just a regular 1,2,3,4.. enumeration */ |
132 | /* FIXME: For GST_MESSAGE_ANY ~0 -> 0xffffffff see |
133 | * https://bugzilla.gnome.org/show_bug.cgi?id=732633 |
134 | */ |
135 | typedef enum |
136 | { |
137 | GST_MESSAGE_UNKNOWN = 0, |
138 | GST_MESSAGE_EOS = (1 << 0), |
139 | GST_MESSAGE_ERROR = (1 << 1), |
140 | GST_MESSAGE_WARNING = (1 << 2), |
141 | GST_MESSAGE_INFO = (1 << 3), |
142 | GST_MESSAGE_TAG = (1 << 4), |
143 | GST_MESSAGE_BUFFERING = (1 << 5), |
144 | GST_MESSAGE_STATE_CHANGED = (1 << 6), |
145 | GST_MESSAGE_STATE_DIRTY = (1 << 7), |
146 | GST_MESSAGE_STEP_DONE = (1 << 8), |
147 | GST_MESSAGE_CLOCK_PROVIDE = (1 << 9), |
148 | GST_MESSAGE_CLOCK_LOST = (1 << 10), |
149 | GST_MESSAGE_NEW_CLOCK = (1 << 11), |
150 | GST_MESSAGE_STRUCTURE_CHANGE = (1 << 12), |
151 | GST_MESSAGE_STREAM_STATUS = (1 << 13), |
152 | GST_MESSAGE_APPLICATION = (1 << 14), |
153 | GST_MESSAGE_ELEMENT = (1 << 15), |
154 | GST_MESSAGE_SEGMENT_START = (1 << 16), |
155 | GST_MESSAGE_SEGMENT_DONE = (1 << 17), |
156 | GST_MESSAGE_DURATION_CHANGED = (1 << 18), |
157 | GST_MESSAGE_LATENCY = (1 << 19), |
158 | GST_MESSAGE_ASYNC_START = (1 << 20), |
159 | GST_MESSAGE_ASYNC_DONE = (1 << 21), |
160 | GST_MESSAGE_REQUEST_STATE = (1 << 22), |
161 | GST_MESSAGE_STEP_START = (1 << 23), |
162 | GST_MESSAGE_QOS = (1 << 24), |
163 | GST_MESSAGE_PROGRESS = (1 << 25), |
164 | GST_MESSAGE_TOC = (1 << 26), |
165 | GST_MESSAGE_RESET_TIME = (1 << 27), |
166 | GST_MESSAGE_STREAM_START = (1 << 28), |
167 | GST_MESSAGE_NEED_CONTEXT = (1 << 29), |
168 | GST_MESSAGE_HAVE_CONTEXT = (1 << 30), |
169 | GST_MESSAGE_EXTENDED = (gint) (1u << 31), |
170 | GST_MESSAGE_DEVICE_ADDED = GST_MESSAGE_EXTENDED + 1, |
171 | GST_MESSAGE_DEVICE_REMOVED = GST_MESSAGE_EXTENDED + 2, |
172 | GST_MESSAGE_PROPERTY_NOTIFY = GST_MESSAGE_EXTENDED + 3, |
173 | GST_MESSAGE_STREAM_COLLECTION = GST_MESSAGE_EXTENDED + 4, |
174 | GST_MESSAGE_STREAMS_SELECTED = GST_MESSAGE_EXTENDED + 5, |
175 | GST_MESSAGE_REDIRECT = GST_MESSAGE_EXTENDED + 6, |
176 | GST_MESSAGE_DEVICE_CHANGED = GST_MESSAGE_EXTENDED + 6, |
177 | GST_MESSAGE_ANY = (gint) (0xffffffff) |
178 | } GstMessageType; |
179 | |
180 | #include <gst/gstminiobject.h> |
181 | #include <gst/gstobject.h> |
182 | #include <gst/gstelement.h> |
183 | #include <gst/gsttaglist.h> |
184 | #include <gst/gststructure.h> |
185 | #include <gst/gstquery.h> |
186 | #include <gst/gsttoc.h> |
187 | #include <gst/gstdevice.h> |
188 | #include <gst/gststreams.h> |
189 | #include <gst/gststreamcollection.h> |
190 | |
191 | GST_API GType _gst_message_type; |
192 | |
193 | #define GST_TYPE_MESSAGE (_gst_message_type) |
194 | #define GST_IS_MESSAGE(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_MESSAGE)) |
195 | #define GST_MESSAGE_CAST(obj) ((GstMessage*)(obj)) |
196 | #define GST_MESSAGE(obj) (GST_MESSAGE_CAST(obj)) |
197 | |
198 | /* the lock is used to handle the synchronous handling of messages, |
199 | * the emitting thread is blocked until the handling thread processed |
200 | * the message using this mutex/cond pair */ |
201 | #define GST_MESSAGE_GET_LOCK(message) (&GST_MESSAGE_CAST(message)->lock) |
202 | #define GST_MESSAGE_LOCK(message) g_mutex_lock(GST_MESSAGE_GET_LOCK(message)) |
203 | #define GST_MESSAGE_UNLOCK(message) g_mutex_unlock(GST_MESSAGE_GET_LOCK(message)) |
204 | #define GST_MESSAGE_GET_COND(message) (&GST_MESSAGE_CAST(message)->cond) |
205 | #define GST_MESSAGE_WAIT(message) g_cond_wait(GST_MESSAGE_GET_COND(message),GST_MESSAGE_GET_LOCK(message)) |
206 | #define GST_MESSAGE_SIGNAL(message) g_cond_signal(GST_MESSAGE_GET_COND(message)) |
207 | |
208 | /** |
209 | * GST_MESSAGE_TYPE: |
210 | * @message: a #GstMessage |
211 | * |
212 | * Get the #GstMessageType of @message. |
213 | */ |
214 | #define GST_MESSAGE_TYPE(message) (GST_MESSAGE_CAST(message)->type) |
215 | /** |
216 | * GST_MESSAGE_TYPE_IS_EXTENDED: |
217 | * @message: a #GstMessage |
218 | * |
219 | * Check if the message is in the extended message group |
220 | * Since: 1.4 |
221 | */ |
222 | #define GST_MESSAGE_TYPE_IS_EXTENDED(message) (!!(GST_MESSAGE_CAST(message)->type & GST_MESSAGE_EXTENDED)) |
223 | |
224 | /** |
225 | * GST_MESSAGE_TYPE_NAME: |
226 | * @message: a #GstMessage |
227 | * |
228 | * Get a constant string representation of the #GstMessageType of @message. |
229 | */ |
230 | #define GST_MESSAGE_TYPE_NAME(message) gst_message_type_get_name(GST_MESSAGE_TYPE(message)) |
231 | /** |
232 | * GST_MESSAGE_TIMESTAMP: |
233 | * @message: a #GstMessage |
234 | * |
235 | * Get the timestamp of @message. This is the timestamp when the message |
236 | * was created. |
237 | */ |
238 | #define GST_MESSAGE_TIMESTAMP(message) (GST_MESSAGE_CAST(message)->timestamp) |
239 | /** |
240 | * GST_MESSAGE_SRC: |
241 | * @message: a #GstMessage |
242 | * |
243 | * Get the object that posted @message. |
244 | */ |
245 | #define GST_MESSAGE_SRC(message) (GST_MESSAGE_CAST(message)->src) |
246 | |
247 | /** |
248 | * GST_MESSAGE_SEQNUM: |
249 | * @message: a #GstMessage |
250 | * |
251 | * Get the sequence number of @message. |
252 | */ |
253 | #define GST_MESSAGE_SEQNUM(message) (GST_MESSAGE_CAST(message)->seqnum) |
254 | |
255 | /** |
256 | * GST_MESSAGE_SRC_NAME: |
257 | * @message: a #GstMessage |
258 | * |
259 | * Get the name of the object that posted @message. Returns "(NULL)" if |
260 | * the message has no source object set. |
261 | */ |
262 | #define GST_MESSAGE_SRC_NAME(message) (GST_MESSAGE_SRC(message) ? \ |
263 | GST_OBJECT_NAME (GST_MESSAGE_SRC(message)) : "(NULL)") |
264 | |
265 | /** |
266 | * GstStructureChangeType: |
267 | * @GST_STRUCTURE_CHANGE_TYPE_PAD_LINK: Pad linking is starting or done. |
268 | * @GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK: Pad unlinking is starting or done. |
269 | * |
270 | * The type of a %GST_MESSAGE_STRUCTURE_CHANGE. |
271 | */ |
272 | typedef enum { |
273 | GST_STRUCTURE_CHANGE_TYPE_PAD_LINK = 0, |
274 | GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK = 1 |
275 | } GstStructureChangeType; |
276 | |
277 | /** |
278 | * GstStreamStatusType: |
279 | * @GST_STREAM_STATUS_TYPE_CREATE: A new thread need to be created. |
280 | * @GST_STREAM_STATUS_TYPE_ENTER: a thread entered its loop function |
281 | * @GST_STREAM_STATUS_TYPE_LEAVE: a thread left its loop function |
282 | * @GST_STREAM_STATUS_TYPE_DESTROY: a thread is destroyed |
283 | * @GST_STREAM_STATUS_TYPE_START: a thread is started |
284 | * @GST_STREAM_STATUS_TYPE_PAUSE: a thread is paused |
285 | * @GST_STREAM_STATUS_TYPE_STOP: a thread is stopped |
286 | * |
287 | * The type of a %GST_MESSAGE_STREAM_STATUS. The stream status messages inform the |
288 | * application of new streaming threads and their status. |
289 | */ |
290 | typedef enum { |
291 | GST_STREAM_STATUS_TYPE_CREATE = 0, |
292 | GST_STREAM_STATUS_TYPE_ENTER = 1, |
293 | GST_STREAM_STATUS_TYPE_LEAVE = 2, |
294 | GST_STREAM_STATUS_TYPE_DESTROY = 3, |
295 | |
296 | GST_STREAM_STATUS_TYPE_START = 8, |
297 | GST_STREAM_STATUS_TYPE_PAUSE = 9, |
298 | GST_STREAM_STATUS_TYPE_STOP = 10 |
299 | } GstStreamStatusType; |
300 | |
301 | /** |
302 | * GstProgressType: |
303 | * @GST_PROGRESS_TYPE_START: A new task started. |
304 | * @GST_PROGRESS_TYPE_CONTINUE: A task completed and a new one continues. |
305 | * @GST_PROGRESS_TYPE_COMPLETE: A task completed. |
306 | * @GST_PROGRESS_TYPE_CANCELED: A task was canceled. |
307 | * @GST_PROGRESS_TYPE_ERROR: A task caused an error. An error message is also |
308 | * posted on the bus. |
309 | * |
310 | * The type of a %GST_MESSAGE_PROGRESS. The progress messages inform the |
311 | * application of the status of asynchronous tasks. |
312 | */ |
313 | typedef enum { |
314 | GST_PROGRESS_TYPE_START = 0, |
315 | GST_PROGRESS_TYPE_CONTINUE = 1, |
316 | GST_PROGRESS_TYPE_COMPLETE = 2, |
317 | GST_PROGRESS_TYPE_CANCELED = 3, |
318 | GST_PROGRESS_TYPE_ERROR = 4 |
319 | } GstProgressType; |
320 | |
321 | /** |
322 | * GstMessage: |
323 | * @mini_object: the parent structure |
324 | * @type: the #GstMessageType of the message |
325 | * @timestamp: the timestamp of the message |
326 | * @src: the src of the message |
327 | * @seqnum: the sequence number of the message |
328 | * |
329 | * A #GstMessage. |
330 | */ |
331 | struct _GstMessage |
332 | { |
333 | GstMiniObject mini_object; |
334 | |
335 | /*< public > *//* with COW */ |
336 | GstMessageType type; |
337 | guint64 timestamp; |
338 | GstObject *src; |
339 | guint32 seqnum; |
340 | |
341 | /*< private >*//* with MESSAGE_LOCK */ |
342 | GMutex lock; /* lock and cond for async delivery */ |
343 | GCond cond; |
344 | }; |
345 | |
346 | #include <gst/gstquery.h> |
347 | |
348 | GST_API |
349 | GType gst_message_get_type (void); |
350 | |
351 | GST_API |
352 | const gchar* gst_message_type_get_name (GstMessageType type); |
353 | |
354 | GST_API |
355 | GQuark gst_message_type_to_quark (GstMessageType type); |
356 | |
357 | /* refcounting */ |
358 | /** |
359 | * gst_message_ref: |
360 | * @msg: the message to ref |
361 | * |
362 | * Convenience macro to increase the reference count of the message. |
363 | * |
364 | * Returns: @msg (for convenience when doing assignments) |
365 | */ |
366 | static inline GstMessage * |
367 | gst_message_ref (GstMessage * msg) |
368 | { |
369 | return (GstMessage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (msg)); |
370 | } |
371 | |
372 | /** |
373 | * gst_message_unref: |
374 | * @msg: the message to unref |
375 | * |
376 | * Convenience macro to decrease the reference count of the message, possibly |
377 | * freeing it. |
378 | */ |
379 | static inline void |
380 | gst_message_unref (GstMessage * msg) |
381 | { |
382 | gst_mini_object_unref (GST_MINI_OBJECT_CAST (msg)); |
383 | } |
384 | |
385 | /** |
386 | * gst_clear_message: (skip) |
387 | * @msg_ptr: a pointer to a #GstMessage reference |
388 | * |
389 | * Clears a reference to a #GstMessage. |
390 | * |
391 | * @msg_ptr must not be %NULL. |
392 | * |
393 | * If the reference is %NULL then this function does nothing. Otherwise, the |
394 | * reference count of the message is decreased and the pointer is set to %NULL. |
395 | * |
396 | * Since: 1.16 |
397 | */ |
398 | static inline void |
399 | gst_clear_message (GstMessage ** msg_ptr) |
400 | { |
401 | gst_clear_mini_object ((GstMiniObject **) msg_ptr); |
402 | } |
403 | |
404 | /* copy message */ |
405 | /** |
406 | * gst_message_copy: |
407 | * @msg: the message to copy |
408 | * |
409 | * Creates a copy of the message. Returns a copy of the message. |
410 | * |
411 | * Returns: (transfer full): a new copy of @msg. |
412 | * |
413 | * MT safe |
414 | */ |
415 | static inline GstMessage * |
416 | gst_message_copy (const GstMessage * msg) |
417 | { |
418 | return GST_MESSAGE_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (msg))); |
419 | } |
420 | |
421 | /** |
422 | * gst_message_is_writable: |
423 | * @msg: a #GstMessage |
424 | * |
425 | * Tests if you can safely write into a message's structure or validly |
426 | * modify the seqnum and timestamp fields. |
427 | */ |
428 | #define gst_message_is_writable(msg) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (msg)) |
429 | /** |
430 | * gst_message_make_writable: |
431 | * @msg: (transfer full): the message to make writable |
432 | * |
433 | * Checks if a message is writable. If not, a writable copy is made and |
434 | * returned. |
435 | * |
436 | * Returns: (transfer full): a message (possibly a duplicate) that is writable. |
437 | * |
438 | * MT safe |
439 | */ |
440 | #define gst_message_make_writable(msg) GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg))) |
441 | /** |
442 | * gst_message_replace: |
443 | * @old_message: (inout) (transfer full) (nullable): pointer to a |
444 | * pointer to a #GstMessage to be replaced. |
445 | * @new_message: (allow-none) (transfer none): pointer to a #GstMessage that will |
446 | * replace the message pointed to by @old_message. |
447 | * |
448 | * Modifies a pointer to a #GstMessage to point to a different #GstMessage. The |
449 | * modification is done atomically (so this is useful for ensuring thread safety |
450 | * in some cases), and the reference counts are updated appropriately (the old |
451 | * message is unreffed, the new one is reffed). |
452 | * |
453 | * Either @new_message or the #GstMessage pointed to by @old_message may be %NULL. |
454 | * |
455 | * Returns: %TRUE if @new_message was different from @old_message |
456 | */ |
457 | static inline gboolean |
458 | gst_message_replace (GstMessage **old_message, GstMessage *new_message) |
459 | { |
460 | return gst_mini_object_replace ((GstMiniObject **) old_message, (GstMiniObject *) new_message); |
461 | } |
462 | |
463 | /** |
464 | * gst_message_take: |
465 | * @old_message: (inout) (transfer full): pointer to a pointer to a #GstMessage |
466 | * to be replaced. |
467 | * @new_message: (transfer full) (allow-none): pointer to a #GstMessage that |
468 | * will replace the message pointed to by @old_message. |
469 | * |
470 | * Modifies a pointer to a #GstMessage to point to a different #GstMessage. This |
471 | * function is similar to gst_message_replace() except that it takes ownership |
472 | * of @new_message. |
473 | * |
474 | * Returns: %TRUE if @new_message was different from @old_message |
475 | * |
476 | * Since: 1.16 |
477 | */ |
478 | static inline gboolean |
479 | gst_message_take (GstMessage **old_message, GstMessage *new_message) |
480 | { |
481 | return gst_mini_object_take ((GstMiniObject **) old_message, |
482 | (GstMiniObject *) new_message); |
483 | } |
484 | |
485 | |
486 | /* custom messages */ |
487 | |
488 | GST_API |
489 | GstMessage * gst_message_new_custom (GstMessageType type, |
490 | GstObject * src, |
491 | GstStructure * structure) G_GNUC_MALLOC; |
492 | GST_API |
493 | const GstStructure * |
494 | gst_message_get_structure (GstMessage *message); |
495 | |
496 | GST_API |
497 | GstStructure * gst_message_writable_structure (GstMessage *message); |
498 | |
499 | GST_API |
500 | gboolean gst_message_has_name (GstMessage *message, const gchar *name); |
501 | |
502 | /* identifiers for events and messages */ |
503 | |
504 | GST_API |
505 | guint32 gst_message_get_seqnum (GstMessage *message); |
506 | |
507 | GST_API |
508 | void gst_message_set_seqnum (GstMessage *message, guint32 seqnum); |
509 | |
510 | /* EOS */ |
511 | |
512 | GST_API |
513 | GstMessage * gst_message_new_eos (GstObject * src) G_GNUC_MALLOC; |
514 | |
515 | /* ERROR */ |
516 | |
517 | GST_API |
518 | GstMessage * gst_message_new_error (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC; |
519 | |
520 | GST_API |
521 | GstMessage * gst_message_new_error_with_details (GstObject * src, GError * error, const gchar * debug, GstStructure * details) G_GNUC_MALLOC; |
522 | |
523 | GST_API |
524 | void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug); |
525 | |
526 | GST_API |
527 | void gst_message_parse_error_details (GstMessage *message, const GstStructure **structure); |
528 | |
529 | /* WARNING */ |
530 | |
531 | GST_API |
532 | GstMessage * gst_message_new_warning (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC; |
533 | |
534 | GST_API |
535 | GstMessage * gst_message_new_warning_with_details (GstObject * src, GError * error, const gchar * debug, GstStructure * details) G_GNUC_MALLOC; |
536 | |
537 | GST_API |
538 | void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug); |
539 | |
540 | GST_API |
541 | void gst_message_parse_warning_details (GstMessage *message, const GstStructure **structure); |
542 | |
543 | /* INFO */ |
544 | |
545 | GST_API |
546 | GstMessage * gst_message_new_info (GstObject * src, GError * error, const gchar * debug) G_GNUC_MALLOC; |
547 | |
548 | GST_API |
549 | GstMessage * gst_message_new_info_with_details (GstObject * src, GError * error, const gchar * debug, GstStructure * details) G_GNUC_MALLOC; |
550 | |
551 | GST_API |
552 | void gst_message_parse_info (GstMessage *message, GError **gerror, gchar **debug); |
553 | |
554 | GST_API |
555 | void gst_message_parse_info_details (GstMessage *message, const GstStructure **structure); |
556 | |
557 | /* TAG */ |
558 | |
559 | GST_API |
560 | GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list) G_GNUC_MALLOC; |
561 | |
562 | GST_API |
563 | void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list); |
564 | |
565 | /* BUFFERING */ |
566 | |
567 | GST_API |
568 | GstMessage * gst_message_new_buffering (GstObject * src, gint percent) G_GNUC_MALLOC; |
569 | |
570 | GST_API |
571 | void gst_message_parse_buffering (GstMessage *message, gint *percent); |
572 | |
573 | GST_API |
574 | void gst_message_set_buffering_stats (GstMessage *message, GstBufferingMode mode, |
575 | gint avg_in, gint avg_out, |
576 | gint64 buffering_left); |
577 | GST_API |
578 | void gst_message_parse_buffering_stats (GstMessage *message, GstBufferingMode *mode, |
579 | gint *avg_in, gint *avg_out, |
580 | gint64 *buffering_left); |
581 | |
582 | /* STATE_CHANGED */ |
583 | |
584 | GST_API |
585 | GstMessage * gst_message_new_state_changed (GstObject * src, GstState oldstate, |
586 | GstState newstate, GstState pending) G_GNUC_MALLOC; |
587 | GST_API |
588 | void gst_message_parse_state_changed (GstMessage *message, GstState *oldstate, |
589 | GstState *newstate, GstState *pending); |
590 | |
591 | /* STATE_DIRTY */ |
592 | |
593 | GST_API |
594 | GstMessage * gst_message_new_state_dirty (GstObject * src) G_GNUC_MALLOC; |
595 | |
596 | /* STEP_DONE */ |
597 | |
598 | GST_API |
599 | GstMessage * gst_message_new_step_done (GstObject * src, GstFormat format, guint64 amount, |
600 | gdouble rate, gboolean flush, gboolean intermediate, |
601 | guint64 duration, gboolean eos) G_GNUC_MALLOC; |
602 | GST_API |
603 | void gst_message_parse_step_done (GstMessage * message, GstFormat *format, guint64 *amount, |
604 | gdouble *rate, gboolean *flush, gboolean *intermediate, |
605 | guint64 *duration, gboolean *eos); |
606 | /* CLOCK_PROVIDE */ |
607 | |
608 | GST_API |
609 | GstMessage * gst_message_new_clock_provide (GstObject * src, GstClock *clock, gboolean ready) G_GNUC_MALLOC; |
610 | |
611 | GST_API |
612 | void gst_message_parse_clock_provide (GstMessage *message, GstClock **clock, |
613 | gboolean *ready); |
614 | |
615 | /* CLOCK_LOST */ |
616 | |
617 | GST_API |
618 | GstMessage * gst_message_new_clock_lost (GstObject * src, GstClock *clock) G_GNUC_MALLOC; |
619 | |
620 | GST_API |
621 | void gst_message_parse_clock_lost (GstMessage *message, GstClock **clock); |
622 | |
623 | /* NEW_CLOCK */ |
624 | |
625 | GST_API |
626 | GstMessage * gst_message_new_new_clock (GstObject * src, GstClock *clock) G_GNUC_MALLOC; |
627 | |
628 | GST_API |
629 | void gst_message_parse_new_clock (GstMessage *message, GstClock **clock); |
630 | |
631 | /* APPLICATION */ |
632 | |
633 | GST_API |
634 | GstMessage * gst_message_new_application (GstObject * src, GstStructure * structure) G_GNUC_MALLOC; |
635 | |
636 | /* ELEMENT */ |
637 | |
638 | GST_API |
639 | GstMessage * gst_message_new_element (GstObject * src, GstStructure * structure) G_GNUC_MALLOC; |
640 | |
641 | /* SEGMENT_START */ |
642 | |
643 | GST_API |
644 | GstMessage * gst_message_new_segment_start (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC; |
645 | |
646 | GST_API |
647 | void gst_message_parse_segment_start (GstMessage *message, GstFormat *format, |
648 | gint64 *position); |
649 | |
650 | /* SEGMENT_DONE */ |
651 | |
652 | GST_API |
653 | GstMessage * gst_message_new_segment_done (GstObject * src, GstFormat format, gint64 position) G_GNUC_MALLOC; |
654 | |
655 | GST_API |
656 | void gst_message_parse_segment_done (GstMessage *message, GstFormat *format, |
657 | gint64 *position); |
658 | |
659 | /* DURATION_CHANGED */ |
660 | |
661 | GST_API |
662 | GstMessage * gst_message_new_duration_changed (GstObject * src) G_GNUC_MALLOC; |
663 | |
664 | /* LATENCY */ |
665 | |
666 | GST_API |
667 | GstMessage * gst_message_new_latency (GstObject * src) G_GNUC_MALLOC; |
668 | |
669 | /* ASYNC_START */ |
670 | |
671 | GST_API |
672 | GstMessage * gst_message_new_async_start (GstObject * src) G_GNUC_MALLOC; |
673 | |
674 | /* ASYNC_DONE */ |
675 | |
676 | GST_API |
677 | GstMessage * gst_message_new_async_done (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC; |
678 | |
679 | GST_API |
680 | void gst_message_parse_async_done (GstMessage *message, GstClockTime *running_time); |
681 | |
682 | /* STRUCTURE CHANGE */ |
683 | |
684 | GST_API |
685 | GstMessage * gst_message_new_structure_change (GstObject * src, GstStructureChangeType type, |
686 | GstElement *owner, gboolean busy) G_GNUC_MALLOC; |
687 | GST_API |
688 | void gst_message_parse_structure_change (GstMessage *message, GstStructureChangeType *type, |
689 | GstElement **owner, gboolean *busy); |
690 | |
691 | /* STREAM STATUS */ |
692 | |
693 | GST_API |
694 | GstMessage * gst_message_new_stream_status (GstObject * src, GstStreamStatusType type, |
695 | GstElement *owner) G_GNUC_MALLOC; |
696 | GST_API |
697 | void gst_message_parse_stream_status (GstMessage *message, GstStreamStatusType *type, |
698 | GstElement **owner); |
699 | GST_API |
700 | void gst_message_set_stream_status_object (GstMessage *message, const GValue *object); |
701 | |
702 | GST_API |
703 | const GValue * gst_message_get_stream_status_object (GstMessage *message); |
704 | |
705 | /* REQUEST_STATE */ |
706 | |
707 | GST_API |
708 | GstMessage * gst_message_new_request_state (GstObject * src, GstState state) G_GNUC_MALLOC; |
709 | |
710 | GST_API |
711 | void gst_message_parse_request_state (GstMessage * message, GstState *state); |
712 | |
713 | /* STEP_START */ |
714 | |
715 | GST_API |
716 | GstMessage * gst_message_new_step_start (GstObject * src, gboolean active, GstFormat format, |
717 | guint64 amount, gdouble rate, gboolean flush, |
718 | gboolean intermediate) G_GNUC_MALLOC; |
719 | GST_API |
720 | void gst_message_parse_step_start (GstMessage * message, gboolean *active, GstFormat *format, |
721 | guint64 *amount, gdouble *rate, gboolean *flush, |
722 | gboolean *intermediate); |
723 | |
724 | /* QOS */ |
725 | |
726 | GST_API |
727 | GstMessage * gst_message_new_qos (GstObject * src, gboolean live, guint64 running_time, |
728 | guint64 stream_time, guint64 timestamp, guint64 duration) G_GNUC_MALLOC; |
729 | GST_API |
730 | void gst_message_set_qos_values (GstMessage * message, gint64 jitter, gdouble proportion, |
731 | gint quality); |
732 | GST_API |
733 | void gst_message_set_qos_stats (GstMessage * message, GstFormat format, guint64 processed, |
734 | guint64 dropped); |
735 | GST_API |
736 | void gst_message_parse_qos (GstMessage * message, gboolean * live, guint64 * running_time, |
737 | guint64 * stream_time, guint64 * timestamp, guint64 * duration); |
738 | GST_API |
739 | void gst_message_parse_qos_values (GstMessage * message, gint64 * jitter, gdouble * proportion, |
740 | gint * quality); |
741 | GST_API |
742 | void gst_message_parse_qos_stats (GstMessage * message, GstFormat * format, guint64 * processed, |
743 | guint64 * dropped); |
744 | /* PROGRESS */ |
745 | |
746 | GST_API |
747 | GstMessage * gst_message_new_progress (GstObject * src, GstProgressType type, const gchar *code, |
748 | const gchar *text) G_GNUC_MALLOC; |
749 | GST_API |
750 | void gst_message_parse_progress (GstMessage * message, GstProgressType * type, gchar ** code, |
751 | gchar ** text); |
752 | |
753 | /* TOC */ |
754 | |
755 | GST_API |
756 | GstMessage * gst_message_new_toc (GstObject *src, GstToc *toc, gboolean updated); |
757 | |
758 | GST_API |
759 | void gst_message_parse_toc (GstMessage *message, GstToc **toc, gboolean *updated); |
760 | |
761 | /* RESET_TIME */ |
762 | |
763 | GST_API |
764 | GstMessage * gst_message_new_reset_time (GstObject * src, GstClockTime running_time) G_GNUC_MALLOC; |
765 | |
766 | GST_API |
767 | void gst_message_parse_reset_time (GstMessage *message, GstClockTime *running_time); |
768 | |
769 | /* STREAM_START */ |
770 | |
771 | GST_API |
772 | GstMessage * gst_message_new_stream_start (GstObject * src) G_GNUC_MALLOC; |
773 | |
774 | GST_API |
775 | void gst_message_set_group_id (GstMessage *message, guint group_id); |
776 | |
777 | GST_API |
778 | gboolean gst_message_parse_group_id (GstMessage *message, guint *group_id); |
779 | |
780 | /* NEED_CONTEXT */ |
781 | |
782 | GST_API |
783 | GstMessage * gst_message_new_need_context (GstObject * src, const gchar * context_type) G_GNUC_MALLOC; |
784 | |
785 | GST_API |
786 | gboolean gst_message_parse_context_type (GstMessage * message, const gchar ** context_type); |
787 | |
788 | /* HAVE_CONTEXT */ |
789 | |
790 | GST_API |
791 | GstMessage * gst_message_new_have_context (GstObject * src, GstContext *context) G_GNUC_MALLOC; |
792 | |
793 | GST_API |
794 | void gst_message_parse_have_context (GstMessage *message, GstContext **context); |
795 | |
796 | /* DEVICE_ADDED */ |
797 | |
798 | GST_API |
799 | GstMessage * gst_message_new_device_added (GstObject * src, GstDevice * device) G_GNUC_MALLOC; |
800 | |
801 | GST_API |
802 | void gst_message_parse_device_added (GstMessage * message, GstDevice ** device); |
803 | |
804 | /* DEVICE_REMOVED */ |
805 | |
806 | GST_API |
807 | GstMessage * gst_message_new_device_removed (GstObject * src, GstDevice * device) G_GNUC_MALLOC; |
808 | |
809 | GST_API |
810 | void gst_message_parse_device_removed (GstMessage * message, GstDevice ** device); |
811 | |
812 | /* DEVICE_CHANGED */ |
813 | |
814 | GST_API |
815 | GstMessage * gst_message_new_device_changed (GstObject * src, GstDevice * device, GstDevice *changed_device); |
816 | |
817 | GST_API |
818 | void gst_message_parse_device_changed (GstMessage * message, GstDevice ** device, GstDevice ** changed_device); |
819 | |
820 | |
821 | /* PROPERTY_NOTIFY */ |
822 | |
823 | GST_API |
824 | GstMessage * gst_message_new_property_notify (GstObject * src, const gchar * property_name, GValue * val) G_GNUC_MALLOC; |
825 | |
826 | GST_API |
827 | void gst_message_parse_property_notify (GstMessage * message, GstObject ** object, const gchar ** property_name, const GValue ** property_value); |
828 | |
829 | /* STREAM_COLLECTION */ |
830 | |
831 | GST_API |
832 | GstMessage * gst_message_new_stream_collection (GstObject * src, GstStreamCollection * collection) G_GNUC_MALLOC; |
833 | |
834 | GST_API |
835 | void gst_message_parse_stream_collection (GstMessage *message, GstStreamCollection **collection); |
836 | |
837 | /* STREAMS_SELECTED */ |
838 | |
839 | GST_API |
840 | GstMessage * gst_message_new_streams_selected (GstObject *src, GstStreamCollection *collection); |
841 | |
842 | GST_API |
843 | void gst_message_streams_selected_add (GstMessage *message, GstStream *stream); |
844 | |
845 | GST_API |
846 | void gst_message_parse_streams_selected (GstMessage * message, GstStreamCollection **collection); |
847 | |
848 | GST_API |
849 | guint gst_message_streams_selected_get_size (GstMessage * message); |
850 | |
851 | GST_API |
852 | GstStream *gst_message_streams_selected_get_stream (GstMessage *message, guint idx); |
853 | |
854 | /* REDIRECT */ |
855 | |
856 | GST_API |
857 | GstMessage * gst_message_new_redirect (GstObject * src, const gchar * location, GstTagList * tag_list, const GstStructure * entry_struct) G_GNUC_MALLOC; |
858 | |
859 | GST_API |
860 | void gst_message_add_redirect_entry (GstMessage * message, const gchar * location, GstTagList * tag_list, const GstStructure * entry_struct); |
861 | |
862 | GST_API |
863 | void gst_message_parse_redirect_entry (GstMessage * message, gsize entry_index, const gchar ** location, GstTagList ** tag_list, const GstStructure ** entry_struct); |
864 | |
865 | GST_API |
866 | gsize gst_message_get_num_redirect_entries (GstMessage * message); |
867 | |
868 | #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC |
869 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstMessage, gst_message_unref) |
870 | #endif |
871 | |
872 | G_END_DECLS |
873 | |
874 | #endif /* __GST_MESSAGE_H__ */ |
875 | |