javax.media
Interface Demultiplexer


public abstract interface Demultiplexer
extends PlugIn, MediaHandler, Duration

A Demultiplexer is a MediaHandler and so it should implement the setSource method. setSource should throw an IncompatibleSourceException if the Demultiplexer cannot make use of the DataSource. This typically happens if the Demultiplexer doesn't support push or pull DataSources, or if it requires a Positionable DataSource or if it requires a Seekable and random-accessible stream (for e.g QuickTime Demultiplexer). setSource should throw an IOException if the DataSource contains a null stream array. Note: No data is read in the setSource method. When trying to select a Demultiplexer for a content-type from a list of Demultiplexers obtained through the PlugInManager, the Processor will call setSource and pick the first Demultiplexer for which this method doesn't throw IncompatibleSourceException or IOException. If a Demultiplexer reads some data and returns IncompatibleSourceException, then the next Demultiplexer on the list gets a stream in a different state.

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
 
Fields inherited from class javax.media.Duration
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
Method Summary
 Time getDuration()
          Get the duration of this media when played at the default rate.
 Time getMediaTime()
          Returns the media time that the next readFrame call represents
 ContentDescriptor[] getSupportedInputContentDescriptors()
          Lists the possible input content descriptors supported by this plug-in.
 Track[] getTracks()
          A stream may contain multiple media tracks, for example audio, video, midi.
 boolean isPositionable()
          Return true if the streams can be repositioned to the beginning.
 boolean isRandomAccess()
          Return true if the streams can be positioned at any Time t.
 Time setPosition(Time where, int rounding)
          Set the position to the specified time.
 void start()
          Signals the beginning when data is read from the demultiplexer.
 void stop()
          Signals when data reading from the demultiplexer to be paused.
 
Methods inherited from interface javax.media.PlugIn
close, getName, open, reset
 
Methods inherited from interface javax.media.MediaHandler
setSource
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Method Detail

getSupportedInputContentDescriptors

public ContentDescriptor[] getSupportedInputContentDescriptors()
Lists the possible input content descriptors supported by this plug-in.

start

public void start()
           throws java.io.IOException
Signals the beginning when data is read from the demultiplexer. i.e., this is called before readFrame is called.

stop

public void stop()
Signals when data reading from the demultiplexer to be paused. i.e., readFrame will not be called after stop is called and before start is called again.

getTracks

public Track[] getTracks()
                  throws java.io.IOException,
                         BadHeaderException
A stream may contain multiple media tracks, for example audio, video, midi. The information specific to a track can be abstracted into a Track interface. The Track interface also allows one to enable or disable a track. In this method, the header, if any, is read and parsed, the track information is retrieved and if applicable the playlist is built. For each track, the maximum frame size is computed. An array of Track objects is returned with the array length equal to the number of tracks.
Throws:
BadHeaderException - Thrown if the header information is incomplete or inconsistent.
java.io.IOException - Thrown if there is an error when reading from the DataSource

isPositionable

public boolean isPositionable()
Return true if the streams can be repositioned to the beginning.

isRandomAccess

public boolean isRandomAccess()
Return true if the streams can be positioned at any Time t. If isRandomAccess() is true then isPositionable() is also true. If isRandomAccess() is false, it doesn't imply that isPositionable() is false.

setPosition

public Time setPosition(Time where,
                        int rounding)
Set the position to the specified time. Returns the rounded position that was actually set. Implementations should set the position to a keyframe, if possible.
Parameters:
time - The new position in the stream.
round - The rounding technique to be used: RoundUp, RoundDown, RoundNearest.
Returns:
The actual position set.

getMediaTime

public Time getMediaTime()
Returns the media time that the next readFrame call represents

getDuration

public Time getDuration()
Get the duration of this media when played at the default rate. If the duration can't be determined getDuration returns DURATION_UNKNOWN. Note that each track can have a different duration and a different start time and therefore this method returns the total duration.
Specified by:
getDuration in interface Duration
Returns:
A Time object representing the duration or DURATION_UNKNOWN.