2021-07-24 02:37:17 +00:00
|
|
|
package c.i.a.c;
|
|
|
|
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.util.Pair;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
import c.i.a.c.d2.h0;
|
|
|
|
import c.i.a.c.d2.r;
|
|
|
|
import c.i.a.c.d2.s;
|
|
|
|
import c.i.a.c.d2.t;
|
|
|
|
import c.i.a.c.d2.u;
|
|
|
|
import c.i.a.c.d2.v;
|
|
|
|
import c.i.a.c.d2.y;
|
|
|
|
import c.i.a.c.d2.z;
|
|
|
|
import c.i.a.c.h2.x;
|
|
|
|
import c.i.a.c.i2.f0;
|
|
|
|
import c.i.a.c.u1.c1;
|
|
|
|
import c.i.a.c.z1.q;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.IdentityHashMap;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.Random;
|
|
|
|
import java.util.Set;
|
|
|
|
/* compiled from: MediaSourceList */
|
|
|
|
public final class b1 {
|
|
|
|
public final List<c> a = new ArrayList();
|
|
|
|
public final IdentityHashMap<v, c> b = new IdentityHashMap<>();
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-28 07:39:21 +00:00
|
|
|
public final Map<Object, c> f761c = new HashMap();
|
2021-07-24 02:37:17 +00:00
|
|
|
public final d d;
|
|
|
|
public final z.a e;
|
|
|
|
public final q.a f;
|
|
|
|
public final HashMap<c, b> g;
|
|
|
|
public final Set<c> h;
|
|
|
|
public h0 i = new h0.a(0, new Random());
|
|
|
|
public boolean j;
|
|
|
|
@Nullable
|
|
|
|
public x k;
|
|
|
|
|
|
|
|
/* compiled from: MediaSourceList */
|
|
|
|
public final class a implements z, q {
|
|
|
|
public final c i;
|
|
|
|
public z.a j;
|
|
|
|
public q.a k;
|
|
|
|
|
|
|
|
public a(c cVar) {
|
|
|
|
this.j = b1.this.e;
|
|
|
|
this.k = b1.this.f;
|
|
|
|
this.i = cVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.z1.q
|
|
|
|
public void B(int i, @Nullable y.a aVar) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.k.b();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.z1.q
|
|
|
|
public void F(int i, @Nullable y.a aVar) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.k.d();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.z1.q
|
|
|
|
public void L(int i, @Nullable y.a aVar) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.k.a();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.d2.z
|
|
|
|
public void N(int i, @Nullable y.a aVar, r rVar, u uVar) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.j.d(rVar, uVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.z1.q
|
|
|
|
public void R(int i, @Nullable y.a aVar) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.k.f();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.d2.z
|
|
|
|
public void U(int i, @Nullable y.a aVar, r rVar, u uVar, IOException iOException, boolean z2) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.j.e(rVar, uVar, iOException, z2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.z1.q
|
|
|
|
public void W(int i, @Nullable y.a aVar) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.k.c();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean a(int i, @Nullable y.a aVar) {
|
|
|
|
y.a aVar2 = null;
|
|
|
|
if (aVar != null) {
|
|
|
|
c cVar = this.i;
|
|
|
|
int i2 = 0;
|
|
|
|
while (true) {
|
2021-07-28 07:39:21 +00:00
|
|
|
if (i2 >= cVar.f763c.size()) {
|
2021-07-24 02:37:17 +00:00
|
|
|
break;
|
2021-07-28 07:39:21 +00:00
|
|
|
} else if (cVar.f763c.get(i2).d == aVar.d) {
|
2021-07-24 02:37:17 +00:00
|
|
|
aVar2 = aVar.b(Pair.create(cVar.b, aVar.a));
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
i2++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (aVar2 == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int i3 = i + this.i.d;
|
|
|
|
z.a aVar3 = this.j;
|
|
|
|
if (aVar3.a != i3 || !f0.a(aVar3.b, aVar2)) {
|
|
|
|
this.j = b1.this.e.g(i3, aVar2, 0);
|
|
|
|
}
|
|
|
|
q.a aVar4 = this.k;
|
|
|
|
if (aVar4.a == i3 && f0.a(aVar4.b, aVar2)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
this.k = b1.this.f.g(i3, aVar2);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.d2.z
|
|
|
|
public void l(int i, @Nullable y.a aVar, u uVar) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.j.b(uVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.d2.z
|
|
|
|
public void m(int i, @Nullable y.a aVar, r rVar, u uVar) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.j.c(rVar, uVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.z1.q
|
|
|
|
public void o(int i, @Nullable y.a aVar, Exception exc) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.k.e(exc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.d2.z
|
|
|
|
public void q(int i, @Nullable y.a aVar, r rVar, u uVar) {
|
|
|
|
if (a(i, aVar)) {
|
|
|
|
this.j.f(rVar, uVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaSourceList */
|
|
|
|
public static final class b {
|
|
|
|
public final y a;
|
|
|
|
public final y.b b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-28 07:39:21 +00:00
|
|
|
public final z f762c;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
public b(y yVar, y.b bVar, z zVar) {
|
|
|
|
this.a = yVar;
|
|
|
|
this.b = bVar;
|
2021-07-28 07:39:21 +00:00
|
|
|
this.f762c = zVar;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaSourceList */
|
|
|
|
public static final class c implements a1 {
|
|
|
|
public final t a;
|
|
|
|
public final Object b = new Object();
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-28 07:39:21 +00:00
|
|
|
public final List<y.a> f763c = new ArrayList();
|
2021-07-24 02:37:17 +00:00
|
|
|
public int d;
|
|
|
|
public boolean e;
|
|
|
|
|
|
|
|
public c(y yVar, boolean z2) {
|
|
|
|
this.a = new t(yVar, z2);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.a1
|
|
|
|
public r1 a() {
|
|
|
|
return this.a.n;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.i.a.c.a1
|
|
|
|
public Object getUid() {
|
|
|
|
return this.b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaSourceList */
|
|
|
|
public interface d {
|
|
|
|
}
|
|
|
|
|
|
|
|
public b1(d dVar, @Nullable c1 c1Var, Handler handler) {
|
|
|
|
this.d = dVar;
|
|
|
|
z.a aVar = new z.a();
|
|
|
|
this.e = aVar;
|
|
|
|
q.a aVar2 = new q.a();
|
|
|
|
this.f = aVar2;
|
|
|
|
this.g = new HashMap<>();
|
|
|
|
this.h = new HashSet();
|
|
|
|
if (c1Var != null) {
|
2021-07-28 07:39:21 +00:00
|
|
|
aVar.f811c.add(new z.a.C0087a(handler, c1Var));
|
|
|
|
aVar2.f1017c.add(new q.a.C0095a(handler, c1Var));
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public r1 a(int i, List<c> list, h0 h0Var) {
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
this.i = h0Var;
|
|
|
|
for (int i2 = i; i2 < list.size() + i; i2++) {
|
|
|
|
c cVar = list.get(i2 - i);
|
|
|
|
if (i2 > 0) {
|
|
|
|
c cVar2 = this.a.get(i2 - 1);
|
|
|
|
t.a aVar = cVar2.a.n;
|
|
|
|
cVar.d = aVar.p() + cVar2.d;
|
|
|
|
cVar.e = false;
|
2021-07-28 07:39:21 +00:00
|
|
|
cVar.f763c.clear();
|
2021-07-24 02:37:17 +00:00
|
|
|
} else {
|
|
|
|
cVar.d = 0;
|
|
|
|
cVar.e = false;
|
2021-07-28 07:39:21 +00:00
|
|
|
cVar.f763c.clear();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
b(i2, cVar.a.n.p());
|
|
|
|
this.a.add(i2, cVar);
|
2021-07-28 07:39:21 +00:00
|
|
|
this.f761c.put(cVar.b, cVar);
|
2021-07-24 02:37:17 +00:00
|
|
|
if (this.j) {
|
|
|
|
g(cVar);
|
|
|
|
if (this.b.isEmpty()) {
|
|
|
|
this.h.add(cVar);
|
|
|
|
} else {
|
|
|
|
b bVar = this.g.get(cVar);
|
|
|
|
if (bVar != null) {
|
|
|
|
bVar.a.d(bVar.b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return c();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void b(int i, int i2) {
|
|
|
|
while (i < this.a.size()) {
|
|
|
|
this.a.get(i).d += i2;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public r1 c() {
|
|
|
|
if (this.a.isEmpty()) {
|
|
|
|
return r1.a;
|
|
|
|
}
|
|
|
|
int i = 0;
|
|
|
|
for (int i2 = 0; i2 < this.a.size(); i2++) {
|
|
|
|
c cVar = this.a.get(i2);
|
|
|
|
cVar.d = i;
|
|
|
|
i += cVar.a.n.p();
|
|
|
|
}
|
|
|
|
return new i1(this.a, this.i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void d() {
|
|
|
|
Iterator<c> it = this.h.iterator();
|
|
|
|
while (it.hasNext()) {
|
|
|
|
c next = it.next();
|
2021-07-28 07:39:21 +00:00
|
|
|
if (next.f763c.isEmpty()) {
|
2021-07-24 02:37:17 +00:00
|
|
|
b bVar = this.g.get(next);
|
|
|
|
if (bVar != null) {
|
|
|
|
bVar.a.d(bVar.b);
|
|
|
|
}
|
|
|
|
it.remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public int e() {
|
|
|
|
return this.a.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void f(c cVar) {
|
2021-07-28 07:39:21 +00:00
|
|
|
if (cVar.e && cVar.f763c.isEmpty()) {
|
2021-07-24 02:37:17 +00:00
|
|
|
b remove = this.g.remove(cVar);
|
|
|
|
Objects.requireNonNull(remove);
|
|
|
|
remove.a.a(remove.b);
|
2021-07-28 07:39:21 +00:00
|
|
|
remove.a.c(remove.f762c);
|
2021-07-24 02:37:17 +00:00
|
|
|
this.h.remove(cVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void g(c cVar) {
|
|
|
|
t tVar = cVar.a;
|
|
|
|
z zVar = new z(this);
|
|
|
|
a aVar = new a(cVar);
|
|
|
|
this.g.put(cVar, new b(tVar, zVar, aVar));
|
|
|
|
Handler handler = new Handler(f0.o(), null);
|
|
|
|
Objects.requireNonNull(tVar);
|
2021-07-28 07:39:21 +00:00
|
|
|
z.a aVar2 = tVar.f800c;
|
2021-07-24 02:37:17 +00:00
|
|
|
Objects.requireNonNull(aVar2);
|
2021-07-28 07:39:21 +00:00
|
|
|
aVar2.f811c.add(new z.a.C0087a(handler, aVar));
|
2021-07-24 02:37:17 +00:00
|
|
|
Handler handler2 = new Handler(f0.o(), null);
|
|
|
|
q.a aVar3 = tVar.d;
|
|
|
|
Objects.requireNonNull(aVar3);
|
2021-07-28 07:39:21 +00:00
|
|
|
aVar3.f1017c.add(new q.a.C0095a(handler2, aVar));
|
2021-07-24 02:37:17 +00:00
|
|
|
tVar.k(zVar, this.k);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void h(v vVar) {
|
|
|
|
c remove = this.b.remove(vVar);
|
|
|
|
Objects.requireNonNull(remove);
|
|
|
|
remove.a.i(vVar);
|
2021-07-28 07:39:21 +00:00
|
|
|
remove.f763c.remove(((s) vVar).i);
|
2021-07-24 02:37:17 +00:00
|
|
|
if (!this.b.isEmpty()) {
|
|
|
|
d();
|
|
|
|
}
|
|
|
|
f(remove);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void i(int i, int i2) {
|
|
|
|
for (int i3 = i2 - 1; i3 >= i; i3--) {
|
|
|
|
c remove = this.a.remove(i3);
|
2021-07-28 07:39:21 +00:00
|
|
|
this.f761c.remove(remove.b);
|
2021-07-24 02:37:17 +00:00
|
|
|
b(i3, -remove.a.n.p());
|
|
|
|
remove.e = true;
|
|
|
|
if (this.j) {
|
|
|
|
f(remove);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|