gstevent.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /* GStreamer
  2. * Copyright (C) 1999,2000 Erik Walthinsen <[email protected]>
  3. * 2000 Wim Taymans <[email protected]>
  4. * 2005 Wim Taymans <[email protected]>
  5. *
  6. * gstevent.h: Header for GstEvent subsystem
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Library General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Library General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Library General Public
  19. * License along with this library; if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  21. * Boston, MA 02110-1301, USA.
  22. */
  23. #ifndef __GST_EVENT_H__
  24. #define __GST_EVENT_H__
  25. typedef struct _GstEvent GstEvent;
  26. /**
  27. * GstEventTypeFlags:
  28. * @GST_EVENT_TYPE_UPSTREAM: Set if the event can travel upstream.
  29. * @GST_EVENT_TYPE_DOWNSTREAM: Set if the event can travel downstream.
  30. * @GST_EVENT_TYPE_SERIALIZED: Set if the event should be serialized with data
  31. * flow.
  32. * @GST_EVENT_TYPE_STICKY: Set if the event is sticky on the pads.
  33. * @GST_EVENT_TYPE_STICKY_MULTI: Multiple sticky events can be on a pad, each
  34. * identified by the event name.
  35. *
  36. * #GstEventTypeFlags indicate the aspects of the different #GstEventType
  37. * values. You can get the type flags of a #GstEventType with the
  38. * gst_event_type_get_flags() function.
  39. */
  40. typedef enum {
  41. GST_EVENT_TYPE_UPSTREAM = 1 << 0,
  42. GST_EVENT_TYPE_DOWNSTREAM = 1 << 1,
  43. GST_EVENT_TYPE_SERIALIZED = 1 << 2,
  44. GST_EVENT_TYPE_STICKY = 1 << 3,
  45. GST_EVENT_TYPE_STICKY_MULTI = 1 << 4
  46. } GstEventTypeFlags;
  47. /**
  48. * GST_EVENT_TYPE_BOTH:
  49. *
  50. * The same thing as #GST_EVENT_TYPE_UPSTREAM | #GST_EVENT_TYPE_DOWNSTREAM.
  51. */
  52. #define GST_EVENT_TYPE_BOTH \
  53. (GST_EVENT_TYPE_UPSTREAM | GST_EVENT_TYPE_DOWNSTREAM)
  54. #define GST_EVENT_NUM_SHIFT (8)
  55. /**
  56. * GST_EVENT_MAKE_TYPE:
  57. * @num: the event number to create
  58. * @flags: the event flags
  59. *
  60. * when making custom event types, use this macro with the num and
  61. * the given flags
  62. */
  63. #define GST_EVENT_MAKE_TYPE(num,flags) \
  64. (((num) << GST_EVENT_NUM_SHIFT) | (flags))
  65. #define FLAG(name) GST_EVENT_TYPE_##name
  66. /**
  67. * GstEventType:
  68. * @GST_EVENT_UNKNOWN: unknown event.
  69. * @GST_EVENT_FLUSH_START: Start a flush operation. This event clears all data
  70. * from the pipeline and unblock all streaming threads.
  71. * @GST_EVENT_FLUSH_STOP: Stop a flush operation. This event resets the
  72. * running-time of the pipeline.
  73. * @GST_EVENT_STREAM_START: Event to mark the start of a new stream. Sent before any
  74. * other serialized event and only sent at the start of a new stream,
  75. * not after flushing seeks.
  76. * @GST_EVENT_CAPS: #GstCaps event. Notify the pad of a new media type.
  77. * @GST_EVENT_SEGMENT: A new media segment follows in the dataflow. The
  78. * segment events contains information for clipping buffers and
  79. * converting buffer timestamps to running-time and
  80. * stream-time.
  81. * @GST_EVENT_TAG: A new set of metadata tags has been found in the stream.
  82. * @GST_EVENT_BUFFERSIZE: Notification of buffering requirements. Currently not
  83. * used yet.
  84. * @GST_EVENT_SINK_MESSAGE: An event that sinks turn into a message. Used to
  85. * send messages that should be emitted in sync with
  86. * rendering.
  87. * @GST_EVENT_EOS: End-Of-Stream. No more data is to be expected to follow
  88. * without a SEGMENT event.
  89. * @GST_EVENT_SEGMENT_DONE: Marks the end of a segment playback.
  90. * @GST_EVENT_GAP: Marks a gap in the datastream.
  91. * @GST_EVENT_TOC: An event which indicates that a new table of contents (TOC)
  92. * was found or updated.
  93. * @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements
  94. * that the downstream elements should adjust their processing
  95. * rate.
  96. * @GST_EVENT_SEEK: A request for a new playback position and rate.
  97. * @GST_EVENT_NAVIGATION: Navigation events are usually used for communicating
  98. * user requests, such as mouse or keyboard movements,
  99. * to upstream elements.
  100. * @GST_EVENT_LATENCY: Notification of new latency adjustment. Sinks will use
  101. * the latency information to adjust their synchronisation.
  102. * @GST_EVENT_STEP: A request for stepping through the media. Sinks will usually
  103. * execute the step operation.
  104. * @GST_EVENT_RECONFIGURE: A request for upstream renegotiating caps and reconfiguring.
  105. * @GST_EVENT_TOC_SELECT: A request for a new playback position based on TOC
  106. * entry's UID.
  107. * @GST_EVENT_CUSTOM_UPSTREAM: Upstream custom event
  108. * @GST_EVENT_CUSTOM_DOWNSTREAM: Downstream custom event that travels in the
  109. * data flow.
  110. * @GST_EVENT_CUSTOM_DOWNSTREAM_OOB: Custom out-of-band downstream event.
  111. * @GST_EVENT_CUSTOM_DOWNSTREAM_STICKY: Custom sticky downstream event.
  112. * @GST_EVENT_CUSTOM_BOTH: Custom upstream or downstream event.
  113. * In-band when travelling downstream.
  114. * @GST_EVENT_CUSTOM_BOTH_OOB: Custom upstream or downstream out-of-band event.
  115. *
  116. * #GstEventType lists the standard event types that can be sent in a pipeline.
  117. *
  118. * The custom event types can be used for private messages between elements
  119. * that can't be expressed using normal
  120. * GStreamer buffer passing semantics. Custom events carry an arbitrary
  121. * #GstStructure.
  122. * Specific custom events are distinguished by the name of the structure.
  123. */
  124. /* NOTE: keep in sync with quark registration in gstevent.c */
  125. typedef enum {
  126. GST_EVENT_UNKNOWN = GST_EVENT_MAKE_TYPE (0, 0),
  127. /* bidirectional events */
  128. GST_EVENT_FLUSH_START = GST_EVENT_MAKE_TYPE (10, FLAG(BOTH)),
  129. GST_EVENT_FLUSH_STOP = GST_EVENT_MAKE_TYPE (20, FLAG(BOTH) | FLAG(SERIALIZED)),
  130. /* downstream serialized events */
  131. GST_EVENT_STREAM_START = GST_EVENT_MAKE_TYPE (40, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  132. GST_EVENT_CAPS = GST_EVENT_MAKE_TYPE (50, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  133. GST_EVENT_SEGMENT = GST_EVENT_MAKE_TYPE (70, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  134. GST_EVENT_TAG = GST_EVENT_MAKE_TYPE (80, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
  135. GST_EVENT_BUFFERSIZE = GST_EVENT_MAKE_TYPE (90, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  136. GST_EVENT_SINK_MESSAGE = GST_EVENT_MAKE_TYPE (100, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
  137. GST_EVENT_EOS = GST_EVENT_MAKE_TYPE (110, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  138. GST_EVENT_TOC = GST_EVENT_MAKE_TYPE (120, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
  139. /* non-sticky downstream serialized */
  140. GST_EVENT_SEGMENT_DONE = GST_EVENT_MAKE_TYPE (150, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
  141. GST_EVENT_GAP = GST_EVENT_MAKE_TYPE (160, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
  142. /* upstream events */
  143. GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (190, FLAG(UPSTREAM)),
  144. GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (200, FLAG(UPSTREAM)),
  145. GST_EVENT_NAVIGATION = GST_EVENT_MAKE_TYPE (210, FLAG(UPSTREAM)),
  146. GST_EVENT_LATENCY = GST_EVENT_MAKE_TYPE (220, FLAG(UPSTREAM)),
  147. GST_EVENT_STEP = GST_EVENT_MAKE_TYPE (230, FLAG(UPSTREAM)),
  148. GST_EVENT_RECONFIGURE = GST_EVENT_MAKE_TYPE (240, FLAG(UPSTREAM)),
  149. GST_EVENT_TOC_SELECT = GST_EVENT_MAKE_TYPE (250, FLAG(UPSTREAM)),
  150. /* custom events start here */
  151. GST_EVENT_CUSTOM_UPSTREAM = GST_EVENT_MAKE_TYPE (270, FLAG(UPSTREAM)),
  152. GST_EVENT_CUSTOM_DOWNSTREAM = GST_EVENT_MAKE_TYPE (280, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
  153. GST_EVENT_CUSTOM_DOWNSTREAM_OOB = GST_EVENT_MAKE_TYPE (290, FLAG(DOWNSTREAM)),
  154. GST_EVENT_CUSTOM_DOWNSTREAM_STICKY = GST_EVENT_MAKE_TYPE (300, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
  155. GST_EVENT_CUSTOM_BOTH = GST_EVENT_MAKE_TYPE (310, FLAG(BOTH) | FLAG(SERIALIZED)),
  156. GST_EVENT_CUSTOM_BOTH_OOB = GST_EVENT_MAKE_TYPE (320, FLAG(BOTH))
  157. } GstEventType;
  158. #undef FLAG
  159. #include <gst/gstminiobject.h>
  160. #include <gst/gstformat.h>
  161. #include <gst/gstobject.h>
  162. #include <gst/gstclock.h>
  163. #include <gst/gststructure.h>
  164. #include <gst/gsttaglist.h>
  165. #include <gst/gstsegment.h>
  166. #include <gst/gstsegment.h>
  167. #include <gst/gstmessage.h>
  168. #include <gst/gstcontext.h>
  169. G_BEGIN_DECLS
  170. GST_EXPORT GType _gst_event_type;
  171. #define GST_TYPE_EVENT (_gst_event_type)
  172. #define GST_IS_EVENT(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_EVENT))
  173. #define GST_EVENT_CAST(obj) ((GstEvent *)(obj))
  174. #define GST_EVENT(obj) (GST_EVENT_CAST(obj))
  175. /**
  176. * GST_EVENT_TYPE:
  177. * @event: the event to query
  178. *
  179. * Get the #GstEventType of the event.
  180. */
  181. #define GST_EVENT_TYPE(event) (GST_EVENT_CAST(event)->type)
  182. /**
  183. * GST_EVENT_TYPE_NAME:
  184. * @event: the event to query
  185. *
  186. * Get a constant string representation of the #GstEventType of the event.
  187. */
  188. #define GST_EVENT_TYPE_NAME(event) (gst_event_type_get_name(GST_EVENT_TYPE(event)))
  189. /**
  190. * GST_EVENT_TIMESTAMP:
  191. * @event: the event to query
  192. *
  193. * Get the #GstClockTime timestamp of the event. This is the time when the event
  194. * was created.
  195. */
  196. #define GST_EVENT_TIMESTAMP(event) (GST_EVENT_CAST(event)->timestamp)
  197. /**
  198. * GST_EVENT_SEQNUM:
  199. * @event: the event to query
  200. *
  201. * The sequence number of @event.
  202. */
  203. #define GST_EVENT_SEQNUM(event) (GST_EVENT_CAST(event)->seqnum)
  204. /**
  205. * GST_EVENT_IS_UPSTREAM:
  206. * @ev: the event to query
  207. *
  208. * Check if an event can travel upstream.
  209. */
  210. #define GST_EVENT_IS_UPSTREAM(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_UPSTREAM)
  211. /**
  212. * GST_EVENT_IS_DOWNSTREAM:
  213. * @ev: the event to query
  214. *
  215. * Check if an event can travel downstream.
  216. */
  217. #define GST_EVENT_IS_DOWNSTREAM(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_DOWNSTREAM)
  218. /**
  219. * GST_EVENT_IS_SERIALIZED:
  220. * @ev: the event to query
  221. *
  222. * Check if an event is serialized with the data stream.
  223. */
  224. #define GST_EVENT_IS_SERIALIZED(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_SERIALIZED)
  225. /**
  226. * GST_EVENT_IS_STICKY:
  227. * @ev: the event to query
  228. *
  229. * Check if an event is sticky on the pads.
  230. */
  231. #define GST_EVENT_IS_STICKY(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_STICKY)
  232. /**
  233. * gst_event_is_writable:
  234. * @ev: a #GstEvent
  235. *
  236. * Tests if you can safely write data into a event's structure or validly
  237. * modify the seqnum and timestamp field.
  238. */
  239. #define gst_event_is_writable(ev) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (ev))
  240. /**
  241. * gst_event_make_writable:
  242. * @ev: (transfer full): a #GstEvent
  243. *
  244. * Makes a writable event from the given event. If the source event is
  245. * already writable, this will simply return the same event. A copy will
  246. * otherwise be made using gst_event_copy().
  247. *
  248. * Returns: (transfer full): a writable event which may or may not be the
  249. * same as @ev
  250. */
  251. #define gst_event_make_writable(ev) GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (ev)))
  252. /**
  253. * gst_event_replace:
  254. * @old_event: (inout) (transfer full) (nullable): pointer to a
  255. * pointer to a #GstEvent to be replaced.
  256. * @new_event: (allow-none) (transfer none): pointer to a #GstEvent that will
  257. * replace the event pointed to by @old_event.
  258. *
  259. * Modifies a pointer to a #GstEvent to point to a different #GstEvent. The
  260. * modification is done atomically (so this is useful for ensuring thread safety
  261. * in some cases), and the reference counts are updated appropriately (the old
  262. * event is unreffed, the new one is reffed).
  263. *
  264. * Either @new_event or the #GstEvent pointed to by @old_event may be %NULL.
  265. *
  266. * Returns: %TRUE if @new_event was different from @old_event
  267. */
  268. #ifdef _FOOL_GTK_DOC_
  269. G_INLINE_FUNC gboolean gst_event_replace (GstEvent **old_event, GstEvent *new_event);
  270. #endif
  271. static inline gboolean
  272. gst_event_replace (GstEvent **old_event, GstEvent *new_event)
  273. {
  274. return gst_mini_object_replace ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
  275. }
  276. /**
  277. * gst_event_steal:
  278. * @old_event: (inout) (transfer full) (nullable): pointer to a
  279. * pointer to a #GstEvent to be stolen.
  280. *
  281. * Atomically replace the #GstEvent pointed to by @old_event with %NULL and
  282. * return the original event.
  283. *
  284. * Returns: the #GstEvent that was in @old_event
  285. */
  286. #ifdef _FOOL_GTK_DOC_
  287. G_INLINE_FUNC GstEvent * gst_event_steal (GstEvent **old_event);
  288. #endif
  289. static inline GstEvent *
  290. gst_event_steal (GstEvent **old_event)
  291. {
  292. return GST_EVENT_CAST (gst_mini_object_steal ((GstMiniObject **) old_event));
  293. }
  294. /**
  295. * gst_event_take:
  296. * @old_event: (inout) (transfer full) (nullable): pointer to a
  297. * pointer to a #GstEvent to be stolen.
  298. * @new_event: (allow-none) (transfer full): pointer to a #GstEvent that will
  299. * replace the event pointed to by @old_event.
  300. *
  301. * Modifies a pointer to a #GstEvent to point to a different #GstEvent. This
  302. * function is similar to gst_event_replace() except that it takes ownership of
  303. * @new_event.
  304. *
  305. * Either @new_event or the #GstEvent pointed to by @old_event may be %NULL.
  306. *
  307. * Returns: %TRUE if @new_event was different from @old_event
  308. */
  309. #ifdef _FOOL_GTK_DOC_
  310. G_INLINE_FUNC gboolean gst_event_take (GstEvent **old_event, GstEvent *new_event);
  311. #endif
  312. static inline gboolean
  313. gst_event_take (GstEvent **old_event, GstEvent *new_event)
  314. {
  315. return gst_mini_object_take ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
  316. }
  317. /**
  318. * GstQOSType:
  319. * @GST_QOS_TYPE_OVERFLOW: The QoS event type that is produced when downstream
  320. * elements are producing data too quickly and the element can't keep up
  321. * processing the data. Upstream should reduce their processing rate. This
  322. * type is also used when buffers arrive early or in time.
  323. * @GST_QOS_TYPE_UNDERFLOW: The QoS event type that is produced when downstream
  324. * elements are producing data too slowly and need to speed up their processing
  325. * rate.
  326. * @GST_QOS_TYPE_THROTTLE: The QoS event type that is produced when the
  327. * application enabled throttling to limit the datarate.
  328. *
  329. * The different types of QoS events that can be given to the
  330. * gst_event_new_qos() method.
  331. */
  332. typedef enum {
  333. GST_QOS_TYPE_OVERFLOW = 0,
  334. GST_QOS_TYPE_UNDERFLOW = 1,
  335. GST_QOS_TYPE_THROTTLE = 2
  336. } GstQOSType;
  337. /**
  338. * GstStreamFlags:
  339. * @GST_STREAM_FLAG_NONE: This stream has no special attributes
  340. * @GST_STREAM_FLAG_SPARSE: This stream is a sparse stream (e.g. a subtitle
  341. * stream), data may flow only in irregular intervals with large gaps in
  342. * between.
  343. * @GST_STREAM_FLAG_SELECT: This stream should be selected by default. This
  344. * flag may be used by demuxers to signal that a stream should be selected
  345. * by default in a playback scenario.
  346. * @GST_STREAM_FLAG_UNSELECT: This stream should not be selected by default.
  347. * This flag may be used by demuxers to signal that a stream should not
  348. * be selected by default in a playback scenario, but only if explicitly
  349. * selected by the user (e.g. an audio track for the hard of hearing or
  350. * a director's commentary track).
  351. *
  352. * Since: 1.2
  353. */
  354. typedef enum {
  355. GST_STREAM_FLAG_NONE,
  356. GST_STREAM_FLAG_SPARSE = (1 << 0),
  357. GST_STREAM_FLAG_SELECT = (1 << 1),
  358. GST_STREAM_FLAG_UNSELECT = (1 << 2)
  359. } GstStreamFlags;
  360. /**
  361. * GstEvent:
  362. * @mini_object: the parent structure
  363. * @type: the #GstEventType of the event
  364. * @timestamp: the timestamp of the event
  365. * @seqnum: the sequence number of the event
  366. *
  367. * A #GstEvent.
  368. */
  369. struct _GstEvent {
  370. GstMiniObject mini_object;
  371. /*< public >*/ /* with COW */
  372. GstEventType type;
  373. guint64 timestamp;
  374. guint32 seqnum;
  375. };
  376. const gchar* gst_event_type_get_name (GstEventType type);
  377. GQuark gst_event_type_to_quark (GstEventType type);
  378. GstEventTypeFlags
  379. gst_event_type_get_flags (GstEventType type);
  380. /* refcounting */
  381. /**
  382. * gst_event_ref:
  383. * @event: The event to refcount
  384. *
  385. * Increase the refcount of this event.
  386. *
  387. * Returns: (transfer full): @event (for convenience when doing assignments)
  388. */
  389. #ifdef _FOOL_GTK_DOC_
  390. G_INLINE_FUNC GstEvent * gst_event_ref (GstEvent * event);
  391. #endif
  392. static inline GstEvent *
  393. gst_event_ref (GstEvent * event)
  394. {
  395. return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (event));
  396. }
  397. /**
  398. * gst_event_unref:
  399. * @event: (transfer full): the event to refcount
  400. *
  401. * Decrease the refcount of an event, freeing it if the refcount reaches 0.
  402. */
  403. #ifdef _FOOL_GTK_DOC_
  404. G_INLINE_FUNC void gst_event_unref (GstEvent * event);
  405. #endif
  406. static inline void
  407. gst_event_unref (GstEvent * event)
  408. {
  409. gst_mini_object_unref (GST_MINI_OBJECT_CAST (event));
  410. }
  411. /* copy event */
  412. /**
  413. * gst_event_copy:
  414. * @event: The event to copy
  415. *
  416. * Copy the event using the event specific copy function.
  417. *
  418. * Returns: (transfer full): the new event
  419. */
  420. #ifdef _FOOL_GTK_DOC_
  421. G_INLINE_FUNC GstEvent * gst_event_copy (const GstEvent * event);
  422. #endif
  423. static inline GstEvent *
  424. gst_event_copy (const GstEvent * event)
  425. {
  426. return GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (event)));
  427. }
  428. GType gst_event_get_type (void);
  429. /* custom event */
  430. GstEvent* gst_event_new_custom (GstEventType type, GstStructure *structure) G_GNUC_MALLOC;
  431. const GstStructure *
  432. gst_event_get_structure (GstEvent *event);
  433. GstStructure * gst_event_writable_structure (GstEvent *event);
  434. gboolean gst_event_has_name (GstEvent *event, const gchar *name);
  435. /* identifiers for events and messages */
  436. guint32 gst_event_get_seqnum (GstEvent *event);
  437. void gst_event_set_seqnum (GstEvent *event, guint32 seqnum);
  438. /* accumulated pad offsets for the event */
  439. gint64 gst_event_get_running_time_offset (GstEvent *event);
  440. void gst_event_set_running_time_offset (GstEvent *event, gint64 offset);
  441. /* Stream start event */
  442. GstEvent * gst_event_new_stream_start (const gchar *stream_id) G_GNUC_MALLOC;
  443. void gst_event_parse_stream_start (GstEvent *event, const gchar **stream_id);
  444. void gst_event_set_stream_flags (GstEvent *event, GstStreamFlags flags);
  445. void gst_event_parse_stream_flags (GstEvent *event, GstStreamFlags *flags);
  446. void gst_event_set_group_id (GstEvent *event, guint group_id);
  447. gboolean gst_event_parse_group_id (GstEvent *event, guint *group_id);
  448. /* flush events */
  449. GstEvent * gst_event_new_flush_start (void) G_GNUC_MALLOC;
  450. GstEvent * gst_event_new_flush_stop (gboolean reset_time) G_GNUC_MALLOC;
  451. void gst_event_parse_flush_stop (GstEvent *event, gboolean *reset_time);
  452. /* EOS event */
  453. GstEvent * gst_event_new_eos (void) G_GNUC_MALLOC;
  454. /* GAP event */
  455. GstEvent * gst_event_new_gap (GstClockTime timestamp,
  456. GstClockTime duration) G_GNUC_MALLOC;
  457. void gst_event_parse_gap (GstEvent * event,
  458. GstClockTime * timestamp,
  459. GstClockTime * duration);
  460. /* Caps events */
  461. GstEvent * gst_event_new_caps (GstCaps *caps) G_GNUC_MALLOC;
  462. void gst_event_parse_caps (GstEvent *event, GstCaps **caps);
  463. /* segment event */
  464. GstEvent* gst_event_new_segment (const GstSegment *segment) G_GNUC_MALLOC;
  465. void gst_event_parse_segment (GstEvent *event, const GstSegment **segment);
  466. void gst_event_copy_segment (GstEvent *event, GstSegment *segment);
  467. /* tag event */
  468. GstEvent* gst_event_new_tag (GstTagList *taglist) G_GNUC_MALLOC;
  469. void gst_event_parse_tag (GstEvent *event, GstTagList **taglist);
  470. /* TOC event */
  471. GstEvent* gst_event_new_toc (GstToc *toc, gboolean updated);
  472. void gst_event_parse_toc (GstEvent *event, GstToc **toc, gboolean *updated);
  473. /* buffer */
  474. GstEvent * gst_event_new_buffer_size (GstFormat format, gint64 minsize, gint64 maxsize,
  475. gboolean async) G_GNUC_MALLOC;
  476. void gst_event_parse_buffer_size (GstEvent *event, GstFormat *format, gint64 *minsize,
  477. gint64 *maxsize, gboolean *async);
  478. /* sink message */
  479. GstEvent* gst_event_new_sink_message (const gchar *name, GstMessage *msg) G_GNUC_MALLOC;
  480. void gst_event_parse_sink_message (GstEvent *event, GstMessage **msg);
  481. /* QOS events */
  482. GstEvent* gst_event_new_qos (GstQOSType type, gdouble proportion,
  483. GstClockTimeDiff diff, GstClockTime timestamp) G_GNUC_MALLOC;
  484. void gst_event_parse_qos (GstEvent *event, GstQOSType *type,
  485. gdouble *proportion, GstClockTimeDiff *diff,
  486. GstClockTime *timestamp);
  487. /* seek event */
  488. GstEvent* gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags,
  489. GstSeekType start_type, gint64 start,
  490. GstSeekType stop_type, gint64 stop) G_GNUC_MALLOC;
  491. void gst_event_parse_seek (GstEvent *event, gdouble *rate, GstFormat *format,
  492. GstSeekFlags *flags,
  493. GstSeekType *start_type, gint64 *start,
  494. GstSeekType *stop_type, gint64 *stop);
  495. /* navigation event */
  496. GstEvent* gst_event_new_navigation (GstStructure *structure) G_GNUC_MALLOC;
  497. /* latency event */
  498. GstEvent* gst_event_new_latency (GstClockTime latency) G_GNUC_MALLOC;
  499. void gst_event_parse_latency (GstEvent *event, GstClockTime *latency);
  500. /* step event */
  501. GstEvent* gst_event_new_step (GstFormat format, guint64 amount, gdouble rate,
  502. gboolean flush, gboolean intermediate) G_GNUC_MALLOC;
  503. void gst_event_parse_step (GstEvent *event, GstFormat *format, guint64 *amount,
  504. gdouble *rate, gboolean *flush, gboolean *intermediate);
  505. /* renegotiate event */
  506. GstEvent* gst_event_new_reconfigure (void) G_GNUC_MALLOC;
  507. /* TOC select event */
  508. GstEvent* gst_event_new_toc_select (const gchar *uid) G_GNUC_MALLOC;
  509. void gst_event_parse_toc_select (GstEvent *event, gchar **uid);
  510. /* segment-done event */
  511. GstEvent* gst_event_new_segment_done (GstFormat format, gint64 position) G_GNUC_MALLOC;
  512. void gst_event_parse_segment_done (GstEvent *event, GstFormat *format, gint64 *position);
  513. G_END_DECLS
  514. #endif /* __GST_EVENT_H__ */