|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object com.sun.media.BasicController
public abstract class BasicController
Media Controller implements the basic functionalities of a java.media.Controller. These include:<
字段摘要 | |
---|---|
protected java.lang.String |
processError
|
protected int |
state
|
protected boolean |
stopThreadEnabled
|
从接口 javax.media.Controller 继承的字段 |
---|
LATENCY_UNKNOWN, Prefetched, Prefetching, Realized, Realizing, Started, Unrealized |
从接口 javax.media.Clock 继承的字段 |
---|
RESET |
从接口 javax.media.Duration 继承的字段 |
---|
DURATION_UNBOUNDED, DURATION_UNKNOWN |
构造方法摘要 | |
---|---|
BasicController()
|
方法摘要 | |
---|---|
protected void |
abortConfigure()
Called when the configure() is aborted, i.e. deallocate() was called while realizing. |
protected abstract void |
abortPrefetch()
Called when the prefetch() is aborted, i.e. deallocate() was called while prefetching. |
protected abstract void |
abortRealize()
Called when the realize() is aborted, i.e. deallocate() was called while realizing. |
void |
addControllerListener(ControllerListener listener)
Add a listener to the listenerList. |
void |
close()
A subclass of this implement close to stop all threads to make it "finalizable", i.e., ready to be garbage collected. |
protected void |
completeConfigure()
Called when the controller is realized and when all the ConfigureCompleteEvents from down stream Controllers have been received. |
protected void |
completePrefetch()
Called when the controller is prefetched and when all the PrefetchCompleteEvents from down stream nodes have been received. |
protected void |
completeRealize()
Called when the controller is realized and when all the RealizeCompleteEvents from down stream Controllers have been received. |
void |
configure()
|
void |
deallocate()
Aborts the current operation and cease any activity that consumes system resources. |
protected void |
dispatchEvent(ControllerEvent evt)
An internal function to notify the listeners on the listener list the given event. |
protected void |
doClose()
Invoked by close() to cleanup the Controller. |
protected boolean |
doConfigure()
The stub function to perform the steps to configure the controller. |
protected void |
doDeallocate()
Called by deallocate(). |
protected void |
doFailedConfigure()
Called when realize() has failed. |
protected void |
doFailedPrefetch()
Called when the prefetch() has failed. |
protected void |
doFailedRealize()
Called when realize() has failed. |
protected abstract boolean |
doPrefetch()
The stub function to perform the steps to prefetch the controller. |
protected abstract boolean |
doRealize()
The stub function to perform the steps to realize the controller. |
protected void |
doSetMediaTime(Time when)
|
protected float |
doSetRate(float factor)
|
protected abstract void |
doStart()
Start immediately. |
protected void |
doStop()
Invoked from stop(). |
protected Clock |
getClock()
|
Control |
getControl(java.lang.String type)
Get the Control that supports the
class or interface specified. |
Control[] |
getControls()
Return a list of Control objects this Controller supports. |
Time |
getDuration()
Return the duration of the media. |
long |
getMediaNanoseconds()
Get the current media time in nanoseconds. |
Time |
getMediaTime()
Return the current media time. |
float |
getRate()
Get the current presentation speed. |
Time |
getStartLatency()
Gets the Controller's start latency in nanoseconds. |
int |
getState()
Get the current state of the controller. |
Time |
getStopTime()
Get the preset stop time. |
Time |
getSyncTime()
Return the Sync Time. |
int |
getTargetState()
Get the current target state. |
TimeBase |
getTimeBase()
Gets the TimeBase that this Clock is using. |
protected void |
interrupt()
Interrupt the process. |
protected abstract boolean |
isConfigurable()
Subclass should define this. |
protected boolean |
isInterrupted()
Return true if the process is interrupted. |
Time |
mapToTimeBase(Time t)
Map the given media-time to time-base-time. |
void |
prefetch()
Take the necessary steps to prefetch the controller. |
void |
realize()
Take the necessary steps to realize the controller. |
void |
removeControllerListener(ControllerListener listener)
Remove a listener from the listener list. |
protected void |
resetInterrupt()
Reset the interrupted flag. |
protected void |
sendEvent(ControllerEvent evt)
Send an event to the listeners listening to my events. |
protected void |
setClock(Clock c)
Subclass can use this to switch to a different default clock. |
protected void |
setMediaLength(long t)
|
void |
setMediaTime(Time when)
Sets the Clock's media time. |
float |
setRate(float factor)
Sets the temporal scale factor. |
void |
setStopTime(Time t)
Sets the media time at which you want the Clock
to stop. |
protected void |
setTargetState(int state)
Set the target state. |
void |
setTimeBase(TimeBase tb)
Sets the TimeBase for this Clock . |
void |
stop()
Stop the controller. |
protected void |
stopAtTime()
Stop because stop time has been reached. |
protected void |
stopControllerOnly()
Stop the controller. |
void |
syncStart(Time tbt)
Synchronizes the current media time to the specified time-base time and start the Clock . |
protected boolean |
syncStartInProgress()
|
protected void |
throwError(java.lang.Error e)
|
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
protected int state
protected java.lang.String processError
protected boolean stopThreadEnabled
构造方法详细信息 |
---|
public BasicController()
方法详细信息 |
---|
protected abstract boolean isConfigurable()
protected void setClock(Clock c)
protected Clock getClock()
protected void interrupt()
protected void resetInterrupt()
protected boolean isInterrupted()
protected boolean doConfigure()
protected void abortConfigure()
protected abstract boolean doRealize()
Return true if the realize is successful. Return false and set the processError string if failed.
This function is not declared synchronized because first it is already guaranteed by realize() not to be called more than once simultaneously. Secondly if this is synchronized, then other synchronized methods, deallocate() and processEvent() will be blocked since they are synchronized methods. Override this to implement subclass behavior.
protected abstract void abortRealize()
protected abstract boolean doPrefetch()
Return true if the prefetch is successful. Return false and set the processError string if failed.
This function is not declared synchronized because first it is already guaranteed by realize() not to be called more than once simultaneously. Secondly if this is synchronized, then other synchronized methods, deallocate() and processEvent() will be blocked since they are synchronized methods. Override this to implement subclass behavior.
protected abstract void abortPrefetch()
protected abstract void doStart()
protected void doStop()
public final void close()
Controller
中的 close
protected void doClose()
public void setTimeBase(TimeBase tb) throws IncompatibleTimeBaseException
Clock
复制的描述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)
.
Clock
中的 setTimeBase
tb
- 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 Control[] getControls()
Controller
中的 getControls
public Control getControl(java.lang.String type)
Control
that supports the
class or interface specified. The full class
or interface name should be specified.
Null
is returned if the Control
is not supported.
Controller
中的 getControl
Control
for the class or interface
name.public void syncStart(Time tbt)
Clock
复制的描述Clock
.
The syncStart
method sets the time-base start-time,
and puts the Clock
in the Started state.
This method can only be called on a
Stopped Clock
.
A ClockStartedError
is thrown if
setTimeBase
is called on a Started
Clock
.
Clock
中的 syncStart
tbt
- The time-base time to equate with the
current media time.protected boolean syncStartInProgress()
public void stop()
Clock
中的 stop
protected void stopControllerOnly()
protected void stopAtTime()
public void setStopTime(Time t)
Clock
复制的描述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.
Clock
中的 setStopTime
t
- The time at which you want the
Clock
to stop, in media time.public Time getStopTime()
Clock
中的 getStopTime
public void setMediaTime(Time when)
Clock
复制的描述Clock's
media time.
This method can only be called on
a Stopped Clock
.
A ClockStartedError
is thrown if
setMediaTime
is called on a Started
Clock
.
Clock
中的 setMediaTime
when
- The new media time.protected void doSetMediaTime(Time when)
public Time getMediaTime()
Clock
中的 getMediaTime
public long getMediaNanoseconds()
Clock
中的 getMediaNanoseconds
public Time getSyncTime()
Clock
中的 getSyncTime
public TimeBase getTimeBase()
Clock
复制的描述TimeBase
that this Clock
is using.
Clock
中的 getTimeBase
public Time mapToTimeBase(Time t) throws ClockStoppedException
Clock
中的 mapToTimeBase
t
- given media time.
ClockStoppedException
- thrown if the Controller has already
been stopped.public float setRate(float factor)
Clock
复制的描述
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.
You can only call this method on a Stopped Clock
. A
ClockStartedError
is thrown if setRate
is called on a Started Clock
.
Clock
中的 setRate
factor
- The temporal scale factor (rate) to set.
protected float doSetRate(float factor)
public float getRate()
Clock
中的 getRate
public final int getState()
Controller
中的 getState
protected final void setTargetState(int state)
public final int getTargetState()
Controller
中的 getTargetState
public Time getStartLatency()
Controller
复制的描述Controller's
start latency in nanoseconds. The start latency represents a
worst-case estimate of the amount of time it will take
to present the first frame of data.
This method is useful for determining how far in advance the
syncStart
method must be invoked to ensure
that media will be
rendered at the specified start time.
For a Controller
that has a variable start latency,
the value returned represents the maximum possible
start latency. If you call getStartLatency
on a Controller
that isn't Prefetched
and getStartLatency
returns LATENCY_UNKNOWN
, calling
prefetch
and then calling getStartLatency
again after the Controller
posts
a PrefetchCompleteEvent
might
return a more accurate estimate.
If getStartLatency
still returns LATENCY_UNKNOWN
,
the start latency is indeterminate and you might not be able to use
syncStart
to
synchronize the Controller
with other Controllers
.
Note: In most cases, the value returned by
getStartLatency
will change once the
Controller
is Prefetched.
Controller
中的 getStartLatency
public Time getDuration()
Duration
中的 getDuration
protected void setMediaLength(long t)
public void configure()
protected void completeConfigure()
protected void doFailedConfigure()
public final void realize()
Controller
中的 realize
protected void completeRealize()
protected void doFailedRealize()
public final void prefetch()
Controller
中的 prefetch
protected void completePrefetch()
protected void doFailedPrefetch()
public final void deallocate()
Controller
复制的描述Controller
is not yet
Realized,
it returns to the Unrealized state. Otherwise, the Controller
returns to the Realized state.
It is illegal to call deallocate
on a Started Controller
.
A ClockStartedError
is thrown if deallocate
is called and the Controller
is in the Started state.
Controller
中的 deallocate
protected void doDeallocate()
public final void addControllerListener(ControllerListener listener)
Controller
中的 addControllerListener
listener
- The listener to which the Controller
will post events.public final void removeControllerListener(ControllerListener listener)
Controller
中的 removeControllerListener
listener
- The listener that has been receiving events from this
Controller
.protected final void sendEvent(ControllerEvent evt)
protected final void dispatchEvent(ControllerEvent evt)
protected void throwError(java.lang.Error e)
|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |