package v;

import a0.InterfaceC0147b;
import b0.t;
import n.C0633A;
import n.x;

/* JADX INFO: renamed from: v.c, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C0727c implements o {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final k f6571a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final C0633A f6572b = new C0633A(0);

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private boolean f6573c = true;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private long f6574d = Long.MIN_VALUE;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private long f6575e = Long.MIN_VALUE;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private volatile long f6576f = Long.MIN_VALUE;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private volatile x f6577g;

    public C0727c(InterfaceC0147b interfaceC0147b) {
        this.f6571a = new k(interfaceC0147b);
    }

    private boolean f() {
        boolean zM = this.f6571a.m(this.f6572b);
        if (this.f6573c) {
            while (zM && !this.f6572b.h()) {
                this.f6571a.s();
                zM = this.f6571a.m(this.f6572b);
            }
        }
        if (!zM) {
            return false;
        }
        long j2 = this.f6575e;
        return j2 == Long.MIN_VALUE || this.f6572b.f5412e < j2;
    }

    @Override // v.o
    public void a(t tVar, int i2) {
        this.f6571a.c(tVar, i2);
    }

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

    @Override // v.o
    public int d(f fVar, int i2, boolean z2) {
        return this.f6571a.b(fVar, i2, z2);
    }

    @Override // v.o
    public void e(long j2, int i2, int i3, int i4, byte[] bArr) {
        this.f6576f = Math.max(this.f6576f, j2);
        k kVar = this.f6571a;
        kVar.e(j2, i2, (kVar.l() - ((long) i3)) - ((long) i4), i3, bArr);
    }

    public synchronized void h() {
        this.f6571a.d();
        this.f6573c = true;
        this.f6574d = Long.MIN_VALUE;
        this.f6575e = Long.MIN_VALUE;
        this.f6576f = Long.MIN_VALUE;
    }

    public boolean i(C0727c c0727c) {
        if (this.f6575e != Long.MIN_VALUE) {
            return true;
        }
        long j2 = this.f6571a.m(this.f6572b) ? this.f6572b.f5412e : this.f6574d + 1;
        k kVar = c0727c.f6571a;
        while (kVar.m(this.f6572b)) {
            C0633A c0633a = this.f6572b;
            if (c0633a.f5412e >= j2 && c0633a.h()) {
                break;
            }
            kVar.s();
        }
        if (!kVar.m(this.f6572b)) {
            return false;
        }
        this.f6575e = this.f6572b.f5412e;
        return true;
    }

    public void j(long j2) {
        while (this.f6571a.m(this.f6572b) && this.f6572b.f5412e < j2) {
            this.f6571a.s();
            this.f6573c = true;
        }
        this.f6574d = Long.MIN_VALUE;
    }

    public void k(int i2) {
        this.f6571a.f(i2);
        this.f6576f = this.f6571a.m(this.f6572b) ? this.f6572b.f5412e : Long.MIN_VALUE;
    }

    public boolean l(C0633A c0633a) {
        if (c0633a == null) {
            return false;
        }
        return this.f6571a.m(c0633a);
    }

    public x m() {
        return this.f6577g;
    }

    public long n() {
        return this.f6576f;
    }

    public int o() {
        return this.f6571a.j();
    }

    public synchronized boolean p(C0633A c0633a) {
        if (!f()) {
            return false;
        }
        this.f6571a.r(c0633a);
        this.f6573c = false;
        if (c0633a != null) {
            this.f6574d = c0633a.f5412e;
        }
        return true;
    }

    public int q() {
        return this.f6571a.k();
    }

    public boolean r() {
        return this.f6577g != null;
    }

    public boolean s() {
        return !f();
    }

    public int t(a0.f fVar, int i2, boolean z2) {
        return this.f6571a.a(fVar, i2, z2);
    }

    public boolean u(long j2) {
        return this.f6571a.t(j2);
    }
}
