|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
public interface Processor
The Processor
interface defines a module for processing
and controlling time-based media data.
Processor
extends the Player
interface.
Unlike a Player
, which processes data as a "black box" and
only renders data to preset destinations, a Processor
supports a programmatic interface that enables control over the media data processing
and access to output data streams.
The processing performed by a Processor
is split into
three stages:
Both the data transcoding and multiplexing processes are programmable.
Processor
Differs from a Controller
Processor
extends the state transition cycle of a
Controller
by adding the Configuring and
Configured states.
The purpose of these additional states is to further refine
the realizing process. The
realizing step is essentially split into two phases:
DataSource
is queried and the input media
stream is parsed to get the format information for the tracks in the stream.
Processor
are constructed to handle
the input media stream.
Between these two steps, you can
program the Processor
to perform specific
processing on its media stream.
The states of a Processor
are:
Unrealized, Configuring, Configured,
Realizing, Realized, Prefetching,
Prefetched, and Started.
While it's in the Configuring
state, a Processor
gathers the source information necessary to prepare the Processor
to be programmed.
This might involve parsing an input file to access the individual
media tracks within the file, or connecting to a capturing device
to determine its capabilities. A ConfigureCompleteEvent
is posted when the Processor
reaches Configured state.
Once a Processor
is Configured, you can program
it to perform particular processing on each track or to output data in a particular
format.
Processor
When you're done programming the Processor
, you call the realize
method to complete its construction.
Once the Processor
is in the Realized state, reprogramming
the Processor
by calling the TrackControl
methods or
the setContentDescriptor
method is not guaranteed
to work. This is because reprogramming the Processor
might require reconstruction
of its internals.
It is legal to call realize
on a Processor
while it
is in the Unrealized state.
This causes the Processor
to transition from the
Unrealized state to the Realized state. As it does this, it goes through each
intermediate state: Configuring
, Configured
, and
Realizing
. However, when you directly realize a Processor
, you miss the
opportunity to program it while it's in the
Configured state--the Processor
performs whatever default processing its
implementation specifies.
Processor
Calling deallocate
changes the state of a Processor
in the same way as a Controller
except that
if deallocate
is called while the Processor
is in the Configuring or
Configured state, the
Processor
is returned to the Unrealized state.
Processor
You can control both the transcoding and multiplexing performed by a Processor
.
Data transcoding is controlled separately for each track.
The getTrackControls
method
returns a TrackControl
for each track. You use these
TrackControl
objects to specify what processing you want to perform.
The multiplexing performed by a Processor
is controlled by specifying
the format that you want it to output. This is done through
the setContentDescriptor
method.
A Processor
can be programmed while it is in the
Configured state. A NotConfiguredError
is thrown
if you attempt to program the Processor
before
is configured.
If you do not program a Processor
through the
TrackControl
methods or by calling setContentDescriptor
,
it performs whatever default processing is specified by its implementation.
Processor
The processed output data streams can be retrieved from a Processor
through its output DataSource
. The output
DataSource
provides the gateway for the output data to
be read. A DataSource
output from a Processor
can be a PushDataSource
, PushBufferDataSource
,
PullDataSource
, or PullBufferDataSource
depending
on the implementation of the Processor
.
A NotRealizedError
is thrown if
getDataOutput
is called on a Processor
that has not yet been realized.
Processor
as a Player
Processor
implementations can be used like a
Player
to render media data instead of sending it to an
output DataSource
. In this case, the TrackControl
objects
provide additional information and control over the individual
tracks to be rendered. When used as a Player
, a Processor
does not produce an output DataSource
.
To use a Processor
as a Player
, you call
setContentDescriptor(null)
.
Controller
,
Player
,
TrackControl
字段摘要 | |
---|---|
static int |
Configured
Returned by getState . |
static int |
Configuring
Returned by getState . |
从接口 javax.media.Controller 继承的字段 |
---|
LATENCY_UNKNOWN, Prefetched, Prefetching, Realized, Realizing, Started, Unrealized |
从接口 javax.media.Clock 继承的字段 |
---|
RESET |
从接口 javax.media.Duration 继承的字段 |
---|
DURATION_UNBOUNDED, DURATION_UNKNOWN |
方法摘要 | |
---|---|
void |
configure()
Prepares the Processor to be programmed. |
javax.media.protocol.ContentDescriptor |
getContentDescriptor()
Gets the output content-type currently set for this Processor . |
javax.media.protocol.DataSource |
getDataOutput()
Gets the output DataSource from the Processor . |
javax.media.protocol.ContentDescriptor[] |
getSupportedContentDescriptors()
Gets all of the content types that this Processor
can output. |
javax.media.control.TrackControl[] |
getTrackControls()
Gets a TrackControl for each track in the media stream. |
javax.media.protocol.ContentDescriptor |
setContentDescriptor(javax.media.protocol.ContentDescriptor outputContentDescriptor)
Sets the output content-type for this Processor . |
从接口 javax.media.Player 继承的方法 |
---|
addController, getControlPanelComponent, getGainControl, getVisualComponent, removeController, start |
从接口 javax.media.MediaHandler 继承的方法 |
---|
setSource |
从接口 javax.media.Controller 继承的方法 |
---|
addControllerListener, close, deallocate, getControl, getControls, getStartLatency, getState, getTargetState, prefetch, realize, removeControllerListener |
从接口 javax.media.Clock 继承的方法 |
---|
getMediaNanoseconds, getMediaTime, getRate, getStopTime, getSyncTime, getTimeBase, mapToTimeBase, setMediaTime, setRate, setStopTime, setTimeBase, stop, syncStart |
从接口 javax.media.Duration 继承的方法 |
---|
getDuration |
字段详细信息 |
---|
static final int Configuring
getState
.
static final int Configured
getState
.
方法详细信息 |
---|
void configure()
Processor
to be programmed. The Processor
gathers information about the data it is going to process.
Calling configure
puts the Processor
into the Configuring state and returns immediately.
When this process is complete and the
Processor
is in the Configured state,
the Processor
posts a ConfigureCompleteEvent
.
javax.media.control.TrackControl[] getTrackControls() throws NotConfiguredError
TrackControl
for each track in the media stream.
This method can only be called once
the Processor
has been configured.
TrackControl
objects. An empty array is returned
if there is no TrackControl
available for this
Processor
.
NotConfiguredError
- If the Processor
is in the Unrealized or
Configuring state.javax.media.protocol.ContentDescriptor[] getSupportedContentDescriptors() throws NotConfiguredError
Processor
can output. The Processor
builds the
ContentDescriptor
array according to its input
DataSource
and
the available codecs and multiplexers.
Processor
.
NotConfiguredError
- If the Processor
is in the Unrealized or
Configuring state.javax.media.protocol.ContentDescriptor setContentDescriptor(javax.media.protocol.ContentDescriptor outputContentDescriptor) throws NotConfiguredError
Processor
.
If setContentDescriptor
is not called, the output
DataSource
is set to raw output by default:
(new ContentDescriptor(ContentDescriptor.RAW))
. The source streams
from the DataSource
are the demultiplexed tracks
from the input source.
outputContentDescriptor
- The content type to be used for the Processor
output.
NotConfiguredError
- If the Processor
is in the Unrealized or
Configuring state.javax.media.protocol.ContentDescriptor getContentDescriptor() throws NotConfiguredError
Processor
.
NotConfiguredError
- If the Processor
is in the Unrealized or
Configuring state.javax.media.protocol.DataSource getDataOutput() throws NotRealizedError
DataSource
from the Processor
. The
output DataSource
is the output connection through which the processed
streams are supplied. The output DataSource
returned by the Processor
is
in the Connected state.
NotRealizedError
- If the Processor
is has not yet been
realized.
|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |