package J;

import I.g;
import I.h;
import android.graphics.Bitmap;
import androidx.core.location.LocationRequestCompat;
import b0.AbstractC0399d;
import b0.D;
import b0.o;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public class d implements g {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final long[] f1126b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final long[] f1127c;

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

    public d() {
        this.f1125a = 0L;
        long[] jArr = {0, LocationRequestCompat.PASSIVE_INTERVAL};
        this.f1126b = jArr;
        this.f1127c = jArr;
        this.f1128d = null;
    }

    @Override // I.g
    public int a(long j2) {
        AbstractC0399d.a(j2 >= 0);
        int iB = D.b(this.f1127c, j2, false, false);
        if (iB < this.f1127c.length) {
            return iB;
        }
        return -1;
    }

    @Override // I.g
    public long b(int i2) {
        AbstractC0399d.a(i2 >= 0);
        AbstractC0399d.a(i2 < this.f1127c.length);
        return this.f1127c[i2];
    }

    @Override // I.g
    public List c(long j2) {
        long[] jArr = this.f1126b;
        Bitmap bitmap = (jArr[0] > j2 || j2 >= jArr[1]) ? null : this.f1128d;
        o.d("DvbSubtitle", "getData timeUs = " + j2 + " data = " + bitmap, 16);
        if (bitmap == null) {
            return Collections.emptyList();
        }
        h.a(bitmap, j2, 0);
        return Collections.singletonList(new I.c(bitmap, true));
    }

    @Override // I.g
    public int d() {
        return this.f1127c.length;
    }

    public d(Bitmap bitmap, long j2, int i2) {
        this.f1125a = j2;
        long[] jArr = {j2, (((long) i2) * 1000000) + j2};
        this.f1126b = jArr;
        long[] jArrCopyOf = Arrays.copyOf(jArr, 2);
        this.f1127c = jArrCopyOf;
        this.f1128d = bitmap;
        Arrays.sort(jArrCopyOf);
    }
}
