|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Track
abstracts the information specific to an individual
track in a media stream.
A media stream might contain multiple media tracks, such as separate tracks for
audio, video, and midi data. A Track
is the output of a Demultiplexer
.
Demultiplexer
Field Summary | |
static int |
FRAME_UNKNOWN
The mapTimeToFrame method returns this value if the time mapping
cannot be established or the Track contains an audio stream. |
static Time |
TIME_UNKNOWN
The mapFrameToTime method returns this value if the time mapping
cannot be established or the Track contains an audio stream. |
Fields inherited from interface javax.media.Duration |
DURATION_UNBOUNDED,
DURATION_UNKNOWN |
Method Summary | |
Format |
getFormat()
Gets the Format of the data in this
Track . |
Time |
getStartTime()
Retrieves the start time of this Track . |
boolean |
isEnabled()
Checks whether or not this Track is enabled. |
Time |
mapFrameToTime(int frameNumber)
Gets the Time that corresponds to the specified frame number. |
int |
mapTimeToFrame(Time t)
Converts the given media time to the corresponding frame number. |
void |
readFrame(Buffer buffer)
Reads the next frame for this Track . |
void |
setEnabled(boolean t)
Enables or disables this Track . |
void |
setTrackListener(TrackListener listener)
Adds an event listener for this Track . |
Methods inherited from interface javax.media.Duration |
getDuration |
Field Detail |
public static final Time TIME_UNKNOWN
mapFrameToTime
method returns this value if the time mapping
cannot be established or the Track
contains an audio stream.public static final int FRAME_UNKNOWN
mapTimeToFrame
method returns this value if the time mapping
cannot be established or the Track
contains an audio stream.Method Detail |
public Format getFormat()
Format
of the data in this
Track
.Format
associated with this
Track
.public void setEnabled(boolean t)
Track
.
A Demultiplexer
discards the data from
disabled tracks.t
- A boolean value indicating whether or not to enable this Track
. Set to
true
to enable this Track
, false
to disable this Track
.public boolean isEnabled()
Track
is enabled.
A Demultiplexer
discards the data from
disabled tracks.true
if the Track
is enabled, false
if it is not.public Time getStartTime()
Track
.Time
object that specifies the start time for this Track
.public void readFrame(Buffer buffer)
Track
.
This method might block if the
data for a complete frame is not available. It might also block if the stream contains
intervening data for a different interleaved Track
.
Once the other Track
is read by a readFrame
call from a
different thread, this method can read the frame. If the intervening
Track
has been disabled, data for that Track
is read and discarded.
Note: This scenario is necessary only if a PullDataSource
Demultiplexer
implementation wants to avoid buffering data locally and
copying the data to the Buffer
passed in as a parameter.
Implementations might decide to buffer data and not
block (if possible) and incur data copy overhead.
If this method is called on a Track
that has been disabled,
it returns immediately with the DISCARD
flag set on.
Each track has a sequence number that is updated by the Demultiplexer
for each frame.
If downstream nodes receive non-contiguous sequence numbers
for a particular Track
, they know that a data overflow has
occurred for that Track
.
buffer
- The Buffer
into which the data is to be read. If
readFrame
is successful, buffer.getLength
returns the length of the
data that was read.public int mapTimeToFrame(Time t)
The frame returned is the nearest frame that has a media time less than or equal to the given media time.
mediaTime
- the input media time for the conversion.public Time mapFrameToTime(int frameNumber)
Time
that corresponds to the specified frame number.Time
object that corresponds to the specified frame.
If the mapping cannot be established or the Track
is an audio track,
TIME_UNKNOWN
is returned.public void setTrackListener(TrackListener listener)
Track
. If the readFrame
call in
progress will block, the listener is notified. This enables the listener to
stop the clock and post a RestartingEvent
.listener
- The TrackListener
to add.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |