Package org.xiph.speex.spi
Class SpeexFormatConvertionProvider
- java.lang.Object
-
- javax.sound.sampled.spi.FormatConversionProvider
-
- org.xiph.speex.spi.SpeexFormatConvertionProvider
-
public class SpeexFormatConvertionProvider extends javax.sound.sampled.spi.FormatConversionProviderA format conversion provider provides format conversion services from one or more input formats to one or more output formats. Converters include codecs, which encode and/or decode audio data, as well as transcoders, etc. Format converters provide methods for determining what conversions are supported and for obtaining an audio stream from which converted data can be read. The source format represents the format of the incoming audio data, which will be converted. The target format represents the format of the processed, converted audio data. This is the format of the data that can be read from the stream returned by one of the getAudioInputStream methods.- Version:
- $Revision: 1.2 $
- Author:
- Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
-
-
Field Summary
Fields Modifier and Type Field Description static javax.sound.sampled.AudioFormat.Encoding[]BOTH_ENCODINGSstatic javax.sound.sampled.AudioFormat.Encoding[]NO_ENCODINGstatic javax.sound.sampled.AudioFormat[]NO_FORMATstatic javax.sound.sampled.AudioFormat.Encoding[]PCM_ENCODINGstatic javax.sound.sampled.AudioFormat.Encoding[]SPEEX_ENCODING
-
Constructor Summary
Constructors Constructor Description SpeexFormatConvertionProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.sound.sampled.AudioInputStreamgetAudioInputStream(javax.sound.sampled.AudioFormat.Encoding targetEncoding, javax.sound.sampled.AudioInputStream sourceStream)Obtains an audio input stream with the specified encoding from the given audio input stream.javax.sound.sampled.AudioInputStreamgetAudioInputStream(javax.sound.sampled.AudioFormat targetFormat, javax.sound.sampled.AudioInputStream sourceStream)Obtains an audio input stream with the specified format from the given audio input stream.javax.sound.sampled.AudioFormat.Encoding[]getSourceEncodings()Obtains the set of source format encodings from which format conversion services are provided by this provider.javax.sound.sampled.AudioFormat.Encoding[]getTargetEncodings()Obtains the set of target format encodings to which format conversion services are provided by this provider.javax.sound.sampled.AudioFormat.Encoding[]getTargetEncodings(javax.sound.sampled.AudioFormat sourceFormat)Obtains the set of target format encodings supported by the format converter given a particular source format.javax.sound.sampled.AudioFormat[]getTargetFormats(javax.sound.sampled.AudioFormat.Encoding targetEncoding, javax.sound.sampled.AudioFormat sourceFormat)Obtains the set of target formats with the encoding specified supported by the format converter.
-
-
-
Field Detail
-
NO_ENCODING
public static final javax.sound.sampled.AudioFormat.Encoding[] NO_ENCODING
-
PCM_ENCODING
public static final javax.sound.sampled.AudioFormat.Encoding[] PCM_ENCODING
-
SPEEX_ENCODING
public static final javax.sound.sampled.AudioFormat.Encoding[] SPEEX_ENCODING
-
BOTH_ENCODINGS
public static final javax.sound.sampled.AudioFormat.Encoding[] BOTH_ENCODINGS
-
NO_FORMAT
public static final javax.sound.sampled.AudioFormat[] NO_FORMAT
-
-
Method Detail
-
getSourceEncodings
public javax.sound.sampled.AudioFormat.Encoding[] getSourceEncodings()
Obtains the set of source format encodings from which format conversion services are provided by this provider.- Specified by:
getSourceEncodingsin classjavax.sound.sampled.spi.FormatConversionProvider- Returns:
- array of source format encodings. The array will always have a length of at least 1.
-
getTargetEncodings
public javax.sound.sampled.AudioFormat.Encoding[] getTargetEncodings()
Obtains the set of target format encodings to which format conversion services are provided by this provider.- Specified by:
getTargetEncodingsin classjavax.sound.sampled.spi.FormatConversionProvider- Returns:
- array of target format encodings. The array will always have a length of at least 1.
-
getTargetEncodings
public javax.sound.sampled.AudioFormat.Encoding[] getTargetEncodings(javax.sound.sampled.AudioFormat sourceFormat)
Obtains the set of target format encodings supported by the format converter given a particular source format. If no target format encodings are supported for this source format, an array of length 0 is returned.- Specified by:
getTargetEncodingsin classjavax.sound.sampled.spi.FormatConversionProvider- Parameters:
sourceFormat- format of the incoming data.- Returns:
- array of supported target format encodings.
-
getTargetFormats
public javax.sound.sampled.AudioFormat[] getTargetFormats(javax.sound.sampled.AudioFormat.Encoding targetEncoding, javax.sound.sampled.AudioFormat sourceFormat)Obtains the set of target formats with the encoding specified supported by the format converter. If no target formats with the specified encoding are supported for this source format, an array of length 0 is returned.- Specified by:
getTargetFormatsin classjavax.sound.sampled.spi.FormatConversionProvider- Parameters:
targetEncoding- desired encoding of the outgoing data.sourceFormat- format of the incoming data.- Returns:
- array of supported target formats.
-
getAudioInputStream
public javax.sound.sampled.AudioInputStream getAudioInputStream(javax.sound.sampled.AudioFormat.Encoding targetEncoding, javax.sound.sampled.AudioInputStream sourceStream)Obtains an audio input stream with the specified encoding from the given audio input stream.- Specified by:
getAudioInputStreamin classjavax.sound.sampled.spi.FormatConversionProvider- Parameters:
targetEncoding- - desired encoding of the stream after processing.sourceStream- - stream from which data to be processed should be read.- Returns:
- stream from which processed data with the specified target encoding may be read.
- Throws:
java.lang.IllegalArgumentException- - if the format combination supplied is not supported.
-
getAudioInputStream
public javax.sound.sampled.AudioInputStream getAudioInputStream(javax.sound.sampled.AudioFormat targetFormat, javax.sound.sampled.AudioInputStream sourceStream)Obtains an audio input stream with the specified format from the given audio input stream.- Specified by:
getAudioInputStreamin classjavax.sound.sampled.spi.FormatConversionProvider- Parameters:
targetFormat- - desired data format of the stream after processing.sourceStream- - stream from which data to be processed should be read.- Returns:
- stream from which processed data with the specified format may be read.
- Throws:
java.lang.IllegalArgumentException- - if the format combination supplied is not supported.
-
-