Class BaseAudioProcessor
- java.lang.Object
-
- com.google.android.exoplayer2.audio.BaseAudioProcessor
-
- All Implemented Interfaces:
AudioProcessor
- Direct Known Subclasses:
ChannelMixingAudioProcessor
,SilenceSkippingAudioProcessor
,TeeAudioProcessor
,ToInt16PcmAudioProcessor
@Deprecated public abstract class BaseAudioProcessor extends Object implements 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.Base class for audio processors that keep an output buffer and an internal buffer that is reused whenever input is queued. Subclasses should overrideonConfigure(AudioFormat)
to return the output audio format for the processor if it's active.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.audio.AudioProcessor
AudioProcessor.AudioFormat, AudioProcessor.UnhandledAudioFormatException
-
-
Field Summary
Fields Modifier and Type Field Description protected AudioProcessor.AudioFormat
inputAudioFormat
Deprecated.The current input audio format.protected AudioProcessor.AudioFormat
outputAudioFormat
Deprecated.The current output audio format.-
Fields inherited from interface com.google.android.exoplayer2.audio.AudioProcessor
EMPTY_BUFFER
-
-
Constructor Summary
Constructors Constructor Description BaseAudioProcessor()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete 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.protected boolean
hasPendingOutput()
Deprecated.Returns whether the current output buffer has any data remaining.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 fromAudioProcessor.getOutput()
untilAudioProcessor.flush()
has been called and more input has been queued.protected AudioProcessor.AudioFormat
onConfigure(AudioProcessor.AudioFormat inputAudioFormat)
Deprecated.Called when the processor is configured for a new input format.protected void
onFlush()
Deprecated.Called when the processor is flushed, directly or as part of resetting.protected void
onQueueEndOfStream()
Deprecated.Called when the end-of-stream is queued to the processor.protected void
onReset()
Deprecated.Called when the processor is reset.void
queueEndOfStream()
Deprecated.Queues an end of stream signal.protected ByteBuffer
replaceOutputBuffer(int size)
Deprecated.Replaces the current output buffer with a buffer of at leastsize
bytes and returns it.void
reset()
Deprecated.Resets the processor to its unconfigured state, releasing any resources.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.android.exoplayer2.audio.AudioProcessor
queueInput
-
-
-
-
Field Detail
-
inputAudioFormat
protected AudioProcessor.AudioFormat inputAudioFormat
Deprecated.The current input audio format.
-
outputAudioFormat
protected AudioProcessor.AudioFormat outputAudioFormat
Deprecated.The current output audio format.
-
-
Method Detail
-
configure
@CanIgnoreReturnValue public final AudioProcessor.AudioFormat configure(AudioProcessor.AudioFormat inputAudioFormat) throws AudioProcessor.UnhandledAudioFormatException
Deprecated.Description copied from interface:AudioProcessor
Configures the processor to process input audio with the specified format. After calling this method, callAudioProcessor.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
AudioProcessor.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. CallAudioProcessor.queueEndOfStream()
when no more input will be supplied in the old input format.- Specified by:
configure
in interfaceAudioProcessor
- Parameters:
inputAudioFormat
- The format of audio that will be queued after the next call toAudioProcessor.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.
-
isActive
public boolean isActive()
Deprecated.Description copied from interface:AudioProcessor
Returns whether the processor is configured and will process input buffers.- Specified by:
isActive
in interfaceAudioProcessor
-
queueEndOfStream
public final void queueEndOfStream()
Deprecated.Description copied from interface:AudioProcessor
Queues an end of stream signal. After this method has been called,AudioProcessor.queueInput(ByteBuffer)
may not be called until after the next call toAudioProcessor.flush()
. CallingAudioProcessor.getOutput()
will return any remaining output data. Multiple calls may be required to read all of the remaining output data.AudioProcessor.isEnded()
will returntrue
once all remaining output data has been read.- Specified by:
queueEndOfStream
in interfaceAudioProcessor
-
getOutput
@CallSuper public ByteBuffer getOutput()
Deprecated.Description copied from interface:AudioProcessor
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.- Specified by:
getOutput
in interfaceAudioProcessor
- Returns:
- A buffer containing processed output data between its position and limit.
-
isEnded
@CallSuper public boolean isEnded()
Deprecated.Description copied from interface:AudioProcessor
Returns whether this processor will return no more output fromAudioProcessor.getOutput()
untilAudioProcessor.flush()
has been called and more input has been queued.- Specified by:
isEnded
in interfaceAudioProcessor
-
flush
public final void flush()
Deprecated.Description copied from interface:AudioProcessor
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.- Specified by:
flush
in interfaceAudioProcessor
-
reset
public final void reset()
Deprecated.Description copied from interface:AudioProcessor
Resets the processor to its unconfigured state, releasing any resources.- Specified by:
reset
in interfaceAudioProcessor
-
replaceOutputBuffer
protected final ByteBuffer replaceOutputBuffer(int size)
Deprecated.Replaces the current output buffer with a buffer of at leastsize
bytes and returns it. Callers should write to the returned buffer thenByteBuffer.flip()
it so it can be read viagetOutput()
.
-
hasPendingOutput
protected final boolean hasPendingOutput()
Deprecated.Returns whether the current output buffer has any data remaining.
-
onConfigure
@CanIgnoreReturnValue protected AudioProcessor.AudioFormat onConfigure(AudioProcessor.AudioFormat inputAudioFormat) throws AudioProcessor.UnhandledAudioFormatException
Deprecated.Called when the processor is configured for a new input format.
-
onQueueEndOfStream
protected void onQueueEndOfStream()
Deprecated.Called when the end-of-stream is queued to the processor.
-
onFlush
protected void onFlush()
Deprecated.Called when the processor is flushed, directly or as part of resetting.
-
onReset
protected void onReset()
Deprecated.Called when the processor is reset.
-
-