1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gstreamer.Event;
26 
27 private import glib.ConstructionException;
28 private import glib.ListG;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gstreamer.Buffer;
32 private import gstreamer.Caps;
33 private import gstreamer.Message;
34 private import gstreamer.Segment;
35 private import gstreamer.Stream;
36 private import gstreamer.StreamCollection;
37 private import gstreamer.Structure;
38 private import gstreamer.TagList;
39 private import gstreamer.Toc;
40 private import gstreamer.c.functions;
41 public  import gstreamer.c.types;
42 public  import gstreamerc.gstreamertypes;
43 
44 
45 /**
46  * The event class provides factory methods to construct events for sending
47  * and functions to query (parse) received events.
48  * 
49  * Events are usually created with gst_event_new_*() which takes event-type
50  * specific parameters as arguments.
51  * To send an event application will usually use gst_element_send_event() and
52  * elements will use gst_pad_send_event() or gst_pad_push_event().
53  * The event should be unreffed with gst_event_unref() if it has not been sent.
54  * 
55  * Events that have been received can be parsed with their respective
56  * gst_event_parse_*() functions. It is valid to pass %NULL for unwanted details.
57  * 
58  * Events are passed between elements in parallel to the data stream. Some events
59  * are serialized with buffers, others are not. Some events only travel downstream,
60  * others only upstream. Some events can travel both upstream and downstream.
61  * 
62  * The events are used to signal special conditions in the datastream such as
63  * EOS (end of stream) or the start of a new stream-segment.
64  * Events are also used to flush the pipeline of any pending data.
65  * 
66  * Most of the event API is used inside plugins. Applications usually only
67  * construct and use seek events.
68  * To do that gst_event_new_seek() is used to create a seek event. It takes
69  * the needed parameters to specify seeking time and mode.
70  * |[<!-- language="C" -->
71  * GstEvent *event;
72  * gboolean result;
73  * ...
74  * // construct a seek event to play the media from second 2 to 5, flush
75  * // the pipeline to decrease latency.
76  * event = gst_event_new_seek (1.0,
77  * GST_FORMAT_TIME,
78  * GST_SEEK_FLAG_FLUSH,
79  * GST_SEEK_TYPE_SET, 2 * GST_SECOND,
80  * GST_SEEK_TYPE_SET, 5 * GST_SECOND);
81  * ...
82  * result = gst_element_send_event (pipeline, event);
83  * if (!result)
84  * g_warning ("seek failed");
85  * ...
86  * ]|
87  */
88 public class Event
89 {
90 	/** the main Gtk struct */
91 	protected GstEvent* gstEvent;
92 	protected bool ownedRef;
93 
94 	/** Get the main Gtk struct */
95 	public GstEvent* getEventStruct(bool transferOwnership = false)
96 	{
97 		if (transferOwnership)
98 			ownedRef = false;
99 		return gstEvent;
100 	}
101 
102 	/** the main Gtk struct as a void* */
103 	protected void* getStruct()
104 	{
105 		return cast(void*)gstEvent;
106 	}
107 
108 	/**
109 	 * Sets our main struct and passes it to the parent class.
110 	 */
111 	public this (GstEvent* gstEvent, bool ownedRef = false)
112 	{
113 		this.gstEvent = gstEvent;
114 		this.ownedRef = ownedRef;
115 	}
116 
117 	/**
118 	 * Create a new EOS event. The eos event can only travel downstream
119 	 * synchronized with the buffer flow. Elements that receive the EOS
120 	 * event on a pad can return UNEXPECTED as a GstFlowReturn when data
121 	 * after the EOS event arrives.
122 	 * The EOS event will travel down to the sink elements in the pipeline
123 	 * which will then post the GST_MESSAGE_EOS on the bus after they have
124 	 * finished playing any buffered data.
125 	 * When all sinks have posted an EOS message, the EOS message is
126 	 * forwarded to the application.
127 	 * Returns:
128 	 *  The new EOS event.
129 	 */
130 	public static Event newEOS()
131 	{
132 		// GstEvent* gst_event_new_eos (void);
133 		auto p = gst_event_new_eos();
134 
135 		if(p is null)
136 		{
137 			throw new ConstructionException("null returned by gst_event_new_eos");
138 		}
139 
140 		return new Event(cast(GstEvent*)p );
141 	}
142 
143 	/**
144 	 * Allocate a new flush start event. The flush start event can be send
145 	 * upstream and downstream and travels out-of-bounds with the dataflow.
146 	 * It marks pads as being in a WRONG_STATE to process more data.
147 	 * Elements unlock and blocking functions and exit their streaming functions
148 	 * as fast as possible.
149 	 * This event is typically generated after a seek to minimize the latency
150 	 * after the seek.
151 	 * Returns:
152 	 *  A new flush start event.
153 	 */
154 	public static Event newFlushStart()
155 	{
156 		// GstEvent* gst_event_new_flush_start (void);
157 		auto p = gst_event_new_flush_start();
158 
159 		if(p is null)
160 		{
161 			throw new ConstructionException("null returned by gst_event_new_flush_start");
162 		}
163 
164 		return new Event(cast(GstEvent*)p );
165 	}
166 
167 	/**
168 	 * Generate a TOC select event with the given uid. The purpose of the
169 	 * TOC select event is to start playback based on the TOC's entry with
170 	 * the given uid.
171 	 */
172 	public static Event newTocSelect(string uid)
173 	{
174 		// GstEvent* gst_event_new_toc_select (const gchar *uid);
175 		auto p = gst_event_new_toc_select(cast(char*)uid.ptr);
176 
177 		if(p is null)
178 		{
179 			throw new ConstructionException("null returned by gst_event_new_toc_select");
180 		}
181 
182 		return new Event(cast(GstEvent*)p );
183 	}
184 
185 	/**
186 	 */
187 
188 	/** */
189 	public static GType getType()
190 	{
191 		return gst_event_get_type();
192 	}
193 
194 	/**
195 	 * Create a new buffersize event. The event is sent downstream and notifies
196 	 * elements that they should provide a buffer of the specified dimensions.
197 	 *
198 	 * When the @async flag is set, a thread boundary is preferred.
199 	 *
200 	 * Params:
201 	 *     format = buffer format
202 	 *     minsize = minimum buffer size
203 	 *     maxsize = maximum buffer size
204 	 *     async = thread behavior
205 	 *
206 	 * Returns: a new #GstEvent
207 	 *
208 	 * Throws: ConstructionException GTK+ fails to create the object.
209 	 */
210 	public this(GstFormat format, long minsize, long maxsize, bool async)
211 	{
212 		auto p = gst_event_new_buffer_size(format, minsize, maxsize, async);
213 
214 		if(p is null)
215 		{
216 			throw new ConstructionException("null returned by new_buffer_size");
217 		}
218 
219 		this(cast(GstEvent*) p);
220 	}
221 
222 	/**
223 	 * Create a new CAPS event for @caps. The caps event can only travel downstream
224 	 * synchronized with the buffer flow and contains the format of the buffers
225 	 * that will follow after the event.
226 	 *
227 	 * Params:
228 	 *     caps = a #GstCaps
229 	 *
230 	 * Returns: the new CAPS event.
231 	 *
232 	 * Throws: ConstructionException GTK+ fails to create the object.
233 	 */
234 	public this(Caps caps)
235 	{
236 		auto p = gst_event_new_caps((caps is null) ? null : caps.getCapsStruct());
237 
238 		if(p is null)
239 		{
240 			throw new ConstructionException("null returned by new_caps");
241 		}
242 
243 		this(cast(GstEvent*) p);
244 	}
245 
246 	/**
247 	 * Create a new custom-typed event. This can be used for anything not
248 	 * handled by other event-specific functions to pass an event to another
249 	 * element.
250 	 *
251 	 * Make sure to allocate an event type with the #GST_EVENT_MAKE_TYPE macro,
252 	 * assigning a free number and filling in the correct direction and
253 	 * serialization flags.
254 	 *
255 	 * New custom events can also be created by subclassing the event type if
256 	 * needed.
257 	 *
258 	 * Params:
259 	 *     type = The type of the new event
260 	 *     structure = the structure for the event. The event will
261 	 *         take ownership of the structure.
262 	 *
263 	 * Returns: the new custom event.
264 	 *
265 	 * Throws: ConstructionException GTK+ fails to create the object.
266 	 */
267 	public this(GstEventType type, Structure structure)
268 	{
269 		auto p = gst_event_new_custom(type, (structure is null) ? null : structure.getStructureStruct(true));
270 
271 		if(p is null)
272 		{
273 			throw new ConstructionException("null returned by new_custom");
274 		}
275 
276 		this(cast(GstEvent*) p);
277 	}
278 
279 	/**
280 	 * Allocate a new flush stop event. The flush stop event can be sent
281 	 * upstream and downstream and travels serialized with the dataflow.
282 	 * It is typically sent after sending a FLUSH_START event to make the
283 	 * pads accept data again.
284 	 *
285 	 * Elements can process this event synchronized with the dataflow since
286 	 * the preceding FLUSH_START event stopped the dataflow.
287 	 *
288 	 * This event is typically generated to complete a seek and to resume
289 	 * dataflow.
290 	 *
291 	 * Params:
292 	 *     resetTime = if time should be reset
293 	 *
294 	 * Returns: a new flush stop event.
295 	 *
296 	 * Throws: ConstructionException GTK+ fails to create the object.
297 	 */
298 	public this(bool resetTime)
299 	{
300 		auto p = gst_event_new_flush_stop(resetTime);
301 
302 		if(p is null)
303 		{
304 			throw new ConstructionException("null returned by new_flush_stop");
305 		}
306 
307 		this(cast(GstEvent*) p);
308 	}
309 
310 	/**
311 	 * Create a new GAP event. A gap event can be thought of as conceptually
312 	 * equivalent to a buffer to signal that there is no data for a certain
313 	 * amount of time. This is useful to signal a gap to downstream elements
314 	 * which may wait for data, such as muxers or mixers or overlays, especially
315 	 * for sparse streams such as subtitle streams.
316 	 *
317 	 * Params:
318 	 *     timestamp = the start time (pts) of the gap
319 	 *     duration = the duration of the gap
320 	 *
321 	 * Returns: the new GAP event.
322 	 *
323 	 * Throws: ConstructionException GTK+ fails to create the object.
324 	 */
325 	public this(GstClockTime timestamp, GstClockTime duration)
326 	{
327 		auto p = gst_event_new_gap(timestamp, duration);
328 
329 		if(p is null)
330 		{
331 			throw new ConstructionException("null returned by new_gap");
332 		}
333 
334 		this(cast(GstEvent*) p);
335 	}
336 
337 	/**
338 	 * Create a new latency event. The event is sent upstream from the sinks and
339 	 * notifies elements that they should add an additional @latency to the
340 	 * running time before synchronising against the clock.
341 	 *
342 	 * The latency is mostly used in live sinks and is always expressed in
343 	 * the time format.
344 	 *
345 	 * Params:
346 	 *     latency = the new latency value
347 	 *
348 	 * Returns: a new #GstEvent
349 	 *
350 	 * Throws: ConstructionException GTK+ fails to create the object.
351 	 */
352 	public this(GstClockTime latency)
353 	{
354 		auto p = gst_event_new_latency(latency);
355 
356 		if(p is null)
357 		{
358 			throw new ConstructionException("null returned by new_latency");
359 		}
360 
361 		this(cast(GstEvent*) p);
362 	}
363 
364 	/**
365 	 * Create a new navigation event from the given description.
366 	 *
367 	 * Params:
368 	 *     structure = description of the event. The event will take
369 	 *         ownership of the structure.
370 	 *
371 	 * Returns: a new #GstEvent
372 	 *
373 	 * Throws: ConstructionException GTK+ fails to create the object.
374 	 */
375 	public this(Structure structure)
376 	{
377 		auto p = gst_event_new_navigation((structure is null) ? null : structure.getStructureStruct(true));
378 
379 		if(p is null)
380 		{
381 			throw new ConstructionException("null returned by new_navigation");
382 		}
383 
384 		this(cast(GstEvent*) p);
385 	}
386 
387 	/**
388 	 * Creates a new event containing information specific to a particular
389 	 * protection system (uniquely identified by @system_id), by which that
390 	 * protection system can acquire key(s) to decrypt a protected stream.
391 	 *
392 	 * In order for a decryption element to decrypt media
393 	 * protected using a specific system, it first needs all the
394 	 * protection system specific information necessary to acquire the decryption
395 	 * key(s) for that stream. The functions defined here enable this information
396 	 * to be passed in events from elements that extract it
397 	 * (e.g., ISOBMFF demuxers, MPEG DASH demuxers) to protection decrypter
398 	 * elements that use it.
399 	 *
400 	 * Events containing protection system specific information are created using
401 	 * #gst_event_new_protection, and they can be parsed by downstream elements
402 	 * using #gst_event_parse_protection.
403 	 *
404 	 * In Common Encryption, protection system specific information may be located
405 	 * within ISOBMFF files, both in movie (moov) boxes and movie fragment (moof)
406 	 * boxes; it may also be contained in ContentProtection elements within MPEG
407 	 * DASH MPDs. The events created by #gst_event_new_protection contain data
408 	 * identifying from which of these locations the encapsulated protection system
409 	 * specific information originated. This origin information is required as
410 	 * some protection systems use different encodings depending upon where the
411 	 * information originates.
412 	 *
413 	 * The events returned by gst_event_new_protection() are implemented
414 	 * in such a way as to ensure that the most recently-pushed protection info
415 	 * event of a particular @origin and @system_id will
416 	 * be stuck to the output pad of the sending element.
417 	 *
418 	 * Params:
419 	 *     systemId = a string holding a UUID that uniquely
420 	 *         identifies a protection system.
421 	 *     data = a #GstBuffer holding protection system specific
422 	 *         information. The reference count of the buffer will be incremented by one.
423 	 *     origin = a string indicating where the protection
424 	 *         information carried in the event was extracted from. The allowed values
425 	 *         of this string will depend upon the protection scheme.
426 	 *
427 	 * Returns: a #GST_EVENT_PROTECTION event, if successful; %NULL
428 	 *     if unsuccessful.
429 	 *
430 	 * Since: 1.6
431 	 *
432 	 * Throws: ConstructionException GTK+ fails to create the object.
433 	 */
434 	public this(string systemId, Buffer data, string origin)
435 	{
436 		auto p = gst_event_new_protection(Str.toStringz(systemId), (data is null) ? null : data.getBufferStruct(), Str.toStringz(origin));
437 
438 		if(p is null)
439 		{
440 			throw new ConstructionException("null returned by new_protection");
441 		}
442 
443 		this(cast(GstEvent*) p);
444 	}
445 
446 	/**
447 	 * Allocate a new qos event with the given values.
448 	 * The QOS event is generated in an element that wants an upstream
449 	 * element to either reduce or increase its rate because of
450 	 * high/low CPU load or other resource usage such as network performance or
451 	 * throttling. Typically sinks generate these events for each buffer
452 	 * they receive.
453 	 *
454 	 * @type indicates the reason for the QoS event. #GST_QOS_TYPE_OVERFLOW is
455 	 * used when a buffer arrived in time or when the sink cannot keep up with
456 	 * the upstream datarate. #GST_QOS_TYPE_UNDERFLOW is when the sink is not
457 	 * receiving buffers fast enough and thus has to drop late buffers.
458 	 * #GST_QOS_TYPE_THROTTLE is used when the datarate is artificially limited
459 	 * by the application, for example to reduce power consumption.
460 	 *
461 	 * @proportion indicates the real-time performance of the streaming in the
462 	 * element that generated the QoS event (usually the sink). The value is
463 	 * generally computed based on more long term statistics about the streams
464 	 * timestamps compared to the clock.
465 	 * A value < 1.0 indicates that the upstream element is producing data faster
466 	 * than real-time. A value > 1.0 indicates that the upstream element is not
467 	 * producing data fast enough. 1.0 is the ideal @proportion value. The
468 	 * proportion value can safely be used to lower or increase the quality of
469 	 * the element.
470 	 *
471 	 * @diff is the difference against the clock in running time of the last
472 	 * buffer that caused the element to generate the QOS event. A negative value
473 	 * means that the buffer with @timestamp arrived in time. A positive value
474 	 * indicates how late the buffer with @timestamp was. When throttling is
475 	 * enabled, @diff will be set to the requested throttling interval.
476 	 *
477 	 * @timestamp is the timestamp of the last buffer that cause the element
478 	 * to generate the QOS event. It is expressed in running time and thus an ever
479 	 * increasing value.
480 	 *
481 	 * The upstream element can use the @diff and @timestamp values to decide
482 	 * whether to process more buffers. For positive @diff, all buffers with
483 	 * timestamp <= @timestamp + @diff will certainly arrive late in the sink
484 	 * as well. A (negative) @diff value so that @timestamp + @diff would yield a
485 	 * result smaller than 0 is not allowed.
486 	 *
487 	 * The application can use general event probes to intercept the QoS
488 	 * event and implement custom application specific QoS handling.
489 	 *
490 	 * Params:
491 	 *     type = the QoS type
492 	 *     proportion = the proportion of the qos message
493 	 *     diff = The time difference of the last Clock sync
494 	 *     timestamp = The timestamp of the buffer
495 	 *
496 	 * Returns: a new QOS event.
497 	 *
498 	 * Throws: ConstructionException GTK+ fails to create the object.
499 	 */
500 	public this(GstQOSType type, double proportion, GstClockTimeDiff diff, GstClockTime timestamp)
501 	{
502 		auto p = gst_event_new_qos(type, proportion, diff, timestamp);
503 
504 		if(p is null)
505 		{
506 			throw new ConstructionException("null returned by new_qos");
507 		}
508 
509 		this(cast(GstEvent*) p);
510 	}
511 
512 	/**
513 	 * Create a new reconfigure event. The purpose of the reconfigure event is
514 	 * to travel upstream and make elements renegotiate their caps or reconfigure
515 	 * their buffer pools. This is useful when changing properties on elements
516 	 * or changing the topology of the pipeline.
517 	 *
518 	 * Returns: a new #GstEvent
519 	 *
520 	 * Throws: ConstructionException GTK+ fails to create the object.
521 	 */
522 	public this()
523 	{
524 		auto p = gst_event_new_reconfigure();
525 
526 		if(p is null)
527 		{
528 			throw new ConstructionException("null returned by new_reconfigure");
529 		}
530 
531 		this(cast(GstEvent*) p);
532 	}
533 
534 	/**
535 	 * Allocate a new seek event with the given parameters.
536 	 *
537 	 * The seek event configures playback of the pipeline between @start to @stop
538 	 * at the speed given in @rate, also called a playback segment.
539 	 * The @start and @stop values are expressed in @format.
540 	 *
541 	 * A @rate of 1.0 means normal playback rate, 2.0 means double speed.
542 	 * Negatives values means backwards playback. A value of 0.0 for the
543 	 * rate is not allowed and should be accomplished instead by PAUSING the
544 	 * pipeline.
545 	 *
546 	 * A pipeline has a default playback segment configured with a start
547 	 * position of 0, a stop position of -1 and a rate of 1.0. The currently
548 	 * configured playback segment can be queried with #GST_QUERY_SEGMENT.
549 	 *
550 	 * @start_type and @stop_type specify how to adjust the currently configured
551 	 * start and stop fields in playback segment. Adjustments can be made relative
552 	 * or absolute to the last configured values. A type of #GST_SEEK_TYPE_NONE
553 	 * means that the position should not be updated.
554 	 *
555 	 * When the rate is positive and @start has been updated, playback will start
556 	 * from the newly configured start position.
557 	 *
558 	 * For negative rates, playback will start from the newly configured stop
559 	 * position (if any). If the stop position is updated, it must be different from
560 	 * -1 (#GST_CLOCK_TIME_NONE) for negative rates.
561 	 *
562 	 * It is not possible to seek relative to the current playback position, to do
563 	 * this, PAUSE the pipeline, query the current playback position with
564 	 * #GST_QUERY_POSITION and update the playback segment current position with a
565 	 * #GST_SEEK_TYPE_SET to the desired position.
566 	 *
567 	 * Params:
568 	 *     rate = The new playback rate
569 	 *     format = The format of the seek values
570 	 *     flags = The optional seek flags
571 	 *     startType = The type and flags for the new start position
572 	 *     start = The value of the new start position
573 	 *     stopType = The type and flags for the new stop position
574 	 *     stop = The value of the new stop position
575 	 *
576 	 * Returns: a new seek event.
577 	 *
578 	 * Throws: ConstructionException GTK+ fails to create the object.
579 	 */
580 	public this(double rate, GstFormat format, GstSeekFlags flags, GstSeekType startType, long start, GstSeekType stopType, long stop)
581 	{
582 		auto p = gst_event_new_seek(rate, format, flags, startType, start, stopType, stop);
583 
584 		if(p is null)
585 		{
586 			throw new ConstructionException("null returned by new_seek");
587 		}
588 
589 		this(cast(GstEvent*) p);
590 	}
591 
592 	/**
593 	 * Create a new SEGMENT event for @segment. The segment event can only travel
594 	 * downstream synchronized with the buffer flow and contains timing information
595 	 * and playback properties for the buffers that will follow.
596 	 *
597 	 * The segment event marks the range of buffers to be processed. All
598 	 * data not within the segment range is not to be processed. This can be
599 	 * used intelligently by plugins to apply more efficient methods of skipping
600 	 * unneeded data. The valid range is expressed with the @start and @stop
601 	 * values.
602 	 *
603 	 * The time value of the segment is used in conjunction with the start
604 	 * value to convert the buffer timestamps into the stream time. This is
605 	 * usually done in sinks to report the current stream_time.
606 	 * @time represents the stream_time of a buffer carrying a timestamp of
607 	 * @start. @time cannot be -1.
608 	 *
609 	 * @start cannot be -1, @stop can be -1. If there
610 	 * is a valid @stop given, it must be greater or equal the @start, including
611 	 * when the indicated playback @rate is < 0.
612 	 *
613 	 * The @applied_rate value provides information about any rate adjustment that
614 	 * has already been made to the timestamps and content on the buffers of the
615 	 * stream. (@rate * @applied_rate) should always equal the rate that has been
616 	 * requested for playback. For example, if an element has an input segment
617 	 * with intended playback @rate of 2.0 and applied_rate of 1.0, it can adjust
618 	 * incoming timestamps and buffer content by half and output a segment event
619 	 * with @rate of 1.0 and @applied_rate of 2.0
620 	 *
621 	 * After a segment event, the buffer stream time is calculated with:
622 	 *
623 	 * time + (TIMESTAMP(buf) - start) * ABS (rate * applied_rate)
624 	 *
625 	 * Params:
626 	 *     segment = a #GstSegment
627 	 *
628 	 * Returns: the new SEGMENT event.
629 	 *
630 	 * Throws: ConstructionException GTK+ fails to create the object.
631 	 */
632 	public this(Segment segment)
633 	{
634 		auto p = gst_event_new_segment((segment is null) ? null : segment.getSegmentStruct());
635 
636 		if(p is null)
637 		{
638 			throw new ConstructionException("null returned by new_segment");
639 		}
640 
641 		this(cast(GstEvent*) p);
642 	}
643 
644 	/**
645 	 * Create a new segment-done event. This event is sent by elements that
646 	 * finish playback of a segment as a result of a segment seek.
647 	 *
648 	 * Params:
649 	 *     format = The format of the position being done
650 	 *     position = The position of the segment being done
651 	 *
652 	 * Returns: a new #GstEvent
653 	 *
654 	 * Throws: ConstructionException GTK+ fails to create the object.
655 	 */
656 	public this(GstFormat format, long position)
657 	{
658 		auto p = gst_event_new_segment_done(format, position);
659 
660 		if(p is null)
661 		{
662 			throw new ConstructionException("null returned by new_segment_done");
663 		}
664 
665 		this(cast(GstEvent*) p);
666 	}
667 
668 	/**
669 	 * Allocate a new select-streams event.
670 	 *
671 	 * The select-streams event requests the specified @streams to be activated.
672 	 *
673 	 * The list of @streams corresponds to the "Stream ID" of each stream to be
674 	 * activated. Those ID can be obtained via the #GstStream objects present
675 	 * in #GST_EVENT_STREAM_START, #GST_EVENT_STREAM_COLLECTION or
676 	 * #GST_MESSSAGE_STREAM_COLLECTION.
677 	 *
678 	 * Params:
679 	 *     streams = the list of streams to
680 	 *         activate
681 	 *
682 	 * Returns: a new select-streams event.
683 	 *
684 	 * Since: 1.10
685 	 *
686 	 * Throws: ConstructionException GTK+ fails to create the object.
687 	 */
688 	public this(ListG streams)
689 	{
690 		auto p = gst_event_new_select_streams((streams is null) ? null : streams.getListGStruct());
691 
692 		if(p is null)
693 		{
694 			throw new ConstructionException("null returned by new_select_streams");
695 		}
696 
697 		this(cast(GstEvent*) p);
698 	}
699 
700 	/**
701 	 * Create a new sink-message event. The purpose of the sink-message event is
702 	 * to instruct a sink to post the message contained in the event synchronized
703 	 * with the stream.
704 	 *
705 	 * @name is used to store multiple sticky events on one pad.
706 	 *
707 	 * Params:
708 	 *     name = a name for the event
709 	 *     msg = the #GstMessage to be posted
710 	 *
711 	 * Returns: a new #GstEvent
712 	 *
713 	 * Throws: ConstructionException GTK+ fails to create the object.
714 	 */
715 	public this(string name, Message msg)
716 	{
717 		auto p = gst_event_new_sink_message(Str.toStringz(name), (msg is null) ? null : msg.getMessageStruct());
718 
719 		if(p is null)
720 		{
721 			throw new ConstructionException("null returned by new_sink_message");
722 		}
723 
724 		this(cast(GstEvent*) p);
725 	}
726 
727 	/**
728 	 * Create a new step event. The purpose of the step event is to instruct a sink
729 	 * to skip @amount (expressed in @format) of media. It can be used to implement
730 	 * stepping through the video frame by frame or for doing fast trick modes.
731 	 *
732 	 * A rate of <= 0.0 is not allowed. Pause the pipeline, for the effect of rate
733 	 * = 0.0 or first reverse the direction of playback using a seek event to get
734 	 * the same effect as rate < 0.0.
735 	 *
736 	 * The @flush flag will clear any pending data in the pipeline before starting
737 	 * the step operation.
738 	 *
739 	 * The @intermediate flag instructs the pipeline that this step operation is
740 	 * part of a larger step operation.
741 	 *
742 	 * Params:
743 	 *     format = the format of @amount
744 	 *     amount = the amount of data to step
745 	 *     rate = the step rate
746 	 *     flush = flushing steps
747 	 *     intermediate = intermediate steps
748 	 *
749 	 * Returns: a new #GstEvent
750 	 *
751 	 * Throws: ConstructionException GTK+ fails to create the object.
752 	 */
753 	public this(GstFormat format, ulong amount, double rate, bool flush, bool intermediate)
754 	{
755 		auto p = gst_event_new_step(format, amount, rate, flush, intermediate);
756 
757 		if(p is null)
758 		{
759 			throw new ConstructionException("null returned by new_step");
760 		}
761 
762 		this(cast(GstEvent*) p);
763 	}
764 
765 	/**
766 	 * Create a new STREAM_COLLECTION event. The stream collection event can only
767 	 * travel downstream synchronized with the buffer flow.
768 	 *
769 	 * Source elements, demuxers and other elements that manage collections
770 	 * of streams and post #GstStreamCollection messages on the bus also send
771 	 * this event downstream on each pad involved in the collection, so that
772 	 * activation of a new collection can be tracked through the downstream
773 	 * data flow.
774 	 *
775 	 * Params:
776 	 *     collection = Active collection for this data flow
777 	 *
778 	 * Returns: the new STREAM_COLLECTION event.
779 	 *
780 	 * Since: 1.10
781 	 *
782 	 * Throws: ConstructionException GTK+ fails to create the object.
783 	 */
784 	public this(StreamCollection collection)
785 	{
786 		auto p = gst_event_new_stream_collection((collection is null) ? null : collection.getStreamCollectionStruct());
787 
788 		if(p is null)
789 		{
790 			throw new ConstructionException("null returned by new_stream_collection");
791 		}
792 
793 		this(cast(GstEvent*) p);
794 	}
795 
796 	/**
797 	 * Create a new Stream Group Done event. The stream-group-done event can
798 	 * only travel downstream synchronized with the buffer flow. Elements
799 	 * that receive the event on a pad should handle it mostly like EOS,
800 	 * and emit any data or pending buffers that would depend on more data
801 	 * arriving and unblock, since there won't be any more data.
802 	 *
803 	 * This event is followed by EOS at some point in the future, and is
804 	 * generally used when switching pads - to unblock downstream so that
805 	 * new pads can be exposed before sending EOS on the existing pads.
806 	 *
807 	 * Params:
808 	 *     groupId = the group id of the stream group which is ending
809 	 *
810 	 * Returns: the new stream-group-done event.
811 	 *
812 	 * Since: 1.10
813 	 *
814 	 * Throws: ConstructionException GTK+ fails to create the object.
815 	 */
816 	public this(uint groupId)
817 	{
818 		auto p = gst_event_new_stream_group_done(groupId);
819 
820 		if(p is null)
821 		{
822 			throw new ConstructionException("null returned by new_stream_group_done");
823 		}
824 
825 		this(cast(GstEvent*) p);
826 	}
827 
828 	/**
829 	 * Create a new STREAM_START event. The stream start event can only
830 	 * travel downstream synchronized with the buffer flow. It is expected
831 	 * to be the first event that is sent for a new stream.
832 	 *
833 	 * Source elements, demuxers and other elements that create new streams
834 	 * are supposed to send this event as the first event of a new stream. It
835 	 * should not be sent after a flushing seek or in similar situations
836 	 * and is used to mark the beginning of a new logical stream. Elements
837 	 * combining multiple streams must ensure that this event is only forwarded
838 	 * downstream once and not for every single input stream.
839 	 *
840 	 * The @stream_id should be a unique string that consists of the upstream
841 	 * stream-id, / as separator and a unique stream-id for this specific
842 	 * stream. A new stream-id should only be created for a stream if the upstream
843 	 * stream is split into (potentially) multiple new streams, e.g. in a demuxer,
844 	 * but not for every single element in the pipeline.
845 	 * gst_pad_create_stream_id() or gst_pad_create_stream_id_printf() can be
846 	 * used to create a stream-id.  There are no particular semantics for the
847 	 * stream-id, though it should be deterministic (to support stream matching)
848 	 * and it might be used to order streams (besides any information conveyed by
849 	 * stream flags).
850 	 *
851 	 * Params:
852 	 *     streamId = Identifier for this stream
853 	 *
854 	 * Returns: the new STREAM_START event.
855 	 *
856 	 * Throws: ConstructionException GTK+ fails to create the object.
857 	 */
858 	public this(string streamId)
859 	{
860 		auto p = gst_event_new_stream_start(Str.toStringz(streamId));
861 
862 		if(p is null)
863 		{
864 			throw new ConstructionException("null returned by new_stream_start");
865 		}
866 
867 		this(cast(GstEvent*) p);
868 	}
869 
870 	/**
871 	 * Generates a metadata tag event from the given @taglist.
872 	 *
873 	 * The scope of the taglist specifies if the taglist applies to the
874 	 * complete medium or only to this specific stream. As the tag event
875 	 * is a sticky event, elements should merge tags received from
876 	 * upstream with a given scope with their own tags with the same
877 	 * scope and create a new tag event from it.
878 	 *
879 	 * Params:
880 	 *     taglist = metadata list. The event will take ownership
881 	 *         of the taglist.
882 	 *
883 	 * Returns: a new #GstEvent
884 	 *
885 	 * Throws: ConstructionException GTK+ fails to create the object.
886 	 */
887 	public this(TagList taglist)
888 	{
889 		auto p = gst_event_new_tag((taglist is null) ? null : taglist.getTagListStruct());
890 
891 		if(p is null)
892 		{
893 			throw new ConstructionException("null returned by new_tag");
894 		}
895 
896 		this(cast(GstEvent*) p);
897 	}
898 
899 	/**
900 	 * Generate a TOC event from the given @toc. The purpose of the TOC event is to
901 	 * inform elements that some kind of the TOC was found.
902 	 *
903 	 * Params:
904 	 *     toc = #GstToc structure.
905 	 *     updated = whether @toc was updated or not.
906 	 *
907 	 * Returns: a new #GstEvent.
908 	 *
909 	 * Throws: ConstructionException GTK+ fails to create the object.
910 	 */
911 	public this(Toc toc, bool updated)
912 	{
913 		auto p = gst_event_new_toc((toc is null) ? null : toc.getTocStruct(), updated);
914 
915 		if(p is null)
916 		{
917 			throw new ConstructionException("null returned by new_toc");
918 		}
919 
920 		this(cast(GstEvent*) p);
921 	}
922 
923 	/**
924 	 * Parses a segment @event and copies the #GstSegment into the location
925 	 * given by @segment.
926 	 *
927 	 * Params:
928 	 *     segment = a pointer to a #GstSegment
929 	 */
930 	public void copySegment(Segment segment)
931 	{
932 		gst_event_copy_segment(gstEvent, (segment is null) ? null : segment.getSegmentStruct());
933 	}
934 
935 	/**
936 	 * Retrieve the accumulated running time offset of the event.
937 	 *
938 	 * Events passing through #GstPads that have a running time
939 	 * offset set via gst_pad_set_offset() will get their offset
940 	 * adjusted according to the pad's offset.
941 	 *
942 	 * If the event contains any information that related to the
943 	 * running time, this information will need to be updated
944 	 * before usage with this offset.
945 	 *
946 	 * Returns: The event's running time offset
947 	 *
948 	 *     MT safe.
949 	 *
950 	 * Since: 1.4
951 	 */
952 	public long getRunningTimeOffset()
953 	{
954 		return gst_event_get_running_time_offset(gstEvent);
955 	}
956 
957 	/**
958 	 * Retrieve the sequence number of a event.
959 	 *
960 	 * Events have ever-incrementing sequence numbers, which may also be set
961 	 * explicitly via gst_event_set_seqnum(). Sequence numbers are typically used to
962 	 * indicate that a event corresponds to some other set of events or messages,
963 	 * for example an EOS event corresponding to a SEEK event. It is considered good
964 	 * practice to make this correspondence when possible, though it is not
965 	 * required.
966 	 *
967 	 * Note that events and messages share the same sequence number incrementor;
968 	 * two events or messages will never have the same sequence number unless
969 	 * that correspondence was made explicitly.
970 	 *
971 	 * Returns: The event's sequence number.
972 	 *
973 	 *     MT safe.
974 	 */
975 	public uint getSeqnum()
976 	{
977 		return gst_event_get_seqnum(gstEvent);
978 	}
979 
980 	/**
981 	 * Access the structure of the event.
982 	 *
983 	 * Returns: The structure of the event. The structure is still
984 	 *     owned by the event, which means that you should not free it and
985 	 *     that the pointer becomes invalid when you free the event.
986 	 *
987 	 *     MT safe.
988 	 */
989 	public Structure getStructure()
990 	{
991 		auto p = gst_event_get_structure(gstEvent);
992 
993 		if(p is null)
994 		{
995 			return null;
996 		}
997 
998 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
999 	}
1000 
1001 	/**
1002 	 * Checks if @event has the given @name. This function is usually used to
1003 	 * check the name of a custom event.
1004 	 *
1005 	 * Params:
1006 	 *     name = name to check
1007 	 *
1008 	 * Returns: %TRUE if @name matches the name of the event structure.
1009 	 */
1010 	public bool hasName(string name)
1011 	{
1012 		return gst_event_has_name(gstEvent, Str.toStringz(name)) != 0;
1013 	}
1014 
1015 	/**
1016 	 * Get the format, minsize, maxsize and async-flag in the buffersize event.
1017 	 *
1018 	 * Params:
1019 	 *     format = A pointer to store the format in
1020 	 *     minsize = A pointer to store the minsize in
1021 	 *     maxsize = A pointer to store the maxsize in
1022 	 *     async = A pointer to store the async-flag in
1023 	 */
1024 	public void parseBufferSize(out GstFormat format, out long minsize, out long maxsize, out bool async)
1025 	{
1026 		int outasync;
1027 
1028 		gst_event_parse_buffer_size(gstEvent, &format, &minsize, &maxsize, &outasync);
1029 
1030 		async = (outasync == 1);
1031 	}
1032 
1033 	/**
1034 	 * Get the caps from @event. The caps remains valid as long as @event remains
1035 	 * valid.
1036 	 *
1037 	 * Params:
1038 	 *     caps = A pointer to the caps
1039 	 */
1040 	public void parseCaps(out Caps caps)
1041 	{
1042 		GstCaps* outcaps = null;
1043 
1044 		gst_event_parse_caps(gstEvent, &outcaps);
1045 
1046 		caps = ObjectG.getDObject!(Caps)(outcaps);
1047 	}
1048 
1049 	/**
1050 	 * Parse the FLUSH_STOP event and retrieve the @reset_time member.
1051 	 *
1052 	 * Params:
1053 	 *     resetTime = if time should be reset
1054 	 */
1055 	public void parseFlushStop(out bool resetTime)
1056 	{
1057 		int outresetTime;
1058 
1059 		gst_event_parse_flush_stop(gstEvent, &outresetTime);
1060 
1061 		resetTime = (outresetTime == 1);
1062 	}
1063 
1064 	/**
1065 	 * Extract timestamp and duration from a new GAP event.
1066 	 *
1067 	 * Params:
1068 	 *     timestamp = location where to store the
1069 	 *         start time (pts) of the gap, or %NULL
1070 	 *     duration = location where to store the duration of
1071 	 *         the gap, or %NULL
1072 	 */
1073 	public void parseGap(out GstClockTime timestamp, out GstClockTime duration)
1074 	{
1075 		gst_event_parse_gap(gstEvent, &timestamp, &duration);
1076 	}
1077 
1078 	/**
1079 	 *
1080 	 * Params:
1081 	 *     groupId = address of variable where to store the group id
1082 	 * Returns: %TRUE if a group id was set on the event and could be parsed,
1083 	 *     %FALSE otherwise.
1084 	 *
1085 	 * Since: 1.2
1086 	 */
1087 	public bool parseGroupId(out uint groupId)
1088 	{
1089 		return gst_event_parse_group_id(gstEvent, &groupId) != 0;
1090 	}
1091 
1092 	/**
1093 	 * Get the latency in the latency event.
1094 	 *
1095 	 * Params:
1096 	 *     latency = A pointer to store the latency in.
1097 	 */
1098 	public void parseLatency(out GstClockTime latency)
1099 	{
1100 		gst_event_parse_latency(gstEvent, &latency);
1101 	}
1102 
1103 	/**
1104 	 * Parses an event containing protection system specific information and stores
1105 	 * the results in @system_id, @data and @origin. The data stored in @system_id,
1106 	 * @origin and @data are valid until @event is released.
1107 	 *
1108 	 * Params:
1109 	 *     systemId = pointer to store the UUID
1110 	 *         string uniquely identifying a content protection system.
1111 	 *     data = pointer to store a #GstBuffer
1112 	 *         holding protection system specific information.
1113 	 *     origin = pointer to store a value that
1114 	 *         indicates where the protection information carried by @event was extracted
1115 	 *         from.
1116 	 *
1117 	 * Since: 1.6
1118 	 */
1119 	public void parseProtection(out string systemId, out Buffer data, string[] origin)
1120 	{
1121 		char* outsystemId = null;
1122 		GstBuffer* outdata = null;
1123 
1124 		gst_event_parse_protection(gstEvent, &outsystemId, &outdata, Str.toStringzArray(origin));
1125 
1126 		systemId = Str.toString(outsystemId);
1127 		data = ObjectG.getDObject!(Buffer)(outdata);
1128 	}
1129 
1130 	/**
1131 	 * Get the type, proportion, diff and timestamp in the qos event. See
1132 	 * gst_event_new_qos() for more information about the different QoS values.
1133 	 *
1134 	 * @timestamp will be adjusted for any pad offsets of pads it was passing through.
1135 	 *
1136 	 * Params:
1137 	 *     type = A pointer to store the QoS type in
1138 	 *     proportion = A pointer to store the proportion in
1139 	 *     diff = A pointer to store the diff in
1140 	 *     timestamp = A pointer to store the timestamp in
1141 	 */
1142 	public void parseQos(out GstQOSType type, out double proportion, out GstClockTimeDiff diff, out GstClockTime timestamp)
1143 	{
1144 		gst_event_parse_qos(gstEvent, &type, &proportion, &diff, &timestamp);
1145 	}
1146 
1147 	/**
1148 	 * Parses a seek @event and stores the results in the given result locations.
1149 	 *
1150 	 * Params:
1151 	 *     rate = result location for the rate
1152 	 *     format = result location for the stream format
1153 	 *     flags = result location for the #GstSeekFlags
1154 	 *     startType = result location for the #GstSeekType of the start position
1155 	 *     start = result location for the start position expressed in @format
1156 	 *     stopType = result location for the #GstSeekType of the stop position
1157 	 *     stop = result location for the stop position expressed in @format
1158 	 */
1159 	public void parseSeek(out double rate, out GstFormat format, out GstSeekFlags flags, out GstSeekType startType, out long start, out GstSeekType stopType, out long stop)
1160 	{
1161 		gst_event_parse_seek(gstEvent, &rate, &format, &flags, &startType, &start, &stopType, &stop);
1162 	}
1163 
1164 	/**
1165 	 * Parses a segment @event and stores the result in the given @segment location.
1166 	 * @segment remains valid only until the @event is freed. Don't modify the segment
1167 	 * and make a copy if you want to modify it or store it for later use.
1168 	 *
1169 	 * Params:
1170 	 *     segment = a pointer to a #GstSegment
1171 	 */
1172 	public void parseSegment(out Segment segment)
1173 	{
1174 		GstSegment* outsegment = null;
1175 
1176 		gst_event_parse_segment(gstEvent, &outsegment);
1177 
1178 		segment = ObjectG.getDObject!(Segment)(outsegment);
1179 	}
1180 
1181 	/**
1182 	 * Extracts the position and format from the segment done message.
1183 	 *
1184 	 * Params:
1185 	 *     format = Result location for the format, or %NULL
1186 	 *     position = Result location for the position, or %NULL
1187 	 */
1188 	public void parseSegmentDone(out GstFormat format, out long position)
1189 	{
1190 		gst_event_parse_segment_done(gstEvent, &format, &position);
1191 	}
1192 
1193 	/**
1194 	 * Parse the SELECT_STREAMS event and retrieve the contained streams.
1195 	 *
1196 	 * Params:
1197 	 *     streams = the streams
1198 	 *
1199 	 * Since: 1.10
1200 	 */
1201 	public void parseSelectStreams(out ListG streams)
1202 	{
1203 		GList* outstreams = null;
1204 
1205 		gst_event_parse_select_streams(gstEvent, &outstreams);
1206 
1207 		streams = new ListG(outstreams);
1208 	}
1209 
1210 	/**
1211 	 * Parse the sink-message event. Unref @msg after usage.
1212 	 *
1213 	 * Params:
1214 	 *     msg = a pointer to store the #GstMessage in.
1215 	 */
1216 	public void parseSinkMessage(out Message msg)
1217 	{
1218 		GstMessage* outmsg = null;
1219 
1220 		gst_event_parse_sink_message(gstEvent, &outmsg);
1221 
1222 		msg = ObjectG.getDObject!(Message)(outmsg);
1223 	}
1224 
1225 	/**
1226 	 * Parse the step event.
1227 	 *
1228 	 * Params:
1229 	 *     format = a pointer to store the format in
1230 	 *     amount = a pointer to store the amount in
1231 	 *     rate = a pointer to store the rate in
1232 	 *     flush = a pointer to store the flush boolean in
1233 	 *     intermediate = a pointer to store the intermediate
1234 	 *         boolean in
1235 	 */
1236 	public void parseStep(out GstFormat format, out ulong amount, out double rate, out bool flush, out bool intermediate)
1237 	{
1238 		int outflush;
1239 		int outintermediate;
1240 
1241 		gst_event_parse_step(gstEvent, &format, &amount, &rate, &outflush, &outintermediate);
1242 
1243 		flush = (outflush == 1);
1244 		intermediate = (outintermediate == 1);
1245 	}
1246 
1247 	/**
1248 	 * Parse a stream-start @event and extract the #GstStream from it.
1249 	 *
1250 	 * Params:
1251 	 *     stream = adress of variable to store the stream
1252 	 *
1253 	 * Since: 1.10
1254 	 */
1255 	public void parseStream(out Stream stream)
1256 	{
1257 		GstStream* outstream = null;
1258 
1259 		gst_event_parse_stream(gstEvent, &outstream);
1260 
1261 		stream = ObjectG.getDObject!(Stream)(outstream);
1262 	}
1263 
1264 	/**
1265 	 * Retrieve new #GstStreamCollection from STREAM_COLLECTION event @event.
1266 	 *
1267 	 * Params:
1268 	 *     collection = pointer to store the collection
1269 	 *
1270 	 * Since: 1.10
1271 	 */
1272 	public void parseStreamCollection(out StreamCollection collection)
1273 	{
1274 		GstStreamCollection* outcollection = null;
1275 
1276 		gst_event_parse_stream_collection(gstEvent, &outcollection);
1277 
1278 		collection = ObjectG.getDObject!(StreamCollection)(outcollection);
1279 	}
1280 
1281 	/** */
1282 	public void parseStreamFlags(out GstStreamFlags flags)
1283 	{
1284 		gst_event_parse_stream_flags(gstEvent, &flags);
1285 	}
1286 
1287 	/**
1288 	 * Parse a stream-group-done @event and store the result in the given
1289 	 * @group_id location.
1290 	 *
1291 	 * Params:
1292 	 *     groupId = address of variable to store the group id into
1293 	 *
1294 	 * Since: 1.10
1295 	 */
1296 	public void parseStreamGroupDone(out uint groupId)
1297 	{
1298 		gst_event_parse_stream_group_done(gstEvent, &groupId);
1299 	}
1300 
1301 	/**
1302 	 * Parse a stream-id @event and store the result in the given @stream_id
1303 	 * location. The string stored in @stream_id must not be modified and will
1304 	 * remain valid only until @event gets freed. Make a copy if you want to
1305 	 * modify it or store it for later use.
1306 	 *
1307 	 * Params:
1308 	 *     streamId = pointer to store the stream-id
1309 	 */
1310 	public void parseStreamStart(out string streamId)
1311 	{
1312 		char* outstreamId = null;
1313 
1314 		gst_event_parse_stream_start(gstEvent, &outstreamId);
1315 
1316 		streamId = Str.toString(outstreamId);
1317 	}
1318 
1319 	/**
1320 	 * Parses a tag @event and stores the results in the given @taglist location.
1321 	 * No reference to the taglist will be returned, it remains valid only until
1322 	 * the @event is freed. Don't modify or free the taglist, make a copy if you
1323 	 * want to modify it or store it for later use.
1324 	 *
1325 	 * Params:
1326 	 *     taglist = pointer to metadata list
1327 	 */
1328 	public void parseTag(out TagList taglist)
1329 	{
1330 		GstTagList* outtaglist = null;
1331 
1332 		gst_event_parse_tag(gstEvent, &outtaglist);
1333 
1334 		taglist = ObjectG.getDObject!(TagList)(outtaglist);
1335 	}
1336 
1337 	/**
1338 	 * Parse a TOC @event and store the results in the given @toc and @updated locations.
1339 	 *
1340 	 * Params:
1341 	 *     toc = pointer to #GstToc structure.
1342 	 *     updated = pointer to store TOC updated flag.
1343 	 */
1344 	public void parseToc(out Toc toc, out bool updated)
1345 	{
1346 		GstToc* outtoc = null;
1347 		int outupdated;
1348 
1349 		gst_event_parse_toc(gstEvent, &outtoc, &outupdated);
1350 
1351 		toc = ObjectG.getDObject!(Toc)(outtoc);
1352 		updated = (outupdated == 1);
1353 	}
1354 
1355 	/**
1356 	 * Parse a TOC select @event and store the results in the given @uid location.
1357 	 *
1358 	 * Params:
1359 	 *     uid = storage for the selection UID.
1360 	 */
1361 	public void parseTocSelect(out string uid)
1362 	{
1363 		char* outuid = null;
1364 
1365 		gst_event_parse_toc_select(gstEvent, &outuid);
1366 
1367 		uid = Str.toString(outuid);
1368 	}
1369 
1370 	/**
1371 	 * All streams that have the same group id are supposed to be played
1372 	 * together, i.e. all streams inside a container file should have the
1373 	 * same group id but different stream ids. The group id should change
1374 	 * each time the stream is started, resulting in different group ids
1375 	 * each time a file is played for example.
1376 	 *
1377 	 * Use gst_util_group_id_next() to get a new group id.
1378 	 *
1379 	 * Params:
1380 	 *     groupId = the group id to set
1381 	 *
1382 	 * Since: 1.2
1383 	 */
1384 	public void setGroupId(uint groupId)
1385 	{
1386 		gst_event_set_group_id(gstEvent, groupId);
1387 	}
1388 
1389 	/**
1390 	 * Set the running time offset of a event. See
1391 	 * gst_event_get_running_time_offset() for more information.
1392 	 *
1393 	 * MT safe.
1394 	 *
1395 	 * Params:
1396 	 *     offset = A the new running time offset
1397 	 *
1398 	 * Since: 1.4
1399 	 */
1400 	public void setRunningTimeOffset(long offset)
1401 	{
1402 		gst_event_set_running_time_offset(gstEvent, offset);
1403 	}
1404 
1405 	/**
1406 	 * Set the sequence number of a event.
1407 	 *
1408 	 * This function might be called by the creator of a event to indicate that the
1409 	 * event relates to other events or messages. See gst_event_get_seqnum() for
1410 	 * more information.
1411 	 *
1412 	 * MT safe.
1413 	 *
1414 	 * Params:
1415 	 *     seqnum = A sequence number.
1416 	 */
1417 	public void setSeqnum(uint seqnum)
1418 	{
1419 		gst_event_set_seqnum(gstEvent, seqnum);
1420 	}
1421 
1422 	/**
1423 	 * Set the @stream on the stream-start @event
1424 	 *
1425 	 * Params:
1426 	 *     stream = the stream object to set
1427 	 *
1428 	 * Since: 1.10
1429 	 */
1430 	public void setStream(Stream stream)
1431 	{
1432 		gst_event_set_stream(gstEvent, (stream is null) ? null : stream.getStreamStruct());
1433 	}
1434 
1435 	/** */
1436 	public void setStreamFlags(GstStreamFlags flags)
1437 	{
1438 		gst_event_set_stream_flags(gstEvent, flags);
1439 	}
1440 
1441 	/**
1442 	 * Get a writable version of the structure.
1443 	 *
1444 	 * Returns: The structure of the event. The structure
1445 	 *     is still owned by the event, which means that you should not free
1446 	 *     it and that the pointer becomes invalid when you free the event.
1447 	 *     This function checks if @event is writable and will never return
1448 	 *     %NULL.
1449 	 *
1450 	 *     MT safe.
1451 	 */
1452 	public Structure writableStructure()
1453 	{
1454 		auto p = gst_event_writable_structure(gstEvent);
1455 
1456 		if(p is null)
1457 		{
1458 			return null;
1459 		}
1460 
1461 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
1462 	}
1463 
1464 	/**
1465 	 * Gets the #GstEventTypeFlags associated with @type.
1466 	 *
1467 	 * Params:
1468 	 *     type = a #GstEventType
1469 	 *
1470 	 * Returns: a #GstEventTypeFlags.
1471 	 */
1472 	public static GstEventTypeFlags typeGetFlags(GstEventType type)
1473 	{
1474 		return gst_event_type_get_flags(type);
1475 	}
1476 
1477 	/**
1478 	 * Get a printable name for the given event type. Do not modify or free.
1479 	 *
1480 	 * Params:
1481 	 *     type = the event type
1482 	 *
1483 	 * Returns: a reference to the static name of the event.
1484 	 */
1485 	public static string typeGetName(GstEventType type)
1486 	{
1487 		return Str.toString(gst_event_type_get_name(type));
1488 	}
1489 
1490 	/**
1491 	 * Get the unique quark for the given event type.
1492 	 *
1493 	 * Params:
1494 	 *     type = the event type
1495 	 *
1496 	 * Returns: the quark associated with the event type
1497 	 */
1498 	public static GQuark typeToQuark(GstEventType type)
1499 	{
1500 		return gst_event_type_to_quark(type);
1501 	}
1502 }