2021-08-09 22:50:52 +00:00
|
|
|
package c.i.a.c.v1;
|
|
|
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import com.google.android.exoplayer2.audio.AudioProcessor;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
import java.util.Objects;
|
|
|
|
/* compiled from: ChannelMappingAudioProcessor */
|
|
|
|
public final class v extends u {
|
|
|
|
@Nullable
|
|
|
|
public int[] i;
|
|
|
|
@Nullable
|
|
|
|
public int[] j;
|
|
|
|
|
|
|
|
@Override // com.google.android.exoplayer2.audio.AudioProcessor
|
|
|
|
public void c(ByteBuffer byteBuffer) {
|
|
|
|
int[] iArr = this.j;
|
|
|
|
Objects.requireNonNull(iArr);
|
|
|
|
int position = byteBuffer.position();
|
|
|
|
int limit = byteBuffer.limit();
|
2021-08-31 07:21:49 +00:00
|
|
|
ByteBuffer j = j(((limit - position) / this.b.e) * this.f1012c.e);
|
2021-08-09 22:50:52 +00:00
|
|
|
while (position < limit) {
|
|
|
|
for (int i : iArr) {
|
|
|
|
j.putShort(byteBuffer.getShort((i * 2) + position));
|
|
|
|
}
|
|
|
|
position += this.b.e;
|
|
|
|
}
|
|
|
|
byteBuffer.position(limit);
|
|
|
|
j.flip();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.v1.u
|
|
|
|
public AudioProcessor.a f(AudioProcessor.a aVar) throws AudioProcessor.UnhandledAudioFormatException {
|
|
|
|
int[] iArr = this.i;
|
|
|
|
if (iArr == null) {
|
|
|
|
return AudioProcessor.a.a;
|
|
|
|
}
|
|
|
|
if (aVar.d == 2) {
|
2021-09-07 07:54:21 +00:00
|
|
|
boolean z2 = aVar.f2282c != iArr.length;
|
2021-08-09 22:50:52 +00:00
|
|
|
int i = 0;
|
|
|
|
while (i < iArr.length) {
|
|
|
|
int i2 = iArr[i];
|
2021-09-07 07:54:21 +00:00
|
|
|
if (i2 < aVar.f2282c) {
|
2021-08-09 22:50:52 +00:00
|
|
|
z2 |= i2 != i;
|
|
|
|
i++;
|
|
|
|
} else {
|
|
|
|
throw new AudioProcessor.UnhandledAudioFormatException(aVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return z2 ? new AudioProcessor.a(aVar.b, iArr.length, 2) : AudioProcessor.a.a;
|
|
|
|
}
|
|
|
|
throw new AudioProcessor.UnhandledAudioFormatException(aVar);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.v1.u
|
|
|
|
public void g() {
|
|
|
|
this.j = this.i;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.v1.u
|
|
|
|
public void i() {
|
|
|
|
this.j = null;
|
|
|
|
this.i = null;
|
|
|
|
}
|
|
|
|
}
|