Class AudioDecoderFactory
AudioDecoder instances.
Decoders must be instantiated through create(InputStream, String, int[]). This factory provides several
built-in AudioDecoder implementations, including PCM, G711, MP3, and Ogg Vorbis.
Additional decoders can be provided using the Java ServiceLoader mechanism. Such decoders must
implement the AudioDecoder interface and be properly registered as services.
For non-built-in decoders, the concrete implementation is selected and instantiated based on its declared decoder name.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.microej.audiomockdecoder.AudioDecodercreate(InputStream inputStream, String formatEncoding, int[] formatParameters) Returns an instance ofAudioDecoderdepending on theformatEncoding.
-
Method Details
-
create
public static com.microej.audiomockdecoder.AudioDecoder create(InputStream inputStream, String formatEncoding, int[] formatParameters) throws ej.sni.NativeIOException Returns an instance ofAudioDecoderdepending on theformatEncoding.Provides dynamic loading of audio decoders using the Java
ServiceLoadermechanism.This class loads implementations of
AudioDecoderdeclared as services.The fully qualified name of each
AudioDecoderimplementation must be declared inMETA-INF/services/com.microej.audiomockdecoder.AudioDecoder.- Parameters:
inputStream- theInputStreamrequired by theAudioDecoderformatEncoding- theStringrepresenting the encoding format (PCM, G711, MP3, Ogg Vorbis, ...)formatParameters- theint[]representing the format parameters; not used if the parameters are defined in theinputStream(MP3, Ogg Vorbis, ...)- Returns:
- an instance of
AudioDecoder - Throws:
ej.sni.NativeIOException- if the format parameters are incorrect or if theformatEncodingis unsupported
-