Class Buffer

java.lang.Object
org.monte.media.av.Buffer

public class Buffer extends Object
A Buffer carries media data from one media processing unit to another.
Author:
Werner Randelshofer
  • Field Details

    • flags

      public 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:
    • track

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

      public int headerOffset
      The header offset. This field is only used if header is an array.
    • headerLength

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

      public 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 Details

    • Buffer

      public Buffer()
  • Method Details

    • setMetaTo

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

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

      Returns Codec.CODEC_FAILED or Codec.CODEC_OK

    • 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(EnumSet<BufferFlag> flags)
      Clears all flags, and then sets the specified flag.
    • clearFlags

      public void clearFlags()
    • toString

      public String toString()
      Overrides:
      toString in class Object