|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.Buffer
A Buffer
is a media-data container that carries media data from one
processing stage to the next inside of a Player
or Processor
.
Buffer
objects are also used to carry data between a buffer stream
and its handler.
A Buffer
object maintains information such as the time stamp,
length, and Format
of the data it carries, as well as any
header information that might be required to process the media data.
PlugIn
,
PushBufferStream
,
PullBufferStream
Field Summary | |
protected java.lang.Object |
data
The object that actually holds the media data chunk for this Buffer . |
protected long |
duration
The duration of the data held in this Buffer , in nanoseconds. |
static int |
FLAG_BUF_OVERFLOWN
Indicates that some buffer queue in the data flow path from where this buffer comes from is overflown. |
static int |
FLAG_BUF_UNDERFLOWN
Indicates that some buffer queue in the data flow path from where this buffer comes from is underflown. |
static int |
FLAG_DISCARD
Indicates that the media data in this Buffer should be ignored. |
static int |
FLAG_EOM
Indicates that this Buffer marks the end of media for the data stream. |
static int |
FLAG_FLUSH
This is a marker bit used by the system. |
static int |
FLAG_KEY_FRAME
Indicates that this Buffer starts with a key frame. |
static int |
FLAG_LIVE_DATA
Indicates that the data is arriving from a live (real-time) source. |
static int |
FLAG_NO_DROP
Indicates that this Buffer will not be dropped
even if the frame is behind the presentation schedule. |
static int |
FLAG_NO_SYNC
Indicates that this Buffer is not to be presented
in sync with the scheduled presentation time. |
static int |
FLAG_NO_WAIT
Indicates that this Buffer will not be waited on
even if the frame is ahead of the presentation schedule. |
static int |
FLAG_RELATIVE_TIME
Indicates that the Buffer carries a time stamp that's
in relative time units. |
static int |
FLAG_RTP_MARKER
This is a marker bit for RTP. |
static int |
FLAG_RTP_TIME
Indicates that the Buffer carries a time stamp that's
in RTP (NTP) time units. |
static int |
FLAG_SID
Indicates that this Buffer contains only SID (silence information
description) frames. |
static int |
FLAG_SILENCE
Indicates that this Buffer contains only silence frames. |
static int |
FLAG_SYSTEM_MARKER
This is a marker bit used by the system. |
static int |
FLAG_SYSTEM_TIME
Indicates that the Buffer carries a time stamp that's
relative to the SystemTimeBase. |
protected int |
flags
A flag mask that describes the boolean attributes enabled for this Buffer . |
protected Format |
format
The Format of the chunk of data in this Buffer . |
protected java.lang.Object |
header
Header information (such as RTP header) for this data chunk. |
protected int |
length
For array data type, states how many samples are valid in the array. |
protected int |
offset
For array data type, points to the starting point (offset) into the array where the valid data begins. |
static long |
SEQUENCE_UNKNOWN
The getSequenceNumber method returns this value if
the sequence number is not known. |
protected long |
sequenceNumber
The sequence number of this Buffer . |
static long |
TIME_UNKNOWN
The getTimeStamp method return this value if the time
stamp of the media is not known. |
protected long |
timeStamp
The time stamp of the data held in this Buffer , in nanoseconds. |
Constructor Summary | |
Buffer()
|
Method Summary | |
java.lang.Object |
clone()
Clone a buffer. |
void |
copy(Buffer buffer)
Copy the attributes from the specified Buffer into this
Buffer |
void |
copy(Buffer buffer,
boolean swapData)
Copy the attributes from the specified Buffer into this
Buffer . |
java.lang.Object |
getData()
Gets the internal data object that holds the media chunk contained in this Buffer . |
long |
getDuration()
Gets the duration of this Buffer . |
int |
getFlags()
Gets the mask of the flags set for this Buffer . |
Format |
getFormat()
Get the Format of the data in this Buffer . |
java.lang.Object |
getHeader()
Gets the header information for the media chunk contained in this Buffer . |
int |
getLength()
Gets the length of the valid data in this Buffer if the data is held in an array. |
int |
getOffset()
If the media chunk for this Buffer is held in an array, gets the
offset into the data array where the valid data begins. |
long |
getSequenceNumber()
Gets the sequence number of this Buffer . |
long |
getTimeStamp()
Gets the time stamp of this Buffer . |
boolean |
isDiscard()
Checks whether or not this Buffer is to be discarded. |
boolean |
isEOM()
Checks whether or not this Buffer marks the end of the media stream. |
void |
setData(java.lang.Object data)
Sets the internal data object that holds the media chunk. |
void |
setDiscard(boolean discard)
Sets the DISCARD flag for this Buffer . |
void |
setDuration(long duration)
Sets the duration of this Buffer . |
void |
setEOM(boolean eom)
Sets the EOM flag for this Buffer . |
void |
setFlags(int flags)
Sets the flag mask for this Buffer . |
void |
setFormat(Format format)
Sets the Format of the data in this Buffer . |
void |
setHeader(java.lang.Object header)
Sets the header information for the media chunk. |
void |
setLength(int length)
Sets the length of the valid data stored in this Buffer if the data
is held in an array. |
void |
setOffset(int offset)
If the media chunk for this Buffer is held in an array,
sets the offset into the array where the valid data begins. |
void |
setSequenceNumber(long number)
Sets the sequence number of this Buffer . |
void |
setTimeStamp(long timeStamp)
Sets the time stamp of this Buffer . |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected long timeStamp
Buffer
, in nanoseconds.
The time stamp marks the time when presentation of this Buffer
is to begin.
If the start time for this Buffer
is not known, this time stamp is set to
TIME_UNKNOWN
.protected long duration
Buffer
, in nanoseconds.
The duration specifies how long it will take for this Buffer
to be presented when the playback rate is 1.0.
If the duration for this Buffer
is not known, it is set to
TIME_UNKNOWN
.protected Format format
Format
of the chunk of data in this Buffer
.protected int flags
Buffer
.
This mask is set to the logical sum of all of the flags that are
set.FLAG_EOM
,
FLAG_DISCARD
,
FLAG_SILENCE
,
FLAG_SID
,
FLAG_KEY_FRAME
,
FLAG_NO_DROP
,
FLAG_NO_WAIT
,
FLAG_NO_SYNC
,
FLAG_RELATIVE_TIME
,
FLAG_SYSTEM_TIME
,
FLAG_RTP_TIME
,
FLAG_FLUSH
,
FLAG_SYSTEM_MARKER
,
FLAG_RTP_MARKER
protected java.lang.Object data
Buffer
.
It can be an array type (such as byte[]) or any other type
of object. Use instanceOf
to determine what type it is.protected java.lang.Object header
instanceOf
to determine what type it is.protected int length
protected int offset
protected long sequenceNumber
Buffer
. The sequence number of adjacent
Buffer
objects in a sequence should differ by 1: positive 1 if the
media is playing forward, negative 1 if the media is played in
reverse. If the sequence number is not known, SEQUENCE_UNKNOWN
is specified.public static final int FLAG_EOM
Buffer
marks the end of media for the data stream.
The Buffer might or might not contain valid data to be processed.
The length and data attributes need to be examined to determine whether or not this
Buffer
contains valid data.public static final int FLAG_DISCARD
Buffer
should be ignored.public static final int FLAG_SILENCE
Buffer
contains only silence frames.public static final int FLAG_SID
Buffer
contains only SID (silence information
description) frames.public static final int FLAG_KEY_FRAME
Buffer
starts with a key frame.public static final int FLAG_NO_DROP
Buffer
will not be dropped
even if the frame is behind the presentation schedule.public static final int FLAG_NO_WAIT
Buffer
will not be waited on
even if the frame is ahead of the presentation schedule.public static final int FLAG_NO_SYNC
Buffer
is not to be presented
in sync with the scheduled presentation time.
In other words, the Buffer
will not be dropped or waited on if it's behind
or ahead of schedule.public static final int FLAG_SYSTEM_TIME
Buffer
carries a time stamp that's
relative to the SystemTimeBase.
This flag is generally set for data transferred from hardware capture
DataSources that uses the system clock.public static final int FLAG_RELATIVE_TIME
Buffer
carries a time stamp that's
in relative time units. This means that individual time stamps are
not measured against any indentifiable absolute origin--only the
difference between the time stamps of two consecutive buffers
carries useful information. (This is the time difference between the
two packets.)public static final int FLAG_FLUSH
Buffer
generated by the system to flush
the data path. Do not attempt to use or overwrite this flag.public static final int FLAG_SYSTEM_MARKER
public static final int FLAG_RTP_MARKER
Buffer
is the last packet of a video frame.public static final int FLAG_RTP_TIME
Buffer
carries a time stamp that's
in RTP (NTP) time units.public static final int FLAG_BUF_OVERFLOWN
public static final int FLAG_BUF_UNDERFLOWN
public static final int FLAG_LIVE_DATA
public static final long TIME_UNKNOWN
getTimeStamp
method return this value if the time
stamp of the media is not known.public static final long SEQUENCE_UNKNOWN
getSequenceNumber
method returns this value if
the sequence number is not known.Constructor Detail |
public Buffer()
Method Detail |
public Format getFormat()
Format
of the data in this Buffer
.public void setFormat(Format format)
Format
of the data in this Buffer
.format
- The Format
of the data.public int getFlags()
Buffer
.
The integer value of the mask is equal to the logical sum of
the flags that are set.FLAG_EOM
,
FLAG_DISCARD
,
FLAG_SILENCE
,
FLAG_SID
,
FLAG_KEY_FRAME
,
FLAG_NO_DROP
,
FLAG_NO_WAIT
,
FLAG_NO_SYNC
,
FLAG_RELATIVE_TIME
,
FLAG_FLUSH
,
FLAG_SYSTEM_MARKER
,
FLAG_RTP_MARKER
public void setFlags(int flags)
Buffer
.
The integer value of the mask is equal to the logical sum of
the flags that are set.FLAG_EOM
,
FLAG_DISCARD
,
FLAG_SILENCE
,
FLAG_SID
,
FLAG_KEY_FRAME
,
FLAG_NO_DROP
,
FLAG_NO_WAIT
,
FLAG_NO_SYNC
,
FLAG_RELATIVE_TIME
,
FLAG_FLUSH
,
FLAG_SYSTEM_MARKER
,
FLAG_RTP_MARKER
public boolean isEOM()
Buffer
marks the end of the media stream.
Even it isEOM
returns true
, the Buffer
might still
contain valid data--check the length of the Buffer
.
This method provides a convenient alternative to using getFlags
to check the EOM flag.
true
if the EOM flag is enabled, false
if it is not.getFlags()
,
FLAG_EOM
public void setEOM(boolean eom)
Buffer
. If the EOM flag is enabled, this
is the last Buffer
in the media stream.
This method provides a convenient alternative to using setFlags
to enable or disable the EOM flag.
eom
- A boolean value that contains the EOM status of the Buffer
. Set to
true
to enable the EOM flag, false
to disable the flag.setFlags(int)
,
FLAG_EOM
public boolean isDiscard()
Buffer
is to be discarded.
This method provides a convenient alternative to using getFlags
to check the DISCARD flag.
true
if the DISCARD flag is enabled, false
if it is not.getFlags()
,
FLAG_DISCARD
public void setDiscard(boolean discard)
Buffer
. If the DISCARD flag is enabled,
this Buffer
is to be discarded.
This method provides a convenient alternative to using setFlags
to enable or disable the DISCARD flag.
discard
- A boolean value that contains the DISCARD status of the Buffer
. Set to
true
to enable the EOM flag, false
to disable the flag.setFlags(int)
,
FLAG_DISCARD
public java.lang.Object getData()
Buffer
.Buffer
.
It can be an array type (such as byte[]) or any other type
of object. Use instanceOf
to determine what type it is.data
public void setData(java.lang.Object data)
data
- The data object that holds the media data chunk for this Buffer
.
It can be an array type (such as byte[]) or any other type
of object.data
public java.lang.Object getHeader()
Buffer
.instanceOf
to determine what type the header object is.header
public void setHeader(java.lang.Object header)
header
- The header object that holds the media data chunk for this Buffer
.header
public int getLength()
Buffer
if the data is held in an array.Buffer
.length
public void setLength(int length)
Buffer
if the data
is held in an array.length
- The length of the valid data in the data array that holds the
media chunk for this Buffer
.length
public int getOffset()
Buffer
is held in an array, gets the
offset into the data array where the valid data begins.public void setOffset(int offset)
Buffer
is held in an array,
sets the offset into the array where the valid data begins.offset
- The starting point for the valid data.offset
public long getTimeStamp()
Buffer
.Buffer
time stamp, in nanoseconds.timeStamp
public void setTimeStamp(long timeStamp)
Buffer
.timeStamp
- The time stamp for the Buffer
, in nanoseconds.timeStamp
public long getDuration()
Buffer
.Buffer
duration, in nanoseconds.duration
public void setDuration(long duration)
Buffer
.duration
- The duration for the Buffer
, in nanoseconds.duration
public void setSequenceNumber(long number)
Buffer
. Sequence numbers
increase or decrease by 1 for each sequential Buffer
, indicating
the order in which the data is to be processed. Can be used
to identify lost samples of data.number
- The sequence number for the Buffer
.sequenceNumber
public long getSequenceNumber()
Buffer
.Buffer
.sequenceNumber
public void copy(Buffer buffer)
Buffer
into this
Buffer
buffer
- The input Buffer
the copy the attributes from.public void copy(Buffer buffer, boolean swapData)
Buffer
into this
Buffer
. If swapData is true, the data values are swapped
between the buffers, otherwise the data value is copied.buffer
- The input Buffer
the copy the attributes from.swapData
- Specifies whether the data objects are to be swapped.public java.lang.Object clone()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |