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.

JMF 2.0

Fields inherited from class
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
close, getName, open, reset
Methods inherited from interface
getControl, getControls

Method Detail


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.


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.
an array of format objects. If no formats are supported, then an array of size zero is returned.


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
numTracks - the number of input tracks.
the number of input tracks the multiplexer is expecting. This would be less than or equal to the number of tracks requested.


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.
format - the input format to expect.
trackID - the track number of this format object.
the preferred format object which may be the same as format, a different format or null.


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.
buffer - the input buffer
trackID - the index identifying the track where the input buffer belongs.
BUFFER_PROCESSED_OK if the processing is successful. Other possible return codes are defined in PlugIn.
See Also:


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.
the output DataSource


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