Debian Codegraph @

gstreamer/gstreamermm/event.h

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2 #ifndef _GSTREAMERMM_EVENT_H
3 #define _GSTREAMERMM_EVENT_H
4
5
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8
9 /* gstreamermm - a C++ wrapper for gstreamer
10 *
11 * Copyright 2008-2016 The gstreamermm Development Team
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28 #include <gst/gst.h>
29 #include <gstreamermm/miniobject.h>
30 #include <gstreamermm/format.h>
31 #include <gstreamermm/clock.h>
32 #include <gstreamermm/segment.h>
33 #include <gstreamermm/caps.h>
34
35
36 namespace Glib
37 {
38 template<typename T>
39 Glib::RefPtr<T> wrap_event_derived(GstEvent* object, bool take_copy)
40 {
41 if(take_copy && object)
42 gst_event_ref(object);
43
44 // See the comment at the top of this file, if you want to know why the cast works.
45 return Glib::RefPtr<T>(reinterpret_cast<T*>(object));
46 }
47
48 }
49
50 namespace Gst
51 {
52
53 #define GST_EVENT_MAKE_TYPE(num,flags) \
54 (((num) << GST_EVENT_NUM_SHIFT) | (flags))
55
56 #define FLAG(name) GST_EVENT_TYPE_##name
57
58 /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */
59
60 /**
61 * @var EventType EVENT_UNKNOWN
62 * Unknown event.
63 *
64 * @var EventType EVENT_FLUSH_START
65 * Start a flush operation. This event clears all data
66 * from the pipeline and unblock all streaming threads.
67 *
68 * @var EventType EVENT_FLUSH_STOP
69 * Stop a flush operation. This event resets the
70 * running-time of the pipeline.
71 *
72 * @var EventType EVENT_STREAM_START
73 * 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 *
77 * @var EventType EVENT_CAPS
78 * Gst::Caps event. Notify the pad of a new media type.
79 *
80 * @var EventType EVENT_SEGMENT
81 * A new media segment follows in the dataflow. The
82 * segment events contains information for clipping buffers and
83 * converting buffer timestamps to running-time and
84 * stream-time.
85 *
86 * @var EventType EVENT_TAG
87 * A new set of metadata tags has been found in the stream.
88 *
89 * @var EventType EVENT_BUFFERSIZE
90 * Notification of buffering requirements. Currently not
91 * used yet.
92 *
93 * @var EventType EVENT_SINK_MESSAGE
94 * An event that sinks turn into a message. Used to
95 * send messages that should be emitted in sync with
96 * rendering.
97 *
98 * @var EventType EVENT_EOS
99 * End-Of-Stream. No more data is to be expected to follow
100 * without a SEGMENT event.
101 *
102 * @var EventType EVENT_SEGMENT_DONE
103 * Marks the end of a segment playback.
104 *
105 * @var EventType EVENT_GAP
106 * Marks a gap in the datastream.
107 *
108 * @var EventType EVENT_TOC
109 * An event which indicates that a new table of contents (TOC)
110 * was found or updated.
111 *
112 * @var EventType EVENT_PROTECTION
113 * An event which indicates that new or updated
114 * encryption information has been found in the stream.
115 *
116 * @var EventType EVENT_QOS
117 * A quality message. Used to indicate to upstream elements
118 * that the downstream elements should adjust their processing
119 * rate.
120 *
121 * @var EventType EVENT_SEEK
122 * A request for a new playback position and rate.
123 *
124 * @var EventType EVENT_NAVIGATION
125 * Navigation events are usually used for communicating
126 * user requests, such as mouse or keyboard movements,
127 * to upstream elements.
128 *
129 * @var EventType EVENT_LATENCY
130 * Notification of new latency adjustment. Sinks will use
131 * the latency information to adjust their synchronisation.
132 *
133 * @var EventType EVENT_STEP
134 * A request for stepping through the media. Sinks will usually
135 * execute the step operation.
136 *
137 * @var EventType EVENT_RECONFIGURE
138 * A request for upstream renegotiating caps and reconfiguring.
139 *
140 * @var EventType EVENT_TOC_SELECT
141 * A request for a new playback position based on TOC
142 * entry's UID.
143 *
144 * @var EventType EVENT_CUSTOM_UPSTREAM
145 * Upstream custom event.
146 *
147 * @var EventType EVENT_CUSTOM_DOWNSTREAM
148 * Downstream custom event that travels in the
149 * data flow.
150 *
151 * @var EventType EVENT_CUSTOM_DOWNSTREAM_OOB
152 * Custom out-of-band downstream event.
153 *
154 * @var EventType EVENT_CUSTOM_DOWNSTREAM_STICKY
155 * Custom sticky downstream event.
156 *
157 * @var EventType EVENT_CUSTOM_BOTH
158 * Custom upstream or downstream event.
159 * In-band when travelling downstream.
160 *
161 * @var EventType EVENT_CUSTOM_BOTH_OOB
162 * Custom upstream or downstream out-of-band event.
163 *
164 * @enum EventType
165 *
166 * Gst::EventType lists the standard event types that can be sent in a pipeline.
167 *
168 * The custom event types can be used for private messages between elements
169 * that can't be expressed using normal
170 * GStreamer buffer passing semantics. Custom events carry an arbitrary
171 * Gst::Structure.
172 * Specific custom events are distinguished by the name of the structure.
173 *
174 * @ingroup gstreamermmEnums
175 * @par Bitwise operators:
176 * <tt>%EventType operator|(EventType, EventType)</tt><br>
177 * <tt>%EventType operator&(EventType, EventType)</tt><br>
178 * <tt>%EventType operator^(EventType, EventType)</tt><br>
179 * <tt>%EventType operator~(EventType)</tt><br>
180 * <tt>%EventType& operator|=(EventType&, EventType)</tt><br>
181 * <tt>%EventType& operator&=(EventType&, EventType)</tt><br>
182 * <tt>%EventType& operator^=(EventType&, EventType)</tt><br>
183 */
184 enum EventType
185 {
186 EVENT_UNKNOWN = GST_EVENT_MAKE_TYPE (0, 0),
187 EVENT_FLUSH_START = GST_EVENT_MAKE_TYPE (10, FLAG(BOTH)),
188 EVENT_FLUSH_STOP = GST_EVENT_MAKE_TYPE (20, FLAG(BOTH) | FLAG(SERIALIZED)),
189 EVENT_STREAM_START = GST_EVENT_MAKE_TYPE (40, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
190 EVENT_CAPS = GST_EVENT_MAKE_TYPE (50, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
191 EVENT_SEGMENT = GST_EVENT_MAKE_TYPE (70, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
192 EVENT_TAG = GST_EVENT_MAKE_TYPE (80, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
193 EVENT_BUFFERSIZE = GST_EVENT_MAKE_TYPE (90, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
194 EVENT_SINK_MESSAGE = GST_EVENT_MAKE_TYPE (100, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
195 EVENT_EOS = GST_EVENT_MAKE_TYPE (110, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY)),
196 EVENT_TOC = GST_EVENT_MAKE_TYPE (120, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
197 EVENT_PROTECTION = GST_EVENT_MAKE_TYPE (130, FLAG (DOWNSTREAM) | FLAG (SERIALIZED) | FLAG (STICKY) | FLAG (STICKY_MULTI)),
198 EVENT_SEGMENT_DONE = GST_EVENT_MAKE_TYPE (150, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
199 EVENT_GAP = GST_EVENT_MAKE_TYPE (160, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
200 EVENT_QOS = GST_EVENT_MAKE_TYPE (190, FLAG(UPSTREAM)),
201 EVENT_SEEK = GST_EVENT_MAKE_TYPE (200, FLAG(UPSTREAM)),
202 EVENT_NAVIGATION = GST_EVENT_MAKE_TYPE (210, FLAG(UPSTREAM)),
203 EVENT_LATENCY = GST_EVENT_MAKE_TYPE (220, FLAG(UPSTREAM)),
204 EVENT_STEP = GST_EVENT_MAKE_TYPE (230, FLAG(UPSTREAM)),
205 EVENT_RECONFIGURE = GST_EVENT_MAKE_TYPE (240, FLAG(UPSTREAM)),
206 EVENT_TOC_SELECT = GST_EVENT_MAKE_TYPE (250, FLAG(UPSTREAM)),
207 EVENT_CUSTOM_UPSTREAM = GST_EVENT_MAKE_TYPE (270, FLAG(UPSTREAM)),
208 EVENT_CUSTOM_DOWNSTREAM = GST_EVENT_MAKE_TYPE (280, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
209 EVENT_CUSTOM_DOWNSTREAM_OOB = GST_EVENT_MAKE_TYPE (290, FLAG(DOWNSTREAM)),
210 EVENT_CUSTOM_DOWNSTREAM_STICKY = GST_EVENT_MAKE_TYPE (300, FLAG(DOWNSTREAM) | FLAG(SERIALIZED) | FLAG(STICKY) | FLAG(STICKY_MULTI)),
211 EVENT_CUSTOM_BOTH = GST_EVENT_MAKE_TYPE (310, FLAG(BOTH) | FLAG(SERIALIZED)),
212 EVENT_CUSTOM_BOTH_OOB = GST_EVENT_MAKE_TYPE (320, FLAG(BOTH))
213 };
214
215 /** @ingroup gstreamermmEnums */
216 inline EventType operator|(EventType lhs, EventType rhs)
217 { return static_cast<EventType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
218
219 /** @ingroup gstreamermmEnums */
220 inline EventType operator&(EventType lhs, EventType rhs)
221 { return static_cast<EventType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
222
223 /** @ingroup gstreamermmEnums */
224 inline EventType operator^(EventType lhs, EventType rhs)
225 { return static_cast<EventType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
226
227 /** @ingroup gstreamermmEnums */
228 inline EventType operator~(EventType flags)
229 { return static_cast<EventType>(~static_cast<unsigned>(flags)); }
230
231 /** @ingroup gstreamermmEnums */
232 inline EventType& operator|=(EventType& lhs, EventType rhs)
233 { return (lhs = static_cast<EventType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
234
235 /** @ingroup gstreamermmEnums */
236 inline EventType& operator&=(EventType& lhs, EventType rhs)
237 { return (lhs = static_cast<EventType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
238
239 /** @ingroup gstreamermmEnums */
240 inline EventType& operator^=(EventType& lhs, EventType rhs)
241 { return (lhs = static_cast<EventType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
242
243 } // namespace Gst
244
245 #ifndef DOXYGEN_SHOULD_SKIP_THIS
246 namespace Glib
247 {
248
249 template <>
250 class Value<Gst::EventType> : public Glib::Value_Flags<Gst::EventType>
251 {
252 public:
253 static GType value_type() G_GNUC_CONST;
254 };
255
256 } // namespace Glib
257 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
258
259 namespace Gst
260 {
261
262 /**
263 * @var EventTypeFlags EVENT_TYPE_UPSTREAM
264 * Set if the event can travel upstream.
265 *
266 * @var EventTypeFlags EVENT_TYPE_DOWNSTREAM
267 * Set if the event can travel downstream.
268 *
269 * @var EventTypeFlags EVENT_TYPE_SERIALIZED
270 * Set if the event should be serialized with data
271 * flow.
272 *
273 * @var EventTypeFlags EVENT_TYPE_STICKY
274 * Set if the event is sticky on the pads.
275 *
276 * @var EventTypeFlags EVENT_TYPE_STICKY_MULTI
277 * Multiple sticky events can be on a pad, each
278 * identified by the event name.
279 *
280 * @enum EventTypeFlags
281 *
282 * Gst::EventTypeFlags indicate the aspects of the different Gst::EventType
283 * values. You can get the type flags of a Gst::EventType with the
284 * Gst::Event::type_get_flags() function.
285 *
286 * @ingroup gstreamermmEnums
287 * @par Bitwise operators:
288 * <tt>%EventTypeFlags operator|(EventTypeFlags, EventTypeFlags)</tt><br>
289 * <tt>%EventTypeFlags operator&(EventTypeFlags, EventTypeFlags)</tt><br>
290 * <tt>%EventTypeFlags operator^(EventTypeFlags, EventTypeFlags)</tt><br>
291 * <tt>%EventTypeFlags operator~(EventTypeFlags)</tt><br>
292 * <tt>%EventTypeFlags& operator|=(EventTypeFlags&, EventTypeFlags)</tt><br>
293 * <tt>%EventTypeFlags& operator&=(EventTypeFlags&, EventTypeFlags)</tt><br>
294 * <tt>%EventTypeFlags& operator^=(EventTypeFlags&, EventTypeFlags)</tt><br>
295 */
296 enum EventTypeFlags
297 {
298 EVENT_TYPE_UPSTREAM = 1 << 0,
299 EVENT_TYPE_DOWNSTREAM = 1 << 1,
300 EVENT_TYPE_SERIALIZED = 1 << 2,
301 EVENT_TYPE_STICKY = 1 << 3,
302 EVENT_TYPE_STICKY_MULTI = 1 << 4
303 };
304
305 /** @ingroup gstreamermmEnums */
306 inline EventTypeFlags operator|(EventTypeFlags lhs, EventTypeFlags rhs)
307 { return static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
308
309 /** @ingroup gstreamermmEnums */
310 inline EventTypeFlags operator&(EventTypeFlags lhs, EventTypeFlags rhs)
311 { return static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
312
313 /** @ingroup gstreamermmEnums */
314 inline EventTypeFlags operator^(EventTypeFlags lhs, EventTypeFlags rhs)
315 { return static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
316
317 /** @ingroup gstreamermmEnums */
318 inline EventTypeFlags operator~(EventTypeFlags flags)
319 { return static_cast<EventTypeFlags>(~static_cast<unsigned>(flags)); }
320
321 /** @ingroup gstreamermmEnums */
322 inline EventTypeFlags& operator|=(EventTypeFlags& lhs, EventTypeFlags rhs)
323 { return (lhs = static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
324
325 /** @ingroup gstreamermmEnums */
326 inline EventTypeFlags& operator&=(EventTypeFlags& lhs, EventTypeFlags rhs)
327 { return (lhs = static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
328
329 /** @ingroup gstreamermmEnums */
330 inline EventTypeFlags& operator^=(EventTypeFlags& lhs, EventTypeFlags rhs)
331 { return (lhs = static_cast<EventTypeFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
332
333 } // namespace Gst
334
335 #ifndef DOXYGEN_SHOULD_SKIP_THIS
336 namespace Glib
337 {
338
339 template <>
340 class Value<Gst::EventTypeFlags> : public Glib::Value_Flags<Gst::EventTypeFlags>
341 {
342 public:
343 static GType value_type() G_GNUC_CONST;
344 };
345
346 } // namespace Glib
347 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
348
349 namespace Gst
350 {
351
352 /**
353 * @var QOSType QOS_TYPE_OVERFLOW
354 * The QoS event type that is produced when upstream
355 * elements are producing data too quickly and the element can't keep up
356 * processing the data. Upstream should reduce their production rate. This
357 * type is also used when buffers arrive early or in time.
358 *
359 * @var QOSType QOS_TYPE_UNDERFLOW
360 * The QoS event type that is produced when upstream
361 * elements are producing data too slowly and need to speed up their
362 * production rate.
363 *
364 * @var QOSType QOS_TYPE_THROTTLE
365 * The QoS event type that is produced when the
366 * application enabled throttling to limit the data rate.
367 *
368 * @enum QOSType
369 *
370 * The different types of QoS events that can be given to the
371 * Gst::Event::new_qos() method.
372 *
373 * @ingroup gstreamermmEnums
374 */
375 enum QOSType
376 {
377 QOS_TYPE_OVERFLOW,
378 QOS_TYPE_UNDERFLOW,
379 QOS_TYPE_THROTTLE
380 };
381
382 } // namespace Gst
383
384 #ifndef DOXYGEN_SHOULD_SKIP_THIS
385 namespace Glib
386 {
387
388 template <>
389 class Value<Gst::QOSType> : public Glib::Value_Enum<Gst::QOSType>
390 {
391 public:
392 static GType value_type() G_GNUC_CONST;
393 };
394
395 } // namespace Glib
396 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
397
398 namespace Gst
399 {
400
401 /**
402 * @var StreamFlags STREAM_FLAG_NONE
403 * This stream has no special attributes.
404 *
405 * @var StreamFlags STREAM_FLAG_SPARSE
406 * This stream is a sparse stream (e.g. a subtitle
407 * stream), data may flow only in irregular intervals with large gaps in
408 * between.
409 *
410 * @var StreamFlags STREAM_FLAG_SELECT
411 * This stream should be selected by default. This
412 * flag may be used by demuxers to signal that a stream should be selected
413 * by default in a playback scenario.
414 *
415 * @var StreamFlags STREAM_FLAG_UNSELECT
416 * This stream should not be selected by default.
417 * This flag may be used by demuxers to signal that a stream should not
418 * be selected by default in a playback scenario, but only if explicitly
419 * selected by the user (e.g. an audio track for the hard of hearing or
420 * a director's commentary track).
421 *
422 * @enum StreamFlags
423 *
424 * @ingroup gstreamermmEnums
425 * @par Bitwise operators:
426 * <tt>%StreamFlags operator|(StreamFlags, StreamFlags)</tt><br>
427 * <tt>%StreamFlags operator&(StreamFlags, StreamFlags)</tt><br>
428 * <tt>%StreamFlags operator^(StreamFlags, StreamFlags)</tt><br>
429 * <tt>%StreamFlags operator~(StreamFlags)</tt><br>
430 * <tt>%StreamFlags& operator|=(StreamFlags&, StreamFlags)</tt><br>
431 * <tt>%StreamFlags& operator&=(StreamFlags&, StreamFlags)</tt><br>
432 * <tt>%StreamFlags& operator^=(StreamFlags&, StreamFlags)</tt><br>
433 */
434 enum StreamFlags
435 {
436 STREAM_FLAG_NONE = 0x0,
437 STREAM_FLAG_SPARSE = (1 << 0),
438 STREAM_FLAG_SELECT = (1 << 1),
439 STREAM_FLAG_UNSELECT = (1 << 2)
440 };
441
442 /** @ingroup gstreamermmEnums */
443 inline StreamFlags operator|(StreamFlags lhs, StreamFlags rhs)
444 { return static_cast<StreamFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
445
446 /** @ingroup gstreamermmEnums */
447 inline StreamFlags operator&(StreamFlags lhs, StreamFlags rhs)
448 { return static_cast<StreamFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
449
450 /** @ingroup gstreamermmEnums */
451 inline StreamFlags operator^(StreamFlags lhs, StreamFlags rhs)
452 { return static_cast<StreamFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
453
454 /** @ingroup gstreamermmEnums */
455 inline StreamFlags operator~(StreamFlags flags)
456 { return static_cast<StreamFlags>(~static_cast<unsigned>(flags)); }
457
458 /** @ingroup gstreamermmEnums */
459 inline StreamFlags& operator|=(StreamFlags& lhs, StreamFlags rhs)
460 { return (lhs = static_cast<StreamFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
461
462 /** @ingroup gstreamermmEnums */
463 inline StreamFlags& operator&=(StreamFlags& lhs, StreamFlags rhs)
464 { return (lhs = static_cast<StreamFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
465
466 /** @ingroup gstreamermmEnums */
467 inline StreamFlags& operator^=(StreamFlags& lhs, StreamFlags rhs)
468 { return (lhs = static_cast<StreamFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
469
470 } // namespace Gst
471
472 #ifndef DOXYGEN_SHOULD_SKIP_THIS
473 namespace Glib
474 {
475
476 template <>
477 class Value<Gst::StreamFlags> : public Glib::Value_Flags<Gst::StreamFlags>
478 {
479 public:
480 static GType value_type() G_GNUC_CONST;
481 };
482
483 } // namespace Glib
484 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
485
486 namespace Gst
487 {
488
489
490 #undef FLAG
491
492 class Message;
493 class Structure;
494 class TagList;
495 class Buffer;
496 class Toc;
497
498 namespace Enums
499 {
500
501 /** Gets a printable name for the given event type.
502 *
503 * @param type The event type.
504 * @return A reference to the static name of the event.
505 */
506 Glib::ustring get_name(EventType type);
507
508 /** Gets the unique quark for the given event type.
509 *
510 * @param type The event type.
511 * @return The quark associated with the event type.
512 */
513 Glib::QueryQuark get_quark(EventType type);
514
515 /** Gets the Gst::EventTypeFlags associated with type.
516 * @param type A Gst::EventType.
517 * @return A Gst::EventTypeFlags.
518 */
519 EventTypeFlags get_flags(EventType type);
520
521 } //namespace Enums
522
523 /** A class that represents events that are passed up and down a pipeline.
524 * The event class provides factory methods to construct and functions query
525 * (parse) events.
526 *
527 * Events are usually created by using the Gst::Event derrived classes'
528 * create() methods. To send an event application will usually use
529 * Gst::Element::send_event() and elements will use Gst::Pad::send_event() or
530 * Gst::Pad::push_event().
531 *
532 * Events that have been received can be parsed with their respective parse()
533 * functions.
534 *
535 * Events are passed between elements in parallel to the data stream. Some
536 * events are serialized with buffers, others are not. Some events only travel
537 * downstream, others only upstream. Some events can travel both upstream and
538 * downstream.
539 *
540 * The events are used to signal special conditions in the datastream such as
541 * EOS (end of stream) or the start of a new stream-segment. Events are also
542 * used to flush the pipeline of any pending data.
543 *
544 * Most of the event API is used inside plugins. Applications usually only
545 * construct and use seek events. To do that Gst::EventSeek::create() is used
546 * to create a seek event. It takes the needed parameters to specity seeking
547 * time and mode. The event is then sent to the element like so:
548 * @code
549 * pipeline->send_event(event);
550 * @endcode
551 */
552 class Event : public MiniObject
553 {
554 public:
555 #ifndef DOXYGEN_SHOULD_SKIP_THIS
556 using CppObjectType = Event;
557 using BaseObjectType = GstEvent;
558 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
559
560
561 /** Increment the reference count for this object.
562 * You should never need to do this manually - use the object via a RefPtr instead.
563 */
564 void reference() const;
565
566 /** Decrement the reference count for this object.
567 * You should never need to do this manually - use the object via a RefPtr instead.
568 */
569 void unreference() const;
570
571 ///Provides access to the underlying C instance.
572 GstEvent* gobj();
573
574 ///Provides access to the underlying C instance.
575 const GstEvent* gobj() const;
576
577 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
578 GstEvent* gobj_copy() const;
579
580 Event() = delete;
581
582 // noncopyable
583 Event(const Event&) = delete;
584 Event& operator=(const Event&) = delete;
585
586 protected:
587 // Do not derive this. Gst::Event can neither be constructed nor deleted.
588
589 void operator delete(void*, std::size_t);
590
591 private:
592
593
594 public:
595 // A copy is taken so that the original is not freed by the wrapper.
596
597
598 /** Access the structure of the event.
599 *
600 * @return The structure of the event. The structure is still
601 * owned by the event, which means that you should not free it and
602 * that the pointer becomes invalid when you free the event.
603 *
604 * MT safe.
605 */
606 Gst::Structure get_structure() const;
607
608
609 /** Checks if @a event has the given @a name. This function is usually used to
610 * check the name of a custom event.
611 *
612 * @param name Name to check.
613 * @return <tt>true</tt> if @a name matches the name of the event structure.
614 */
615 bool has_name(const Glib::ustring& name) const;
616
617
618 /** Retrieve the sequence number of a event.
619 *
620 * Events have ever-incrementing sequence numbers, which may also be set
621 * explicitly via set_seqnum(). Sequence numbers are typically used to
622 * indicate that a event corresponds to some other set of events or messages,
623 * for example an EOS event corresponding to a SEEK event. It is considered good
624 * practice to make this correspondence when possible, though it is not
625 * required.
626 *
627 * Note that events and messages share the same sequence number incrementor;
628 * two events or messages will never have the same sequence number unless
629 * that correspondence was made explicitly.
630 *
631 * @return The event's sequence number.
632 *
633 * MT safe.
634 */
635 guint32 get_seqnum() const;
636
637 /** Set the sequence number of a event.
638 *
639 * This function might be called by the creator of a event to indicate that the
640 * event relates to other events or messages. See get_seqnum() for
641 * more information.
642 *
643 * MT safe.
644 *
645 * @param seqnum A sequence number.
646 */
647 void set_seqnum(guint32 seqnum);
648
649
650 /** Retrieve the accumulated running time offset of the event.
651 *
652 * Events passing through Gst::Pads that have a running time
653 * offset set via Gst::Pad::set_offset() will get their offset
654 * adjusted according to the pad's offset.
655 *
656 * If the event contains any information that related to the
657 * running time, this information will need to be updated
658 * before usage with this offset.
659 *
660 * @return The event's running time offset
661 *
662 * MT safe.
663 */
664 gint64 get_running_time_offset() const;
665
666 /** Set the running time offset of a event. See
667 * get_running_time_offset() for more information.
668 *
669 * MT safe.
670 *
671 * @param offset A the new running time offset.
672 */
673 void set_running_time_offset(gint64 offset);
674
675
676 /** Copy the event using the event specific copy function.
677 *
678 * @return The new event.
679 */
680 Glib::RefPtr<Gst::Event> copy() const;
681
682 /**
683 * Makes a writable event from the given event. If the source event is
684 * already writable, this will simply return the same event.
685 * @return A Gst::Event (possibly the same reference) that is writable.
686 */
687 Glib::RefPtr<Gst::Event> create_writable();
688
689 /** Check if an event can travel downstream.
690 */
691 bool is_downstream() const;
692
693 /** Check if an event is serialized with the data stream.
694 */
695 bool is_serialized() const;
696
697 /** Check if an event can travel upstream.
698 */
699 bool is_upstream() const;
700
701 /** Get the Gst::EventType of the event.
702 */
703 EventType get_event_type() const;
704
705 /** Get the Gst::ClockTime timestamp of the event. This is the time when the
706 * event was created.
707 */
708 Gst::ClockTime get_timestamp() const;
709
710
711 };
712
713 /** A flush start event. See create() for more details.
714 */
715 class EventFlushStart : public Event
716 {
717 public:
718 #ifndef DOXYGEN_SHOULD_SKIP_THIS
719 using CppObjectType = EventFlushStart;
720 using BaseObjectType = GstEvent;
721 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
722
723 private:
724
725 public:
726
727
728 /** Allocate a new flush start event. The flush start event can be sent
729 * upstream and downstream and travels out-of-bounds with the dataflow.
730 *
731 * It marks pads as being flushing and will make them return
732 * Gst::FLOW_FLUSHING when used for data flow with Gst::Pad::push(),
733 * Gst::Pad::chain(), Gst::Pad::get_range() and Gst::Pad::pull_range().
734 * Any event (except a Gst::EVENT_FLUSH_STOP) received
735 * on a flushing pad will return <tt>false</tt> immediately.
736 *
737 * Elements should unlock any blocking functions and exit their streaming
738 * functions as fast as possible when this event is received.
739 *
740 * This event is typically generated after a seek to flush out all queued data
741 * in the pipeline so that the new media is played as soon as possible.
742 *
743 * @return A new flush start event.
744 */
745 static Glib::RefPtr<Gst::EventFlushStart> create();
746
747
748 };
749
750 /** A flush stop event. See create() for more details.
751 */
752 class EventFlushStop : public Event
753 {
754 public:
755 #ifndef DOXYGEN_SHOULD_SKIP_THIS
756 using CppObjectType = EventFlushStop;
757 using BaseObjectType = GstEvent;
758 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
759
760 private:
761
762 public:
763
764
765 /** Allocate a new flush stop event. The flush stop event can be sent
766 * upstream and downstream and travels serialized with the dataflow.
767 * It is typically sent after sending a FLUSH_START event to make the
768 * pads accept data again.
769 *
770 * Elements can process this event synchronized with the dataflow since
771 * the preceding FLUSH_START event stopped the dataflow.
772 *
773 * This event is typically generated to complete a seek and to resume
774 * dataflow.
775 *
776 * @param reset_time If time should be reset.
777 * @return A new flush stop event.
778 */
779 static Glib::RefPtr<Gst::EventFlushStop> create(bool reset_time);
780
781 /** Retrieve a reset time member.
782 * @return TRUE, if time should be reset; FALSE, otherwise.
783 */
784 bool parse_reset_time() const;
785
786
787 };
788
789 /** A stream-start event. See create() for more details.
790 */
791 class EventStreamStart : public Event
792 {
793 public:
794 #ifndef DOXYGEN_SHOULD_SKIP_THIS
795 using CppObjectType = EventStreamStart;
796 using BaseObjectType = GstEvent;
797 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
798
799 private:
800
801 public:
802
803
804 /** Create a new STREAM_START event. The stream start event can only
805 * travel downstream synchronized with the buffer flow. It is expected
806 * to be the first event that is sent for a new stream.
807 *
808 * Source elements, demuxers and other elements that create new streams
809 * are supposed to send this event as the first event of a new stream. It
810 * should not be sent after a flushing seek or in similar situations
811 * and is used to mark the beginning of a new logical stream. Elements
812 * combining multiple streams must ensure that this event is only forwarded
813 * downstream once and not for every single input stream.
814 *
815 * The @a stream_id should be a unique string that consists of the upstream
816 * stream-id, / as separator and a unique stream-id for this specific
817 * stream. A new stream-id should only be created for a stream if the upstream
818 * stream is split into (potentially) multiple new streams, e.g. in a demuxer,
819 * but not for every single element in the pipeline.
820 * Gst::Pad::create_stream_id() or Gst::Pad::create_stream_id_printf() can be
821 * used to create a stream-id. There are no particular semantics for the
822 * stream-id, though it should be deterministic (to support stream matching)
823 * and it might be used to order streams (besides any information conveyed by
824 * stream flags).
825 *
826 * @param stream_id Identifier for this stream.
827 * @return The new STREAM_START event.
828 */
829 static Glib::RefPtr<Gst::EventStreamStart> create(const Glib::ustring& stream_id);
830
831 /** Parse a stream-id event.
832 *
833 * @return A stream id.
834 */
835 Glib::ustring parse_stream_id() const;
836
837
838 /** @param flags The stream flags to set.
839 */
840 void set_stream_flags(Gst::StreamFlags flags);
841
842 /** Parse a stream flag.
843 *
844 * @return A stream flags.
845 */
846 Gst::StreamFlags parse_stream_flags() const;
847
848
849 /** @param group_id Address of variable where to store the group id.
850 * @return <tt>true</tt> if a group id was set on the event and could be parsed,
851 * <tt>false</tt> otherwise.
852 */
853 bool parse_group_id(guint& group_id) const;
854
855 /** All streams that have the same group id are supposed to be played
856 * together, i.e.\ all streams inside a container file should have the
857 * same group id but different stream ids. The group id should change
858 * each time the stream is started, resulting in different group ids
859 * each time a file is played for example.
860 *
861 * Use gst_util_group_id_next() to get a new group id.
862 *
863 * @param group_id The group id to set.
864 */
865 void set_group_id(guint group_id);
866
867
868 };
869
870 /** A caps event. See create() for more details.
871 */
872 class EventCaps : public Event
873 {
874 public:
875 #ifndef DOXYGEN_SHOULD_SKIP_THIS
876 using CppObjectType = EventCaps;
877 using BaseObjectType = GstEvent;
878 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
879
880 private:
881
882 public:
883
884
885 /** Create a new CAPS event for @a caps. The caps event can only travel downstream
886 * synchronized with the buffer flow and contains the format of the buffers
887 * that will follow after the event.
888 *
889 * @param caps A Gst::Caps.
890 * @return The new CAPS event.
891 */
892 static Glib::RefPtr<Gst::EventCaps> create(const Glib::RefPtr<Gst::Caps>& caps);
893
894 /** Get the caps from @a event. The caps remains valid as long as @a event remains
895 * valid.
896 *
897 * @return A caps object.
898 */
899 Glib::RefPtr<Gst::Caps> parse_caps();
900
901
902 /** Get the caps from @a event. The caps remains valid as long as @a event remains
903 * valid.
904 *
905 * @return A caps object.
906 */
907 Glib::RefPtr<const Gst::Caps> parse_caps() const;
908
909
910 };
911
912 /** A segment event. See create() for more details.
913 */
914 class EventSegment : public Event
915 {
916 public:
917 #ifndef DOXYGEN_SHOULD_SKIP_THIS
918 using CppObjectType = EventSegment;
919 using BaseObjectType = GstEvent;
920 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
921
922 private:
923
924 public:
925
926
927 /** Create a new SEGMENT event for @a segment. The segment event can only travel
928 * downstream synchronized with the buffer flow and contains timing information
929 * and playback properties for the buffers that will follow.
930 *
931 * The segment event marks the range of buffers to be processed. All
932 * data not within the segment range is not to be processed. This can be
933 * used intelligently by plugins to apply more efficient methods of skipping
934 * unneeded data. The valid range is expressed with the @a start and @a stop
935 * values.
936 *
937 * The time value of the segment is used in conjunction with the start
938 * value to convert the buffer timestamps into the stream time. This is
939 * usually done in sinks to report the current stream_time.
940 * @a time represents the stream_time of a buffer carrying a timestamp of
941 * @a start. @a time cannot be -1.
942 *
943 * @a start cannot be -1, @a stop can be -1. If there
944 * is a valid @a stop given, it must be greater or equal the @a start, including
945 * when the indicated playback @a rate is < 0.
946 *
947 * The @a applied_rate value provides information about any rate adjustment that
948 * has already been made to the timestamps and content on the buffers of the
949 * stream. ( @a rate * @a applied_rate) should always equal the rate that has been
950 * requested for playback. For example, if an element has an input segment
951 * with intended playback @a rate of 2.0 and applied_rate of 1.0, it can adjust
952 * incoming timestamps and buffer content by half and output a segment event
953 * with @a rate of 1.0 and @a applied_rate of 2.0
954 *
955 * After a segment event, the buffer stream time is calculated with:
956 *
957 * time + (TIMESTAMP(buf) - start) * ABS (rate * applied_rate)
958 *
959 * @param segment A Gst::Segment.
960 * @return The new SEGMENT event.
961 */
962 static Glib::RefPtr<Gst::EventSegment> create(const Gst::Segment& segment);
963
964 /** Parses a segment event and copies the GstSegment.
965 *
966 * @return A copy of a Gst::Segment.
967 */
968 Gst::Segment copy_segment() const;
969
970
971 };
972
973 /** A tag event. See create() for more details.
974 */
975 class EventTag : public Event
976 {
977 public:
978 #ifndef DOXYGEN_SHOULD_SKIP_THIS
979 using CppObjectType = EventTag;
980 using BaseObjectType = GstEvent;
981 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
982
983 private:
984
985 public:
986
987
988 /** Generates a metadata tag event from the given @a taglist.
989 *
990 * The scope of the taglist specifies if the taglist applies to the
991 * complete medium or only to this specific stream. As the tag event
992 * is a sticky event, elements should merge tags received from
993 * upstream with a given scope with their own tags with the same
994 * scope and create a new tag event from it.
995 *
996 * @param taglist Metadata list. The event will take ownership
997 * of the taglist.
998 * @return A new Gst::Event.
999 */
1000 static Glib::RefPtr<Gst::EventTag> create(const Gst::TagList& taglist);
1001
1002 /** Gets a tag list.
1003 * @return A Gst::TagList.
1004 */
1005 Gst::TagList parse_tag_list() const;
1006
1007
1008 };
1009
1010 /** A buffer size event. See create() for more details.
1011 */
1012 class EventBufferSize : public Event
1013 {
1014 public:
1015 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1016 using CppObjectType = EventBufferSize;
1017 using BaseObjectType = GstEvent;
1018 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1019
1020 private:
1021
1022 public:
1023
1024
1025 /** Create a new buffersize event. The event is sent downstream and notifies
1026 * elements that they should provide a buffer of the specified dimensions.
1027 *
1028 * When the @a async flag is set, a thread boundary is preferred.
1029 *
1030 * @param format Buffer format.
1031 * @param minsize Minimum buffer size.
1032 * @param maxsize Maximum buffer size.
1033 * @param async Thread behavior.
1034 * @return A new Gst::Event.
1035 */
1036 static Glib::RefPtr<Gst::EventBufferSize> create(Format format, gint64 minsize, gint64 maxsize, bool async);
1037
1038 /** Get the format, minsize, maxsize and async-flag in the buffersize event.
1039 *
1040 * @param format A reference to store the format in.
1041 * @param minsize A reference to store the minsize in.
1042 * @param maxsize A reference to store the maxsize in.
1043 * @param async A reference to store the async-flag in.
1044 */
1045 void parse(Format& format, gint64& minsize, gint64& maxsize, bool& async) const;
1046
1047
1048 /** Get the minsize in the buffersize event.
1049 *
1050 * @return The mininum size.
1051 */
1052 gint64 parse_min_size() const;
1053
1054 /** Get the format, in the buffersize event.
1055 *
1056 * @return The format.
1057 */
1058 Gst::Format parse_format() const;
1059
1060 /** Get the maxsize in the buffersize event.
1061 *
1062 * @return The maximum size.
1063 */
1064 gint64 parse_max_size() const;
1065
1066 /** Get the async-flag in the buffersize event.
1067 *
1068 * @return The async flag.
1069 */
1070 bool parse_async() const;
1071
1072
1073 };
1074
1075 /** A sink-message event. See create() for more details.
1076 */
1077 class EventSinkMessage : public Event
1078 {
1079 public:
1080 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1081 using CppObjectType = EventSinkMessage;
1082 using BaseObjectType = GstEvent;
1083 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1084
1085 private:
1086
1087 public:
1088
1089
1090 /** Create a new sink-message event. The purpose of the sink-message event is
1091 * to instruct a sink to post the message contained in the event synchronized
1092 * with the stream.
1093 *
1094 * @a name is used to store multiple sticky events on one pad.
1095 *
1096 * @param name A name for the event.
1097 * @param message The Gst::Message to be posted.
1098 * @return A new Gst::Event.
1099 */
1100 static Glib::RefPtr<Gst::EventSinkMessage> create(const Glib::ustring& name, const Glib::RefPtr<Gst::Message>& message);
1101
1102 /** Parse the sink-message event.
1103 * @return the sink-messge's event message.
1104 */
1105 Glib::RefPtr<Gst::Message> parse_message();
1106
1107
1108 /** Parse the sink-message event.
1109 * @return the sink-messge's event message.
1110 */
1111 Glib::RefPtr<const Gst::Message> parse_message() const;
1112
1113
1114 };
1115
1116 /** An end of stream event. See create() for more details.
1117 */
1118 class EventEos : public Event
1119 {
1120 public:
1121 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1122 using CppObjectType = EventEos;
1123 using BaseObjectType = GstEvent;
1124 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1125
1126 private:
1127
1128 public:
1129
1130
1131 /** Create a new EOS event. The eos event can only travel downstream
1132 * synchronized with the buffer flow. Elements that receive the EOS
1133 * event on a pad can return Gst::FLOW_EOS as a Gst::FlowReturn
1134 * when data after the EOS event arrives.
1135 *
1136 * The EOS event will travel down to the sink elements in the pipeline
1137 * which will then post the Gst::MESSAGE_EOS on the bus after they have
1138 * finished playing any buffered data.
1139 *
1140 * When all sinks have posted an EOS message, an EOS message is
1141 * forwarded to the application.
1142 *
1143 * The EOS event itself will not cause any state transitions of the pipeline.
1144 *
1145 * @return The new EOS event.
1146 */
1147 static Glib::RefPtr<Gst::EventEos> create();
1148
1149
1150 };
1151
1152 /** A new table of content event. See create() for more details.
1153 */
1154 class EventToc : public Event
1155 {
1156 public:
1157 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1158 using CppObjectType = EventToc;
1159 using BaseObjectType = GstEvent;
1160 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1161
1162 private:
1163
1164 public:
1165
1166
1167 /** Generate a TOC event from the given @a toc. The purpose of the TOC event is to
1168 * inform elements that some kind of the TOC was found.
1169 *
1170 * @param toc Gst::Toc structure.
1171 * @param updated Whether @a toc was updated or not.
1172 * @return A new Gst::Event.
1173 */
1174 static Glib::RefPtr<Gst::EventToc> create(const Glib::RefPtr<Gst::Toc>& toc, bool updated);
1175
1176 /** Parse a TOC event and store the results in the given toc and updated locations.
1177 *
1178 * @param toc A Gst::Toc structure.
1179 * @param updated A TOC update flag.
1180 */
1181 void parse(Glib::RefPtr<Gst::Toc>& toc, bool& updated);
1182
1183
1184 /** Parse a TOC event and store the results in the given toc and updated locations.
1185 *
1186 * @param toc A Gst::Toc structure.
1187 * @param updated A TOC update flag.
1188 */
1189 void parse(Glib::RefPtr<const Gst::Toc>& toc, bool& updated) const;
1190
1191 /** Parse a Toc structure.
1192 *
1193 * @return A Gst::Toc structure.
1194 */
1195 Glib::RefPtr<Gst::Toc> parse_toc();
1196
1197 /** Parse a Toc structure.
1198 *
1199 * @return A Gst::Toc structure.
1200 */
1201 Glib::RefPtr<const Gst::Toc> parse_toc() const;
1202
1203 /** Parse a TOC update flag.
1204 *
1205 * @return A TOC update flag.
1206 */
1207 bool parse_updated() const;
1208
1209
1210 };
1211
1212 /** A protection event. See create() for more details.
1213 */
1214 class EventProtection : public Event
1215 {
1216 public:
1217 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1218 using CppObjectType = EventProtection;
1219 using BaseObjectType = GstEvent;
1220 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1221
1222 private:
1223
1224 public:
1225
1226
1227 /** Creates a new event containing information specific to a particular
1228 * protection system (uniquely identified by @a system_id), by which that
1229 * protection system can acquire key(s) to decrypt a protected stream.
1230 *
1231 * In order for a decryption element to decrypt media
1232 * protected using a specific system, it first needs all the
1233 * protection system specific information necessary to acquire the decryption
1234 * key(s) for that stream. The functions defined here enable this information
1235 * to be passed in events from elements that extract it
1236 * (e.g., ISOBMFF demuxers, MPEG DASH demuxers) to protection decrypter
1237 * elements that use it.
1238 *
1239 * Events containing protection system specific information are created using
1240 * #gst_event_new_protection, and they can be parsed by downstream elements
1241 * using #gst_event_parse_protection.
1242 *
1243 * In Common Encryption, protection system specific information may be located
1244 * within ISOBMFF files, both in movie (moov) boxes and movie fragment (moof)
1245 * boxes; it may also be contained in ContentProtection elements within MPEG
1246 * DASH MPDs. The events created by #gst_event_new_protection contain data
1247 * identifying from which of these locations the encapsulated protection system
1248 * specific information originated. This origin information is required as
1249 * some protection systems use different encodings depending upon where the
1250 * information originates.
1251 *
1252 * The events returned by new_protection() are implemented
1253 * in such a way as to ensure that the most recently-pushed protection info
1254 * event of a particular @a origin and @a system_id will
1255 * be stuck to the output pad of the sending element.
1256 *
1257 * @param system_id A string holding a UUID that uniquely
1258 * identifies a protection system.
1259 * @param data A Gst::Buffer holding protection system specific
1260 * information. The reference count of the buffer will be incremented by one.
1261 * @param origin A string indicating where the protection
1262 * information carried in the event was extracted from. The allowed values
1263 * of this string will depend upon the protection scheme.
1264 * @return A Gst::EVENT_PROTECTION event, if successful; <tt>nullptr</tt>
1265 * if unsuccessful.
1266 */
1267 static Glib::RefPtr<Gst::EventProtection> create(const Glib::ustring& system_id, const Glib::RefPtr<Gst::Buffer>& data, const Glib::ustring& origin);
1268
1269 /**
1270 * Parses an event containing protection system specific information and stores the results in system_id, data and origin.
1271 *
1272 * @param system_id Result location for the UUID string uniquely identifying a content protection system.
1273 * @param data Result location for the Gst::Buffer holding protection system specific information.
1274 * @param origin Result location for the value that indicates where the protection information carried by event was extracted from.
1275 */
1276 void parse(Glib::ustring& system_id, Glib::RefPtr<Gst::Buffer>& data, Glib::ustring& origin) const;
1277
1278
1279 /** Parse UUID of the protection event.
1280 * @return The UUID.
1281 */
1282 Glib::ustring parse_system_id() const;
1283
1284 /** Parse data of the protection event.
1285 * @return The data.
1286 */
1287 Glib::RefPtr<Gst::Buffer> parse_data();
1288
1289 /** Parse data of the protection event.
1290 * @return The data.
1291 */
1292 Glib::RefPtr<const Gst::Buffer> parse_data() const;
1293
1294 /** Parse origin of the protection event.
1295 * @return The origin.
1296 */
1297 Glib::ustring parse_origin() const;
1298
1299
1300 };
1301
1302 /** A segment done event. See create() for more details.
1303 */
1304 class EventSegmentDone : public Event
1305 {
1306 public:
1307 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1308 using CppObjectType = EventSegmentDone;
1309 using BaseObjectType = GstEvent;
1310 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1311
1312 private:
1313
1314 public:
1315
1316
1317 /** Create a new segment-done event. This event is sent by elements that
1318 * finish playback of a segment as a result of a segment seek.
1319 *
1320 * @param p1 The format of the position being done.
1321 * @param position The position of the segment being done.
1322 * @return A new Gst::Event.
1323 */
1324 static Glib::RefPtr<Gst::EventSegmentDone> create(Gst::Format p1, gint64 position);
1325
1326 /**
1327 * Extracts the position and format from the segment done event.
1328 *
1329 * @param format Result location for the format.
1330 * @param position Result location for the position.
1331 */
1332 void parse(Gst::Format& format, gint64& position) const;
1333
1334
1335 /** Parse format of the segment done event.
1336 * @return The format.
1337 */
1338 Gst::Format parse_format() const;
1339
1340 /** Parse position of the segment done event.
1341 * @return The position.
1342 */
1343 gint64 parse_position() const;
1344
1345
1346 };
1347
1348 /** A gap in the stream event. See create() for more details.
1349 */
1350 class EventGap : public Event
1351 {
1352 public:
1353 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1354 using CppObjectType = EventGap;
1355 using BaseObjectType = GstEvent;
1356 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1357
1358 private:
1359
1360 public:
1361
1362
1363 /** Create a new GAP event. A gap event can be thought of as conceptually
1364 * equivalent to a buffer to signal that there is no data for a certain
1365 * amount of time. This is useful to signal a gap to downstream elements
1366 * which may wait for data, such as muxers or mixers or overlays, especially
1367 * for sparse streams such as subtitle streams.
1368 *
1369 * @param timestamp The start time (pts) of the gap.
1370 * @param duration The duration of the gap.
1371 * @return The new GAP event.
1372 */
1373 static Glib::RefPtr<Gst::EventGap> create(Gst::ClockTime timestamp, Gst::ClockTime duration);
1374
1375 /**
1376 * Extract timestamp and duration from a new GAP event.
1377 *
1378 * @param timestamp Location where to store the start time (pts) of the gap.
1379 * @param duration Location where to store the duration of the gap.
1380 */
1381 void parse(Gst::ClockTime& timestamp, Gst::ClockTime& duration) const;
1382
1383
1384 /** Parse timestamp of the gap event.
1385 * @return The timestamp.
1386 */
1387 Gst::ClockTime parse_timestamp() const;
1388
1389 /** Parse duration of the gap event.
1390 * @return The duration.
1391 */
1392 Gst::ClockTime parse_duration() const;
1393
1394
1395 };
1396
1397 /** A QOS event. See create() for more details.
1398 */
1399 class EventQos : public Event
1400 {
1401 public:
1402 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1403 using CppObjectType = EventQos;
1404 using BaseObjectType = GstEvent;
1405 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1406
1407 private:
1408
1409 public:
1410
1411
1412 /** Allocate a new qos event with the given values.
1413 * The QOS event is generated in an element that wants an upstream
1414 * element to either reduce or increase its rate because of
1415 * high/low CPU load or other resource usage such as network performance or
1416 * throttling. Typically sinks generate these events for each buffer
1417 * they receive.
1418 *
1419 * @a type indicates the reason for the QoS event. Gst::QOS_TYPE_OVERFLOW is
1420 * used when a buffer arrived in time or when the sink cannot keep up with
1421 * the upstream datarate. Gst::QOS_TYPE_UNDERFLOW is when the sink is not
1422 * receiving buffers fast enough and thus has to drop late buffers.
1423 * Gst::QOS_TYPE_THROTTLE is used when the datarate is artificially limited
1424 * by the application, for example to reduce power consumption.
1425 *
1426 * @a proportion indicates the real-time performance of the streaming in the
1427 * element that generated the QoS event (usually the sink). The value is
1428 * generally computed based on more long term statistics about the streams
1429 * timestamps compared to the clock.
1430 * A value < 1.0 indicates that the upstream element is producing data faster
1431 * than real-time. A value > 1.0 indicates that the upstream element is not
1432 * producing data fast enough. 1.0 is the ideal @a proportion value. The
1433 * proportion value can safely be used to lower or increase the quality of
1434 * the element.
1435 *
1436 * @a diff is the difference against the clock in running time of the last
1437 * buffer that caused the element to generate the QOS event. A negative value
1438 * means that the buffer with @a timestamp arrived in time. A positive value
1439 * indicates how late the buffer with @a timestamp was. When throttling is
1440 * enabled, @a diff will be set to the requested throttling interval.
1441 *
1442 * @a timestamp is the timestamp of the last buffer that cause the element
1443 * to generate the QOS event. It is expressed in running time and thus an ever
1444 * increasing value.
1445 *
1446 * The upstream element can use the @a diff and @a timestamp values to decide
1447 * whether to process more buffers. For positive @a diff, all buffers with
1448 * timestamp <= @a timestamp + @a diff will certainly arrive late in the sink
1449 * as well. A (negative) @a diff value so that @a timestamp + @a diff would yield a
1450 * result smaller than 0 is not allowed.
1451 *
1452 * The application can use general event probes to intercept the QoS
1453 * event and implement custom application specific QoS handling.
1454 *
1455 * @param type The QoS type.
1456 * @param proportion The proportion of the qos message.
1457 * @param diff The time difference of the last Clock sync.
1458 * @param timestamp The timestamp of the buffer.
1459 * @return A new QOS event.
1460 */
1461 static Glib::RefPtr<Gst::EventQos> create(QOSType type, double proportion, Gst::ClockTimeDiff diff, Gst::ClockTime timestamp);
1462
1463 /**
1464 * Gets the type, proportion, diff and timestamp from the qos event.
1465 *
1466 * @param type A pointer to store the QoS type in.
1467 * @param proportion A pointer to store the proportion in.
1468 * @param diff A pointer to store the diff in.
1469 * @param timestamp A pointer to store the timestamp in.
1470 */
1471 void parse(QOSType& type, double& proportion, Gst::ClockTimeDiff& diff, Gst::ClockTime& timestamp) const;
1472
1473
1474 /** Get the QoS type. See create() for more information
1475 * about the different QoS values.
1476 *
1477 * @return The QoS type.
1478 */
1479 QOSType parse_type() const;
1480
1481 /** Get the proportion in the qos event. See create() for more information
1482 * about the different QoS values.
1483 *
1484 * @return The proportion.
1485 */
1486 double parse_proportion() const;
1487
1488 /** Get the diff in the qos event. See create() for more information about
1489 * the different QoS values.
1490 *
1491 * @return The difference.
1492 */
1493 Gst::ClockTimeDiff parse_diff() const;
1494
1495 /** Get the timestamp in the qos event. See create() for more information
1496 * about the different QoS values.
1497 * @return The timestamp.
1498 */
1499 Gst::ClockTime parse_timestamp() const;
1500
1501
1502 };
1503
1504 /** A seek event. See create() for more details.
1505 */
1506 class EventSeek : public Event
1507 {
1508 public:
1509 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1510 using CppObjectType = EventSeek;
1511 using BaseObjectType = GstEvent;
1512 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1513
1514 private:
1515
1516 public:
1517
1518
1519 /** Allocate a new seek event with the given parameters.
1520 *
1521 * The seek event configures playback of the pipeline between @a start to @a stop
1522 * at the speed given in @a rate, also called a playback segment.
1523 * The @a start and @a stop values are expressed in @a format.
1524 *
1525 * A @a rate of 1.0 means normal playback rate, 2.0 means double speed.
1526 * Negatives values means backwards playback. A value of 0.0 for the
1527 * rate is not allowed and should be accomplished instead by PAUSING the
1528 * pipeline.
1529 *
1530 * A pipeline has a default playback segment configured with a start
1531 * position of 0, a stop position of -1 and a rate of 1.0. The currently
1532 * configured playback segment can be queried with Gst::QUERY_SEGMENT.
1533 *
1534 * @a start_type and @a stop_type specify how to adjust the currently configured
1535 * start and stop fields in playback segment. Adjustments can be made relative
1536 * or absolute to the last configured values. A type of Gst::SEEK_TYPE_NONE
1537 * means that the position should not be updated.
1538 *
1539 * When the rate is positive and @a start has been updated, playback will start
1540 * from the newly configured start position.
1541 *
1542 * For negative rates, playback will start from the newly configured stop
1543 * position (if any). If the stop position is updated, it must be different from
1544 * -1 (Gst::CLOCK_TIME_NONE) for negative rates.
1545 *
1546 * It is not possible to seek relative to the current playback position, to do
1547 * this, PAUSE the pipeline, query the current playback position with
1548 * Gst::QUERY_POSITION and update the playback segment current position with a
1549 * Gst::SEEK_TYPE_SET to the desired position.
1550 *
1551 * @param rate The new playback rate.
1552 * @param format The format of the seek values.
1553 * @param flags The optional seek flags.
1554 * @param start_type The type and flags for the new start position.
1555 * @param start The value of the new start position.
1556 * @param stop_type The type and flags for the new stop position.
1557 * @param stop The value of the new stop position.
1558 * @return A new seek event.
1559 */
1560 static Glib::RefPtr<Gst::EventSeek> create(double rate, Format format, SeekFlags flags, SeekType start_type, gint64 start, SeekType stop_type, gint64 stop);
1561
1562 /** Parses a seek event and stores the results in the given result locations.
1563 *
1564 * @param rate Result location for the rate.
1565 * @param format Result location for the stream format.
1566 * @param flags Result location for the Gst::SeekFlags.
1567 * @param start_type Result location for the Gst::SeekType of the start
1568 * position.
1569 * @param start Result location for the start postion expressed in format.
1570 * @param stop_type Result location for the Gst::SeekType of the stop
1571 * position.
1572 * @param stop Result location for the stop postion expressed in format.
1573 */
1574 void parse(double& rate, Format& format, SeekFlags& flags,
1575 SeekType& start_type, gint64& start, SeekType& stop_type,
1576 gint64& stop) const;
1577
1578
1579 /** Parses the start of a seek event.
1580 * @return The start.
1581 */
1582 gint64 parse_start() const;
1583
1584 /** Parses the rate of a seek event.
1585 * @return The rate.
1586 */
1587 double parse_rate() const;
1588
1589 /** Parses the format of a seek event.
1590 * @return The format.
1591 */
1592 Format parse_format() const;
1593
1594 /** Parses the flags of a seek event.
1595 * @return The flags.
1596 */
1597 SeekFlags parse_flags() const;
1598
1599 /** Parses the start type of a seek event.
1600 * @return The start type.
1601 */
1602 SeekType parse_start_type() const;
1603
1604 /** Parses the stop type of a seek event.
1605 * @return The stop type.
1606 */
1607 SeekType parse_stop_type() const;
1608
1609 /** Parses the stop of a seek event.
1610 * @return The stop.
1611 */
1612 gint64 parse_stop() const;
1613
1614
1615 };
1616
1617 /** A latency event. See create() for more details.
1618 */
1619 class EventLatency : public Event
1620 {
1621 public:
1622 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1623 using CppObjectType = EventLatency;
1624 using BaseObjectType = GstEvent;
1625 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1626
1627 private:
1628
1629 public:
1630
1631
1632 /** Create a new latency event. The event is sent upstream from the sinks and
1633 * notifies elements that they should add an additional @a latency to the
1634 * running time before synchronising against the clock.
1635 *
1636 * The latency is mostly used in live sinks and is always expressed in
1637 * the time format.
1638 *
1639 * @param latency The new latency value.
1640 * @return A new Gst::Event.
1641 */
1642 static Glib::RefPtr<Gst::EventLatency> create(Gst::ClockTime latency);
1643
1644 /** Get the latency in the latency event.
1645 *
1646 * @return The latency.
1647 */
1648 Gst::ClockTime parse_latency() const;
1649
1650
1651 };
1652
1653 /** A step event. See create() for more details.
1654 */
1655 class EventStep : public Event
1656 {
1657 public:
1658 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1659 using CppObjectType = EventStep;
1660 using BaseObjectType = GstEvent;
1661 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1662
1663 private:
1664
1665 public:
1666
1667
1668 /** Create a new step event. The purpose of the step event is to instruct a sink
1669 * to skip @a amount (expressed in @a format) of media. It can be used to implement
1670 * stepping through the video frame by frame or for doing fast trick modes.
1671 *
1672 * A rate of <= 0.0 is not allowed. Pause the pipeline, for the effect of rate
1673 * = 0.0 or first reverse the direction of playback using a seek event to get
1674 * the same effect as rate < 0.0.
1675 *
1676 * The @a flush flag will clear any pending data in the pipeline before starting
1677 * the step operation.
1678 *
1679 * The @a intermediate flag instructs the pipeline that this step operation is
1680 * part of a larger step operation.
1681 *
1682 * @param format The format of @a amount.
1683 * @param amount The amount of data to step.
1684 * @param rate The step rate.
1685 * @param flush Flushing steps.
1686 * @param intermediate Intermediate steps.
1687 * @return A new Gst::Event.
1688 */
1689 static Glib::RefPtr<Gst::EventStep> create(Gst::Format format, guint64 amount, double rate, bool flush, bool intermediate);
1690
1691 /** Parse the step event.
1692 *
1693 * @param format A reference to store the format in.
1694 * @param amount A reference to store the amount in.
1695 * @param rate A reference to store the rate in.
1696 * @param flush A reference to store the flush boolean in.
1697 * @param intermediate A reference to store the intermediate boolean in.
1698 */
1699 void parse(Gst::Format& format, guint64& amount, double& rate,
1700 bool& flush, bool& intermediate) const;
1701
1702
1703 /** Get the amount in a step event.
1704 * @return The amount.
1705 */
1706 guint64 parse_amount() const;
1707
1708 /** Get the format in a step event.
1709 * @return The format.
1710 */
1711 Gst::Format parse_format() const;
1712
1713 /** Get the rate in a step event.
1714 * @return The rate.
1715 */
1716 double parse_rate() const;
1717
1718 /** Get the flush in a step event.
1719 * @return The flush flag.
1720 */
1721 bool parse_flush() const;
1722
1723 /** Get the intermediate flag in a step event.
1724 * @return The intermediate flag.
1725 */
1726 bool parse_intermediate() const;
1727
1728
1729 };
1730
1731 /** A reconfigure event. See create() for more details.
1732 */
1733 class EventReconfigure : public Event
1734 {
1735 public:
1736 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1737 using CppObjectType = EventReconfigure;
1738 using BaseObjectType = GstEvent;
1739 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1740
1741 private:
1742
1743 public:
1744
1745
1746 /** Create a new reconfigure event. The purpose of the reconfigure event is
1747 * to travel upstream and make elements renegotiate their caps or reconfigure
1748 * their buffer pools. This is useful when changing properties on elements
1749 * or changing the topology of the pipeline.
1750 *
1751 * @return A new Gst::Event.
1752 */
1753 static Glib::RefPtr<Gst::EventReconfigure> create();
1754
1755
1756 };
1757
1758 /** A toc select event. See create() for more details.
1759 */
1760 class EventTocSelect : public Event
1761 {
1762 public:
1763 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1764 using CppObjectType = EventTocSelect;
1765 using BaseObjectType = GstEvent;
1766 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
1767
1768 private:
1769
1770 public:
1771
1772
1773 /** Generate a TOC select event with the given @a uid. The purpose of the
1774 * TOC select event is to start playback based on the TOC's entry with the
1775 * given @a uid.
1776 *
1777 * @param uid UID in the TOC to start playback from.
1778 * @return A new Gst::Event.
1779 */
1780 static Glib::RefPtr<Gst::EventTocSelect> create(const Glib::ustring& uid);
1781
1782 /** Parse the UID in a toc select event.
1783 * @return The UID.
1784 */
1785 Glib::ustring parse_uid() const;
1786
1787
1788 };
1789
1790 } //namespace Gst
1791
1792
1793 namespace Glib
1794 {
1795
1796 /** A Glib::wrap() method for this object.
1797 *
1798 * @param object The C instance.
1799 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
1800 * @result A C++ instance that wraps this C instance.
1801 *
1802 * @relates Gst::Event
1803 */
1804 Glib::RefPtr<Gst::Event> wrap(GstEvent* object, bool take_copy = false);
1805
1806 } // namespace Glib
1807
1808
1809 #endif /* _GSTREAMERMM_EVENT_H */
1810