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