org.jaudiotagger.audio.asf.data
Class AudioStreamChunk

java.lang.Object
  extended by org.jaudiotagger.audio.asf.data.Chunk
      extended by org.jaudiotagger.audio.asf.data.StreamChunk
          extended by org.jaudiotagger.audio.asf.data.AudioStreamChunk

public final class AudioStreamChunk
extends StreamChunk

This class represents the stream chunk describing an audio stream.

Author:
Christian Laireiter

Field Summary
private  long averageBytesPerSec
          Stores the average amount of bytes used by audio stream.
private  int bitsPerSample
          Amount of bits used per sample.
private  long blockAlignment
          The block alignment of the audio data.
private  long channelCount
          Number of channels.
static java.lang.String[][] CODEC_DESCRIPTIONS
          Stores the hex values of codec identifiers to their descriptions.
private  byte[] codecData
          Some data which needs to be interpreted if the codec is handled.
private  long compressionFormat
          The audio compression format code.
private  GUID errorConcealment
          this field stores the error concealment type.
private  long samplingRate
          Sampling rate of audio stream.
static long WMA
          Stores the audio codec number for WMA
static long WMA_CBR
          Stores the audio codec number for WMA (CBR)
static long WMA_LOSSLESS
          Stores the audio codec number for WMA_LOSSLESS
static long WMA_PRO
          Stores the audio codec number for WMA_PRO
static long WMA_VBR
          Stores the audio codec number for WMA (VBR)
 
Fields inherited from class org.jaudiotagger.audio.asf.data.Chunk
chunkLength, guid, position
 
Constructor Summary
AudioStreamChunk(java.math.BigInteger chunkLen)
          Creates an instance.
 
Method Summary
 long getAverageBytesPerSec()
           
 int getBitsPerSample()
           
 long getBlockAlignment()
           
 long getChannelCount()
           
 byte[] getCodecData()
           
 java.lang.String getCodecDescription()
          This method will take a look at compressionFormatand returns a String with its hex value and if known a textual note on what coded it represents.
 long getCompressionFormat()
           
 GUID getErrorConcealment()
           
 int getKbps()
          This method takes the value of getAverageBytesPerSec()and calculates the kbps out of it, by simply multiplying by 8 and dividing by 1000.
 long getSamplingRate()
           
 boolean isErrorConcealed()
          This mehtod returns whether the audio stream data is error concealed.
 java.lang.String prettyPrint(java.lang.String prefix)
          (overridden)
 void setAverageBytesPerSec(long avgeBytesPerSec)
           
 void setBitsPerSample(int bps)
          Sets the bitsPerSample
 void setBlockAlignment(long align)
          Sets the blockAlignment.
 void setChannelCount(long channels)
           
 void setCodecData(byte[] codecSpecificData)
          Sets the codecData
 void setCompressionFormat(long cFormatCode)
           
 void setErrorConcealment(GUID errConc)
          This method sets the error concealment type which is given by two GUIDs.
 void setSamplingRate(long sampRate)
           
 
Methods inherited from class org.jaudiotagger.audio.asf.data.StreamChunk
getStreamNumber, getStreamSpecificDataSize, getStreamType, getTimeOffset, getTypeSpecificDataSize, isContentEncrypted, setContentEncrypted, setStreamNumber, setStreamSpecificDataSize, setTimeOffset, setTypeSpecificDataSize
 
Methods inherited from class org.jaudiotagger.audio.asf.data.Chunk
getChunckEnd, getChunkEnd, getChunkLength, getGuid, getPosition, setPosition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CODEC_DESCRIPTIONS

public static final java.lang.String[][] CODEC_DESCRIPTIONS
Stores the hex values of codec identifiers to their descriptions.


WMA

public static final long WMA
Stores the audio codec number for WMA

See Also:
Constant Field Values

WMA_CBR

public static final long WMA_CBR
Stores the audio codec number for WMA (CBR)

See Also:
Constant Field Values

WMA_LOSSLESS

public static final long WMA_LOSSLESS
Stores the audio codec number for WMA_LOSSLESS

See Also:
Constant Field Values

WMA_PRO

public static final long WMA_PRO
Stores the audio codec number for WMA_PRO

See Also:
Constant Field Values

WMA_VBR

public static final long WMA_VBR
Stores the audio codec number for WMA (VBR)

See Also:
Constant Field Values

averageBytesPerSec

private long averageBytesPerSec
Stores the average amount of bytes used by audio stream.
This value is a field within type specific data of audio stream. Maybe it could be used to calculate the KBPs.


bitsPerSample

private int bitsPerSample
Amount of bits used per sample.


blockAlignment

private long blockAlignment
The block alignment of the audio data.


channelCount

private long channelCount
Number of channels.


codecData

private byte[] codecData
Some data which needs to be interpreted if the codec is handled.


compressionFormat

private long compressionFormat
The audio compression format code.


errorConcealment

private GUID errorConcealment
this field stores the error concealment type.


samplingRate

private long samplingRate
Sampling rate of audio stream.

Constructor Detail

AudioStreamChunk

public AudioStreamChunk(java.math.BigInteger chunkLen)
Creates an instance.

Parameters:
chunkLen - Length of the entire chunk (including guid and size)
Method Detail

getAverageBytesPerSec

public long getAverageBytesPerSec()
Returns:
Returns the averageBytesPerSec.

getBitsPerSample

public int getBitsPerSample()
Returns:
Returns the bitsPerSample.

getBlockAlignment

public long getBlockAlignment()
Returns:
Returns the blockAlignment.

getChannelCount

public long getChannelCount()
Returns:
Returns the channelCount.

getCodecData

public byte[] getCodecData()
Returns:
Returns the codecData.

getCodecDescription

public java.lang.String getCodecDescription()
This method will take a look at compressionFormatand returns a String with its hex value and if known a textual note on what coded it represents.

Returns:
A description for the used codec.

getCompressionFormat

public long getCompressionFormat()
Returns:
Returns the compressionFormat.

getErrorConcealment

public GUID getErrorConcealment()
Returns:
Returns the errorConcealment.

getKbps

public int getKbps()
This method takes the value of getAverageBytesPerSec()and calculates the kbps out of it, by simply multiplying by 8 and dividing by 1000.

Returns:
amount of bits per second in kilo bits.

getSamplingRate

public long getSamplingRate()
Returns:
Returns the samplingRate.

isErrorConcealed

public boolean isErrorConcealed()
This mehtod returns whether the audio stream data is error concealed.
For now only interleaved concealment is known.

Returns:
true if error concealment is used.

prettyPrint

public java.lang.String prettyPrint(java.lang.String prefix)
(overridden)

Overrides:
prettyPrint in class StreamChunk
Parameters:
prefix - each line gets this string prepended.
Returns:
Information of current Chunk Object.
See Also:
Chunk.prettyPrint(String)

setAverageBytesPerSec

public void setAverageBytesPerSec(long avgeBytesPerSec)
Parameters:
avgeBytesPerSec - The averageBytesPerSec to set.

setBitsPerSample

public void setBitsPerSample(int bps)
Sets the bitsPerSample

Parameters:
bps -

setBlockAlignment

public void setBlockAlignment(long align)
Sets the blockAlignment.

Parameters:
align -

setChannelCount

public void setChannelCount(long channels)
Parameters:
channels - The channelCount to set.

setCodecData

public void setCodecData(byte[] codecSpecificData)
Sets the codecData

Parameters:
codecSpecificData -

setCompressionFormat

public void setCompressionFormat(long cFormatCode)
Parameters:
cFormatCode - The compressionFormat to set.

setErrorConcealment

public void setErrorConcealment(GUID errConc)
This method sets the error concealment type which is given by two GUIDs.

Parameters:
errConc - the type of error concealment the audio stream is stored as.

setSamplingRate

public void setSamplingRate(long sampRate)
Parameters:
sampRate - The samplingRate to set.