org.kc7bfi.jflac.sound.spi
Class Flac2PcmAudioInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by javax.sound.sampled.AudioInputStream
          extended by org.kc7bfi.jflac.sound.spi.RingedAudioInputStream
              extended by org.kc7bfi.jflac.sound.spi.Flac2PcmAudioInputStream
All Implemented Interfaces:
Closeable, PCMProcessor

public class Flac2PcmAudioInputStream
extends RingedAudioInputStream
implements PCMProcessor

Converts an Flac bitstream into a PCM 16bits/sample audio stream.

Version:
$Revision: 1.6 $
Author:
Marc Gimpel, Wimba S.A. (marc@wimba.com), Florian Bomers

Field Summary
 
Fields inherited from class org.kc7bfi.jflac.sound.spi.RingedAudioInputStream
buffer, DEFAULT_BUFFER_SIZE, in
 
Fields inherited from class javax.sound.sampled.AudioInputStream
format, frameLength, framePos, frameSize
 
Constructor Summary
Flac2PcmAudioInputStream(InputStream in, AudioFormat format, long length)
          Constructor.
Flac2PcmAudioInputStream(InputStream in, AudioFormat format, long length, int size)
          Constructor.
 
Method Summary
protected  void fill()
          called from the super class whenever more PCM data is needed.
 Metadata[] getMetaData()
           
 StreamInfo getStreamInfo()
           
protected  void initDecoder()
          Initialize the Flac Decoder after reading the Header.
 void processPCM(ByteData pcm)
          Process the decoded PCM bytes.
 void processStreamInfo(StreamInfo streamInfo)
          Process the StreamInfo block.
 
Methods inherited from class org.kc7bfi.jflac.sound.spi.RingedAudioInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class javax.sound.sampled.AudioInputStream
getFormat, getFrameLength, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Flac2PcmAudioInputStream

public Flac2PcmAudioInputStream(InputStream in,
                                AudioFormat format,
                                long length)
Constructor.

Parameters:
in - the underlying input stream.
format - the target format of this stream's audio data.
length - the length in sample frames of the data in this stream.

Flac2PcmAudioInputStream

public Flac2PcmAudioInputStream(InputStream in,
                                AudioFormat format,
                                long length,
                                int size)
Constructor.

Parameters:
in - the underlying input stream.
format - the target format of this stream's audio data.
length - the length in sample frames of the data in this stream.
size - the buffer size.
Method Detail

fill

protected void fill()
             throws IOException
called from the super class whenever more PCM data is needed.

Overrides:
fill in class RingedAudioInputStream
Throws:
IOException

initDecoder

protected void initDecoder()
                    throws IOException
Initialize the Flac Decoder after reading the Header.

Throws:
IOException

processStreamInfo

public void processStreamInfo(StreamInfo streamInfo)
Process the StreamInfo block.

Specified by:
processStreamInfo in interface PCMProcessor
Parameters:
streamInfo - the StreamInfo block
See Also:
PCMProcessor.processStreamInfo(org.kc7bfi.jflac.metadata.StreamInfo)

processPCM

public void processPCM(ByteData pcm)
Process the decoded PCM bytes. This is called synchronously from the fill() method.

Specified by:
processPCM in interface PCMProcessor
Parameters:
pcm - The decoded PCM data
See Also:
PCMProcessor.processPCM(ByteData)

getStreamInfo

public StreamInfo getStreamInfo()
Returns:
the streamInfo

getMetaData

public Metadata[] getMetaData()
Returns:
the metaData


Copyright © 2004-2011. All Rights Reserved.