public class AbstractClock extends java.lang.Object implements Clock
AbstractController,
StopTimeMonitor| Constructor and Description |
|---|
AbstractClock()
Constructs an AbstractClock.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getMediaNanoseconds()
Get the media time in nanoseconds.
|
protected Time |
getMediaStartTime()
Get the media time the media is scheduled to start (if the
Clock is stopped), or the media time at which the Clock
started (if the Clock is started).
|
Time |
getMediaTime()
Calculates the current media time based on the current
time-base time, the time-base start time, the media start
time, and the rate.
|
float |
getRate()
Get the current temporal scale factor.
|
Time |
getStopTime()
Get the last value successfully set by setStopTime.
|
Time |
getSyncTime()
Gets the time until the Clock's media synchronizes with its
time-base.
|
TimeBase |
getTimeBase()
Get the TimeBase that this Clock is using.
|
protected Time |
getTimeBaseStartTime()
Get the time-base time the media is scheduled to start (if
the Clock is stopped), or the time-base time at which the
Clock started (if the Clock is started).
|
Time |
mapToTimeBase(Time t)
Given a media time, returns the corresponding time-base
time.
|
void |
setMediaTime(Time t)
Sets the media time.
|
float |
setRate(float rate)
Set the temporal scale factor.
|
void |
setStopTime(Time mediaStopTime)
Set the media time at which you want the
Clock to stop. |
void |
setTimeBase(TimeBase timebase)
Set the
TimeBase for this Clock. |
void |
stop()
Stop the Clock.
|
void |
syncStart(Time t)
syncStart the AbstractClock at the previously-
specified time-base start time.
|
public void setTimeBase(TimeBase timebase) throws IncompatibleTimeBaseException
TimeBase for this Clock.
This method can only be called on a Stopped
Clock. A ClockStartedError is
thrown if setTimeBase is called on a
Started Clock.
A Clock has a default TimeBase that
is determined by the implementation. To reset a
Clock to its default TimeBase,
call setTimeBase(null).
setTimeBase in interface Clocktimebase - The new TimeBase or
null to reset the
Clock to its default
TimeBase.IncompatibleTimeBaseException - Thrown if the Clock can't use the
specified TimeBase.public TimeBase getTimeBase()
getTimeBase in interface Clockpublic void setMediaTime(Time t)
setMediaTime in interface Clockt - The media time to setClockStartedError - If the Clock is Started.protected Time getMediaStartTime()
protected Time getTimeBaseStartTime()
public Time getMediaTime()
getMediaTime in interface Clockpublic long getMediaNanoseconds()
getMediaNanoseconds in interface Clockpublic Time getSyncTime()
getSyncTime in interface Clockpublic Time mapToTimeBase(Time t) throws ClockStoppedException
mapToTimeBase in interface Clockt - A media time to be mapped to a time-base time.ClockStoppedException - If the clock has not started.public float setRate(float rate)
The setRate method returns the actual rate set
by the Clock. Clocks should set
their rate as close to the requested value as possible, but
are not required to set the rate to the exact value of any
argument other than 1.0. A Clock is only
guaranteed to set its rate exactly to 1.0.
setRate in interface Clockrate - The temporal scale factor (rate) to set.ClockStartedError - If the Clock is Started.public float getRate()
Clock's media time and its
TimeBase.
For example, a rate of 2.0 indicates that media time
will pass twice as fast as the TimeBase time
once the Clock starts. Similarly, a negative
rate indicates that the Clock runs in the
opposite direction of its TimeBase. All
Clocks are guaranteed to support a rate of
1.0, the default rate. Clocks are not
required to support any other rate.
public void setStopTime(Time mediaStopTime)
Clock to stop. The Clock will
stop when its media time passes the stop-time. To
clear the stop time, set it to: Clock.RESET.
You can always call setStopTime on a
Stopped Clock.
On a Started Clock, the stop-time can
only be set once. A StopTimeSetError is
thrown if setStopTime is called and the
media stop-time has already been set.
setStopTime in interface ClockmediaStopTime - The time at which you want the
Clock to stop, in media
time.public Time getStopTime()
getStopTime in interface Clockpublic void syncStart(Time t)
Synchronous method -- return when transition complete