|
|||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | ||||||||
java.lang.Objectjavax.media.Manager
public final class Manager
Manager is the access point for obtaining
system dependent resources such as Players,
DataSources, Processors, DataSinks,
the system TimeBase, the cloneable and merging utility
DataSources.
A DataSource is an object used to
deliver time-based multimedia data that is specific
to a delivery protocol.
A Player is an object used to
control and render multimedia data that
is specific to the content type of the data.
A Processor is an object similar to a Player which is
used to process data and output the processed data.
A DataSink is an object that takes a DataSource
as input and renders the output to a specified destination.
A DataSource provides
a Player, Processor or DataSink
with media data;
a Player, Processor or DataSink
must have a DataSource.
Manager provides access to a protocol and media independent
mechanism for constructing DataSources, Players,
Processors and DataSinks.
Manager will createPlayers from a
URL, a MediaLocator or a DataSource.
Creating a Player requires the following:
DataSource for the specified
protocol
Player for the content-type
specified by the DataSource
DataSource to the Player
using the setSource method.
MediaLocator defines a protocol for obtaining
content.
DataSources are identified by the protocol
that they support. Manager uses the protocol
name to find DataSource classes.
To find a DataSource using a MediaLocator,
Manager constructs a list of class names from the protocol
package-prefix list and the protocol name obtained
from the MediaLocator.
For each class name in the constructed list a new DataSource
is instantiated, the MediaLocator is attached,
and the DataSource is connected.
If no errors have occurred, the procces is considered finished and the
connected DataSource is used by
Manager in any following operations.
If there was an error then the next class name in the list
is tried.
The exact details of the search algorithm is described in
the method documentation below.
Player is a MediaHandler.
A MediaHandler is a an object that reads
data from a DataSource. There are three types
of supported MediaHandler: MediaProxy,
Player and Processor.
MediaHandlers are identified by the content type that they
support. A DataSource identifies the content type
of the data it produces with the getContentType method.
Manager uses the content type name to
find instances of MediaHandler.
To find a
If the
If the
If a valid
The detailed creation algorithm is specified in the methods below.
If the
The
The algorithm for creating a
The algorithm for creating a
This is a blocking method that creates a
This is a blocking method that creates a
This is a blocking method that creates a
The algorithm is similar to that for creating a
The algorithm is similar to that for creating a
The algorithm for creating a
This method accepts a
Returns a data source for the protocol specified by
the
The algorithm for creating a
The algorithm for creating a
The first name in the list will always be:
Each additional name looks like:
The first name in the list will always be:
Each additional name looks like:
The first name in the list will always be:
Each additional name looks like:
MediaHandler using a content type name,
Manager constructs a list of class names from
the content package-prefix list and the content type name.
For each class name in the constructed list a new MediaHandler
is instantiated, and the DataSource is attached to
the MediaHandler using MediaHandler is a Player and the
setSource was successful the process is finished
and the Player is returned.
If the setSource failed, another name in the
list is tried.
MediaHandler is a MediaProxy
then a new DataSource is obtained from the
MediaProxy, a new list is created for the
content type the DataSource supports and the
whole thing is tried again.
Player is not found then the whole
procedure is repeated with "unknown" substituted
for the content-type name. The "unknown" content type is supported
by generic Players that are capable of handling
a large variety of media types, often in a platform dependent
way.
Creating a Realized Player
Versions of createRealizedPlayer calls are provided as an
acceleration to create a Player. The returned player is in the
Realized state. In addition to NoPlayerException
and IOException, CannotRealizeException can
be thrown if the Manager cannot realize the
Player.
Creating Processors
Processors are created in the same way as Players
as outlined above. Manager also provides an additional way
to create a Processor via the createRealizedProcessor call. A
ProcessorModel is used to fully identify the
input and output requirements of a Processor. The
createRealizedProcessor call takes a
ProcessorModel as input and create a Processor
that adheres to the given
ProcessorModel. The returned Processor is
in the Realized state. The method is a blocking call.Manager fails to find a Processor
that fits the ProcessorModel, a
NoProcessorException is thrown. If there is a problem
creating and realizing a Processor, it will throw an
IOException or CannotRealizeException depending
on the circumstances.
Creating DataSinks
DataSinks are created from an input DataSource
MediaLocator. The MediaLocator identifies the
protocol and content of the DataSink to be used. The
search for the particular DataSink class to be created
is similar to the process of creating a DataSource.
The detail search and creation algorithm is described in the method
documentation below.
Player and Processor Threads
Players and Processors process media data
asynchronously from the main program flow.
This implies that a Player or Processor must
often manage one or more threads.
The threads managed by the Player or Processor
are not in the thread group of the application that calls
createPlayer or createProcessor.
System Time Base
All Players need a TimeBase. Many
use a system-wide TimeBase, often based on
a time-of-day clock.
Manager provides access to the system TimeBase
through getSystemTimeBase.
Cloning and Merging DataSources
DataSources can be cloned or merged. If a
DataSource is cloned, more than one
MediaHandler can use it as input. Merging more than one
DataSources will generate one DataSource which
contains all the SourceStreams of the constituent
DataSourcesManager provides two methods:
createCloneableDataSource and
createMergingDataSource for such purpose.
Manager Hints
Using the setHint method, the preference for how
the Manager creates the objects can be specified.
However, a particular implementation of the Manager
can choose to ignore the requested hints.
MAX_SECURITY,
CACHING,
LIGHTWEIGHT_RENDERER,
,
URL,
MediaLocator,
PackageManager,
DataSource,
URLDataSource,
MediaHandler,
Player,
Processor,
MediaProxy,
TimeBase
字段摘要
static intCACHING
Boolean hint to turn on/off the use of playback caching.
static intLIGHTWEIGHT_RENDERER
Boolean hint to turn on/off the use of light weight rendering.
static intMAX_SECURITY
Boolean hint to turn on/off maximum security.
static intPLUGIN_PLAYER
Boolean hint to request the Manager to create
Players that support
PlugIns.
static java.lang.StringUNKNOWN_CONTENT_NAME
方法摘要
static javax.media.protocol.DataSourcecreateCloneableDataSource(javax.media.protocol.DataSource source)
static DataSinkcreateDataSink(javax.media.protocol.DataSource datasource,
MediaLocator destLocator)
Create a DataSink for the specified input
Datasource and destination Medialocator.
static javax.media.protocol.DataSourcecreateDataSource(MediaLocator sourceLocator)
Create a DataSource for the specified media.
static javax.media.protocol.DataSourcecreateDataSource(java.net.URL sourceURL)
Create a DataSource for the specified media.
static javax.media.protocol.DataSourcecreateMergingDataSource(javax.media.protocol.DataSource[] sources)
Creates a merged DataSource from an array of sources.
static PlayercreatePlayer(javax.media.protocol.DataSource source)
Create a Player for the DataSource.
static PlayercreatePlayer(MediaLocator sourceLocator)
Create a Player for the specified media.
static PlayercreatePlayer(java.net.URL sourceURL)
Create a Player for the specified media.
static ProcessorcreateProcessor(javax.media.protocol.DataSource source)
Create a Processor for the DataSource.
static ProcessorcreateProcessor(MediaLocator sourceLocator)
Create a Processor for the specified media.
static ProcessorcreateProcessor(java.net.URL sourceURL)
Create a Processor for the specified media.
static PlayercreateRealizedPlayer(javax.media.protocol.DataSource source)
Create a Realized Player for the specified source.
static PlayercreateRealizedPlayer(MediaLocator ml)
Create a Realized Player for the specified media.
static PlayercreateRealizedPlayer(java.net.URL sourceURL)
Create a Realized Player for the specified media.
static ProcessorcreateRealizedProcessor(ProcessorModel model)
Create a Realized Processor for the specified
ProcessorModel.
static java.lang.StringgetCacheDirectory()
Retrieve the directory that's used for playback caching.
static java.util.VectorgetDataSourceList(java.lang.String protocolName)
Build a list of DataSource class names from the
protocol prefix-list and a protocol name.
static java.util.VectorgetHandlerClassList(java.lang.String contentName)
Build a list of Player Handler classes from the
content-prefix-list and a content name.
static java.lang.ObjectgetHint(int hint)
Retrieve the value of a hint set.
static java.util.VectorgetProcessorClassList(java.lang.String contentName)
Build a list of Processor Handler classes from the
content-prefix-list and a content name.
static TimeBasegetSystemTimeBase()
Get the time-base object for the system.
static java.lang.StringgetVersion()
Returns the version string for this revision of JMF.
static voidsetHint(int hint,
java.lang.Object value)
Specify a hint for the Manager to use.
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
字段详细信息
MAX_SECURITY
public static final int MAX_SECURITY
CACHING
public static final int CACHING
LIGHTWEIGHT_RENDERER
public static final int LIGHTWEIGHT_RENDERER
Manager will try to create
Players that use renderers which can interoperate with
light weight GUI components.
PLUGIN_PLAYER
public static final int PLUGIN_PLAYER
Manager to create
Players that support
PlugIns. Such Players use
PlugIns to demultiplex, decode, render or multiplex
the data. It will also support TrackControls for
application level programming.
UNKNOWN_CONTENT_NAME
public static final java.lang.String UNKNOWN_CONTENT_NAME
方法详细信息
getVersion
public static java.lang.String getVersion()
createPlayer
public static Player createPlayer(java.net.URL sourceURL)
throws java.io.IOException,
NoPlayerException
Player for the specified media.
This creates a MediaLocator from the URL and then
calls createPlayer.
sourceURL - The URL that describes the media data.
Player.
NoPlayerException - Thrown if no Player
can be found.
java.io.IOException - Thrown if there was a problem connecting
with the source.
createPlayer
public static Player createPlayer(MediaLocator sourceLocator)
throws java.io.IOException,
NoPlayerException
Player for the specified media.
Player from
a MediaLocator is:
MediaLocator.
DataSource classes that
support the protocol, using the protocol package-prefix-list.
DataSource,
connect method to connect the source.
getContentType)
from the source.
MediaHandler classes that support the
media-content-type-name, using the content package-prefix-list.
MediaHandler class in the list:
MediaHandler.
MediaHandler by calling
MediaHandler.setSource.
MediaHandler; otherwise try the next
MediaHandler is a Player,
return the new Player.
MediaHandler is a MediaProxy,
obtain a new DataSource from the MediaProxy,
obtain the list of MediaHandlers that support the new
DataSource, and continue searching the new list.
MediaHandler is found for this source,
try the next source in the list.
Player is found after trying all of the sources,
reuse the source list.
This time, for each source class in the list:
connect method to connect to the source.
MediaHandler classes that support the
"unknown" content-type-name.
MediaHandler class in the list,
search for a Player as in the previous search.
Player is found after trying all of the sources,
a NoPlayerException is thrown.
sourceLocator - A MediaLocator that describes
the media content.
Player for the media described by the source.
NoPlayerException - Thrown if no Player can
be found.
java.io.IOException - Thrown if there was a problem connecting
with the source.
createPlayer
public static Player createPlayer(javax.media.protocol.DataSource source)
throws java.io.IOException,
NoPlayerException
Player for the DataSource.
Player from
a DataSource is:
getContentType.
Player classes that support the media content-type name.
Player class in the list:
Player.
Player by calling
setSource on the Player.
Player;
otherwise,
try the next Player in the list.
Player is found for this source:
Player classes that support the
"unknown" content-type-name.
Player class in the list:
Player.
Player by
calling setSource
on the Player.
Player;
otherwise, try the next Player in the list.
Player can be created,
a NoPlayerException is thrown.
DataSource - The DataSource that describes
the media content.
Player.
NoPlayerException - Thrown if a Player can't
be created.
java.io.IOException - Thrown if there was a problem connecting
with the source.
createRealizedPlayer
public static Player createRealizedPlayer(java.net.URL sourceURL)
throws java.io.IOException,
NoPlayerException,
CannotRealizeException
Player for the specified media.
Player, calls
realize on it and returns only after the Player has
been Realized. Realizing a Player could be a time consuming
operation and one should use caution when using this method as it
could block the thread for several seconds.
ml - The MediaLocator that describes the source of
the media.
Player that is in the Realized
state.
NoPlayerException - Thrown if a Player can't
be created.
java.io.IOException - Thrown if there was a problem connecting
with the source.
CannotRealizeException - Thrown if there was a problem
realizing the Player.
createRealizedPlayer
public static Player createRealizedPlayer(MediaLocator ml)
throws java.io.IOException,
NoPlayerException,
CannotRealizeException
Player for the specified media.
Player, calls
realize on it and returns only after the Player has
been Realized. Realizing a Player could be a time consuming
operation and one should use caution when using this method as it
could block the thread for several seconds.
ml - The MediaLocator that describes the source of
the media.
Player that is in the Realized
state.
NoPlayerException - Thrown if a Player can't
be created.
java.io.IOException - Thrown if there was a problem connecting
with the source.
CannotRealizeException - Thrown if there was a problem
realizing the Player.
createRealizedPlayer
public static Player createRealizedPlayer(javax.media.protocol.DataSource source)
throws java.io.IOException,
NoPlayerException,
CannotRealizeException
Player for the specified source.
Player, calls
realize on it and returns only after the Player has
been Realized. Realizing a Player could be a time consuming
operation and one should use caution when using this method as it
could block the thread for several seconds.
source - The DataSource that describes the media
content.
Player that is in the Realized
state.
NoPlayerException - Thrown if a Player can't
be created.
java.io.IOException - Thrown if there was a problem connecting
with the source.
CannotRealizeException - Thrown if there was a problem
realizing the Player.
createProcessor
public static Processor createProcessor(java.net.URL sourceURL)
throws java.io.IOException,
NoProcessorException
Processor for the specified media.
Player
from a URL
sourceURL - A URL that describes
the media content.
Processor for the media described by the source.
NoProcessorException - Thrown if no Processor can
be found.
java.io.IOException - Thrown if there was a problem connecting
with the source.
createProcessor
public static Processor createProcessor(MediaLocator sourceLocator)
throws java.io.IOException,
NoProcessorException
Processor for the specified media.
Player
from a MediaLocator
sourceLocator - A MediaLocator that describes
the media content.
Processor for the media described by the source.
NoProcessorException - Thrown if no Processor can
be found.
java.io.IOException - Thrown if there was a problem connecting
with the source.
createProcessor
public static Processor createProcessor(javax.media.protocol.DataSource source)
throws java.io.IOException,
NoProcessorException
Processor for the DataSource.
Processor is similar
to creating a Player from a DataSource.
DataSource - The DataSource that describes
the media content.
Processor.
NoProcessorException - Thrown if a Processor can't
be created.
java.io.IOException - Thrown if there was a problem connecting
with the source.
createRealizedProcessor
public static Processor createRealizedProcessor(ProcessorModel model)
throws java.io.IOException,
NoProcessorException,
CannotRealizeException
Processor for the specified
ProcessorModel.
ProcessorModel that describes
the required input and/or output format of the media data. It is a
blocking method and returns only after the Processor
reaches the Realized state.
model - The ProcessorModel that describes the input and
output media
Processor that is in the Realized
state.
NoProcessorException - Thrown if a Processor can't
be created.
java.io.IOException - Thrown if there was a problem connecting
with the source.
CannotRealizeException - Thrown if there was a problem
realizing the Player.ProcessorModel
createDataSource
public static javax.media.protocol.DataSource createDataSource(java.net.URL sourceURL)
throws java.io.IOException,
NoDataSourceException
DataSource for the specified media.
sourceURL - The URL that describes the media data.
DataSource for the media.
NoDataSourceException - Thrown if no DataSource
can be found.
java.io.IOException - Thrown if there was a problem connecting
with the source.
createDataSource
public static javax.media.protocol.DataSource createDataSource(MediaLocator sourceLocator)
throws java.io.IOException,
NoDataSourceException
DataSource for the specified media.
MediaLocator. The returned data source
is connected; DataSource.connect has been
invoked.
DataSource from
a MediaLocator is:
MediaLocator.
DataSource classes that
support the protocol.
DataSource.
connect to connect the source.
URL from the
MediaLocator and use it to create
a URLDataSource
NoDataSourceException
is thrown.
sourceLocator - The source protocol for the media data.
DataSource.
NoDataSourceException - Thrown if no DataSource
can be found.
java.io.IOException - Thrown if there was a problem connecting
with the source.
createMergingDataSource
public static javax.media.protocol.DataSource createMergingDataSource(javax.media.protocol.DataSource[] sources)
throws IncompatibleSourceException
DataSource from an array of sources.
All sources must be of the same type (i.e PullDataSource,
PushDataSource, etc.) otherwise an
IncompatibleSourceException is thrown.
The returned DataSource is of the same type of
the given sources. Its content-type is RAW if all sources are of
type RAW. Otherwise, its content-type is MIXED.
sources - the DataSources to be merged
DataSource which contains all the streams
of the original sources
IncompatibleSourceException - if the sources are not
of the same type
createCloneableDataSource
public static javax.media.protocol.DataSource createCloneableDataSource(javax.media.protocol.DataSource source)
getSystemTimeBase
public static TimeBase getSystemTimeBase()
createDataSink
public static DataSink createDataSink(javax.media.protocol.DataSource datasource,
MediaLocator destLocator)
throws NoDataSinkException
DataSink for the specified input
Datasource and destination Medialocator.
DataSink from
a MediaLocator and datasource is:
MediaLocator.
MediaHandler classes within the
datasink package that support the
protocol, using the content package-prefix-list.
i.e. search for content-prefix.media.datasink.protocol.Handler
MediaHandler class in the list:
MediaHandler.
MediaHandler is a
DataSink,
Attach the source to the MediaHandler by calling
MediaHandler.setSource
DataSink;otherwise try the next
MediaHandler in the list.
MediaHandler is a DataSinkProxy,
obtain the content type of the proxy using the getContentType() method.
Now obtain a list of MediaHandlers that support
the protocol of the Medialocator and the content type returned by
the proxy
i.e. look for content-prefix.media.datasink.protocol.content-type.Handler
MediaHandler is found and it is a
DataSink, attach the datasource
to it by calling MediaHandler.setSource.
DataSink if there are no errors.
MediaHandler is found, or if there are
any errors,try the next MediaHandler
DataSink is found after trying all of the handlers,
a NoDataSinkException is thrown.
datasource - The input DataSource to the DataSinkdestLocator - A MediaLocator that describes
the destination of the media to be handled by the datasink
DataSink for the media described by the
destLocator and that supports the datasource .
NoDataSinkException - Thrown if no DataSink can
be found.NoDataSinkException
getCacheDirectory
public static java.lang.String getCacheDirectory()
setHint
public static void setHint(int hint,
java.lang.Object value)
Manager to use.
hint - The name of the hint to be set.value - The value the hint is to be set.MAX_SECURITY,
CACHING,
LIGHTWEIGHT_RENDERER,
PLUGIN_PLAYER
getHint
public static java.lang.Object getHint(int hint)
hint - The name of the hint.
MAX_SECURITY,
CACHING,
LIGHTWEIGHT_RENDERER,
PLUGIN_PLAYER
getDataSourceList
public static java.util.Vector getDataSourceList(java.lang.String protocolName)
DataSource class names from the
protocol prefix-list and a protocol name.
media.protocol.<protocol>.DataSource
for every
<protocol-prefix>.media.protocol.<protocol>.DataSource
<protocol-prefix> in the
protocol-prefix-list.
protocol - The name of the protocol the source must
support.
Player class-name.
getHandlerClassList
public static java.util.Vector getHandlerClassList(java.lang.String contentName)
Handler classes from the
content-prefix-list and a content name.
media.content.<contentType>.Handler
for every
<content-prefix>.media.content.<contentName>.Player
<content-prefix> in the
content-prefix-list.
contentName - The content type to use in the class name.
Player
class-name.
getProcessorClassList
public static java.util.Vector getProcessorClassList(java.lang.String contentName)
Handler classes from the
content-prefix-list and a content name.
media.processor.<contentType>.Handler
for every
<content-prefix>.media.processor.<contentName>.Processor
<content-prefix> in the
content-prefix-list.
contentName - The content type to use in the class name.
Processor
class-name.
概述
软件包
类
树
已过时
索引
帮助
上一个类
下一个类
框架
无框架
摘要: 嵌套 | 字段 | 构造方法 | 方法
详细信息: 字段 | 构造方法 | 方法