public class ID3v24FrameBodyRecommendedBufferSize extends ID3v24FrameBody
A recommended buffer size frame body is associated with an ID3v2.4 RBUF
frame
which is used to indicate a buffer size to
a server from which an .mp3 file is being streamed. Sometimes the server is aware of transmission or coding problems resulting in interruptions in the audio stream. In these cases,
the size of the buffer can be recommended by the server using this frame. Embedded tags are generally not recommended since this could render unpredictable behaviour from present
software/hardware.
For applications like streaming audio it might be an idea to embed tags into the audio stream though. If the client connects to individual connections
like HTTP and there is a possibility to begin every transmission with a tag, then this tag should include a recommended buffer size frame. If the client
is connected to an arbitrary point in the stream, such as radio or multicast, then the recommended buffer size frame should be included in every tag.
Every tag that is picked up after the initial/first tag is to be considered as an update of the previous one. For example, if there is a TIT2
frame in the first received tag and one in the second tag, then the first should be 'replaced' with the second.
The recommended buffer frame body contains the following fields:
Field | Description | |
---|---|---|
1. | bufferSize | the recommended size of the buffer |
2. | embeddedInfoFlag | indicates that an ID3 tag with the maximum size described in the bufferSize field may occur in the audiostream. In such case the tag should reside between two MPEG frames, if the audio is MPEG encoded. |
3. | offsetToNextTag | If the position of the next tag is known, the offset is calculated from the end of tag in which this frame resides to the first byte of the header in the next. This field is optional and may be omitted. |
The 'buffer size' should be kept to a minimum. There may be only one recommended buffer size frame in a tag.
buffer, dirty, frameType
nextNullTerminatorIndex, nullTerminatorIndex
Constructor and Description |
---|
ID3v24FrameBodyRecommendedBufferSize()
The default constructor is called when creating a new frame.
|
ID3v24FrameBodyRecommendedBufferSize(java.io.InputStream inputStream,
int frameBodySize)
This constructor is called when reading in an existing frame from an .mp3 file.
|
ID3v24FrameBodyRecommendedBufferSize(int bufferSize,
boolean embeddedInfoFlag,
int offsetToNextTag)
This constructor is called when creating a new frame.
|
Modifier and Type | Method and Description |
---|---|
int |
getBufferSize()
gets the buffer size.
|
int |
getOffsetToNextTag()
gets the number of bytes until the next tag.
|
boolean |
isEmbeddedInfoFlag()
gets the flag indicating whether an ID3 tag with the maximum size described in 'Buffer size' may occur in the audiostream.
|
void |
parse()
parses the raw bytes of the frame body and stores the parsed values in the frame's fields.
|
void |
setBuffer()
If the frame body's values have been modified, then resize the raw binary buffer and store the new values there.
|
void |
setBufferSize(int bufferSize)
sets the size of the buffer.
|
void |
setEmbeddedInfoFlag(boolean embeddedInfoFlag)
sets whether an ID3 tag with the maximum size described in 'Buffer size' may occur in the audiostream.
|
void |
setOffsetToNextTag(int offsetToNextTag)
sets number of bytes until the next tag.
|
java.lang.String |
toString()
gets a string representation of the recommended buffer size frame body showing all of the frame's fields and their values.
|
getFrameType, getNextNullTerminator, getSize, isDirty, save, save
getNextNullTerminator, pricesToString, stringToBytes
bytesToInt, bytesToInt, bytesToShort, bytesToShort, bytesToSynchsafeInt, bytesToSynchsafeShort, formateDate, hex, hex, hex, intToBytes, littleEndianBytesToInt, pad, shortToBytes, synchsafeIntToBytes
public ID3v24FrameBodyRecommendedBufferSize()
public ID3v24FrameBodyRecommendedBufferSize(int bufferSize, boolean embeddedInfoFlag, int offsetToNextTag)
bufferSize
- size of the buffer in bytes.embeddedInfoFlag
- indicates whether an ID3 tag with the maximum size described in 'buffer size' may occur in the audiostream.offsetToNextTag
- optional field indicating the number of bytes until the next tag.public ID3v24FrameBodyRecommendedBufferSize(java.io.InputStream inputStream, int frameBodySize) throws java.io.IOException
inputStream
- input stream pointing to a recommended buffer size frame body in the .mp3 file.frameBodySize
- size (in bytes) of the frame's body.java.io.IOException
- if there is an error while reading the frame body.public void parse() throws java.lang.IllegalArgumentException
parse
in class ID3v24FrameBody
java.lang.IllegalArgumentException
- if an invalid value is detected while parsing the frame body's raw bytes.public int getBufferSize()
setBufferSize(int)
public void setBufferSize(int bufferSize)
bufferSize
- size of the buffer in bytes.getBufferSize()
public boolean isEmbeddedInfoFlag()
setEmbeddedInfoFlag(boolean)
public void setEmbeddedInfoFlag(boolean embeddedInfoFlag)
embeddedInfoFlag
- boolean indicating whether an ID3 tag may occur in the audiostream.isEmbeddedInfoFlag()
public int getOffsetToNextTag()
setOffsetToNextTag(int)
public void setOffsetToNextTag(int offsetToNextTag)
offsetToNextTag
- number of bytes to the next tag.getOffsetToNextTag()
public void setBuffer()
setBuffer
in class ID3v24FrameBody
public java.lang.String toString()
toString
in class java.lang.Object