package m1;

import T0.A;
import T0.y;
import T0.z;

/* JADX INFO: renamed from: m1.a, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1160a implements f, z {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final long f14546a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final long f14547b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final int f14548c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final long f14549d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final int f14550e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final long f14551f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final boolean f14552g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final long f14553h;
    public final int i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final int f14554j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final boolean f14555k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final long f14556l;

    public C1160a(long j8, long j9, int i, int i5, boolean z8) {
        this.f14546a = j8;
        this.f14547b = j9;
        this.f14548c = i5 == -1 ? 1 : i5;
        this.f14550e = i;
        this.f14552g = z8;
        if (j8 == -1) {
            this.f14549d = -1L;
            this.f14551f = -9223372036854775807L;
        } else {
            long j10 = j8 - j9;
            this.f14549d = j10;
            this.f14551f = (Math.max(0L, j10) * 8000000) / ((long) i);
        }
        this.f14553h = j9;
        this.i = i;
        this.f14554j = i5;
        this.f14555k = z8;
        this.f14556l = j8 == -1 ? -1L : j8;
    }

    @Override // T0.z
    public final boolean b() {
        return this.f14549d != -1 || this.f14552g;
    }

    @Override // m1.f
    public final long d(long j8) {
        return (Math.max(0L, j8 - this.f14547b) * 8000000) / ((long) this.f14550e);
    }

    @Override // m1.f
    public final long g() {
        return this.f14556l;
    }

    @Override // T0.z
    public final y h(long j8) {
        long j9 = this.f14549d;
        long j10 = this.f14547b;
        if (j9 == -1 && !this.f14552g) {
            A a3 = new A(0L, j10);
            return new y(a3, a3);
        }
        int i = this.f14550e;
        long j11 = this.f14548c;
        long jMin = (((((long) i) * j8) / 8000000) / j11) * j11;
        if (j9 != -1) {
            jMin = Math.min(jMin, j9 - j11);
        }
        long jMax = Math.max(jMin, 0L) + j10;
        long jMax2 = (Math.max(0L, jMax - j10) * 8000000) / ((long) i);
        A a8 = new A(jMax2, jMax);
        if (j9 != -1 && jMax2 < j8) {
            long j12 = jMax + j11;
            if (j12 < this.f14546a) {
                return new y(a8, new A((Math.max(0L, j12 - j10) * 8000000) / ((long) i), j12));
            }
        }
        return new y(a8, a8);
    }

    @Override // m1.f
    public final int j() {
        return this.i;
    }

    @Override // T0.z
    public final long k() {
        return this.f14551f;
    }
}
