org.jaudiotagger.audio.flac.metadatablock
Class MetadataBlockDataStreamInfo

java.lang.Object
  extended by org.jaudiotagger.audio.flac.metadatablock.MetadataBlockDataStreamInfo

public class MetadataBlockDataStreamInfo
extends java.lang.Object

Stream Info

This block has information about the whole stream, like sample rate, number of channels, total number of samples, etc. It must be present as the first metadata block in the stream. Other metadata blocks may follow, and ones that the decoder doesn't understand, it will skip. Format: Info <16> The minimum block size (in samples) used in the stream. <16> The maximum block size (in samples) used in the stream. (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream. <24> The minimum frame size (in bytes) used in the stream. May be 0 to imply the value is not known. <24> The maximum frame size (in bytes) used in the stream. May be 0 to imply the value is not known. <20> Sample rate in Hz. Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 655350Hz. Also, a value of 0 is invalid. <3> (number of channels)-1. FLAC supports from 1 to 8 channels <5> (bits per sample)-1. FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample. <36> Total samples in stream. 'Samples' means inter-channel sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels. A value of zero here means the number of total samples is unknown. <128> MD5 signature of the unencoded audio data. This allows the decoder to determine if an error exists in the audio data even when the error does not result in an invalid bitstream. NOTES * FLAC specifies a minimum block size of 16 and a maximum block size of 65535, meaning the bit patterns corresponding to the numbers 0-15 in the minimum blocksize and maximum blocksize fields are invalid.


Field Summary
private  int bitsPerSample
           
private  int channelNumber
           
private  boolean isValid
           
private  float length
           
static java.util.logging.Logger logger
           
private  int maxBlockSize
           
private  int maxFrameSize
           
private  int minBlockSize
           
private  int minFrameSize
           
private  int samplingRate
           
private  int samplingRatePerChannel
           
static int STREAM_INFO_DATA_LENGTH
           
private  int totalNumberOfSamples
           
 
Constructor Summary
MetadataBlockDataStreamInfo(MetadataBlockHeader header, java.io.RandomAccessFile raf)
           
 
Method Summary
 int getChannelNumber()
           
 java.lang.String getEncodingType()
           
 int getLength()
           
 float getPreciseLength()
           
 int getSamplingRate()
           
 int getSamplingRatePerChannel()
           
 boolean isValid()
           
private  int readSamplingRate(byte b1, byte b2, byte b3)
           
private  int readThreeByteInteger(byte b1, byte b2, byte b3)
           
private  int readTotalNumberOfSamples(byte b1, byte b2, byte b3, byte b4, byte b5)
           
 java.lang.String toString()
           
private  int u(int i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STREAM_INFO_DATA_LENGTH

public static final int STREAM_INFO_DATA_LENGTH
See Also:
Constant Field Values

logger

public static java.util.logging.Logger logger

minBlockSize

private int minBlockSize

maxBlockSize

private int maxBlockSize

minFrameSize

private int minFrameSize

maxFrameSize

private int maxFrameSize

samplingRate

private int samplingRate

samplingRatePerChannel

private int samplingRatePerChannel

bitsPerSample

private int bitsPerSample

channelNumber

private int channelNumber

totalNumberOfSamples

private int totalNumberOfSamples

length

private float length

isValid

private boolean isValid
Constructor Detail

MetadataBlockDataStreamInfo

public MetadataBlockDataStreamInfo(MetadataBlockHeader header,
                                   java.io.RandomAccessFile raf)
                            throws java.io.IOException
Throws:
java.io.IOException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLength

public int getLength()

getPreciseLength

public float getPreciseLength()

getChannelNumber

public int getChannelNumber()

getSamplingRate

public int getSamplingRate()

getSamplingRatePerChannel

public int getSamplingRatePerChannel()

getEncodingType

public java.lang.String getEncodingType()

isValid

public boolean isValid()

readThreeByteInteger

private int readThreeByteInteger(byte b1,
                                 byte b2,
                                 byte b3)

readSamplingRate

private int readSamplingRate(byte b1,
                             byte b2,
                             byte b3)

readTotalNumberOfSamples

private int readTotalNumberOfSamples(byte b1,
                                     byte b2,
                                     byte b3,
                                     byte b4,
                                     byte b5)

u

private int u(int i)