package defpackage;

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

/* JADX INFO: renamed from: ᵺʾːˁ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C5117 implements InterfaceC4834 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final int f19270;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final AbstractC4509 f19271;

    public C5117(int i, C2598 c2598) {
        this.f19270 = i;
        this.f19271 = c2598;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public static C5117 m10619(int i, C4545 c4545) {
        InterfaceC4834 c1797;
        String str;
        int i2 = 4;
        ˑᵕʾ.ːˏᵟᵯ(4, "initialCapacity");
        Object[] objArrCopyOf = new Object[4];
        int i3 = c4545.f17283;
        int iM8829 = -2;
        int i4 = 0;
        while (c4545.m9623() > 8) {
            int iM9618 = c4545.m9618();
            int iM96182 = c4545.f17282 + c4545.m9618();
            c4545.m9612(iM96182);
            if (iM9618 != 1414744396) {
                C4016 c4016 = null;
                switch (iM9618) {
                    case 1718776947:
                        if (iM8829 != 2) {
                            if (iM8829 == 1) {
                                int iM9607 = c4545.m9607();
                                String str2 = iM9607 != 1 ? iM9607 != 85 ? iM9607 != 255 ? iM9607 != 8192 ? iM9607 != 8193 ? null : "audio/vnd.dts" : "audio/ac3" : "audio/mp4a-latm" : "audio/mpeg" : "audio/raw";
                                if (str2 != null) {
                                    int iM96072 = c4545.m9607();
                                    int iM96183 = c4545.m9618();
                                    c4545.m9609(6);
                                    int iM96073 = c4545.m9607();
                                    String str3 = AbstractC0956.f4222;
                                    int iM3212 = AbstractC0956.m3212(iM96073, ByteOrder.LITTLE_ENDIAN);
                                    int iM96074 = c4545.m9623() > 0 ? c4545.m9607() : 0;
                                    C4753 c4753 = new C4753();
                                    c4753.f18101 = AbstractC4208.m9132(str2);
                                    c4753.f18090 = iM96072;
                                    c4753.f18113 = iM96183;
                                    if (str2.equals("audio/raw") && iM3212 != 0) {
                                        c4753.f18095 = iM3212;
                                    }
                                    if (str2.equals("audio/mp4a-latm") && iM96074 > 0) {
                                        byte[] bArr = new byte[iM96074];
                                        c4545.m9627(bArr, 0, iM96074);
                                        c4753.f18119 = AbstractC4509.m9553(bArr);
                                    }
                                    c1797 = new C1797(new C5286(c4753));
                                } else {
                                    AbstractC3653.m8224(iM9607, "Ignoring track with unsupported format tag ");
                                }
                            } else {
                                ˋˀᵧ.ʿٴˇ("Ignoring strf box for unsupported track type: ".concat(AbstractC0956.m3226(iM8829)));
                            }
                            c1797 = c4016;
                            break;
                        } else {
                            c4545.m9609(i2);
                            int iM96184 = c4545.m9618();
                            int iM96185 = c4545.m9618();
                            c4545.m9609(i2);
                            int iM96186 = c4545.m9618();
                            switch (iM96186) {
                                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) {
                                C4753 c47532 = new C4753();
                                c47532.f18098 = iM96184;
                                c47532.f18102 = iM96185;
                                c47532.f18101 = AbstractC4208.m9132(str);
                                c1797 = new C1797(new C5286(c47532));
                            } else {
                                AbstractC3653.m8224(iM96186, "Ignoring track with unsupported compression ");
                                c1797 = c4016;
                            }
                        }
                        break;
                    case 1751742049:
                        int iM96187 = c4545.m9618();
                        c4545.m9609(8);
                        int iM96188 = c4545.m9618();
                        int iM96189 = c4545.m9618();
                        c4545.m9609(i2);
                        c4545.m9618();
                        c4545.m9609(12);
                        c1797 = new C2494(iM96187, iM96188, iM96189);
                        break;
                    case 1752331379:
                        int iM961810 = c4545.m9618();
                        c4545.m9609(12);
                        c4545.m9618();
                        int iM961811 = c4545.m9618();
                        int iM961812 = c4545.m9618();
                        c4545.m9609(i2);
                        int iM961813 = c4545.m9618();
                        int iM961814 = c4545.m9618();
                        c4545.m9609(i2);
                        c4016 = new C4016(iM961810, iM961811, iM961812, iM961813, iM961814, c4545.m9618());
                        c1797 = c4016;
                        break;
                    case 1852994675:
                        c1797 = new C0311(c4545.m9617(c4545.m9623(), StandardCharsets.UTF_8));
                        break;
                    default:
                        c1797 = c4016;
                        break;
                }
            } else {
                c1797 = m10619(c4545.m9618(), c4545);
            }
            if (c1797 != null) {
                if (c1797.mo1562() == 1752331379) {
                    iM8829 = ((C4016) c1797).m8829();
                }
                int i5 = i4 + 1;
                int iM8058 = AbstractC3544.m8058(objArrCopyOf.length, i5);
                if (iM8058 > objArrCopyOf.length) {
                    objArrCopyOf = Arrays.copyOf(objArrCopyOf, iM8058);
                }
                objArrCopyOf[i4] = c1797;
                i4 = i5;
            }
            c4545.m9624(iM96182);
            c4545.m9612(i3);
            i2 = 4;
        }
        return new C5117(i, AbstractC4509.m9563(i4, objArrCopyOf));
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final InterfaceC4834 m10620(Class cls) {
        C2822 c2822ListIterator = this.f19271.listIterator(0);
        while (c2822ListIterator.hasNext()) {
            InterfaceC4834 interfaceC4834 = (InterfaceC4834) c2822ListIterator.next();
            if (interfaceC4834.getClass() == cls) {
                return interfaceC4834;
            }
        }
        return null;
    }

    @Override // defpackage.InterfaceC4834
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final int mo1562() {
        return this.f19270;
    }
}
