package T0;

import x0.AbstractC1709a;

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

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final byte[] f6351a = new byte[10];

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

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

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

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

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

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

    public final void a(F f3, E e8) {
        if (this.f6353c > 0) {
            f3.a(this.f6354d, this.f6355e, this.f6356f, this.f6357g, e8);
            this.f6353c = 0;
        }
    }

    public final void b(F f3, long j8, int i, int i5, int i8, E e8) {
        AbstractC1709a.i("TrueHD chunk samples must be contiguous in the sample queue.", this.f6357g <= i5 + i8);
        if (this.f6352b) {
            int i9 = this.f6353c;
            int i10 = i9 + 1;
            this.f6353c = i10;
            if (i9 == 0) {
                this.f6354d = j8;
                this.f6355e = i;
                this.f6356f = 0;
            }
            this.f6356f += i5;
            this.f6357g = i8;
            if (i10 >= 16) {
                a(f3, e8);
            }
        }
    }

    public final void c(n nVar) {
        if (this.f6352b) {
            return;
        }
        byte[] bArr = this.f6351a;
        int i = 0;
        nVar.n(bArr, 0, 10);
        nVar.a();
        if (bArr[4] == -8 && bArr[5] == 114 && bArr[6] == 111) {
            byte b8 = bArr[7];
            if ((b8 & 254) == 186) {
                i = 40 << ((bArr[(b8 & 255) == 187 ? '\t' : '\b'] >> 4) & 7);
            }
        }
        if (i == 0) {
            return;
        }
        this.f6352b = true;
    }
}
