package y2;

import androidx.media3.common.ParserException;
import androidx.media3.common.util.Log;
import androidx.media3.common.util.ParsableByteArray;
import androidx.media3.extractor.z;

/* JADX INFO: loaded from: classes.dex */
public abstract class e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final byte[] f36759a = {0, 0, 0, 0, 16, 0, -128, 0, 0, -86, 0, 56, -101, 113};

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final byte[] f36760b = {0, 0, 33, 7, -45, 17, -122, 68, -56, -63, -54, 0, 0, 0};

    public static boolean a(z zVar) {
        ParsableByteArray parsableByteArray = new ParsableByteArray(8);
        int i10 = h2.f.a(zVar, parsableByteArray).f26404a;
        if (i10 != 1380533830 && i10 != 1380333108) {
            return false;
        }
        zVar.a(0, 4, parsableByteArray.getData());
        parsableByteArray.setPosition(0);
        int i11 = parsableByteArray.readInt();
        if (i11 == 1463899717) {
            return true;
        }
        Log.e("WavHeaderReader", "Unsupported form type: " + i11);
        return false;
    }

    public static h2.f b(int i10, z zVar, ParsableByteArray parsableByteArray) throws ParserException {
        h2.f fVarA = h2.f.a(zVar, parsableByteArray);
        while (true) {
            int i11 = fVarA.f26404a;
            if (i11 == i10) {
                return fVarA;
            }
            defpackage.e.z("Ignoring unknown WAV chunk: ", i11, "WavHeaderReader");
            long j10 = fVarA.f26405b;
            long j11 = 8 + j10;
            if (j10 % 2 != 0) {
                j11 = 9 + j10;
            }
            if (j11 > 2147483647L) {
                throw ParserException.createForUnsupportedContainerFeature("Chunk is too large (~2GB+) to skip; id: " + i11);
            }
            zVar.k((int) j11);
            fVarA = h2.f.a(zVar, parsableByteArray);
        }
    }
}
