Commit 92029ed0 by olly Committed by Oliver Woodman

Un-deprecate Format.pcmEncoding and switch tests back to it.

This change precedes one that will remove Format.encoding.

PiperOrigin-RevId: 322619495
parent 21fe2f1e
Showing with 72 additions and 73 deletions
......@@ -767,8 +767,8 @@ public final class Format implements Parcelable {
* The audio sampling rate in Hz, or {@link #NO_VALUE} if unknown or not applicable.
*/
public final int sampleRate;
/** @deprecated Use {@link #encoding}. */
@Deprecated @C.PcmEncoding public final int pcmEncoding;
/** The {@link C.PcmEncoding} for PCM audio. Set to {@link #NO_VALUE} for other media types. */
@C.PcmEncoding public final int pcmEncoding;
/** The {@link C.Encoding} for audio. Set to {@link #NO_VALUE} for other media types. */
@C.Encoding public final int encoding;
/**
......@@ -1214,7 +1214,6 @@ public final class Format implements Parcelable {
}
// Some fields are deprecated but they're still assigned below.
@SuppressWarnings("deprecation")
/* package */ Format(
@Nullable String id,
@Nullable String label,
......@@ -1301,7 +1300,7 @@ public final class Format implements Parcelable {
}
// Some fields are deprecated but they're still assigned below.
@SuppressWarnings({"ResourceType", "deprecation"})
@SuppressWarnings({"ResourceType"})
/* package */ Format(Parcel in) {
id = in.readString();
label = in.readString();
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 853333
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 1792000
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 2645333
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -14,7 +14,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -14,7 +14,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -13,7 +13,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -13,7 +13,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 853333
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 1792000
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 2730666
flags = 1
......
......@@ -13,7 +13,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 853333
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 1792000
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 2645333
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 18432
channelCount = 2
sampleRate = 44000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 18432
channelCount = 2
sampleRate = 44000
encoding = 2
pcmEncoding = 2
sample 0:
time = 837818
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 18432
channelCount = 2
sampleRate = 44000
encoding = 2
pcmEncoding = 2
sample 0:
time = 1780363
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 18432
channelCount = 2
sampleRate = 44000
encoding = 2
pcmEncoding = 2
sample 0:
time = 2618181
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 18432
channelCount = 2
sampleRate = 44000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 853333
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 1792000
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 2645333
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[TXXX: description=ID: value=105519843, TIT2: description=null: value=那么爱你为什么, TPE1: description=null: value=阿强, TALB: description=null: value=华丽的外衣, TXXX: description=ID: value=105519843, APIC: mimeType=image/jpeg, description=]
sample 0:
time = 0
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[TXXX: description=ID: value=105519843, TIT2: description=null: value=那么爱你为什么, TPE1: description=null: value=阿强, TALB: description=null: value=华丽的外衣, TXXX: description=ID: value=105519843, APIC: mimeType=image/jpeg, description=]
sample 0:
time = 853333
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[TXXX: description=ID: value=105519843, TIT2: description=null: value=那么爱你为什么, TPE1: description=null: value=阿强, TALB: description=null: value=华丽的外衣, TXXX: description=ID: value=105519843, APIC: mimeType=image/jpeg, description=]
sample 0:
time = 1792000
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[TXXX: description=ID: value=105519843, TIT2: description=null: value=那么爱你为什么, TPE1: description=null: value=阿强, TALB: description=null: value=华丽的外衣, TXXX: description=ID: value=105519843, APIC: mimeType=image/jpeg, description=]
sample 0:
time = 2645333
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[TXXX: description=ID: value=105519843, TIT2: description=null: value=那么爱你为什么, TPE1: description=null: value=阿强, TALB: description=null: value=华丽的外衣, TXXX: description=ID: value=105519843, APIC: mimeType=image/jpeg, description=]
sample 0:
time = 0
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[Picture: mimeType=image/png, description=]
sample 0:
time = 0
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[Picture: mimeType=image/png, description=]
sample 0:
time = 853333
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[Picture: mimeType=image/png, description=]
sample 0:
time = 1792000
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[Picture: mimeType=image/png, description=]
sample 0:
time = 2645333
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[Picture: mimeType=image/png, description=]
sample 0:
time = 0
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[VC: TITLE=test title, VC: ARTIST=test artist]
sample 0:
time = 0
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[VC: TITLE=test title, VC: ARTIST=test artist]
sample 0:
time = 853333
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[VC: TITLE=test title, VC: ARTIST=test artist]
sample 0:
time = 1792000
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[VC: TITLE=test title, VC: ARTIST=test artist]
sample 0:
time = 2645333
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 16384
channelCount = 2
sampleRate = 48000
encoding = 2
pcmEncoding = 2
metadata = entries=[VC: TITLE=test title, VC: ARTIST=test artist]
sample 0:
time = 0
......
config:
encoding = 2 (16 bit)
channel count = 2
sample rate = 48000
pcmEncoding = 2
channelCount = 2
sampleRate = 48000
buffer:
time = 1000
data = 1217833679
......
config:
encoding = 536870912 (24 bit)
channel count = 2
sample rate = 48000
pcmEncoding = 536870912
channelCount = 2
sampleRate = 48000
buffer:
time = 0
data = 225023649
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 333333
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 666666
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 1000000
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 339395
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 678790
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 1018185
flags = 1
......
......@@ -16,7 +16,7 @@ track 0:
maxInputSize = 8820
channelCount = 1
sampleRate = 44100
encoding = 2
pcmEncoding = 2
sample 0:
time = 0
flags = 1
......
......@@ -19,11 +19,11 @@ import static com.google.common.truth.Truth.assertWithMessage;
import android.content.Context;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.audio.AudioSink;
import com.google.android.exoplayer2.audio.ForwardingAudioSink;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.Util;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
......@@ -131,24 +131,24 @@ public final class CapturingAudioSink extends ForwardingAudioSink implements Dum
private static final class DumpableConfiguration implements Dumper.Dumpable {
private final int inputEncoding;
@C.PcmEncoding private final int inputPcmEncoding;
private final int inputChannelCount;
private final int inputSampleRate;
public DumpableConfiguration(int inputEncoding, int inputChannelCount, int inputSampleRate) {
this.inputEncoding = inputEncoding;
public DumpableConfiguration(
@C.PcmEncoding int inputPcmEncoding, int inputChannelCount, int inputSampleRate) {
this.inputPcmEncoding = inputPcmEncoding;
this.inputChannelCount = inputChannelCount;
this.inputSampleRate = inputSampleRate;
}
@Override
public void dump(Dumper dumper) {
int bitDepth = (Util.getPcmFrameSize(inputEncoding, /* channelCount= */ 1) * 8);
dumper
.startBlock("config")
.add("encoding", inputEncoding + " (" + bitDepth + " bit)")
.add("channel count", inputChannelCount)
.add("sample rate", inputSampleRate)
.add("pcmEncoding", inputPcmEncoding)
.add("channelCount", inputChannelCount)
.add("sampleRate", inputSampleRate)
.endBlock();
}
}
......
......@@ -312,7 +312,7 @@ public final class FakeTrackOutput implements TrackOutput, Dumper.Dumpable {
addIfNonDefault(dumper, "pixelWidthHeightRatio", format -> format.pixelWidthHeightRatio);
addIfNonDefault(dumper, "channelCount", format -> format.channelCount);
addIfNonDefault(dumper, "sampleRate", format -> format.sampleRate);
addIfNonDefault(dumper, "encoding", format -> format.encoding);
addIfNonDefault(dumper, "pcmEncoding", format -> format.pcmEncoding);
addIfNonDefault(dumper, "encoderDelay", format -> format.encoderDelay);
addIfNonDefault(dumper, "encoderPadding", format -> format.encoderPadding);
addIfNonDefault(dumper, "subsampleOffsetUs", format -> format.subsampleOffsetUs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment