gstmessage.h 27 KB

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