Class TimeFrameI
- java.lang.Object
-
- com.jogamp.common.av.TimeFrameI
-
- Direct Known Subclasses:
AudioSink.AudioFrame
public class TimeFrameI extends Object
Integer time frame in milliseconds, maybe specialized for texture/video, audio, .. animated content.Type and value range has been chosen to suit embedded CPUs and characteristics of audio / video streaming and animations. Milliseconds of type integer with a maximum value of
Integer.MAX_VALUE
will allow tracking time up 2,147,483.647 seconds or 24 days 20 hours 31 minutes and 23 seconds, seegetPTS()
andgetDuration()
.Milliseconds granularity is also more than enough to deal with A-V synchronization, where the threshold usually lies within 22ms.
Milliseconds granularity for displaying video frames might seem inaccurate for each single frame, i.e. 60Hz != 16ms, however, accumulated values diminish this error and vertical sync is achieved by build-in V-Sync of the video drivers.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
duration
static int
END_OF_STREAM_PTS
Constant marking the end of the stream PTS, i.e.static int
INVALID_PTS
Constant marking an invalid PTS, i.e.protected int
pts
-
Constructor Summary
Constructors Constructor Description TimeFrameI()
Ctor w/ zero duration andINVALID_PTS
.TimeFrameI(int pts, int duration)
Create a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDuration()
Get this frame's duration in milliseconds.int
getPTS()
Returns this frame's presentation timestamp (PTS) in milliseconds.void
setDuration(int duration)
Set this frame's duration in milliseconds.void
setPTS(int pts)
Set this frame's presentation timestamp (PTS) in milliseconds.String
toString()
-
-
-
Field Detail
-
INVALID_PTS
public static final int INVALID_PTS
Constant marking an invalid PTS, i.e. Integer.MIN_VALUE == 0x80000000 == -2147483648. Sync w/ native code.- See Also:
- Constant Field Values
-
END_OF_STREAM_PTS
public static final int END_OF_STREAM_PTS
Constant marking the end of the stream PTS, i.e. Integer.MIN_VALUE - 1 == 0x7FFFFFFF == 2147483647. Sync w/ native code.- See Also:
- Constant Field Values
-
pts
protected int pts
-
duration
protected int duration
-
-
Constructor Detail
-
TimeFrameI
public TimeFrameI()
Ctor w/ zero duration andINVALID_PTS
.
-
TimeFrameI
public TimeFrameI(int pts, int duration)
Create a new instance- Parameters:
pts
- frame pts in milliseconds, seegetPTS()
duration
- frame duration in milliseconds, seegetDuration()
- See Also:
getPTS()
,getDuration()
-
-
Method Detail
-
getPTS
public final int getPTS()
Returns this frame's presentation timestamp (PTS) in milliseconds.The relative millisecond PTS since start of the presentation stored in integer covers a time span of 2'147'483'647 ms (see
Integer.MAX_VALUE
or 2'147'483 seconds or 24.855 days.
-
setPTS
public final void setPTS(int pts)
Set this frame's presentation timestamp (PTS) in milliseconds.- See Also:
getPTS()
-
getDuration
public final int getDuration()
Get this frame's duration in milliseconds.The duration stored in integer covers 2'147'483'647 ms (see
Integer.MAX_VALUE
or 2'147'483 seconds or 24.855 days.
-
setDuration
public final void setDuration(int duration)
Set this frame's duration in milliseconds.- See Also:
getDuration()
-
-