FileDocCategorySizeDatePackage
Demultiplexer.javaAPI DocJMF 2.1.1e6350Mon May 12 12:20:38 BST 2003javax.media

Demultiplexer

public interface Demultiplexer implements MediaHandler, Duration, PlugIn
A Demultiplexer is a media processing unit that takes an interleaved media stream as input, extracts the individual tracks from the stream, and outputs the resulting tracks. It has one input and multiple outputs.

A Demultiplexer is a MediaHandler and needs to implement the setSource method. This method should throw an IncompatibleSourceException if the Demultiplexer cannot use the specified DataSource. This typically happens if:

  • The Demultiplexer doesn't support the type of DataSource specified (push or pull).
     
  • The Demultiplexer requires a positionable DataSource.
     
  • The Demultiplexer requires a seekable, random-access stream. (For example, the QuickTime Demultiplexer has this requirement.)
The setSource method should throw an IOException if the specified DataSource contains a null stream array.

Note: No data is read by the setSource method. When trying to select a Demultiplexer for a particular content-type from a list of Demultiplexer implementations obtained through the PlugInManager, the Processor picks the first Demultiplexer that doesn't for throw an IncompatibleSourceException or an IOException when setSource is called. If a particular Demultiplexer reads some data from the stream and then throws an IncompatibleSourceException, the next Demultiplexer in the list gets the stream in a different state.

since
JMF 2.0

Fields Summary
Constructors Summary
Methods Summary
public javax.media.TimegetDuration()
Gets the duration of this media stream when played at the default rate.

Note that each track can have a different duration and a different start time. This method returns the total duration from when the first track starts and the last track ends.

return
A Time object that represents the duration or DURATION_UNKNOWN if the duration cannot be determined.

public javax.media.TimegetMediaTime()
Gets the current media time. This is the stream position that the next readFrame will read.

return
The current position in the media stream as a Time object.

public javax.media.protocol.ContentDescriptor[]getSupportedInputContentDescriptors()
Lists the all of the input content descriptors that this Demultiplexer supports.

public javax.media.Track[]getTracks()

Retrieves the individual tracks that the media stream contains. A stream can contain multiple media tracks, such as separate tracks for audio, video, and midi data. The information specific to a track is abstracted by an instance of a class that implements the Track interface. The Track interface also provides methods for enabling or disabling a track.

When getTracks is called, the stream header is read and parsed (if there is one), the track information is retrieved, the maximum frame size for each track is computed, and the play list is built (if applicable).

return
An array of Track objects. The length of the array is equal to the number of tracks in the stream.
exception
BadHeaderException If the header information is incomplete or inconsistent.
exception
IOException If there is an error when trying to read from the DataSource.

public booleanisPositionable()
Checks whether or not the stream can be repositioned to the beginning.

return
true if the stream can be repositioned, false if it cannot.

public booleanisRandomAccess()
Checks whether or not the stream can be positioned at any Time. If isRandomAccess returns true, then the stream is also positionable (isPositionable returns true). However, a stream can be positionable but not random access--the isPositionable method might return true even if isRandomAccess returns false.

return
true if the stream is a random access stream, false if it is not.

public javax.media.TimesetPosition(javax.media.Time where, int rounding)
Sets the stream position (media time) to the specified Time. Returns the rounded position that was actually set. Implementations should set the position to a key frame, if possible.

param
time The new stream position, specified as a Time.
param
round The rounding technique to be used: RoundUp, RoundDown, or RoundNearest.
return
The actual stream position that was set as a Time object.

public voidstart()
Signals that data is going to start being read from the Demultiplexer. The start method is called before any calls are made to readFrame.

exception
IOException If there is an error when trying to read from the DataSource.

public voidstop()
Signals that data is going to stop being read from the Demultiplexer. After the stop method is called, readFrame will not be called again unless start is called first.