docs/doc/reference/com/google/android/exoplayer2/audio/AudioProcessor.html
Package com.google.android.exoplayer2.audio
BaseAudioProcessor, ChannelMixingAudioProcessor, SilenceSkippingAudioProcessor, SonicAudioProcessor, TeeAudioProcessor, ToInt16PcmAudioProcessor[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceAudioProcessor
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Interface for audio processors, which take audio data as input and transform it, potentially modifying its channel count, encoding and/or sample rate.
In addition to being able to modify the format of audio, implementations may allow parameters to be set that affect the output audio and whether the processor is active/inactive.
Nested Classes | Modifier and Type | Interface | Description |
| --- | --- | --- |
| static class | AudioProcessor.AudioFormat |
Deprecated.
PCM audio format that may be handled by an audio processor.
|
| static class | AudioProcessor.UnhandledAudioFormatException |
Deprecated.
Exception thrown when the given AudioProcessor.AudioFormat can not be handled.
|
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static ByteBuffer | EMPTY_BUFFER |
Deprecated.
An empty, direct ByteBuffer.
|
All Methods Instance Methods Abstract Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| AudioProcessor.AudioFormat | configure(AudioProcessor.AudioFormat inputAudioFormat) |
Deprecated.
Configures the processor to process input audio with the specified format.
|
| void | flush() |
Deprecated.
Clears any buffered data and pending output.
|
| ByteBuffer | getOutput() |
Deprecated.
Returns a buffer containing processed output data between its position and limit.
|
| boolean | isActive() |
Deprecated.
Returns whether the processor is configured and will process input buffers.
|
| boolean | isEnded() |
Deprecated.
Returns whether this processor will return no more output from getOutput() until flush() has been called and more input has been queued.
|
| void | queueEndOfStream() |
Deprecated.
Queues an end of stream signal.
|
| void | queueInput(ByteBuffer inputBuffer) |
Deprecated.
Queues audio data between the position and limit of the inputBuffer for processing.
|
| void | reset() |
Deprecated.
Resets the processor to its unconfigured state, releasing any resources. |
-
static final[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")EMPTY_BUFFER
Deprecated.
An empty, direct ByteBuffer.
-
@CanIgnoreReturnValue[AudioProcessor.AudioFormat](AudioProcessor.AudioFormat.html "class in com.google.android.exoplayer2.audio")configure([AudioProcessor.AudioFormat](AudioProcessor.AudioFormat.html "class in com.google.android.exoplayer2.audio")inputAudioFormat)
throws[AudioProcessor.UnhandledAudioFormatException](AudioProcessor.UnhandledAudioFormatException.html "class in com.google.android.exoplayer2.audio")
Deprecated.
Configures the processor to process input audio with the specified format. After calling this method, call isActive() to determine whether the audio processor is active. Returns the configured output audio format if this instance is active.
After calling this method, it is necessary to flush() the processor to apply the new configuration. Before applying the new configuration, it is safe to queue input and get output in the old input/output formats. Call queueEndOfStream() when no more input will be supplied in the old input format.
Parameters:inputAudioFormat - The format of audio that will be queued after the next call to flush().Returns:The configured output audio format if this instance is active.Throws:AudioProcessor.UnhandledAudioFormatException - Thrown if the specified format can't be handled as input.
-
boolean isActive()
Deprecated.
Returns whether the processor is configured and will process input buffers.
-
void queueInput([ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")inputBuffer)
Deprecated.
Queues audio data between the position and limit of the inputBuffer for processing. After calling this method, processed output may be available via getOutput(). Calling queueInput(ByteBuffer) again invalidates any pending output.
Parameters:inputBuffer - The input buffer to process. It must be a direct byte buffer with native byte order. Its contents are treated as read-only. Its position will be advanced by the number of bytes consumed (which may be zero). The caller retains ownership of the provided buffer.
-
void queueEndOfStream()
Deprecated.
Queues an end of stream signal. After this method has been called, queueInput(ByteBuffer) may not be called until after the next call to flush(). Calling getOutput() will return any remaining output data. Multiple calls may be required to read all of the remaining output data. isEnded() will return true once all remaining output data has been read.
-
[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")getOutput()
Deprecated.
Returns a buffer containing processed output data between its position and limit. The buffer will always be a direct byte buffer with native byte order. Calling this method invalidates any previously returned buffer. The buffer will be empty if no output is available. Returns:A buffer containing processed output data between its position and limit.
-
boolean isEnded()
Deprecated.
Returns whether this processor will return no more output from getOutput() until flush() has been called and more input has been queued.
-
void flush()
Deprecated.
Clears any buffered data and pending output. If the audio processor is active, also prepares the audio processor to receive a new stream of input in the last configured (pending) format.
-
void reset()
Deprecated.
Resets the processor to its unconfigured state, releasing any resources.