org.xiph.speex.spi

Class SpeexAudioFileReader


public class SpeexAudioFileReader
extends AudioFileReader

Provider for Speex audio file reading services. This implementation can parse the format information from Speex audio file, and can produce audio input streams from files of this type.
Version:
$Revision: 1.2 $
Author:
Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)

Field Summary

static String
OGGID
The String that identifies the beginning of an Ogg packet.
static int
OGG_HEADERSIZE
static int
SEGOFFSET
static String
SPEEXID
The String that identifies the beginning of the Speex header.
static int
SPEEX_HEADERSIZE
The size of the Speex header.

Method Summary

AudioFileFormat
getAudioFileFormat(File file)
Obtains the audio file format of the File provided.
AudioFileFormat
getAudioFileFormat(InputStream stream)
Obtains an audio input stream from the input stream provided.
protected AudioFileFormat
getAudioFileFormat(InputStream bitStream, ByteArrayOutputStream baos, int mediaLength)
Return the AudioFileFormat from the given InputStream.
protected AudioFileFormat
getAudioFileFormat(InputStream stream, int medialength)
Return the AudioFileFormat from the given InputStream.
AudioFileFormat
getAudioFileFormat(URL url)
Obtains an audio input stream from the URL provided.
AudioInputStream
getAudioInputStream(File file)
Obtains an audio input stream from the File provided.
AudioInputStream
getAudioInputStream(InputStream stream)
Obtains an audio input stream from the input stream provided.
protected AudioInputStream
getAudioInputStream(InputStream inputStream, int medialength)
Obtains an audio input stream from the input stream provided.
AudioInputStream
getAudioInputStream(URL url)
Obtains an audio input stream from the URL provided.
private static int
readInt(byte[] data, int offset)
Converts Little Endian (Windows) bytes to an int (Java uses Big Endian).

Field Details

OGGID

public static final String OGGID
The String that identifies the beginning of an Ogg packet.

OGG_HEADERSIZE

public static final int OGG_HEADERSIZE
Field Value:
27

SEGOFFSET

public static final int SEGOFFSET
Field Value:
26

SPEEXID

public static final String SPEEXID
The String that identifies the beginning of the Speex header.

SPEEX_HEADERSIZE

public static final int SPEEX_HEADERSIZE
The size of the Speex header.
Field Value:
80

Method Details

getAudioFileFormat

public AudioFileFormat getAudioFileFormat(File file)
            throws UnsupportedAudioFileException,
                   IOException
Obtains the audio file format of the File provided. The File must point to valid audio file data.
Parameters:
file - the File from which file format information should be extracted.
Returns:
an AudioFileFormat object describing the audio file format.

getAudioFileFormat

public AudioFileFormat getAudioFileFormat(InputStream stream)
            throws UnsupportedAudioFileException,
                   IOException
Obtains an audio input stream from the input stream provided.
Parameters:
stream - the input stream from which the AudioInputStream should be constructed.
Returns:
an AudioInputStream object based on the audio file data contained in the input stream.

getAudioFileFormat

protected AudioFileFormat getAudioFileFormat(InputStream bitStream,
                                             ByteArrayOutputStream baos,
                                             int mediaLength)
            throws UnsupportedAudioFileException,
                   IOException
Return the AudioFileFormat from the given InputStream. Implementation.
Parameters:
bitStream -
baos -
mediaLength -
Returns:
an AudioInputStream object based on the audio file data contained in the input stream.

getAudioFileFormat

protected AudioFileFormat getAudioFileFormat(InputStream stream,
                                             int medialength)
            throws UnsupportedAudioFileException,
                   IOException
Return the AudioFileFormat from the given InputStream.
Parameters:
stream - the input stream from which the AudioInputStream should be constructed.
medialength -
Returns:
an AudioInputStream object based on the audio file data contained in the input stream.

getAudioFileFormat

public AudioFileFormat getAudioFileFormat(URL url)
            throws UnsupportedAudioFileException,
                   IOException
Obtains an audio input stream from the URL provided. The URL must point to valid audio file data.
Parameters:
url - the URL for which the AudioInputStream should be constructed.
Returns:
an AudioInputStream object based on the audio file data pointed to by the URL.

getAudioInputStream

public AudioInputStream getAudioInputStream(File file)
            throws UnsupportedAudioFileException,
                   IOException
Obtains an audio input stream from the File provided. The File must point to valid audio file data.
Parameters:
file - the File for which the AudioInputStream should be constructed.
Returns:
an AudioInputStream object based on the audio file data pointed to by the File.

getAudioInputStream

public AudioInputStream getAudioInputStream(InputStream stream)
            throws UnsupportedAudioFileException,
                   IOException
Obtains an audio input stream from the input stream provided. The stream must point to valid audio file data.
Parameters:
stream - the input stream from which the AudioInputStream should be constructed.
Returns:
an AudioInputStream object based on the audio file data contained in the input stream.

getAudioInputStream

protected AudioInputStream getAudioInputStream(InputStream inputStream,
                                               int medialength)
            throws UnsupportedAudioFileException,
                   IOException
Obtains an audio input stream from the input stream provided. The stream must point to valid audio file data.
Parameters:
inputStream - the input stream from which the AudioInputStream should be constructed.
medialength -
Returns:
an AudioInputStream object based on the audio file data contained in the input stream.

getAudioInputStream

public AudioInputStream getAudioInputStream(URL url)
            throws UnsupportedAudioFileException,
                   IOException
Obtains an audio input stream from the URL provided. The URL must point to valid audio file data.
Parameters:
url - the URL for which the AudioInputStream should be constructed.
Returns:
an AudioInputStream object based on the audio file data pointed to by the URL.

readInt

private static int readInt(byte[] data,
                           int offset)
Converts Little Endian (Windows) bytes to an int (Java uses Big Endian).
Parameters:
data - the data to read.
offset - the offset from which to start reading.
Returns:
the integer value of the reassembled bytes.

Copyright © 1999-2004 Wimba S.A. All Rights Reserved.