package defpackage;

import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

/* renamed from: ᵪᵡʝٴ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C3902 implements InterfaceC0244 {

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

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

    public C3902(int i, C4471 c4471) {
        this.f14555 = i;
        this.f14554 = c4471;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public static C3902 m8553(int i, C3493 c3493) {
        InterfaceC0244 c2640;
        String str;
        int i2 = 4;
        ˏᵭᵔᵬ.ᵻᵢﹳᵰ(4, "initialCapacity");
        Object[] objArrCopyOf = new Object[4];
        int i3 = c3493.f13081;
        int iM3370 = -2;
        int i4 = 0;
        while (c3493.m7959() > 8) {
            int iM7966 = c3493.m7966();
            int iM79662 = c3493.f13083 + c3493.m7966();
            c3493.m7950(iM79662);
            if (iM7966 != 1414744396) {
                C1009 c1009 = null;
                switch (iM7966) {
                    case 1718776947:
                        if (iM3370 == 2) {
                            c3493.m7946(i2);
                            int iM79663 = c3493.m7966();
                            int iM79664 = c3493.m7966();
                            c3493.m7946(i2);
                            int iM79665 = c3493.m7966();
                            switch (iM79665) {
                                case 808802372:
                                case 877677894:
                                case 1145656883:
                                case 1145656920:
                                case 1482049860:
                                case 1684633208:
                                case 2021026148:
                                    str = "video/mp4v-es";
                                    break;
                                case 826496577:
                                case 828601953:
                                case 875967048:
                                    str = "video/avc";
                                    break;
                                case 842289229:
                                    str = "video/mp42";
                                    break;
                                case 859066445:
                                    str = "video/mp43";
                                    break;
                                case 1196444237:
                                case 1735420525:
                                    str = "video/mjpeg";
                                    break;
                                default:
                                    str = null;
                                    break;
                            }
                            if (str != null) {
                                C2153 c2153 = new C2153();
                                c2153.f8501 = iM79663;
                                c2153.f8514 = iM79664;
                                c2153.f8516 = AbstractC2924.m7101(str);
                                c2640 = new C2640(new C3446(c2153));
                                break;
                            } else {
                                AbstractC1327.m4103(iM79665, "Ignoring track with unsupported compression ");
                                c2640 = c1009;
                                break;
                            }
                        } else {
                            if (iM3370 == 1) {
                                int iM7962 = c3493.m7962();
                                String str2 = iM7962 != 1 ? iM7962 != 85 ? iM7962 != 255 ? iM7962 != 8192 ? iM7962 != 8193 ? null : "audio/vnd.dts" : "audio/ac3" : "audio/mp4a-latm" : "audio/mpeg" : "audio/raw";
                                if (str2 != null) {
                                    int iM79622 = c3493.m7962();
                                    int iM79666 = c3493.m7966();
                                    c3493.m7946(6);
                                    int iM79623 = c3493.m7962();
                                    String str3 = AbstractC3558.f13329;
                                    int iM8144 = AbstractC3558.m8144(iM79623, ByteOrder.LITTLE_ENDIAN);
                                    int iM79624 = c3493.m7959() > 0 ? c3493.m7962() : 0;
                                    C2153 c21532 = new C2153();
                                    c21532.f8516 = AbstractC2924.m7101(str2);
                                    c21532.f8517 = iM79622;
                                    c21532.f8513 = iM79666;
                                    if (str2.equals("audio/raw") && iM8144 != 0) {
                                        c21532.f8526 = iM8144;
                                    }
                                    if (str2.equals("audio/mp4a-latm") && iM79624 > 0) {
                                        byte[] bArr = new byte[iM79624];
                                        c3493.m7970(bArr, 0, iM79624);
                                        c21532.f8506 = AbstractC2692.m6702(bArr);
                                    }
                                    c2640 = new C2640(new C3446(c21532));
                                    break;
                                } else {
                                    AbstractC1327.m4103(iM7962, "Ignoring track with unsupported format tag ");
                                }
                            } else {
                                ᵳʿˉ.ᵶʔᵢˊ("Ignoring strf box for unsupported track type: ".concat(AbstractC3558.m8162(iM3370)));
                            }
                            c2640 = c1009;
                        }
                    case 1751742049:
                        int iM79667 = c3493.m7966();
                        c3493.m7946(8);
                        int iM79668 = c3493.m7966();
                        int iM79669 = c3493.m7966();
                        c3493.m7946(i2);
                        c3493.m7966();
                        c3493.m7946(12);
                        c2640 = new C0445(iM79667, iM79668, iM79669);
                        break;
                    case 1752331379:
                        int iM796610 = c3493.m7966();
                        c3493.m7946(12);
                        c3493.m7966();
                        int iM796611 = c3493.m7966();
                        int iM796612 = c3493.m7966();
                        c3493.m7946(i2);
                        int iM796613 = c3493.m7966();
                        int iM796614 = c3493.m7966();
                        c3493.m7946(i2);
                        c1009 = new C1009(iM796610, iM796611, iM796612, iM796613, iM796614, c3493.m7966());
                        c2640 = c1009;
                        break;
                    case 1852994675:
                        c2640 = new C2959(c3493.m7973(c3493.m7959(), StandardCharsets.UTF_8));
                        break;
                    default:
                        c2640 = c1009;
                        break;
                }
            } else {
                c2640 = m8553(c3493.m7966(), c3493);
            }
            if (c2640 != null) {
                if (c2640.mo1552() == 1752331379) {
                    iM3370 = ((C1009) c2640).m3370();
                }
                int i5 = i4 + 1;
                int iM7813 = AbstractC3435.m7813(objArrCopyOf.length, i5);
                if (iM7813 > objArrCopyOf.length) {
                    objArrCopyOf = Arrays.copyOf(objArrCopyOf, iM7813);
                }
                objArrCopyOf[i4] = c2640;
                i4 = i5;
            }
            c3493.m7955(iM79662);
            c3493.m7950(i3);
            i2 = 4;
        }
        return new C3902(i, AbstractC2692.m6695(i4, objArrCopyOf));
    }

    @Override // defpackage.InterfaceC0244
    /* renamed from: ᵥᵯˎ */
    public final int mo1552() {
        return this.f14555;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final InterfaceC0244 m8554(Class cls) {
        C4421 c4421ListIterator = this.f14554.listIterator(0);
        while (c4421ListIterator.hasNext()) {
            InterfaceC0244 interfaceC0244 = (InterfaceC0244) c4421ListIterator.next();
            if (interfaceC0244.getClass() == cls) {
                return interfaceC0244;
            }
        }
        return null;
    }
}
