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.Message;
26 
27 private import glib.ConstructionException;
28 private import glib.ErrorG;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gobject.Value;
32 private import gstreamer.Clock;
33 private import gstreamer.Context;
34 private import gstreamer.Device;
35 private import gstreamer.Element;
36 private import gstreamer.ObjectGst;
37 private import gstreamer.Structure;
38 private import gstreamer.TagList;
39 private import gstreamer.Toc;
40 private import gstreamerc.gstreamer;
41 public  import gstreamerc.gstreamertypes;
42 
43 
44 /**
45  * Messages are implemented as a subclass of #GstMiniObject with a generic
46  * #GstStructure as the content. This allows for writing custom messages without
47  * requiring an API change while allowing a wide range of different types
48  * of messages.
49  * 
50  * Messages are posted by objects in the pipeline and are passed to the
51  * application using the #GstBus.
52  * 
53  * The basic use pattern of posting a message on a #GstBus is as follows:
54  * |[
55  * gst_bus_post (bus, gst_message_new_eos());
56  * ]|
57  * 
58  * A #GstElement usually posts messages on the bus provided by the parent
59  * container using gst_element_post_message().
60  */
61 public class Message
62 {
63 	/** the main Gtk struct */
64 	protected GstMessage* gstMessage;
65 
66 	/** Get the main Gtk struct */
67 	public GstMessage* getMessageStruct()
68 	{
69 		return gstMessage;
70 	}
71 
72 	/** the main Gtk struct as a void* */
73 	protected void* getStruct()
74 	{
75 		return cast(void*)gstMessage;
76 	}
77 
78 	/**
79 	 * Sets our main struct and passes it to the parent class.
80 	 */
81 	public this (GstMessage* gstMessage)
82 	{
83 		this.gstMessage = gstMessage;
84 	}
85 
86 	/**
87 	 * Get the type of the message.
88 	 */
89 	public GstMessageType type()
90 	{
91 		return cast(GstMessageType)getMessageStruct().type;
92 	}
93 	
94 	/**
95 	 * Get the src (the element that originated the message) of the message.
96 	 */
97 	public ObjectGst src()
98 	{
99 		return new ObjectGst( cast(GstObject*)getMessageStruct().src );
100 	}
101 	
102 	/**
103 	 * Create a new element-specific message. This is meant as a generic way of
104 	 * allowing one-way communication from an element to an application, for example
105 	 * "the firewire cable was unplugged". The format of the message should be
106 	 * documented in the element's documentation. The structure field can be NULL.
107 	 * MT safe.
108 	 * Params:
109 	 *  src = The object originating the message.
110 	 *  structure = The structure for the message. The message will take ownership of
111 	 *  the structure.
112 	 * Returns:
113 	 *  The new element message.
114 	 */
115 	public static Message newElement(ObjectGst src, Structure structure)
116 	{
117 		// GstMessage* gst_message_new_element (GstObject *src,  GstStructure *structure);
118 		auto p = gst_message_new_element((src is null) ? null : src.getObjectGstStruct(), (structure is null) ? null : structure.getStructureStruct());
119 		
120 		if(p is null)
121 		{
122 			throw new ConstructionException("null returned by gst_message_new_element");
123 		}
124 		
125 		return new Message(cast(GstMessage*)p); //, true);
126 	}
127 	
128 	/**
129 	 * Create a new clock message. This message is posted whenever the
130 	 * pipeline selectes a new clock for the pipeline.
131 	 * MT safe.
132 	 * Params:
133 	 *  src = The object originating the message.
134 	 *  clock = the new selected clock
135 	 * Returns:
136 	 *  The new new clock message.
137 	 */
138 	public static Message newNewClock(ObjectGst src, Clock clock)
139 	{
140 		// GstMessage* gst_message_new_new_clock (GstObject *src,  GstClock *clock);
141 		auto p = gst_message_new_new_clock((src is null) ? null : src.getObjectGstStruct(), (clock is null) ? null : clock.getClockStruct());
142 		
143 		if(p is null)
144 		{
145 			throw new ConstructionException("null returned by gst_message_new_new_clock");
146 		}
147 		
148 		return new Message(cast(GstMessage*)p); //, true);
149 	}
150 	
151 	/**
152 	 * Create a new segment done message. This message is posted by elements that
153 	 * finish playback of a segment as a result of a segment seek. This message
154 	 * is received by the application after all elements that posted a segment_start
155 	 * have posted the segment_done.
156 	 * MT safe.
157 	 * Params:
158 	 *  src = The object originating the message.
159 	 *  format = The format of the position being done
160 	 *  position = The position of the segment being done
161 	 * Returns:
162 	 *  The new segment done message.
163 	 */
164 	public static Message newSegmentDone(ObjectGst src, GstFormat format, long position)
165 	{
166 		// GstMessage* gst_message_new_segment_done (GstObject *src,  GstFormat format,  gint64 position);
167 		auto p = gst_message_new_segment_done((src is null) ? null : src.getObjectGstStruct(), format, position);
168 		
169 		if(p is null)
170 		{
171 			throw new ConstructionException("null returned by gst_message_new_segment_done");
172 		}
173 		
174 		return new Message(cast(GstMessage*)p); //, true);
175 	}
176 	
177 	/**
178 	 * Create a new segment message. This message is posted by elements that
179 	 * start playback of a segment as a result of a segment seek. This message
180 	 * is not received by the application but is used for maintenance reasons in
181 	 * container elements.
182 	 * MT safe.
183 	 * Params:
184 	 *  src = The object originating the message.
185 	 *  format = The format of the position being played
186 	 *  position = The position of the segment being played
187 	 * Returns:
188 	 *  The new segment start message.
189 	 */
190 	public static Message newSegmentStart(ObjectGst src, GstFormat format, long position)
191 	{
192 		// GstMessage* gst_message_new_segment_start (GstObject *src,  GstFormat format,  gint64 position);
193 		auto p = gst_message_new_segment_start((src is null) ? null : src.getObjectGstStruct(), format, position);
194 		
195 		if(p is null)
196 		{
197 			throw new ConstructionException("null returned by gst_message_new_segment_start");
198 		}
199 		
200 		return new Message(cast(GstMessage*)p); //, true);
201 	}
202 	
203 	/**
204 	 * Create a new warning message. The message will make copies of error and
205 	 * debug.
206 	 * MT safe.
207 	 * Params:
208 	 *  src = The object originating the message.
209 	 *  error = The GError for this message.
210 	 *  debug = A debugging string for something or other.
211 	 * Returns:
212 	 *  The new warning message.
213 	 */
214 	public static Message newWarning(ObjectGst src, ErrorG error, string dbug)
215 	{
216 		// GstMessage* gst_message_new_warning (GstObject *src,  GError *error,  gchar *debug);
217 		auto p = gst_message_new_warning((src is null) ? null : src.getObjectGstStruct(), (error is null) ? null : error.getErrorGStruct(), Str.toStringz(dbug));
218 		
219 		if(p is null)
220 		{
221 			throw new ConstructionException("null returned by gst_message_new_warning");
222 		}
223 		
224 		return new Message(cast(GstMessage*)p); //, true);
225 	}
226 	
227 	/**
228 	 * Create a state dirty message. This message is posted whenever an element
229 	 * changed its state asynchronously and is used internally to update the
230 	 * states of container objects.
231 	 * MT safe.
232 	 * Params:
233 	 *  src = the object originating the message
234 	 * Returns:
235 	 *  The new state dirty message.
236 	 */
237 	public static Message newStateDirty(ObjectGst src)
238 	{
239 		// GstMessage* gst_message_new_state_dirty (GstObject *src);
240 		auto p = gst_message_new_state_dirty((src is null) ? null : src.getObjectGstStruct());
241 		
242 		if(p is null)
243 		{
244 			throw new ConstructionException("null returned by gst_message_new_state_dirty");
245 		}
246 		
247 		return new Message(cast(GstMessage*)p); //, true);
248 	}
249 	
250 	/**
251 	 * Create a new eos message. This message is generated and posted in
252 	 * the sink elements of a GstBin. The bin will only forward the EOS
253 	 * message to the application if all sinks have posted an EOS message.
254 	 * MT safe.
255 	 * Params:
256 	 *  src = The object originating the message.
257 	 * Returns:
258 	 *  The new eos message.
259 	 */
260 	public static Message newEOS(ObjectGst src)
261 	{
262 		// GstMessage* gst_message_new_eos (GstObject *src);
263 		auto p = gst_message_new_eos((src is null) ? null : src.getObjectGstStruct());
264 		
265 		if(p is null)
266 		{
267 			throw new ConstructionException("null returned by gst_message_new_eos");
268 		}
269 		
270 		return new Message(cast(GstMessage*)p); //, true);
271 	}
272 	
273 	/**
274 	 * Create a new error message. The message will copy error and
275 	 * debug. This message is posted by element when a fatal event
276 	 * occured. The pipeline will probably (partially) stop. The application
277 	 * receiving this message should stop the pipeline.
278 	 * MT safe.
279 	 * Params:
280 	 *  src = The object originating the message.
281 	 *  error = The GError for this message.
282 	 *  debug = A debugging string for something or other.
283 	 * Returns:
284 	 *  The new error message.
285 	 */
286 	public static Message newError(ObjectGst src, ErrorG error, string dbug)
287 	{
288 		// GstMessage* gst_message_new_error (GstObject *src,  GError *error,  gchar *debug);
289 		auto p = gst_message_new_error((src is null) ? null : src.getObjectGstStruct(), (error is null) ? null : error.getErrorGStruct(), Str.toStringz(dbug));
290 		
291 		if(p is null)
292 		{
293 			throw new ConstructionException("null returned by gst_message_new_error");
294 		}
295 		
296 		return new Message(cast(GstMessage*)p); //, true);
297 	}
298 	
299 	/**
300 	 * Create a new info message. The message will make copies of error and
301 	 * debug.
302 	 * MT safe.
303 	 * Since 0.10.12
304 	 * Params:
305 	 *  src = The object originating the message.
306 	 *  error = The GError for this message.
307 	 *  debug = A debugging string for something or other.
308 	 * Returns:
309 	 *  The new info message.
310 	 */
311 	public static Message newInfo(ObjectGst src, ErrorG error, string dbug)
312 	{
313 		// GstMessage* gst_message_new_info (GstObject *src,  GError *error,  gchar *debug);
314 		auto p = gst_message_new_info((src is null) ? null : src.getObjectGstStruct(), (error is null) ? null : error.getErrorGStruct(), Str.toStringz(dbug));
315 		
316 		if(p is null)
317 		{
318 			throw new ConstructionException("null returned by gst_message_new_info");
319 		}
320 		
321 		return new Message(cast(GstMessage*)p); //, true);
322 	}
323 	
324 	/**
325 	 * This message can be posted by elements when their latency requirements
326 	 * have changed.
327 	 * Params:
328 	 *     src = The object originating the message.
329 	 * Returns:
330 	 * The new latency message. MT safe.
331 	 */
332 	public static Message newLatency(ObjectGst src)
333 	{
334 		// GstMessage* gst_message_new_latency (GstObject *src);
335 		auto p = gst_message_new_latency((src is null) ? null : src.getObjectGstStruct());
336 		
337 		if(p is null)
338 		{
339 			throw new ConstructionException("null returned by gst_message_new_latency");
340 		}
341 		
342 		return new Message(cast(GstMessage*)p); //, true);
343 	}
344 	
345 	/**
346 	 * Create a new duration changed message. This message is posted by elements
347 	 * that know the duration of a stream when the duration changes. This message
348 	 * is received by bins and is used to calculate the total duration of a
349 	 * pipeline. Elements may post a duration message with a duration of
350 	 * GST_CLOCK_TIME_NONE to indicate that the duration has changed and the
351 	 * cached duration should be discarded. The new duration can then be
352 	 * retrieved via a query.
353 	 * Params:
354 	 *    src = The object originating the message. [transfer none]
355 	 * Throws: ConstructionException GTK+ fails to create the object.
356 	 */
357 	public static Message newDurationChanged(ObjectGst src)
358 	{
359 		// GstMessage * gst_message_new_duration_changed (GstObject *src);
360 		auto p = gst_message_new_duration_changed((src is null) ? null : src.getObjectGstStruct());
361 		
362 		if(p is null)
363 		{
364 			throw new ConstructionException("null returned by gst_message_new_duration_changed((src is null) ? null : src.getObjectGstStruct())");
365 		}
366 		
367 		return new Message(cast(GstMessage*)p); //, true);
368 	}
369 	
370 	/**
371 	 * This message is posted by elements when they start an ASYNC state change.
372 	 * Params:
373 	 * src = The object originating the message. [transfer none]
374 	 * Throws: ConstructionException GTK+ fails to create the object.
375 	 */
376 	public static Message newAsyncStart(ObjectGst src)
377 	{
378 		// GstMessage * gst_message_new_async_start (GstObject *src);
379 		auto p = gst_message_new_async_start((src is null) ? null : src.getObjectGstStruct());
380 		if(p is null)
381 		{
382 			throw new ConstructionException("null returned by gst_message_new_async_start((src is null) ? null : src.getObjectGstStruct())");
383 		}
384 		return new Message(cast(GstMessage*)p); //, true);
385 	}
386 	
387 	/**
388 	 * The message is posted when elements completed an ASYNC state change.
389 	 * running_time contains the time of the desired running_time when this
390 	 * elements goes to PLAYING. A value of GST_CLOCK_TIME_NONE for running_time
391 	 * means that the element has no clock interaction and thus doesn't care about
392 	 * the running_time of the pipeline.
393 	 * Params:
394 	 * src = The object originating the message. [transfer none]
395 	 * runningTime = the desired running_time
396 	 * Throws: ConstructionException GTK+ fails to create the object.
397 	 */
398 	public static Message newAsyncDone(ObjectGst src, GstClockTime runningTime)
399 	{
400 		// GstMessage * gst_message_new_async_done (GstObject *src,  GstClockTime running_time);
401 		auto p = gst_message_new_async_done((src is null) ? null : src.getObjectGstStruct(), runningTime);
402 		if(p is null)
403 		{
404 			throw new ConstructionException("null returned by gst_message_new_async_done((src is null) ? null : src.getObjectGstStruct(), runningTime)");
405 		}
406 		return new Message(cast(GstMessage*)p); //, true);
407 	}
408 	
409 	/**
410 	 * Creates a new device-added message. The device-added message is produced by
411 	 * #GstDeviceProvider or a #GstDeviceMonitor. They announce the appearance
412 	 * of monitored devices.
413 	 *
414 	 * Params:
415 	 *     src = The #GstObject that created the message
416 	 *     device = The new #GstDevice
417 	 *
418 	 * Return: a newly allocated #GstMessage
419 	 *
420 	 * Since: 1.4
421 	 *
422 	 * Throws: ConstructionException GTK+ fails to create the object.
423 	 */
424 	public static Message newDeviceAdded(ObjectGst src, Device device)
425 	{
426 		auto p = gst_message_new_device_added((src is null) ? null : src.getObjectGstStruct(), (device is null) ? null : device.getDeviceStruct());
427 		
428 		if(p is null)
429 		{
430 			throw new ConstructionException("null returned by new_device_added");
431 		}
432 		
433 		return new Message(cast(GstMessage*)p); //, true);
434 	}
435 	
436 	/**
437 	 * Creates a new device-removed message. The device-removed message is produced
438 	 * by #GstDeviceProvider or a #GstDeviceMonitor. They announce the
439 	 * disappearance of monitored devices.
440 	 *
441 	 * Params:
442 	 *     src = The #GstObject that created the message
443 	 *     device = The removed #GstDevice
444 	 *
445 	 * Return: a newly allocated #GstMessage
446 	 *
447 	 * Since: 1.4
448 	 *
449 	 * Throws: ConstructionException GTK+ fails to create the object.
450 	 */
451 	public  static Message newDeviceRemoved(ObjectGst src, Device device)
452 	{
453 		auto p = gst_message_new_device_removed((src is null) ? null : src.getObjectGstStruct(), (device is null) ? null : device.getDeviceStruct());
454 		
455 		if(p is null)
456 		{
457 			throw new ConstructionException("null returned by new_device_removed");
458 		}
459 		
460 		return new Message(cast(GstMessage*)p); //, true);
461 	}
462 
463 	/**
464 	 */
465 
466 	public static GType getType()
467 	{
468 		return gst_message_get_type();
469 	}
470 
471 	/**
472 	 * Create a new application-typed message. GStreamer will never create these
473 	 * messages; they are a gift from us to you. Enjoy.
474 	 *
475 	 * Params:
476 	 *     src = the object originating the message.
477 	 *     structure = the structure for the message. The message
478 	 *         will take ownership of the structure.
479 	 *
480 	 * Return: The new application message.
481 	 *
482 	 *     MT safe.
483 	 *
484 	 * Throws: ConstructionException GTK+ fails to create the object.
485 	 */
486 	public this(ObjectGst src, Structure structure)
487 	{
488 		auto p = gst_message_new_application((src is null) ? null : src.getObjectGstStruct(), (structure is null) ? null : structure.getStructureStruct());
489 		
490 		if(p is null)
491 		{
492 			throw new ConstructionException("null returned by new_application");
493 		}
494 		
495 		this(cast(GstMessage*) p);
496 	}
497 
498 	/**
499 	 * The message is posted when elements completed an ASYNC state change.
500 	 * @running_time contains the time of the desired running_time when this
501 	 * elements goes to PLAYING. A value of #GST_CLOCK_TIME_NONE for @running_time
502 	 * means that the element has no clock interaction and thus doesn't care about
503 	 * the running_time of the pipeline.
504 	 *
505 	 * Params:
506 	 *     src = The object originating the message.
507 	 *     runningTime = the desired running_time
508 	 *
509 	 * Return: The new async_done message.
510 	 *
511 	 *     MT safe.
512 	 *
513 	 * Throws: ConstructionException GTK+ fails to create the object.
514 	 */
515 	public this(ObjectGst src, GstClockTime runningTime)
516 	{
517 		auto p = gst_message_new_async_done((src is null) ? null : src.getObjectGstStruct(), runningTime);
518 		
519 		if(p is null)
520 		{
521 			throw new ConstructionException("null returned by new_async_done");
522 		}
523 		
524 		this(cast(GstMessage*) p);
525 	}
526 
527 	/**
528 	 * Create a new buffering message. This message can be posted by an element that
529 	 * needs to buffer data before it can continue processing. @percent should be a
530 	 * value between 0 and 100. A value of 100 means that the buffering completed.
531 	 *
532 	 * When @percent is < 100 the application should PAUSE a PLAYING pipeline. When
533 	 * @percent is 100, the application can set the pipeline (back) to PLAYING.
534 	 * The application must be prepared to receive BUFFERING messages in the
535 	 * PREROLLING state and may only set the pipeline to PLAYING after receiving a
536 	 * message with @percent set to 100, which can happen after the pipeline
537 	 * completed prerolling.
538 	 *
539 	 * MT safe.
540 	 *
541 	 * Params:
542 	 *     src = The object originating the message.
543 	 *     percent = The buffering percent
544 	 *
545 	 * Return: The new buffering message.
546 	 *
547 	 * Throws: ConstructionException GTK+ fails to create the object.
548 	 */
549 	public this(ObjectGst src, int percent)
550 	{
551 		auto p = gst_message_new_buffering((src is null) ? null : src.getObjectGstStruct(), percent);
552 		
553 		if(p is null)
554 		{
555 			throw new ConstructionException("null returned by new_buffering");
556 		}
557 		
558 		this(cast(GstMessage*) p);
559 	}
560 
561 	/**
562 	 * Create a clock lost message. This message is posted whenever the
563 	 * clock is not valid anymore.
564 	 *
565 	 * If this message is posted by the pipeline, the pipeline will
566 	 * select a new clock again when it goes to PLAYING. It might therefore
567 	 * be needed to set the pipeline to PAUSED and PLAYING again.
568 	 *
569 	 * Params:
570 	 *     src = the object originating the message.
571 	 *     clock = the clock that was lost
572 	 *
573 	 * Return: The new clock lost message.
574 	 *
575 	 *     MT safe.
576 	 *
577 	 * Throws: ConstructionException GTK+ fails to create the object.
578 	 */
579 	public this(ObjectGst src, Clock clock)
580 	{
581 		auto p = gst_message_new_clock_lost((src is null) ? null : src.getObjectGstStruct(), (clock is null) ? null : clock.getClockStruct());
582 		
583 		if(p is null)
584 		{
585 			throw new ConstructionException("null returned by new_clock_lost");
586 		}
587 		
588 		this(cast(GstMessage*) p);
589 	}
590 
591 	/**
592 	 * Create a clock provide message. This message is posted whenever an
593 	 * element is ready to provide a clock or lost its ability to provide
594 	 * a clock (maybe because it paused or became EOS).
595 	 *
596 	 * This message is mainly used internally to manage the clock
597 	 * selection.
598 	 *
599 	 * Params:
600 	 *     src = the object originating the message.
601 	 *     clock = the clock it provides
602 	 *     ready = %TRUE if the sender can provide a clock
603 	 *
604 	 * Return: the new provide clock message.
605 	 *
606 	 *     MT safe.
607 	 *
608 	 * Throws: ConstructionException GTK+ fails to create the object.
609 	 */
610 	public this(ObjectGst src, Clock clock, bool ready)
611 	{
612 		auto p = gst_message_new_clock_provide((src is null) ? null : src.getObjectGstStruct(), (clock is null) ? null : clock.getClockStruct(), ready);
613 		
614 		if(p is null)
615 		{
616 			throw new ConstructionException("null returned by new_clock_provide");
617 		}
618 		
619 		this(cast(GstMessage*) p);
620 	}
621 
622 	/**
623 	 * Create a new custom-typed message. This can be used for anything not
624 	 * handled by other message-specific functions to pass a message to the
625 	 * app. The structure field can be %NULL.
626 	 *
627 	 * Params:
628 	 *     type = The #GstMessageType to distinguish messages
629 	 *     src = The object originating the message.
630 	 *     structure = the structure for the
631 	 *         message. The message will take ownership of the structure.
632 	 *
633 	 * Return: The new message.
634 	 *
635 	 *     MT safe.
636 	 *
637 	 * Throws: ConstructionException GTK+ fails to create the object.
638 	 */
639 	public this(GstMessageType type, ObjectGst src, Structure structure)
640 	{
641 		auto p = gst_message_new_custom(type, (src is null) ? null : src.getObjectGstStruct(), (structure is null) ? null : structure.getStructureStruct());
642 		
643 		if(p is null)
644 		{
645 			throw new ConstructionException("null returned by new_custom");
646 		}
647 		
648 		this(cast(GstMessage*) p);
649 	}
650 
651 	/**
652 	 * This message is posted when an element has a new local #GstContext.
653 	 *
654 	 * Params:
655 	 *     src = The object originating the message.
656 	 *     context = the context
657 	 *
658 	 * Return: The new have-context message.
659 	 *
660 	 *     MT safe.
661 	 *
662 	 * Since: 1.2
663 	 *
664 	 * Throws: ConstructionException GTK+ fails to create the object.
665 	 */
666 	public this(ObjectGst src, Context context)
667 	{
668 		auto p = gst_message_new_have_context((src is null) ? null : src.getObjectGstStruct(), (context is null) ? null : context.getContextStruct());
669 		
670 		if(p is null)
671 		{
672 			throw new ConstructionException("null returned by new_have_context");
673 		}
674 		
675 		this(cast(GstMessage*) p);
676 	}
677 
678 	/**
679 	 * This message is posted when an element needs a specific #GstContext.
680 	 *
681 	 * Params:
682 	 *     src = The object originating the message.
683 	 *     contextType = The context type that is needed
684 	 *
685 	 * Return: The new need-context message.
686 	 *
687 	 *     MT safe.
688 	 *
689 	 * Since: 1.2
690 	 *
691 	 * Throws: ConstructionException GTK+ fails to create the object.
692 	 */
693 	public this(ObjectGst src, string contextType)
694 	{
695 		auto p = gst_message_new_need_context((src is null) ? null : src.getObjectGstStruct(), Str.toStringz(contextType));
696 		
697 		if(p is null)
698 		{
699 			throw new ConstructionException("null returned by new_need_context");
700 		}
701 		
702 		this(cast(GstMessage*) p);
703 	}
704 
705 	/**
706 	 * Progress messages are posted by elements when they use an asynchronous task
707 	 * to perform actions triggered by a state change.
708 	 *
709 	 * @code contains a well defined string describing the action.
710 	 * @test should contain a user visible string detailing the current action.
711 	 *
712 	 * Params:
713 	 *     src = The object originating the message.
714 	 *     type = a #GstProgressType
715 	 *     code = a progress code
716 	 *     text = free, user visible text describing the progress
717 	 *
718 	 * Return: The new qos message.
719 	 *
720 	 * Throws: ConstructionException GTK+ fails to create the object.
721 	 */
722 	public this(ObjectGst src, GstProgressType type, string code, string text)
723 	{
724 		auto p = gst_message_new_progress((src is null) ? null : src.getObjectGstStruct(), type, Str.toStringz(code), Str.toStringz(text));
725 		
726 		if(p is null)
727 		{
728 			throw new ConstructionException("null returned by new_progress");
729 		}
730 		
731 		this(cast(GstMessage*) p);
732 	}
733 
734 	/**
735 	 * A QOS message is posted on the bus whenever an element decides to drop a
736 	 * buffer because of QoS reasons or whenever it changes its processing strategy
737 	 * because of QoS reasons (quality adjustments such as processing at lower
738 	 * accuracy).
739 	 *
740 	 * This message can be posted by an element that performs synchronisation against the
741 	 * clock (live) or it could be dropped by an element that performs QoS because of QOS
742 	 * events received from a downstream element (!live).
743 	 *
744 	 * @running_time, @stream_time, @timestamp, @duration should be set to the
745 	 * respective running-time, stream-time, timestamp and duration of the (dropped)
746 	 * buffer that generated the QoS event. Values can be left to
747 	 * GST_CLOCK_TIME_NONE when unknown.
748 	 *
749 	 * Params:
750 	 *     src = The object originating the message.
751 	 *     live = if the message was generated by a live element
752 	 *     runningTime = the running time of the buffer that generated the message
753 	 *     streamTime = the stream time of the buffer that generated the message
754 	 *     timestamp = the timestamps of the buffer that generated the message
755 	 *     duration = the duration of the buffer that generated the message
756 	 *
757 	 * Return: The new qos message.
758 	 *
759 	 *     MT safe.
760 	 *
761 	 * Throws: ConstructionException GTK+ fails to create the object.
762 	 */
763 	public this(ObjectGst src, bool live, ulong runningTime, ulong streamTime, ulong timestamp, ulong duration)
764 	{
765 		auto p = gst_message_new_qos((src is null) ? null : src.getObjectGstStruct(), live, runningTime, streamTime, timestamp, duration);
766 		
767 		if(p is null)
768 		{
769 			throw new ConstructionException("null returned by new_qos");
770 		}
771 		
772 		this(cast(GstMessage*) p);
773 	}
774 
775 	/**
776 	 * This message can be posted by elements when they want to have their state
777 	 * changed. A typical use case would be an audio server that wants to pause the
778 	 * pipeline because a higher priority stream is being played.
779 	 *
780 	 * Params:
781 	 *     src = the object originating the message.
782 	 *     state = The new requested state
783 	 *
784 	 * Return: the new request state message.
785 	 *
786 	 *     MT safe.
787 	 *
788 	 * Throws: ConstructionException GTK+ fails to create the object.
789 	 */
790 	public this(ObjectGst src, GstState state)
791 	{
792 		auto p = gst_message_new_request_state((src is null) ? null : src.getObjectGstStruct(), state);
793 		
794 		if(p is null)
795 		{
796 			throw new ConstructionException("null returned by new_request_state");
797 		}
798 		
799 		this(cast(GstMessage*) p);
800 	}
801 
802 	/**
803 	 * Create a state change message. This message is posted whenever an element
804 	 * changed its state.
805 	 *
806 	 * Params:
807 	 *     src = the object originating the message
808 	 *     oldstate = the previous state
809 	 *     newstate = the new (current) state
810 	 *     pending = the pending (target) state
811 	 *
812 	 * Return: the new state change message.
813 	 *
814 	 *     MT safe.
815 	 *
816 	 * Throws: ConstructionException GTK+ fails to create the object.
817 	 */
818 	public this(ObjectGst src, GstState oldstate, GstState newstate, GstState pending)
819 	{
820 		auto p = gst_message_new_state_changed((src is null) ? null : src.getObjectGstStruct(), oldstate, newstate, pending);
821 		
822 		if(p is null)
823 		{
824 			throw new ConstructionException("null returned by new_state_changed");
825 		}
826 		
827 		this(cast(GstMessage*) p);
828 	}
829 
830 	/**
831 	 * This message is posted by elements when they complete a part, when @intermediate set
832 	 * to %TRUE, or a complete step operation.
833 	 *
834 	 * @duration will contain the amount of time (in GST_FORMAT_TIME) of the stepped
835 	 * @amount of media in format @format.
836 	 *
837 	 * Params:
838 	 *     src = The object originating the message.
839 	 *     format = the format of @amount
840 	 *     amount = the amount of stepped data
841 	 *     rate = the rate of the stepped amount
842 	 *     flush = is this an flushing step
843 	 *     intermediate = is this an intermediate step
844 	 *     duration = the duration of the data
845 	 *     eos = the step caused EOS
846 	 *
847 	 * Return: the new step_done message.
848 	 *
849 	 *     MT safe.
850 	 *
851 	 * Throws: ConstructionException GTK+ fails to create the object.
852 	 */
853 	public this(ObjectGst src, GstFormat format, ulong amount, double rate, bool flush, bool intermediate, ulong duration, bool eos)
854 	{
855 		auto p = gst_message_new_step_done((src is null) ? null : src.getObjectGstStruct(), format, amount, rate, flush, intermediate, duration, eos);
856 		
857 		if(p is null)
858 		{
859 			throw new ConstructionException("null returned by new_step_done");
860 		}
861 		
862 		this(cast(GstMessage*) p);
863 	}
864 
865 	/**
866 	 * This message is posted by elements when they accept or activate a new step
867 	 * event for @amount in @format.
868 	 *
869 	 * @active is set to %FALSE when the element accepted the new step event and has
870 	 * queued it for execution in the streaming threads.
871 	 *
872 	 * @active is set to %TRUE when the element has activated the step operation and
873 	 * is now ready to start executing the step in the streaming thread. After this
874 	 * message is emitted, the application can queue a new step operation in the
875 	 * element.
876 	 *
877 	 * Params:
878 	 *     src = The object originating the message.
879 	 *     active = if the step is active or queued
880 	 *     format = the format of @amount
881 	 *     amount = the amount of stepped data
882 	 *     rate = the rate of the stepped amount
883 	 *     flush = is this an flushing step
884 	 *     intermediate = is this an intermediate step
885 	 *
886 	 * Return: The new step_start message.
887 	 *
888 	 *     MT safe.
889 	 *
890 	 * Throws: ConstructionException GTK+ fails to create the object.
891 	 */
892 	public this(ObjectGst src, bool active, GstFormat format, ulong amount, double rate, bool flush, bool intermediate)
893 	{
894 		auto p = gst_message_new_step_start((src is null) ? null : src.getObjectGstStruct(), active, format, amount, rate, flush, intermediate);
895 		
896 		if(p is null)
897 		{
898 			throw new ConstructionException("null returned by new_step_start");
899 		}
900 		
901 		this(cast(GstMessage*) p);
902 	}
903 
904 	/**
905 	 * Create a new stream_start message. This message is generated and posted in
906 	 * the sink elements of a GstBin. The bin will only forward the STREAM_START
907 	 * message to the application if all sinks have posted an STREAM_START message.
908 	 *
909 	 * Params:
910 	 *     src = The object originating the message.
911 	 *
912 	 * Return: The new stream_start message.
913 	 *
914 	 *     MT safe.
915 	 *
916 	 * Throws: ConstructionException GTK+ fails to create the object.
917 	 */
918 	public this(ObjectGst src)
919 	{
920 		auto p = gst_message_new_stream_start((src is null) ? null : src.getObjectGstStruct());
921 		
922 		if(p is null)
923 		{
924 			throw new ConstructionException("null returned by new_stream_start");
925 		}
926 		
927 		this(cast(GstMessage*) p);
928 	}
929 
930 	/**
931 	 * Create a new stream status message. This message is posted when a streaming
932 	 * thread is created/destroyed or when the state changed.
933 	 *
934 	 * Params:
935 	 *     src = The object originating the message.
936 	 *     type = The stream status type.
937 	 *     owner = the owner element of @src.
938 	 *
939 	 * Return: the new stream status message.
940 	 *
941 	 *     MT safe.
942 	 *
943 	 * Throws: ConstructionException GTK+ fails to create the object.
944 	 */
945 	public this(ObjectGst src, GstStreamStatusType type, Element owner)
946 	{
947 		auto p = gst_message_new_stream_status((src is null) ? null : src.getObjectGstStruct(), type, (owner is null) ? null : owner.getElementStruct());
948 		
949 		if(p is null)
950 		{
951 			throw new ConstructionException("null returned by new_stream_status");
952 		}
953 		
954 		this(cast(GstMessage*) p);
955 	}
956 
957 	/**
958 	 * Create a new structure change message. This message is posted when the
959 	 * structure of a pipeline is in the process of being changed, for example
960 	 * when pads are linked or unlinked.
961 	 *
962 	 * @src should be the sinkpad that unlinked or linked.
963 	 *
964 	 * Params:
965 	 *     src = The object originating the message.
966 	 *     type = The change type.
967 	 *     owner = The owner element of @src.
968 	 *     busy = Whether the structure change is busy.
969 	 *
970 	 * Return: the new structure change message.
971 	 *
972 	 *     MT safe.
973 	 *
974 	 * Throws: ConstructionException GTK+ fails to create the object.
975 	 */
976 	public this(ObjectGst src, GstStructureChangeType type, Element owner, bool busy)
977 	{
978 		auto p = gst_message_new_structure_change((src is null) ? null : src.getObjectGstStruct(), type, (owner is null) ? null : owner.getElementStruct(), busy);
979 		
980 		if(p is null)
981 		{
982 			throw new ConstructionException("null returned by new_structure_change");
983 		}
984 		
985 		this(cast(GstMessage*) p);
986 	}
987 
988 	/**
989 	 * Create a new tag message. The message will take ownership of the tag list.
990 	 * The message is posted by elements that discovered a new taglist.
991 	 *
992 	 * Params:
993 	 *     src = The object originating the message.
994 	 *     tagList = the tag list for the message.
995 	 *
996 	 * Return: the new tag message.
997 	 *
998 	 *     MT safe.
999 	 *
1000 	 * Throws: ConstructionException GTK+ fails to create the object.
1001 	 */
1002 	public this(ObjectGst src, TagList tagList)
1003 	{
1004 		auto p = gst_message_new_tag((src is null) ? null : src.getObjectGstStruct(), (tagList is null) ? null : tagList.getTagListStruct());
1005 		
1006 		if(p is null)
1007 		{
1008 			throw new ConstructionException("null returned by new_tag");
1009 		}
1010 		
1011 		this(cast(GstMessage*) p);
1012 	}
1013 
1014 	/**
1015 	 * Create a new TOC message. The message is posted by elements
1016 	 * that discovered or updated a TOC.
1017 	 *
1018 	 * Params:
1019 	 *     src = the object originating the message.
1020 	 *     toc = #GstToc structure for the message.
1021 	 *     updated = whether TOC was updated or not.
1022 	 *
1023 	 * Return: a new TOC message.
1024 	 *
1025 	 *     MT safe.
1026 	 *
1027 	 * Throws: ConstructionException GTK+ fails to create the object.
1028 	 */
1029 	public this(ObjectGst src, Toc toc, bool updated)
1030 	{
1031 		auto p = gst_message_new_toc((src is null) ? null : src.getObjectGstStruct(), (toc is null) ? null : toc.getTocStruct(), updated);
1032 		
1033 		if(p is null)
1034 		{
1035 			throw new ConstructionException("null returned by new_toc");
1036 		}
1037 		
1038 		this(cast(GstMessage*) p);
1039 	}
1040 
1041 	/**
1042 	 * Retrieve the sequence number of a message.
1043 	 *
1044 	 * Messages have ever-incrementing sequence numbers, which may also be set
1045 	 * explicitly via gst_message_set_seqnum(). Sequence numbers are typically used
1046 	 * to indicate that a message corresponds to some other set of messages or
1047 	 * events, for example a SEGMENT_DONE message corresponding to a SEEK event. It
1048 	 * is considered good practice to make this correspondence when possible, though
1049 	 * it is not required.
1050 	 *
1051 	 * Note that events and messages share the same sequence number incrementor;
1052 	 * two events or messages will never have the same sequence number unless
1053 	 * that correspondence was made explicitly.
1054 	 *
1055 	 * Return: The message's sequence number.
1056 	 *
1057 	 *     MT safe.
1058 	 */
1059 	public uint getSeqnum()
1060 	{
1061 		return gst_message_get_seqnum(gstMessage);
1062 	}
1063 
1064 	/**
1065 	 * Extracts the object managing the streaming thread from @message.
1066 	 *
1067 	 * Return: a GValue containing the object that manages the streaming thread.
1068 	 *     This object is usually of type GstTask but other types can be added in the
1069 	 *     future. The object remains valid as long as @message is valid.
1070 	 */
1071 	public Value getStreamStatusObject()
1072 	{
1073 		auto p = gst_message_get_stream_status_object(gstMessage);
1074 		
1075 		if(p is null)
1076 		{
1077 			return null;
1078 		}
1079 		
1080 		return ObjectG.getDObject!(Value)(cast(GValue*) p);
1081 	}
1082 
1083 	/**
1084 	 * Access the structure of the message.
1085 	 *
1086 	 * Return: The structure of the message. The structure is
1087 	 *     still owned by the message, which means that you should not free it and
1088 	 *     that the pointer becomes invalid when you free the message.
1089 	 *
1090 	 *     MT safe.
1091 	 */
1092 	public Structure getStructure()
1093 	{
1094 		auto p = gst_message_get_structure(gstMessage);
1095 		
1096 		if(p is null)
1097 		{
1098 			return null;
1099 		}
1100 		
1101 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
1102 	}
1103 
1104 	/**
1105 	 * Checks if @message has the given @name. This function is usually used to
1106 	 * check the name of a custom message.
1107 	 *
1108 	 * Params:
1109 	 *     name = name to check
1110 	 *
1111 	 * Return: %TRUE if @name matches the name of the message structure.
1112 	 */
1113 	public bool hasName(string name)
1114 	{
1115 		return gst_message_has_name(gstMessage, Str.toStringz(name)) != 0;
1116 	}
1117 
1118 	/**
1119 	 * Extract the running_time from the async_done message.
1120 	 *
1121 	 * MT safe.
1122 	 *
1123 	 * Params:
1124 	 *     runningTime = Result location for the running_time or %NULL
1125 	 */
1126 	public void parseAsyncDone(out GstClockTime runningTime)
1127 	{
1128 		gst_message_parse_async_done(gstMessage, &runningTime);
1129 	}
1130 
1131 	/**
1132 	 * Extracts the buffering percent from the GstMessage. see also
1133 	 * gst_message_new_buffering().
1134 	 *
1135 	 * MT safe.
1136 	 *
1137 	 * Params:
1138 	 *     percent = Return location for the percent.
1139 	 */
1140 	public void parseBuffering(out int percent)
1141 	{
1142 		gst_message_parse_buffering(gstMessage, &percent);
1143 	}
1144 
1145 	/**
1146 	 * Extracts the buffering stats values from @message.
1147 	 *
1148 	 * Params:
1149 	 *     mode = a buffering mode, or %NULL
1150 	 *     avgIn = the average input rate, or %NULL
1151 	 *     avgOut = the average output rate, or %NULL
1152 	 *     bufferingLeft = amount of buffering time left in
1153 	 *         milliseconds, or %NULL
1154 	 */
1155 	public void parseBufferingStats(out GstBufferingMode mode, out int avgIn, out int avgOut, out long bufferingLeft)
1156 	{
1157 		gst_message_parse_buffering_stats(gstMessage, &mode, &avgIn, &avgOut, &bufferingLeft);
1158 	}
1159 
1160 	/**
1161 	 * Extracts the lost clock from the GstMessage.
1162 	 * The clock object returned remains valid until the message is freed.
1163 	 *
1164 	 * MT safe.
1165 	 *
1166 	 * Params:
1167 	 *     clock = a pointer to hold the lost clock
1168 	 */
1169 	public void parseClockLost(out Clock clock)
1170 	{
1171 		GstClock* outclock = null;
1172 		
1173 		gst_message_parse_clock_lost(gstMessage, &outclock);
1174 		
1175 		clock = ObjectG.getDObject!(Clock)(outclock);
1176 	}
1177 
1178 	/**
1179 	 * Extracts the clock and ready flag from the GstMessage.
1180 	 * The clock object returned remains valid until the message is freed.
1181 	 *
1182 	 * MT safe.
1183 	 *
1184 	 * Params:
1185 	 *     clock = a pointer to  hold a clock
1186 	 *         object, or %NULL
1187 	 *     ready = a pointer to hold the ready flag, or %NULL
1188 	 */
1189 	public void parseClockProvide(out Clock clock, out bool ready)
1190 	{
1191 		GstClock* outclock = null;
1192 		int outready;
1193 		
1194 		gst_message_parse_clock_provide(gstMessage, &outclock, &outready);
1195 		
1196 		clock = ObjectG.getDObject!(Clock)(outclock);
1197 		ready = (outready == 1);
1198 	}
1199 
1200 	/**
1201 	 * Parse a context type from an existing GST_MESSAGE_NEED_CONTEXT message.
1202 	 *
1203 	 * Params:
1204 	 *     contextType = the context type, or %NULL
1205 	 *
1206 	 * Return: a #gboolean indicating if the parsing succeeded.
1207 	 *
1208 	 * Since: 1.2
1209 	 */
1210 	public bool parseContextType(out string contextType)
1211 	{
1212 		char* outcontextType = null;
1213 		
1214 		auto p = gst_message_parse_context_type(gstMessage, &outcontextType) != 0;
1215 		
1216 		contextType = Str.toString(outcontextType);
1217 		
1218 		return p;
1219 	}
1220 
1221 	/**
1222 	 * Parses a device-added message. The device-added message is produced by
1223 	 * #GstDeviceProvider or a #GstDeviceMonitor. It announces the appearance
1224 	 * of monitored devices.
1225 	 *
1226 	 * Params:
1227 	 *     device = A location where to store a
1228 	 *         pointer to the new #GstDevice, or %NULL
1229 	 *
1230 	 * Since: 1.4
1231 	 */
1232 	public void parseDeviceAdded(out Device device)
1233 	{
1234 		GstDevice* outdevice = null;
1235 		
1236 		gst_message_parse_device_added(gstMessage, &outdevice);
1237 		
1238 		device = ObjectG.getDObject!(Device)(outdevice);
1239 	}
1240 
1241 	/**
1242 	 * Parses a device-removed message. The device-removed message is produced by
1243 	 * #GstDeviceProvider or a #GstDeviceMonitor. It announces the
1244 	 * disappearance of monitored devices.
1245 	 *
1246 	 * Params:
1247 	 *     device = A location where to store a
1248 	 *         pointer to the removed #GstDevice, or %NULL
1249 	 *
1250 	 * Since: 1.4
1251 	 */
1252 	public void parseDeviceRemoved(out Device device)
1253 	{
1254 		GstDevice* outdevice = null;
1255 		
1256 		gst_message_parse_device_removed(gstMessage, &outdevice);
1257 		
1258 		device = ObjectG.getDObject!(Device)(outdevice);
1259 	}
1260 
1261 	/**
1262 	 * Extracts the GError and debug string from the GstMessage. The values returned
1263 	 * in the output arguments are copies; the caller must free them when done.
1264 	 *
1265 	 * Typical usage of this function might be:
1266 	 * |[
1267 	 * ...
1268 	 * switch (GST_MESSAGE_TYPE (msg)) {
1269 	 * case GST_MESSAGE_ERROR: {
1270 	 * GError *err = NULL;
1271 	 * gchar *dbg_info = NULL;
1272 	 *
1273 	 * gst_message_parse_error (msg, &amp;err, &amp;dbg_info);
1274 	 * g_printerr ("ERROR from element %s: %s\n",
1275 	 * GST_OBJECT_NAME (msg->src), err->message);
1276 	 * g_printerr ("Debugging info: %s\n", (dbg_info) ? dbg_info : "none");
1277 	 * g_error_free (err);
1278 	 * g_free (dbg_info);
1279 	 * break;
1280 	 * }
1281 	 * ...
1282 	 * }
1283 	 * ...
1284 	 * ]|
1285 	 *
1286 	 * MT safe.
1287 	 *
1288 	 * Params:
1289 	 *     gerror = location for the GError
1290 	 *     dbg = location for the debug message,
1291 	 *         or %NULL
1292 	 */
1293 	public void parseError(out ErrorG gerror, out string dbg)
1294 	{
1295 		GError* outgerror = null;
1296 		char* outdbg = null;
1297 		
1298 		gst_message_parse_error(gstMessage, &outgerror, &outdbg);
1299 		
1300 		gerror = new ErrorG(outgerror);
1301 		dbg = Str.toString(outdbg);
1302 	}
1303 
1304 	/**
1305 	 * Extract the group from the STREAM_START message.
1306 	 *
1307 	 * Params:
1308 	 *     groupId = Result location for the group id or
1309 	 *         %NULL
1310 	 *
1311 	 * Return: %TRUE if the message had a group id set, %FALSE otherwise
1312 	 *
1313 	 *     MT safe.
1314 	 *
1315 	 * Since: 1.2
1316 	 */
1317 	public bool parseGroupId(out uint groupId)
1318 	{
1319 		return gst_message_parse_group_id(gstMessage, &groupId) != 0;
1320 	}
1321 
1322 	/**
1323 	 * Extract the context from the HAVE_CONTEXT message.
1324 	 *
1325 	 * MT safe.
1326 	 *
1327 	 * Params:
1328 	 *     context = Result location for the
1329 	 *         context or %NULL
1330 	 *
1331 	 * Since: 1.2
1332 	 */
1333 	public void parseHaveContext(out Context context)
1334 	{
1335 		GstContext* outcontext = null;
1336 		
1337 		gst_message_parse_have_context(gstMessage, &outcontext);
1338 		
1339 		context = ObjectG.getDObject!(Context)(outcontext);
1340 	}
1341 
1342 	/**
1343 	 * Extracts the GError and debug string from the GstMessage. The values returned
1344 	 * in the output arguments are copies; the caller must free them when done.
1345 	 *
1346 	 * MT safe.
1347 	 *
1348 	 * Params:
1349 	 *     gerror = location for the GError
1350 	 *     dbg = location for the debug message,
1351 	 *         or %NULL
1352 	 */
1353 	public void parseInfo(out ErrorG gerror, out string dbg)
1354 	{
1355 		GError* outgerror = null;
1356 		char* outdbg = null;
1357 		
1358 		gst_message_parse_info(gstMessage, &outgerror, &outdbg);
1359 		
1360 		gerror = new ErrorG(outgerror);
1361 		dbg = Str.toString(outdbg);
1362 	}
1363 
1364 	/**
1365 	 * Extracts the new clock from the GstMessage.
1366 	 * The clock object returned remains valid until the message is freed.
1367 	 *
1368 	 * MT safe.
1369 	 *
1370 	 * Params:
1371 	 *     clock = a pointer to hold the selected
1372 	 *         new clock
1373 	 */
1374 	public void parseNewClock(out Clock clock)
1375 	{
1376 		GstClock* outclock = null;
1377 		
1378 		gst_message_parse_new_clock(gstMessage, &outclock);
1379 		
1380 		clock = ObjectG.getDObject!(Clock)(outclock);
1381 	}
1382 
1383 	/**
1384 	 * Parses the progress @type, @code and @text.
1385 	 *
1386 	 * Params:
1387 	 *     type = location for the type
1388 	 *     code = location for the code
1389 	 *     text = location for the text
1390 	 */
1391 	public void parseProgress(out GstProgressType type, out string code, out string text)
1392 	{
1393 		char* outcode = null;
1394 		char* outtext = null;
1395 		
1396 		gst_message_parse_progress(gstMessage, &type, &outcode, &outtext);
1397 		
1398 		code = Str.toString(outcode);
1399 		text = Str.toString(outtext);
1400 	}
1401 
1402 	/**
1403 	 * Extract the timestamps and live status from the QoS message.
1404 	 *
1405 	 * The returned values give the running_time, stream_time, timestamp and
1406 	 * duration of the dropped buffer. Values of GST_CLOCK_TIME_NONE mean unknown
1407 	 * values.
1408 	 *
1409 	 * MT safe.
1410 	 *
1411 	 * Params:
1412 	 *     live = if the message was generated by a live element
1413 	 *     runningTime = the running time of the buffer that
1414 	 *         generated the message
1415 	 *     streamTime = the stream time of the buffer that
1416 	 *         generated the message
1417 	 *     timestamp = the timestamps of the buffer that
1418 	 *         generated the message
1419 	 *     duration = the duration of the buffer that
1420 	 *         generated the message
1421 	 */
1422 	public void parseQos(out bool live, out ulong runningTime, out ulong streamTime, out ulong timestamp, out ulong duration)
1423 	{
1424 		int outlive;
1425 		
1426 		gst_message_parse_qos(gstMessage, &outlive, &runningTime, &streamTime, &timestamp, &duration);
1427 		
1428 		live = (outlive == 1);
1429 	}
1430 
1431 	/**
1432 	 * Extract the QoS stats representing the history of the current continuous
1433 	 * pipeline playback period.
1434 	 *
1435 	 * When @format is @GST_FORMAT_UNDEFINED both @dropped and @processed are
1436 	 * invalid. Values of -1 for either @processed or @dropped mean unknown values.
1437 	 *
1438 	 * MT safe.
1439 	 *
1440 	 * Params:
1441 	 *     format = Units of the 'processed' and 'dropped' fields.
1442 	 *         Video sinks and video filters will use GST_FORMAT_BUFFERS (frames).
1443 	 *         Audio sinks and audio filters will likely use GST_FORMAT_DEFAULT
1444 	 *         (samples).
1445 	 *     processed = Total number of units correctly processed
1446 	 *         since the last state change to READY or a flushing operation.
1447 	 *     dropped = Total number of units dropped since the last
1448 	 *         state change to READY or a flushing operation.
1449 	 */
1450 	public void parseQosStats(out GstFormat format, out ulong processed, out ulong dropped)
1451 	{
1452 		gst_message_parse_qos_stats(gstMessage, &format, &processed, &dropped);
1453 	}
1454 
1455 	/**
1456 	 * Extract the QoS values that have been calculated/analysed from the QoS data
1457 	 *
1458 	 * MT safe.
1459 	 *
1460 	 * Params:
1461 	 *     jitter = The difference of the running-time against
1462 	 *         the deadline.
1463 	 *     proportion = Long term prediction of the ideal rate
1464 	 *         relative to normal rate to get optimal quality.
1465 	 *     quality = An element dependent integer value that
1466 	 *         specifies the current quality level of the element. The default
1467 	 *         maximum quality is 1000000.
1468 	 */
1469 	public void parseQosValues(out long jitter, out double proportion, out int quality)
1470 	{
1471 		gst_message_parse_qos_values(gstMessage, &jitter, &proportion, &quality);
1472 	}
1473 
1474 	/**
1475 	 * Extract the requested state from the request_state message.
1476 	 *
1477 	 * MT safe.
1478 	 *
1479 	 * Params:
1480 	 *     state = Result location for the requested state or %NULL
1481 	 */
1482 	public void parseRequestState(out GstState state)
1483 	{
1484 		gst_message_parse_request_state(gstMessage, &state);
1485 	}
1486 
1487 	/**
1488 	 * Extract the running-time from the RESET_TIME message.
1489 	 *
1490 	 * MT safe.
1491 	 *
1492 	 * Params:
1493 	 *     runningTime = Result location for the running_time or
1494 	 *         %NULL
1495 	 */
1496 	public void parseResetTime(out GstClockTime runningTime)
1497 	{
1498 		gst_message_parse_reset_time(gstMessage, &runningTime);
1499 	}
1500 
1501 	/**
1502 	 * Extracts the position and format from the segment done message.
1503 	 *
1504 	 * MT safe.
1505 	 *
1506 	 * Params:
1507 	 *     format = Result location for the format, or %NULL
1508 	 *     position = Result location for the position, or %NULL
1509 	 */
1510 	public void parseSegmentDone(out GstFormat format, out long position)
1511 	{
1512 		gst_message_parse_segment_done(gstMessage, &format, &position);
1513 	}
1514 
1515 	/**
1516 	 * Extracts the position and format from the segment start message.
1517 	 *
1518 	 * MT safe.
1519 	 *
1520 	 * Params:
1521 	 *     format = Result location for the format, or %NULL
1522 	 *     position = Result location for the position, or %NULL
1523 	 */
1524 	public void parseSegmentStart(out GstFormat format, out long position)
1525 	{
1526 		gst_message_parse_segment_start(gstMessage, &format, &position);
1527 	}
1528 
1529 	/**
1530 	 * Extracts the old and new states from the GstMessage.
1531 	 *
1532 	 * Typical usage of this function might be:
1533 	 * |[
1534 	 * ...
1535 	 * switch (GST_MESSAGE_TYPE (msg)) {
1536 	 * case GST_MESSAGE_STATE_CHANGED: {
1537 	 * GstState old_state, new_state;
1538 	 *
1539 	 * gst_message_parse_state_changed (msg, &amp;old_state, &amp;new_state, NULL);
1540 	 * g_print ("Element %s changed state from %s to %s.\n",
1541 	 * GST_OBJECT_NAME (msg->src),
1542 	 * gst_element_state_get_name (old_state),
1543 	 * gst_element_state_get_name (new_state));
1544 	 * break;
1545 	 * }
1546 	 * ...
1547 	 * }
1548 	 * ...
1549 	 * ]|
1550 	 *
1551 	 * MT safe.
1552 	 *
1553 	 * Params:
1554 	 *     oldstate = the previous state, or %NULL
1555 	 *     newstate = the new (current) state, or %NULL
1556 	 *     pending = the pending (target) state, or %NULL
1557 	 */
1558 	public void parseStateChanged(out GstState oldstate, out GstState newstate, out GstState pending)
1559 	{
1560 		gst_message_parse_state_changed(gstMessage, &oldstate, &newstate, &pending);
1561 	}
1562 
1563 	/**
1564 	 * Extract the values the step_done message.
1565 	 *
1566 	 * MT safe.
1567 	 *
1568 	 * Params:
1569 	 *     format = result location for the format
1570 	 *     amount = result location for the amount
1571 	 *     rate = result location for the rate
1572 	 *     flush = result location for the flush flag
1573 	 *     intermediate = result location for the intermediate flag
1574 	 *     duration = result location for the duration
1575 	 *     eos = result location for the EOS flag
1576 	 */
1577 	public void parseStepDone(out GstFormat format, out ulong amount, out double rate, out bool flush, out bool intermediate, out ulong duration, out bool eos)
1578 	{
1579 		int outflush;
1580 		int outintermediate;
1581 		int outeos;
1582 		
1583 		gst_message_parse_step_done(gstMessage, &format, &amount, &rate, &outflush, &outintermediate, &duration, &outeos);
1584 		
1585 		flush = (outflush == 1);
1586 		intermediate = (outintermediate == 1);
1587 		eos = (outeos == 1);
1588 	}
1589 
1590 	/**
1591 	 * Extract the values from step_start message.
1592 	 *
1593 	 * MT safe.
1594 	 *
1595 	 * Params:
1596 	 *     active = result location for the active flag
1597 	 *     format = result location for the format
1598 	 *     amount = result location for the amount
1599 	 *     rate = result location for the rate
1600 	 *     flush = result location for the flush flag
1601 	 *     intermediate = result location for the intermediate flag
1602 	 */
1603 	public void parseStepStart(out bool active, out GstFormat format, out ulong amount, out double rate, out bool flush, out bool intermediate)
1604 	{
1605 		int outactive;
1606 		int outflush;
1607 		int outintermediate;
1608 		
1609 		gst_message_parse_step_start(gstMessage, &outactive, &format, &amount, &rate, &outflush, &outintermediate);
1610 		
1611 		active = (outactive == 1);
1612 		flush = (outflush == 1);
1613 		intermediate = (outintermediate == 1);
1614 	}
1615 
1616 	/**
1617 	 * Extracts the stream status type and owner the GstMessage. The returned
1618 	 * owner remains valid for as long as the reference to @message is valid and
1619 	 * should thus not be unreffed.
1620 	 *
1621 	 * MT safe.
1622 	 *
1623 	 * Params:
1624 	 *     type = A pointer to hold the status type
1625 	 *     owner = The owner element of the message source
1626 	 */
1627 	public void parseStreamStatus(out GstStreamStatusType type, out Element owner)
1628 	{
1629 		GstElement* outowner = null;
1630 		
1631 		gst_message_parse_stream_status(gstMessage, &type, &outowner);
1632 		
1633 		owner = ObjectG.getDObject!(Element)(outowner);
1634 	}
1635 
1636 	/**
1637 	 * Extracts the change type and completion status from the GstMessage.
1638 	 *
1639 	 * MT safe.
1640 	 *
1641 	 * Params:
1642 	 *     type = A pointer to hold the change type
1643 	 *     owner = The owner element of the
1644 	 *         message source
1645 	 *     busy = a pointer to hold whether the change is in
1646 	 *         progress or has been completed
1647 	 */
1648 	public void parseStructureChange(out GstStructureChangeType type, out Element owner, out bool busy)
1649 	{
1650 		GstElement* outowner = null;
1651 		int outbusy;
1652 		
1653 		gst_message_parse_structure_change(gstMessage, &type, &outowner, &outbusy);
1654 		
1655 		owner = ObjectG.getDObject!(Element)(outowner);
1656 		busy = (outbusy == 1);
1657 	}
1658 
1659 	/**
1660 	 * Extracts the tag list from the GstMessage. The tag list returned in the
1661 	 * output argument is a copy; the caller must free it when done.
1662 	 *
1663 	 * Typical usage of this function might be:
1664 	 * |[
1665 	 * ...
1666 	 * switch (GST_MESSAGE_TYPE (msg)) {
1667 	 * case GST_MESSAGE_TAG: {
1668 	 * GstTagList *tags = NULL;
1669 	 *
1670 	 * gst_message_parse_tag (msg, &amp;tags);
1671 	 * g_print ("Got tags from element %s\n", GST_OBJECT_NAME (msg->src));
1672 	 * handle_tags (tags);
1673 	 * gst_tag_list_unref (tags);
1674 	 * break;
1675 	 * }
1676 	 * ...
1677 	 * }
1678 	 * ...
1679 	 * ]|
1680 	 *
1681 	 * MT safe.
1682 	 *
1683 	 * Params:
1684 	 *     tagList = return location for the tag-list.
1685 	 */
1686 	public void parseTag(out TagList tagList)
1687 	{
1688 		GstTagList* outtagList = null;
1689 		
1690 		gst_message_parse_tag(gstMessage, &outtagList);
1691 		
1692 		tagList = ObjectG.getDObject!(TagList)(outtagList);
1693 	}
1694 
1695 	/**
1696 	 * Extract the TOC from the #GstMessage. The TOC returned in the
1697 	 * output argument is a copy; the caller must free it with
1698 	 * gst_toc_unref() when done.
1699 	 *
1700 	 * MT safe.
1701 	 *
1702 	 * Params:
1703 	 *     toc = return location for the TOC.
1704 	 *     updated = return location for the updated flag.
1705 	 */
1706 	public void parseToc(out Toc toc, out bool updated)
1707 	{
1708 		GstToc* outtoc = null;
1709 		int outupdated;
1710 		
1711 		gst_message_parse_toc(gstMessage, &outtoc, &outupdated);
1712 		
1713 		toc = ObjectG.getDObject!(Toc)(outtoc);
1714 		updated = (outupdated == 1);
1715 	}
1716 
1717 	/**
1718 	 * Extracts the GError and debug string from the GstMessage. The values returned
1719 	 * in the output arguments are copies; the caller must free them when done.
1720 	 *
1721 	 * MT safe.
1722 	 *
1723 	 * Params:
1724 	 *     gerror = location for the GError
1725 	 *     dbg = location for the debug message,
1726 	 *         or %NULL
1727 	 */
1728 	public void parseWarning(out ErrorG gerror, out string dbg)
1729 	{
1730 		GError* outgerror = null;
1731 		char* outdbg = null;
1732 		
1733 		gst_message_parse_warning(gstMessage, &outgerror, &outdbg);
1734 		
1735 		gerror = new ErrorG(outgerror);
1736 		dbg = Str.toString(outdbg);
1737 	}
1738 
1739 	/**
1740 	 * Configures the buffering stats values in @message.
1741 	 *
1742 	 * Params:
1743 	 *     mode = a buffering mode
1744 	 *     avgIn = the average input rate
1745 	 *     avgOut = the average output rate
1746 	 *     bufferingLeft = amount of buffering time left in milliseconds
1747 	 */
1748 	public void setBufferingStats(GstBufferingMode mode, int avgIn, int avgOut, long bufferingLeft)
1749 	{
1750 		gst_message_set_buffering_stats(gstMessage, mode, avgIn, avgOut, bufferingLeft);
1751 	}
1752 
1753 	/**
1754 	 * Sets the group id on the stream-start message.
1755 	 *
1756 	 * All streams that have the same group id are supposed to be played
1757 	 * together, i.e. all streams inside a container file should have the
1758 	 * same group id but different stream ids. The group id should change
1759 	 * each time the stream is started, resulting in different group ids
1760 	 * each time a file is played for example.
1761 	 *
1762 	 * MT safe.
1763 	 *
1764 	 * Params:
1765 	 *     groupId = the group id
1766 	 *
1767 	 * Since: 1.2
1768 	 */
1769 	public void setGroupId(uint groupId)
1770 	{
1771 		gst_message_set_group_id(gstMessage, groupId);
1772 	}
1773 
1774 	/**
1775 	 * Set the QoS stats representing the history of the current continuous pipeline
1776 	 * playback period.
1777 	 *
1778 	 * When @format is @GST_FORMAT_UNDEFINED both @dropped and @processed are
1779 	 * invalid. Values of -1 for either @processed or @dropped mean unknown values.
1780 	 *
1781 	 * MT safe.
1782 	 *
1783 	 * Params:
1784 	 *     format = Units of the 'processed' and 'dropped' fields. Video sinks and video
1785 	 *         filters will use GST_FORMAT_BUFFERS (frames). Audio sinks and audio filters
1786 	 *         will likely use GST_FORMAT_DEFAULT (samples).
1787 	 *     processed = Total number of units correctly processed since the last state
1788 	 *         change to READY or a flushing operation.
1789 	 *     dropped = Total number of units dropped since the last state change to READY
1790 	 *         or a flushing operation.
1791 	 */
1792 	public void setQosStats(GstFormat format, ulong processed, ulong dropped)
1793 	{
1794 		gst_message_set_qos_stats(gstMessage, format, processed, dropped);
1795 	}
1796 
1797 	/**
1798 	 * Set the QoS values that have been calculated/analysed from the QoS data
1799 	 *
1800 	 * MT safe.
1801 	 *
1802 	 * Params:
1803 	 *     jitter = The difference of the running-time against the deadline.
1804 	 *     proportion = Long term prediction of the ideal rate relative to normal rate
1805 	 *         to get optimal quality.
1806 	 *     quality = An element dependent integer value that specifies the current
1807 	 *         quality level of the element. The default maximum quality is 1000000.
1808 	 */
1809 	public void setQosValues(long jitter, double proportion, int quality)
1810 	{
1811 		gst_message_set_qos_values(gstMessage, jitter, proportion, quality);
1812 	}
1813 
1814 	/**
1815 	 * Set the sequence number of a message.
1816 	 *
1817 	 * This function might be called by the creator of a message to indicate that
1818 	 * the message relates to other messages or events. See gst_message_get_seqnum()
1819 	 * for more information.
1820 	 *
1821 	 * MT safe.
1822 	 *
1823 	 * Params:
1824 	 *     seqnum = A sequence number.
1825 	 */
1826 	public void setSeqnum(uint seqnum)
1827 	{
1828 		gst_message_set_seqnum(gstMessage, seqnum);
1829 	}
1830 
1831 	/**
1832 	 * Configures the object handling the streaming thread. This is usually a
1833 	 * GstTask object but other objects might be added in the future.
1834 	 *
1835 	 * Params:
1836 	 *     object = the object controlling the streaming
1837 	 */
1838 	public void setStreamStatusObject(Value object)
1839 	{
1840 		gst_message_set_stream_status_object(gstMessage, (object is null) ? null : object.getValueStruct());
1841 	}
1842 
1843 	/**
1844 	 * Get a printable name for the given message type. Do not modify or free.
1845 	 *
1846 	 * Params:
1847 	 *     type = the message type
1848 	 *
1849 	 * Return: a reference to the static name of the message.
1850 	 */
1851 	public static string typeGetName(GstMessageType type)
1852 	{
1853 		return Str.toString(gst_message_type_get_name(type));
1854 	}
1855 
1856 	/**
1857 	 * Get the unique quark for the given message type.
1858 	 *
1859 	 * Params:
1860 	 *     type = the message type
1861 	 *
1862 	 * Return: the quark associated with the message type
1863 	 */
1864 	public static GQuark typeToQuark(GstMessageType type)
1865 	{
1866 		return gst_message_type_to_quark(type);
1867 	}
1868 }