javax.media
接口 Demultiplexer

所有超级接口:
Controls, Duration, MediaHandler, PlugIn

public interface Demultiplexer
extends PlugIn, MediaHandler, Duration

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 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.

从以下版本开始:
JMF 2.0

字段摘要
 
从接口 javax.media.PlugIn 继承的字段
BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED, PLUGIN_TERMINATED
 
从接口 javax.media.Duration 继承的字段
DURATION_UNBOUNDED, DURATION_UNKNOWN
 
方法摘要
 Time getDuration()
          Gets the duration of this media stream when played at the default rate.
 Time getMediaTime()
          Gets the current media time.
 javax.media.protocol.ContentDescriptor[] getSupportedInputContentDescriptors()
          Lists the all of the input content descriptors that this Demultiplexer supports.
 Track[] getTracks()
           Retrieves the individual tracks that the media stream contains.
 boolean isPositionable()
          Checks whether or not the stream can be repositioned to the beginning.
 boolean isRandomAccess()
          Checks whether or not the stream can be positioned at any Time.
 Time setPosition(Time where, int rounding)
          Sets the stream position (media time) to the specified Time.
 void start()
          Signals that data is going to start being read from the Demultiplexer.
 void stop()
          Signals that data is going to stop being read from the Demultiplexer.
 
从接口 javax.media.PlugIn 继承的方法
close, getName, open, reset
 
从接口 javax.media.Controls 继承的方法
getControl, getControls
 
从接口 javax.media.MediaHandler 继承的方法
setSource
 

方法详细信息

getSupportedInputContentDescriptors

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


start

void start()
           throws java.io.IOException
Signals that data is going to start being read from the Demultiplexer. The start method is called before any calls are made to readFrame.

抛出:
java.io.IOException - If there is an error when trying to read from the DataSource.

stop

void stop()
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.


getTracks

Track[] getTracks()
                  throws java.io.IOException,
                         BadHeaderException

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).

返回:
An array of Track objects. The length of the array is equal to the number of tracks in the stream.
抛出:
BadHeaderException - If the header information is incomplete or inconsistent.
java.io.IOException - If there is an error when trying to read from the DataSource.

isPositionable

boolean isPositionable()
Checks whether or not the stream can be repositioned to the beginning.

返回:
true if the stream can be repositioned, false if it cannot.

isRandomAccess

boolean isRandomAccess()
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.

返回:
true if the stream is a random access stream, false if it is not.

setPosition

Time setPosition(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.

参数:
time - The new stream position, specified as a Time.
round - The rounding technique to be used: RoundUp, RoundDown, or RoundNearest.
返回:
The actual stream position that was set as a Time object.

getMediaTime

Time getMediaTime()
Gets the current media time. This is the stream position that the next readFrame will read.

返回:
The current position in the media stream as a Time object.

getDuration

Time getDuration()
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.

指定者:
接口 Duration 中的 getDuration
返回:
A Time object that represents the duration or DURATION_UNKNOWN if the duration cannot be determined.