package B0;

import android.content.Context;
import android.os.Looper;
import java.nio.ByteBuffer;
import n4.u0;
import x0.AbstractC1709a;

/* JADX INFO: loaded from: classes.dex */
public final class t0 implements u2.i {

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

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

    public /* synthetic */ t0() {
        this.f915a = 4;
    }

    @Override // u2.i
    public boolean a(q2.h hVar) {
        return this.f916b;
    }

    @Override // u2.i
    public boolean b() {
        return this.f916b;
    }

    public synchronized void c() {
        while (!this.f916b) {
            wait();
        }
    }

    public synchronized void d() {
        boolean z8 = false;
        while (!this.f916b) {
            try {
                wait();
            } catch (InterruptedException unused) {
                z8 = true;
            }
        }
        if (z8) {
            Thread.currentThread().interrupt();
        }
    }

    public synchronized void e() {
        this.f916b = false;
    }

    public synchronized boolean f() {
        if (this.f916b) {
            return false;
        }
        this.f916b = true;
        notifyAll();
        return true;
    }

    public void g(boolean z8) {
        switch (this.f915a) {
            case u0.f15495q /* 0 */:
                if (this.f916b != z8) {
                    this.f916b = z8;
                    break;
                }
                break;
            default:
                if (this.f916b != z8) {
                    this.f916b = z8;
                    break;
                }
                break;
        }
    }

    public /* synthetic */ t0(int i, boolean z8) {
        this.f915a = i;
        this.f916b = z8;
    }

    public t0(Context context, Looper looper, x0.q qVar, int i) {
        this.f915a = i;
        switch (i) {
            case 1:
                new C4.f(context.getApplicationContext());
                qVar.a(looper, null);
                break;
            default:
                new x3.e(context.getApplicationContext());
                qVar.a(looper, null);
                break;
        }
    }

    public t0(y0.o oVar, y0.q qVar) {
        this.f915a = 5;
        int i = qVar.f18874a;
        AbstractC1709a.d(i == 6 || i == 3);
        ByteBuffer byteBuffer = qVar.f18875b;
        int iMin = Math.min(4, byteBuffer.remaining());
        byte[] bArr = new byte[iMin];
        byteBuffer.asReadOnlyBuffer().get(bArr);
        T0.H h8 = new T0.H(iMin, bArr);
        oVar.getClass();
        y0.o.a(false);
        if (h8.h()) {
            this.f916b = false;
            return;
        }
        int i5 = h8.i(2);
        boolean zH = h8.h();
        y0.o.a(false);
        if (!zH) {
            this.f916b = true;
            return;
        }
        boolean zH2 = (i5 == 3 || i5 == 0) ? true : h8.h();
        h8.s();
        y0.o.a(!false);
        if (h8.h()) {
            y0.o.a(!false);
            h8.s();
        }
        y0.o.a(false);
        if (i5 != 3) {
            h8.s();
        }
        h8.t(0);
        if (i5 != 2 && i5 != 0 && !zH2) {
            h8.t(3);
        }
        this.f916b = ((i5 == 3 || i5 == 0) ? 255 : h8.i(8)) != 0;
    }
}
