org.tritonus.sampled.convert.lame
Class Mp3LameFormatConversionProvider
java.lang.Object
javax.sound.sampled.spi.FormatConversionProvider
org.tritonus.share.sampled.convert.TFormatConversionProvider
org.tritonus.share.sampled.convert.TSimpleFormatConversionProvider
org.tritonus.sampled.convert.lame.Mp3LameFormatConversionProvider
- public class Mp3LameFormatConversionProvider
- extends TSimpleFormatConversionProvider
ConversionProvider for encoding MP3 audio files with the lame lib.
It uses a sloppy implementation of the MPEG1L3 encoding:
It is used as a common denominator. So users can always ask for
MPEG1L3 encoding but may get in fact an MPEG2L3 or MPEG2.5L3 encoded
stream.
- Author:
- Florian Bomers
Method Summary |
AudioInputStream |
getAudioInputStream(AudioFormat targetFormat,
AudioInputStream audioInputStream)
|
protected AudioFormat |
getDefaultTargetFormat(AudioFormat targetFormat,
AudioFormat sourceFormat,
boolean allowNotSpecified)
|
protected int |
getFrameSize(AudioFormat.Encoding encoding,
float sampleRate,
int sampleSize,
int channels,
float frameRate,
boolean bigEndian,
int oldFrameSize)
Calculates the frame size for the given format 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. |
Methods inherited from class org.tritonus.share.sampled.convert.TSimpleFormatConversionProvider |
disable, doMatch, doMatch, getCollectionSourceEncodings, getCollectionSourceFormats, getCollectionTargetEncodings, getCollectionTargetFormats, getSourceEncodings, getTargetEncodings, getTargetEncodings, isAllowedSourceEncoding, isAllowedSourceFormat, isAllowedTargetEncoding, isAllowedTargetFormat, isSourceEncodingSupported, isTargetEncodingSupported, replaceNotSpecified |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MPEG1L3
public static final AudioFormat.Encoding MPEG1L3
MPEG2L3
public static final AudioFormat.Encoding MPEG2L3
MPEG2DOT5L3
public static final AudioFormat.Encoding MPEG2DOT5L3
Mp3LameFormatConversionProvider
public Mp3LameFormatConversionProvider()
- Constructor.
getAudioInputStream
public AudioInputStream getAudioInputStream(AudioFormat targetFormat,
AudioInputStream audioInputStream)
- Specified by:
getAudioInputStream
in class FormatConversionProvider
getTargetFormats
public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding,
AudioFormat sourceFormat)
- Description copied from class:
TSimpleFormatConversionProvider
- This implementation assumes that the converter can convert
from each of its source formats to each of its target
formats. If this is not the case, the converter has to
override this method.
- Overrides:
getTargetFormats
in class TSimpleFormatConversionProvider
getDefaultTargetFormat
protected AudioFormat getDefaultTargetFormat(AudioFormat targetFormat,
AudioFormat sourceFormat,
boolean allowNotSpecified)
getFrameSize
protected int getFrameSize(AudioFormat.Encoding encoding,
float sampleRate,
int sampleSize,
int channels,
float frameRate,
boolean bigEndian,
int oldFrameSize)
- Description copied from class:
TSimpleFormatConversionProvider
- Calculates the frame size for the given format description.
The default implementation returns AudioSystem.NOT_SPECIFIED
if either
sampleSize
or channels
is AudioSystem.NOT_SPECIFIED,
otherwise sampleSize*channels/8
is returned.
If this does not reflect the way to calculate the right frame size,
inheriting classes should overwrite this method if they use
replaceNotSpecified(...). It is not used elsewhere in this class.
- Overrides:
getFrameSize
in class TSimpleFormatConversionProvider