JavDB.apk(点击下载) / a.java


package y1;

import b2.k;
import com.google.android.exoplayer2.u0;
import g2.a;
import java.io.IOException;
import k3.y;
import m2.b;
import t1.a0;
import t1.b0;
import t1.l;
import t1.m;
import t1.n;

public final class a implements l {

    /* renamed from: a  reason: collision with root package name */
    private final y f12065a = new y(6);

    /* renamed from: b  reason: collision with root package name */
    private n f12066b;

    /* renamed from: c  reason: collision with root package name */
    private int f12067c;

    /* renamed from: d  reason: collision with root package name */
    private int f12068d;

    /* renamed from: e  reason: collision with root package name */
    private int f12069e;

    /* renamed from: f  reason: collision with root package name */
    private long f12070f = -1;

    /* renamed from: g  reason: collision with root package name */
    private b f12071g;

    /* renamed from: h  reason: collision with root package name */
    private m f12072h;

    /* renamed from: i  reason: collision with root package name */
    private c f12073i;

    /* renamed from: j  reason: collision with root package name */
    private k f12074j;

    private void c(m mVar) throws IOException {
        this.f12065a.L(2);
        mVar.o(this.f12065a.d(), 0, 2);
        mVar.p(this.f12065a.J() - 2);
    }

    private void d() {
        g(new a.b[0]);
        ((n) k3.a.e(this.f12066b)).i();
        this.f12066b.l(new b0.b(-9223372036854775807L));
        this.f12067c = 6;
    }

    private static b e(String str, long j7) throws IOException {
        b a7;
        if (j7 == -1 || (a7 = e.a(str)) == null) {
            return null;
        }
        return a7.a(j7);
    }

    private void g(a.b... bVarArr) {
        ((n) k3.a.e(this.f12066b)).e(1024, 4).e(new u0.b().K("image/jpeg").X(new g2.a(bVarArr)).E());
    }

    private int h(m mVar) throws IOException {
        this.f12065a.L(2);
        mVar.o(this.f12065a.d(), 0, 2);
        return this.f12065a.J();
    }

    private void j(m mVar) throws IOException {
        this.f12065a.L(2);
        mVar.readFully(this.f12065a.d(), 0, 2);
        int J = this.f12065a.J();
        this.f12068d = J;
        if (J == 65498) {
            if (this.f12070f != -1) {
                this.f12067c = 4;
            } else {
                d();
            }
        } else if ((J < 65488 || J > 65497) && J != 65281) {
            this.f12067c = 1;
        }
    }

    private void k(m mVar) throws IOException {
        String x6;
        if (this.f12068d == 65505) {
            y yVar = new y(this.f12069e);
            mVar.readFully(yVar.d(), 0, this.f12069e);
            if (this.f12071g == null && "http://ns.adobe.com/xap/1.0/".equals(yVar.x()) && (x6 = yVar.x()) != null) {
                b e7 = e(x6, mVar.a());
                this.f12071g = e7;
                if (e7 != null) {
                    this.f12070f = e7.f9736i;
                }
            }
        } else {
            mVar.j(this.f12069e);
        }
        this.f12067c = 0;
    }

    private void l(m mVar) throws IOException {
        this.f12065a.L(2);
        mVar.readFully(this.f12065a.d(), 0, 2);
        this.f12069e = this.f12065a.J() - 2;
        this.f12067c = 2;
    }

    private void m(m mVar) throws IOException {
        if (!mVar.m(this.f12065a.d(), 0, 1, true)) {
            d();
            return;
        }
        mVar.h();
        if (this.f12074j == null) {
            this.f12074j = new k();
        }
        c cVar = new c(mVar, this.f12070f);
        this.f12073i = cVar;
        if (this.f12074j.i(cVar)) {
            this.f12074j.b(new d(this.f12070f, (n) k3.a.e(this.f12066b)));
            n();
            return;
        }
        d();
    }

    private void n() {
        g((a.b) k3.a.e(this.f12071g));
        this.f12067c = 5;
    }

    @Override // t1.l
    public void a(long j7, long j8) {
        if (j7 == 0) {
            this.f12067c = 0;
            this.f12074j = null;
        } else if (this.f12067c == 5) {
            ((k) k3.a.e(this.f12074j)).a(j7, j8);
        }
    }

    @Override // t1.l
    public void b(n nVar) {
        this.f12066b = nVar;
    }

    @Override // t1.l
    public int f(m mVar, a0 a0Var) throws IOException {
        int i7 = this.f12067c;
        if (i7 == 0) {
            j(mVar);
            return 0;
        } else if (i7 == 1) {
            l(mVar);
            return 0;
        } else if (i7 == 2) {
            k(mVar);
            return 0;
        } else if (i7 == 4) {
            long q7 = mVar.q();
            long j7 = this.f12070f;
            if (q7 != j7) {
                a0Var.f11354a = j7;
                return 1;
            }
            m(mVar);
            return 0;
        } else if (i7 == 5) {
            if (this.f12073i == null || mVar != this.f12072h) {
                this.f12072h = mVar;
                this.f12073i = new c(mVar, this.f12070f);
            }
            int f7 = ((k) k3.a.e(this.f12074j)).f(this.f12073i, a0Var);
            if (f7 == 1) {
                a0Var.f11354a += this.f12070f;
            }
            return f7;
        } else if (i7 == 6) {
            return -1;
        } else {
            throw new IllegalStateException();
        }
    }

    @Override // t1.l
    public boolean i(m mVar) throws IOException {
        if (h(mVar) != 65496) {
            return false;
        }
        int h7 = h(mVar);
        this.f12068d = h7;
        if (h7 == 65504) {
            c(mVar);
            this.f12068d = h(mVar);
        }
        if (this.f12068d != 65505) {
            return false;
        }
        mVar.p(2);
        this.f12065a.L(6);
        mVar.o(this.f12065a.d(), 0, 6);
        if (this.f12065a.F() == 1165519206 && this.f12065a.J() == 0) {
            return true;
        }
        return false;
    }

    @Override // t1.l
    public void release() {
        k kVar = this.f12074j;
        if (kVar != null) {
            kVar.release();
        }
    }
}