Interface AudioProcessor
-
- All Known Implementing Classes:
BaseAudioProcessor
,ChannelMixingAudioProcessor
,SilenceSkippingAudioProcessor
,SonicAudioProcessor
,TeeAudioProcessor
,ToInt16PcmAudioProcessor
@Deprecated public interface AudioProcessor
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 Class Summary
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 givenAudioProcessor.AudioFormat
can not be handled.
-
Field Summary
Fields Modifier and Type Field Description static ByteBuffer
EMPTY_BUFFER
Deprecated.An empty, directByteBuffer
.
-
Method Summary
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 fromgetOutput()
untilflush()
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 theinputBuffer
for processing.void
reset()
Deprecated.Resets the processor to its unconfigured state, releasing any resources.
-
-
-
Field Detail
-
EMPTY_BUFFER
static final ByteBuffer EMPTY_BUFFER
Deprecated.An empty, directByteBuffer
.
-
-
Method Detail
-
configure
@CanIgnoreReturnValue AudioProcessor.AudioFormat configure(AudioProcessor.AudioFormat inputAudioFormat) throws AudioProcessor.UnhandledAudioFormatException
Deprecated.Configures the processor to process input audio with the specified format. After calling this method, callisActive()
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. CallqueueEndOfStream()
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 toflush()
.- 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.
-
isActive
boolean isActive()
Deprecated.Returns whether the processor is configured and will process input buffers.
-
queueInput
void queueInput(ByteBuffer inputBuffer)
Deprecated.Queues audio data between the position and limit of theinputBuffer
for processing. After calling this method, processed output may be available viagetOutput()
. CallingqueueInput(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.
-
queueEndOfStream
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 toflush()
. CallinggetOutput()
will return any remaining output data. Multiple calls may be required to read all of the remaining output data.isEnded()
will returntrue
once all remaining output data has been read.
-
getOutput
ByteBuffer 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.
-
isEnded
boolean isEnded()
Deprecated.Returns whether this processor will return no more output fromgetOutput()
untilflush()
has been called and more input has been queued.
-
flush
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.
-
reset
void reset()
Deprecated.Resets the processor to its unconfigured state, releasing any resources.
-
-