org.gstreamer.event
Class NewSegmentEvent

java.lang.Object
  extended by org.gstreamer.lowlevel.NativeValue
      extended by org.gstreamer.lowlevel.Handle
          extended by org.gstreamer.lowlevel.NativeObject
              extended by org.gstreamer.lowlevel.RefCountedObject
                  extended by org.gstreamer.MiniObject
                      extended by org.gstreamer.Event
                          extended by org.gstreamer.event.NewSegmentEvent

public class NewSegmentEvent
extends Event

The newsegment event marks the range of buffers to be processed. All data not within the segment range is not to be processed. This can be used intelligently by plugins to apply more efficient methods of skipping unneeded data.

The position value of the segment is used in conjunction with the start value to convertTo the buffer timestamps into the stream time. This is usually done in sinks to report the current stream_time.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.gstreamer.lowlevel.NativeObject
NativeObject.Initializer
 
Field Summary
 
Fields inherited from class org.gstreamer.lowlevel.NativeObject
defaultInit, LIFECYCLE, ownsHandle
 
Constructor Summary
NewSegmentEvent(boolean update, double rate, ClockTime start, ClockTime stop, ClockTime position)
           
NewSegmentEvent(boolean update, double rate, double appliedRate, Format format, long start, long stop, long position)
          Allocates a new newsegment event with the given format/values triplets.
NewSegmentEvent(boolean update, double rate, Format format, long start, long stop, long position)
          Allocates a new newsegment event with the given format/values triplets.
NewSegmentEvent(NativeObject.Initializer init)
          This constructor is for internal use only.
 
Method Summary
 double getAppliedRate()
          Gets the applied playback rate.
 long getEnd()
          Gets the end of the new segment.
 Format getFormat()
          Gets the format of the start, stop and position values.
 long getPosition()
          Gets the position of the new segment.
 double getRate()
          Gets the playback rate.
 long getStart()
          Gets the start of the new segment.
 boolean isUpdate()
          Gets whether this new segment event is an update or not.
 
Methods inherited from class org.gstreamer.Event
getStructure
 
Methods inherited from class org.gstreamer.MiniObject
disposeNativeHandle, isWritable, makeWritable, objectFor, ref, unref
 
Methods inherited from class org.gstreamer.lowlevel.NativeObject
classFor, disown, dispose, equals, finalize, getNativeAddress, handle, hashCode, initializer, initializer, instanceFor, invalidate, isDisposed, nativeValue, objectFor, objectFor, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NewSegmentEvent

public NewSegmentEvent(NativeObject.Initializer init)
This constructor is for internal use only.

Parameters:
init - initialization data.

NewSegmentEvent

public NewSegmentEvent(boolean update,
                       double rate,
                       Format format,
                       long start,
                       long stop,
                       long position)
Allocates a new newsegment event with the given format/values triplets. position represents the stream_time of a buffer carrying a timestamp of start.

position cannot be -1, start cannot be -1, stop can be -1.

If there is a valid stop given, it must be greater or equal to start, including when the indicated playback rate is < 0.

After a newsegment event, the buffer stream time is calculated with:

position + (TIMESTAMP(buf) - start) * ABS (rate * applied_rate)

Parameters:
update - Whether this segment is an update to a previous one
rate - A new rate for playback
format - The format of the segment values
start - The start value of the segment
stop - The stop value of the segment
position - The stream position

NewSegmentEvent

public NewSegmentEvent(boolean update,
                       double rate,
                       ClockTime start,
                       ClockTime stop,
                       ClockTime position)

NewSegmentEvent

public NewSegmentEvent(boolean update,
                       double rate,
                       double appliedRate,
                       Format format,
                       long start,
                       long stop,
                       long position)
Allocates a new newsegment event with the given format/values triplets. position represents the stream_time of a buffer carrying a timestamp of start.

position cannot be -1, start cannot be -1, stop can be -1.

If there is a valid stop given, it must be greater or equal to start, including when the indicated playback rate is < 0.

The appliedRate value provides information about any rate adjustment that has already been made to the timestamps and content on the buffers of the stream. (rate * appliedRate) should always equal the rate that has been requested for playback.

For example, if an element has an input segment with intended playback rate of 2.0 and appliedRate of 1.0, it can adjust incoming timestamps and buffer content by half and output a newsegment event with rate of 1.0 and appliedRate of 2.0

After a newsegment event, the buffer stream time is calculated with:

position + (TIMESTAMP(buf) - start) * ABS (rate * applied_rate)

Parameters:
update - Whether this segment is an update to a previous one
rate - A new rate for playback
appliedRate - The rate factor which has already been applied
format - The format of the segment values
start - The start value of the segment
stop - The stop value of the segment
position - The stream position
Method Detail

isUpdate

public boolean isUpdate()
Gets whether this new segment event is an update or not.

Returns:
true if this event is an update.

getFormat

public Format getFormat()
Gets the format of the start, stop and position values.

Returns:
The Format for the start, stop and position values.

getRate

public double getRate()
Gets the playback rate.

Returns:
the playback rate.

getAppliedRate

public double getAppliedRate()
Gets the applied playback rate.

Returns:
the applied playback rate.

getStart

public long getStart()
Gets the start of the new segment.

Returns:
the start of the new segment in units of the event format.

getEnd

public long getEnd()
Gets the end of the new segment.

Returns:
the end of the new segment.

getPosition

public long getPosition()
Gets the position of the new segment.

Returns:
the position of the new segment.