2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gstreamer-GstMessage.html
44 * - gst_message_parse_tag
45 * - gst_message_type_to_quark
46 * - gst_message_new_element
47 * - gst_message_new_new_clock
48 * - gst_message_new_segment_done
49 * - gst_message_new_segment_start
50 * - gst_message_new_warning
51 * - gst_message_new_state_dirty
52 * - gst_message_new_eos
53 * - gst_message_new_error
54 * - gst_message_new_info
58 * - gstreamer.Structure
59 * - gstreamer.ObjectGst
66 * - GstClock* -> Clock
67 * - GstMessage* -> Message
68 * - GstObject* -> ObjectGst
69 * - GstStructure* -> Structure
70 * - GstTagList* -> TagList
75 module gstreamer
.Message
;
77 private import gstreamerc
.gstreamertypes
;
79 private import gstreamerc
.gstreamer
;
81 private import glib
.Str
;
82 private import glib
.Quark
;
83 private import gstreamer
.Structure
;
84 private import gstreamer
.ObjectGst
;
85 private import gstreamer
.Clock
;
86 private import glib
.ErrorG
;
87 private import gstreamer
.TagList
;
93 * Messages are implemented as a subclass of GstMiniObject with a generic
94 * GstStructure as the content. This allows for writing custom messages without
95 * requiring an API change while allowing a wide range of different types
97 * Messages are posted by objects in the pipeline and are passed to the
98 * application using the GstBus.
99 * The basic use pattern of posting a message on a GstBus is as follows:
100 * Example11.Posting a GstMessage
101 * gst_bus_post (bus, gst_message_new_eos());
102 * A GstElement usually posts messages on the bus provided by the parent
103 * container using gst_element_post_message().
104 * Last reviewed on 2005-11-09 (0.9.4)
109 /** the main Gtk struct */
110 protected GstMessage
* gstMessage
;
113 public GstMessage
* getMessageStruct()
119 /** the main Gtk struct as a void* */
120 protected void* getStruct()
122 return cast(void*)gstMessage
;
126 * Sets our main struct and passes it to the parent class
128 public this (GstMessage
* gstMessage
)
130 this.gstMessage
= gstMessage
;
134 * Get the type of the message.
136 public GstMessageType
type()
138 return getMessageStruct().type
;
142 * Get the src (the element that originated the message) of the message.
144 public ObjectGst
src()
146 return new ObjectGst( cast(GstObject
*)getMessageStruct().src
);
152 public Structure
structure()
154 return new Structure( getMessageStruct().structure
);
158 * Extracts the tag list from the GstMessage. The tag list returned in the
159 * output argument is a copy; the caller must free it when done.
162 * A valid GstMessage of type GST_MESSAGE_TAG.
164 * Return location for the tag-list.
166 /*public void parseTag(GstTagList** tagList)
168 // void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list);
169 gst_message_parse_tag(gstMessage, tagList);
171 public TagList
parseTag()
173 // void gst_message_parse_tag (GstMessage *message, GstTagList **tag_list);
174 GstTagList
* tag_list_c
;
175 gst_message_parse_tag(gstMessage
, &tag_list_c
);
176 return new TagList(tag_list_c
);
179 //I'm not so sure about the following:
181 * Get the unique quark for the given message type.
185 * the quark associated with the message type
187 public static Quark
typeToQuark(GstMessageType type
)
189 // GQuark gst_message_type_to_quark (GstMessageType type);
190 return new Quark( cast(uint*)gst_message_type_to_quark(type
) );
194 * Create a new element-specific message. This is meant as a generic way of
195 * allowing one-way communication from an element to an application, for example
196 * "the firewire cable was unplugged". The format of the message should be
197 * documented in the element's documentation. The structure field can be NULL.
199 * The object originating the message.
201 * The structure for the message. The message will take ownership of
204 * The new element message.
207 public static Message
newElement(ObjectGst src
, Structure structure
)
209 // GstMessage* gst_message_new_element (GstObject *src, GstStructure *structure);
210 return new Message(cast(GstMessage
*)gst_message_new_element((src
is null) ?
null : src
.getObjectGstStruct(), (structure
is null) ?
null : structure
.getStructureStruct()) );
214 * Create a new clock message. This message is posted whenever the
215 * pipeline selectes a new clock for the pipeline.
217 * The object originating the message.
219 * the new selected clock
221 * The new new clock message.
224 public static Message
newNewClock(ObjectGst src
, Clock clock
)
226 // GstMessage* gst_message_new_new_clock (GstObject *src, GstClock *clock);
227 return new Message(cast(GstMessage
*)gst_message_new_new_clock((src
is null) ?
null : src
.getObjectGstStruct(), (clock
is null) ?
null : clock
.getClockStruct()) );
231 * Create a new segment done message. This message is posted by elements that
232 * finish playback of a segment as a result of a segment seek. This message
233 * is received by the application after all elements that posted a segment_start
234 * have posted the segment_done.
236 * The object originating the message.
238 * The format of the position being done
240 * The position of the segment being done
242 * The new segment done message.
245 public static Message
newSegmentDone(ObjectGst src
, GstFormat format
, long position
)
247 // GstMessage* gst_message_new_segment_done (GstObject *src, GstFormat format, gint64 position);
248 return new Message(cast(GstMessage
*)gst_message_new_segment_done((src
is null) ?
null : src
.getObjectGstStruct(), format
, position
) );
252 * Create a new segment message. This message is posted by elements that
253 * start playback of a segment as a result of a segment seek. This message
254 * is not received by the application but is used for maintenance reasons in
255 * container elements.
257 * The object originating the message.
259 * The format of the position being played
261 * The position of the segment being played
263 * The new segment start message.
266 public static Message
newSegmentStart(ObjectGst src
, GstFormat format
, long position
)
268 // GstMessage* gst_message_new_segment_start (GstObject *src, GstFormat format, gint64 position);
269 return new Message(cast(GstMessage
*)gst_message_new_segment_start((src
is null) ?
null : src
.getObjectGstStruct(), format
, position
) );
273 * Create a new warning message. The message will make copies of error and
276 * The object originating the message.
278 * The GError for this message.
280 * A debugging string for something or other.
282 * The new warning message.
285 public static Message
newWarning(ObjectGst src
, ErrorG error
, char[] dbug
)
287 // GstMessage* gst_message_new_warning (GstObject *src, GError *error, gchar *debug);
288 return new Message(cast(GstMessage
*)gst_message_new_warning((src
is null) ?
null : src
.getObjectGstStruct(), (error
is null) ?
null : error
.getErrorGStruct(), Str
.toStringz(dbug
)) );
292 * Create a state dirty message. This message is posted whenever an element
293 * changed its state asynchronously and is used internally to update the
294 * states of container objects.
296 * the object originating the message
298 * The new state dirty message.
301 public static Message
newStateDirty(ObjectGst src
)
303 // GstMessage* gst_message_new_state_dirty (GstObject *src);
304 return new Message(cast(GstMessage
*)gst_message_new_state_dirty((src
is null) ?
null : src
.getObjectGstStruct()) );
308 * Create a new eos message. This message is generated and posted in
309 * the sink elements of a GstBin. The bin will only forward the EOS
310 * message to the application if all sinks have posted an EOS message.
312 * The object originating the message.
314 * The new eos message.
317 public static Message
newEOS(ObjectGst src
)
319 // GstMessage* gst_message_new_eos (GstObject *src);
320 return new Message(cast(GstMessage
*)gst_message_new_eos((src
is null) ?
null : src
.getObjectGstStruct()) );
324 * Create a new error message. The message will copy error and
325 * debug. This message is posted by element when a fatal event
326 * occured. The pipeline will probably (partially) stop. The application
327 * receiving this message should stop the pipeline.
329 * The object originating the message.
331 * The GError for this message.
333 * A debugging string for something or other.
335 * The new error message.
338 public static Message
newError(ObjectGst src
, ErrorG error
, char[] dbug
)
340 // GstMessage* gst_message_new_error (GstObject *src, GError *error, gchar *debug);
341 return new Message(cast(GstMessage
*)gst_message_new_error((src
is null) ?
null : src
.getObjectGstStruct(), (error
is null) ?
null : error
.getErrorGStruct(), Str
.toStringz(dbug
)) );
345 * Create a new info message. The message will make copies of error and
348 * The object originating the message.
350 * The GError for this message.
352 * A debugging string for something or other.
354 * The new info message.
358 public static Message
newInfo(ObjectGst src
, ErrorG error
, char[] dbug
)
360 // GstMessage* gst_message_new_info (GstObject *src, GError *error, gchar *debug);
361 return new Message(cast(GstMessage
*)gst_message_new_info((src
is null) ?
null : src
.getObjectGstStruct(), (error
is null) ?
null : error
.getErrorGStruct(), Str
.toStringz(dbug
)) );
376 * Get a printable name for the given message type. Do not modify or free.
380 * a reference to the static name of the message.
382 public static char[] typeGetName(GstMessageType type
)
384 // const gchar* gst_message_type_get_name (GstMessageType type);
385 return Str
.toString(gst_message_type_get_name(type
) );
390 * Access the structure of the message.
394 * The structure of the message. The structure is still
395 * owned by the message, which means that you should not free it and
396 * that the pointer becomes invalid when you free the message.
399 public Structure
getStructure()
401 // const GstStructure* gst_message_get_structure (GstMessage *message);
402 return new Structure( gst_message_get_structure(gstMessage
) );
407 * Create a new application-typed message. GStreamer will never create these
408 * messages; they are a gift from us to you. Enjoy.
410 * The object originating the message.
412 * The structure for the message. The message will take ownership of
415 * The new application message.
418 public this (ObjectGst src
, Structure structure
)
420 // GstMessage* gst_message_new_application (GstObject *src, GstStructure *structure);
421 this(cast(GstMessage
*)gst_message_new_application((src
is null) ?
null : src
.getObjectGstStruct(), (structure
is null) ?
null : structure
.getStructureStruct()) );
425 * Create a clock provide message. This message is posted whenever an
426 * element is ready to provide a clock or lost its ability to provide
427 * a clock (maybe because it paused or became EOS).
428 * This message is mainly used internally to manage the clock
431 * The object originating the message.
433 * The clock it provides
435 * TRUE if the sender can provide a clock
437 * The new provide clock message.
440 public this (ObjectGst src
, Clock clock
, int ready
)
442 // GstMessage* gst_message_new_clock_provide (GstObject *src, GstClock *clock, gboolean ready);
443 this(cast(GstMessage
*)gst_message_new_clock_provide((src
is null) ?
null : src
.getObjectGstStruct(), (clock
is null) ?
null : clock
.getClockStruct(), ready
) );
447 * Create a clock lost message. This message is posted whenever the
448 * clock is not valid anymore.
449 * If this message is posted by the pipeline, the pipeline will
450 * select a new clock again when it goes to PLAYING. It might therefore
451 * be needed to set the pipeline to PAUSED and PLAYING again.
453 * The object originating the message.
455 * the clock that was lost
457 * The new clock lost message.
460 public this (ObjectGst src
, Clock clock
)
462 // GstMessage* gst_message_new_clock_lost (GstObject *src, GstClock *clock);
463 this(cast(GstMessage
*)gst_message_new_clock_lost((src
is null) ?
null : src
.getObjectGstStruct(), (clock
is null) ?
null : clock
.getClockStruct()) );
467 * Create a new custom-typed message. This can be used for anything not
468 * handled by other message-specific functions to pass a message to the
469 * app. The structure field can be NULL.
471 * The GstMessageType to distinguish messages
473 * The object originating the message.
475 * The structure for the message. The message will take ownership of
481 public this (GstMessageType type
, ObjectGst src
, Structure structure
)
483 // GstMessage* gst_message_new_custom (GstMessageType type, GstObject *src, GstStructure *structure);
484 this(cast(GstMessage
*)gst_message_new_custom(type
, (src
is null) ?
null : src
.getObjectGstStruct(), (structure
is null) ?
null : structure
.getStructureStruct()) );
495 * Create a state change message. This message is posted whenever an element
498 * the object originating the message
502 * the new (current) state
504 * the pending (target) state
506 * The new state change message.
509 public this (ObjectGst src
, GstState oldstate
, GstState newstate
, GstState pending
)
511 // GstMessage* gst_message_new_state_changed (GstObject *src, GstState oldstate, GstState newstate, GstState pending);
512 this(cast(GstMessage
*)gst_message_new_state_changed((src
is null) ?
null : src
.getObjectGstStruct(), oldstate
, newstate
, pending
) );
516 * Create a new tag message. The message will take ownership of the tag list.
517 * The message is posted by elements that discovered a new taglist.
519 * The object originating the message.
521 * The tag list for the message.
523 * The new tag message.
526 public this (ObjectGst src
, TagList tagList
)
528 // GstMessage* gst_message_new_tag (GstObject *src, GstTagList *tag_list);
529 this(cast(GstMessage
*)gst_message_new_tag((src
is null) ?
null : src
.getObjectGstStruct(), (tagList
is null) ?
null : tagList
.getTagListStruct()) );
533 * Create a new buffering message. This message can be posted by an element that
534 * needs to buffer data before it can continue processing. percent should be a
535 * value between 0 and 100. A value of 100 means that the buffering completed.
536 * When percent is < 100 the application should PAUSE a PLAYING pipeline. When
537 * percent is 100, the application can set the pipeline (back) to PLAYING.
538 * The application must be prepared to receive BUFFERING messages in the
539 * PREROLLING state and may only set the pipeline to PLAYING after receiving a
540 * message with percent set to 100, which can happen after the pipeline
541 * completed prerolling.
543 * The object originating the message.
545 * The buffering percent
547 * The new buffering message.
551 public this (ObjectGst src
, int percent
)
553 // GstMessage* gst_message_new_buffering (GstObject *src, gint percent);
554 this(cast(GstMessage
*)gst_message_new_buffering((src
is null) ?
null : src
.getObjectGstStruct(), percent
) );
559 * Create a new duration message. This message is posted by elements that
560 * know the duration of a stream in a specific format. This message
561 * is received by bins and is used to calculate the total duration of a
562 * pipeline. Elements may post a duration message with a duration of
563 * GST_CLOCK_TIME_NONE to indicate that the duration has changed and the
564 * cached duration should be discarded. The new duration can then be
565 * retrieved via a query.
567 * The object originating the message.
569 * The format of the duration
573 * The new duration message.
576 public this (ObjectGst src
, GstFormat format
, long duration
)
578 // GstMessage* gst_message_new_duration (GstObject *src, GstFormat format, gint64 duration);
579 this(cast(GstMessage
*)gst_message_new_duration((src
is null) ?
null : src
.getObjectGstStruct(), format
, duration
) );
584 * This message can be posted by elements when their latency requirements have
587 * The object originating the message.
589 * The new latency message.
593 public this (ObjectGst src
)
595 // GstMessage* gst_message_new_latency (GstObject *src);
596 this(cast(GstMessage
*)gst_message_new_latency((src
is null) ?
null : src
.getObjectGstStruct()) );
600 * Extracts the lost clock from the GstMessage.
601 * The clock object returned remains valid until the message is freed.
604 * A valid GstMessage of type GST_MESSAGE_CLOCK_LOST.
606 * A pointer to hold the lost clock
608 public void parseClockLost(GstClock
** clock
)
610 // void gst_message_parse_clock_lost (GstMessage *message, GstClock **clock);
611 gst_message_parse_clock_lost(gstMessage
, clock
);
615 * Extracts the clock and ready flag from the GstMessage.
616 * The clock object returned remains valid until the message is freed.
619 * A valid GstMessage of type GST_MESSAGE_CLOCK_PROVIDE.
621 * A pointer to hold a clock object.
623 * A pointer to hold the ready flag.
625 public void parseClockProvide(GstClock
** clock
, int* ready
)
627 // void gst_message_parse_clock_provide (GstMessage *message, GstClock **clock, gboolean *ready);
628 gst_message_parse_clock_provide(gstMessage
, clock
, ready
);
632 * Extracts the GError and debug string from the GstMessage. The values returned
633 * in the output arguments are copies; the caller must free them when done.
636 * A valid GstMessage of type GST_MESSAGE_ERROR.
638 * Location for the GError
640 * Location for the debug message, or NULL
642 public void parseError(GError
** gerror
, char** dbug
)
644 // void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug);
645 gst_message_parse_error(gstMessage
, gerror
, dbug
);
649 * Extracts the GError and debug string from the GstMessage. The values returned
650 * in the output arguments are copies; the caller must free them when done.
653 * A valid GstMessage of type GST_MESSAGE_INFO.
655 * Location for the GError
657 * Location for the debug message, or NULL
660 public void parseInfo(GError
** gerror
, char** dbug
)
662 // void gst_message_parse_info (GstMessage *message, GError **gerror, gchar **debug);
663 gst_message_parse_info(gstMessage
, gerror
, dbug
);
667 * Extracts the new clock from the GstMessage.
668 * The clock object returned remains valid until the message is freed.
671 * A valid GstMessage of type GST_MESSAGE_NEW_CLOCK.
673 * A pointer to hold the selected new clock
675 public void parseNewClock(GstClock
** clock
)
677 // void gst_message_parse_new_clock (GstMessage *message, GstClock **clock);
678 gst_message_parse_new_clock(gstMessage
, clock
);
682 * Extracts the position and format from the segment start message.
685 * A valid GstMessage of type GST_MESSAGE_SEGMENT_DONE.
687 * Result location for the format, or NULL
689 * Result location for the position, or NULL
691 public void parseSegmentDone(GstFormat
* format
, long* position
)
693 // void gst_message_parse_segment_done (GstMessage *message, GstFormat *format, gint64 *position);
694 gst_message_parse_segment_done(gstMessage
, format
, position
);
698 * Extracts the position and format from the segment start message.
701 * A valid GstMessage of type GST_MESSAGE_SEGMENT_START.
703 * Result location for the format, or NULL
705 * Result location for the position, or NULL
707 public void parseSegmentStart(GstFormat
* format
, long* position
)
709 // void gst_message_parse_segment_start (GstMessage *message, GstFormat *format, gint64 *position);
710 gst_message_parse_segment_start(gstMessage
, format
, position
);
714 * Extracts the old and new states from the GstMessage.
717 * a valid GstMessage of type GST_MESSAGE_STATE_CHANGED
719 * the previous state, or NULL
721 * the new (current) state, or NULL
723 * the pending (target) state, or NULL
725 public void parseStateChanged(GstState
* oldstate
, GstState
* newstate
, GstState
* pending
)
727 // void gst_message_parse_state_changed (GstMessage *message, GstState *oldstate, GstState *newstate, GstState *pending);
728 gst_message_parse_state_changed(gstMessage
, oldstate
, newstate
, pending
);
733 * Extracts the buffering percent from the GstMessage. see also
734 * gst_message_new_buffering().
736 * A valid GstMessage of type GST_MESSAGE_BUFFERING.
738 * Return location for the percent.
742 public void parseBuffering(int* percent
)
744 // void gst_message_parse_buffering (GstMessage *message, gint *percent);
745 gst_message_parse_buffering(gstMessage
, percent
);
749 * Extracts the GError and debug string from the GstMessage. The values returned
750 * in the output arguments are copies; the caller must free them when done.
753 * A valid GstMessage of type GST_MESSAGE_WARNING.
755 * Location for the GError
757 * Location for the debug message, or NULL
759 public void parseWarning(GError
** gerror
, char** dbug
)
761 // void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug);
762 gst_message_parse_warning(gstMessage
, gerror
, dbug
);
766 * Extracts the duration and format from the duration message. The duration
767 * might be GST_CLOCK_TIME_NONE, which indicates that the duration has
768 * changed. Applications should always use a query to retrieve the duration
772 * A valid GstMessage of type GST_MESSAGE_DURATION.
774 * Result location for the format, or NULL
776 * Result location for the duration, or NULL
778 public void parseDuration(GstFormat
* format
, long* duration
)
780 // void gst_message_parse_duration (GstMessage *message, GstFormat *format, gint64 *duration);
781 gst_message_parse_duration(gstMessage
, format
, duration
);
785 * Convenience macro to increase the reference count of the message.
789 * msg (for convenience when doing assignments)
791 public Message
doref()
793 // GstMessage* gst_message_ref (GstMessage *msg);
794 return new Message( gst_message_ref(gstMessage
) );