# GstSegment

This helper structure holds the relevant values for tracking the region of interest in a media file, called a segment.

The structure can be used for two purposes:

- performing seeks (handling seek events)
- tracking playback regions (handling newsegment events)

The segment is usually configured by the application with a seek event which is propagated upstream and eventually handled by an element that performs the seek.

The configured segment is then propagated back downstream with a newsegment event. This information is then used to clip media to the segment boundaries.

A segment structure is initialized with gst_segment_init, which takes a GstFormat that will be used as the format of the segment values. The segment will be configured with a start value of 0 and a stop/duration of -1, which is undefined. The default rate and applied_rate is 1.0.

The public duration field contains the duration of the segment. When using the segment for seeking, the start and time members should normally be left to their default 0 value. The stop position is left to -1 unless explicitly configured to a different value after a seek event.

The current position in the segment should be set by changing the position member in the structure.

For elements that perform seeks, the current segment should be updated with the gst_segment_do_seek and the values from the seek event. This method will update all the segment fields. The position field will contain the new playback position. If the start_type was different from GST_SEEK_TYPE_NONE, playback continues from the position position, possibly with updated flags or rate.

For elements that want to use GstSegment to track the playback region, update the segment fields with the information from the newsegment event. The gst_segment_clip method can be used to check and clip the media data to the segment boundaries.

For elements that want to synchronize to the pipeline clock, gst_segment_to_running_time can be used to convert a timestamp to a value that can be used to synchronize to the clock. This function takes into account the base as well as any rate or applied_rate conversions.

For elements that need to perform operations on media data in stream_time, gst_segment_to_stream_time can be used to convert a timestamp and the segment info to stream time (which is always between 0 and the duration of the stream).

## GstSegment

The structure that holds the configured region of interest in a media file.

### Members

`flags` (GstSegmentFlags) –

flags for this segment

`rate` (gdouble) –

the playback rate of the segment is set in response to a seek event and, without any seek, the value should be `1.0`. This value is used by elements that synchronize buffer running times on the clock (usually the sink elements), leading to consuming buffers faster (for a value `> 1.0`) or slower (for `0.0 < value < 1.0`) than normal playback speed. The rate also defines the playback direction, meaning that when the value is lower than `0.0`, the playback happens in reverse, and the stream-time is going backward. The `rate` value should never be `0.0`.

`applied_rate` (gdouble) –

The applied rate is the rate that has been applied to the stream. The effective/resulting playback rate of a stream is `rate * applied_rate`. The applied rate can be set by source elements when a server is sending the stream with an already modified playback speed rate. Filter elements that modify the stream in a way that modifies the playback speed should also modify the applied rate. For example the videorate element when its rate property is set will set the applied rate of the segment it pushed downstream. Also scaletempo applies the input segment rate to the stream and outputs a segment with rate=1.0 and applied_rate=<inputsegment.rate>.

`format` (GstFormat) –

the unit used for all of the segment's values.

`base` (guint64) –

the running time (plus elapsed time, see offset) of the segment start (stop if rate < 0.0).

`offset` (guint64) –

the offset expresses the elapsed time (in buffer timestamps) before a seek with its start (stop if rate < 0.0) seek type set to GST_SEEK_TYPE_NONE, the value is set to the position of the segment at the time of the seek.

`start` (guint64) –

the start time of the segment (in buffer timestamps) (PTS), that is the timestamp of the first buffer to output inside the segment (last one during reverse playback). For example decoders will clip out the buffers before the start time.

`stop` (guint64) –

the stop time of the segment (in buffer timestamps) (PTS), that is the timestamp of the last buffer to output inside the segment (first one during reverse playback). For example decoders will clip out buffers after the stop time.

`time` (guint64) –

the stream time of the segment start (stop if rate < 0.0).

`position` (guint64) –

the buffer timestamp position in the segment is supposed to be updated by elements such as sources, demuxers or parsers to track progress by setting it to the last pushed buffer' end time (timestamp + duration) for that specific segment. The position is used when reconfiguring the segment with gst_segment_do_seek when the seek is only updating the segment (see offset).

`duration` (guint64) –

the duration of the segment is the maximum absolute difference between start and stop if stop is not set, otherwise it should be the difference between those two values. This should be set by elements that know the overall stream duration (like demuxers) and will be used when seeking with GST_SEEK_TYPE_END.

## Gst.Segment

The structure that holds the configured region of interest in a media file.

### Members

`flags` (Gst.SegmentFlags) –

flags for this segment

`rate` (Number) –

the playback rate of the segment is set in response to a seek event and, without any seek, the value should be `1.0`. This value is used by elements that synchronize buffer running times on the clock (usually the sink elements), leading to consuming buffers faster (for a value `> 1.0`) or slower (for `0.0 < value < 1.0`) than normal playback speed. The rate also defines the playback direction, meaning that when the value is lower than `0.0`, the playback happens in reverse, and the stream-time is going backward. The `rate` value should never be `0.0`.

`applied_rate` (Number) –

The applied rate is the rate that has been applied to the stream. The effective/resulting playback rate of a stream is `rate * applied_rate`. The applied rate can be set by source elements when a server is sending the stream with an already modified playback speed rate. Filter elements that modify the stream in a way that modifies the playback speed should also modify the applied rate. For example the videorate (not introspectable) element when its rate (not introspectable) property is set will set the applied rate of the segment it pushed downstream. Also scaletempo (not introspectable) applies the input segment rate to the stream and outputs a segment with rate=1.0 and applied_rate=<inputsegment.rate>.

`format` (Gst.Format) –

the unit used for all of the segment's values.

`base` (Number) –

the running time (plus elapsed time, see offset) of the segment start (stop if rate < 0.0).

`offset` (Number) –

the offset expresses the elapsed time (in buffer timestamps) before a seek with its start (stop if rate < 0.0) seek type set to Gst.SeekType.NONE, the value is set to the position of the segment at the time of the seek.

`start` (Number) –

the start time of the segment (in buffer timestamps) (PTS), that is the timestamp of the first buffer to output inside the segment (last one during reverse playback). For example decoders will clip out the buffers before the start time.

`stop` (Number) –

the stop time of the segment (in buffer timestamps) (PTS), that is the timestamp of the last buffer to output inside the segment (first one during reverse playback). For example decoders will clip out buffers after the stop time.

`time` (Number) –

the stream time of the segment start (stop if rate < 0.0).

`position` (Number) –

the buffer timestamp position in the segment is supposed to be updated by elements such as sources, demuxers or parsers to track progress by setting it to the last pushed buffer' end time (timestamp + duration) for that specific segment. The position is used when reconfiguring the segment with Gst.Segment.prototype.do_seek when the seek is only updating the segment (see offset).

`duration` (Number) –

the duration of the segment is the maximum absolute difference between start and stop if stop is not set, otherwise it should be the difference between those two values. This should be set by elements that know the overall stream duration (like demuxers) and will be used when seeking with Gst.SeekType.END.

## Gst.Segment

The structure that holds the configured region of interest in a media file.

### Members

`flags` (Gst.SegmentFlags) –

flags for this segment

`rate` (float) –

the playback rate of the segment is set in response to a seek event and, without any seek, the value should be `1.0`. This value is used by elements that synchronize buffer running times on the clock (usually the sink elements), leading to consuming buffers faster (for a value `> 1.0`) or slower (for `0.0 < value < 1.0`) than normal playback speed. The rate also defines the playback direction, meaning that when the value is lower than `0.0`, the playback happens in reverse, and the stream-time is going backward. The `rate` value should never be `0.0`.

`applied_rate` (float) –

The applied rate is the rate that has been applied to the stream. The effective/resulting playback rate of a stream is `rate * applied_rate`. The applied rate can be set by source elements when a server is sending the stream with an already modified playback speed rate. Filter elements that modify the stream in a way that modifies the playback speed should also modify the applied rate. For example the videorate (not introspectable) element when its rate (not introspectable) property is set will set the applied rate of the segment it pushed downstream. Also scaletempo (not introspectable) applies the input segment rate to the stream and outputs a segment with rate=1.0 and applied_rate=<inputsegment.rate>.

`format` (Gst.Format) –

the unit used for all of the segment's values.

`base` (int) –

the running time (plus elapsed time, see offset) of the segment start (stop if rate < 0.0).

`offset` (int) –

the offset expresses the elapsed time (in buffer timestamps) before a seek with its start (stop if rate < 0.0) seek type set to Gst.SeekType.NONE, the value is set to the position of the segment at the time of the seek.

`start` (int) –

the start time of the segment (in buffer timestamps) (PTS), that is the timestamp of the first buffer to output inside the segment (last one during reverse playback). For example decoders will clip out the buffers before the start time.

`stop` (int) –

the stop time of the segment (in buffer timestamps) (PTS), that is the timestamp of the last buffer to output inside the segment (first one during reverse playback). For example decoders will clip out buffers after the stop time.

`time` (int) –

the stream time of the segment start (stop if rate < 0.0).

`position` (int) –

the buffer timestamp position in the segment is supposed to be updated by elements such as sources, demuxers or parsers to track progress by setting it to the last pushed buffer' end time (timestamp + duration) for that specific segment. The position is used when reconfiguring the segment with Gst.Segment.do_seek when the seek is only updating the segment (see offset).

`duration` (int) –

the duration of the segment is the maximum absolute difference between start and stop if stop is not set, otherwise it should be the difference between those two values. This should be set by elements that know the overall stream duration (like demuxers) and will be used when seeking with Gst.SeekType.END.

### Constructors

#### gst_segment_new

    GstSegment *
    gst_segment_new ()

Allocate a new GstSegment structure and initialize it using gst_segment_init.

Free-function: gst_segment_free

Returns ( [transfer: full]) –

a new GstSegment, free with gst_segment_free.

#### Gst.Segment.prototype.new

    function Gst.Segment.prototype.new(): {
        // javascript wrapper for 'gst_segment_new'
    }

Allocate a new Gst.Segment structure and initialize it using Gst.Segment.prototype.init.

Free-function: gst_segment_free

Returns (Gst.Segment) –

a new Gst.Segment, free with Gst.Segment.prototype.free.

#### Gst.Segment.new

    def Gst.Segment.new ():
        #python wrapper for 'gst_segment_new'

Allocate a new Gst.Segment structure and initialize it using Gst.Segment.init.

Free-function: gst_segment_free

Returns (Gst.Segment) –

a new Gst.Segment, free with Gst.Segment.free.

### Methods

#### gst_segment_clip

    gboolean
    gst_segment_clip (const GstSegment * segment,
                      GstFormat format,
                      guint64 start,
                      guint64 stop,
                      guint64 * clip_start,
                      guint64 * clip_stop)

Clip the given start and stop values to the segment boundaries given in segment. start and stop are compared and clipped to segment start and stop values.

If the function returns FALSE, start and stop are known to fall outside of segment and clip_start and clip_stop are not updated.

When the function returns TRUE, clip_start and clip_stop will be updated. If clip_start or clip_stop are different from start or stop respectively, the region fell partially in the segment.

Note that when stop is -1, clip_stop will be set to the end of the segment. Depending on the use case, this may or may not be what you want.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`start` –

the start position in the segment

`stop` –

the stop position in the segment

`clip_start` ( [out][allow-none]) –

the clipped start position in the segment

`clip_stop` ( [out][allow-none]) –

the clipped stop position in the segment

Returns –

TRUE if the given start and stop times fall partially or completely in segment, FALSE if the values are completely outside of the segment.

#### Gst.Segment.prototype.clip

    function Gst.Segment.prototype.clip(format: Gst.Format, start: Number, stop: Number): {
        // javascript wrapper for 'gst_segment_clip'
    }

Clip the given start and stop values to the segment boundaries given in segment. start and stop are compared and clipped to segment start and stop values.

If the function returns false, start and stop are known to fall outside of segment and clip_start and clip_stop are not updated.

When the function returns true, clip_start and clip_stop will be updated. If clip_start or clip_stop are different from start or stop respectively, the region fell partially in the segment.

Note that when stop is -1, clip_stop will be set to the end of the segment. Depending on the use case, this may or may not be what you want.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`start` (Number) –

the start position in the segment

`stop` (Number) –

the stop position in the segment

Returns a tuple made of:

(Number ) –

true if the given start and stop times fall partially or completely in segment, false if the values are completely outside of the segment.

`clip_start` (Number ) –

true if the given start and stop times fall partially or completely in segment, false if the values are completely outside of the segment.

`clip_stop` (Number ) –

true if the given start and stop times fall partially or completely in segment, false if the values are completely outside of the segment.

#### Gst.Segment.clip

    def Gst.Segment.clip (self, format, start, stop):
        #python wrapper for 'gst_segment_clip'

Clip the given start and stop values to the segment boundaries given in segment. start and stop are compared and clipped to segment start and stop values.

If the function returns False, start and stop are known to fall outside of segment and clip_start and clip_stop are not updated.

When the function returns True, clip_start and clip_stop will be updated. If clip_start or clip_stop are different from start or stop respectively, the region fell partially in the segment.

Note that when stop is -1, clip_stop will be set to the end of the segment. Depending on the use case, this may or may not be what you want.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`start` (int) –

the start position in the segment

`stop` (int) –

the stop position in the segment

Returns a tuple made of:

(bool ) –

True if the given start and stop times fall partially or completely in segment, False if the values are completely outside of the segment.

`clip_start` (int ) –

True if the given start and stop times fall partially or completely in segment, False if the values are completely outside of the segment.

`clip_stop` (int ) –

True if the given start and stop times fall partially or completely in segment, False if the values are completely outside of the segment.

#### gst_segment_copy

    GstSegment *
    gst_segment_copy (const GstSegment * segment)

Create a copy of given segment.

Free-function: gst_segment_free

Parameters:

`segment` ( [transfer: none]) –

a GstSegment

Returns ( [transfer: full]) –

a new GstSegment, free with gst_segment_free.

#### Gst.Segment.prototype.copy

    function Gst.Segment.prototype.copy(): {
        // javascript wrapper for 'gst_segment_copy'
    }

Create a copy of given segment.

Free-function: gst_segment_free

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment

Returns (Gst.Segment) –

a new Gst.Segment, free with Gst.Segment.prototype.free.

#### Gst.Segment.copy

    def Gst.Segment.copy (self):
        #python wrapper for 'gst_segment_copy'

Create a copy of given segment.

Free-function: gst_segment_free

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment

Returns (Gst.Segment) –

a new Gst.Segment, free with Gst.Segment.free.

#### gst_segment_copy_into

    gst_segment_copy_into (const GstSegment * src,
                           GstSegment * dest)

Copy the contents of src into dest.

Parameters:

`src` ( [transfer: none]) –

a GstSegment

`dest` ( [transfer: none]) –

a GstSegment

#### Gst.Segment.prototype.copy_into

    function Gst.Segment.prototype.copy_into(dest: Gst.Segment): {
        // javascript wrapper for 'gst_segment_copy_into'
    }

Copy the contents of src into dest.

Parameters:

`src` (Gst.Segment) –

a Gst.Segment

`dest` (Gst.Segment) –

a Gst.Segment

#### Gst.Segment.copy_into

    def Gst.Segment.copy_into (self, dest):
        #python wrapper for 'gst_segment_copy_into'

Copy the contents of src into dest.

Parameters:

`src` (Gst.Segment) –

a Gst.Segment

`dest` (Gst.Segment) –

a Gst.Segment

#### gst_segment_do_seek

    gboolean
    gst_segment_do_seek (GstSegment * segment,
                         gdouble rate,
                         GstFormat format,
                         GstSeekFlags flags,
                         GstSeekType start_type,
                         guint64 start,
                         GstSeekType stop_type,
                         guint64 stop,
                         gboolean * update)

Update the segment structure with the field values of a seek event (see gst_event_new_seek).

After calling this method, the segment field position and time will contain the requested new position in the segment. The new requested position in the segment depends on rate and start_type and stop_type.

For positive rate, the new position in the segment is the new segment start field when it was updated with a start_type different from GST_SEEK_TYPE_NONE. If no update was performed on segment start position (#GST_SEEK_TYPE_NONE), start is ignored and segment position is unmodified.

For negative rate, the new position in the segment is the new segment stop field when it was updated with a stop_type different from GST_SEEK_TYPE_NONE. If no stop was previously configured in the segment, the duration of the segment will be used to update the stop position. If no update was performed on segment stop position (#GST_SEEK_TYPE_NONE), stop is ignored and segment position is unmodified.

The applied rate of the segment will be set to 1.0 by default. If the caller can apply a rate change, it should update segment rate and applied_rate after calling this function.

update will be set to TRUE if a seek should be performed to the segment position field. This field can be FALSE if, for example, only the rate has been changed but not the playback position.

Parameters:

`segment` –

a GstSegment structure.

`rate` –

the rate of the segment.

`format` –

the format of the segment.

`flags` –

the segment flags for the segment

`start_type` –

the seek method

`start` –

the seek start value

`stop_type` –

the seek method

`stop` –

the seek stop value

`update` ( [out][allow-none]) –

boolean holding whether position was updated.

Returns –

TRUE if the seek could be performed.

#### Gst.Segment.prototype.do_seek

    function Gst.Segment.prototype.do_seek(rate: Number, format: Gst.Format, flags: Gst.SeekFlags, start_type: Gst.SeekType, start: Number, stop_type: Gst.SeekType, stop: Number): {
        // javascript wrapper for 'gst_segment_do_seek'
    }

Update the segment structure with the field values of a seek event (see Gst.Event.prototype.new_seek).

After calling this method, the segment field position and time will contain the requested new position in the segment. The new requested position in the segment depends on rate and start_type and stop_type.

For positive rate, the new position in the segment is the new segment start field when it was updated with a start_type different from Gst.SeekType.NONE. If no update was performed on segment start position (#GST_SEEK_TYPE_NONE), start is ignored and segment position is unmodified.

For negative rate, the new position in the segment is the new segment stop field when it was updated with a stop_type different from Gst.SeekType.NONE. If no stop was previously configured in the segment, the duration of the segment will be used to update the stop position. If no update was performed on segment stop position (#GST_SEEK_TYPE_NONE), stop is ignored and segment position is unmodified.

The applied rate of the segment will be set to 1.0 by default. If the caller can apply a rate change, it should update segment rate and applied_rate after calling this function.

update will be set to true if a seek should be performed to the segment position field. This field can be false if, for example, only the rate has been changed but not the playback position.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`rate` (Number) –

the rate of the segment.

`format` (Gst.Format) –

the format of the segment.

`flags` (Gst.SeekFlags) –

the segment flags for the segment

`start_type` (Gst.SeekType) –

the seek method

`start` (Number) –

the seek start value

`stop_type` (Gst.SeekType) –

the seek method

`stop` (Number) –

the seek stop value

Returns a tuple made of:

(Number ) –

true if the seek could be performed.

`update` (Number ) –

true if the seek could be performed.

#### Gst.Segment.do_seek

    def Gst.Segment.do_seek (self, rate, format, flags, start_type, start, stop_type, stop):
        #python wrapper for 'gst_segment_do_seek'

Update the segment structure with the field values of a seek event (see Gst.Event.new_seek).

After calling this method, the segment field position and time will contain the requested new position in the segment. The new requested position in the segment depends on rate and start_type and stop_type.

For positive rate, the new position in the segment is the new segment start field when it was updated with a start_type different from Gst.SeekType.NONE. If no update was performed on segment start position (#GST_SEEK_TYPE_NONE), start is ignored and segment position is unmodified.

For negative rate, the new position in the segment is the new segment stop field when it was updated with a stop_type different from Gst.SeekType.NONE. If no stop was previously configured in the segment, the duration of the segment will be used to update the stop position. If no update was performed on segment stop position (#GST_SEEK_TYPE_NONE), stop is ignored and segment position is unmodified.

The applied rate of the segment will be set to 1.0 by default. If the caller can apply a rate change, it should update segment rate and applied_rate after calling this function.

update will be set to True if a seek should be performed to the segment position field. This field can be False if, for example, only the rate has been changed but not the playback position.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`rate` (float) –

the rate of the segment.

`format` (Gst.Format) –

the format of the segment.

`flags` (Gst.SeekFlags) –

the segment flags for the segment

`start_type` (Gst.SeekType) –

the seek method

`start` (int) –

the seek start value

`stop_type` (Gst.SeekType) –

the seek method

`stop` (int) –

the seek stop value

Returns a tuple made of:

(bool ) –

True if the seek could be performed.

`update` (bool ) –

True if the seek could be performed.

#### gst_segment_free

    gst_segment_free (GstSegment * segment)

Free the allocated segment segment.

Parameters:

`segment` ( [in][transfer: full]) –

a GstSegment

#### Gst.Segment.prototype.free

    function Gst.Segment.prototype.free(): {
        // javascript wrapper for 'gst_segment_free'
    }

Free the allocated segment segment.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment

#### Gst.Segment.free

    def Gst.Segment.free (self):
        #python wrapper for 'gst_segment_free'

Free the allocated segment segment.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment

#### gst_segment_init

    gst_segment_init (GstSegment * segment,
                      GstFormat format)

The start/position fields are set to 0 and the stop/duration fields are set to -1 (unknown). The default rate of 1.0 and no flags are set.

Initialize segment to its default values.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

#### Gst.Segment.prototype.init

    function Gst.Segment.prototype.init(format: Gst.Format): {
        // javascript wrapper for 'gst_segment_init'
    }

The start/position fields are set to 0 and the stop/duration fields are set to -1 (unknown). The default rate of 1.0 and no flags are set.

Initialize segment to its default values.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

#### Gst.Segment.init

    def Gst.Segment.init (self, format):
        #python wrapper for 'gst_segment_init'

The start/position fields are set to 0 and the stop/duration fields are set to -1 (unknown). The default rate of 1.0 and no flags are set.

Initialize segment to its default values.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

#### gst_segment_is_equal

    gboolean
    gst_segment_is_equal (const GstSegment * s0,
                          const GstSegment * s1)

Checks for two segments being equal. Equality here is defined as perfect equality, including floating point values.

Parameters:

`s0` –

a GstSegment structure.

`s1` –

a GstSegment structure.

Returns –

TRUE if the segments are equal, FALSE otherwise.

Since : 1.6

#### Gst.Segment.prototype.is_equal

    function Gst.Segment.prototype.is_equal(s1: Gst.Segment): {
        // javascript wrapper for 'gst_segment_is_equal'
    }

Checks for two segments being equal. Equality here is defined as perfect equality, including floating point values.

Parameters:

`s0` (Gst.Segment) –

a Gst.Segment structure.

`s1` (Gst.Segment) –

a Gst.Segment structure.

Returns (Number) –

true if the segments are equal, false otherwise.

Since : 1.6

#### Gst.Segment.is_equal

    def Gst.Segment.is_equal (self, s1):
        #python wrapper for 'gst_segment_is_equal'

Checks for two segments being equal. Equality here is defined as perfect equality, including floating point values.

Parameters:

`s0` (Gst.Segment) –

a Gst.Segment structure.

`s1` (Gst.Segment) –

a Gst.Segment structure.

Returns (bool) –

True if the segments are equal, False otherwise.

Since : 1.6

#### gst_segment_offset_running_time

    gboolean
    gst_segment_offset_running_time (GstSegment * segment,
                                     GstFormat format,
                                     gint64 offset)

Adjust the values in segment so that offset is applied to all future running-time calculations.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`offset` –

the offset to apply in the segment

Returns –

TRUE if the segment could be updated successfully. If FALSE is returned, offset is not in segment.

Since : 1.2.3

#### Gst.Segment.prototype.offset_running_time

    function Gst.Segment.prototype.offset_running_time(format: Gst.Format, offset: Number): {
        // javascript wrapper for 'gst_segment_offset_running_time'
    }

Adjust the values in segment so that offset is applied to all future running-time calculations.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`offset` (Number) –

the offset to apply in the segment

Returns (Number) –

true if the segment could be updated successfully. If false is returned, offset is not in segment.

Since : 1.2.3

#### Gst.Segment.offset_running_time

    def Gst.Segment.offset_running_time (self, format, offset):
        #python wrapper for 'gst_segment_offset_running_time'

Adjust the values in segment so that offset is applied to all future running-time calculations.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`offset` (int) –

the offset to apply in the segment

Returns (bool) –

True if the segment could be updated successfully. If False is returned, offset is not in segment.

Since : 1.2.3

#### gst_segment_position_from_running_time

    guint64
    gst_segment_position_from_running_time (const GstSegment * segment,
                                            GstFormat format,
                                            guint64 running_time)

Convert running_time into a position in the segment so that gst_segment_to_running_time with that position returns running_time.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`running_time` –

the running_time in the segment

Returns –

the position in the segment for running_time. This function returns -1 when running_time is -1 or when it is not inside segment.

Since : 1.8

#### Gst.Segment.prototype.position_from_running_time

    function Gst.Segment.prototype.position_from_running_time(format: Gst.Format, running_time: Number): {
        // javascript wrapper for 'gst_segment_position_from_running_time'
    }

Convert running_time into a position in the segment so that Gst.Segment.prototype.to_running_time with that position returns running_time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`running_time` (Number) –

the running_time in the segment

Returns (Number) –

the position in the segment for running_time. This function returns -1 when running_time is -1 or when it is not inside segment.

Since : 1.8

#### Gst.Segment.position_from_running_time

    def Gst.Segment.position_from_running_time (self, format, running_time):
        #python wrapper for 'gst_segment_position_from_running_time'

Convert running_time into a position in the segment so that Gst.Segment.to_running_time with that position returns running_time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`running_time` (int) –

the running_time in the segment

Returns (int) –

the position in the segment for running_time. This function returns -1 when running_time is -1 or when it is not inside segment.

Since : 1.8

#### gst_segment_position_from_running_time_full

    gint
    gst_segment_position_from_running_time_full (const GstSegment * segment,
                                                 GstFormat format,
                                                 guint64 running_time,
                                                 guint64 * position)

Translate running_time to the segment position using the currently configured segment. Compared to gst_segment_position_from_running_time this function can return negative segment position.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

running_time can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, running_time resulted in a positive position returned in position.

When this function returns -1, the returned position was < 0, and the value in the position variable should be negated to get the real negative segment position.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`running_time` –

the running-time

`position` ( [out]) –

the resulting position in the segment

Returns –

a 1 or -1 on success, 0 on failure.

Since : 1.8

#### Gst.Segment.prototype.position_from_running_time_full

    function Gst.Segment.prototype.position_from_running_time_full(format: Gst.Format, running_time: Number): {
        // javascript wrapper for 'gst_segment_position_from_running_time_full'
    }

Translate running_time to the segment position using the currently configured segment. Compared to Gst.Segment.prototype.position_from_running_time this function can return negative segment position.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

running_time can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, running_time resulted in a positive position returned in position.

When this function returns -1, the returned position was < 0, and the value in the position variable should be negated to get the real negative segment position.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`running_time` (Number) –

the running-time

Returns a tuple made of:

(Number ) –

a 1 or -1 on success, 0 on failure.

`position` (Number ) –

a 1 or -1 on success, 0 on failure.

Since : 1.8

#### Gst.Segment.position_from_running_time_full

    def Gst.Segment.position_from_running_time_full (self, format, running_time):
        #python wrapper for 'gst_segment_position_from_running_time_full'

Translate running_time to the segment position using the currently configured segment. Compared to Gst.Segment.position_from_running_time this function can return negative segment position.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

running_time can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, running_time resulted in a positive position returned in position.

When this function returns -1, the returned position was < 0, and the value in the position variable should be negated to get the real negative segment position.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`running_time` (int) –

the running-time

Returns a tuple made of:

(int ) –

a 1 or -1 on success, 0 on failure.

`position` (int ) –

a 1 or -1 on success, 0 on failure.

Since : 1.8

#### gst_segment_position_from_stream_time

    guint64
    gst_segment_position_from_stream_time (const GstSegment * segment,
                                           GstFormat format,
                                           guint64 stream_time)

Convert stream_time into a position in the segment so that gst_segment_to_stream_time with that position returns stream_time.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`stream_time` –

the stream_time in the segment

Returns –

the position in the segment for stream_time. This function returns -1 when stream_time is -1 or when it is not inside segment.

Since : 1.8

#### Gst.Segment.prototype.position_from_stream_time

    function Gst.Segment.prototype.position_from_stream_time(format: Gst.Format, stream_time: Number): {
        // javascript wrapper for 'gst_segment_position_from_stream_time'
    }

Convert stream_time into a position in the segment so that Gst.Segment.prototype.to_stream_time with that position returns stream_time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`stream_time` (Number) –

the stream_time in the segment

Returns (Number) –

the position in the segment for stream_time. This function returns -1 when stream_time is -1 or when it is not inside segment.

Since : 1.8

#### Gst.Segment.position_from_stream_time

    def Gst.Segment.position_from_stream_time (self, format, stream_time):
        #python wrapper for 'gst_segment_position_from_stream_time'

Convert stream_time into a position in the segment so that Gst.Segment.to_stream_time with that position returns stream_time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`stream_time` (int) –

the stream_time in the segment

Returns (int) –

the position in the segment for stream_time. This function returns -1 when stream_time is -1 or when it is not inside segment.

Since : 1.8

#### gst_segment_position_from_stream_time_full

    gint
    gst_segment_position_from_stream_time_full (const GstSegment * segment,
                                                GstFormat format,
                                                guint64 stream_time,
                                                guint64 * position)

Translate stream_time to the segment position using the currently configured segment. Compared to gst_segment_position_from_stream_time this function can return negative segment position.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

stream_time can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, stream_time resulted in a positive position returned in position.

When this function returns -1, the returned position should be negated to get the real negative segment position.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`stream_time` –

the stream-time

`position` ( [out]) –

the resulting position in the segment

Returns –

a 1 or -1 on success, 0 on failure.

Since : 1.8

#### Gst.Segment.prototype.position_from_stream_time_full

    function Gst.Segment.prototype.position_from_stream_time_full(format: Gst.Format, stream_time: Number): {
        // javascript wrapper for 'gst_segment_position_from_stream_time_full'
    }

Translate stream_time to the segment position using the currently configured segment. Compared to Gst.Segment.prototype.position_from_stream_time this function can return negative segment position.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

stream_time can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, stream_time resulted in a positive position returned in position.

When this function returns -1, the returned position should be negated to get the real negative segment position.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`stream_time` (Number) –

the stream-time

Returns a tuple made of:

(Number ) –

a 1 or -1 on success, 0 on failure.

`position` (Number ) –

a 1 or -1 on success, 0 on failure.

Since : 1.8

#### Gst.Segment.position_from_stream_time_full

    def Gst.Segment.position_from_stream_time_full (self, format, stream_time):
        #python wrapper for 'gst_segment_position_from_stream_time_full'

Translate stream_time to the segment position using the currently configured segment. Compared to Gst.Segment.position_from_stream_time this function can return negative segment position.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

stream_time can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, stream_time resulted in a positive position returned in position.

When this function returns -1, the returned position should be negated to get the real negative segment position.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`stream_time` (int) –

the stream-time

Returns a tuple made of:

(int ) –

a 1 or -1 on success, 0 on failure.

`position` (int ) –

a 1 or -1 on success, 0 on failure.

Since : 1.8

#### gst_segment_set_running_time

    gboolean
    gst_segment_set_running_time (GstSegment * segment,
                                  GstFormat format,
                                  guint64 running_time)

Adjust the start/stop and base values of segment such that the next valid buffer will be one with running_time.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`running_time` –

the running_time in the segment

Returns –

TRUE if the segment could be updated successfully. If FALSE is returned, running_time is -1 or not in segment.

#### Gst.Segment.prototype.set_running_time

    function Gst.Segment.prototype.set_running_time(format: Gst.Format, running_time: Number): {
        // javascript wrapper for 'gst_segment_set_running_time'
    }

Adjust the start/stop and base values of segment such that the next valid buffer will be one with running_time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`running_time` (Number) –

the running_time in the segment

Returns (Number) –

true if the segment could be updated successfully. If false is returned, running_time is -1 or not in segment.

#### Gst.Segment.set_running_time

    def Gst.Segment.set_running_time (self, format, running_time):
        #python wrapper for 'gst_segment_set_running_time'

Adjust the start/stop and base values of segment such that the next valid buffer will be one with running_time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`running_time` (int) –

the running_time in the segment

Returns (bool) –

True if the segment could be updated successfully. If False is returned, running_time is -1 or not in segment.

#### gst_segment_to_position

    guint64
    gst_segment_to_position (const GstSegment * segment,
                             GstFormat format,
                             guint64 running_time)

Convert running_time into a position in the segment so that gst_segment_to_running_time with that position returns running_time.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`running_time` –

the running_time in the segment

Returns –

the position in the segment for running_time. This function returns -1 when running_time is -1 or when it is not inside segment.

deprecated : Use gst_segment_position_from_running_time() instead.

#### Gst.Segment.prototype.to_position

    function Gst.Segment.prototype.to_position(format: Gst.Format, running_time: Number): {
        // javascript wrapper for 'gst_segment_to_position'
    }

Convert running_time into a position in the segment so that Gst.Segment.prototype.to_running_time with that position returns running_time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`running_time` (Number) –

the running_time in the segment

Returns (Number) –

the position in the segment for running_time. This function returns -1 when running_time is -1 or when it is not inside segment.

deprecated : Use gst_segment_position_from_running_time() instead.

#### Gst.Segment.to_position

    def Gst.Segment.to_position (self, format, running_time):
        #python wrapper for 'gst_segment_to_position'

Convert running_time into a position in the segment so that Gst.Segment.to_running_time with that position returns running_time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`running_time` (int) –

the running_time in the segment

Returns (int) –

the position in the segment for running_time. This function returns -1 when running_time is -1 or when it is not inside segment.

deprecated : Use gst_segment_position_from_running_time() instead.

#### gst_segment_to_running_time

    guint64
    gst_segment_to_running_time (const GstSegment * segment,
                                 GstFormat format,
                                 guint64 position)

Translate position to the total running time using the currently configured segment. Position is a value between segment start and stop time.

This function is typically used by elements that need to synchronize to the global clock in a pipeline. The running time is a constantly increasing value starting from 0. When gst_segment_init is called, this value will reset to 0.

This function returns -1 if the position is outside of segment start and stop.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`position` –

the position in the segment

Returns –

the position as the total running time or -1 when an invalid position was given.

#### Gst.Segment.prototype.to_running_time

    function Gst.Segment.prototype.to_running_time(format: Gst.Format, position: Number): {
        // javascript wrapper for 'gst_segment_to_running_time'
    }

Translate position to the total running time using the currently configured segment. Position is a value between segment start and stop time.

This function is typically used by elements that need to synchronize to the global clock in a pipeline. The running time is a constantly increasing value starting from 0. When Gst.Segment.prototype.init is called, this value will reset to 0.

This function returns -1 if the position is outside of segment start and stop.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`position` (Number) –

the position in the segment

Returns (Number) –

the position as the total running time or -1 when an invalid position was given.

#### Gst.Segment.to_running_time

    def Gst.Segment.to_running_time (self, format, position):
        #python wrapper for 'gst_segment_to_running_time'

Translate position to the total running time using the currently configured segment. Position is a value between segment start and stop time.

This function is typically used by elements that need to synchronize to the global clock in a pipeline. The running time is a constantly increasing value starting from 0. When Gst.Segment.init is called, this value will reset to 0.

This function returns -1 if the position is outside of segment start and stop.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`position` (int) –

the position in the segment

Returns (int) –

the position as the total running time or -1 when an invalid position was given.

#### gst_segment_to_running_time_full

    gint
    gst_segment_to_running_time_full (const GstSegment * segment,
                                      GstFormat format,
                                      guint64 position,
                                      guint64 * running_time)

Translate position to the total running time using the currently configured segment. Compared to gst_segment_to_running_time this function can return negative running-time.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

position can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, position resulted in a positive running-time returned in running_time.

When this function returns -1, the returned running_time should be negated to get the real negative running time.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`position` –

the position in the segment

`running_time` ( [out][allow-none]) –

result running-time

Returns –

a 1 or -1 on success, 0 on failure.

Since : 1.6

#### Gst.Segment.prototype.to_running_time_full

    function Gst.Segment.prototype.to_running_time_full(format: Gst.Format, position: Number): {
        // javascript wrapper for 'gst_segment_to_running_time_full'
    }

Translate position to the total running time using the currently configured segment. Compared to Gst.Segment.prototype.to_running_time this function can return negative running-time.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

position can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, position resulted in a positive running-time returned in running_time.

When this function returns -1, the returned running_time should be negated to get the real negative running time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`position` (Number) –

the position in the segment

Returns a tuple made of:

(Number ) –

a 1 or -1 on success, 0 on failure.

`running_time` (Number ) –

a 1 or -1 on success, 0 on failure.

Since : 1.6

#### Gst.Segment.to_running_time_full

    def Gst.Segment.to_running_time_full (self, format, position):
        #python wrapper for 'gst_segment_to_running_time_full'

Translate position to the total running time using the currently configured segment. Compared to Gst.Segment.to_running_time this function can return negative running-time.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

position can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, position resulted in a positive running-time returned in running_time.

When this function returns -1, the returned running_time should be negated to get the real negative running time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`position` (int) –

the position in the segment

Returns a tuple made of:

(int ) –

a 1 or -1 on success, 0 on failure.

`running_time` (int ) –

a 1 or -1 on success, 0 on failure.

Since : 1.6

#### gst_segment_to_stream_time

    guint64
    gst_segment_to_stream_time (const GstSegment * segment,
                                GstFormat format,
                                guint64 position)

Translate position to stream time using the currently configured segment. The position value must be between segment start and stop value.

This function is typically used by elements that need to operate on the stream time of the buffers it receives, such as effect plugins. In those use cases, position is typically the buffer timestamp or clock time that one wants to convert to the stream time. The stream time is always between 0 and the total duration of the media stream.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`position` –

the position in the segment

Returns –

the position in stream_time or -1 when an invalid position was given.

Since : 1.8

#### Gst.Segment.prototype.to_stream_time

    function Gst.Segment.prototype.to_stream_time(format: Gst.Format, position: Number): {
        // javascript wrapper for 'gst_segment_to_stream_time'
    }

Translate position to stream time using the currently configured segment. The position value must be between segment start and stop value.

This function is typically used by elements that need to operate on the stream time of the buffers it receives, such as effect plugins. In those use cases, position is typically the buffer timestamp or clock time that one wants to convert to the stream time. The stream time is always between 0 and the total duration of the media stream.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`position` (Number) –

the position in the segment

Returns (Number) –

the position in stream_time or -1 when an invalid position was given.

Since : 1.8

#### Gst.Segment.to_stream_time

    def Gst.Segment.to_stream_time (self, format, position):
        #python wrapper for 'gst_segment_to_stream_time'

Translate position to stream time using the currently configured segment. The position value must be between segment start and stop value.

This function is typically used by elements that need to operate on the stream time of the buffers it receives, such as effect plugins. In those use cases, position is typically the buffer timestamp or clock time that one wants to convert to the stream time. The stream time is always between 0 and the total duration of the media stream.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`position` (int) –

the position in the segment

Returns (int) –

the position in stream_time or -1 when an invalid position was given.

Since : 1.8

#### gst_segment_to_stream_time_full

    gint
    gst_segment_to_stream_time_full (const GstSegment * segment,
                                     GstFormat format,
                                     guint64 position,
                                     guint64 * stream_time)

Translate position to the total stream time using the currently configured segment. Compared to gst_segment_to_stream_time this function can return negative stream-time.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

position can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, position resulted in a positive stream-time returned in stream_time.

When this function returns -1, the returned stream_time should be negated to get the real negative stream time.

Parameters:

`segment` –

a GstSegment structure.

`format` –

the format of the segment.

`position` –

the position in the segment

`stream_time` ( [out]) –

result stream-time

Returns –

a 1 or -1 on success, 0 on failure.

Since : 1.8

#### Gst.Segment.prototype.to_stream_time_full

    function Gst.Segment.prototype.to_stream_time_full(format: Gst.Format, position: Number): {
        // javascript wrapper for 'gst_segment_to_stream_time_full'
    }

Translate position to the total stream time using the currently configured segment. Compared to Gst.Segment.prototype.to_stream_time this function can return negative stream-time.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

position can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, position resulted in a positive stream-time returned in stream_time.

When this function returns -1, the returned stream_time should be negated to get the real negative stream time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`position` (Number) –

the position in the segment

Returns a tuple made of:

(Number ) –

a 1 or -1 on success, 0 on failure.

`stream_time` (Number ) –

a 1 or -1 on success, 0 on failure.

Since : 1.8

#### Gst.Segment.to_stream_time_full

    def Gst.Segment.to_stream_time_full (self, format, position):
        #python wrapper for 'gst_segment_to_stream_time_full'

Translate position to the total stream time using the currently configured segment. Compared to Gst.Segment.to_stream_time this function can return negative stream-time.

This function is typically used by elements that need to synchronize buffers against the clock or each other.

position can be any value and the result of this function for values outside of the segment is extrapolated.

When 1 is returned, position resulted in a positive stream-time returned in stream_time.

When this function returns -1, the returned stream_time should be negated to get the real negative stream time.

Parameters:

`segment` (Gst.Segment) –

a Gst.Segment structure.

`format` (Gst.Format) –

the format of the segment.

`position` (int) –

the position in the segment

Returns a tuple made of:

(int ) –

a 1 or -1 on success, 0 on failure.

`stream_time` (int ) –

a 1 or -1 on success, 0 on failure.

Since : 1.8

## Enumerations

### GstSeekFlags

Flags to be used with gst_element_seek or gst_event_new_seek. All flags can be used together.

A non flushing seek might take some time to perform as the currently playing data in the pipeline will not be cleared.

An accurate seek might be slower for formats that don't have any indexes or timestamp markers in the stream. Specifying this flag might require a complete scan of the file in those cases.

When performing a segment seek: after the playback of the segment completes, no EOS will be emitted by the element that performed the seek, but a GST_MESSAGE_SEGMENT_DONE message will be posted on the bus by the element. When this message is posted, it is possible to send a new seek event to continue playback. With this seek method it is possible to perform seamless looping or simple linear editing.

When only changing the playback rate and not the direction, the GST_SEEK_FLAG_INSTANT_RATE_CHANGE flag can be used for a non-flushing seek to signal that the rate change should be applied immediately. This requires special support in the seek handlers (e.g. demuxers) and any elements synchronizing to the clock, and in general can't work in all cases (for example UDP streaming where the delivery rate is controlled by a remote server). The instant-rate-change mode supports changing the trickmode-related GST_SEEK_ flags, but can't be used in conjunction with other seek flags that affect the new playback position - as the playback position will not be changing.

When doing fast forward (rate > 1.0) or fast reverse (rate < -1.0) trickmode playback, the GST_SEEK_FLAG_TRICKMODE flag can be used to instruct decoders and demuxers to adjust the playback rate by skipping frames. This can improve performance and decrease CPU usage because not all frames need to be decoded.

Beyond that, the GST_SEEK_FLAG_TRICKMODE_KEY_UNITS flag can be used to request that decoders skip all frames except key units, and GST_SEEK_FLAG_TRICKMODE_NO_AUDIO flags can be used to request that audio decoders do no decoding at all, and simple output silence.

The GST_SEEK_FLAG_SNAP_BEFORE flag can be used to snap to the previous relevant location, and the GST_SEEK_FLAG_SNAP_AFTER flag can be used to select the next relevant location. If GST_SEEK_FLAG_KEY_UNIT is specified, the relevant location is a keyframe. If both flags are specified, the nearest of these locations will be selected. If none are specified, the implementation is free to select whichever it wants.

The before and after here are in running time, so when playing backwards, the next location refers to the one that will played in next, and not the one that is located after in the actual source stream.

Also see part-seeking.txt in the GStreamer design documentation for more details on the meaning of these flags and the behaviour expected of elements that handle them.

##### Members

`GST_SEEK_FLAG_NONE` (0) –

no flag

`GST_SEEK_FLAG_FLUSH` (1) –

flush pipeline

`GST_SEEK_FLAG_ACCURATE` (2) –

accurate position is requested, this might be considerably slower for some formats.

`GST_SEEK_FLAG_KEY_UNIT` (4) –

seek to the nearest keyframe. This might be faster but less accurate.

`GST_SEEK_FLAG_SEGMENT` (8) –

perform a segment seek.

`GST_SEEK_FLAG_TRICKMODE` (16) –

when doing fast forward or fast reverse playback, allow elements to skip frames instead of generating all frames. (Since: 1.6)

`GST_SEEK_FLAG_SKIP` (16) –

Deprecated backward compatibility flag, replaced by GST_SEEK_FLAG_TRICKMODE

`GST_SEEK_FLAG_SNAP_BEFORE` (32) –

go to a location before the requested position, if GST_SEEK_FLAG_KEY_UNIT this means the keyframe at or before the requested position the one at or before the seek target.

`GST_SEEK_FLAG_SNAP_AFTER` (64) –

go to a location after the requested position, if GST_SEEK_FLAG_KEY_UNIT this means the keyframe at of after the requested position.

`GST_SEEK_FLAG_SNAP_NEAREST` (96) –

go to a position near the requested position, if GST_SEEK_FLAG_KEY_UNIT this means the keyframe closest to the requested position, if both keyframes are at an equal distance, behaves like GST_SEEK_FLAG_SNAP_BEFORE.

`GST_SEEK_FLAG_TRICKMODE_KEY_UNITS` (128) –

when doing fast forward or fast reverse playback, request that elements only decode keyframes and skip all other content, for formats that have keyframes. (Since: 1.6)

`GST_SEEK_FLAG_TRICKMODE_NO_AUDIO` (256) –

when doing fast forward or fast reverse playback, request that audio decoder elements skip decoding and output only gap events or silence. (Since: 1.6)

`GST_SEEK_FLAG_TRICKMODE_FORWARD_PREDICTED` (512) –

When doing fast forward or fast reverse playback, request that elements only decode keyframes and forward predicted frames and skip all other content (for example B-Frames), for formats that have keyframes and forward predicted frames. (Since: 1.18)

`GST_SEEK_FLAG_INSTANT_RATE_CHANGE` (1024) –

Signals that a rate change should be applied immediately. Only valid if start/stop position are GST_CLOCK_TIME_NONE, the playback direction does not change and the seek is not flushing. (Since: 1.18)

### Gst.SeekFlags

Flags to be used with Gst.Element.prototype.seek or Gst.Event.prototype.new_seek. All flags can be used together.

A non flushing seek might take some time to perform as the currently playing data in the pipeline will not be cleared.

An accurate seek might be slower for formats that don't have any indexes or timestamp markers in the stream. Specifying this flag might require a complete scan of the file in those cases.

When performing a segment seek: after the playback of the segment completes, no EOS will be emitted by the element that performed the seek, but a Gst.MessageType.SEGMENT_DONE message will be posted on the bus by the element. When this message is posted, it is possible to send a new seek event to continue playback. With this seek method it is possible to perform seamless looping or simple linear editing.

When only changing the playback rate and not the direction, the Gst.SeekFlags.INSTANT_RATE_CHANGE flag can be used for a non-flushing seek to signal that the rate change should be applied immediately. This requires special support in the seek handlers (e.g. demuxers) and any elements synchronizing to the clock, and in general can't work in all cases (for example UDP streaming where the delivery rate is controlled by a remote server). The instant-rate-change mode supports changing the trickmode-related GST_SEEK_ flags, but can't be used in conjunction with other seek flags that affect the new playback position - as the playback position will not be changing.

When doing fast forward (rate > 1.0) or fast reverse (rate < -1.0) trickmode playback, the Gst.SeekFlags.TRICKMODE flag can be used to instruct decoders and demuxers to adjust the playback rate by skipping frames. This can improve performance and decrease CPU usage because not all frames need to be decoded.

Beyond that, the Gst.SeekFlags.TRICKMODE_KEY_UNITS flag can be used to request that decoders skip all frames except key units, and Gst.SeekFlags.TRICKMODE_NO_AUDIO flags can be used to request that audio decoders do no decoding at all, and simple output silence.

The Gst.SeekFlags.SNAP_BEFORE flag can be used to snap to the previous relevant location, and the Gst.SeekFlags.SNAP_AFTER flag can be used to select the next relevant location. If Gst.SeekFlags.KEY_UNIT is specified, the relevant location is a keyframe. If both flags are specified, the nearest of these locations will be selected. If none are specified, the implementation is free to select whichever it wants.

The before and after here are in running time, so when playing backwards, the next location refers to the one that will played in next, and not the one that is located after in the actual source stream.

Also see part-seeking.txt in the GStreamer design documentation for more details on the meaning of these flags and the behaviour expected of elements that handle them.

##### Members

`Gst.SeekFlags.NONE` (0) –

no flag

`Gst.SeekFlags.FLUSH` (1) –

flush pipeline

`Gst.SeekFlags.ACCURATE` (2) –

accurate position is requested, this might be considerably slower for some formats.

`Gst.SeekFlags.KEY_UNIT` (4) –

seek to the nearest keyframe. This might be faster but less accurate.

`Gst.SeekFlags.SEGMENT` (8) –

perform a segment seek.

`Gst.SeekFlags.TRICKMODE` (16) –

when doing fast forward or fast reverse playback, allow elements to skip frames instead of generating all frames. (Since: 1.6)

`Gst.SeekFlags.SKIP` (16) –

Deprecated backward compatibility flag, replaced by Gst.SeekFlags.TRICKMODE

`Gst.SeekFlags.SNAP_BEFORE` (32) –

go to a location before the requested position, if Gst.SeekFlags.KEY_UNIT this means the keyframe at or before the requested position the one at or before the seek target.

`Gst.SeekFlags.SNAP_AFTER` (64) –

go to a location after the requested position, if Gst.SeekFlags.KEY_UNIT this means the keyframe at of after the requested position.

`Gst.SeekFlags.SNAP_NEAREST` (96) –

go to a position near the requested position, if Gst.SeekFlags.KEY_UNIT this means the keyframe closest to the requested position, if both keyframes are at an equal distance, behaves like Gst.SeekFlags.SNAP_BEFORE.

`Gst.SeekFlags.TRICKMODE_KEY_UNITS` (128) –

when doing fast forward or fast reverse playback, request that elements only decode keyframes and skip all other content, for formats that have keyframes. (Since: 1.6)

`Gst.SeekFlags.TRICKMODE_NO_AUDIO` (256) –

when doing fast forward or fast reverse playback, request that audio decoder elements skip decoding and output only gap events or silence. (Since: 1.6)

`Gst.SeekFlags.TRICKMODE_FORWARD_PREDICTED` (512) –

When doing fast forward or fast reverse playback, request that elements only decode keyframes and forward predicted frames and skip all other content (for example B-Frames), for formats that have keyframes and forward predicted frames. (Since: 1.18)

`Gst.SeekFlags.INSTANT_RATE_CHANGE` (1024) –

Signals that a rate change should be applied immediately. Only valid if start/stop position are GST_CLOCK_TIME_NONE, the playback direction does not change and the seek is not flushing. (Since: 1.18)

### Gst.SeekFlags

Flags to be used with Gst.Element.seek or Gst.Event.new_seek. All flags can be used together.

A non flushing seek might take some time to perform as the currently playing data in the pipeline will not be cleared.

An accurate seek might be slower for formats that don't have any indexes or timestamp markers in the stream. Specifying this flag might require a complete scan of the file in those cases.

When performing a segment seek: after the playback of the segment completes, no EOS will be emitted by the element that performed the seek, but a Gst.MessageType.SEGMENT_DONE message will be posted on the bus by the element. When this message is posted, it is possible to send a new seek event to continue playback. With this seek method it is possible to perform seamless looping or simple linear editing.

When only changing the playback rate and not the direction, the Gst.SeekFlags.INSTANT_RATE_CHANGE flag can be used for a non-flushing seek to signal that the rate change should be applied immediately. This requires special support in the seek handlers (e.g. demuxers) and any elements synchronizing to the clock, and in general can't work in all cases (for example UDP streaming where the delivery rate is controlled by a remote server). The instant-rate-change mode supports changing the trickmode-related GST_SEEK_ flags, but can't be used in conjunction with other seek flags that affect the new playback position - as the playback position will not be changing.

When doing fast forward (rate > 1.0) or fast reverse (rate < -1.0) trickmode playback, the Gst.SeekFlags.TRICKMODE flag can be used to instruct decoders and demuxers to adjust the playback rate by skipping frames. This can improve performance and decrease CPU usage because not all frames need to be decoded.

Beyond that, the Gst.SeekFlags.TRICKMODE_KEY_UNITS flag can be used to request that decoders skip all frames except key units, and Gst.SeekFlags.TRICKMODE_NO_AUDIO flags can be used to request that audio decoders do no decoding at all, and simple output silence.

The Gst.SeekFlags.SNAP_BEFORE flag can be used to snap to the previous relevant location, and the Gst.SeekFlags.SNAP_AFTER flag can be used to select the next relevant location. If Gst.SeekFlags.KEY_UNIT is specified, the relevant location is a keyframe. If both flags are specified, the nearest of these locations will be selected. If none are specified, the implementation is free to select whichever it wants.

The before and after here are in running time, so when playing backwards, the next location refers to the one that will played in next, and not the one that is located after in the actual source stream.

Also see part-seeking.txt in the GStreamer design documentation for more details on the meaning of these flags and the behaviour expected of elements that handle them.

##### Members

`Gst.SeekFlags.NONE` (0) –

no flag

`Gst.SeekFlags.FLUSH` (1) –

flush pipeline

`Gst.SeekFlags.ACCURATE` (2) –

accurate position is requested, this might be considerably slower for some formats.

`Gst.SeekFlags.KEY_UNIT` (4) –

seek to the nearest keyframe. This might be faster but less accurate.

`Gst.SeekFlags.SEGMENT` (8) –

perform a segment seek.

`Gst.SeekFlags.TRICKMODE` (16) –

when doing fast forward or fast reverse playback, allow elements to skip frames instead of generating all frames. (Since: 1.6)

`Gst.SeekFlags.SKIP` (16) –

Deprecated backward compatibility flag, replaced by Gst.SeekFlags.TRICKMODE

`Gst.SeekFlags.SNAP_BEFORE` (32) –

go to a location before the requested position, if Gst.SeekFlags.KEY_UNIT this means the keyframe at or before the requested position the one at or before the seek target.

`Gst.SeekFlags.SNAP_AFTER` (64) –

go to a location after the requested position, if Gst.SeekFlags.KEY_UNIT this means the keyframe at of after the requested position.

`Gst.SeekFlags.SNAP_NEAREST` (96) –

go to a position near the requested position, if Gst.SeekFlags.KEY_UNIT this means the keyframe closest to the requested position, if both keyframes are at an equal distance, behaves like Gst.SeekFlags.SNAP_BEFORE.

`Gst.SeekFlags.TRICKMODE_KEY_UNITS` (128) –

when doing fast forward or fast reverse playback, request that elements only decode keyframes and skip all other content, for formats that have keyframes. (Since: 1.6)

`Gst.SeekFlags.TRICKMODE_NO_AUDIO` (256) –

when doing fast forward or fast reverse playback, request that audio decoder elements skip decoding and output only gap events or silence. (Since: 1.6)

`Gst.SeekFlags.TRICKMODE_FORWARD_PREDICTED` (512) –

When doing fast forward or fast reverse playback, request that elements only decode keyframes and forward predicted frames and skip all other content (for example B-Frames), for formats that have keyframes and forward predicted frames. (Since: 1.18)

`Gst.SeekFlags.INSTANT_RATE_CHANGE` (1024) –

Signals that a rate change should be applied immediately. Only valid if start/stop position are GST_CLOCK_TIME_NONE, the playback direction does not change and the seek is not flushing. (Since: 1.18)

### GstSeekType

The different types of seek events. When constructing a seek event with gst_event_new_seek or when doing gst_segment_do_seek ().

##### Members

`GST_SEEK_TYPE_NONE` (0) –

no change in position is required

`GST_SEEK_TYPE_SET` (1) –

absolute position is requested

`GST_SEEK_TYPE_END` (2) –

relative position to duration is requested

### Gst.SeekType

The different types of seek events. When constructing a seek event with Gst.Event.prototype.new_seek or when doing gst_segment_do_seek ().

##### Members

`Gst.SeekType.NONE` (0) –

no change in position is required

`Gst.SeekType.SET` (1) –

absolute position is requested

`Gst.SeekType.END` (2) –

relative position to duration is requested

### Gst.SeekType

The different types of seek events. When constructing a seek event with Gst.Event.new_seek or when doing gst_segment_do_seek ().

##### Members

`Gst.SeekType.NONE` (0) –

no change in position is required

`Gst.SeekType.SET` (1) –

absolute position is requested

`Gst.SeekType.END` (2) –

relative position to duration is requested

### GstSegmentFlags

Flags for the GstSegment structure. Currently mapped to the corresponding values of the seek flags.

##### Members

`GST_SEGMENT_FLAG_NONE` (0) –

no flags

`GST_SEGMENT_FLAG_RESET` (1) –

reset the pipeline running_time to the segment running_time

`GST_SEGMENT_FLAG_TRICKMODE` (16) –

perform skip playback (Since: 1.6)

`GST_SEGMENT_FLAG_SKIP` (16) –

Deprecated backward compatibility flag, replaced by GST_SEGMENT_FLAG_TRICKMODE

`GST_SEGMENT_FLAG_SEGMENT` (8) –

send SEGMENT_DONE instead of EOS

`GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS` (128) –

Decode only keyframes, where possible (Since: 1.6)

`GST_SEGMENT_FLAG_TRICKMODE_FORWARD_PREDICTED` (512) –

Decode only keyframes or forward predicted frames, where possible (Since: 1.18)

`GST_SEGMENT_FLAG_TRICKMODE_NO_AUDIO` (256) –

Do not decode any audio, where possible (Since: 1.6)

### Gst.SegmentFlags

Flags for the GstSegment structure. Currently mapped to the corresponding values of the seek flags.

##### Members

`Gst.SegmentFlags.NONE` (0) –

no flags

`Gst.SegmentFlags.RESET` (1) –

reset the pipeline running_time to the segment running_time

`Gst.SegmentFlags.TRICKMODE` (16) –

perform skip playback (Since: 1.6)

`Gst.SegmentFlags.SKIP` (16) –

Deprecated backward compatibility flag, replaced by GST_SEGMENT_FLAG_TRICKMODE

`Gst.SegmentFlags.SEGMENT` (8) –

send SEGMENT_DONE instead of EOS

`Gst.SegmentFlags.TRICKMODE_KEY_UNITS` (128) –

Decode only keyframes, where possible (Since: 1.6)

`Gst.SegmentFlags.TRICKMODE_FORWARD_PREDICTED` (512) –

Decode only keyframes or forward predicted frames, where possible (Since: 1.18)

`Gst.SegmentFlags.TRICKMODE_NO_AUDIO` (256) –

Do not decode any audio, where possible (Since: 1.6)

### Gst.SegmentFlags

Flags for the GstSegment structure. Currently mapped to the corresponding values of the seek flags.

##### Members

`Gst.SegmentFlags.NONE` (0) –

no flags

`Gst.SegmentFlags.RESET` (1) –

reset the pipeline running_time to the segment running_time

`Gst.SegmentFlags.TRICKMODE` (16) –

perform skip playback (Since: 1.6)

`Gst.SegmentFlags.SKIP` (16) –

Deprecated backward compatibility flag, replaced by GST_SEGMENT_FLAG_TRICKMODE

`Gst.SegmentFlags.SEGMENT` (8) –

send SEGMENT_DONE instead of EOS

`Gst.SegmentFlags.TRICKMODE_KEY_UNITS` (128) –

Decode only keyframes, where possible (Since: 1.6)

`Gst.SegmentFlags.TRICKMODE_FORWARD_PREDICTED` (512) –

Decode only keyframes or forward predicted frames, where possible (Since: 1.18)

`Gst.SegmentFlags.TRICKMODE_NO_AUDIO` (256) –

Do not decode any audio, where possible (Since: 1.6)

## Constants

### GST_SEGMENT_INSTANT_FLAGS

    #define GST_SEGMENT_INSTANT_FLAGS \
        (GST_SEGMENT_FLAG_TRICKMODE|GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS|GST_SEEK_FLAG_TRICKMODE_FORWARD_PREDICTED|GST_SEGMENT_FLAG_TRICKMODE_NO_AUDIO)

### Gst.SEGMENT_INSTANT_FLAGS

The results of the search are