javax.media
Interface Multiplexer


public abstract interface Multiplexer
extends PlugIn

The base Multiplexer interface. A Multiplexer takes input data from different tracks, multiplexes the data into an interleaved container format, then output the interleaved data via the output DataSource. It is possible for a multiplexer to have only a single track as input. In which case it does not need to interleave the data. It might still need to format the output stream with some additional data interleaved with the input data.
A Multiplexer can be used by the Player as the master time base for synchronization, if the Multiplexer implements the Clock interface. In such case, the Multiplexer should update the media time and time base as media is being processed accordingly.

Since:
JMF 2.0

Fields inherited from class javax.media.PlugIn
BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED
 
Method Summary
 DataSource getDataOutput()
          Get the output DataSource from this multiplexer.
 Format[] getSupportedInputFormats()
          Returns the supported input formats in an array.
 ContentDescriptor[] getSupportedOutputContentDescriptors(Format[] inputs)
          Lists the possible output contentdescriptors of the processed data.
 int process(Buffer buffer, int trackID)
          Process the buffer and multiplex it with data from other tracks.
 ContentDescriptor setContentDescriptor(ContentDescriptor outputContentDescriptor)
          Set the output content-type.
 Format setInputFormat(Format format, int trackID)
          Sets the input format for the specified track number.
 int setNumTracks(int numTracks)
          Sets the number of input tracks that the multiplexer is to expect.
 
Methods inherited from interface javax.media.PlugIn
close, getName, open, reset
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Method Detail

getSupportedOutputContentDescriptors

public ContentDescriptor[] getSupportedOutputContentDescriptors(Format[] inputs)
Lists the possible output contentdescriptors of the processed data. If input is non-null, then it lists the possible output contentdescriptors given that the input data are of the formats specified by inputs. If inputs is null, then it lists all possible output content descriptors that this plug-in advertises.

getSupportedInputFormats

public Format[] getSupportedInputFormats()
Returns the supported input formats in an array. The format objects could be loosely defined, in which case setInputFormat should be called with a more specific format to make sure that the format is supported by this multiplexer.
Returns:
an array of format objects. If no formats are supported, then an array of size zero is returned.

setNumTracks

public int setNumTracks(int numTracks)
Sets the number of input tracks that the multiplexer is to expect. If the multiplexer cannot accomodate that many tracks, then it returns the maximum number of tracks that it accepts. Otherwise it returns numTracks
Parameters:
numTracks - the number of input tracks.
Returns:
the number of input tracks the multiplexer is expecting. This would be less than or equal to the number of tracks requested.

setInputFormat

public Format setInputFormat(Format format,
                             int trackID)
Sets the input format for the specified track number. If the format is accepted by the multiplexer, it returns the same format, otherwise it returns a more well defined format that it prefers. If the format is totally unacceptable, then it returns null.
Parameters:
format - the input format to expect.
trackID - the track number of this format object.
Returns:
the preferred format object which may be the same as format, a different format or null.

process

public int process(Buffer buffer,
                   int trackID)
Process the buffer and multiplex it with data from other tracks. The multiplexed output is sent to the output DataSource.
Parameters:
buffer - the input buffer
trackID - the index identifying the track where the input buffer belongs.
Returns:
BUFFER_PROCESSED_OK if the processing is successful. Other possible return codes are defined in PlugIn.
See Also:
PlugIn

getDataOutput

public DataSource getDataOutput()
Get the output DataSource from this multiplexer. The DataSource returned can be a push or pull datasource. i.e. a Push[Pull]DataSource or Push[Pull]BufferDataSource.
The datasource must be returned in the connected state.
Returns:
the output DataSource

setContentDescriptor

public ContentDescriptor setContentDescriptor(ContentDescriptor outputContentDescriptor)
Set the output content-type.
Parameters:
outputContentDescriptor - the content-type of the output.
Throws:
UnsupportedFormatException - if the outputContentDescriptor cannot be supported by the Multiplexer.
FormatChangeException - if the Multiplexer does not support format changes after it has been set.