public abstract class TEncodingFormatConversionProvider extends TSimpleFormatConversionProvider
It is assumed that each source format can be encoded to all target formats.
In the sourceFormats and targetFormats collections that are passed to the constructor of this class, fields may be set to AudioSystem.NOT_SPECIFIED. This means that it handles all values of that field, but cannot change it.
This class prevents that a conversion is done (e.g. for sample rates), because the overriding class specified AudioSystem.NOT_SPECIFIED as sample rate, meaning it handles all sample rates.
Overriding classes must implement at least
AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream)
and provide a constructor that calls the protected constructor of this class.
Modifier and Type | Method and Description |
---|---|
AudioFormat[] |
getTargetFormats(AudioFormat.Encoding targetEncoding,
AudioFormat sourceFormat)
This implementation assumes that the converter can convert
from each of its source formats to each of its target
formats.
|
getSourceEncodings, getTargetEncodings, getTargetEncodings, isSourceEncodingSupported, isTargetEncodingSupported
getAudioInputStream, getMatchingFormat, isConversionSupported
getAudioInputStream, isConversionSupported
public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat)
When conversion is supported, for every target encoding, the fields sample size in bits, channels and sample rate are checked:
replaceNotSpecified(sourceFormat, targetFormat)
in the base
class TSimpleFormatConversionProvider is used - and accordingly, the frameSize
is recalculated with getFrameSize(...)
if a field with AudioSystem.NOT_SPECIFIED
is replaced. Inheriting classes may wish to override this method if the
default mode of calculating the frame size is not appropriate.getTargetFormats
in class TSimpleFormatConversionProvider