183 lines
4.7 KiB
Java
183 lines
4.7 KiB
Java
package c.i.a.c.a2;
|
|
|
|
import androidx.annotation.Nullable;
|
|
import c.i.a.c.i2.f0;
|
|
import c.i.a.c.i2.v;
|
|
import com.google.android.exoplayer2.Format;
|
|
import com.google.android.exoplayer2.metadata.Metadata;
|
|
import com.google.android.exoplayer2.metadata.flac.PictureFrame;
|
|
import com.google.android.exoplayer2.metadata.flac.VorbisComment;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
/* compiled from: FlacStreamMetadata */
|
|
public final class o {
|
|
public final int a;
|
|
public final int b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final int f761c;
|
|
public final int d;
|
|
public final int e;
|
|
public final int f;
|
|
public final int g;
|
|
public final int h;
|
|
public final int i;
|
|
public final long j;
|
|
@Nullable
|
|
public final a k;
|
|
@Nullable
|
|
public final Metadata l;
|
|
|
|
/* compiled from: FlacStreamMetadata */
|
|
public static class a {
|
|
public final long[] a;
|
|
public final long[] b;
|
|
|
|
public a(long[] jArr, long[] jArr2) {
|
|
this.a = jArr;
|
|
this.b = jArr2;
|
|
}
|
|
}
|
|
|
|
public o(int i, int i2, int i3, int i4, int i5, int i6, int i7, long j, @Nullable a aVar, @Nullable Metadata metadata) {
|
|
this.a = i;
|
|
this.b = i2;
|
|
this.f761c = i3;
|
|
this.d = i4;
|
|
this.e = i5;
|
|
this.f = h(i5);
|
|
this.g = i6;
|
|
this.h = i7;
|
|
this.i = c(i7);
|
|
this.j = j;
|
|
this.k = aVar;
|
|
this.l = metadata;
|
|
}
|
|
|
|
public o(byte[] bArr, int i) {
|
|
v vVar = new v(bArr);
|
|
vVar.k(i * 8);
|
|
this.a = vVar.g(16);
|
|
this.b = vVar.g(16);
|
|
this.f761c = vVar.g(24);
|
|
this.d = vVar.g(24);
|
|
int g = vVar.g(20);
|
|
this.e = g;
|
|
this.f = h(g);
|
|
this.g = vVar.g(3) + 1;
|
|
int g2 = vVar.g(5) + 1;
|
|
this.h = g2;
|
|
this.i = c(g2);
|
|
this.j = (f0.L(vVar.g(4)) << 32) | f0.L(vVar.g(32));
|
|
this.k = null;
|
|
this.l = null;
|
|
}
|
|
|
|
@Nullable
|
|
public static Metadata a(List<String> list, List<PictureFrame> list2) {
|
|
if (list.isEmpty() && list2.isEmpty()) {
|
|
return null;
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
for (int i = 0; i < list.size(); i++) {
|
|
String str = list.get(i);
|
|
String[] H = f0.H(str, "=");
|
|
if (H.length != 2) {
|
|
c.d.b.a.a.j0("Failed to parse Vorbis comment: ", str, "FlacStreamMetadata");
|
|
} else {
|
|
arrayList.add(new VorbisComment(H[0], H[1]));
|
|
}
|
|
}
|
|
arrayList.addAll(list2);
|
|
if (arrayList.isEmpty()) {
|
|
return null;
|
|
}
|
|
return new Metadata(arrayList);
|
|
}
|
|
|
|
public static int c(int i) {
|
|
if (i == 8) {
|
|
return 1;
|
|
}
|
|
if (i == 12) {
|
|
return 2;
|
|
}
|
|
if (i == 16) {
|
|
return 4;
|
|
}
|
|
if (i != 20) {
|
|
return i != 24 ? -1 : 6;
|
|
}
|
|
return 5;
|
|
}
|
|
|
|
public static int h(int i) {
|
|
switch (i) {
|
|
case 8000:
|
|
return 4;
|
|
case 16000:
|
|
return 5;
|
|
case 22050:
|
|
return 6;
|
|
case 24000:
|
|
return 7;
|
|
case 32000:
|
|
return 8;
|
|
case 44100:
|
|
return 9;
|
|
case 48000:
|
|
return 10;
|
|
case 88200:
|
|
return 1;
|
|
case 96000:
|
|
return 11;
|
|
case 176400:
|
|
return 2;
|
|
case 192000:
|
|
return 3;
|
|
default:
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
public o b(@Nullable a aVar) {
|
|
return new o(this.a, this.b, this.f761c, this.d, this.e, this.g, this.h, this.j, aVar, this.l);
|
|
}
|
|
|
|
public long d() {
|
|
long j = this.j;
|
|
if (j == 0) {
|
|
return -9223372036854775807L;
|
|
}
|
|
return (j * 1000000) / ((long) this.e);
|
|
}
|
|
|
|
public Format e(byte[] bArr, @Nullable Metadata metadata) {
|
|
bArr[4] = Byte.MIN_VALUE;
|
|
int i = this.d;
|
|
if (i <= 0) {
|
|
i = -1;
|
|
}
|
|
Metadata f = f(metadata);
|
|
Format.b bVar = new Format.b();
|
|
bVar.k = "audio/flac";
|
|
bVar.l = i;
|
|
bVar.f2270x = this.g;
|
|
bVar.f2271y = this.e;
|
|
bVar.m = Collections.singletonList(bArr);
|
|
bVar.i = f;
|
|
return bVar.a();
|
|
}
|
|
|
|
@Nullable
|
|
public Metadata f(@Nullable Metadata metadata) {
|
|
Metadata metadata2 = this.l;
|
|
return metadata2 == null ? metadata : metadata == null ? metadata2 : metadata2.a(metadata.i);
|
|
}
|
|
|
|
public long g(long j) {
|
|
return f0.i((j * ((long) this.e)) / 1000000, 0, this.j - 1);
|
|
}
|
|
}
|