package defpackage;

import j$.util.Objects;
import java.io.EOFException;
import java.util.Arrays;

/* renamed from: ᵼᵷ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C5306 implements InterfaceC2154 {

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public static final C3446 f19859;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public static final C3446 f19860;

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public int f19861;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public C3446 f19862;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final C1665 f19863;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final C3446 f19864;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public byte[] f19865;

    static {
        C2153 c2153 = new C2153();
        c2153.f8516 = AbstractC2924.m7101("application/id3");
        f19860 = new C3446(c2153);
        C2153 c21532 = new C2153();
        c21532.f8516 = AbstractC2924.m7101("application/x-emsg");
        f19859 = new C3446(c21532);
    }

    public C5306(C1665 c1665, int i) {
        this.f19863 = c1665;
        if (i == 1) {
            this.f19864 = f19860;
        } else {
            if (i != 3) {
                ᵹˉᵞ.ˌᵜᵹᵩ(AbstractC2990.m7313(i, "Unknown metadataType: "));
                throw null;
            }
            this.f19864 = f19859;
        }
        this.f19865 = new byte[0];
        this.f19861 = 0;
    }

    @Override // defpackage.InterfaceC2154
    /* renamed from: ˇʼʤˎ */
    public final /* synthetic */ void mo4406(int i, C3493 c3493) {
        AbstractC2990.m7314(this, c3493, i);
    }

    @Override // defpackage.InterfaceC2154
    /* renamed from: ˎˏʜʾ */
    public final void mo4407(C3446 c3446) {
        this.f19862 = c3446;
        this.f19863.mo4407(this.f19864);
    }

    @Override // defpackage.InterfaceC2154
    /* renamed from: ˏˋٴ */
    public final int mo4408(InterfaceC1463 interfaceC1463, int i, boolean z) {
        return mo4409(interfaceC1463, i, z);
    }

    @Override // defpackage.InterfaceC2154
    /* renamed from: ˏᵙ */
    public final int mo4409(InterfaceC1463 interfaceC1463, int i, boolean z) throws EOFException {
        int i2 = this.f19861 + i;
        byte[] bArr = this.f19865;
        if (bArr.length < i2) {
            this.f19865 = Arrays.copyOf(bArr, (i2 / 2) + i2);
        }
        int i3 = interfaceC1463.read(this.f19865, this.f19861, i);
        if (i3 != -1) {
            this.f19861 += i3;
            return i3;
        }
        if (z) {
            return -1;
        }
        throw new EOFException();
    }

    @Override // defpackage.InterfaceC2154
    /* renamed from: ᵥᵯˎ */
    public final void mo4410(long j, int i, int i2, int i3, C5346 c5346) {
        this.f19862.getClass();
        int i4 = this.f19861 - i3;
        C3493 c3493 = new C3493(Arrays.copyOfRange(this.f19865, i4 - i2, i4));
        byte[] bArr = this.f19865;
        System.arraycopy(bArr, i4, bArr, 0, i3);
        this.f19861 = i3;
        String str = this.f19862.f12929;
        C3446 c3446 = this.f19864;
        String str2 = c3446.f12929;
        String str3 = c3446.f12929;
        if (!Objects.equals(str, str2)) {
            if (!"application/x-emsg".equals(this.f19862.f12929)) {
                ᵳʿˉ.ᵶʔᵢˊ("Ignoring sample for unsupported format: " + this.f19862.f12929);
                return;
            }
            C1361 c1361M5556 = C2021.m5556(c3493);
            C3446 c3446Mo1236 = c1361M5556.mo1236();
            if (c3446Mo1236 == null || !Objects.equals(str3, c3446Mo1236.f12929)) {
                ᵳʿˉ.ᵶʔᵢˊ("Ignoring EMSG. Expected it to contain wrapped " + str3 + " but actual wrapped format: " + c1361M5556.mo1236());
                return;
            }
            byte[] bArrMo1235 = c1361M5556.mo1235();
            bArrMo1235.getClass();
            c3493 = new C3493(bArrMo1235);
        }
        int iM7959 = c3493.m7959();
        C1665 c1665 = this.f19863;
        AbstractC2990.m7314(c1665, c3493, iM7959);
        c1665.mo4410(j, i, iM7959, 0, c5346);
    }

    @Override // defpackage.InterfaceC2154
    /* renamed from: ᵴᵳ */
    public final void mo4411(C3493 c3493, int i, int i2) {
        int i3 = this.f19861 + i;
        byte[] bArr = this.f19865;
        if (bArr.length < i3) {
            this.f19865 = Arrays.copyOf(bArr, (i3 / 2) + i3);
        }
        c3493.m7970(this.f19865, this.f19861, i);
        this.f19861 += i;
    }

    @Override // defpackage.InterfaceC2154
    /* renamed from: ᵻᵢﹳᵰ */
    public final /* synthetic */ void mo4412(long j) {
    }
}
