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-GstEvent.html
44 * - gst_event_new_buffer_size
46 * - gst_event_new_flush_start
47 * - gst_event_new_flush_stop
48 * - gst_event_new_navigation
51 * - gstreamer.Structure
53 * - gstreamer.MiniObject
55 * - GstEvent* -> Event
56 * - GstMiniObject -> MiniObject
57 * - GstMiniObject* -> MiniObject
58 * - GstStructure* -> Structure
59 * - GstTagList* -> TagList
64 module gstreamer
.Event
;
66 private import gstreamerc
.gstreamertypes
;
68 private import gstreamerc
.gstreamer
;
70 private import glib
.Str
;
71 private import gstreamer
.Structure
;
72 private import gstreamer
.TagList
;
73 private import gstreamer
.MiniObject
;
79 * The event class provides factory methods to construct and functions query
81 * Events are usually created with gst_event_new_*() which takes event-type
82 * specific parameters as arguments.
83 * To send an event application will usually use gst_element_send_event() and
84 * elements will use gst_pad_send_event() or gst_pad_push_event().
85 * The event should be unreffed with gst_event_unref() if it has not been sent.
86 * Events that have been received can be parsed with their respective
87 * gst_event_parse_*() functions.
88 * Events are passed between elements in parallel to the data stream. Some events
89 * are serialized with buffers, others are not. Some events only travel downstream,
90 * others only upstream. Some events can travel both upstream and downstream.
91 * The events are used to signal special conditions in the datastream such as
92 * EOS (end of stream) or the start of a new stream-segment.
93 * Events are also used to flush the pipeline of any pending data.
94 * Most of the event API is used inside plugins. Applications usually only
95 * construct and use seek events.
96 * To do that gst_event_new_seek() is used to create a seek event. It takes
97 * the needed parameters to specity seeking time and mode.
98 * Example8.performing a seek on a pipeline
102 * // construct a seek event to play the media from second 2 to 5, flush
103 * // the pipeline to decrease latency.
104 * event = gst_event_new_seek (1.0,
106 * GST_SEEK_FLAG_FLUSH,
107 * GST_SEEK_TYPE_SET, 2 * GST_SECOND,
108 * GST_SEEK_TYPE_SET, 5 * GST_SECOND);
110 * result = gst_element_send_event (pipeline, event);
112 * g_warning ("seek failed");
114 * Last reviewed on 2006-09-6 (0.10.10)
119 /** the main Gtk struct */
120 protected GstEvent
* gstEvent
;
123 public GstEvent
* getEventStruct()
129 /** the main Gtk struct as a void* */
130 protected void* getStruct()
132 return cast(void*)gstEvent
;
136 * Sets our main struct and passes it to the parent class
138 public this (GstEvent
* gstEvent
)
140 this.gstEvent
= gstEvent
;
144 * Create a new buffersize event. The event is sent downstream and notifies
145 * elements that they should provide a buffer of the specified dimensions.
146 * When the async flag is set, a thread boundary is prefered.
150 * minimum buffer size
152 * maximum buffer size
158 public static Event
newBufferSize(GstFormat format
, long minsize
, long maxsize
, int async
)
160 // GstEvent* gst_event_new_buffer_size (GstFormat format, gint64 minsize, gint64 maxsize, gboolean async);
161 return new Event(cast(GstEvent
*)gst_event_new_buffer_size(format
, minsize
, maxsize
, async
) );
163 * Create a new EOS event. The eos event can only travel downstream
164 * synchronized with the buffer flow. Elements that receive the EOS
165 * event on a pad can return UNEXPECTED as a GstFlowReturn when data
166 * after the EOS event arrives.
167 * The EOS event will travel down to the sink elements in the pipeline
168 * which will then post the GST_MESSAGE_EOS on the bus after they have
169 * finished playing any buffered data.
170 * When all sinks have posted an EOS message, the EOS message is
171 * forwarded to the application.
175 public static Event
newEOS()
177 // GstEvent* gst_event_new_eos (void);
178 return new Event(cast(GstEvent
*)gst_event_new_eos() );
180 * Allocate a new flush start event. The flush start event can be send
181 * upstream and downstream and travels out-of-bounds with the dataflow.
182 * It marks pads as being in a WRONG_STATE to process more data.
183 * Elements unlock and blocking functions and exit their streaming functions
184 * as fast as possible.
185 * This event is typically generated after a seek to minimize the latency
188 * A new flush start event.
190 public static Event
newFlushStart()
192 // GstEvent* gst_event_new_flush_start (void);
193 return new Event(cast(GstEvent
*)gst_event_new_flush_start() );
195 * Allocate a new flush stop event. The flush start event can be send
196 * upstream and downstream and travels out-of-bounds with the dataflow.
197 * It is typically send after sending a FLUSH_START event to make the
198 * pads accept data again.
199 * Elements can process this event synchronized with the dataflow since
200 * the preceeding FLUSH_START event stopped the dataflow.
201 * This event is typically generated to complete a seek and to resume
204 * A new flush stop event.
206 public static Event
newFlushStop()
208 // GstEvent* gst_event_new_flush_stop (void);
209 return new Event(cast(GstEvent
*)gst_event_new_flush_stop() );
211 * Create a new navigation event from the given description.
213 * description of the event
217 public static Event
newNavigation(Structure structure
)
219 // GstEvent* gst_event_new_navigation (GstStructure *structure);
220 return new Event(cast(GstEvent
*)gst_event_new_navigation((structure
is null) ?
null : structure
.getStructureStruct()) );
243 * Access the structure of the event.
247 * The structure of the event. The structure is still
248 * owned by the event, which means that you should not free it and
249 * that the pointer becomes invalid when you free the event.
252 public Structure
getStructure()
254 // const GstStructure* gst_event_get_structure (GstEvent *event);
255 return new Structure( gst_event_get_structure(gstEvent
) );
260 * Create a new custom-typed event. This can be used for anything not
261 * handled by other event-specific functions to pass an event to another
263 * Make sure to allocate an event type with the GST_EVENT_MAKE_TYPE macro,
264 * assigning a free number and filling in the correct direction and
265 * serialization flags.
266 * New custom events can also be created by subclassing the event type if
269 * The type of the new event
271 * The structure for the event. The event will take ownership of
274 * The new custom event.
276 public this (GstEventType type
, Structure structure
)
278 // GstEvent* gst_event_new_custom (GstEventType type, GstStructure *structure);
279 this(cast(GstEvent
*)gst_event_new_custom(type
, (structure
is null) ?
null : structure
.getStructureStruct()) );
286 * Create a new latency event. The event is sent upstream from the sinks and
287 * notifies elements that they should add an additional latency to the
288 * timestamps before synchronising against the clock.
289 * The latency is mostly used in live sinks and is always expressed in
292 * the new latency value
297 public this (GstClockTime latency
)
299 // GstEvent* gst_event_new_latency (GstClockTime latency);
300 this(cast(GstEvent
*)gst_event_new_latency(latency
) );
305 * Allocate a new newsegment event with the given format/values tripplets
306 * This method calls gst_event_new_new_segment_full() passing a default
307 * value of 1.0 for applied_rate
309 * is this segment an update to a previous one
311 * a new rate for playback
313 * The format of the segment values
315 * the start value of the segment
317 * the stop value of the segment
321 * A new newsegment event.
323 public this (int update
, double rate
, GstFormat format
, long start
, long stop
, long position
)
325 // GstEvent* gst_event_new_new_segment (gboolean update, gdouble rate, GstFormat format, gint64 start, gint64 stop, gint64 position);
326 this(cast(GstEvent
*)gst_event_new_new_segment(update
, rate
, format
, start
, stop
, position
) );
330 * Allocate a new newsegment event with the given format/values triplets.
331 * The newsegment event marks the range of buffers to be processed. All
332 * data not within the segment range is not to be processed. This can be
333 * used intelligently by plugins to apply more efficient methods of skipping
335 * The position value of the segment is used in conjunction with the start
336 * value to convert the buffer timestamps into the stream time. This is
337 * usually done in sinks to report the current stream_time.
338 * position represents the stream_time of a buffer carrying a timestamp of
339 * start. position cannot be -1.
340 * start cannot be -1, stop can be -1. If there
341 * is a valid stop given, it must be greater or equal the start, including
342 * when the indicated playback rate is < 0.
343 * The applied_rate value provides information about any rate adjustment that
344 * has already been made to the timestamps and content on the buffers of the
345 * stream. (rate * applied_rate) should always equal the rate that has been
346 * requested for playback. For example, if an element has an input segment
347 * with intended playback rate of 2.0 and applied_rate of 1.0, it can adjust
348 * incoming timestamps and buffer content by half and output a newsegment event
349 * with rate of 1.0 and applied_rate of 2.0
350 * After a newsegment event, the buffer stream time is calculated with:
351 * position + (TIMESTAMP(buf) - start) * ABS (rate * applied_rate)
353 * Whether this segment is an update to a previous one
355 * A new rate for playback
357 * The rate factor which has already been applied
359 * The format of the segment values
361 * The start value of the segment
363 * The stop value of the segment
367 * A new newsegment event.
370 public this (int update
, double rate
, double appliedRate
, GstFormat format
, long start
, long stop
, long position
)
372 // GstEvent* gst_event_new_new_segment_full (gboolean update, gdouble rate, gdouble applied_rate, GstFormat format, gint64 start, gint64 stop, gint64 position);
373 this(cast(GstEvent
*)gst_event_new_new_segment_full(update
, rate
, appliedRate
, format
, start
, stop
, position
) );
377 * Allocate a new qos event with the given values.
378 * The QOS event is generated in an element that wants an upstream
379 * element to either reduce or increase its rate because of
380 * high/low CPU load or other resource usage such as network performance.
381 * Typically sinks generate these events for each buffer they receive.
382 * proportion indicates the real-time performance of the streaming in the
383 * element that generated the QoS event (usually the sink). The value is
384 * generally computed based on more long term statistics about the streams
385 * timestamps compared to the clock.
386 * A value < 1.0 indicates that the upstream element is producing data faster
387 * than real-time. A value > 1.0 indicates that the upstream element is not
388 * producing data fast enough. 1.0 is the ideal proportion value. The
389 * proportion value can safely be used to lower or increase the quality of
391 * diff is the difference against the clock in running time of the last
392 * buffer that caused the element to generate the QOS event. A negative value
393 * means that the buffer with timestamp arrived in time. A positive value
394 * indicates how late the buffer with timestamp was.
395 * timestamp is the timestamp of the last buffer that cause the element
396 * to generate the QOS event. It is expressed in running time and thus an ever
398 * The upstream element can use the diff and timestamp values to decide
399 * whether to process more buffers. For possitive diff, all buffers with
400 * timestamp <= timestamp + diff will certainly arrive late in the sink
402 * The application can use general event probes to intercept the QoS
403 * event and implement custom application specific QoS handling.
405 * the proportion of the qos message
407 * The time difference of the last Clock sync
409 * The timestamp of the buffer
413 public this (double proportion
, GstClockTimeDiff diff
, GstClockTime timestamp
)
415 // GstEvent* gst_event_new_qos (gdouble proportion, GstClockTimeDiff diff, GstClockTime timestamp);
416 this(cast(GstEvent
*)gst_event_new_qos(proportion
, diff
, timestamp
) );
420 * Allocate a new seek event with the given parameters.
421 * The seek event configures playback of the pipeline between start to stop
422 * at the speed given in rate, also called a playback segment.
423 * The start and stop values are expressed in format.
424 * A rate of 1.0 means normal playback rate, 2.0 means double speed.
425 * Negatives values means backwards playback. A value of 0.0 for the
426 * rate is not allowed and should be accomplished instead by PAUSING the
428 * A pipeline has a default playback segment configured with a start
429 * position of 0, a stop position of -1 and a rate of 1.0. The currently
430 * configured playback segment can be queried with GST_QUERY_SEGMENT.
431 * start_type and stop_type specify how to adjust the currently configured
432 * start and stop fields in segment. Adjustments can be made relative or
433 * absolute to the last configured values. A type of GST_SEEK_TYPE_NONE means
434 * that the position should not be updated.
435 * When the rate is positive and start has been updated, playback will start
436 * from the newly configured start position.
437 * For negative rates, playback will start from the newly configured stop
438 * position (if any). If the stop position if updated, it must be different from
439 * -1 for negative rates.
440 * It is not possible to seek relative to the current playback position, to do
441 * this, PAUSE the pipeline, query the current playback position with
442 * GST_QUERY_POSITION and update the playback segment current position with a
443 * GST_SEEK_TYPE_SET to the desired position.
445 * The new playback rate
447 * The format of the seek values
449 * The optional seek flags
451 * The type and flags for the new start position
453 * The value of the new start position
455 * The type and flags for the new stop position
457 * The value of the new stop position
461 public this (double rate
, GstFormat format
, GstSeekFlags flags
, GstSeekType startType
, long start
, GstSeekType stopType
, long stop
)
463 // GstEvent* gst_event_new_seek (gdouble rate, GstFormat format, GstSeekFlags flags, GstSeekType start_type, gint64 start, GstSeekType stop_type, gint64 stop);
464 this(cast(GstEvent
*)gst_event_new_seek(rate
, format
, flags
, startType
, start
, stopType
, stop
) );
468 * Generates a metadata tag event from the given taglist.
474 public this (TagList taglist
)
476 // GstEvent* gst_event_new_tag (GstTagList *taglist);
477 this(cast(GstEvent
*)gst_event_new_tag((taglist
is null) ?
null : taglist
.getTagListStruct()) );
481 * Get the format, minsize, maxsize and async-flag in the buffersize event.
485 * A pointer to store the format in
487 * A pointer to store the minsize in
489 * A pointer to store the maxsize in
491 * A pointer to store the async-flag in
493 public void parseBufferSize(GstFormat
* format
, long* minsize
, long* maxsize
, int* async
)
495 // void gst_event_parse_buffer_size (GstEvent *event, GstFormat *format, gint64 *minsize, gint64 *maxsize, gboolean *async);
496 gst_event_parse_buffer_size(gstEvent
, format
, minsize
, maxsize
, async
);
500 * Get the latency in the latency event.
504 * A pointer to store the latency in.
507 public void parseLatency(GstClockTime
* latency
)
509 // void gst_event_parse_latency (GstEvent *event, GstClockTime *latency);
510 gst_event_parse_latency(gstEvent
, latency
);
514 * Get the update flag, rate, format, start, stop and position in the
515 * newsegment event. In general, gst_event_parse_new_segment_full() should
516 * be used instead of this, to also retrieve the applied_rate value of the
517 * segment. See gst_event_new_new_segment_full() for a full description
518 * of the newsegment event.
522 * A pointer to the update flag of the segment
524 * A pointer to the rate of the segment
526 * A pointer to the format of the newsegment values
528 * A pointer to store the start value in
530 * A pointer to store the stop value in
532 * A pointer to store the stream time in
534 public void parseNewSegment(int* update
, double* rate
, GstFormat
* format
, long* start
, long* stop
, long* position
)
536 // void gst_event_parse_new_segment (GstEvent *event, gboolean *update, gdouble *rate, GstFormat *format, gint64 *start, gint64 *stop, gint64 *position);
537 gst_event_parse_new_segment(gstEvent
, update
, rate
, format
, start
, stop
, position
);
541 * Get the update, rate, applied_rate, format, start, stop and
542 * position in the newsegment event. See gst_event_new_new_segment_full()
543 * for a full description of the newsegment event.
547 * A pointer to the update flag of the segment
549 * A pointer to the rate of the segment
551 * A pointer to the applied_rate of the segment
553 * A pointer to the format of the newsegment values
555 * A pointer to store the start value in
557 * A pointer to store the stop value in
559 * A pointer to store the stream time in
562 public void parseNewSegmentFull(int* update
, double* rate
, double* appliedRate
, GstFormat
* format
, long* start
, long* stop
, long* position
)
564 // void gst_event_parse_new_segment_full (GstEvent *event, gboolean *update, gdouble *rate, gdouble *applied_rate, GstFormat *format, gint64 *start, gint64 *stop, gint64 *position);
565 gst_event_parse_new_segment_full(gstEvent
, update
, rate
, appliedRate
, format
, start
, stop
, position
);
569 * Get the proportion, diff and timestamp in the qos event. See
570 * gst_event_new_qos() for more information about the different QoS values.
574 * A pointer to store the proportion in
576 * A pointer to store the diff in
578 * A pointer to store the timestamp in
580 public void parseQos(double* proportion
, GstClockTimeDiff
* diff
, GstClockTime
* timestamp
)
582 // void gst_event_parse_qos (GstEvent *event, gdouble *proportion, GstClockTimeDiff *diff, GstClockTime *timestamp);
583 gst_event_parse_qos(gstEvent
, proportion
, diff
, timestamp
);
587 * Parses a seek event and stores the results in the given result locations.
591 * result location for the rate
593 * result location for the stream format
595 * result location for the GstSeekFlags
597 * result location for the GstSeekType of the start position
599 * result location for the start postion expressed in format
601 * result location for the GstSeekType of the stop position
603 * result location for the stop postion expressed in format
605 public void parseSeek(double* rate
, GstFormat
* format
, GstSeekFlags
* flags
, GstSeekType
* startType
, long* start
, GstSeekType
* stopType
, long* stop
)
607 // void gst_event_parse_seek (GstEvent *event, gdouble *rate, GstFormat *format, GstSeekFlags *flags, GstSeekType *start_type, gint64 *start, GstSeekType *stop_type, gint64 *stop);
608 gst_event_parse_seek(gstEvent
, rate
, format
, flags
, startType
, start
, stopType
, stop
);
612 * Parses a tag event and stores the results in the given taglist location.
616 * pointer to metadata list
618 public void parseTag(GstTagList
** taglist
)
620 // void gst_event_parse_tag (GstEvent *event, GstTagList **taglist);
621 gst_event_parse_tag(gstEvent
, taglist
);
625 * Increase the refcount of this event.
627 * The event to refcount
629 * event (for convenience when doing assignments)
633 // GstEvent* gst_event_ref (GstEvent *event);
634 return new Event( gst_event_ref(gstEvent
) );
640 * Gets the GstEventTypeFlags associated with type.
644 * a GstEventTypeFlags.
646 public static GstEventTypeFlags
typeGetFlags(GstEventType type
)
648 // GstEventTypeFlags gst_event_type_get_flags (GstEventType type);
649 return gst_event_type_get_flags(type
);
653 * Get a printable name for the given event type. Do not modify or free.
657 * a reference to the static name of the event.
659 public static char[] typeGetName(GstEventType type
)
661 // const gchar* gst_event_type_get_name (GstEventType type);
662 return Str
.toString(gst_event_type_get_name(type
) );
666 * Get the unique quark for the given event type.
670 * the quark associated with the event type
674 public static GQuark
typeToQuark(GstEventType type
)
676 // GQuark gst_event_type_to_quark (GstEventType type);
677 return gst_event_type_to_quark(type
);