Fields Summary |
---|
protected long | timeStampThe time stamp of the data held in this 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 | durationThe duration of the data held in this 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 | formatThe Format of the chunk of data in this Buffer . |
protected int | flagsA flag mask that describes the boolean attributes
enabled for this Buffer .
This mask is set to the logical sum of all of the flags that are
set. |
protected Object | dataThe object that actually holds the media data chunk for this 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 Object | headerHeader information (such as RTP header) for this data chunk.
It can be of any type.
Use instanceOf to determine what type it is. |
protected int | lengthFor array data type, states how many samples are valid in the array.
(The array might be larger than the actual media length). |
protected int | offsetFor array data type, points to the starting point (offset) into the
array where the valid data begins. |
protected long | sequenceNumberThe sequence number of this 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_EOMIndicates that this 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_DISCARDIndicates that the media data in this Buffer should be ignored. |
public static final int | FLAG_SILENCEIndicates that this Buffer contains only silence frames. |
public static final int | FLAG_SIDIndicates that this Buffer contains only SID (silence information
description) frames. |
public static final int | FLAG_KEY_FRAMEIndicates that this Buffer starts with a key frame. |
public static final int | FLAG_NO_DROPIndicates that this Buffer will not be dropped
even if the frame is behind the presentation schedule. |
public static final int | FLAG_NO_WAITIndicates that this Buffer will not be waited on
even if the frame is ahead of the presentation schedule. |
public static final int | FLAG_NO_SYNCIndicates that this 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_TIMEIndicates that the 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_TIMEIndicates that the 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_FLUSHThis is a marker bit used by the system. When this flag is set,
it marks a zero-length 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_MARKERThis is a marker bit used by the system. Do not attempt to use
or overwrite this flag. |
public static final int | FLAG_RTP_MARKERThis is a marker bit for RTP. Indicates that the Buffer
is the last packet of a video frame. |
public static final int | FLAG_RTP_TIMEIndicates that the Buffer carries a time stamp that's
in RTP (NTP) time units. |
public static final int | FLAG_BUF_OVERFLOWNIndicates that some buffer queue in the data flow path from where
this buffer comes from is overflown.
When such condition occurs, the processing element should attempt
to speed up the procesing of this buffer object to reduce the overflow. |
public static final int | FLAG_BUF_UNDERFLOWNIndicates that some buffer queue in the data flow path from where
this buffer comes from is underflown.
When such condition occurs, the processing element should attempt
to speed up the procesing of this buffer object to reduce the underflow. |
public static final int | FLAG_LIVE_DATAIndicates that the data is arriving from a live (real-time) source. |
public static final long | TIME_UNKNOWNThe getTimeStamp method return this value if the time
stamp of the media is not known. |
public static final long | SEQUENCE_UNKNOWNThe getSequenceNumber method returns this value if
the sequence number is not known. |
Methods Summary |
---|
public java.lang.Object | clone()Clone a buffer.
Buffer buf = new Buffer();
Object data = getData();
if (data != null) {
if (data instanceof byte[])
buf.data = ((byte[])data).clone();
else if (data instanceof int[])
buf.data = ((int[])data).clone();
else if (data instanceof short[])
buf.data = ((short[])data).clone();
else
buf.data = data;
}
if (header != null) {
if (header instanceof byte[])
buf.header = ((byte[])header).clone();
else if (header instanceof int[])
buf.header = ((int[])header).clone();
else if (header instanceof short[])
buf.header = ((short[])header).clone();
else
buf.header = header;
}
buf.format = format;
buf.length = length;
buf.offset = offset;
buf.timeStamp = timeStamp;
buf.duration = duration;
buf.sequenceNumber = sequenceNumber;
buf.flags = flags;
return buf;
|
public void | copy(javax.media.Buffer buffer)Copy the attributes from the specified Buffer into this
Buffer
copy(buffer, false);
|
public void | copy(javax.media.Buffer buffer, boolean swapData)Copy the attributes from the specified Buffer into this
Buffer . If swapData is true, the data values are swapped
between the buffers, otherwise the data value is copied.
if (swapData) {
Object temp = data;
data = buffer.data;
buffer.data = temp;
} else {
data = buffer.data;
}
header = buffer.header;
format = buffer.format;
length = buffer.length;
offset = buffer.offset;
timeStamp = buffer.timeStamp;
duration = buffer.duration;
sequenceNumber = buffer.sequenceNumber;
flags = buffer.flags;
|
public java.lang.Object | getData()Gets the internal data object that holds the media chunk contained in this Buffer .
return data;
|
public long | getDuration()Gets the duration of this Buffer .
return duration;
|
public int | getFlags()Gets the mask of the flags set for this Buffer .
The integer value of the mask is equal to the logical sum of
the flags that are set.
return flags;
|
public javax.media.Format | getFormat()Get the Format of the data in this Buffer .
return format;
|
public java.lang.Object | getHeader()Gets the header information for the media chunk contained in this Buffer .
return header;
|
public int | getLength()Gets the length of the valid data in this Buffer if the data is held in an array.
return length;
|
public 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.
return offset;
|
public long | getSequenceNumber()Gets the sequence number of this Buffer .
return sequenceNumber;
|
public long | getTimeStamp()Gets the time stamp of this Buffer .
return timeStamp;
|
public boolean | isDiscard()Checks whether or not this Buffer is to be discarded.
This method provides a convenient alternative to using getFlags
to check the DISCARD flag.
return (flags & FLAG_DISCARD) != 0;
|
public boolean | isEOM()Checks whether or not this 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.
return (flags & FLAG_EOM) != 0;
|
public void | setData(java.lang.Object data)Sets the internal data object that holds the media chunk.
this.data = data;
|
public void | setDiscard(boolean discard)Sets the DISCARD flag for this 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.
if (discard)
flags |= FLAG_DISCARD;
else
flags &= ~FLAG_DISCARD;
|
public void | setDuration(long duration)Sets the duration of this Buffer .
this.duration = duration;
|
public void | setEOM(boolean eom)Sets the EOM flag for this 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.
if (eom)
flags |= FLAG_EOM;
else
flags &= ~FLAG_EOM;
|
public void | setFlags(int flags)Sets the flag mask for this Buffer .
The integer value of the mask is equal to the logical sum of
the flags that are set.
this.flags = flags;
|
public void | setFormat(javax.media.Format format)Sets the Format of the data in this Buffer .
this.format=format;
|
public void | setHeader(java.lang.Object header)Sets the header information for the media chunk.
this.header = header;
|
public void | setLength(int length)Sets the length of the valid data stored in this Buffer if the data
is held in an array.
this.length=length;
|
public 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.
this.offset = offset;
|
public void | setSequenceNumber(long number)Sets the sequence number of this 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.
sequenceNumber = number;
|
public void | setTimeStamp(long timeStamp)Sets the time stamp of this Buffer .
this.timeStamp = timeStamp;
|