多宝语音 v1.5.0版本的 MD5 值为:dcfcdc4e4f0a662eb0256f88e60f66b1

以下内容为反编译后的 e.java 源代码,内容仅作参考


package xp;

import android.util.Pair;
import android.util.SparseArray;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.video.ColorInfo;
import com.tencent.mm.opensdk.modelmsg.WXVideoFileObject;
import com.tencent.mmkv.MMKV;
import fr.g0;
import fr.k;
import fr.l;
import fr.n;
import fr.r;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
import pp.t;
import up.h;
import up.i;
import up.j;
import up.o;
import up.q;

public final class e implements up.g {
    public static final j Z = new j() {
        @Override
        public final up.g[] a() {
            up.g[] q11;
            q11 = e.q();
            return q11;
        }
    };

    public static final byte[] f49220a0 = {49, 10, 48, 48, 58, 48, 48, 58, 48, 48, 44, 48, 48, 48, 32, 45, 45, 62, 32, 48, 48, 58, 48, 48, 58, 48, 48, 44, 48, 48, 48, 10};

    public static final byte[] f49221b0 = {32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32};

    public static final byte[] f49222c0 = g0.M("Format: Start, End, ReadOrder, Layer, Style, Name, MarginL, MarginR, MarginV, Effect, Text");

    public static final byte[] f49223d0 = {68, 105, 97, 108, 111, 103, 117, 101, 58, 32, 48, 58, 48, 48, 58, 48, 48, 58, 48, 48, 44, 48, 58, 48, 48, 58, 48, 48, 58, 48, 48, 44};

    public static final byte[] f49224e0 = {32, 32, 32, 32, 32, 32, 32, 32, 32, 32};

    public static final UUID f49225f0 = new UUID(72057594037932032L, -9223371306706625679L);
    public long A;
    public l B;
    public l C;
    public boolean D;
    public int E;
    public long F;
    public long G;
    public int H;
    public int I;
    public int[] J;
    public int K;
    public int L;
    public int M;
    public int N;
    public boolean O;
    public boolean P;
    public boolean Q;
    public boolean R;
    public byte S;
    public int T;
    public int U;
    public int V;
    public boolean W;
    public boolean X;
    public i Y;

    public final xp.b f49226a;

    public final g f49227b;

    public final SparseArray<c> f49228c;

    public final boolean f49229d;

    public final r f49230e;

    public final r f49231f;

    public final r f49232g;

    public final r f49233h;

    public final r f49234i;

    public final r f49235j;

    public final r f49236k;

    public final r f49237l;

    public final r f49238m;

    public ByteBuffer f49239n;

    public long f49240o;

    public long f49241p;

    public long f49242q;

    public long f49243r;

    public long f49244s;

    public c f49245t;

    public boolean f49246u;

    public int f49247v;

    public long f49248w;

    public boolean f49249x;

    public long f49250y;

    public long f49251z;

    public final class b implements xp.c {
        public b() {
        }

        @Override
        public void a(int i11) throws t {
            e.this.l(i11);
        }

        @Override
        public void b(int i11, double d11) throws t {
            e.this.n(i11, d11);
        }

        @Override
        public void c(int i11, long j11) throws t {
            e.this.o(i11, j11);
        }

        @Override
        public int d(int i11) {
            switch (i11) {
                case 131:
                case 136:
                case 155:
                case 159:
                case 176:
                case 179:
                case 186:
                case 215:
                case 231:
                case 241:
                case 251:
                case 16980:
                case 17029:
                case 17143:
                case 18401:
                case 18408:
                case 20529:
                case 20530:
                case 21420:
                case 21432:
                case 21680:
                case 21682:
                case 21690:
                case 21930:
                case 21945:
                case 21946:
                case 21947:
                case 21948:
                case 21949:
                case 22186:
                case 22203:
                case 25188:
                case 2352003:
                case 2807729:
                    return 2;
                case 134:
                case 17026:
                case 21358:
                case 2274716:
                    return 3;
                case 160:
                case 174:
                case 183:
                case 187:
                case 224:
                case 225:
                case 18407:
                case 19899:
                case 20532:
                case 20533:
                case 21936:
                case 21968:
                case 25152:
                case 28032:
                case 30320:
                case 290298740:
                case 357149030:
                case 374648427:
                case 408125543:
                case 440786851:
                case 475249515:
                case 524531317:
                    return 1;
                case 161:
                case 163:
                case 16981:
                case 18402:
                case 21419:
                case 25506:
                case 30322:
                    return 4;
                case 181:
                case 17545:
                case 21969:
                case 21970:
                case 21971:
                case 21972:
                case 21973:
                case 21974:
                case 21975:
                case 21976:
                case 21977:
                case 21978:
                    return 5;
                default:
                    return 0;
            }
        }

        @Override
        public boolean e(int i11) {
            if (i11 != 357149030 && i11 != 524531317 && i11 != 475249515 && i11 != 374648427) {
                return false;
            }
            return true;
        }

        @Override
        public void f(int i11, int i12, h hVar) throws IOException, InterruptedException {
            e.this.h(i11, i12, hVar);
        }

        @Override
        public void g(int i11, String str) throws t {
            e.this.z(i11, str);
        }

        @Override
        public void h(int i11, long j11, long j12) throws t {
            e.this.y(i11, j11, j12);
        }
    }

    public static final class c {
        public float A;
        public float B;
        public float C;
        public float D;
        public float E;
        public float F;
        public float G;
        public int H;
        public int I;
        public int J;
        public long K;
        public long L;
        public d M;
        public boolean N;
        public boolean O;
        public String P;
        public q Q;
        public int R;

        public String f49253a;

        public String f49254b;

        public int f49255c;

        public int f49256d;

        public int f49257e;

        public boolean f49258f;

        public byte[] f49259g;

        public q.a f49260h;

        public byte[] f49261i;

        public DrmInitData f49262j;

        public int f49263k;

        public int f49264l;

        public int f49265m;

        public int f49266n;

        public int f49267o;

        public byte[] f49268p;

        public int f49269q;

        public boolean f49270r;

        public int f49271s;

        public int f49272t;

        public int f49273u;

        public int f49274v;

        public int f49275w;

        public float f49276x;

        public float f49277y;

        public float f49278z;

        public c() {
            this.f49263k = -1;
            this.f49264l = -1;
            this.f49265m = -1;
            this.f49266n = -1;
            this.f49267o = 0;
            this.f49268p = null;
            this.f49269q = -1;
            this.f49270r = false;
            this.f49271s = -1;
            this.f49272t = -1;
            this.f49273u = -1;
            this.f49274v = 1000;
            this.f49275w = 200;
            this.f49276x = -1.0f;
            this.f49277y = -1.0f;
            this.f49278z = -1.0f;
            this.A = -1.0f;
            this.B = -1.0f;
            this.C = -1.0f;
            this.D = -1.0f;
            this.E = -1.0f;
            this.F = -1.0f;
            this.G = -1.0f;
            this.H = 1;
            this.I = -1;
            this.J = 8000;
            this.K = 0L;
            this.L = 0L;
            this.O = true;
            this.P = "eng";
        }

        public static Pair<String, List<byte[]>> e(r rVar) throws t {
            try {
                rVar.L(16);
                long o11 = rVar.o();
                if (o11 == 1482049860) {
                    return new Pair<>("video/3gpp", null);
                }
                if (o11 == 826496599) {
                    byte[] bArr = rVar.f34684a;
                    for (int c11 = rVar.c() + 20; c11 < bArr.length - 4; c11++) {
                        if (bArr[c11] == 0 && bArr[c11 + 1] == 0 && bArr[c11 + 2] == 1 && bArr[c11 + 3] == 15) {
                            return new Pair<>("video/wvc1", Collections.singletonList(Arrays.copyOfRange(bArr, c11, bArr.length)));
                        }
                    }
                    throw new t("Failed to find FourCC VC1 initialization data");
                }
                k.f("MatroskaExtractor", "Unknown FourCC. Setting mimeType to video/x-unknown");
                return new Pair<>("video/x-unknown", null);
            } catch (ArrayIndexOutOfBoundsException unused) {
                throw new t("Error parsing FourCC private data");
            }
        }

        public static boolean f(r rVar) throws t {
            try {
                int q11 = rVar.q();
                if (q11 == 1) {
                    return true;
                }
                if (q11 != 65534) {
                    return false;
                }
                rVar.K(24);
                if (rVar.r() == e.f49225f0.getMostSignificantBits()) {
                    if (rVar.r() == e.f49225f0.getLeastSignificantBits()) {
                        return true;
                    }
                }
                return false;
            } catch (ArrayIndexOutOfBoundsException unused) {
                throw new t("Error parsing MS/ACM codec private");
            }
        }

        public static List<byte[]> g(byte[] bArr) throws t {
            int i11;
            int i12;
            try {
                if (bArr[0] == 2) {
                    int i13 = 1;
                    int i14 = 0;
                    while (true) {
                        i11 = bArr[i13];
                        if (i11 != -1) {
                            break;
                        }
                        i14 += 255;
                        i13++;
                    }
                    int i15 = i13 + 1;
                    int i16 = i14 + i11;
                    int i17 = 0;
                    while (true) {
                        i12 = bArr[i15];
                        if (i12 != -1) {
                            break;
                        }
                        i17 += 255;
                        i15++;
                    }
                    int i18 = i15 + 1;
                    int i19 = i17 + i12;
                    if (bArr[i18] == 1) {
                        byte[] bArr2 = new byte[i16];
                        System.arraycopy(bArr, i18, bArr2, 0, i16);
                        int i21 = i18 + i16;
                        if (bArr[i21] == 3) {
                            int i22 = i21 + i19;
                            if (bArr[i22] == 5) {
                                byte[] bArr3 = new byte[bArr.length - i22];
                                System.arraycopy(bArr, i22, bArr3, 0, bArr.length - i22);
                                ArrayList arrayList = new ArrayList(2);
                                arrayList.add(bArr2);
                                arrayList.add(bArr3);
                                return arrayList;
                            }
                            throw new t("Error parsing vorbis codec private");
                        }
                        throw new t("Error parsing vorbis codec private");
                    }
                    throw new t("Error parsing vorbis codec private");
                }
                throw new t("Error parsing vorbis codec private");
            } catch (ArrayIndexOutOfBoundsException unused) {
                throw new t("Error parsing vorbis codec private");
            }
        }

        public final byte[] b() {
            if (this.f49276x != -1.0f && this.f49277y != -1.0f && this.f49278z != -1.0f && this.A != -1.0f && this.B != -1.0f && this.C != -1.0f && this.D != -1.0f && this.E != -1.0f && this.F != -1.0f && this.G != -1.0f) {
                byte[] bArr = new byte[25];
                ByteBuffer wrap = ByteBuffer.wrap(bArr);
                wrap.put((byte) 0);
                wrap.putShort((short) ((this.f49276x * 50000.0f) + 0.5f));
                wrap.putShort((short) ((this.f49277y * 50000.0f) + 0.5f));
                wrap.putShort((short) ((this.f49278z * 50000.0f) + 0.5f));
                wrap.putShort((short) ((this.A * 50000.0f) + 0.5f));
                wrap.putShort((short) ((this.B * 50000.0f) + 0.5f));
                wrap.putShort((short) ((this.C * 50000.0f) + 0.5f));
                wrap.putShort((short) ((this.D * 50000.0f) + 0.5f));
                wrap.putShort((short) ((this.E * 50000.0f) + 0.5f));
                wrap.putShort((short) (this.F + 0.5f));
                wrap.putShort((short) (this.G + 0.5f));
                wrap.putShort((short) this.f49274v);
                wrap.putShort((short) this.f49275w);
                return bArr;
            }
            return null;
        }

        public void c(i iVar, int i11) throws t {
            char c11;
            List<byte[]> singletonList;
            String str;
            int H;
            String str2;
            int i12;
            int i13;
            String str3;
            List<byte[]> list;
            Format q11;
            int i14;
            int i15;
            int i16;
            String str4 = this.f49254b;
            str4.hashCode();
            int i17 = 1;
            switch (str4.hashCode()) {
                case -2095576542:
                    if (str4.equals("V_MPEG4/ISO/AP")) {
                        c11 = 0;
                        break;
                    }
                    c11 = 65535;
                    break;
                case -2095575984:
                    if (str4.equals("V_MPEG4/ISO/SP")) {
                        c11 = 1;
                        break;
                    }
                    c11 = 65535;
                    break;
                case -1985379776:
                    if (str4.equals("A_MS/ACM")) {
                        c11 = 2;
                        break;
                    }
                    c11 = 65535;
                    break;
                case -1784763192:
                    if (str4.equals("A_TRUEHD")) {
                        c11 = 3;
                        break;
                    }
                    c11 = 65535;
                    break;
                case -1730367663:
                    if (str4.equals("A_VORBIS")) {
                        c11 = 4;
                        break;
                    }
                    c11 = 65535;
                    break;
                case -1482641358:
                    if (str4.equals("A_MPEG/L2")) {
                        c11 = 5;
                        break;
                    }
                    c11 = 65535;
                    break;
                case -1482641357:
                    if (str4.equals("A_MPEG/L3")) {
                        c11 = 6;
                        break;
                    }
                    c11 = 65535;
                    break;
                case -1373388978:
                    if (str4.equals("V_MS/VFW/FOURCC")) {
                        c11 = 7;
                        break;
                    }
                    c11 = 65535;
                    break;
                case -933872740:
                    if (str4.equals("S_DVBSUB")) {
                        c11 = '\b';
                        break;
                    }
                    c11 = 65535;
                    break;
                case -538363189:
                    if (str4.equals("V_MPEG4/ISO/ASP")) {
                        c11 = '\t';
                        break;
                    }
                    c11 = 65535;
                    break;
                case -538363109:
                    if (str4.equals("V_MPEG4/ISO/AVC")) {
                        c11 = '\n';
                        break;
                    }
                    c11 = 65535;
                    break;
                case -425012669:
                    if (str4.equals("S_VOBSUB")) {
                        c11 = 11;
                        break;
                    }
                    c11 = 65535;
                    break;
                case -356037306:
                    if (str4.equals("A_DTS/LOSSLESS")) {
                        c11 = '\f';
                        break;
                    }
                    c11 = 65535;
                    break;
                case 62923557:
                    if (str4.equals("A_AAC")) {
                        c11 = '\r';
                        break;
                    }
                    c11 = 65535;
                    break;
                case 62923603:
                    if (str4.equals("A_AC3")) {
                        c11 = 14;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 62927045:
                    if (str4.equals("A_DTS")) {
                        c11 = 15;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 82338133:
                    if (str4.equals("V_VP8")) {
                        c11 = 16;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 82338134:
                    if (str4.equals("V_VP9")) {
                        c11 = 17;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 99146302:
                    if (str4.equals("S_HDMV/PGS")) {
                        c11 = 18;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 444813526:
                    if (str4.equals("V_THEORA")) {
                        c11 = 19;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 542569478:
                    if (str4.equals("A_DTS/EXPRESS")) {
                        c11 = 20;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 725957860:
                    if (str4.equals("A_PCM/INT/LIT")) {
                        c11 = 21;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 738597099:
                    if (str4.equals("S_TEXT/ASS")) {
                        c11 = 22;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 855502857:
                    if (str4.equals("V_MPEGH/ISO/HEVC")) {
                        c11 = 23;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 1422270023:
                    if (str4.equals("S_TEXT/UTF8")) {
                        c11 = 24;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 1809237540:
                    if (str4.equals("V_MPEG2")) {
                        c11 = 25;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 1950749482:
                    if (str4.equals("A_EAC3")) {
                        c11 = 26;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 1950789798:
                    if (str4.equals("A_FLAC")) {
                        c11 = 27;
                        break;
                    }
                    c11 = 65535;
                    break;
                case 1951062397:
                    if (str4.equals("A_OPUS")) {
                        c11 = 28;
                        break;
                    }
                    c11 = 65535;
                    break;
                default:
                    c11 = 65535;
                    break;
            }
            String str5 = "audio/x-unknown";
            switch (c11) {
                case 0:
                case 1:
                case '\t':
                    byte[] bArr = this.f49261i;
                    singletonList = bArr == null ? null : Collections.singletonList(bArr);
                    str = "video/mp4v-es";
                    str5 = str;
                    i12 = -1;
                    i13 = -1;
                    int i18 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                        q11 = Format.n(Integer.toString(i11), str5, null, -1, i13, this.H, this.J, i12, singletonList, this.f49262j, i18, this.P);
                    } else if (n.m(str5)) {
                        if (this.f49267o == 0) {
                            int i19 = this.f49265m;
                            i14 = -1;
                            if (i19 == -1) {
                                i19 = this.f49263k;
                            }
                            this.f49265m = i19;
                            int i21 = this.f49266n;
                            if (i21 == -1) {
                                i21 = this.f49264l;
                            }
                            this.f49266n = i21;
                        } else {
                            i14 = -1;
                        }
                        float f11 = (this.f49265m == i14 || (i16 = this.f49266n) == i14) ? -1.0f : (this.f49264l * r2) / (this.f49263k * i16);
                        ColorInfo colorInfo = this.f49270r ? new ColorInfo(this.f49271s, this.f49273u, this.f49272t, b()) : null;
                        if ("htc_video_rotA-000".equals(this.f49253a)) {
                            i15 = 0;
                        } else if ("htc_video_rotA-090".equals(this.f49253a)) {
                            i15 = 90;
                        } else if ("htc_video_rotA-180".equals(this.f49253a)) {
                            i15 = 180;
                        } else {
                            i15 = "htc_video_rotA-270".equals(this.f49253a) ? 270 : -1;
                        }
                        q11 = Format.B(Integer.toString(i11), str5, null, -1, i13, this.f49263k, this.f49264l, -1.0f, singletonList, i15, f11, this.f49268p, this.f49269q, colorInfo, this.f49262j);
                        i17 = 2;
                    } else {
                        if ("application/x-subrip".equals(str5)) {
                            q11 = Format.w(Integer.toString(i11), str5, i18, this.P, this.f49262j);
                        } else if ("text/x-ssa".equals(str5)) {
                            ArrayList arrayList = new ArrayList(2);
                            arrayList.add(e.f49222c0);
                            arrayList.add(this.f49261i);
                            q11 = Format.x(Integer.toString(i11), str5, null, -1, i18, this.P, -1, this.f49262j, Long.MAX_VALUE, arrayList);
                        } else {
                            if (!"application/vobsub".equals(str5) && !"application/pgs".equals(str5) && !"application/dvbsubs".equals(str5)) {
                                throw new t("Unexpected MIME type.");
                            }
                            q11 = Format.q(Integer.toString(i11), str5, null, -1, i18, singletonList, this.P, this.f49262j);
                        }
                        i17 = 3;
                    }
                    q a11 = iVar.a(this.f49255c, i17);
                    this.Q = a11;
                    a11.b(q11);
                    return;
                case 2:
                    if (f(new r(this.f49261i))) {
                        H = g0.H(this.I);
                        if (H == 0) {
                            k.f("MatroskaExtractor", "Unsupported PCM bit depth: " + this.I + ". Setting mimeType to audio/x-unknown");
                        }
                        i12 = H;
                        str5 = "audio/raw";
                        singletonList = null;
                        i13 = -1;
                        int i182 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                        if (!n.k(str5)) {
                        }
                        q a112 = iVar.a(this.f49255c, i17);
                        this.Q = a112;
                        a112.b(q11);
                        return;
                    }
                    k.f("MatroskaExtractor", "Non-PCM MS/ACM is unsupported. Setting mimeType to audio/x-unknown");
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i1822 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a1122 = iVar.a(this.f49255c, i17);
                    this.Q = a1122;
                    a1122.b(q11);
                    return;
                case 3:
                    this.M = new d();
                    str2 = "audio/true-hd";
                    str5 = str2;
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i18222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a11222 = iVar.a(this.f49255c, i17);
                    this.Q = a11222;
                    a11222.b(q11);
                    return;
                case 4:
                    singletonList = g(this.f49261i);
                    str5 = "audio/vorbis";
                    i12 = -1;
                    i13 = 8192;
                    int i182222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a112222 = iVar.a(this.f49255c, i17);
                    this.Q = a112222;
                    a112222.b(q11);
                    return;
                case 5:
                    str3 = "audio/mpeg-L2";
                    str5 = str3;
                    singletonList = null;
                    i12 = -1;
                    i13 = 4096;
                    int i1822222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a1122222 = iVar.a(this.f49255c, i17);
                    this.Q = a1122222;
                    a1122222.b(q11);
                    return;
                case 6:
                    str3 = "audio/mpeg";
                    str5 = str3;
                    singletonList = null;
                    i12 = -1;
                    i13 = 4096;
                    int i18222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a11222222 = iVar.a(this.f49255c, i17);
                    this.Q = a11222222;
                    a11222222.b(q11);
                    return;
                case 7:
                    Pair<String, List<byte[]>> e11 = e(new r(this.f49261i));
                    str = (String) e11.first;
                    singletonList = (List) e11.second;
                    str5 = str;
                    i12 = -1;
                    i13 = -1;
                    int i182222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a112222222 = iVar.a(this.f49255c, i17);
                    this.Q = a112222222;
                    a112222222.b(q11);
                    return;
                case '\b':
                    byte[] bArr2 = this.f49261i;
                    singletonList = Collections.singletonList(new byte[]{bArr2[0], bArr2[1], bArr2[2], bArr2[3]});
                    str5 = "application/dvbsubs";
                    i12 = -1;
                    i13 = -1;
                    int i1822222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a1122222222 = iVar.a(this.f49255c, i17);
                    this.Q = a1122222222;
                    a1122222222.b(q11);
                    return;
                case '\n':
                    gr.a b11 = gr.a.b(new r(this.f49261i));
                    list = b11.f35392a;
                    this.R = b11.f35393b;
                    str = "video/avc";
                    singletonList = list;
                    str5 = str;
                    i12 = -1;
                    i13 = -1;
                    int i18222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a11222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a11222222222;
                    a11222222222.b(q11);
                    return;
                case 11:
                    singletonList = Collections.singletonList(this.f49261i);
                    str5 = "application/vobsub";
                    i12 = -1;
                    i13 = -1;
                    int i182222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a112222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a112222222222;
                    a112222222222.b(q11);
                    return;
                case '\f':
                    str2 = "audio/vnd.dts.hd";
                    str5 = str2;
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i1822222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a1122222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a1122222222222;
                    a1122222222222.b(q11);
                    return;
                case '\r':
                    singletonList = Collections.singletonList(this.f49261i);
                    str = "audio/mp4a-latm";
                    str5 = str;
                    i12 = -1;
                    i13 = -1;
                    int i18222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a11222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a11222222222222;
                    a11222222222222.b(q11);
                    return;
                case 14:
                    str2 = "audio/ac3";
                    str5 = str2;
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i182222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a112222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a112222222222222;
                    a112222222222222.b(q11);
                    return;
                case 15:
                case 20:
                    str2 = "audio/vnd.dts";
                    str5 = str2;
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i1822222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a1122222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a1122222222222222;
                    a1122222222222222.b(q11);
                    return;
                case 16:
                    str2 = "video/x-vnd.on2.vp8";
                    str5 = str2;
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i18222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a11222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a11222222222222222;
                    a11222222222222222.b(q11);
                    return;
                case 17:
                    str2 = "video/x-vnd.on2.vp9";
                    str5 = str2;
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i182222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a112222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a112222222222222222;
                    a112222222222222222.b(q11);
                    return;
                case 18:
                    str5 = "application/pgs";
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i1822222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a1122222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a1122222222222222222;
                    a1122222222222222222.b(q11);
                    return;
                case 19:
                    str2 = "video/x-unknown";
                    str5 = str2;
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i18222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a11222222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a11222222222222222222;
                    a11222222222222222222.b(q11);
                    return;
                case 21:
                    H = g0.H(this.I);
                    if (H == 0) {
                        k.f("MatroskaExtractor", "Unsupported PCM bit depth: " + this.I + ". Setting mimeType to audio/x-unknown");
                        singletonList = null;
                        i12 = -1;
                        i13 = -1;
                        int i182222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                        if (!n.k(str5)) {
                        }
                        q a112222222222222222222 = iVar.a(this.f49255c, i17);
                        this.Q = a112222222222222222222;
                        a112222222222222222222.b(q11);
                        return;
                    }
                    i12 = H;
                    str5 = "audio/raw";
                    singletonList = null;
                    i13 = -1;
                    int i1822222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a1122222222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a1122222222222222222222;
                    a1122222222222222222222.b(q11);
                    return;
                case 22:
                    str5 = "text/x-ssa";
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i18222222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a11222222222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a11222222222222222222222;
                    a11222222222222222222222.b(q11);
                    return;
                case 23:
                    gr.b a12 = gr.b.a(new r(this.f49261i));
                    list = a12.f35397a;
                    this.R = a12.f35398b;
                    str = "video/hevc";
                    singletonList = list;
                    str5 = str;
                    i12 = -1;
                    i13 = -1;
                    int i182222222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a112222222222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a112222222222222222222222;
                    a112222222222222222222222.b(q11);
                    return;
                case 24:
                    str5 = "application/x-subrip";
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i1822222222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a1122222222222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a1122222222222222222222222;
                    a1122222222222222222222222.b(q11);
                    return;
                case 25:
                    str2 = "video/mpeg2";
                    str5 = str2;
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i18222222222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a11222222222222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a11222222222222222222222222;
                    a11222222222222222222222222.b(q11);
                    return;
                case 26:
                    str2 = "audio/eac3";
                    str5 = str2;
                    singletonList = null;
                    i12 = -1;
                    i13 = -1;
                    int i182222222222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a112222222222222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a112222222222222222222222222;
                    a112222222222222222222222222.b(q11);
                    return;
                case 27:
                    singletonList = Collections.singletonList(this.f49261i);
                    str = "audio/flac";
                    str5 = str;
                    i12 = -1;
                    i13 = -1;
                    int i1822222222222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a1122222222222222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a1122222222222222222222222222;
                    a1122222222222222222222222222.b(q11);
                    return;
                case 28:
                    singletonList = new ArrayList<>(3);
                    singletonList.add(this.f49261i);
                    singletonList.add(ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(this.K).array());
                    singletonList.add(ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(this.L).array());
                    str5 = "audio/opus";
                    i12 = -1;
                    i13 = 5760;
                    int i18222222222222222222222222222 = (this.O ? 1 : 0) | 0 | (!this.N ? 2 : 0);
                    if (!n.k(str5)) {
                    }
                    q a11222222222222222222222222222 = iVar.a(this.f49255c, i17);
                    this.Q = a11222222222222222222222222222;
                    a11222222222222222222222222222.b(q11);
                    return;
                default:
                    throw new t("Unrecognized codec identifier.");
            }
        }

        public void d() {
            d dVar = this.M;
            if (dVar != null) {
                dVar.a(this);
            }
        }

        public void h() {
            d dVar = this.M;
            if (dVar != null) {
                dVar.b();
            }
        }
    }

    public static final class d {

        public final byte[] f49279a = new byte[10];

        public boolean f49280b;

        public int f49281c;

        public int f49282d;

        public long f49283e;

        public int f49284f;

        public void a(c cVar) {
            if (this.f49280b && this.f49281c > 0) {
                cVar.Q.c(this.f49283e, this.f49284f, this.f49282d, 0, cVar.f49260h);
                this.f49281c = 0;
            }
        }

        public void b() {
            this.f49280b = false;
        }

        public void c(c cVar, long j11) {
            if (!this.f49280b) {
                return;
            }
            int i11 = this.f49281c;
            int i12 = i11 + 1;
            this.f49281c = i12;
            if (i11 == 0) {
                this.f49283e = j11;
            }
            if (i12 < 16) {
                return;
            }
            cVar.Q.c(this.f49283e, this.f49284f, this.f49282d, 0, cVar.f49260h);
            this.f49281c = 0;
        }

        public void d(h hVar, int i11, int i12) throws IOException, InterruptedException {
            if (!this.f49280b) {
                hVar.i(this.f49279a, 0, 10);
                hVar.c();
                if (rp.a.j(this.f49279a) == 0) {
                    return;
                }
                this.f49280b = true;
                this.f49281c = 0;
            }
            if (this.f49281c == 0) {
                this.f49284f = i11;
                this.f49282d = 0;
            }
            this.f49282d += i12;
        }
    }

    public e() {
        this(0);
    }

    public static int[] m(int[] iArr, int i11) {
        if (iArr == null) {
            return new int[i11];
        }
        if (iArr.length >= i11) {
            return iArr;
        }
        return new int[Math.max(iArr.length * 2, i11)];
    }

    public static boolean p(String str) {
        if (!"V_VP8".equals(str) && !"V_VP9".equals(str) && !"V_MPEG2".equals(str) && !"V_MPEG4/ISO/SP".equals(str) && !"V_MPEG4/ISO/ASP".equals(str) && !"V_MPEG4/ISO/AP".equals(str) && !"V_MPEG4/ISO/AVC".equals(str) && !"V_MPEGH/ISO/HEVC".equals(str) && !"V_MS/VFW/FOURCC".equals(str) && !"V_THEORA".equals(str) && !"A_OPUS".equals(str) && !"A_VORBIS".equals(str) && !"A_AAC".equals(str) && !"A_MPEG/L2".equals(str) && !"A_MPEG/L3".equals(str) && !"A_AC3".equals(str) && !"A_EAC3".equals(str) && !"A_TRUEHD".equals(str) && !"A_DTS".equals(str) && !"A_DTS/EXPRESS".equals(str) && !"A_DTS/LOSSLESS".equals(str) && !"A_FLAC".equals(str) && !"A_MS/ACM".equals(str) && !"A_PCM/INT/LIT".equals(str) && !"S_TEXT/UTF8".equals(str) && !"S_TEXT/ASS".equals(str) && !"S_VOBSUB".equals(str) && !"S_HDMV/PGS".equals(str) && !"S_DVBSUB".equals(str)) {
            return false;
        }
        return true;
    }

    public static up.g[] q() {
        return new up.g[]{new e()};
    }

    public static void x(byte[] bArr, long j11, String str, int i11, long j12, byte[] bArr2) {
        byte[] M;
        byte[] bArr3;
        if (j11 == -9223372036854775807L) {
            M = bArr2;
            bArr3 = M;
        } else {
            long j13 = j11 - ((r1 * MMKV.ExpireInHour) * 1000000);
            int i12 = (int) (j13 / 60000000);
            long j14 = j13 - ((i12 * 60) * 1000000);
            int i13 = (int) (j14 / 1000000);
            M = g0.M(String.format(Locale.US, str, Integer.valueOf((int) (j11 / 3600000000L)), Integer.valueOf(i12), Integer.valueOf(i13), Integer.valueOf((int) ((j14 - (i13 * 1000000)) / j12))));
            bArr3 = bArr2;
        }
        System.arraycopy(M, 0, bArr, i11, bArr3.length);
    }

    public final void A(h hVar, c cVar, int i11) throws IOException, InterruptedException {
        boolean z11;
        boolean z12;
        int i12;
        if ("S_TEXT/UTF8".equals(cVar.f49254b)) {
            B(hVar, f49220a0, i11);
            return;
        }
        if ("S_TEXT/ASS".equals(cVar.f49254b)) {
            B(hVar, f49223d0, i11);
            return;
        }
        q qVar = cVar.Q;
        boolean z13 = true;
        if (!this.O) {
            if (cVar.f49258f) {
                this.M &= -1073741825;
                int i13 = 128;
                if (!this.P) {
                    hVar.readFully(this.f49232g.f34684a, 0, 1);
                    this.N++;
                    byte b11 = this.f49232g.f34684a[0];
                    if ((b11 & 128) != 128) {
                        this.S = b11;
                        this.P = true;
                    } else {
                        throw new t("Extension bit is set in signal byte");
                    }
                }
                byte b12 = this.S;
                if ((b12 & 1) == 1) {
                    z11 = true;
                } else {
                    z11 = false;
                }
                if (z11) {
                    if ((b12 & 2) == 2) {
                        z12 = true;
                    } else {
                        z12 = false;
                    }
                    this.M |= WXVideoFileObject.FILE_SIZE_LIMIT;
                    if (!this.Q) {
                        hVar.readFully(this.f49237l.f34684a, 0, 8);
                        this.N += 8;
                        this.Q = true;
                        r rVar = this.f49232g;
                        byte[] bArr = rVar.f34684a;
                        if (!z12) {
                            i13 = 0;
                        }
                        bArr[0] = (byte) (i13 | 8);
                        rVar.K(0);
                        qVar.a(this.f49232g, 1);
                        this.V++;
                        this.f49237l.K(0);
                        qVar.a(this.f49237l, 8);
                        this.V += 8;
                    }
                    if (z12) {
                        if (!this.R) {
                            hVar.readFully(this.f49232g.f34684a, 0, 1);
                            this.N++;
                            this.f49232g.K(0);
                            this.T = this.f49232g.y();
                            this.R = true;
                        }
                        int i14 = this.T * 4;
                        this.f49232g.H(i14);
                        hVar.readFully(this.f49232g.f34684a, 0, i14);
                        this.N += i14;
                        short s11 = (short) ((this.T / 2) + 1);
                        int i15 = (s11 * 6) + 2;
                        ByteBuffer byteBuffer = this.f49239n;
                        if (byteBuffer == null || byteBuffer.capacity() < i15) {
                            this.f49239n = ByteBuffer.allocate(i15);
                        }
                        this.f49239n.position(0);
                        this.f49239n.putShort(s11);
                        int i16 = 0;
                        int i17 = 0;
                        while (true) {
                            i12 = this.T;
                            if (i16 >= i12) {
                                break;
                            }
                            int C = this.f49232g.C();
                            if (i16 % 2 == 0) {
                                this.f49239n.putShort((short) (C - i17));
                            } else {
                                this.f49239n.putInt(C - i17);
                            }
                            i16++;
                            i17 = C;
                        }
                        int i18 = (i11 - this.N) - i17;
                        if (i12 % 2 == 1) {
                            this.f49239n.putInt(i18);
                        } else {
                            this.f49239n.putShort((short) i18);
                            this.f49239n.putInt(0);
                        }
                        this.f49238m.I(this.f49239n.array(), i15);
                        qVar.a(this.f49238m, i15);
                        this.V += i15;
                    }
                }
            } else {
                byte[] bArr2 = cVar.f49259g;
                if (bArr2 != null) {
                    this.f49235j.I(bArr2, bArr2.length);
                }
            }
            this.O = true;
        }
        int d11 = i11 + this.f49235j.d();
        if (!"V_MPEG4/ISO/AVC".equals(cVar.f49254b) && !"V_MPEGH/ISO/HEVC".equals(cVar.f49254b)) {
            if (cVar.M != null) {
                if (this.f49235j.d() != 0) {
                    z13 = false;
                }
                fr.a.f(z13);
                cVar.M.d(hVar, this.M, d11);
            }
            while (true) {
                int i19 = this.N;
                if (i19 >= d11) {
                    break;
                } else {
                    t(hVar, qVar, d11 - i19);
                }
            }
        } else {
            byte[] bArr3 = this.f49231f.f34684a;
            bArr3[0] = 0;
            bArr3[1] = 0;
            bArr3[2] = 0;
            int i21 = cVar.R;
            int i22 = 4 - i21;
            while (this.N < d11) {
                int i23 = this.U;
                if (i23 == 0) {
                    u(hVar, bArr3, i22, i21);
                    this.f49231f.K(0);
                    this.U = this.f49231f.C();
                    this.f49230e.K(0);
                    qVar.a(this.f49230e, 4);
                    this.V += 4;
                } else {
                    this.U = i23 - t(hVar, qVar, i23);
                }
            }
        }
        if ("A_VORBIS".equals(cVar.f49254b)) {
            this.f49233h.K(0);
            qVar.a(this.f49233h, 4);
            this.V += 4;
        }
    }

    public final void B(h hVar, byte[] bArr, int i11) throws IOException, InterruptedException {
        int length = bArr.length + i11;
        if (this.f49236k.b() < length) {
            this.f49236k.f34684a = Arrays.copyOf(bArr, length + i11);
        } else {
            System.arraycopy(bArr, 0, this.f49236k.f34684a, 0, bArr.length);
        }
        hVar.readFully(this.f49236k.f34684a, bArr.length, i11);
        this.f49236k.H(length);
    }

    @Override
    public void a(i iVar) {
        this.Y = iVar;
    }

    @Override
    public int c(h hVar, up.n nVar) throws IOException, InterruptedException {
        this.W = false;
        boolean z11 = true;
        while (z11 && !this.W) {
            z11 = this.f49226a.a(hVar);
            if (z11 && r(nVar, hVar.getPosition())) {
                return 1;
            }
        }
        if (z11) {
            return 0;
        }
        for (int i11 = 0; i11 < this.f49228c.size(); i11++) {
            this.f49228c.valueAt(i11).d();
        }
        return -1;
    }

    @Override
    public boolean d(h hVar) throws IOException, InterruptedException {
        return new f().b(hVar);
    }

    @Override
    public void e(long j11, long j12) {
        this.A = -9223372036854775807L;
        this.E = 0;
        this.f49226a.reset();
        this.f49227b.e();
        v();
        for (int i11 = 0; i11 < this.f49228c.size(); i11++) {
            this.f49228c.valueAt(i11).h();
        }
    }

    public void h(int i11, int i12, h hVar) throws IOException, InterruptedException {
        char c11;
        long j11;
        int i13;
        int i14;
        int i15;
        int i16 = 0;
        int i17 = 1;
        if (i11 != 161 && i11 != 163) {
            if (i11 == 16981) {
                byte[] bArr = new byte[i12];
                this.f49245t.f49259g = bArr;
                hVar.readFully(bArr, 0, i12);
                return;
            }
            if (i11 == 18402) {
                byte[] bArr2 = new byte[i12];
                hVar.readFully(bArr2, 0, i12);
                this.f49245t.f49260h = new q.a(1, bArr2, 0, 0);
                return;
            }
            if (i11 == 21419) {
                Arrays.fill(this.f49234i.f34684a, (byte) 0);
                hVar.readFully(this.f49234i.f34684a, 4 - i12, i12);
                this.f49234i.K(0);
                this.f49247v = (int) this.f49234i.A();
                return;
            }
            if (i11 == 25506) {
                byte[] bArr3 = new byte[i12];
                this.f49245t.f49261i = bArr3;
                hVar.readFully(bArr3, 0, i12);
                return;
            } else if (i11 == 30322) {
                byte[] bArr4 = new byte[i12];
                this.f49245t.f49268p = bArr4;
                hVar.readFully(bArr4, 0, i12);
                return;
            } else {
                throw new t("Unexpected id: " + i11);
            }
        }
        if (this.E == 0) {
            this.K = (int) this.f49227b.d(hVar, false, true, 8);
            this.L = this.f49227b.b();
            this.G = -9223372036854775807L;
            this.E = 1;
            this.f49232g.G();
        }
        c cVar = this.f49228c.get(this.K);
        if (cVar == null) {
            hVar.g(i12 - this.L);
            this.E = 0;
            return;
        }
        if (this.E == 1) {
            s(hVar, 3);
            int i18 = (this.f49232g.f34684a[2] & 6) >> 1;
            byte b11 = 255;
            if (i18 == 0) {
                this.I = 1;
                int[] m11 = m(this.J, 1);
                this.J = m11;
                m11[0] = (i12 - this.L) - 3;
            } else if (i11 == 163) {
                int i19 = 4;
                s(hVar, 4);
                int i21 = (this.f49232g.f34684a[3] & 255) + 1;
                this.I = i21;
                int[] m12 = m(this.J, i21);
                this.J = m12;
                if (i18 == 2) {
                    int i22 = (i12 - this.L) - 4;
                    int i23 = this.I;
                    Arrays.fill(m12, 0, i23, i22 / i23);
                } else {
                    if (i18 != 1) {
                        if (i18 == 3) {
                            int i24 = 0;
                            int i25 = 0;
                            while (true) {
                                int i26 = this.I;
                                if (i24 < i26 - 1) {
                                    this.J[i24] = i16;
                                    i19++;
                                    s(hVar, i19);
                                    int i27 = i19 - 1;
                                    if (this.f49232g.f34684a[i27] == 0) {
                                        throw new t("No valid varint length mask found");
                                    }
                                    int i28 = 0;
                                    while (true) {
                                        if (i28 >= 8) {
                                            j11 = 0;
                                            break;
                                        }
                                        int i29 = i17 << (7 - i28);
                                        if ((this.f49232g.f34684a[i27] & i29) != 0) {
                                            i19 += i28;
                                            s(hVar, i19);
                                            j11 = (~i29) & this.f49232g.f34684a[i27] & b11;
                                            int i31 = i27 + 1;
                                            while (i31 < i19) {
                                                j11 = (j11 << 8) | (this.f49232g.f34684a[i31] & b11);
                                                i31++;
                                                b11 = 255;
                                            }
                                            if (i24 > 0) {
                                                j11 -= (1 << ((i28 * 7) + 6)) - 1;
                                            }
                                        } else {
                                            i28++;
                                            i17 = 1;
                                            b11 = 255;
                                        }
                                    }
                                    if (j11 < -2147483648L || j11 > 2147483647L) {
                                        break;
                                    }
                                    int i32 = (int) j11;
                                    int[] iArr = this.J;
                                    if (i24 != 0) {
                                        i32 += iArr[i24 - 1];
                                    }
                                    iArr[i24] = i32;
                                    i25 += i32;
                                    i24++;
                                    i16 = 0;
                                    i17 = 1;
                                    b11 = 255;
                                } else {
                                    c11 = 1;
                                    this.J[i26 - 1] = ((i12 - this.L) - i19) - i25;
                                    break;
                                }
                            }
                            throw new t("EBML lacing sample size out of range.");
                        }
                        throw new t("Unexpected lacing value: " + i18);
                    }
                    int i33 = 0;
                    int i34 = 0;
                    while (true) {
                        i13 = this.I;
                        if (i33 >= i13 - 1) {
                            break;
                        }
                        this.J[i33] = 0;
                        do {
                            i19++;
                            s(hVar, i19);
                            i14 = this.f49232g.f34684a[i19 - 1] & 255;
                            int[] iArr2 = this.J;
                            i15 = iArr2[i33] + i14;
                            iArr2[i33] = i15;
                        } while (i14 == 255);
                        i34 += i15;
                        i33++;
                    }
                    this.J[i13 - 1] = ((i12 - this.L) - i19) - i34;
                }
            } else {
                throw new t("Lacing only supported in SimpleBlocks.");
            }
            c11 = 1;
            byte[] bArr5 = this.f49232g.f34684a;
            this.F = this.A + w((bArr5[c11] & 255) | (bArr5[0] << 8));
            byte b12 = this.f49232g.f34684a[2];
            this.M = ((cVar.f49256d == 2 || (i11 == 163 && (b12 & 128) == 128)) ? 1 : 0) | ((b12 & 8) == 8 ? Integer.MIN_VALUE : 0);
            this.E = 2;
            this.H = 0;
        }
        if (i11 != 163) {
            A(hVar, cVar, this.J[0]);
            return;
        }
        while (true) {
            int i35 = this.H;
            if (i35 < this.I) {
                A(hVar, cVar, this.J[i35]);
                j(cVar, this.F + ((this.H * cVar.f49257e) / 1000));
                this.H++;
            } else {
                this.E = 0;
                return;
            }
        }
    }

    public final o i() {
        l lVar;
        l lVar2;
        if (this.f49241p != -1 && this.f49244s != -9223372036854775807L && (lVar = this.B) != null && lVar.c() != 0 && (lVar2 = this.C) != null && lVar2.c() == this.B.c()) {
            int c11 = this.B.c();
            int[] iArr = new int[c11];
            long[] jArr = new long[c11];
            long[] jArr2 = new long[c11];
            long[] jArr3 = new long[c11];
            int i11 = 0;
            for (int i12 = 0; i12 < c11; i12++) {
                jArr3[i12] = this.B.b(i12);
                jArr[i12] = this.f49241p + this.C.b(i12);
            }
            while (true) {
                int i13 = c11 - 1;
                if (i11 < i13) {
                    int i14 = i11 + 1;
                    iArr[i11] = (int) (jArr[i14] - jArr[i11]);
                    jArr2[i11] = jArr3[i14] - jArr3[i11];
                    i11 = i14;
                } else {
                    iArr[i13] = (int) ((this.f49241p + this.f49240o) - jArr[i13]);
                    jArr2[i13] = this.f49244s - jArr3[i13];
                    this.B = null;
                    this.C = null;
                    return new up.b(iArr, jArr, jArr2, jArr3);
                }
            }
        } else {
            this.B = null;
            this.C = null;
            return new o.b(this.f49244s);
        }
    }

    public final void j(c cVar, long j11) {
        d dVar = cVar.M;
        if (dVar != null) {
            dVar.c(cVar, j11);
        } else {
            if ("S_TEXT/UTF8".equals(cVar.f49254b)) {
                k(cVar, "%02d:%02d:%02d,%03d", 19, 1000L, f49221b0);
            } else if ("S_TEXT/ASS".equals(cVar.f49254b)) {
                k(cVar, "%01d:%02d:%02d:%02d", 21, 10000L, f49224e0);
            }
            cVar.Q.c(j11, this.M, this.V, 0, cVar.f49260h);
        }
        this.W = true;
        v();
    }

    public final void k(c cVar, String str, int i11, long j11, byte[] bArr) {
        x(this.f49236k.f34684a, this.G, str, i11, j11, bArr);
        q qVar = cVar.Q;
        r rVar = this.f49236k;
        qVar.a(rVar, rVar.d());
        this.V += this.f49236k.d();
    }

    public void l(int i11) throws t {
        if (i11 != 160) {
            if (i11 != 174) {
                if (i11 != 19899) {
                    if (i11 != 25152) {
                        if (i11 != 28032) {
                            if (i11 != 357149030) {
                                if (i11 != 374648427) {
                                    if (i11 == 475249515 && !this.f49246u) {
                                        this.Y.g(i());
                                        this.f49246u = true;
                                        return;
                                    }
                                    return;
                                }
                                if (this.f49228c.size() != 0) {
                                    this.Y.q();
                                    return;
                                }
                                throw new t("No valid tracks were found");
                            }
                            if (this.f49242q == -9223372036854775807L) {
                                this.f49242q = 1000000L;
                            }
                            long j11 = this.f49243r;
                            if (j11 != -9223372036854775807L) {
                                this.f49244s = w(j11);
                                return;
                            }
                            return;
                        }
                        c cVar = this.f49245t;
                        if (cVar.f49258f && cVar.f49259g != null) {
                            throw new t("Combining encryption and compression is not supported");
                        }
                        return;
                    }
                    c cVar2 = this.f49245t;
                    if (cVar2.f49258f) {
                        if (cVar2.f49260h != null) {
                            cVar2.f49262j = new DrmInitData(new DrmInitData.SchemeData(pp.c.f42158a, "video/webm", this.f49245t.f49260h.f46551b));
                            return;
                        }
                        throw new t("Encrypted Track found but ContentEncKeyID was not found");
                    }
                    return;
                }
                int i12 = this.f49247v;
                if (i12 != -1) {
                    long j12 = this.f49248w;
                    if (j12 != -1) {
                        if (i12 == 475249515) {
                            this.f49250y = j12;
                            return;
                        }
                        return;
                    }
                }
                throw new t("Mandatory element SeekID or SeekPosition not found");
            }
            if (p(this.f49245t.f49254b)) {
                c cVar3 = this.f49245t;
                cVar3.c(this.Y, cVar3.f49255c);
                SparseArray<c> sparseArray = this.f49228c;
                c cVar4 = this.f49245t;
                sparseArray.put(cVar4.f49255c, cVar4);
            }
            this.f49245t = null;
            return;
        }
        if (this.E != 2) {
            return;
        }
        if (!this.X) {
            this.M |= 1;
        }
        j(this.f49228c.get(this.K), this.F);
        this.E = 0;
    }

    public void n(int i11, double d11) {
        if (i11 != 181) {
            if (i11 != 17545) {
                switch (i11) {
                    case 21969:
                        this.f49245t.f49276x = (float) d11;
                        return;
                    case 21970:
                        this.f49245t.f49277y = (float) d11;
                        return;
                    case 21971:
                        this.f49245t.f49278z = (float) d11;
                        return;
                    case 21972:
                        this.f49245t.A = (float) d11;
                        return;
                    case 21973:
                        this.f49245t.B = (float) d11;
                        return;
                    case 21974:
                        this.f49245t.C = (float) d11;
                        return;
                    case 21975:
                        this.f49245t.D = (float) d11;
                        return;
                    case 21976:
                        this.f49245t.E = (float) d11;
                        return;
                    case 21977:
                        this.f49245t.F = (float) d11;
                        return;
                    case 21978:
                        this.f49245t.G = (float) d11;
                        return;
                    default:
                        return;
                }
            }
            this.f49243r = (long) d11;
            return;
        }
        this.f49245t.J = (int) d11;
    }

    public void o(int i11, long j11) throws t {
        if (i11 != 20529) {
            if (i11 != 20530) {
                boolean z11 = false;
                switch (i11) {
                    case 131:
                        this.f49245t.f49256d = (int) j11;
                        return;
                    case 136:
                        c cVar = this.f49245t;
                        if (j11 == 1) {
                            z11 = true;
                        }
                        cVar.O = z11;
                        return;
                    case 155:
                        this.G = w(j11);
                        return;
                    case 159:
                        this.f49245t.H = (int) j11;
                        return;
                    case 176:
                        this.f49245t.f49263k = (int) j11;
                        return;
                    case 179:
                        this.B.a(w(j11));
                        return;
                    case 186:
                        this.f49245t.f49264l = (int) j11;
                        return;
                    case 215:
                        this.f49245t.f49255c = (int) j11;
                        return;
                    case 231:
                        this.A = w(j11);
                        return;
                    case 241:
                        if (!this.D) {
                            this.C.a(j11);
                            this.D = true;
                            return;
                        }
                        return;
                    case 251:
                        this.X = true;
                        return;
                    case 16980:
                        if (j11 != 3) {
                            throw new t("ContentCompAlgo " + j11 + " not supported");
                        }
                        return;
                    case 17029:
                        if (j11 < 1 || j11 > 2) {
                            throw new t("DocTypeReadVersion " + j11 + " not supported");
                        }
                        return;
                    case 17143:
                        if (j11 != 1) {
                            throw new t("EBMLReadVersion " + j11 + " not supported");
                        }
                        return;
                    case 18401:
                        if (j11 != 5) {
                            throw new t("ContentEncAlgo " + j11 + " not supported");
                        }
                        return;
                    case 18408:
                        if (j11 != 1) {
                            throw new t("AESSettingsCipherMode " + j11 + " not supported");
                        }
                        return;
                    case 21420:
                        this.f49248w = j11 + this.f49241p;
                        return;
                    case 21432:
                        int i12 = (int) j11;
                        if (i12 != 0) {
                            if (i12 != 1) {
                                if (i12 != 3) {
                                    if (i12 == 15) {
                                        this.f49245t.f49269q = 3;
                                        return;
                                    }
                                    return;
                                }
                                this.f49245t.f49269q = 1;
                                return;
                            }
                            this.f49245t.f49269q = 2;
                            return;
                        }
                        this.f49245t.f49269q = 0;
                        return;
                    case 21680:
                        this.f49245t.f49265m = (int) j11;
                        return;
                    case 21682:
                        this.f49245t.f49267o = (int) j11;
                        return;
                    case 21690:
                        this.f49245t.f49266n = (int) j11;
                        return;
                    case 21930:
                        c cVar2 = this.f49245t;
                        if (j11 == 1) {
                            z11 = true;
                        }
                        cVar2.N = z11;
                        return;
                    case 22186:
                        this.f49245t.K = j11;
                        return;
                    case 22203:
                        this.f49245t.L = j11;
                        return;
                    case 25188:
                        this.f49245t.I = (int) j11;
                        return;
                    case 2352003:
                        this.f49245t.f49257e = (int) j11;
                        return;
                    case 2807729:
                        this.f49242q = j11;
                        return;
                    default:
                        switch (i11) {
                            case 21945:
                                int i13 = (int) j11;
                                if (i13 != 1) {
                                    if (i13 == 2) {
                                        this.f49245t.f49273u = 1;
                                        return;
                                    }
                                    return;
                                }
                                this.f49245t.f49273u = 2;
                                return;
                            case 21946:
                                int i14 = (int) j11;
                                if (i14 != 1) {
                                    if (i14 != 16) {
                                        if (i14 != 18) {
                                            if (i14 != 6 && i14 != 7) {
                                                return;
                                            }
                                        } else {
                                            this.f49245t.f49272t = 7;
                                            return;
                                        }
                                    } else {
                                        this.f49245t.f49272t = 6;
                                        return;
                                    }
                                }
                                this.f49245t.f49272t = 3;
                                return;
                            case 21947:
                                c cVar3 = this.f49245t;
                                cVar3.f49270r = true;
                                int i15 = (int) j11;
                                if (i15 != 1) {
                                    if (i15 != 9) {
                                        if (i15 == 4 || i15 == 5 || i15 == 6 || i15 == 7) {
                                            cVar3.f49271s = 2;
                                            return;
                                        }
                                        return;
                                    }
                                    cVar3.f49271s = 6;
                                    return;
                                }
                                cVar3.f49271s = 1;
                                return;
                            case 21948:
                                this.f49245t.f49274v = (int) j11;
                                return;
                            case 21949:
                                this.f49245t.f49275w = (int) j11;
                                return;
                            default:
                                return;
                        }
                }
            }
            if (j11 != 1) {
                throw new t("ContentEncodingScope " + j11 + " not supported");
            }
            return;
        }
        if (j11 == 0) {
            return;
        }
        throw new t("ContentEncodingOrder " + j11 + " not supported");
    }

    public final boolean r(up.n nVar, long j11) {
        if (this.f49249x) {
            this.f49251z = j11;
            nVar.f46542a = this.f49250y;
            this.f49249x = false;
            return true;
        }
        if (this.f49246u) {
            long j12 = this.f49251z;
            if (j12 != -1) {
                nVar.f46542a = j12;
                this.f49251z = -1L;
                return true;
            }
        }
        return false;
    }

    public final void s(h hVar, int i11) throws IOException, InterruptedException {
        if (this.f49232g.d() >= i11) {
            return;
        }
        if (this.f49232g.b() < i11) {
            r rVar = this.f49232g;
            byte[] bArr = rVar.f34684a;
            rVar.I(Arrays.copyOf(bArr, Math.max(bArr.length * 2, i11)), this.f49232g.d());
        }
        r rVar2 = this.f49232g;
        hVar.readFully(rVar2.f34684a, rVar2.d(), i11 - this.f49232g.d());
        this.f49232g.J(i11);
    }

    public final int t(h hVar, q qVar, int i11) throws IOException, InterruptedException {
        int d11;
        int a11 = this.f49235j.a();
        if (a11 > 0) {
            d11 = Math.min(i11, a11);
            qVar.a(this.f49235j, d11);
        } else {
            d11 = qVar.d(hVar, i11, false);
        }
        this.N += d11;
        this.V += d11;
        return d11;
    }

    public final void u(h hVar, byte[] bArr, int i11, int i12) throws IOException, InterruptedException {
        int min = Math.min(i12, this.f49235j.a());
        hVar.readFully(bArr, i11 + min, i12 - min);
        if (min > 0) {
            this.f49235j.h(bArr, i11, min);
        }
        this.N += i12;
    }

    public final void v() {
        this.N = 0;
        this.V = 0;
        this.U = 0;
        this.O = false;
        this.P = false;
        this.R = false;
        this.T = 0;
        this.S = (byte) 0;
        this.Q = false;
        this.f49235j.G();
    }

    public final long w(long j11) throws t {
        long j12 = this.f49242q;
        if (j12 != -9223372036854775807L) {
            return g0.b0(j11, j12, 1000L);
        }
        throw new t("Can't scale timecode prior to timecodeScale being set.");
    }

    public void y(int i11, long j11, long j12) throws t {
        if (i11 != 160) {
            if (i11 != 174) {
                if (i11 != 187) {
                    if (i11 != 19899) {
                        if (i11 != 20533) {
                            if (i11 != 21968) {
                                if (i11 != 408125543) {
                                    if (i11 != 475249515) {
                                        if (i11 == 524531317 && !this.f49246u) {
                                            if (this.f49229d && this.f49250y != -1) {
                                                this.f49249x = true;
                                                return;
                                            } else {
                                                this.Y.g(new o.b(this.f49244s));
                                                this.f49246u = true;
                                                return;
                                            }
                                        }
                                        return;
                                    }
                                    this.B = new l();
                                    this.C = new l();
                                    return;
                                }
                                long j13 = this.f49241p;
                                if (j13 != -1 && j13 != j11) {
                                    throw new t("Multiple Segment elements not supported");
                                }
                                this.f49241p = j11;
                                this.f49240o = j12;
                                return;
                            }
                            this.f49245t.f49270r = true;
                            return;
                        }
                        this.f49245t.f49258f = true;
                        return;
                    }
                    this.f49247v = -1;
                    this.f49248w = -1L;
                    return;
                }
                this.D = false;
                return;
            }
            this.f49245t = new c();
            return;
        }
        this.X = false;
    }

    public void z(int i11, String str) throws t {
        if (i11 != 134) {
            if (i11 != 17026) {
                if (i11 != 21358) {
                    if (i11 == 2274716) {
                        this.f49245t.P = str;
                        return;
                    }
                    return;
                }
                this.f49245t.f49253a = str;
                return;
            }
            if (!"webm".equals(str) && !"matroska".equals(str)) {
                throw new t("DocType " + str + " not supported");
            }
            return;
        }
        this.f49245t.f49254b = str;
    }

    public e(int i11) {
        this(new xp.a(), i11);
    }

    public e(xp.b bVar, int i11) {
        this.f49241p = -1L;
        this.f49242q = -9223372036854775807L;
        this.f49243r = -9223372036854775807L;
        this.f49244s = -9223372036854775807L;
        this.f49250y = -1L;
        this.f49251z = -1L;
        this.A = -9223372036854775807L;
        this.f49226a = bVar;
        bVar.b(new b());
        this.f49229d = (i11 & 1) == 0;
        this.f49227b = new g();
        this.f49228c = new SparseArray<>();
        this.f49232g = new r(4);
        this.f49233h = new r(ByteBuffer.allocate(4).putInt(-1).array());
        this.f49234i = new r(4);
        this.f49230e = new r(fr.o.f34660a);
        this.f49231f = new r(4);
        this.f49235j = new r();
        this.f49236k = new r();
        this.f49237l = new r(8);
        this.f49238m = new r();
    }

    @Override
    public void release() {
    }
}