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-GstSegment.html
47 * - GstSegment* -> Segment
52 module gstreamer
.Segment
;
54 private import gstreamerc
.gstreamertypes
;
56 private import gstreamerc
.gstreamer
;
58 private import glib
.Str
;
64 * This helper structure holds the relevant values for tracking the region of
65 * interest in a media file, called a segment.
66 * The structure can be used for two purposes:
67 * performing seeks (handling seek events)
68 * tracking playback regions (handling newsegment events)
69 * The segment is usually configured by the application with a seek event which
70 * is propagated upstream and eventually handled by an element that performs the seek.
71 * The configured segment is then propagated back downstream with a newsegment event.
72 * This information is then used to clip media to the segment boundaries.
73 * A segment structure is initialized with gst_segment_init(), which takes a GstFormat
74 * that will be used as the format of the segment values. The segment will be configured
75 * with a start value of 0 and a stop/duration of -1, which is undefined. The default
76 * rate and applied_rate is 1.0.
77 * If the segment is used for managing seeks, the segment duration should be set with
78 * gst_segment_set_duration(). The public duration field contains the duration of the
79 * segment. When using the segment for seeking, the start and time members should
80 * normally be left to their default 0 value. The stop position is left to -1 unless
81 * explicitly configured to a different value after a seek event.
82 * The current position in the segment should be set with the gst_segment_set_last_stop().
83 * The public last_stop field contains the last set stop position in the segment.
84 * For elements that perform seeks, the current segment should be updated with the
85 * gst_segment_set_seek() and the values from the seek event. This method will update
86 * all the segment fields. The last_pos field will contain the new playback position.
87 * If the cur_type was different from GST_SEEK_TYPE_NONE, playback continues from
88 * the last_pos position, possibly with updated flags or rate.
89 * For elements that want to use GstSegment to track the playback region, use
90 * gst_segment_set_newsegment() to update the segment fields with the information from
91 * the newsegment event. The gst_segment_clip() method can be used to check and clip
92 * the media data to the segment boundaries.
93 * For elements that want to synchronize to the pipeline clock, gst_segment_to_running_time()
94 * can be used to convert a timestamp to a value that can be used to synchronize
95 * to the clock. This function takes into account all accumulated segments as well as
96 * any rate or applied_rate conversions.
97 * For elements that need to perform operations on media data in stream_time,
98 * gst_segment_to_stream_time() can be used to convert a timestamp and the segment
99 * info to stream time (which is always between 0 and the duration of the stream).
100 * Last reviewed on 2006-05-03 (0.10.6)
105 /** the main Gtk struct */
106 protected GstSegment
* gstSegment
;
109 public GstSegment
* getSegmentStruct()
115 /** the main Gtk struct as a void* */
116 protected void* getStruct()
118 return cast(void*)gstSegment
;
122 * Sets our main struct and passes it to the parent class
124 public this (GstSegment
* gstSegment
)
126 this.gstSegment
= gstSegment
;
134 * Clip the given start and stop values to the segment boundaries given
135 * in segment. start and stop are compared and clipped to segment
136 * start and stop values.
137 * If the function returns FALSE, start and stop are known to fall
138 * outside of segment and clip_start and clip_stop are not updated.
139 * When the function returns TRUE, clip_start and clip_stop will be
140 * updated. If clip_start or clip_stop are different from start or stop
141 * respectively, the region fell partially in the segment.
143 * a GstSegment structure.
145 * the format of the segment.
147 * the start position in the segment
149 * the stop position in the segment
151 * the clipped start position in the segment
153 * the clipped stop position in the segment
155 * TRUE if the given start and stop times fall partially or
156 * completely in segment, FALSE if the values are completely outside
159 public int clip(GstFormat format
, long start
, long stop
, long* clipStart
, long* clipStop
)
161 // gboolean gst_segment_clip (GstSegment *segment, GstFormat format, gint64 start, gint64 stop, gint64 *clip_start, gint64 *clip_stop);
162 return gst_segment_clip(gstSegment
, format
, start
, stop
, clipStart
, clipStop
);
166 * The start/last_stop positions are set to 0 and the stop/duration
167 * fields are set to -1 (unknown). The default rate of 1.0 and no
169 * Initialize segment to its default values.
171 * a GstSegment structure.
173 * the format of the segment.
175 public void init(GstFormat format
)
177 // void gst_segment_init (GstSegment *segment, GstFormat format);
178 gst_segment_init(gstSegment
, format
);
182 * Allocate a new GstSegment structure and initialize it using
183 * gst_segment_init().
185 * a new GstSegment, free with gst_segment_free().
189 // GstSegment* gst_segment_new (void);
190 this(cast(GstSegment
*)gst_segment_new() );
194 * Free the allocated segment segment.
200 // void gst_segment_free (GstSegment *segment);
201 gst_segment_free(gstSegment
);
205 * Set the duration of the segment to duration. This function is mainly
206 * used by elements that perform seeking and know the total duration of the
208 * This field should be set to allow seeking requests relative to the
211 * a GstSegment structure.
213 * the format of the segment.
215 * the duration of the segment info or -1 if unknown.
217 public void setDuration(GstFormat format
, long duration
)
219 // void gst_segment_set_duration (GstSegment *segment, GstFormat format, gint64 duration);
220 gst_segment_set_duration(gstSegment
, format
, duration
);
224 * Set the last observed stop position in the segment to position.
225 * This field should be set to allow seeking requests relative to the
226 * current playing position.
228 * a GstSegment structure.
230 * the format of the segment.
234 public void setLastStop(GstFormat format
, long position
)
236 // void gst_segment_set_last_stop (GstSegment *segment, GstFormat format, gint64 position);
237 gst_segment_set_last_stop(gstSegment
, format
, position
);
241 * Update the segment structure with the field values of a new segment event and
242 * with a default applied_rate of 1.0.
244 * a GstSegment structure.
246 * flag indicating a new segment is started or updated
248 * the rate of the segment.
250 * the format of the segment.
252 * the new start value
256 * the new stream time
259 public void setNewsegment(int update
, double rate
, GstFormat format
, long start
, long stop
, long time
)
261 // void gst_segment_set_newsegment (GstSegment *segment, gboolean update, gdouble rate, GstFormat format, gint64 start, gint64 stop, gint64 time);
262 gst_segment_set_newsegment(gstSegment
, update
, rate
, format
, start
, stop
, time
);
266 * Update the segment structure with the field values of a new segment event.
268 * a GstSegment structure.
270 * flag indicating a new segment is started or updated
272 * the rate of the segment.
274 * the applied rate of the segment.
276 * the format of the segment.
278 * the new start value
282 * the new stream time
284 public void setNewsegmentFull(int update
, double rate
, double appliedRate
, GstFormat format
, long start
, long stop
, long time
)
286 // void gst_segment_set_newsegment_full (GstSegment *segment, gboolean update, gdouble rate, gdouble applied_rate, GstFormat format, gint64 start, gint64 stop, gint64 time);
287 gst_segment_set_newsegment_full(gstSegment
, update
, rate
, appliedRate
, format
, start
, stop
, time
);
291 * Update the segment structure with the field values of a seek event (see
292 * gst_event_new_seek()).
293 * After calling this method, the segment field last_stop and time will
294 * contain the requested new position in the segment. The new requested
295 * position in the segment depends on rate and start_type and stop_type.
296 * For positive rate, the new position in the segment is the new segment
297 * start field when it was updated with a start_type different from
298 * GST_SEEK_TYPE_NONE. If no update was performed on segment start position
299 * (GST_SEEK_TYPE_NONE), start is ignored and segment last_stop is
301 * For negative rate, the new position in the segment is the new segment
302 * stop field when it was updated with a stop_type different from
303 * GST_SEEK_TYPE_NONE. If no stop was previously configured in the segment, the
304 * duration of the segment will be used to update the stop position.
305 * If no update was performed on segment stop position (GST_SEEK_TYPE_NONE),
306 * stop is ignored and segment last_stop is unmodified.
307 * The applied rate of the segment will be set to 1.0 by default.
308 * If the caller can apply a rate change, it should update segment
309 * rate and applied_rate after calling this function.
310 * update will be set to TRUE if a seek should be performed to the segment
311 * last_stop field. This field can be FALSE if, for example, only the rate
312 * has been changed but not the playback position.
314 * a GstSegment structure.
316 * the rate of the segment.
318 * the format of the segment.
320 * the seek flags for the segment
324 * the seek start value
328 * the seek stop value
330 * boolean holding whether last_stop was updated.
332 public void setSeek(double rate
, GstFormat format
, GstSeekFlags flags
, GstSeekType startType
, long start
, GstSeekType stopType
, long stop
, int* update
)
334 // void gst_segment_set_seek (GstSegment *segment, gdouble rate, GstFormat format, GstSeekFlags flags, GstSeekType start_type, gint64 start, GstSeekType stop_type, gint64 stop, gboolean *update);
335 gst_segment_set_seek(gstSegment
, rate
, format
, flags
, startType
, start
, stopType
, stop
, update
);
339 * Translate position to the total running time using the currently configured
340 * and previously accumulated segments. Position is a value between segment
341 * start and stop time.
342 * This function is typically used by elements that need to synchronize to the
343 * global clock in a pipeline. The runnning time is a constantly increasing value
344 * starting from 0. When gst_segment_init() is called, this value will reset to
346 * This function returns -1 if the position is outside of segment start and stop.
348 * a GstSegment structure.
350 * the format of the segment.
352 * the position in the segment
354 * the position as the total running time or -1 when an invalid position
357 public long toRunningTime(GstFormat format
, long position
)
359 // gint64 gst_segment_to_running_time (GstSegment *segment, GstFormat format, gint64 position);
360 return gst_segment_to_running_time(gstSegment
, format
, position
);
364 * Translate position to stream time using the currently configured
365 * segment. The position value must be between segment start and
367 * This function is typically used by elements that need to operate on
368 * the stream time of the buffers it receives, such as effect plugins.
369 * In those use cases, position is typically the buffer timestamp or
370 * clock time that one wants to convert to the stream time.
371 * The stream time is always between 0 and the total duration of the
374 * a GstSegment structure.
376 * the format of the segment.
378 * the position in the segment
380 * the position in stream_time or -1 when an invalid position
385 public long toStreamTime(GstFormat format
, long position
)
387 // gint64 gst_segment_to_stream_time (GstSegment *segment, GstFormat format, gint64 position);
388 return gst_segment_to_stream_time(gstSegment
, format
, position
);