package x2;

import androidx.media3.common.util.Assertions;
import androidx.media3.extractor.z0;
import com.google.android.gms.internal.ads.ih1;
import com.google.android.gms.internal.ads.u3;

/* JADX INFO: loaded from: classes.dex */
public final class n {

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

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

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

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

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

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

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public long f34545g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final Object f34546h;

    public final void a(int i10, int i11, byte[] bArr) {
        if (this.f34540b) {
            int i12 = this.f34543e;
            int i13 = (i10 + 1) - i12;
            if (i13 >= i11) {
                this.f34543e = (i11 - i10) + i12;
            } else {
                this.f34541c = ((bArr[i13] & 192) >> 6) == 0;
                this.f34540b = false;
            }
        }
    }

    public final void b(int i10, boolean z10, long j10) {
        Assertions.checkState(this.f34545g != -9223372036854775807L);
        if (this.f34542d == 182 && z10 && this.f34539a) {
            ((z0) this.f34546h).sampleMetadata(this.f34545g, this.f34541c ? 1 : 0, (int) (j10 - this.f34544f), i10, null);
        }
        if (this.f34542d != 179) {
            this.f34544f = j10;
        }
    }

    public final void c(byte[] bArr, int i10, int i11) {
        if (this.f34540b) {
            int i12 = this.f34543e;
            int i13 = (i10 + 1) - i12;
            if (i13 >= i11) {
                this.f34543e = (i11 - i10) + i12;
            } else {
                this.f34541c = ((bArr[i13] & 192) >> 6) == 0;
                this.f34540b = false;
            }
        }
    }

    public final void d(int i10, boolean z10, long j10) {
        ih1.b1(this.f34545g != -9223372036854775807L);
        if (this.f34542d == 182 && z10 && this.f34539a) {
            ((u3) this.f34546h).zze(this.f34545g, this.f34541c ? 1 : 0, (int) (j10 - this.f34544f), i10, null);
        }
        if (this.f34542d != 179) {
            this.f34544f = j10;
        }
    }
}
