mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove deprecated androidx.media3.exoplayer.audio.SonicAudioProcessor
Also, make `androidx.media3.common.audio.SonicAudioProcessor` final. PiperOrigin-RevId: 720987023
This commit is contained in:
parent
98f52a1dbb
commit
fc6df77831
@ -9,6 +9,7 @@
|
|||||||
* Extractors:
|
* Extractors:
|
||||||
* DataSource:
|
* DataSource:
|
||||||
* Audio:
|
* Audio:
|
||||||
|
* Make `androidx.media3.common.audio.SonicAudioProcessor` final.
|
||||||
* Video:
|
* Video:
|
||||||
* Text:
|
* Text:
|
||||||
* Metadata:
|
* Metadata:
|
||||||
@ -35,6 +36,7 @@
|
|||||||
* Test Utilities:
|
* Test Utilities:
|
||||||
* Demo app:
|
* Demo app:
|
||||||
* Remove deprecated symbols:
|
* Remove deprecated symbols:
|
||||||
|
* Removed `androidx.media3.exoplayer.audio.SonicAudioProcessor`.
|
||||||
|
|
||||||
## 1.6
|
## 1.6
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ import java.nio.ShortBuffer;
|
|||||||
* An {@link AudioProcessor} that uses the Sonic library to modify audio speed/pitch/sample rate.
|
* An {@link AudioProcessor} that uses the Sonic library to modify audio speed/pitch/sample rate.
|
||||||
*/
|
*/
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
public class SonicAudioProcessor implements AudioProcessor {
|
public final class SonicAudioProcessor implements AudioProcessor {
|
||||||
|
|
||||||
/** Indicates that the output sample rate should be the same as the input. */
|
/** Indicates that the output sample rate should be the same as the input. */
|
||||||
public static final int SAMPLE_RATE_NO_CHANGE = -1;
|
public static final int SAMPLE_RATE_NO_CHANGE = -1;
|
||||||
@ -100,7 +100,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
*
|
*
|
||||||
* @param speed The target factor by which playback should be sped up.
|
* @param speed The target factor by which playback should be sped up.
|
||||||
*/
|
*/
|
||||||
public final void setSpeed(@FloatRange(from = 0f, fromInclusive = false) float speed) {
|
public void setSpeed(@FloatRange(from = 0f, fromInclusive = false) float speed) {
|
||||||
checkArgument(speed > 0f);
|
checkArgument(speed > 0f);
|
||||||
if (this.speed != speed) {
|
if (this.speed != speed) {
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
@ -115,7 +115,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
*
|
*
|
||||||
* @param pitch The target pitch.
|
* @param pitch The target pitch.
|
||||||
*/
|
*/
|
||||||
public final void setPitch(@FloatRange(from = 0f, fromInclusive = false) float pitch) {
|
public void setPitch(@FloatRange(from = 0f, fromInclusive = false) float pitch) {
|
||||||
checkArgument(pitch > 0f);
|
checkArgument(pitch > 0f);
|
||||||
if (this.pitch != pitch) {
|
if (this.pitch != pitch) {
|
||||||
this.pitch = pitch;
|
this.pitch = pitch;
|
||||||
@ -131,7 +131,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
* @param sampleRateHz The sample rate for output audio, in Hertz.
|
* @param sampleRateHz The sample rate for output audio, in Hertz.
|
||||||
* @see #configure(AudioFormat)
|
* @see #configure(AudioFormat)
|
||||||
*/
|
*/
|
||||||
public final void setOutputSampleRateHz(int sampleRateHz) {
|
public void setOutputSampleRateHz(int sampleRateHz) {
|
||||||
checkArgument(sampleRateHz == SAMPLE_RATE_NO_CHANGE || sampleRateHz > 0);
|
checkArgument(sampleRateHz == SAMPLE_RATE_NO_CHANGE || sampleRateHz > 0);
|
||||||
pendingOutputSampleRate = sampleRateHz;
|
pendingOutputSampleRate = sampleRateHz;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
* @param playoutDuration The playout duration to scale.
|
* @param playoutDuration The playout duration to scale.
|
||||||
* @return The corresponding media duration, in the same units as {@code duration}.
|
* @return The corresponding media duration, in the same units as {@code duration}.
|
||||||
*/
|
*/
|
||||||
public final long getMediaDuration(long playoutDuration) {
|
public long getMediaDuration(long playoutDuration) {
|
||||||
if (outputBytes >= MIN_BYTES_FOR_DURATION_SCALING_CALCULATION) {
|
if (outputBytes >= MIN_BYTES_FOR_DURATION_SCALING_CALCULATION) {
|
||||||
long processedInputBytes = inputBytes - checkNotNull(sonic).getPendingInputBytes();
|
long processedInputBytes = inputBytes - checkNotNull(sonic).getPendingInputBytes();
|
||||||
return outputAudioFormat.sampleRate == inputAudioFormat.sampleRate
|
return outputAudioFormat.sampleRate == inputAudioFormat.sampleRate
|
||||||
@ -172,7 +172,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
* @param mediaDuration The media duration to scale.
|
* @param mediaDuration The media duration to scale.
|
||||||
* @return The corresponding playout duration, in the same units as {@code mediaDuration}.
|
* @return The corresponding playout duration, in the same units as {@code mediaDuration}.
|
||||||
*/
|
*/
|
||||||
public final long getPlayoutDuration(long mediaDuration) {
|
public long getPlayoutDuration(long mediaDuration) {
|
||||||
if (outputBytes >= MIN_BYTES_FOR_DURATION_SCALING_CALCULATION) {
|
if (outputBytes >= MIN_BYTES_FOR_DURATION_SCALING_CALCULATION) {
|
||||||
long processedInputBytes = inputBytes - checkNotNull(sonic).getPendingInputBytes();
|
long processedInputBytes = inputBytes - checkNotNull(sonic).getPendingInputBytes();
|
||||||
return outputAudioFormat.sampleRate == inputAudioFormat.sampleRate
|
return outputAudioFormat.sampleRate == inputAudioFormat.sampleRate
|
||||||
@ -187,7 +187,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the number of bytes processed since last flush or reset. */
|
/** Returns the number of bytes processed since last flush or reset. */
|
||||||
public final long getProcessedInputBytes() {
|
public long getProcessedInputBytes() {
|
||||||
return inputBytes - checkNotNull(sonic).getPendingInputBytes();
|
return inputBytes - checkNotNull(sonic).getPendingInputBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,8 +197,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final AudioFormat configure(AudioFormat inputAudioFormat)
|
public AudioFormat configure(AudioFormat inputAudioFormat) throws UnhandledAudioFormatException {
|
||||||
throws UnhandledAudioFormatException {
|
|
||||||
if (inputAudioFormat.encoding != C.ENCODING_PCM_16BIT) {
|
if (inputAudioFormat.encoding != C.ENCODING_PCM_16BIT) {
|
||||||
throw new UnhandledAudioFormatException(inputAudioFormat);
|
throw new UnhandledAudioFormatException(inputAudioFormat);
|
||||||
}
|
}
|
||||||
@ -214,7 +213,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isActive() {
|
public boolean isActive() {
|
||||||
return pendingOutputAudioFormat.sampleRate != Format.NO_VALUE
|
return pendingOutputAudioFormat.sampleRate != Format.NO_VALUE
|
||||||
&& (shouldBeActiveWithDefaultParameters || !areParametersSetToDefaultValues());
|
&& (shouldBeActiveWithDefaultParameters || !areParametersSetToDefaultValues());
|
||||||
}
|
}
|
||||||
@ -226,7 +225,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void queueInput(ByteBuffer inputBuffer) {
|
public void queueInput(ByteBuffer inputBuffer) {
|
||||||
if (!inputBuffer.hasRemaining()) {
|
if (!inputBuffer.hasRemaining()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -239,7 +238,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void queueEndOfStream() {
|
public void queueEndOfStream() {
|
||||||
// TODO(internal b/174554082): assert sonic is non-null here and in getOutput.
|
// TODO(internal b/174554082): assert sonic is non-null here and in getOutput.
|
||||||
if (sonic != null) {
|
if (sonic != null) {
|
||||||
sonic.queueEndOfStream();
|
sonic.queueEndOfStream();
|
||||||
@ -248,7 +247,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final ByteBuffer getOutput() {
|
public ByteBuffer getOutput() {
|
||||||
@Nullable Sonic sonic = this.sonic;
|
@Nullable Sonic sonic = this.sonic;
|
||||||
if (sonic != null) {
|
if (sonic != null) {
|
||||||
int outputSize = sonic.getOutputSize();
|
int outputSize = sonic.getOutputSize();
|
||||||
@ -272,12 +271,12 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isEnded() {
|
public boolean isEnded() {
|
||||||
return inputEnded && (sonic == null || sonic.getOutputSize() == 0);
|
return inputEnded && (sonic == null || sonic.getOutputSize() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void flush() {
|
public void flush() {
|
||||||
if (isActive()) {
|
if (isActive()) {
|
||||||
inputAudioFormat = pendingInputAudioFormat;
|
inputAudioFormat = pendingInputAudioFormat;
|
||||||
outputAudioFormat = pendingOutputAudioFormat;
|
outputAudioFormat = pendingOutputAudioFormat;
|
||||||
@ -300,7 +299,7 @@ public class SonicAudioProcessor implements AudioProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void reset() {
|
public void reset() {
|
||||||
speed = 1f;
|
speed = 1f;
|
||||||
pitch = 1f;
|
pitch = 1f;
|
||||||
pendingInputAudioFormat = AudioFormat.NOT_SET;
|
pendingInputAudioFormat = AudioFormat.NOT_SET;
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package androidx.media3.exoplayer.audio;
|
|
||||||
|
|
||||||
import androidx.media3.common.util.UnstableApi;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link androidx.media3.common.audio.SonicAudioProcessor}.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnstableApi
|
|
||||||
// TODO(b/261567371): Move `final` from common SonicAudioProcessor method signatures to class
|
|
||||||
// signature when removing this file.
|
|
||||||
public final class SonicAudioProcessor extends androidx.media3.common.audio.SonicAudioProcessor {}
|
|
Loading…
x
Reference in New Issue
Block a user