204 lines
5.8 KiB
Java
204 lines
5.8 KiB
Java
package c.i.a.c.c2;
|
|
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.Message;
|
|
import androidx.annotation.Nullable;
|
|
import c.i.a.c.g0;
|
|
import c.i.a.c.i2.f0;
|
|
import c.i.a.c.s0;
|
|
import com.google.android.exoplayer2.Format;
|
|
import com.google.android.exoplayer2.metadata.Metadata;
|
|
import java.nio.ByteBuffer;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
/* compiled from: MetadataRenderer */
|
|
public final class f extends g0 implements Handler.Callback {
|
|
public int A;
|
|
@Nullable
|
|
public b B;
|
|
public boolean C;
|
|
public boolean D;
|
|
public long E;
|
|
public final c t;
|
|
public final e u;
|
|
@Nullable
|
|
public final Handler v;
|
|
public final d w;
|
|
|
|
/* renamed from: x reason: collision with root package name */
|
|
public final Metadata[] f781x;
|
|
|
|
/* renamed from: y reason: collision with root package name */
|
|
public final long[] f782y;
|
|
|
|
/* renamed from: z reason: collision with root package name */
|
|
public int f783z;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public f(e eVar, @Nullable Looper looper) {
|
|
super(5);
|
|
Handler handler;
|
|
c cVar = c.a;
|
|
Objects.requireNonNull(eVar);
|
|
this.u = eVar;
|
|
if (looper == null) {
|
|
handler = null;
|
|
} else {
|
|
int i = f0.a;
|
|
handler = new Handler(looper, this);
|
|
}
|
|
this.v = handler;
|
|
this.t = cVar;
|
|
this.w = new d();
|
|
this.f781x = new Metadata[5];
|
|
this.f782y = new long[5];
|
|
}
|
|
|
|
@Override // c.i.a.c.g0
|
|
public void B() {
|
|
Arrays.fill(this.f781x, (Object) null);
|
|
this.f783z = 0;
|
|
this.A = 0;
|
|
this.B = null;
|
|
}
|
|
|
|
@Override // c.i.a.c.g0
|
|
public void D(long j, boolean z2) {
|
|
Arrays.fill(this.f781x, (Object) null);
|
|
this.f783z = 0;
|
|
this.A = 0;
|
|
this.C = false;
|
|
this.D = false;
|
|
}
|
|
|
|
@Override // c.i.a.c.g0
|
|
public void H(Format[] formatArr, long j, long j2) {
|
|
this.B = this.t.b(formatArr[0]);
|
|
}
|
|
|
|
public final void J(Metadata metadata, List<Metadata.Entry> list) {
|
|
int i = 0;
|
|
while (true) {
|
|
Metadata.Entry[] entryArr = metadata.i;
|
|
if (i < entryArr.length) {
|
|
Format x2 = entryArr[i].x();
|
|
if (x2 == null || !this.t.a(x2)) {
|
|
list.add(metadata.i[i]);
|
|
} else {
|
|
b b = this.t.b(x2);
|
|
byte[] n0 = metadata.i[i].n0();
|
|
Objects.requireNonNull(n0);
|
|
this.w.p();
|
|
this.w.r(n0.length);
|
|
ByteBuffer byteBuffer = this.w.k;
|
|
int i2 = f0.a;
|
|
byteBuffer.put(n0);
|
|
this.w.s();
|
|
Metadata a = b.a(this.w);
|
|
if (a != null) {
|
|
J(a, list);
|
|
}
|
|
}
|
|
i++;
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // c.i.a.c.l1
|
|
public int a(Format format) {
|
|
if (!this.t.a(format)) {
|
|
return 0;
|
|
}
|
|
return (format.M == null ? 4 : 2) | 0 | 0;
|
|
}
|
|
|
|
@Override // c.i.a.c.k1
|
|
public boolean b() {
|
|
return this.D;
|
|
}
|
|
|
|
@Override // c.i.a.c.k1
|
|
public boolean d() {
|
|
return true;
|
|
}
|
|
|
|
@Override // c.i.a.c.k1, c.i.a.c.l1
|
|
public String getName() {
|
|
return "MetadataRenderer";
|
|
}
|
|
|
|
@Override // android.os.Handler.Callback
|
|
public boolean handleMessage(Message message) {
|
|
if (message.what == 0) {
|
|
this.u.l((Metadata) message.obj);
|
|
return true;
|
|
}
|
|
throw new IllegalStateException();
|
|
}
|
|
|
|
@Override // c.i.a.c.k1
|
|
public void q(long j, long j2) {
|
|
if (!this.C && this.A < 5) {
|
|
this.w.p();
|
|
s0 A = A();
|
|
int I = I(A, this.w, false);
|
|
if (I == -4) {
|
|
if (this.w.n()) {
|
|
this.C = true;
|
|
} else {
|
|
d dVar = this.w;
|
|
dVar.q = this.E;
|
|
dVar.s();
|
|
b bVar = this.B;
|
|
int i = f0.a;
|
|
Metadata a = bVar.a(this.w);
|
|
if (a != null) {
|
|
ArrayList arrayList = new ArrayList(a.i.length);
|
|
J(a, arrayList);
|
|
if (!arrayList.isEmpty()) {
|
|
Metadata metadata = new Metadata(arrayList);
|
|
int i2 = this.f783z;
|
|
int i3 = this.A;
|
|
int i4 = (i2 + i3) % 5;
|
|
this.f781x[i4] = metadata;
|
|
this.f782y[i4] = this.w.m;
|
|
this.A = i3 + 1;
|
|
}
|
|
}
|
|
}
|
|
} else if (I == -5) {
|
|
Format format = A.b;
|
|
Objects.requireNonNull(format);
|
|
this.E = format.f2265x;
|
|
}
|
|
}
|
|
if (this.A > 0) {
|
|
long[] jArr = this.f782y;
|
|
int i5 = this.f783z;
|
|
if (jArr[i5] <= j) {
|
|
Metadata metadata2 = this.f781x[i5];
|
|
int i6 = f0.a;
|
|
Handler handler = this.v;
|
|
if (handler != null) {
|
|
handler.obtainMessage(0, metadata2).sendToTarget();
|
|
} else {
|
|
this.u.l(metadata2);
|
|
}
|
|
Metadata[] metadataArr = this.f781x;
|
|
int i7 = this.f783z;
|
|
metadataArr[i7] = null;
|
|
this.f783z = (i7 + 1) % 5;
|
|
this.A--;
|
|
}
|
|
}
|
|
if (this.C && this.A == 0) {
|
|
this.D = true;
|
|
}
|
|
}
|
|
}
|