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  * Conversion parameters:
26  * inFile  = gstreamer-GstEvent.html
27  * outPack = gstreamer
28  * outFile = Event
29  * strct   = GstEvent
30  * realStrct=
31  * ctorStrct=
32  * clss    = Event
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_event_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * 	- gst_event_new_eos
45  * 	- gst_event_new_flush_start
46  * 	- gst_event_new_toc_select
47  * omit signals:
48  * imports:
49  * 	- glib.Str
50  * 	- gstreamer.Caps
51  * 	- gstreamer.Message
52  * 	- gstreamer.Segment
53  * 	- gstreamer.Structure
54  * 	- gstreamer.TagList
55  * 	- gstreamer.Toc
56  * structWrap:
57  * 	- GstCaps* -> Caps
58  * 	- GstEvent* -> Event
59  * 	- GstMessage* -> Message
60  * 	- GstSegment* -> Segment
61  * 	- GstStructure* -> Structure
62  * 	- GstTagList* -> TagList
63  * 	- GstToc* -> Toc
64  * module aliases:
65  * local aliases:
66  * overrides:
67  */
68 
69 module gstreamer.Event;
70 
71 public  import gstreamerc.gstreamertypes;
72 
73 private import gstreamerc.gstreamer;
74 private import glib.ConstructionException;
75 private import gobject.ObjectG;
76 
77 
78 private import glib.Str;
79 private import gstreamer.Caps;
80 private import gstreamer.Message;
81 private import gstreamer.Segment;
82 private import gstreamer.Structure;
83 private import gstreamer.TagList;
84 private import gstreamer.Toc;
85 
86 
87 
88 
89 /**
90  * The event class provides factory methods to construct events for sending
91  * and functions to query (parse) received events.
92  *
93  * Events are usually created with gst_event_new_*() which takes event-type
94  * specific parameters as arguments.
95  * To send an event application will usually use gst_element_send_event() and
96  * elements will use gst_pad_send_event() or gst_pad_push_event().
97  * The event should be unreffed with gst_event_unref() if it has not been sent.
98  *
99  * Events that have been received can be parsed with their respective
100  * gst_event_parse_*() functions. It is valid to pass NULL for unwanted details.
101  *
102  * Events are passed between elements in parallel to the data stream. Some events
103  * are serialized with buffers, others are not. Some events only travel downstream,
104  * others only upstream. Some events can travel both upstream and downstream.
105  *
106  * The events are used to signal special conditions in the datastream such as
107  * EOS (end of stream) or the start of a new stream-segment.
108  * Events are also used to flush the pipeline of any pending data.
109  *
110  * Most of the event API is used inside plugins. Applications usually only
111  * construct and use seek events.
112  * To do that gst_event_new_seek() is used to create a seek event. It takes
113  * the needed parameters to specify seeking time and mode.
114  *
115  * $(DDOC_COMMENT example)
116  *
117  * Last reviewed on 2012-03-28 (0.11.3)
118  */
119 public class Event
120 {
121 	
122 	/** the main Gtk struct */
123 	protected GstEvent* gstEvent;
124 	
125 	
126 	public GstEvent* getEventStruct()
127 	{
128 		return gstEvent;
129 	}
130 	
131 	
132 	/** the main Gtk struct as a void* */
133 	protected void* getStruct()
134 	{
135 		return cast(void*)gstEvent;
136 	}
137 	
138 	/**
139 	 * Sets our main struct and passes it to the parent class
140 	 */
141 	public this (GstEvent* gstEvent)
142 	{
143 		this.gstEvent = gstEvent;
144 	}
145 	
146 	/**
147 	 * Create a new EOS event. The eos event can only travel downstream
148 	 * synchronized with the buffer flow. Elements that receive the EOS
149 	 * event on a pad can return UNEXPECTED as a GstFlowReturn when data
150 	 * after the EOS event arrives.
151 	 * The EOS event will travel down to the sink elements in the pipeline
152 	 * which will then post the GST_MESSAGE_EOS on the bus after they have
153 	 * finished playing any buffered data.
154 	 * When all sinks have posted an EOS message, the EOS message is
155 	 * forwarded to the application.
156 	 * Returns:
157 	 *  The new EOS event.
158 	 */
159 	public static Event newEOS()
160 	{
161 		// GstEvent* gst_event_new_eos (void);
162 		auto p = gst_event_new_eos();
163 		
164 		if(p is null)
165 		{
166 			throw new ConstructionException("null returned by gst_event_new_eos");
167 		}
168 		
169 		return new Event(cast(GstEvent*)p );
170 	}	/**
171 	 * Allocate a new flush start event. The flush start event can be send
172 	 * upstream and downstream and travels out-of-bounds with the dataflow.
173 	 * It marks pads as being in a WRONG_STATE to process more data.
174 	 * Elements unlock and blocking functions and exit their streaming functions
175 	 * as fast as possible.
176 	 * This event is typically generated after a seek to minimize the latency
177 	 * after the seek.
178 	 * Returns:
179 	 *  A new flush start event.
180 	 */
181 	public static Event newFlushStart()
182 	{
183 		// GstEvent* gst_event_new_flush_start (void);
184 		auto p = gst_event_new_flush_start();
185 		
186 		if(p is null)
187 		{
188 			throw new ConstructionException("null returned by gst_event_new_flush_start");
189 		}
190 		
191 		return new Event(cast(GstEvent*)p );
192 	}	/**
193 	 * Generate a TOC select event with the given uid. The purpose of the
194 	 * TOC select event is to start playback based on the TOC's entry with
195 	 * the given uid.
196 	 */
197 	public static Event newTocSelect(string uid)
198 	{
199 		// GstEvent* gst_event_new_toc_select (const gchar *uid);
200 		auto p = gst_event_new_toc_select(cast(char*)uid.ptr);
201 		
202 		if(p is null)
203 		{
204 			throw new ConstructionException("null returned by gst_event_new_toc_select");
205 		}
206 		
207 		return new Event(cast(GstEvent*)p );
208 	}
209 	
210 	/**
211 	 */
212 	
213 	/**
214 	 * Gets the GstEventTypeFlags associated with type.
215 	 * Params:
216 	 * type = a GstEventType
217 	 * Returns: a GstEventTypeFlags.
218 	 */
219 	public static GstEventTypeFlags typeGetFlags(GstEventType type)
220 	{
221 		// GstEventTypeFlags gst_event_type_get_flags (GstEventType type);
222 		return gst_event_type_get_flags(type);
223 	}
224 	
225 	/**
226 	 * Get a printable name for the given event type. Do not modify or free.
227 	 * Params:
228 	 * type = the event type
229 	 * Returns: a reference to the static name of the event.
230 	 */
231 	public static string typeGetName(GstEventType type)
232 	{
233 		// const gchar * gst_event_type_get_name (GstEventType type);
234 		return Str.toString(gst_event_type_get_name(type));
235 	}
236 	
237 	/**
238 	 * Get the unique quark for the given event type.
239 	 * Params:
240 	 * type = the event type
241 	 * Returns: the quark associated with the event type
242 	 */
243 	public static GQuark typeToQuark(GstEventType type)
244 	{
245 		// GQuark gst_event_type_to_quark (GstEventType type);
246 		return gst_event_type_to_quark(type);
247 	}
248 	
249 	/**
250 	 * Increase the refcount of this event.
251 	 * Returns: event (for convenience when doing assignments). [transfer full]
252 	 */
253 	public Event doref()
254 	{
255 		// GstEvent * gst_event_ref (GstEvent *event);
256 		auto p = gst_event_ref(gstEvent);
257 		
258 		if(p is null)
259 		{
260 			return null;
261 		}
262 		
263 		return ObjectG.getDObject!(Event)(cast(GstEvent*) p);
264 	}
265 	
266 	/**
267 	 * Decrease the refcount of an event, freeing it if the refcount reaches 0.
268 	 */
269 	public void unref()
270 	{
271 		// void gst_event_unref (GstEvent *event);
272 		gst_event_unref(gstEvent);
273 	}
274 	
275 	/**
276 	 * Modifies a pointer to a GstEvent to point to a different GstEvent. The
277 	 * modification is done atomically (so this is useful for ensuring thread safety
278 	 * in some cases), and the reference counts are updated appropriately (the old
279 	 * event is unreffed, the new one is reffed).
280 	 * Either new_event or the GstEvent pointed to by old_event may be NULL.
281 	 * Params:
282 	 * oldEvent = pointer to a pointer to a GstEvent
283 	 * to be replaced. [inout][transfer full]
284 	 * newEvent = pointer to a GstEvent that will
285 	 * replace the event pointed to by old_event. [allow-none][transfer none]
286 	 * Returns: TRUE if new_event was different from old_event
287 	 */
288 	public static int replace(ref Event oldEvent, Event newEvent)
289 	{
290 		// gboolean gst_event_replace (GstEvent **old_event,  GstEvent *new_event);
291 		GstEvent* outoldEvent = (oldEvent is null) ? null : oldEvent.getEventStruct();
292 		
293 		auto p = gst_event_replace(&outoldEvent, (newEvent is null) ? null : newEvent.getEventStruct());
294 		
295 		oldEvent = ObjectG.getDObject!(Event)(outoldEvent);
296 		return p;
297 	}
298 	
299 	/**
300 	 * Copy the event using the event specific copy function.
301 	 * Returns: the new event. [transfer full]
302 	 */
303 	public Event copy()
304 	{
305 		// GstEvent * gst_event_copy (const GstEvent *event);
306 		auto p = gst_event_copy(gstEvent);
307 		
308 		if(p is null)
309 		{
310 			return null;
311 		}
312 		
313 		return ObjectG.getDObject!(Event)(cast(GstEvent*) p);
314 	}
315 	
316 	/**
317 	 * Atomically replace the GstEvent pointed to by old_event with NULL and
318 	 * return the original event.
319 	 * Params:
320 	 * oldEvent = pointer to a pointer to a GstEvent
321 	 * to be stolen. [inout][transfer full]
322 	 * Returns: the GstEvent that was in old_event
323 	 */
324 	public static Event steal(ref Event oldEvent)
325 	{
326 		// GstEvent * gst_event_steal (GstEvent **old_event);
327 		GstEvent* outoldEvent = (oldEvent is null) ? null : oldEvent.getEventStruct();
328 		
329 		auto p = gst_event_steal(&outoldEvent);
330 		
331 		oldEvent = ObjectG.getDObject!(Event)(outoldEvent);
332 		
333 		if(p is null)
334 		{
335 			return null;
336 		}
337 		
338 		return ObjectG.getDObject!(Event)(cast(GstEvent*) p);
339 	}
340 	
341 	/**
342 	 * Modifies a pointer to a GstEvent to point to a different GstEvent. This
343 	 * function is similar to gst_event_replace() except that it takes ownership of
344 	 * new_event.
345 	 * Either new_event or the GstEvent pointed to by old_event may be NULL.
346 	 * Params:
347 	 * oldEvent = pointer to a pointer to a GstEvent
348 	 * to be stolen. [inout][transfer full]
349 	 * newEvent = pointer to a GstEvent that will
350 	 * replace the event pointed to by old_event. [allow-none][transfer full]
351 	 * Returns: TRUE if new_event was different from old_event
352 	 */
353 	public static int take(ref Event oldEvent, Event newEvent)
354 	{
355 		// gboolean gst_event_take (GstEvent **old_event,  GstEvent *new_event);
356 		GstEvent* outoldEvent = (oldEvent is null) ? null : oldEvent.getEventStruct();
357 		
358 		auto p = gst_event_take(&outoldEvent, (newEvent is null) ? null : newEvent.getEventStruct());
359 		
360 		oldEvent = ObjectG.getDObject!(Event)(outoldEvent);
361 		return p;
362 	}
363 	
364 	/**
365 	 * Get a writable version of the structure.
366 	 * Returns: The structure of the event. The structure is still owned by the event, which means that you should not free it and that the pointer becomes invalid when you free the event. This function checks if event is writable and will never return NULL. MT safe.
367 	 */
368 	public Structure writableStructure()
369 	{
370 		// GstStructure * gst_event_writable_structure (GstEvent *event);
371 		auto p = gst_event_writable_structure(gstEvent);
372 		
373 		if(p is null)
374 		{
375 			return null;
376 		}
377 		
378 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
379 	}
380 	
381 	/**
382 	 * Create a new custom-typed event. This can be used for anything not
383 	 * handled by other event-specific functions to pass an event to another
384 	 * element.
385 	 * Make sure to allocate an event type with the GST_EVENT_MAKE_TYPE macro,
386 	 * assigning a free number and filling in the correct direction and
387 	 * serialization flags.
388 	 * New custom events can also be created by subclassing the event type if
389 	 * needed.
390 	 * Params:
391 	 * type = The type of the new event
392 	 * structure = the structure for the event. The event will
393 	 * take ownership of the structure. [transfer full]
394 	 * Throws: ConstructionException GTK+ fails to create the object.
395 	 */
396 	public this (GstEventType type, Structure structure)
397 	{
398 		// GstEvent * gst_event_new_custom (GstEventType type,  GstStructure *structure);
399 		auto p = gst_event_new_custom(type, (structure is null) ? null : structure.getStructureStruct());
400 		if(p is null)
401 		{
402 			throw new ConstructionException("null returned by gst_event_new_custom(type, (structure is null) ? null : structure.getStructureStruct())");
403 		}
404 		this(cast(GstEvent*) p);
405 	}
406 	
407 	/**
408 	 * Access the structure of the event.
409 	 * Returns: The structure of the event. The structure is still owned by the event, which means that you should not free it and that the pointer becomes invalid when you free the event. MT safe.
410 	 */
411 	public Structure getStructure()
412 	{
413 		// const GstStructure * gst_event_get_structure (GstEvent *event);
414 		auto p = gst_event_get_structure(gstEvent);
415 		
416 		if(p is null)
417 		{
418 			return null;
419 		}
420 		
421 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
422 	}
423 	
424 	/**
425 	 * Checks if event has the given name. This function is usually used to
426 	 * check the name of a custom event.
427 	 * Params:
428 	 * name = name to check
429 	 * Returns: TRUE if name matches the name of the event structure.
430 	 */
431 	public int hasName(string name)
432 	{
433 		// gboolean gst_event_has_name (GstEvent *event,  const gchar *name);
434 		return gst_event_has_name(gstEvent, Str.toStringz(name));
435 	}
436 	
437 	/**
438 	 * Retrieve the sequence number of a event.
439 	 * Events have ever-incrementing sequence numbers, which may also be set
440 	 * explicitly via gst_event_set_seqnum(). Sequence numbers are typically used to
441 	 * indicate that a event corresponds to some other set of events or messages,
442 	 * for example an EOS event corresponding to a SEEK event. It is considered good
443 	 * practice to make this correspondence when possible, though it is not
444 	 * required.
445 	 * Note that events and messages share the same sequence number incrementor;
446 	 * two events or messages will never have the same sequence number unless
447 	 * that correspondence was made explicitly.
448 	 * Returns: The event's sequence number. MT safe.
449 	 */
450 	public uint getSeqnum()
451 	{
452 		// guint32 gst_event_get_seqnum (GstEvent *event);
453 		return gst_event_get_seqnum(gstEvent);
454 	}
455 	
456 	/**
457 	 * Set the sequence number of a event.
458 	 * This function might be called by the creator of a event to indicate that the
459 	 * event relates to other events or messages. See gst_event_get_seqnum() for
460 	 * more information.
461 	 * MT safe.
462 	 * Params:
463 	 * seqnum = A sequence number.
464 	 */
465 	public void setSeqnum(uint seqnum)
466 	{
467 		// void gst_event_set_seqnum (GstEvent *event,  guint32 seqnum);
468 		gst_event_set_seqnum(gstEvent, seqnum);
469 	}
470 	
471 	/**
472 	 * Allocate a new flush stop event. The flush stop event can be sent
473 	 * upstream and downstream and travels serialized with the dataflow.
474 	 * It is typically sent after sending a FLUSH_START event to make the
475 	 * pads accept data again.
476 	 * Elements can process this event synchronized with the dataflow since
477 	 * the preceeding FLUSH_START event stopped the dataflow.
478 	 * This event is typically generated to complete a seek and to resume
479 	 * dataflow.
480 	 * Params:
481 	 * resetTime = if time should be reset
482 	 * Throws: ConstructionException GTK+ fails to create the object.
483 	 */
484 	public this (int resetTime)
485 	{
486 		// GstEvent * gst_event_new_flush_stop (gboolean reset_time);
487 		auto p = gst_event_new_flush_stop(resetTime);
488 		if(p is null)
489 		{
490 			throw new ConstructionException("null returned by gst_event_new_flush_stop(resetTime)");
491 		}
492 		this(cast(GstEvent*) p);
493 	}
494 	
495 	/**
496 	 * Parse the FLUSH_STOP event and retrieve the reset_time member.
497 	 * Params:
498 	 * resetTime = if time should be reset. [out]
499 	 */
500 	public void parseFlushStop(out int resetTime)
501 	{
502 		// void gst_event_parse_flush_stop (GstEvent *event,  gboolean *reset_time);
503 		gst_event_parse_flush_stop(gstEvent, &resetTime);
504 	}
505 	
506 	/**
507 	 * Create a new GAP event. A gap event can be thought of as conceptually
508 	 * equivalent to a buffer to signal that there is no data for a certain
509 	 * amount of time. This is useful to signal a gap to downstream elements
510 	 * which may wait for data, such as muxers or mixers or overlays, especially
511 	 * for sparse streams such as subtitle streams.
512 	 * Params:
513 	 * timestamp = the start time (pts) of the gap
514 	 * duration = the duration of the gap
515 	 * Throws: ConstructionException GTK+ fails to create the object.
516 	 */
517 	public this (GstClockTime timestamp, GstClockTime duration)
518 	{
519 		// GstEvent * gst_event_new_gap (GstClockTime timestamp,  GstClockTime duration);
520 		auto p = gst_event_new_gap(timestamp, duration);
521 		if(p is null)
522 		{
523 			throw new ConstructionException("null returned by gst_event_new_gap(timestamp, duration)");
524 		}
525 		this(cast(GstEvent*) p);
526 	}
527 	
528 	/**
529 	 * Extract timestamp and duration from a new GAP event.
530 	 * Params:
531 	 * timestamp = location where to store the
532 	 * start time (pts) of the gap, or NULL. [out][allow-none]
533 	 * duration = location where to store the duration of
534 	 * the gap, or NULL. [out][allow-none]
535 	 */
536 	public void parseGap(out GstClockTime timestamp, out GstClockTime duration)
537 	{
538 		// void gst_event_parse_gap (GstEvent *event,  GstClockTime *timestamp,  GstClockTime *duration);
539 		gst_event_parse_gap(gstEvent, &timestamp, &duration);
540 	}
541 	
542 	/**
543 	 * Create a new STREAM_START event. The stream start event can only
544 	 * travel downstream synchronized with the buffer flow. It is expected
545 	 * to be the first event that is sent for a new stream.
546 	 * Source elements, demuxers and other elements that create new streams
547 	 * are supposed to send this event as the first event of a new stream. It
548 	 * should not be send after a flushing seek or in similar situations
549 	 * and is used to mark the beginning of a new logical stream. Elements
550 	 * combining multiple streams must ensure that this event is only forwarded
551 	 * downstream once and not for every single input stream.
552 	 * The stream_id should be a unique string that consists of the upstream
553 	 * stream-id, / as separator and a unique stream-id for this specific
554 	 * stream. A new stream-id should only be created for a stream if the upstream
555 	 * stream is split into (potentially) multiple new streams, e.g. in a demuxer,
556 	 * but not for every single element in the pipeline.
557 	 * gst_pad_create_stream_id() or gst_pad_create_stream_id_printf() can be
558 	 * used to create a stream-id.
559 	 * Params:
560 	 * streamId = Identifier for this stream
561 	 * Throws: ConstructionException GTK+ fails to create the object.
562 	 */
563 	public this (string streamId)
564 	{
565 		// GstEvent * gst_event_new_stream_start (const gchar *stream_id);
566 		auto p = gst_event_new_stream_start(Str.toStringz(streamId));
567 		if(p is null)
568 		{
569 			throw new ConstructionException("null returned by gst_event_new_stream_start(Str.toStringz(streamId))");
570 		}
571 		this(cast(GstEvent*) p);
572 	}
573 	
574 	/**
575 	 * Parse a stream-id event and store the result in the given stream_id
576 	 * location. The string stored in stream_id must not be modified and will
577 	 * remain valid only until event gets freed. Make a copy if you want to
578 	 * modify it or store it for later use.
579 	 * Params:
580 	 * streamId = pointer to store the stream-id. [out][transfer none]
581 	 */
582 	public void parseStreamStart(out string streamId)
583 	{
584 		// void gst_event_parse_stream_start (GstEvent *event,  const gchar **stream_id);
585 		char* outstreamId = null;
586 		
587 		gst_event_parse_stream_start(gstEvent, &outstreamId);
588 		
589 		streamId = Str.toString(outstreamId);
590 	}
591 	
592 	/**
593 	 * Since 1.2
594 	 * Params:
595 	 * flags = the stream flags to set
596 	 */
597 	public void setStreamFlags(GstStreamFlags flags)
598 	{
599 		// void gst_event_set_stream_flags (GstEvent *event,  GstStreamFlags flags);
600 		gst_event_set_stream_flags(gstEvent, flags);
601 	}
602 	
603 	/**
604 	 * Since 1.2
605 	 * Params:
606 	 * flags = address of variable where to store the stream flags. [out]
607 	 */
608 	public void parseStreamFlags(out GstStreamFlags flags)
609 	{
610 		// void gst_event_parse_stream_flags (GstEvent *event,  GstStreamFlags *flags);
611 		gst_event_parse_stream_flags(gstEvent, &flags);
612 	}
613 	
614 	/**
615 	 * All streams that have the same group id are supposed to be played
616 	 * together, i.e. all streams inside a container file should have the
617 	 * same group id but different stream ids. The group id should change
618 	 * each time the stream is started, resulting in different group ids
619 	 * each time a file is played for example.
620 	 * Use gst_util_group_id_next() to get a new group id.
621 	 * Since 1.2
622 	 * Params:
623 	 * groupId = the group id to set
624 	 */
625 	public void setGroupId(uint groupId)
626 	{
627 		// void gst_event_set_group_id (GstEvent *event,  guint group_id);
628 		gst_event_set_group_id(gstEvent, groupId);
629 	}
630 	
631 	/**
632 	 * Since 1.2
633 	 * Params:
634 	 * groupId = address of variable where to store the group id. [out]
635 	 * Returns: TRUE if a group id was set on the event and could be parsed, FALSE otherwise.
636 	 */
637 	public int parseGroupId(out uint groupId)
638 	{
639 		// gboolean gst_event_parse_group_id (GstEvent *event,  guint *group_id);
640 		return gst_event_parse_group_id(gstEvent, &groupId);
641 	}
642 	
643 	/**
644 	 * Create a new SEGMENT event for segment. The segment event can only travel
645 	 * downstream synchronized with the buffer flow and contains timing information
646 	 * and playback properties for the buffers that will follow.
647 	 * The newsegment event marks the range of buffers to be processed. All
648 	 * data not within the segment range is not to be processed. This can be
649 	 * used intelligently by plugins to apply more efficient methods of skipping
650 	 * unneeded data. The valid range is expressed with the start and stop
651 	 * values.
652 	 * The time value of the segment is used in conjunction with the start
653 	 * value to convert the buffer timestamps into the stream time. This is
654 	 * usually done in sinks to report the current stream_time.
655 	 * time represents the stream_time of a buffer carrying a timestamp of
656 	 * start. time cannot be -1.
657 	 * start cannot be -1, stop can be -1. If there
658 	 * is a valid stop given, it must be greater or equal the start, including
659 	 * when the indicated playback rate is < 0.
660 	 * The applied_rate value provides information about any rate adjustment that
661 	 * has already been made to the timestamps and content on the buffers of the
662 	 * stream. (rate * applied_rate) should always equal the rate that has been
663 	 * requested for playback. For example, if an element has an input segment
664 	 * with intended playback rate of 2.0 and applied_rate of 1.0, it can adjust
665 	 * incoming timestamps and buffer content by half and output a newsegment event
666 	 * with rate of 1.0 and applied_rate of 2.0
667 	 * Params:
668 	 * segment = a GstSegment. [transfer none]
669 	 * Throws: ConstructionException GTK+ fails to create the object.
670 	 */
671 	public this (Segment segment)
672 	{
673 		// GstEvent * gst_event_new_segment (const GstSegment *segment);
674 		auto p = gst_event_new_segment((segment is null) ? null : segment.getSegmentStruct());
675 		if(p is null)
676 		{
677 			throw new ConstructionException("null returned by gst_event_new_segment((segment is null) ? null : segment.getSegmentStruct())");
678 		}
679 		this(cast(GstEvent*) p);
680 	}
681 	
682 	/**
683 	 * Parses a segment event and stores the result in the given segment location.
684 	 * segment remains valid only until the event is freed. Don't modify the segment
685 	 * and make a copy if you want to modify it or store it for later use.
686 	 * Params:
687 	 * segment = a pointer to a GstSegment. [out][transfer none]
688 	 */
689 	public void parseSegment(out Segment segment)
690 	{
691 		// void gst_event_parse_segment (GstEvent *event,  const GstSegment **segment);
692 		GstSegment* outsegment = null;
693 		
694 		gst_event_parse_segment(gstEvent, &outsegment);
695 		
696 		segment = ObjectG.getDObject!(Segment)(outsegment);
697 	}
698 	
699 	/**
700 	 * Parses a segment event and copies the GstSegment into the location
701 	 * given by segment.
702 	 * Params:
703 	 * segment = a pointer to a GstSegment
704 	 */
705 	public void copySegment(Segment segment)
706 	{
707 		// void gst_event_copy_segment (GstEvent *event,  GstSegment *segment);
708 		gst_event_copy_segment(gstEvent, (segment is null) ? null : segment.getSegmentStruct());
709 	}
710 	
711 	/**
712 	 * Generates a metadata tag event from the given taglist.
713 	 * The scope of the taglist specifies if the taglist applies to the
714 	 * complete medium or only to this specific stream. As the tag event
715 	 * is a sticky event, elements should merge tags received from
716 	 * upstream with a given scope with their own tags with the same
717 	 * scope and create a new tag event from it.
718 	 * Params:
719 	 * taglist = metadata list. The event will take ownership
720 	 * of the taglist. [transfer full]
721 	 * Throws: ConstructionException GTK+ fails to create the object.
722 	 */
723 	public this (TagList taglist)
724 	{
725 		// GstEvent * gst_event_new_tag (GstTagList *taglist);
726 		auto p = gst_event_new_tag((taglist is null) ? null : taglist.getTagListStruct());
727 		if(p is null)
728 		{
729 			throw new ConstructionException("null returned by gst_event_new_tag((taglist is null) ? null : taglist.getTagListStruct())");
730 		}
731 		this(cast(GstEvent*) p);
732 	}
733 	
734 	/**
735 	 * Parses a tag event and stores the results in the given taglist location.
736 	 * No reference to the taglist will be returned, it remains valid only until
737 	 * the event is freed. Don't modify or free the taglist, make a copy if you
738 	 * want to modify it or store it for later use.
739 	 * Params:
740 	 * taglist = pointer to metadata list. [out][transfer none]
741 	 */
742 	public void parseTag(out TagList taglist)
743 	{
744 		// void gst_event_parse_tag (GstEvent *event,  GstTagList **taglist);
745 		GstTagList* outtaglist = null;
746 		
747 		gst_event_parse_tag(gstEvent, &outtaglist);
748 		
749 		taglist = ObjectG.getDObject!(TagList)(outtaglist);
750 	}
751 	
752 	/**
753 	 * Create a new buffersize event. The event is sent downstream and notifies
754 	 * elements that they should provide a buffer of the specified dimensions.
755 	 * When the async flag is set, a thread boundary is preferred.
756 	 * Params:
757 	 * format = buffer format
758 	 * minsize = minimum buffer size
759 	 * maxsize = maximum buffer size
760 	 * async = thread behavior
761 	 * Throws: ConstructionException GTK+ fails to create the object.
762 	 */
763 	public this (GstFormat format, long minsize, long maxsize, int async)
764 	{
765 		// GstEvent * gst_event_new_buffer_size (GstFormat format,  gint64 minsize,  gint64 maxsize,  gboolean async);
766 		auto p = gst_event_new_buffer_size(format, minsize, maxsize, async);
767 		if(p is null)
768 		{
769 			throw new ConstructionException("null returned by gst_event_new_buffer_size(format, minsize, maxsize, async)");
770 		}
771 		this(cast(GstEvent*) p);
772 	}
773 	
774 	/**
775 	 * Get the format, minsize, maxsize and async-flag in the buffersize event.
776 	 * Params:
777 	 * format = A pointer to store the format in. [out]
778 	 * minsize = A pointer to store the minsize in. [out]
779 	 * maxsize = A pointer to store the maxsize in. [out]
780 	 * async = A pointer to store the async-flag in. [out]
781 	 */
782 	public void parseBufferSize(out GstFormat format, out long minsize, out long maxsize, out int async)
783 	{
784 		// void gst_event_parse_buffer_size (GstEvent *event,  GstFormat *format,  gint64 *minsize,  gint64 *maxsize,  gboolean *async);
785 		gst_event_parse_buffer_size(gstEvent, &format, &minsize, &maxsize, &async);
786 	}
787 	
788 	/**
789 	 * Allocate a new qos event with the given values.
790 	 * The QOS event is generated in an element that wants an upstream
791 	 * element to either reduce or increase its rate because of
792 	 * high/low CPU load or other resource usage such as network performance or
793 	 * throttling. Typically sinks generate these events for each buffer
794 	 * they receive.
795 	 * type indicates the reason for the QoS event. GST_QOS_TYPE_OVERFLOW is
796 	 * used when a buffer arrived in time or when the sink cannot keep up with
797 	 * the upstream datarate. GST_QOS_TYPE_UNDERFLOW is when the sink is not
798 	 * receiving buffers fast enough and thus has to drop late buffers.
799 	 * GST_QOS_TYPE_THROTTLE is used when the datarate is artificially limited
800 	 * by the application, for example to reduce power consumption.
801 	 * proportion indicates the real-time performance of the streaming in the
802 	 * element that generated the QoS event (usually the sink). The value is
803 	 * generally computed based on more long term statistics about the streams
804 	 * timestamps compared to the clock.
805 	 * A value < 1.0 indicates that the upstream element is producing data faster
806 	 * than real-time. A value > 1.0 indicates that the upstream element is not
807 	 * producing data fast enough. 1.0 is the ideal proportion value. The
808 	 * proportion value can safely be used to lower or increase the quality of
809 	 * the element.
810 	 * diff is the difference against the clock in running time of the last
811 	 * buffer that caused the element to generate the QOS event. A negative value
812 	 * means that the buffer with timestamp arrived in time. A positive value
813 	 * indicates how late the buffer with timestamp was. When throttling is
814 	 * enabled, diff will be set to the requested throttling interval.
815 	 * timestamp is the timestamp of the last buffer that cause the element
816 	 * to generate the QOS event. It is expressed in running time and thus an ever
817 	 * increasing value.
818 	 * The upstream element can use the diff and timestamp values to decide
819 	 * whether to process more buffers. For possitive diff, all buffers with
820 	 * timestamp <= timestamp + diff will certainly arrive late in the sink
821 	 * as well. A (negative) diff value so that timestamp + diff would yield a
822 	 * result smaller than 0 is not allowed.
823 	 * The application can use general event probes to intercept the QoS
824 	 * event and implement custom application specific QoS handling.
825 	 * Params:
826 	 * type = the QoS type
827 	 * proportion = the proportion of the qos message
828 	 * diff = The time difference of the last Clock sync
829 	 * timestamp = The timestamp of the buffer
830 	 * Throws: ConstructionException GTK+ fails to create the object.
831 	 */
832 	public this (GstQOSType type, double proportion, GstClockTimeDiff diff, GstClockTime timestamp)
833 	{
834 		// GstEvent * gst_event_new_qos (GstQOSType type,  gdouble proportion,  GstClockTimeDiff diff,  GstClockTime timestamp);
835 		auto p = gst_event_new_qos(type, proportion, diff, timestamp);
836 		if(p is null)
837 		{
838 			throw new ConstructionException("null returned by gst_event_new_qos(type, proportion, diff, timestamp)");
839 		}
840 		this(cast(GstEvent*) p);
841 	}
842 	
843 	/**
844 	 * Get the type, proportion, diff and timestamp in the qos event. See
845 	 * gst_event_new_qos() for more information about the different QoS values.
846 	 * Params:
847 	 * type = A pointer to store the QoS type in. [out]
848 	 * proportion = A pointer to store the proportion in. [out]
849 	 * diff = A pointer to store the diff in. [out]
850 	 * timestamp = A pointer to store the timestamp in. [out]
851 	 */
852 	public void parseQos(out GstQOSType type, out double proportion, out GstClockTimeDiff diff, out GstClockTime timestamp)
853 	{
854 		// void gst_event_parse_qos (GstEvent *event,  GstQOSType *type,  gdouble *proportion,  GstClockTimeDiff *diff,  GstClockTime *timestamp);
855 		gst_event_parse_qos(gstEvent, &type, &proportion, &diff, &timestamp);
856 	}
857 	
858 	/**
859 	 * Allocate a new seek event with the given parameters.
860 	 * The seek event configures playback of the pipeline between start to stop
861 	 * at the speed given in rate, also called a playback segment.
862 	 * The start and stop values are expressed in format.
863 	 * A rate of 1.0 means normal playback rate, 2.0 means double speed.
864 	 * Negatives values means backwards playback. A value of 0.0 for the
865 	 * rate is not allowed and should be accomplished instead by PAUSING the
866 	 * pipeline.
867 	 * A pipeline has a default playback segment configured with a start
868 	 * position of 0, a stop position of -1 and a rate of 1.0. The currently
869 	 * configured playback segment can be queried with GST_QUERY_SEGMENT.
870 	 * start_type and stop_type specify how to adjust the currently configured
871 	 * start and stop fields in playback segment. Adjustments can be made relative
872 	 * or absolute to the last configured values. A type of GST_SEEK_TYPE_NONE
873 	 * means that the position should not be updated.
874 	 * When the rate is positive and start has been updated, playback will start
875 	 * from the newly configured start position.
876 	 * For negative rates, playback will start from the newly configured stop
877 	 * position (if any). If the stop position is updated, it must be different from
878 	 * -1 (GST_CLOCK_TIME_NONE) for negative rates.
879 	 * It is not possible to seek relative to the current playback position, to do
880 	 * this, PAUSE the pipeline, query the current playback position with
881 	 * GST_QUERY_POSITION and update the playback segment current position with a
882 	 * GST_SEEK_TYPE_SET to the desired position.
883 	 * Params:
884 	 * rate = The new playback rate
885 	 * format = The format of the seek values
886 	 * flags = The optional seek flags
887 	 * startType = The type and flags for the new start position
888 	 * start = The value of the new start position
889 	 * stopType = The type and flags for the new stop position
890 	 * stop = The value of the new stop position
891 	 * Throws: ConstructionException GTK+ fails to create the object.
892 	 */
893 	public this (double rate, GstFormat format, GstSeekFlags flags, GstSeekType startType, long start, GstSeekType stopType, long stop)
894 	{
895 		// GstEvent * gst_event_new_seek (gdouble rate,  GstFormat format,  GstSeekFlags flags,  GstSeekType start_type,  gint64 start,  GstSeekType stop_type,  gint64 stop);
896 		auto p = gst_event_new_seek(rate, format, flags, startType, start, stopType, stop);
897 		if(p is null)
898 		{
899 			throw new ConstructionException("null returned by gst_event_new_seek(rate, format, flags, startType, start, stopType, stop)");
900 		}
901 		this(cast(GstEvent*) p);
902 	}
903 	
904 	/**
905 	 * Parses a seek event and stores the results in the given result locations.
906 	 * Params:
907 	 * rate = result location for the rate. [out]
908 	 * format = result location for the stream format. [out]
909 	 * flags = result location for the GstSeekFlags. [out]
910 	 * startType = result location for the GstSeekType of the start position. [out]
911 	 * start = result location for the start postion expressed in format. [out]
912 	 * stopType = result location for the GstSeekType of the stop position. [out]
913 	 * stop = result location for the stop postion expressed in format. [out]
914 	 */
915 	public void parseSeek(out double rate, out GstFormat format, out GstSeekFlags flags, out GstSeekType startType, out long start, out GstSeekType stopType, out long stop)
916 	{
917 		// void gst_event_parse_seek (GstEvent *event,  gdouble *rate,  GstFormat *format,  GstSeekFlags *flags,  GstSeekType *start_type,  gint64 *start,  GstSeekType *stop_type,  gint64 *stop);
918 		gst_event_parse_seek(gstEvent, &rate, &format, &flags, &startType, &start, &stopType, &stop);
919 	}
920 	
921 	/**
922 	 * Create a new navigation event from the given description.
923 	 * Params:
924 	 * structure = description of the event. The event will take
925 	 * ownership of the structure. [transfer full]
926 	 * Throws: ConstructionException GTK+ fails to create the object.
927 	 */
928 	public this (Structure structure)
929 	{
930 		// GstEvent * gst_event_new_navigation (GstStructure *structure);
931 		auto p = gst_event_new_navigation((structure is null) ? null : structure.getStructureStruct());
932 		if(p is null)
933 		{
934 			throw new ConstructionException("null returned by gst_event_new_navigation((structure is null) ? null : structure.getStructureStruct())");
935 		}
936 		this(cast(GstEvent*) p);
937 	}
938 	
939 	/**
940 	 * Create a new latency event. The event is sent upstream from the sinks and
941 	 * notifies elements that they should add an additional latency to the
942 	 * running time before synchronising against the clock.
943 	 * The latency is mostly used in live sinks and is always expressed in
944 	 * the time format.
945 	 * Params:
946 	 * latency = the new latency value
947 	 * Throws: ConstructionException GTK+ fails to create the object.
948 	 */
949 	public this (GstClockTime latency)
950 	{
951 		// GstEvent * gst_event_new_latency (GstClockTime latency);
952 		auto p = gst_event_new_latency(latency);
953 		if(p is null)
954 		{
955 			throw new ConstructionException("null returned by gst_event_new_latency(latency)");
956 		}
957 		this(cast(GstEvent*) p);
958 	}
959 	
960 	/**
961 	 * Get the latency in the latency event.
962 	 * Params:
963 	 * latency = A pointer to store the latency in. [out]
964 	 */
965 	public void parseLatency(ref GstClockTime latency)
966 	{
967 		// void gst_event_parse_latency (GstEvent *event,  GstClockTime *latency);
968 		gst_event_parse_latency(gstEvent, &latency);
969 	}
970 	
971 	/**
972 	 * Create a new step event. The purpose of the step event is to instruct a sink
973 	 * to skip amount (expressed in format) of media. It can be used to implement
974 	 * stepping through the video frame by frame or for doing fast trick modes.
975 	 * A rate of <= 0.0 is not allowed. Pause the pipeline, for the effect of rate
976 	 * = 0.0 or first reverse the direction of playback using a seek event to get
977 	 * the same effect as rate < 0.0.
978 	 * The flush flag will clear any pending data in the pipeline before starting
979 	 * the step operation.
980 	 * The intermediate flag instructs the pipeline that this step operation is
981 	 * part of a larger step operation.
982 	 * Params:
983 	 * format = the format of amount
984 	 * amount = the amount of data to step
985 	 * rate = the step rate
986 	 * flush = flushing steps
987 	 * intermediate = intermediate steps
988 	 * Throws: ConstructionException GTK+ fails to create the object.
989 	 */
990 	public this (GstFormat format, ulong amount, double rate, int flush, int intermediate)
991 	{
992 		// GstEvent * gst_event_new_step (GstFormat format,  guint64 amount,  gdouble rate,  gboolean flush,  gboolean intermediate);
993 		auto p = gst_event_new_step(format, amount, rate, flush, intermediate);
994 		if(p is null)
995 		{
996 			throw new ConstructionException("null returned by gst_event_new_step(format, amount, rate, flush, intermediate)");
997 		}
998 		this(cast(GstEvent*) p);
999 	}
1000 	
1001 	/**
1002 	 * Parse the step event.
1003 	 * Params:
1004 	 * format = a pointer to store the format in. [out][allow-none]
1005 	 * amount = a pointer to store the amount in. [out][allow-none]
1006 	 * rate = a pointer to store the rate in. [out][allow-none]
1007 	 * flush = a pointer to store the flush boolean in. [out][allow-none]
1008 	 * intermediate = a pointer to store the intermediate
1009 	 * boolean in. [out][allow-none]
1010 	 */
1011 	public void parseStep(out GstFormat format, out ulong amount, out double rate, out int flush, out int intermediate)
1012 	{
1013 		// void gst_event_parse_step (GstEvent *event,  GstFormat *format,  guint64 *amount,  gdouble *rate,  gboolean *flush,  gboolean *intermediate);
1014 		gst_event_parse_step(gstEvent, &format, &amount, &rate, &flush, &intermediate);
1015 	}
1016 	
1017 	/**
1018 	 * Create a new sink-message event. The purpose of the sink-message event is
1019 	 * to instruct a sink to post the message contained in the event synchronized
1020 	 * with the stream.
1021 	 * name is used to store multiple sticky events on one pad.
1022 	 * Params:
1023 	 * name = a name for the event
1024 	 * msg = the GstMessage to be posted. [transfer none]
1025 	 * Throws: ConstructionException GTK+ fails to create the object.
1026 	 */
1027 	public this (string name, Message msg)
1028 	{
1029 		// GstEvent * gst_event_new_sink_message (const gchar *name,  GstMessage *msg);
1030 		auto p = gst_event_new_sink_message(Str.toStringz(name), (msg is null) ? null : msg.getMessageStruct());
1031 		if(p is null)
1032 		{
1033 			throw new ConstructionException("null returned by gst_event_new_sink_message(Str.toStringz(name), (msg is null) ? null : msg.getMessageStruct())");
1034 		}
1035 		this(cast(GstEvent*) p);
1036 	}
1037 	
1038 	/**
1039 	 * Parse the sink-message event. Unref msg after usage.
1040 	 * Params:
1041 	 * msg = a pointer to store the GstMessage in. [out][transfer full]
1042 	 */
1043 	public void parseSinkMessage(out Message msg)
1044 	{
1045 		// void gst_event_parse_sink_message (GstEvent *event,  GstMessage **msg);
1046 		GstMessage* outmsg = null;
1047 		
1048 		gst_event_parse_sink_message(gstEvent, &outmsg);
1049 		
1050 		msg = ObjectG.getDObject!(Message)(outmsg);
1051 	}
1052 	
1053 	/**
1054 	 * Create a new reconfigure event. The purpose of the reconfingure event is
1055 	 * to travel upstream and make elements renegotiate their caps or reconfigure
1056 	 * their buffer pools. This is useful when changing properties on elements
1057 	 * or changing the topology of the pipeline.
1058 	 * Throws: ConstructionException GTK+ fails to create the object.
1059 	 */
1060 	public this ()
1061 	{
1062 		// GstEvent * gst_event_new_reconfigure (void);
1063 		auto p = gst_event_new_reconfigure();
1064 		if(p is null)
1065 		{
1066 			throw new ConstructionException("null returned by gst_event_new_reconfigure()");
1067 		}
1068 		this(cast(GstEvent*) p);
1069 	}
1070 	
1071 	/**
1072 	 * Create a new CAPS event for caps. The caps event can only travel downstream
1073 	 * synchronized with the buffer flow and contains the format of the buffers
1074 	 * that will follow after the event.
1075 	 * Params:
1076 	 * caps = a GstCaps. [transfer none]
1077 	 * Throws: ConstructionException GTK+ fails to create the object.
1078 	 */
1079 	public this (Caps caps)
1080 	{
1081 		// GstEvent * gst_event_new_caps (GstCaps *caps);
1082 		auto p = gst_event_new_caps((caps is null) ? null : caps.getCapsStruct());
1083 		if(p is null)
1084 		{
1085 			throw new ConstructionException("null returned by gst_event_new_caps((caps is null) ? null : caps.getCapsStruct())");
1086 		}
1087 		this(cast(GstEvent*) p);
1088 	}
1089 	
1090 	/**
1091 	 * Get the caps from event. The caps remains valid as long as event remains
1092 	 * valid.
1093 	 * Params:
1094 	 * caps = A pointer to the caps. [out][transfer none]
1095 	 */
1096 	public void parseCaps(out Caps caps)
1097 	{
1098 		// void gst_event_parse_caps (GstEvent *event,  GstCaps **caps);
1099 		GstCaps* outcaps = null;
1100 		
1101 		gst_event_parse_caps(gstEvent, &outcaps);
1102 		
1103 		caps = ObjectG.getDObject!(Caps)(outcaps);
1104 	}
1105 	
1106 	/**
1107 	 * Generate a TOC event from the given toc. The purpose of the TOC event is to
1108 	 * inform elements that some kind of the TOC was found.
1109 	 * Params:
1110 	 * toc = GstToc structure. [transfer none]
1111 	 * updated = whether toc was updated or not.
1112 	 * Throws: ConstructionException GTK+ fails to create the object.
1113 	 */
1114 	public this (Toc toc, int updated)
1115 	{
1116 		// GstEvent * gst_event_new_toc (GstToc *toc,  gboolean updated);
1117 		auto p = gst_event_new_toc((toc is null) ? null : toc.getTocStruct(), updated);
1118 		if(p is null)
1119 		{
1120 			throw new ConstructionException("null returned by gst_event_new_toc((toc is null) ? null : toc.getTocStruct(), updated)");
1121 		}
1122 		this(cast(GstEvent*) p);
1123 	}
1124 	
1125 	/**
1126 	 * Parse a TOC event and store the results in the given toc and updated locations.
1127 	 * Params:
1128 	 * toc = pointer to GstToc structure. [out][transfer full]
1129 	 * updated = pointer to store TOC updated flag. [out]
1130 	 */
1131 	public void parseToc(out Toc toc, out int updated)
1132 	{
1133 		// void gst_event_parse_toc (GstEvent *event,  GstToc **toc,  gboolean *updated);
1134 		GstToc* outtoc = null;
1135 		
1136 		gst_event_parse_toc(gstEvent, &outtoc, &updated);
1137 		
1138 		toc = ObjectG.getDObject!(Toc)(outtoc);
1139 	}
1140 	
1141 	/**
1142 	 * Parse a TOC select event and store the results in the given uid location.
1143 	 * Params:
1144 	 * uid = storage for the selection UID. [out]
1145 	 */
1146 	public void parseTocSelect(out string uid)
1147 	{
1148 		// void gst_event_parse_toc_select (GstEvent *event,  gchar **uid);
1149 		char* outuid = null;
1150 		
1151 		gst_event_parse_toc_select(gstEvent, &outuid);
1152 		
1153 		uid = Str.toString(outuid);
1154 	}
1155 	
1156 	/**
1157 	 * Create a new segment-done event. This event is sent by elements that
1158 	 * finish playback of a segment as a result of a segment seek.
1159 	 * Params:
1160 	 * format = The format of the position being done
1161 	 * position = The position of the segment being done
1162 	 * Throws: ConstructionException GTK+ fails to create the object.
1163 	 */
1164 	public this (GstFormat format, long position)
1165 	{
1166 		// GstEvent * gst_event_new_segment_done (GstFormat format,  gint64 position);
1167 		auto p = gst_event_new_segment_done(format, position);
1168 		if(p is null)
1169 		{
1170 			throw new ConstructionException("null returned by gst_event_new_segment_done(format, position)");
1171 		}
1172 		this(cast(GstEvent*) p);
1173 	}
1174 	
1175 	/**
1176 	 * Extracts the position and format from the segment done message.
1177 	 * Params:
1178 	 * format = Result location for the format, or NULL. [out][allow-none]
1179 	 * position = Result location for the position, or NULL. [out][allow-none]
1180 	 */
1181 	public void parseSegmentDone(out GstFormat format, out long position)
1182 	{
1183 		// void gst_event_parse_segment_done (GstEvent *event,  GstFormat *format,  gint64 *position);
1184 		gst_event_parse_segment_done(gstEvent, &format, &position);
1185 	}
1186 }