package l2;

import androidx.media3.common.util.ParsableByteArray;
import com.google.android.gms.internal.ads.p01;
import com.google.android.gms.internal.ads.u6;
import java.util.NoSuchElementException;

/* JADX INFO: loaded from: classes.dex */
public final class i implements e, u6 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f29999a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f30000b;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public int f30002d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Object f30003e;

    @Override // l2.e
    public final int a() {
        return -1;
    }

    @Override // l2.e
    public final int b() {
        return this.f29999a;
    }

    @Override // l2.e
    public final int c() {
        int i10 = this.f30000b;
        if (i10 == 8) {
            return ((ParsableByteArray) this.f30003e).readUnsignedByte();
        }
        if (i10 == 16) {
            return ((ParsableByteArray) this.f30003e).readUnsignedShort();
        }
        int i11 = this.f30001c;
        this.f30001c = i11 + 1;
        if (i11 % 2 != 0) {
            return this.f30002d & 15;
        }
        int unsignedByte = ((ParsableByteArray) this.f30003e).readUnsignedByte();
        this.f30002d = unsignedByte;
        return (unsignedByte & 240) >> 4;
    }

    public final long d() {
        int i10 = this.f30001c;
        if (i10 == 0) {
            throw new NoSuchElementException();
        }
        long[] jArr = (long[]) this.f30003e;
        int i11 = this.f29999a;
        long j10 = jArr[i11];
        this.f29999a = this.f30002d & (i11 + 1);
        this.f30001c = i10 - 1;
        return j10;
    }

    @Override // com.google.android.gms.internal.ads.u6
    public final int zza() {
        return this.f29999a;
    }

    @Override // com.google.android.gms.internal.ads.u6
    public final int zzb() {
        return -1;
    }

    @Override // com.google.android.gms.internal.ads.u6
    public final int zzc() {
        int i10 = this.f30000b;
        if (i10 == 8) {
            return ((p01) this.f30003e).I();
        }
        if (i10 == 16) {
            return ((p01) this.f30003e).J();
        }
        int i11 = this.f30001c;
        this.f30001c = i11 + 1;
        if (i11 % 2 != 0) {
            return this.f30002d & 15;
        }
        int I = ((p01) this.f30003e).I();
        this.f30002d = I;
        return (I & 240) >> 4;
    }
}
