package p;

import b0.D;
import b0.t;
import n.x;
import p.d;
import u.InterfaceC0722a;
import v.C0726b;
import v.C0727c;

/* JADX INFO: loaded from: classes.dex */
public class m extends c implements d.a {

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private final d f6185g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private x f6186h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    private InterfaceC0722a f6187i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    private v.m f6188j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private volatile int f6189k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    private volatile boolean f6190l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    private volatile boolean f6191m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    private C0727c f6192n;

    public m(a0.f fVar, a0.h hVar, int i2, j jVar, d dVar, int i3, boolean z2) {
        super(fVar, hVar, 2, i2, jVar, i3);
        this.f6185g = dVar;
        this.f6191m = z2;
    }

    @Override // v.o
    public void a(t tVar, int i2) {
        throw new IllegalStateException("Unexpected sample data in initialization chunk");
    }

    @Override // p.d.a
    public void b(v.m mVar) {
        this.f6188j = mVar;
    }

    @Override // v.o
    public void c(x xVar) {
        this.f6186h = xVar;
    }

    @Override // v.o
    public int d(v.f fVar, int i2, boolean z2) {
        throw new IllegalStateException("Unexpected sample data in initialization chunk");
    }

    @Override // v.o
    public void e(long j2, int i2, int i3, int i4, byte[] bArr) {
        throw new IllegalStateException("Unexpected sample data in initialization chunk");
    }

    @Override // p.c
    public long f() {
        return this.f6189k;
    }

    @Override // p.d.a
    public void g(InterfaceC0722a interfaceC0722a) {
        this.f6187i = interfaceC0722a;
    }

    public InterfaceC0722a h() {
        return this.f6187i;
    }

    public x i() {
        return this.f6186h;
    }

    public v.m j() {
        return this.f6188j;
    }

    public boolean k() {
        return this.f6187i != null;
    }

    public boolean l() {
        return this.f6186h != null;
    }

    @Override // a0.r.c
    public boolean m() {
        return this.f6190l;
    }

    public boolean n() {
        return this.f6188j != null;
    }

    public void o(C0727c c0727c) {
        this.f6192n = c0727c;
    }

    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$UnknownArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    @Override // a0.r.c
    public void q() {
        boolean z2 = false;
        int iT = 0;
        if (this.f6185g == null) {
            j jVar = this.f6088c;
            this.f6186h = x.m(jVar.f6165a, jVar.f6166b, jVar.f6167c, 0L, jVar.f6174j);
            try {
                this.f6091f.a(D.z(this.f6089d, this.f6189k));
                while (iT != -1) {
                    this.f6189k += iT;
                    iT = this.f6192n.t(this.f6091f, Integer.MAX_VALUE, true);
                }
                this.f6192n.e(0L, 1, this.f6189k, 0, null);
                D.g(this.f6091f);
                return;
            } catch (Throwable th) {
                D.g(this.f6091f);
                throw th;
            }
        }
        if (this.f6191m) {
            this.f6185g.k(true);
        }
        a0.h hVarA = D.A(this.f6089d, this.f6189k);
        StringBuilder sb = new StringBuilder();
        sb.append("start loading loadDataSpec ");
        sb.append(hVarA);
        sb.append("  bytesLoaded ");
        sb.append(this.f6189k);
        b0.o.d("InitializationChunk", sb.toString(), 4);
        try {
            a0.f fVar = this.f6091f;
            C0726b c0726b = new C0726b(fVar, hVarA.f1942c, fVar.a(hVarA));
            if (this.f6189k == 0) {
                this.f6185g.h(this);
            }
            int iJ = 0;
            while (iJ == 0) {
                try {
                    if (this.f6190l) {
                        break;
                    } else {
                        iJ = this.f6185g.j(c0726b);
                    }
                } finally {
                    this.f6189k = (int) (c0726b.j() - this.f6089d.f1942c);
                    D.g(this.f6091f);
                }
            }
        } finally {
            if (this.f6191m) {
                this.f6185g.k(false);
            }
            b0.o.d("InitializationChunk", "end loading loadDataSpec " + hVarA + "  bytesLoaded " + this.f6189k, 4);
            D.g(this.f6091f);
        }
    }

    @Override // a0.r.c
    public void u() {
        this.f6190l = true;
    }
}
