public abstract class BaseAudioDecoder extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Uri |
audioSource |
protected WeakReference<Context> |
contextWeakReference |
protected MediaCodec |
decoder |
protected MediaExtractor |
extractor |
protected AudioDecoderListener |
listener |
protected int |
targetSampleRate |
protected int |
targetSampleType |
| Constructor and Description |
|---|
BaseAudioDecoder(Uri audioSource,
Context context,
int sampleRate,
int sampleType,
AudioDecoderListener listener) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
initMediaComponents() |
protected MediaCodec.BufferInfo |
onInputBufferAvailable(MediaExtractor extractor,
ByteBuffer inputBuffer) |
protected void |
onMediaCodecError(MediaCodec.CodecException e) |
protected SampleBuffer |
onOutputBufferAvailable(ByteBuffer outputBuffer) |
protected void |
onOutputFormatChanged(MediaFormat mediaFormat) |
abstract void |
start() |
void |
stop() |
protected final int targetSampleRate
protected final int targetSampleType
protected MediaExtractor extractor
protected MediaCodec decoder
protected final Uri audioSource
protected final WeakReference<Context> contextWeakReference
protected final AudioDecoderListener listener
public BaseAudioDecoder(@NonNull
Uri audioSource,
@NonNull
Context context,
int sampleRate,
int sampleType,
AudioDecoderListener listener)
audioSource - Uri of the audio source to be convertedcontext - the contextsampleRate - can be either 8000, 16000, 22050 or 44100sampleType - can be either UNSIGNED_8_BIT, SIGNED_16_BIT, FLOATlistener - listener for event callbacksAudioPassThruCapabilities.getSamplingRate(),
AudioStreamManager.SampleTypeprotected MediaCodec.BufferInfo onInputBufferAvailable(@NonNull MediaExtractor extractor, @NonNull ByteBuffer inputBuffer)
protected SampleBuffer onOutputBufferAvailable(@NonNull ByteBuffer outputBuffer)
protected void onOutputFormatChanged(@NonNull
MediaFormat mediaFormat)
protected void onMediaCodecError(@NonNull
MediaCodec.CodecException e)
public abstract void start()
public void stop()