javax.media
Interface Codec

All Known Subinterfaces:
Effect

public interface Codec
extends PlugIn

A Codec is a media processing unit that accepts a Buffer object as its input, performs some processing on the input data, and then puts the result in an output Buffer object. It has one input and one output. Typical examples of codecs include audio decoders, video encoders, and effects.

A codec usually works in one of the following modes:

Some restrictions apply to the processing a Codec can perform on its input and output Buffer objects:

Since:
JMF 2.0

Fields inherited from interface javax.media.PlugIn
BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED, PLUGIN_TERMINATED
 
Method Summary
 Format[] getSupportedInputFormats()
          Lists all of the input formats that this codec accepts.
 Format[] getSupportedOutputFormats(Format input)
          Lists the output formats that this codec can generate.
 int process(Buffer input, Buffer output)
          Performs the media processing defined by this codec.
 Format setInputFormat(Format format)
          Sets the format of the data to be input to this codec.
 Format setOutputFormat(Format format)
          Sets the format for the data this codec outputs.
 
Methods inherited from interface javax.media.PlugIn
close, getName, open, reset
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Method Detail

getSupportedInputFormats

public Format[] getSupportedInputFormats()
Lists all of the input formats that this codec accepts.
Returns:
An array that contains the supported input Formats.

getSupportedOutputFormats

public Format[] getSupportedOutputFormats(Format input)
Lists the output formats that this codec can generate. If input is non-null, this method lists the possible output formats that can be generated from input data of the specified Format. If input is null, this method lists all of the output formats supported by this plug-in.
Parameters:
input - The Format of the data to be used as input to the plug-in.
Returns:
An array that contains the supported output Formats.

setInputFormat

public Format setInputFormat(Format format)
Sets the format of the data to be input to this codec.
Parameters:
format - The Format to be set.
Returns:
The Format that was set, which might be the supported Format that most closely matches the one specified. Returns null if the specified Format is not supported and no reasonable match could be found.

setOutputFormat

public Format setOutputFormat(Format format)
Sets the format for the data this codec outputs.
Parameters:
format - The Format to be set.
Returns:
The Format that was set, which might be the Format that most closely matched the one specified. Returns null if the specified Format is not supported and no reasonable match could be found.

process

public int process(Buffer input,
                   Buffer output)
Performs the media processing defined by this codec.
Parameters:
input - The Buffer that contains the media data to be processed.
output - The Buffer in which to store the processed media data.
Returns:
BUFFER_PROCESSED_OK if the processing is successful. Other possible return codes are defined in PlugIn.
See Also:
PlugIn


Submit a bug or feature
Copyright 1999-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved. See the Specification License for more details.
Sun, Sun Microsystems, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.