public class NewSegmentEvent extends Event
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.
NativeObject.Initializer
defaultInit, LIFECYCLE, ownsHandle
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
getStructure
disposeNativeHandle, isWritable, makeWritable, ref, unref
classFor, disown, dispose, equals, finalize, getNativeAddress, handle, hashCode, initializer, initializer, instanceFor, invalidate, isDisposed, nativeValue, objectFor, objectFor, objectFor, objectFor, toString
public NewSegmentEvent(NativeObject.Initializer init)
init
- initialization data.public NewSegmentEvent(boolean update, double rate, Format format, long start, long stop, long position)
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)
update
- Whether this segment is an update to a previous onerate
- A new rate for playbackformat
- The format of the segment valuesstart
- The start value of the segmentstop
- The stop value of the segmentposition
- The stream positionpublic NewSegmentEvent(boolean update, double rate, ClockTime start, ClockTime stop, ClockTime position)
public NewSegmentEvent(boolean update, double rate, double appliedRate, Format format, long start, long stop, long position)
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)
update
- Whether this segment is an update to a previous onerate
- A new rate for playbackappliedRate
- The rate factor which has already been appliedformat
- The format of the segment valuesstart
- The start value of the segmentstop
- The stop value of the segmentposition
- The stream positionpublic boolean isUpdate()
public Format getFormat()
Format
for the start, stop and position values.public double getRate()
public double getAppliedRate()
public long getStart()
public long getEnd()
public long getPosition()