gstevent.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. /* GStreamer
  2. * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
  3. * 2000 Wim Taymans <wim.taymans@chello.be>
  4. * 2005 Wim Taymans <wim@fluendo.com>
  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_PROTECTION: An event which indicates that new or updated
  94. * encryption information has been found in the stream.
  95. * @GST_EVENT_QOS: A quality message. Used to indicate to upstream elements
  96. * that the downstream elements should adjust their processing
  97. * rate.
  98. * @GST_EVENT_SEEK: A request for a new playback position and rate.
  99. * @GST_EVENT_NAVIGATION: Navigation events are usually used for communicating
  100. * user requests, such as mouse or keyboard movements,
  101. * to upstream elements.
  102. * @GST_EVENT_LATENCY: Notification of new latency adjustment. Sinks will use
  103. * the latency information to adjust their synchronisation.
  104. * @GST_EVENT_STEP: A request for stepping through the media. Sinks will usually
  105. * execute the step operation.
  106. * @GST_EVENT_RECONFIGURE: A request for upstream renegotiating caps and reconfiguring.
  107. * @GST_EVENT_TOC_SELECT: A request for a new playback position based on TOC
  108. * entry's UID.
  109. * @GST_EVENT_CUSTOM_UPSTREAM: Upstream custom event
  110. * @GST_EVENT_CUSTOM_DOWNSTREAM: Downstream custom event that travels in the
  111. * data flow.
  112. * @GST_EVENT_CUSTOM_DOWNSTREAM_OOB: Custom out-of-band downstream event.
  113. * @GST_EVENT_CUSTOM_DOWNSTREAM_STICKY: Custom sticky downstream event.
  114. * @GST_EVENT_CUSTOM_BOTH: Custom upstream or downstream event.
  115. * In-band when travelling downstream.
  116. * @GST_EVENT_CUSTOM_BOTH_OOB: Custom upstream or downstream out-of-band event.
  117. *
  118. * #GstEventType lists the standard event types that can be sent in a pipeline.
  119. *
  120. * The custom event types can be used for private messages between elements
  121. * that can't be expressed using normal
  122. * GStreamer buffer passing semantics. Custom events carry an arbitrary
  123. * #GstStructure.
  124. * Specific custom events are distinguished by the name of the structure.
  125. */
  126. /* NOTE: keep in sync with quark registration in gstevent.c */
  127. typedef enum {
  128. GST_EVENT_UNKNOWN = GST_EVENT_MAKE_TYPE (0, 0),
  129. /* bidirectional events */
  130. GST_EVENT_FLUSH_START = GST_EVENT_MAKE_TYPE (10, FLAG(BOTH)),
  131. GST_EVENT_FLUSH_STOP = GST_EVENT_MAKE_TYPE (20, FLAG(BOTH) | FLAG(SERIALIZED)),
  132. /* downstream serialized events */
  133. GST_EVENT_STREAM_START = GST_EVENT_MAKE_TYPE (40, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  134. GST_EVENT_CAPS = GST_EVENT_MAKE_TYPE (50, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  135. GST_EVENT_SEGMENT = GST_EVENT_MAKE_TYPE (70, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  136. GST_EVENT_TAG = GST_EVENT_MAKE_TYPE (80, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
  137. GST_EVENT_BUFFERSIZE = GST_EVENT_MAKE_TYPE (90, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  138. GST_EVENT_SINK_MESSAGE = GST_EVENT_MAKE_TYPE (100, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
  139. GST_EVENT_EOS = GST_EVENT_MAKE_TYPE (110, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
  140. GST_EVENT_TOC = GST_EVENT_MAKE_TYPE (120, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
  141. GST_EVENT_PROTECTION = GST_EVENT_MAKE_TYPE (130, FLAG (DOWNSTREAM) | FLAG (SERIALIZED) | FLAG (STICKY) | FLAG (STICKY_MULTI)),
  142. /* non-sticky downstream serialized */
  143. GST_EVENT_SEGMENT_DONE = GST_EVENT_MAKE_TYPE (150, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
  144. GST_EVENT_GAP = GST_EVENT_MAKE_TYPE (160, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
  145. /* upstream events */
  146. GST_EVENT_QOS = GST_EVENT_MAKE_TYPE (190, FLAG(UPSTREAM)),
  147. GST_EVENT_SEEK = GST_EVENT_MAKE_TYPE (200, FLAG(UPSTREAM)),
  148. GST_EVENT_NAVIGATION = GST_EVENT_MAKE_TYPE (210, FLAG(UPSTREAM)),
  149. GST_EVENT_LATENCY = GST_EVENT_MAKE_TYPE (220, FLAG(UPSTREAM)),
  150. GST_EVENT_STEP = GST_EVENT_MAKE_TYPE (230, FLAG(UPSTREAM)),
  151. GST_EVENT_RECONFIGURE = GST_EVENT_MAKE_TYPE (240, FLAG(UPSTREAM)),
  152. GST_EVENT_TOC_SELECT = GST_EVENT_MAKE_TYPE (250, FLAG(UPSTREAM)),
  153. /* custom events start here */
  154. GST_EVENT_CUSTOM_UPSTREAM = GST_EVENT_MAKE_TYPE (270, FLAG(UPSTREAM)),
  155. GST_EVENT_CUSTOM_DOWNSTREAM = GST_EVENT_MAKE_TYPE (280, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
  156. GST_EVENT_CUSTOM_DOWNSTREAM_OOB = GST_EVENT_MAKE_TYPE (290, FLAG(DOWNSTREAM)),
  157. GST_EVENT_CUSTOM_DOWNSTREAM_STICKY = GST_EVENT_MAKE_TYPE (300, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
  158. GST_EVENT_CUSTOM_BOTH = GST_EVENT_MAKE_TYPE (310, FLAG(BOTH) | FLAG(SERIALIZED)),
  159. GST_EVENT_CUSTOM_BOTH_OOB = GST_EVENT_MAKE_TYPE (320, FLAG(BOTH))
  160. } GstEventType;
  161. #undef FLAG
  162. #include <gst/gstminiobject.h>
  163. #include <gst/gstformat.h>
  164. #include <gst/gstobject.h>
  165. #include <gst/gstclock.h>
  166. #include <gst/gststructure.h>
  167. #include <gst/gsttaglist.h>
  168. #include <gst/gstsegment.h>
  169. #include <gst/gstmessage.h>
  170. #include <gst/gstcontext.h>
  171. G_BEGIN_DECLS
  172. GST_EXPORT GType _gst_event_type;
  173. #define GST_TYPE_EVENT (_gst_event_type)
  174. #define GST_IS_EVENT(obj) (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_EVENT))
  175. #define GST_EVENT_CAST(obj) ((GstEvent *)(obj))
  176. #define GST_EVENT(obj) (GST_EVENT_CAST(obj))
  177. /**
  178. * GST_EVENT_TYPE:
  179. * @event: the event to query
  180. *
  181. * Get the #GstEventType of the event.
  182. */
  183. #define GST_EVENT_TYPE(event) (GST_EVENT_CAST(event)->type)
  184. /**
  185. * GST_EVENT_TYPE_NAME:
  186. * @event: the event to query
  187. *
  188. * Get a constant string representation of the #GstEventType of the event.
  189. */
  190. #define GST_EVENT_TYPE_NAME(event) (gst_event_type_get_name(GST_EVENT_TYPE(event)))
  191. /**
  192. * GST_EVENT_TIMESTAMP:
  193. * @event: the event to query
  194. *
  195. * Get the #GstClockTime timestamp of the event. This is the time when the event
  196. * was created.
  197. */
  198. #define GST_EVENT_TIMESTAMP(event) (GST_EVENT_CAST(event)->timestamp)
  199. /**
  200. * GST_EVENT_SEQNUM:
  201. * @event: the event to query
  202. *
  203. * The sequence number of @event.
  204. */
  205. #define GST_EVENT_SEQNUM(event) (GST_EVENT_CAST(event)->seqnum)
  206. /**
  207. * GST_EVENT_IS_UPSTREAM:
  208. * @ev: the event to query
  209. *
  210. * Check if an event can travel upstream.
  211. */
  212. #define GST_EVENT_IS_UPSTREAM(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_UPSTREAM)
  213. /**
  214. * GST_EVENT_IS_DOWNSTREAM:
  215. * @ev: the event to query
  216. *
  217. * Check if an event can travel downstream.
  218. */
  219. #define GST_EVENT_IS_DOWNSTREAM(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_DOWNSTREAM)
  220. /**
  221. * GST_EVENT_IS_SERIALIZED:
  222. * @ev: the event to query
  223. *
  224. * Check if an event is serialized with the data stream.
  225. */
  226. #define GST_EVENT_IS_SERIALIZED(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_SERIALIZED)
  227. /**
  228. * GST_EVENT_IS_STICKY:
  229. * @ev: the event to query
  230. *
  231. * Check if an event is sticky on the pads.
  232. */
  233. #define GST_EVENT_IS_STICKY(ev) !!(GST_EVENT_TYPE (ev) & GST_EVENT_TYPE_STICKY)
  234. /**
  235. * gst_event_is_writable:
  236. * @ev: a #GstEvent
  237. *
  238. * Tests if you can safely write data into a event's structure or validly
  239. * modify the seqnum and timestamp field.
  240. */
  241. #define gst_event_is_writable(ev) gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (ev))
  242. /**
  243. * gst_event_make_writable:
  244. * @ev: (transfer full): a #GstEvent
  245. *
  246. * Makes a writable event from the given event. If the source event is
  247. * already writable, this will simply return the same event. A copy will
  248. * otherwise be made using gst_event_copy().
  249. *
  250. * Returns: (transfer full): a writable event which may or may not be the
  251. * same as @ev
  252. */
  253. #define gst_event_make_writable(ev) GST_EVENT_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (ev)))
  254. /**
  255. * gst_event_replace:
  256. * @old_event: (inout) (transfer full) (nullable): pointer to a
  257. * pointer to a #GstEvent to be replaced.
  258. * @new_event: (allow-none) (transfer none): pointer to a #GstEvent that will
  259. * replace the event pointed to by @old_event.
  260. *
  261. * Modifies a pointer to a #GstEvent to point to a different #GstEvent. The
  262. * modification is done atomically (so this is useful for ensuring thread safety
  263. * in some cases), and the reference counts are updated appropriately (the old
  264. * event is unreffed, the new one is reffed).
  265. *
  266. * Either @new_event or the #GstEvent pointed to by @old_event may be %NULL.
  267. *
  268. * Returns: %TRUE if @new_event was different from @old_event
  269. */
  270. static inline gboolean
  271. gst_event_replace (GstEvent **old_event, GstEvent *new_event)
  272. {
  273. return gst_mini_object_replace ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
  274. }
  275. /**
  276. * gst_event_steal:
  277. * @old_event: (inout) (transfer full) (nullable): pointer to a
  278. * pointer to a #GstEvent to be stolen.
  279. *
  280. * Atomically replace the #GstEvent pointed to by @old_event with %NULL and
  281. * return the original event.
  282. *
  283. * Returns: the #GstEvent that was in @old_event
  284. */
  285. static inline GstEvent *
  286. gst_event_steal (GstEvent **old_event)
  287. {
  288. return GST_EVENT_CAST (gst_mini_object_steal ((GstMiniObject **) old_event));
  289. }
  290. /**
  291. * gst_event_take:
  292. * @old_event: (inout) (transfer full) (nullable): pointer to a
  293. * pointer to a #GstEvent to be stolen.
  294. * @new_event: (allow-none) (transfer full): pointer to a #GstEvent that will
  295. * replace the event pointed to by @old_event.
  296. *
  297. * Modifies a pointer to a #GstEvent to point to a different #GstEvent. This
  298. * function is similar to gst_event_replace() except that it takes ownership of
  299. * @new_event.
  300. *
  301. * Either @new_event or the #GstEvent pointed to by @old_event may be %NULL.
  302. *
  303. * Returns: %TRUE if @new_event was different from @old_event
  304. */
  305. static inline gboolean
  306. gst_event_take (GstEvent **old_event, GstEvent *new_event)
  307. {
  308. return gst_mini_object_take ((GstMiniObject **) old_event, (GstMiniObject *) new_event);
  309. }
  310. /**
  311. * GstQOSType:
  312. * @GST_QOS_TYPE_OVERFLOW: The QoS event type that is produced when upstream
  313. * elements are producing data too quickly and the element can't keep up
  314. * processing the data. Upstream should reduce their production rate. This
  315. * type is also used when buffers arrive early or in time.
  316. * @GST_QOS_TYPE_UNDERFLOW: The QoS event type that is produced when upstream
  317. * elements are producing data too slowly and need to speed up their
  318. * production rate.
  319. * @GST_QOS_TYPE_THROTTLE: The QoS event type that is produced when the
  320. * application enabled throttling to limit the data rate.
  321. *
  322. * The different types of QoS events that can be given to the
  323. * gst_event_new_qos() method.
  324. */
  325. typedef enum {
  326. GST_QOS_TYPE_OVERFLOW = 0,
  327. GST_QOS_TYPE_UNDERFLOW = 1,
  328. GST_QOS_TYPE_THROTTLE = 2
  329. } GstQOSType;
  330. /**
  331. * GstStreamFlags:
  332. * @GST_STREAM_FLAG_NONE: This stream has no special attributes
  333. * @GST_STREAM_FLAG_SPARSE: This stream is a sparse stream (e.g. a subtitle
  334. * stream), data may flow only in irregular intervals with large gaps in
  335. * between.
  336. * @GST_STREAM_FLAG_SELECT: This stream should be selected by default. This
  337. * flag may be used by demuxers to signal that a stream should be selected
  338. * by default in a playback scenario.
  339. * @GST_STREAM_FLAG_UNSELECT: This stream should not be selected by default.
  340. * This flag may be used by demuxers to signal that a stream should not
  341. * be selected by default in a playback scenario, but only if explicitly
  342. * selected by the user (e.g. an audio track for the hard of hearing or
  343. * a director's commentary track).
  344. *
  345. * Since: 1.2
  346. */
  347. typedef enum {
  348. GST_STREAM_FLAG_NONE,
  349. GST_STREAM_FLAG_SPARSE = (1 << 0),
  350. GST_STREAM_FLAG_SELECT = (1 << 1),
  351. GST_STREAM_FLAG_UNSELECT = (1 << 2)
  352. } GstStreamFlags;
  353. /**
  354. * GstEvent:
  355. * @mini_object: the parent structure
  356. * @type: the #GstEventType of the event
  357. * @timestamp: the timestamp of the event
  358. * @seqnum: the sequence number of the event
  359. *
  360. * A #GstEvent.
  361. */
  362. struct _GstEvent {
  363. GstMiniObject mini_object;
  364. /*< public >*/ /* with COW */
  365. GstEventType type;
  366. guint64 timestamp;
  367. guint32 seqnum;
  368. };
  369. const gchar* gst_event_type_get_name (GstEventType type);
  370. GQuark gst_event_type_to_quark (GstEventType type);
  371. GstEventTypeFlags
  372. gst_event_type_get_flags (GstEventType type);
  373. /* refcounting */
  374. /**
  375. * gst_event_ref:
  376. * @event: The event to refcount
  377. *
  378. * Increase the refcount of this event.
  379. *
  380. * Returns: (transfer full): @event (for convenience when doing assignments)
  381. */
  382. static inline GstEvent *
  383. gst_event_ref (GstEvent * event)
  384. {
  385. return (GstEvent *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (event));
  386. }
  387. /**
  388. * gst_event_unref:
  389. * @event: (transfer full): the event to refcount
  390. *
  391. * Decrease the refcount of an event, freeing it if the refcount reaches 0.
  392. */
  393. static inline void
  394. gst_event_unref (GstEvent * event)
  395. {
  396. gst_mini_object_unref (GST_MINI_OBJECT_CAST (event));
  397. }
  398. /* copy event */
  399. /**
  400. * gst_event_copy:
  401. * @event: The event to copy
  402. *
  403. * Copy the event using the event specific copy function.
  404. *
  405. * Returns: (transfer full): the new event
  406. */
  407. static inline GstEvent *
  408. gst_event_copy (const GstEvent * event)
  409. {
  410. return GST_EVENT_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (event)));
  411. }
  412. GType gst_event_get_type (void);
  413. /* custom event */
  414. GstEvent* gst_event_new_custom (GstEventType type, GstStructure *structure) G_GNUC_MALLOC;
  415. const GstStructure *
  416. gst_event_get_structure (GstEvent *event);
  417. GstStructure * gst_event_writable_structure (GstEvent *event);
  418. gboolean gst_event_has_name (GstEvent *event, const gchar *name);
  419. /* identifiers for events and messages */
  420. guint32 gst_event_get_seqnum (GstEvent *event);
  421. void gst_event_set_seqnum (GstEvent *event, guint32 seqnum);
  422. /* accumulated pad offsets for the event */
  423. gint64 gst_event_get_running_time_offset (GstEvent *event);
  424. void gst_event_set_running_time_offset (GstEvent *event, gint64 offset);
  425. /* Stream start event */
  426. GstEvent * gst_event_new_stream_start (const gchar *stream_id) G_GNUC_MALLOC;
  427. void gst_event_parse_stream_start (GstEvent *event, const gchar **stream_id);
  428. void gst_event_set_stream_flags (GstEvent *event, GstStreamFlags flags);
  429. void gst_event_parse_stream_flags (GstEvent *event, GstStreamFlags *flags);
  430. void gst_event_set_group_id (GstEvent *event, guint group_id);
  431. gboolean gst_event_parse_group_id (GstEvent *event, guint *group_id);
  432. /* flush events */
  433. GstEvent * gst_event_new_flush_start (void) G_GNUC_MALLOC;
  434. GstEvent * gst_event_new_flush_stop (gboolean reset_time) G_GNUC_MALLOC;
  435. void gst_event_parse_flush_stop (GstEvent *event, gboolean *reset_time);
  436. /* EOS event */
  437. GstEvent * gst_event_new_eos (void) G_GNUC_MALLOC;
  438. /* GAP event */
  439. GstEvent * gst_event_new_gap (GstClockTime timestamp,
  440. GstClockTime duration) G_GNUC_MALLOC;
  441. void gst_event_parse_gap (GstEvent * event,
  442. GstClockTime * timestamp,
  443. GstClockTime * duration);
  444. /* Caps events */
  445. GstEvent * gst_event_new_caps (GstCaps *caps) G_GNUC_MALLOC;
  446. void gst_event_parse_caps (GstEvent *event, GstCaps **caps);
  447. /* segment event */
  448. GstEvent* gst_event_new_segment (const GstSegment *segment) G_GNUC_MALLOC;
  449. void gst_event_parse_segment (GstEvent *event, const GstSegment **segment);
  450. void gst_event_copy_segment (GstEvent *event, GstSegment *segment);
  451. /* tag event */
  452. GstEvent* gst_event_new_tag (GstTagList *taglist) G_GNUC_MALLOC;
  453. void gst_event_parse_tag (GstEvent *event, GstTagList **taglist);
  454. /* TOC event */
  455. GstEvent* gst_event_new_toc (GstToc *toc, gboolean updated);
  456. void gst_event_parse_toc (GstEvent *event, GstToc **toc, gboolean *updated);
  457. /* Protection event */
  458. GstEvent * gst_event_new_protection (const gchar * system_id, GstBuffer * data, const gchar * origin);
  459. void gst_event_parse_protection (GstEvent * event, const gchar ** system_id,
  460. GstBuffer ** data, const gchar ** origin);
  461. /* buffer */
  462. GstEvent * gst_event_new_buffer_size (GstFormat format, gint64 minsize, gint64 maxsize,
  463. gboolean async) G_GNUC_MALLOC;
  464. void gst_event_parse_buffer_size (GstEvent *event, GstFormat *format, gint64 *minsize,
  465. gint64 *maxsize, gboolean *async);
  466. /* sink message */
  467. GstEvent* gst_event_new_sink_message (const gchar *name, GstMessage *msg) G_GNUC_MALLOC;
  468. void gst_event_parse_sink_message (GstEvent *event, GstMessage **msg);
  469. /* QOS events */
  470. GstEvent* gst_event_new_qos (GstQOSType type, gdouble proportion,
  471. GstClockTimeDiff diff, GstClockTime timestamp) G_GNUC_MALLOC;
  472. void gst_event_parse_qos (GstEvent *event, GstQOSType *type,
  473. gdouble *proportion, GstClockTimeDiff *diff,
  474. GstClockTime *timestamp);
  475. /* seek event */
  476. GstEvent* gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags,
  477. GstSeekType start_type, gint64 start,
  478. GstSeekType stop_type, gint64 stop) G_GNUC_MALLOC;
  479. void gst_event_parse_seek (GstEvent *event, gdouble *rate, GstFormat *format,
  480. GstSeekFlags *flags,
  481. GstSeekType *start_type, gint64 *start,
  482. GstSeekType *stop_type, gint64 *stop);
  483. /* navigation event */
  484. GstEvent* gst_event_new_navigation (GstStructure *structure) G_GNUC_MALLOC;
  485. /* latency event */
  486. GstEvent* gst_event_new_latency (GstClockTime latency) G_GNUC_MALLOC;
  487. void gst_event_parse_latency (GstEvent *event, GstClockTime *latency);
  488. /* step event */
  489. GstEvent* gst_event_new_step (GstFormat format, guint64 amount, gdouble rate,
  490. gboolean flush, gboolean intermediate) G_GNUC_MALLOC;
  491. void gst_event_parse_step (GstEvent *event, GstFormat *format, guint64 *amount,
  492. gdouble *rate, gboolean *flush, gboolean *intermediate);
  493. /* renegotiate event */
  494. GstEvent* gst_event_new_reconfigure (void) G_GNUC_MALLOC;
  495. /* TOC select event */
  496. GstEvent* gst_event_new_toc_select (const gchar *uid) G_GNUC_MALLOC;
  497. void gst_event_parse_toc_select (GstEvent *event, gchar **uid);
  498. /* segment-done event */
  499. GstEvent* gst_event_new_segment_done (GstFormat format, gint64 position) G_GNUC_MALLOC;
  500. void gst_event_parse_segment_done (GstEvent *event, GstFormat *format, gint64 *position);
  501. #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
  502. G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEvent, gst_event_unref)
  503. #endif
  504. G_END_DECLS
  505. #endif /* __GST_EVENT_H__ */