Copyright 2013-01-06 Werner Randelshofer

org.monte.media
Class Buffer

java.lang.Object
  extended by org.monte.media.Buffer

public class Buffer
extends java.lang.Object

A Buffer carries media data from one media processing unit to another.

Version:
1.0 2011-03-12 Created.
Author:
Werner Randelshofer

Field Summary
 java.lang.Object data
          The media data.
 java.util.EnumSet<BufferFlag> flags
          A flag mask that describes the boolean attributes for this buffer.
 Format format
          The format of the data in this buffer.
 java.lang.Object header
          Header information, such as RTP header for this chunk.
 int length
          The data length.
static int NOT_SPECIFIED
          Values which are not specified must have this value.
 int offset
          The data offset.
 int sampleCount
          The number of samples in the data field.
 Rational sampleDuration
          Duration of a sample in seconds.
 long sequenceNumber
          Sequence number of the buffer.
 Rational timeStamp
          The time stamp of this buffer in seconds.
 int track
          The track number.
 
Constructor Summary
Buffer()
           
 
Method Summary
 void clearFlag(BufferFlag flag)
          Convenience method for clearing a flag.
 void clearFlags()
           
 boolean isFlag(BufferFlag flag)
          Returns true if the specified flag is set.
 void setDataTo(Buffer that)
          Sets data, offset, length and header of this buffer to that buffer.
 void setFlag(BufferFlag flag)
          Convenience method for setting a flag.
 void setFlag(BufferFlag flag, boolean value)
          Sets or clears the specified flag.
 void setFlagsTo(BufferFlag... flags)
          Clears all flags, and then sets the specified flag.
 void setFlagsTo(java.util.EnumSet<BufferFlag> flags)
          Clears all flags, and then sets the specified flag.
 void setMetaTo(Buffer that)
          Sets all variables of this buffer to that buffer except for data, offset, length and header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flags

public java.util.EnumSet<BufferFlag> flags
A flag mask that describes the boolean attributes for this buffer.


NOT_SPECIFIED

public static final int NOT_SPECIFIED
Values which are not specified must have this value.

See Also:
Constant Field Values

track

public int track
The track number. This can be set to NOT_SPECIFIED or to a number >= 0.


header

public java.lang.Object header
Header information, such as RTP header for this chunk.


data

public java.lang.Object data
The media data.


offset

public int offset
The data offset. This field is only used if data is an array.


length

public int length
The data length. This field is only used if data is an array.


sampleDuration

public Rational sampleDuration
Duration of a sample in seconds. Multiply this with sampleCount to get the buffer duration.


timeStamp

public Rational timeStamp
The time stamp of this buffer in seconds.


format

public Format format
The format of the data in this buffer.


sampleCount

public int sampleCount
The number of samples in the data field.


sequenceNumber

public long sequenceNumber
Sequence number of the buffer. This can be used for debugging.

Constructor Detail

Buffer

public Buffer()
Method Detail

setMetaTo

public void setMetaTo(Buffer that)
Sets all variables of this buffer to that buffer except for data, offset, length and header.


setDataTo

public void setDataTo(Buffer that)
Sets data, offset, length and header of this buffer to that buffer. Note that this method creates copies of the data and header, so that these fields in that buffer can be discarded without affecting the contents of this buffer.

FIXME - This method does not always create a copy!!


isFlag

public boolean isFlag(BufferFlag flag)
Returns true if the specified flag is set.


setFlag

public void setFlag(BufferFlag flag)
Convenience method for setting a flag.


clearFlag

public void clearFlag(BufferFlag flag)
Convenience method for clearing a flag.


setFlag

public void setFlag(BufferFlag flag,
                    boolean value)
Sets or clears the specified flag.


setFlagsTo

public void setFlagsTo(BufferFlag... flags)
Clears all flags, and then sets the specified flag.


setFlagsTo

public void setFlagsTo(java.util.EnumSet<BufferFlag> flags)
Clears all flags, and then sets the specified flag.


clearFlags

public void clearFlags()

Copyright 2013-01-06 Werner Randelshofer