javax.media
类 PlugInManager

java.lang.Object
  继承者 javax.media.PlugInManager

public class PlugInManager
extends java.lang.Object

The PlugInManager is used to search for installed plug-ins and register new plug-ins.

Plug-in Types

JMF defines several types of plug-ins, such as codecs, demultiplexers, and renderers. Custom plug-in types can also be registered. The predefined plug-in types are:

This PlugInManager is a wrapper for the actual implementation, which it expects to find in javax.media.pim.PlugInManager. If this implementation exists and is an instance of javax.media.PlugInManager, all calls to javax.media.PlugInManager are redirected to javax.media.pim.PlugInManager. If the implementation is not found, all calls to javax.media.PlugInManager methods will fail and return null or invalid data.

从以下版本开始:
JMF 2.0

字段摘要
static int CODEC
          Codec plug-in type.
static int DEMULTIPLEXER
          Demultiplexer plug-in type.
static int EFFECT
          Effect plug-in type.
static int MULTIPLEXER
          Multiplexer plug-in type.
static int RENDERER
          Renderer plug-in type.
 
构造方法摘要
PlugInManager()
           
 
方法摘要
static boolean addPlugIn(java.lang.String classname, Format[] in, Format[] out, int type)
          Registers a new plug-in.
static void commit()
          Commits any changes made to the plug-in list.
static java.util.Vector getPlugInList(Format input, Format output, int type)
          Builds a list of plug-ins that satisfy the specified plug-in type and input and output formats.
static Format[] getSupportedInputFormats(java.lang.String className, int type)
          Gets a list of the input formats that the specified plug-in supports.
static Format[] getSupportedOutputFormats(java.lang.String className, int type)
          Gets a list of the output formats that the specified plug-in supports.
static boolean removePlugIn(java.lang.String classname, int type)
          Removes an existing plug-in from the registry.
static void setPlugInList(java.util.Vector plugins, int type)
          Sets the search order for the plug-ins of the specified type.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

DEMULTIPLEXER

public static final int DEMULTIPLEXER
Demultiplexer plug-in type.

另请参见:
常量字段值

CODEC

public static final int CODEC
Codec plug-in type.

另请参见:
常量字段值

EFFECT

public static final int EFFECT
Effect plug-in type.

另请参见:
常量字段值

RENDERER

public static final int RENDERER
Renderer plug-in type.

另请参见:
常量字段值

MULTIPLEXER

public static final int MULTIPLEXER
Multiplexer plug-in type.

另请参见:
常量字段值
构造方法详细信息

PlugInManager

public PlugInManager()
方法详细信息

getPlugInList

public static java.util.Vector getPlugInList(Format input,
                                             Format output,
                                             int type)
Builds a list of plug-ins that satisfy the specified plug-in type and input and output formats. Either or both of the formats can be null. If input is null, getPlugInList returns a list of plug-ins of the specified type that match the output format. If output is null, getPlugInList returns a list of plug-ins of the specified type that match the input format. If both parameters are null, getPlugInList returns a list of all of the plug-ins of the specified type.

参数:
input - The input Format to be supported by the plug-in.
output - The output Format to be generated by the plug-in.
type - The type of plug-in to search for, for example: DEMULTIPLEXER, CODEC, EFFECT, MULTIPLEXER, or RENDERER.
返回:
A Vector that contains the plug-in list.

setPlugInList

public static void setPlugInList(java.util.Vector plugins,
                                 int type)
Sets the search order for the plug-ins of the specified type. This enables you to control what plug-in is selected when multiple plug-ins of a particular type support the same input and output formats. (The first match is selected by the Processor.) This list is valid for the duration of the session only, unless commit is called.

参数:
plugins - A Vector that lists the plug-ins in the order that they should be searched.
type - The type of plug-in contained in the search list, for example: DEMULTIPLEXER, CODEC, EFFECT, MULTIPLEXER, or RENDERER.
另请参见:
commit()

commit

public static void commit()
                   throws java.io.IOException
Commits any changes made to the plug-in list. The commit method must be called when a plug-in is added or removed to make the change permanent. Changes to the search order can also be made permanent by calling commit.

抛出:
java.io.IOException

addPlugIn

public static boolean addPlugIn(java.lang.String classname,
                                Format[] in,
                                Format[] out,
                                int type)
Registers a new plug-in. This plug-in is automatically appended to the list of plug-ins searched when a Processor is created. Registration will fail if a plug-in of the same name already exists. The commit method has to be called to make the addition permanent.

参数:
classname - A String that contains the class name of the new plug-in.
in - A Format array that contains the input formats that the plug-in supports.
out - A Format array that contains the output formats that the plug-in supports.
type - The type of the new plug-in, for example: DEMULTIPLEXER, CODEC, EFFECT, MULTIPLEXER, or RENDERER.
返回:
true if the plug-in is registered successfully, false if it could not be registered.

removePlugIn

public static boolean removePlugIn(java.lang.String classname,
                                   int type)
Removes an existing plug-in from the registry. The commit method has to be called to make this change permanent.

参数:
classname - A String that contains the class name of the plug-in to be removed.
type - The type of the new plug-in, for example: DEMULTIPLEXER, CODEC, EFFECT, MULTIPLEXER, or RENDERER.
返回:
true if the plug-in is succesfully removed, false if no plug-in with the specified name could be found.

getSupportedInputFormats

public static Format[] getSupportedInputFormats(java.lang.String className,
                                                int type)
Gets a list of the input formats that the specified plug-in supports.

参数:
className - The plug-in class name. For example: com.sun.media.codec.MPEG
type - The type of the specified plug-in, for example: DEMULTIPLEXER, CODEC, EFFECT, MULTIPLEXER, or RENDERER.
返回:
An array of Format objects that the specified plug-in can accept as input. Returns an array of zero elements if specified plug-in is not registered or has no inputs.

getSupportedOutputFormats

public static Format[] getSupportedOutputFormats(java.lang.String className,
                                                 int type)
Gets a list of the output formats that the specified plug-in supports.

参数:
className - The plug-in class name. For example: com.sun.media.codec.MPEG
type - The type of the specified plug-in, for example: DEMULTIPLEXER, CODEC, EFFECT, MULTIPLEXER, or RENDERER.
返回:
An array of Format objects that the specified plug-in can generate as output. Returns an array of zero elements if specified plug-in is not registered or has no outputs.