FLIX VISION v2.8.2版本的 MD5 值为:4d33b143293b36f23ce5a6a5834e6993

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


package v3;

import android.util.Log;
import android.util.SparseArray;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.drm.c;
import com.unity3d.services.core.device.MimeTypes;
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 p3.i;
import t3.k;
import t3.l;
import t3.m;
import y4.g;
import y4.j;
import y4.l;
import y4.u;

public final class d implements t3.e {
    public static final byte[] Z = {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[] f18581a0 = {32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32};

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

    public static final byte[] f18583c0 = {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 long f18584d0 = 10000;

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

    public static final UUID f18586f0 = new UUID(72057594037932032L, -9223371306706625679L);
    public long A;
    public g B;
    public g 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 t3.g Y;

    public final v3.b f18587a;

    public final f f18588b;

    public final SparseArray<b> f18589c;

    public final boolean f18590d;

    public final l f18591e;

    public final l f18592f;

    public final l f18593g;

    public final l f18594h;

    public final l f18595i;

    public final l f18596j;

    public final l f18597k;

    public final l f18598l;

    public final l f18599m;

    public ByteBuffer f18600n;

    public long f18601o;

    public long f18602p;

    public long f18603q;

    public long f18604r;

    public long f18605s;

    public b f18606t;

    public boolean f18607u;

    public int f18608v;

    public long f18609w;

    public boolean f18610x;

    public long f18611y;

    public long f18612z;

    public final class a implements c {
        public a() {
        }

        public void binaryElement(int i10, int i11, t3.f fVar) throws IOException, InterruptedException {
            long j10;
            int i12;
            int i13;
            int i14;
            d dVar = d.this;
            dVar.getClass();
            int i15 = 1;
            int i16 = 0;
            if (i10 != 161 && i10 != 163) {
                if (i10 == 16981) {
                    b bVar = dVar.f18606t;
                    byte[] bArr = new byte[i11];
                    bVar.f18619f = bArr;
                    ((t3.b) fVar).readFully(bArr, 0, i11);
                    return;
                }
                if (i10 == 18402) {
                    byte[] bArr2 = new byte[i11];
                    ((t3.b) fVar).readFully(bArr2, 0, i11);
                    dVar.f18606t.f18620g = new m.a(1, bArr2, 0, 0);
                    return;
                }
                if (i10 == 21419) {
                    l lVar = dVar.f18595i;
                    Arrays.fill(lVar.f20517a, (byte) 0);
                    ((t3.b) fVar).readFully(lVar.f20517a, 4 - i11, i11);
                    lVar.setPosition(0);
                    dVar.f18608v = (int) lVar.readUnsignedInt();
                    return;
                }
                if (i10 == 25506) {
                    b bVar2 = dVar.f18606t;
                    byte[] bArr3 = new byte[i11];
                    bVar2.f18621h = bArr3;
                    ((t3.b) fVar).readFully(bArr3, 0, i11);
                    return;
                }
                if (i10 != 30322) {
                    throw new ParserException(a.b.g("Unexpected id: ", i10));
                }
                b bVar3 = dVar.f18606t;
                byte[] bArr4 = new byte[i11];
                bVar3.f18628o = bArr4;
                ((t3.b) fVar).readFully(bArr4, 0, i11);
                return;
            }
            int i17 = dVar.E;
            l lVar2 = dVar.f18593g;
            if (i17 == 0) {
                f fVar2 = dVar.f18588b;
                dVar.K = (int) fVar2.readUnsignedVarint(fVar, false, true, 8);
                dVar.L = fVar2.getLastLength();
                dVar.G = -9223372036854775807L;
                dVar.E = 1;
                lVar2.reset();
            }
            b bVar4 = dVar.f18589c.get(dVar.K);
            if (bVar4 == null) {
                ((t3.b) fVar).skipFully(i11 - dVar.L);
                dVar.E = 0;
                return;
            }
            if (dVar.E == 1) {
                dVar.c(fVar, 3);
                int i18 = (lVar2.f20517a[2] & 6) >> 1;
                byte b5 = 255;
                if (i18 == 0) {
                    dVar.I = 1;
                    int[] iArr = dVar.J;
                    if (iArr == null) {
                        iArr = new int[1];
                    } else if (iArr.length < 1) {
                        iArr = new int[Math.max(iArr.length * 2, 1)];
                    }
                    dVar.J = iArr;
                    iArr[0] = (i11 - dVar.L) - 3;
                } else {
                    if (i10 != 163) {
                        throw new ParserException("Lacing only supported in SimpleBlocks.");
                    }
                    int i19 = 4;
                    dVar.c(fVar, 4);
                    int i20 = (lVar2.f20517a[3] & 255) + 1;
                    dVar.I = i20;
                    int[] iArr2 = dVar.J;
                    if (iArr2 == null) {
                        iArr2 = new int[i20];
                    } else if (iArr2.length < i20) {
                        iArr2 = new int[Math.max(iArr2.length * 2, i20)];
                    }
                    dVar.J = iArr2;
                    if (i18 == 2) {
                        int i21 = (i11 - dVar.L) - 4;
                        int i22 = dVar.I;
                        Arrays.fill(iArr2, 0, i22, i21 / i22);
                    } else if (i18 == 1) {
                        int i23 = 0;
                        int i24 = 0;
                        while (true) {
                            i12 = dVar.I;
                            if (i23 >= i12 - 1) {
                                break;
                            }
                            dVar.J[i23] = 0;
                            do {
                                i19++;
                                dVar.c(fVar, i19);
                                i13 = lVar2.f20517a[i19 - 1] & 255;
                                int[] iArr3 = dVar.J;
                                i14 = iArr3[i23] + i13;
                                iArr3[i23] = i14;
                            } while (i13 == 255);
                            i24 += i14;
                            i23++;
                        }
                        dVar.J[i12 - 1] = ((i11 - dVar.L) - i19) - i24;
                    } else {
                        if (i18 != 3) {
                            throw new ParserException(a.b.g("Unexpected lacing value: ", i18));
                        }
                        int i25 = 0;
                        int i26 = 0;
                        while (true) {
                            int i27 = dVar.I;
                            if (i25 >= i27 - 1) {
                                dVar.J[i27 - 1] = ((i11 - dVar.L) - i19) - i26;
                                i15 = 1;
                                break;
                            }
                            dVar.J[i25] = i16;
                            i19++;
                            dVar.c(fVar, i19);
                            int i28 = i19 - 1;
                            if (lVar2.f20517a[i28] == 0) {
                                throw new ParserException("No valid varint length mask found");
                            }
                            int i29 = 0;
                            while (true) {
                                if (i29 >= 8) {
                                    j10 = 0;
                                    break;
                                }
                                int i30 = i15 << (7 - i29);
                                if ((lVar2.f20517a[i28] & i30) != 0) {
                                    int i31 = i19 + i29;
                                    dVar.c(fVar, i31);
                                    int i32 = i28 + 1;
                                    j10 = (~i30) & lVar2.f20517a[i28] & b5;
                                    while (i32 < i31) {
                                        int i33 = lVar2.f20517a[i32] & 255;
                                        i32++;
                                        j10 = i33 | (j10 << 8);
                                        i31 = i31;
                                    }
                                    int i34 = i31;
                                    if (i25 > 0) {
                                        j10 -= (1 << ((i29 * 7) + 6)) - 1;
                                    }
                                    i19 = i34;
                                } else {
                                    i29++;
                                    i15 = 1;
                                    b5 = 255;
                                }
                            }
                            if (j10 < -2147483648L || j10 > 2147483647L) {
                                break;
                            }
                            int i35 = (int) j10;
                            int[] iArr4 = dVar.J;
                            if (i25 != 0) {
                                i35 += iArr4[i25 - 1];
                            }
                            iArr4[i25] = i35;
                            i26 += i35;
                            i25++;
                            i15 = 1;
                            i16 = 0;
                            b5 = 255;
                        }
                    }
                }
                byte[] bArr5 = lVar2.f20517a;
                dVar.F = dVar.e((bArr5[i15] & 255) | (bArr5[0] << 8)) + dVar.A;
                byte b10 = lVar2.f20517a[2];
                dVar.M = ((bVar4.f18616c == 2 || (i10 == 163 && (b10 & 128) == 128)) ? 1 : 0) | ((b10 & 8) == 8 ? Integer.MIN_VALUE : 0);
                dVar.E = 2;
                dVar.H = 0;
            }
            if (i10 != 163) {
                dVar.f(fVar, bVar4, dVar.J[0]);
                return;
            }
            while (true) {
                int i36 = dVar.H;
                if (i36 >= dVar.I) {
                    dVar.E = 0;
                    return;
                } else {
                    dVar.f(fVar, bVar4, dVar.J[i36]);
                    dVar.a(bVar4, dVar.F + ((dVar.H * bVar4.f18617d) / 1000));
                    dVar.H++;
                }
            }
        }

        public void endMasterElement(int i10) throws ParserException {
            t3.l aVar;
            g gVar;
            g gVar2;
            int i11;
            d dVar = d.this;
            SparseArray<b> sparseArray = dVar.f18589c;
            if (i10 == 160) {
                if (dVar.E != 2) {
                    return;
                }
                if (!dVar.X) {
                    dVar.M |= 1;
                }
                dVar.a(sparseArray.get(dVar.K), dVar.F);
                dVar.E = 0;
                return;
            }
            if (i10 == 174) {
                String str = dVar.f18606t.f18614a;
                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)) ? 1 : 0) != 0) {
                    b bVar = dVar.f18606t;
                    bVar.initializeOutput(dVar.Y, bVar.f18615b);
                    b bVar2 = dVar.f18606t;
                    sparseArray.put(bVar2.f18615b, bVar2);
                }
                dVar.f18606t = null;
                return;
            }
            if (i10 == 19899) {
                int i12 = dVar.f18608v;
                if (i12 != -1) {
                    long j10 = dVar.f18609w;
                    if (j10 != -1) {
                        if (i12 == 475249515) {
                            dVar.f18611y = j10;
                            return;
                        }
                        return;
                    }
                }
                throw new ParserException("Mandatory element SeekID or SeekPosition not found");
            }
            if (i10 == 25152) {
                b bVar3 = dVar.f18606t;
                if (bVar3.f18618e) {
                    m.a aVar2 = bVar3.f18620g;
                    if (aVar2 == null) {
                        throw new ParserException("Encrypted Track found but ContentEncKeyID was not found");
                    }
                    bVar3.f18622i = new com.google.android.exoplayer2.drm.c(new c.b(p3.b.f17229b, null, MimeTypes.VIDEO_WEBM, aVar2.f18243b));
                    return;
                }
                return;
            }
            if (i10 == 28032) {
                b bVar4 = dVar.f18606t;
                if (bVar4.f18618e && bVar4.f18619f != null) {
                    throw new ParserException("Combining encryption and compression is not supported");
                }
                return;
            }
            if (i10 == 357149030) {
                if (dVar.f18603q == -9223372036854775807L) {
                    dVar.f18603q = 1000000L;
                }
                long j11 = dVar.f18604r;
                if (j11 != -9223372036854775807L) {
                    dVar.f18605s = dVar.e(j11);
                    return;
                }
                return;
            }
            if (i10 == 374648427) {
                if (sparseArray.size() == 0) {
                    throw new ParserException("No valid tracks were found");
                }
                dVar.Y.endTracks();
                return;
            }
            if (i10 == 475249515 && !dVar.f18607u) {
                t3.g gVar3 = dVar.Y;
                if (dVar.f18602p == -1 || dVar.f18605s == -9223372036854775807L || (gVar = dVar.B) == null || gVar.size() == 0 || (gVar2 = dVar.C) == null || gVar2.size() != dVar.B.size()) {
                    dVar.B = null;
                    dVar.C = null;
                    aVar = new l.a(dVar.f18605s);
                } else {
                    int size = dVar.B.size();
                    int[] iArr = new int[size];
                    long[] jArr = new long[size];
                    long[] jArr2 = new long[size];
                    long[] jArr3 = new long[size];
                    for (int i13 = 0; i13 < size; i13++) {
                        jArr3[i13] = dVar.B.get(i13);
                        jArr[i13] = dVar.C.get(i13) + dVar.f18602p;
                    }
                    while (true) {
                        i11 = size - 1;
                        if (r4 >= i11) {
                            break;
                        }
                        int i14 = r4 + 1;
                        iArr[r4] = (int) (jArr[i14] - jArr[r4]);
                        jArr2[r4] = jArr3[i14] - jArr3[r4];
                        r4 = i14;
                    }
                    iArr[i11] = (int) ((dVar.f18602p + dVar.f18601o) - jArr[i11]);
                    jArr2[i11] = dVar.f18605s - jArr3[i11];
                    dVar.B = null;
                    dVar.C = null;
                    aVar = new t3.a(iArr, jArr, jArr2, jArr3);
                }
                gVar3.seekMap(aVar);
                dVar.f18607u = true;
            }
        }

        public void floatElement(int i10, double d10) throws ParserException {
            d dVar = d.this;
            if (i10 == 181) {
                dVar.f18606t.I = (int) d10;
                return;
            }
            if (i10 == 17545) {
                dVar.f18604r = (long) d10;
                return;
            }
            switch (i10) {
                case 21969:
                    dVar.f18606t.f18636w = (float) d10;
                    return;
                case 21970:
                    dVar.f18606t.f18637x = (float) d10;
                    return;
                case 21971:
                    dVar.f18606t.f18638y = (float) d10;
                    return;
                case 21972:
                    dVar.f18606t.f18639z = (float) d10;
                    return;
                case 21973:
                    dVar.f18606t.A = (float) d10;
                    return;
                case 21974:
                    dVar.f18606t.B = (float) d10;
                    return;
                case 21975:
                    dVar.f18606t.C = (float) d10;
                    return;
                case 21976:
                    dVar.f18606t.D = (float) d10;
                    return;
                case 21977:
                    dVar.f18606t.E = (float) d10;
                    return;
                case 21978:
                    dVar.f18606t.F = (float) d10;
                    return;
                default:
                    dVar.getClass();
                    return;
            }
        }

        public int getElementType(int i10) {
            d.this.getClass();
            switch (i10) {
                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 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;
            }
        }

        public void integerElement(int i10, long j10) throws ParserException {
            d dVar = d.this;
            dVar.getClass();
            if (i10 == 20529) {
                if (j10 == 0) {
                    return;
                }
                throw new ParserException("ContentEncodingOrder " + j10 + " not supported");
            }
            if (i10 == 20530) {
                if (j10 == 1) {
                    return;
                }
                throw new ParserException("ContentEncodingScope " + j10 + " not supported");
            }
            switch (i10) {
                case 131:
                    dVar.f18606t.f18616c = (int) j10;
                    return;
                case 136:
                    dVar.f18606t.L = j10 == 1;
                    return;
                case 155:
                    dVar.G = dVar.e(j10);
                    return;
                case 159:
                    dVar.f18606t.G = (int) j10;
                    return;
                case 176:
                    dVar.f18606t.f18623j = (int) j10;
                    return;
                case 179:
                    dVar.B.add(dVar.e(j10));
                    return;
                case 186:
                    dVar.f18606t.f18624k = (int) j10;
                    return;
                case 215:
                    dVar.f18606t.f18615b = (int) j10;
                    return;
                case 231:
                    dVar.A = dVar.e(j10);
                    return;
                case 241:
                    if (dVar.D) {
                        return;
                    }
                    dVar.C.add(j10);
                    dVar.D = true;
                    return;
                case 251:
                    dVar.X = true;
                    return;
                case 16980:
                    if (j10 == 3) {
                        return;
                    }
                    throw new ParserException("ContentCompAlgo " + j10 + " not supported");
                case 17029:
                    if (j10 < 1 || j10 > 2) {
                        throw new ParserException("DocTypeReadVersion " + j10 + " not supported");
                    }
                    return;
                case 17143:
                    if (j10 == 1) {
                        return;
                    }
                    throw new ParserException("EBMLReadVersion " + j10 + " not supported");
                case 18401:
                    if (j10 == 5) {
                        return;
                    }
                    throw new ParserException("ContentEncAlgo " + j10 + " not supported");
                case 18408:
                    if (j10 == 1) {
                        return;
                    }
                    throw new ParserException("AESSettingsCipherMode " + j10 + " not supported");
                case 21420:
                    dVar.f18609w = j10 + dVar.f18602p;
                    return;
                case 21432:
                    int i11 = (int) j10;
                    if (i11 == 0) {
                        dVar.f18606t.f18629p = 0;
                        return;
                    }
                    if (i11 == 1) {
                        dVar.f18606t.f18629p = 2;
                        return;
                    } else if (i11 == 3) {
                        dVar.f18606t.f18629p = 1;
                        return;
                    } else {
                        if (i11 != 15) {
                            return;
                        }
                        dVar.f18606t.f18629p = 3;
                        return;
                    }
                case 21680:
                    dVar.f18606t.f18625l = (int) j10;
                    return;
                case 21682:
                    dVar.f18606t.f18627n = (int) j10;
                    return;
                case 21690:
                    dVar.f18606t.f18626m = (int) j10;
                    return;
                case 21930:
                    dVar.f18606t.M = j10 == 1;
                    return;
                case 22186:
                    dVar.f18606t.J = j10;
                    return;
                case 22203:
                    dVar.f18606t.K = j10;
                    return;
                case 25188:
                    dVar.f18606t.H = (int) j10;
                    return;
                case 2352003:
                    dVar.f18606t.f18617d = (int) j10;
                    return;
                case 2807729:
                    dVar.f18603q = j10;
                    return;
                default:
                    switch (i10) {
                        case 21945:
                            int i12 = (int) j10;
                            if (i12 == 1) {
                                dVar.f18606t.f18633t = 2;
                                return;
                            } else {
                                if (i12 != 2) {
                                    return;
                                }
                                dVar.f18606t.f18633t = 1;
                                return;
                            }
                        case 21946:
                            int i13 = (int) j10;
                            if (i13 != 1) {
                                if (i13 == 16) {
                                    dVar.f18606t.f18632s = 6;
                                    return;
                                } else if (i13 == 18) {
                                    dVar.f18606t.f18632s = 7;
                                    return;
                                } else if (i13 != 6 && i13 != 7) {
                                    return;
                                }
                            }
                            dVar.f18606t.f18632s = 3;
                            return;
                        case 21947:
                            b bVar = dVar.f18606t;
                            bVar.f18630q = true;
                            int i14 = (int) j10;
                            if (i14 == 1) {
                                bVar.f18631r = 1;
                                return;
                            }
                            if (i14 == 9) {
                                bVar.f18631r = 6;
                                return;
                            } else {
                                if (i14 == 4 || i14 == 5 || i14 == 6 || i14 == 7) {
                                    bVar.f18631r = 2;
                                    return;
                                }
                                return;
                            }
                        case 21948:
                            dVar.f18606t.f18634u = (int) j10;
                            return;
                        case 21949:
                            dVar.f18606t.f18635v = (int) j10;
                            return;
                        default:
                            return;
                    }
            }
        }

        public boolean isLevel1Element(int i10) {
            d.this.getClass();
            return i10 == 357149030 || i10 == 524531317 || i10 == 475249515 || i10 == 374648427;
        }

        public void startMasterElement(int i10, long j10, long j11) throws ParserException {
            d dVar = d.this;
            dVar.getClass();
            if (i10 == 160) {
                dVar.X = false;
                return;
            }
            if (i10 == 174) {
                dVar.f18606t = new b();
                return;
            }
            if (i10 == 187) {
                dVar.D = false;
                return;
            }
            if (i10 == 19899) {
                dVar.f18608v = -1;
                dVar.f18609w = -1L;
                return;
            }
            if (i10 == 20533) {
                dVar.f18606t.f18618e = true;
                return;
            }
            if (i10 == 21968) {
                dVar.f18606t.f18630q = true;
                return;
            }
            if (i10 == 408125543) {
                long j12 = dVar.f18602p;
                if (j12 != -1 && j12 != j10) {
                    throw new ParserException("Multiple Segment elements not supported");
                }
                dVar.f18602p = j10;
                dVar.f18601o = j11;
                return;
            }
            if (i10 == 475249515) {
                dVar.B = new g();
                dVar.C = new g();
            } else if (i10 == 524531317 && !dVar.f18607u) {
                if (dVar.f18590d && dVar.f18611y != -1) {
                    dVar.f18610x = true;
                } else {
                    dVar.Y.seekMap(new l.a(dVar.f18605s));
                    dVar.f18607u = true;
                }
            }
        }

        public void stringElement(int i10, String str) throws ParserException {
            d dVar = d.this;
            dVar.getClass();
            if (i10 == 134) {
                dVar.f18606t.f18614a = str;
                return;
            }
            if (i10 != 17026) {
                if (i10 != 2274716) {
                    return;
                }
                dVar.f18606t.N = str;
            } else if (!"webm".equals(str) && !"matroska".equals(str)) {
                throw new ParserException(a.b.l("DocType ", str, " not supported"));
            }
        }
    }

    public static final class b {
        public boolean L;
        public m O;
        public int P;

        public String f18614a;

        public int f18615b;

        public int f18616c;

        public int f18617d;

        public boolean f18618e;

        public byte[] f18619f;

        public m.a f18620g;

        public byte[] f18621h;

        public com.google.android.exoplayer2.drm.c f18622i;

        public int f18623j = -1;

        public int f18624k = -1;

        public int f18625l = -1;

        public int f18626m = -1;

        public int f18627n = 0;

        public byte[] f18628o = null;

        public int f18629p = -1;

        public boolean f18630q = false;

        public int f18631r = -1;

        public int f18632s = -1;

        public int f18633t = -1;

        public int f18634u = 1000;

        public int f18635v = 200;

        public float f18636w = -1.0f;

        public float f18637x = -1.0f;

        public float f18638y = -1.0f;

        public float f18639z = -1.0f;
        public float A = -1.0f;
        public float B = -1.0f;
        public float C = -1.0f;
        public float D = -1.0f;
        public float E = -1.0f;
        public float F = -1.0f;
        public int G = 1;
        public int H = -1;
        public int I = 8000;
        public long J = 0;
        public long K = 0;
        public boolean M = true;
        public String N = "eng";

        public void initializeOutput(t3.g gVar, int i10) throws ParserException {
            char c10;
            List<byte[]> singletonList;
            String str;
            boolean z10;
            int pcmEncoding;
            String str2;
            List<byte[]> list;
            String str3;
            int i11;
            int i12;
            String str4;
            List<byte[]> list2;
            i createImageSampleFormat;
            z4.b bVar;
            byte[] bArr;
            int i13;
            String str5 = this.f18614a;
            str5.getClass();
            int i14 = 2;
            switch (str5.hashCode()) {
                case -2095576542:
                    if (str5.equals("V_MPEG4/ISO/AP")) {
                        c10 = 0;
                        break;
                    }
                    c10 = 65535;
                    break;
                case -2095575984:
                    if (str5.equals("V_MPEG4/ISO/SP")) {
                        c10 = 1;
                        break;
                    }
                    c10 = 65535;
                    break;
                case -1985379776:
                    if (str5.equals("A_MS/ACM")) {
                        c10 = 2;
                        break;
                    }
                    c10 = 65535;
                    break;
                case -1784763192:
                    if (str5.equals("A_TRUEHD")) {
                        c10 = 3;
                        break;
                    }
                    c10 = 65535;
                    break;
                case -1730367663:
                    if (str5.equals("A_VORBIS")) {
                        c10 = 4;
                        break;
                    }
                    c10 = 65535;
                    break;
                case -1482641358:
                    if (str5.equals("A_MPEG/L2")) {
                        c10 = 5;
                        break;
                    }
                    c10 = 65535;
                    break;
                case -1482641357:
                    if (str5.equals("A_MPEG/L3")) {
                        c10 = 6;
                        break;
                    }
                    c10 = 65535;
                    break;
                case -1373388978:
                    if (str5.equals("V_MS/VFW/FOURCC")) {
                        c10 = 7;
                        break;
                    }
                    c10 = 65535;
                    break;
                case -933872740:
                    if (str5.equals("S_DVBSUB")) {
                        c10 = '\b';
                        break;
                    }
                    c10 = 65535;
                    break;
                case -538363189:
                    if (str5.equals("V_MPEG4/ISO/ASP")) {
                        c10 = '\t';
                        break;
                    }
                    c10 = 65535;
                    break;
                case -538363109:
                    if (str5.equals("V_MPEG4/ISO/AVC")) {
                        c10 = '\n';
                        break;
                    }
                    c10 = 65535;
                    break;
                case -425012669:
                    if (str5.equals("S_VOBSUB")) {
                        c10 = 11;
                        break;
                    }
                    c10 = 65535;
                    break;
                case -356037306:
                    if (str5.equals("A_DTS/LOSSLESS")) {
                        c10 = '\f';
                        break;
                    }
                    c10 = 65535;
                    break;
                case 62923557:
                    if (str5.equals("A_AAC")) {
                        c10 = '\r';
                        break;
                    }
                    c10 = 65535;
                    break;
                case 62923603:
                    if (str5.equals("A_AC3")) {
                        c10 = 14;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 62927045:
                    if (str5.equals("A_DTS")) {
                        c10 = 15;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 82338133:
                    if (str5.equals("V_VP8")) {
                        c10 = 16;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 82338134:
                    if (str5.equals("V_VP9")) {
                        c10 = 17;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 99146302:
                    if (str5.equals("S_HDMV/PGS")) {
                        c10 = 18;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 444813526:
                    if (str5.equals("V_THEORA")) {
                        c10 = 19;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 542569478:
                    if (str5.equals("A_DTS/EXPRESS")) {
                        c10 = 20;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 725957860:
                    if (str5.equals("A_PCM/INT/LIT")) {
                        c10 = 21;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 738597099:
                    if (str5.equals("S_TEXT/ASS")) {
                        c10 = 22;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 855502857:
                    if (str5.equals("V_MPEGH/ISO/HEVC")) {
                        c10 = 23;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 1422270023:
                    if (str5.equals("S_TEXT/UTF8")) {
                        c10 = 24;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 1809237540:
                    if (str5.equals("V_MPEG2")) {
                        c10 = 25;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 1950749482:
                    if (str5.equals("A_EAC3")) {
                        c10 = 26;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 1950789798:
                    if (str5.equals("A_FLAC")) {
                        c10 = 27;
                        break;
                    }
                    c10 = 65535;
                    break;
                case 1951062397:
                    if (str5.equals("A_OPUS")) {
                        c10 = 28;
                        break;
                    }
                    c10 = 65535;
                    break;
                default:
                    c10 = 65535;
                    break;
            }
            switch (c10) {
                case 0:
                case 1:
                case '\t':
                    byte[] bArr2 = this.f18621h;
                    singletonList = bArr2 == null ? null : Collections.singletonList(bArr2);
                    str = "video/mp4v-es";
                    list = singletonList;
                    str3 = str;
                    i11 = -1;
                    i12 = -1;
                    int i15 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                        createImageSampleFormat = i.createAudioSampleFormat(Integer.toString(i10), str3, null, -1, i12, this.G, this.I, i11, list, this.f18622i, i15, this.N);
                        i14 = 1;
                    } else if (y4.i.isVideo(str3)) {
                        if (this.f18627n == 0) {
                            int i16 = this.f18625l;
                            if (i16 == -1) {
                                i16 = this.f18623j;
                            }
                            this.f18625l = i16;
                            int i17 = this.f18626m;
                            if (i17 == -1) {
                                i17 = this.f18624k;
                            }
                            this.f18626m = i17;
                        }
                        float f10 = (this.f18625l == -1 || (i13 = this.f18626m) == -1) ? -1.0f : (this.f18624k * r1) / (this.f18623j * i13);
                        if (this.f18630q) {
                            if (this.f18636w == -1.0f || this.f18637x == -1.0f || this.f18638y == -1.0f || this.f18639z == -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) {
                                bArr = null;
                            } else {
                                bArr = new byte[25];
                                ByteBuffer wrap = ByteBuffer.wrap(bArr);
                                wrap.put((byte) 0);
                                wrap.putShort((short) ((this.f18636w * 50000.0f) + 0.5f));
                                wrap.putShort((short) ((this.f18637x * 50000.0f) + 0.5f));
                                wrap.putShort((short) ((this.f18638y * 50000.0f) + 0.5f));
                                wrap.putShort((short) ((this.f18639z * 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 + 0.5f));
                                wrap.putShort((short) (this.F + 0.5f));
                                wrap.putShort((short) this.f18634u);
                                wrap.putShort((short) this.f18635v);
                            }
                            bVar = new z4.b(this.f18631r, this.f18633t, this.f18632s, bArr);
                        } else {
                            bVar = null;
                        }
                        createImageSampleFormat = i.createVideoSampleFormat(Integer.toString(i10), str3, null, -1, i12, this.f18623j, this.f18624k, -1.0f, list, -1, f10, this.f18628o, this.f18629p, bVar, this.f18622i);
                    } else {
                        if ("application/x-subrip".equals(str3)) {
                            createImageSampleFormat = i.createTextSampleFormat(Integer.toString(i10), str3, i15, this.N, this.f18622i);
                        } else if ("text/x-ssa".equals(str3)) {
                            ArrayList arrayList = new ArrayList(2);
                            arrayList.add(d.f18582b0);
                            arrayList.add(this.f18621h);
                            createImageSampleFormat = i.createTextSampleFormat(Integer.toString(i10), str3, null, -1, i15, this.N, -1, this.f18622i, Long.MAX_VALUE, arrayList);
                        } else {
                            if (!"application/vobsub".equals(str3) && !"application/pgs".equals(str3) && !"application/dvbsubs".equals(str3)) {
                                throw new ParserException("Unexpected MIME type.");
                            }
                            createImageSampleFormat = i.createImageSampleFormat(Integer.toString(i10), str3, null, -1, list, this.N, this.f18622i);
                        }
                        i14 = 3;
                    }
                    m track = gVar.track(this.f18615b, i14);
                    this.O = track;
                    track.format(createImageSampleFormat);
                    return;
                case 2:
                    y4.l lVar = new y4.l(this.f18621h);
                    try {
                        int readLittleEndianUnsignedShort = lVar.readLittleEndianUnsignedShort();
                        if (readLittleEndianUnsignedShort != 1) {
                            if (readLittleEndianUnsignedShort == 65534) {
                                lVar.setPosition(24);
                                long readLong = lVar.readLong();
                                UUID uuid = d.f18586f0;
                                if (readLong == uuid.getMostSignificantBits()) {
                                    break;
                                }
                            }
                            z10 = false;
                            if (!z10) {
                                pcmEncoding = u.getPcmEncoding(this.H);
                                if (pcmEncoding == 0) {
                                    Log.w("MatroskaExtractor", "Unsupported PCM bit depth: " + this.H + ". Setting mimeType to audio/x-unknown");
                                }
                                i11 = pcmEncoding;
                                str3 = "audio/raw";
                                list = null;
                                i12 = -1;
                                int i152 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                                if (!y4.i.isAudio(str3)) {
                                }
                                m track2 = gVar.track(this.f18615b, i14);
                                this.O = track2;
                                track2.format(createImageSampleFormat);
                                return;
                            }
                            Log.w("MatroskaExtractor", "Non-PCM MS/ACM is unsupported. Setting mimeType to audio/x-unknown");
                            str3 = "audio/x-unknown";
                            list = null;
                            i11 = -1;
                            i12 = -1;
                            int i1522 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                            if (!y4.i.isAudio(str3)) {
                            }
                            m track22 = gVar.track(this.f18615b, i14);
                            this.O = track22;
                            track22.format(createImageSampleFormat);
                            return;
                        }
                        z10 = true;
                        if (!z10) {
                        }
                        str3 = "audio/x-unknown";
                        list = null;
                        i11 = -1;
                        i12 = -1;
                        int i15222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                        if (!y4.i.isAudio(str3)) {
                        }
                        m track222 = gVar.track(this.f18615b, i14);
                        this.O = track222;
                        track222.format(createImageSampleFormat);
                        return;
                    } catch (ArrayIndexOutOfBoundsException unused) {
                        throw new ParserException("Error parsing MS/ACM codec private");
                    }
                case 3:
                    str2 = "audio/true-hd";
                    str3 = str2;
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i152222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track2222 = gVar.track(this.f18615b, i14);
                    this.O = track2222;
                    track2222.format(createImageSampleFormat);
                    return;
                case 4:
                    byte[] bArr3 = this.f18621h;
                    try {
                        if (bArr3[0] != 2) {
                            throw new ParserException("Error parsing vorbis codec private");
                        }
                        int i18 = 1;
                        int i19 = 0;
                        while (true) {
                            int i20 = bArr3[i18];
                            if (i20 == -1) {
                                i19 += 255;
                                i18++;
                            } else {
                                int i21 = i18 + 1;
                                int i22 = i19 + i20;
                                int i23 = 0;
                                while (true) {
                                    int i24 = bArr3[i21];
                                    if (i24 != -1) {
                                        int i25 = i21 + 1;
                                        int i26 = i23 + i24;
                                        if (bArr3[i25] != 1) {
                                            throw new ParserException("Error parsing vorbis codec private");
                                        }
                                        byte[] bArr4 = new byte[i22];
                                        System.arraycopy(bArr3, i25, bArr4, 0, i22);
                                        int i27 = i25 + i22;
                                        if (bArr3[i27] != 3) {
                                            throw new ParserException("Error parsing vorbis codec private");
                                        }
                                        int i28 = i27 + i26;
                                        if (bArr3[i28] != 5) {
                                            throw new ParserException("Error parsing vorbis codec private");
                                        }
                                        byte[] bArr5 = new byte[bArr3.length - i28];
                                        System.arraycopy(bArr3, i28, bArr5, 0, bArr3.length - i28);
                                        ArrayList arrayList2 = new ArrayList(2);
                                        arrayList2.add(bArr4);
                                        arrayList2.add(bArr5);
                                        list = arrayList2;
                                        str3 = "audio/vorbis";
                                        i11 = -1;
                                        i12 = 8192;
                                        int i1522222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                                        if (!y4.i.isAudio(str3)) {
                                        }
                                        m track22222 = gVar.track(this.f18615b, i14);
                                        this.O = track22222;
                                        track22222.format(createImageSampleFormat);
                                        return;
                                    }
                                    i23 += 255;
                                    i21++;
                                }
                            }
                        }
                    } catch (ArrayIndexOutOfBoundsException unused2) {
                        throw new ParserException("Error parsing vorbis codec private");
                    }
                    break;
                case 5:
                    str4 = "audio/mpeg-L2";
                    str3 = str4;
                    list = null;
                    i11 = -1;
                    i12 = 4096;
                    int i15222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track222222 = gVar.track(this.f18615b, i14);
                    this.O = track222222;
                    track222222.format(createImageSampleFormat);
                    return;
                case 6:
                    str4 = "audio/mpeg";
                    str3 = str4;
                    list = null;
                    i11 = -1;
                    i12 = 4096;
                    int i152222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track2222222 = gVar.track(this.f18615b, i14);
                    this.O = track2222222;
                    track2222222.format(createImageSampleFormat);
                    return;
                case 7:
                    y4.l lVar2 = new y4.l(this.f18621h);
                    try {
                        lVar2.skipBytes(16);
                        if (lVar2.readLittleEndianUnsignedInt() == 826496599) {
                            byte[] bArr6 = lVar2.f20517a;
                            for (int position = lVar2.getPosition() + 20; position < bArr6.length - 4; position++) {
                                if (bArr6[position] == 0 && bArr6[position + 1] == 0 && bArr6[position + 2] == 1 && bArr6[position + 3] == 15) {
                                    singletonList = Collections.singletonList(Arrays.copyOfRange(bArr6, position, bArr6.length));
                                }
                            }
                            throw new ParserException("Failed to find FourCC VC1 initialization data");
                        }
                        singletonList = null;
                        if (singletonList != null) {
                            str = "video/wvc1";
                            list = singletonList;
                            str3 = str;
                            i11 = -1;
                            i12 = -1;
                            int i1522222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                            if (!y4.i.isAudio(str3)) {
                            }
                            m track22222222 = gVar.track(this.f18615b, i14);
                            this.O = track22222222;
                            track22222222.format(createImageSampleFormat);
                            return;
                        }
                        Log.w("MatroskaExtractor", "Unsupported FourCC. Setting mimeType to video/x-unknown");
                        list = singletonList;
                        str3 = "video/x-unknown";
                        i11 = -1;
                        i12 = -1;
                        int i15222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                        if (!y4.i.isAudio(str3)) {
                        }
                        m track222222222 = gVar.track(this.f18615b, i14);
                        this.O = track222222222;
                        track222222222.format(createImageSampleFormat);
                        return;
                    } catch (ArrayIndexOutOfBoundsException unused3) {
                        throw new ParserException("Error parsing FourCC VC1 codec private");
                    }
                case '\b':
                    byte[] bArr7 = this.f18621h;
                    singletonList = Collections.singletonList(new byte[]{bArr7[0], bArr7[1], bArr7[2], bArr7[3]});
                    str = "application/dvbsubs";
                    list = singletonList;
                    str3 = str;
                    i11 = -1;
                    i12 = -1;
                    int i152222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track2222222222 = gVar.track(this.f18615b, i14);
                    this.O = track2222222222;
                    track2222222222.format(createImageSampleFormat);
                    return;
                case '\n':
                    z4.a parse = z4.a.parse(new y4.l(this.f18621h));
                    list2 = parse.f20778a;
                    this.P = parse.f20779b;
                    str = MimeTypes.VIDEO_H264;
                    list = list2;
                    str3 = str;
                    i11 = -1;
                    i12 = -1;
                    int i1522222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track22222222222 = gVar.track(this.f18615b, i14);
                    this.O = track22222222222;
                    track22222222222.format(createImageSampleFormat);
                    return;
                case 11:
                    singletonList = Collections.singletonList(this.f18621h);
                    str = "application/vobsub";
                    list = singletonList;
                    str3 = str;
                    i11 = -1;
                    i12 = -1;
                    int i15222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track222222222222;
                    track222222222222.format(createImageSampleFormat);
                    return;
                case '\f':
                    str2 = "audio/vnd.dts.hd";
                    str3 = str2;
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i152222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track2222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track2222222222222;
                    track2222222222222.format(createImageSampleFormat);
                    return;
                case '\r':
                    singletonList = Collections.singletonList(this.f18621h);
                    str = "audio/mp4a-latm";
                    list = singletonList;
                    str3 = str;
                    i11 = -1;
                    i12 = -1;
                    int i1522222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track22222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track22222222222222;
                    track22222222222222.format(createImageSampleFormat);
                    return;
                case 14:
                    str2 = "audio/ac3";
                    str3 = str2;
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i15222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track222222222222222;
                    track222222222222222.format(createImageSampleFormat);
                    return;
                case 15:
                case 20:
                    str2 = "audio/vnd.dts";
                    str3 = str2;
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i152222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track2222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track2222222222222222;
                    track2222222222222222.format(createImageSampleFormat);
                    return;
                case 16:
                    str2 = "video/x-vnd.on2.vp8";
                    str3 = str2;
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i1522222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track22222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track22222222222222222;
                    track22222222222222222.format(createImageSampleFormat);
                    return;
                case 17:
                    str2 = "video/x-vnd.on2.vp9";
                    str3 = str2;
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i15222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track222222222222222222;
                    track222222222222222222.format(createImageSampleFormat);
                    return;
                case 18:
                    str2 = "application/pgs";
                    str3 = str2;
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i152222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track2222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track2222222222222222222;
                    track2222222222222222222.format(createImageSampleFormat);
                    return;
                case 19:
                    str3 = "video/x-unknown";
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i1522222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track22222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track22222222222222222222;
                    track22222222222222222222.format(createImageSampleFormat);
                    return;
                case 21:
                    pcmEncoding = u.getPcmEncoding(this.H);
                    if (pcmEncoding == 0) {
                        Log.w("MatroskaExtractor", "Unsupported PCM bit depth: " + this.H + ". Setting mimeType to audio/x-unknown");
                        str3 = "audio/x-unknown";
                        list = null;
                        i11 = -1;
                        i12 = -1;
                        int i15222222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                        if (!y4.i.isAudio(str3)) {
                        }
                        m track222222222222222222222 = gVar.track(this.f18615b, i14);
                        this.O = track222222222222222222222;
                        track222222222222222222222.format(createImageSampleFormat);
                        return;
                    }
                    i11 = pcmEncoding;
                    str3 = "audio/raw";
                    list = null;
                    i12 = -1;
                    int i152222222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track2222222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track2222222222222222222222;
                    track2222222222222222222222.format(createImageSampleFormat);
                    return;
                case 22:
                    str3 = "text/x-ssa";
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i1522222222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track22222222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track22222222222222222222222;
                    track22222222222222222222222.format(createImageSampleFormat);
                    return;
                case 23:
                    z4.d parse2 = z4.d.parse(new y4.l(this.f18621h));
                    list2 = parse2.f20801a;
                    this.P = parse2.f20802b;
                    str = MimeTypes.VIDEO_H265;
                    list = list2;
                    str3 = str;
                    i11 = -1;
                    i12 = -1;
                    int i15222222222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track222222222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track222222222222222222222222;
                    track222222222222222222222222.format(createImageSampleFormat);
                    return;
                case 24:
                    str3 = "application/x-subrip";
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i152222222222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track2222222222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track2222222222222222222222222;
                    track2222222222222222222222222.format(createImageSampleFormat);
                    return;
                case 25:
                    str2 = "video/mpeg2";
                    str3 = str2;
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i1522222222222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track22222222222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track22222222222222222222222222;
                    track22222222222222222222222222.format(createImageSampleFormat);
                    return;
                case 26:
                    str2 = "audio/eac3";
                    str3 = str2;
                    list = null;
                    i11 = -1;
                    i12 = -1;
                    int i15222222222222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track222222222222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track222222222222222222222222222;
                    track222222222222222222222222222.format(createImageSampleFormat);
                    return;
                case 27:
                    singletonList = Collections.singletonList(this.f18621h);
                    str = "audio/flac";
                    list = singletonList;
                    str3 = str;
                    i11 = -1;
                    i12 = -1;
                    int i152222222222222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track2222222222222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track2222222222222222222222222222;
                    track2222222222222222222222222222.format(createImageSampleFormat);
                    return;
                case 28:
                    ArrayList arrayList3 = new ArrayList(3);
                    arrayList3.add(this.f18621h);
                    arrayList3.add(ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(this.J).array());
                    arrayList3.add(ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(this.K).array());
                    list = arrayList3;
                    str3 = "audio/opus";
                    i11 = -1;
                    i12 = 5760;
                    int i1522222222222222222222222222222 = (this.M ? 1 : 0) | 0 | (!this.L ? 2 : 0);
                    if (!y4.i.isAudio(str3)) {
                    }
                    m track22222222222222222222222222222 = gVar.track(this.f18615b, i14);
                    this.O = track22222222222222222222222222222;
                    track22222222222222222222222222222.format(createImageSampleFormat);
                    return;
                default:
                    throw new ParserException("Unrecognized codec identifier.");
            }
        }
    }

    public d(int i10) {
        v3.a aVar = new v3.a();
        this.f18602p = -1L;
        this.f18603q = -9223372036854775807L;
        this.f18604r = -9223372036854775807L;
        this.f18605s = -9223372036854775807L;
        this.f18611y = -1L;
        this.f18612z = -1L;
        this.A = -9223372036854775807L;
        this.f18587a = aVar;
        aVar.init(new a());
        this.f18590d = (i10 & 1) == 0;
        this.f18588b = new f();
        this.f18589c = new SparseArray<>();
        this.f18593g = new y4.l(4);
        this.f18594h = new y4.l(ByteBuffer.allocate(4).putInt(-1).array());
        this.f18595i = new y4.l(4);
        this.f18591e = new y4.l(j.f20496a);
        this.f18592f = new y4.l(4);
        this.f18596j = new y4.l();
        this.f18597k = new y4.l();
        this.f18598l = new y4.l(8);
        this.f18599m = new y4.l();
    }

    public final void a(b bVar, long j10) {
        if ("S_TEXT/UTF8".equals(bVar.f18614a)) {
            b(bVar, "%02d:%02d:%02d,%03d", 19, 1000L, f18581a0);
        } else if ("S_TEXT/ASS".equals(bVar.f18614a)) {
            b(bVar, "%01d:%02d:%02d:%02d", 21, f18584d0, f18585e0);
        }
        bVar.O.sampleMetadata(j10, this.M, this.V, 0, bVar.f18620g);
        this.W = true;
        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.f18596j.reset();
    }

    public final void b(b bVar, String str, int i10, long j10, byte[] bArr) {
        byte[] utf8Bytes;
        byte[] bArr2;
        y4.l lVar = this.f18597k;
        byte[] bArr3 = lVar.f20517a;
        long j11 = this.G;
        if (j11 == -9223372036854775807L) {
            utf8Bytes = bArr;
            bArr2 = utf8Bytes;
        } else {
            int i11 = (int) (j11 / 3600000000L);
            long j12 = j11 - ((i11 * 3600) * 1000000);
            int i12 = (int) (j12 / 60000000);
            long j13 = j12 - ((i12 * 60) * 1000000);
            int i13 = (int) (j13 / 1000000);
            utf8Bytes = u.getUtf8Bytes(String.format(Locale.US, str, Integer.valueOf(i11), Integer.valueOf(i12), Integer.valueOf(i13), Integer.valueOf((int) ((j13 - (i13 * 1000000)) / j10))));
            bArr2 = bArr;
        }
        System.arraycopy(utf8Bytes, 0, bArr3, i10, bArr2.length);
        bVar.O.sampleData(lVar, lVar.limit());
        this.V = lVar.limit() + this.V;
    }

    public final void c(t3.f fVar, int i10) throws IOException, InterruptedException {
        y4.l lVar = this.f18593g;
        if (lVar.limit() >= i10) {
            return;
        }
        if (lVar.capacity() < i10) {
            byte[] bArr = lVar.f20517a;
            lVar.reset(Arrays.copyOf(bArr, Math.max(bArr.length * 2, i10)), lVar.limit());
        }
        ((t3.b) fVar).readFully(lVar.f20517a, lVar.limit(), i10 - lVar.limit());
        lVar.setLimit(i10);
    }

    public final int d(t3.f fVar, m mVar, int i10) throws IOException, InterruptedException {
        int sampleData;
        y4.l lVar = this.f18596j;
        int bytesLeft = lVar.bytesLeft();
        if (bytesLeft > 0) {
            sampleData = Math.min(i10, bytesLeft);
            mVar.sampleData(lVar, sampleData);
        } else {
            sampleData = mVar.sampleData(fVar, i10, false);
        }
        this.N += sampleData;
        this.V += sampleData;
        return sampleData;
    }

    public final long e(long j10) throws ParserException {
        long j11 = this.f18603q;
        if (j11 != -9223372036854775807L) {
            return u.scaleLargeTimestamp(j10, j11, 1000L);
        }
        throw new ParserException("Can't scale timecode prior to timecodeScale being set.");
    }

    public final void f(t3.f fVar, b bVar, int i10) throws IOException, InterruptedException {
        int i11;
        if ("S_TEXT/UTF8".equals(bVar.f18614a)) {
            g(fVar, Z, i10);
            return;
        }
        if ("S_TEXT/ASS".equals(bVar.f18614a)) {
            g(fVar, f18583c0, i10);
            return;
        }
        m mVar = bVar.O;
        boolean z10 = this.O;
        y4.l lVar = this.f18596j;
        if (!z10) {
            if (bVar.f18618e) {
                this.M &= -1073741825;
                boolean z11 = this.P;
                y4.l lVar2 = this.f18593g;
                if (!z11) {
                    ((t3.b) fVar).readFully(lVar2.f20517a, 0, 1);
                    this.N++;
                    byte b5 = lVar2.f20517a[0];
                    if ((b5 & 128) == 128) {
                        throw new ParserException("Extension bit is set in signal byte");
                    }
                    this.S = b5;
                    this.P = true;
                }
                byte b10 = this.S;
                if ((b10 & 1) == 1) {
                    boolean z12 = (b10 & 2) == 2;
                    this.M |= 1073741824;
                    if (!this.Q) {
                        y4.l lVar3 = this.f18598l;
                        ((t3.b) fVar).readFully(lVar3.f20517a, 0, 8);
                        this.N += 8;
                        this.Q = true;
                        lVar2.f20517a[0] = (byte) ((z12 ? 128 : 0) | 8);
                        lVar2.setPosition(0);
                        mVar.sampleData(lVar2, 1);
                        this.V++;
                        lVar3.setPosition(0);
                        mVar.sampleData(lVar3, 8);
                        this.V += 8;
                    }
                    if (z12) {
                        if (!this.R) {
                            ((t3.b) fVar).readFully(lVar2.f20517a, 0, 1);
                            this.N++;
                            lVar2.setPosition(0);
                            this.T = lVar2.readUnsignedByte();
                            this.R = true;
                        }
                        int i12 = this.T * 4;
                        lVar2.reset(i12);
                        ((t3.b) fVar).readFully(lVar2.f20517a, 0, i12);
                        this.N += i12;
                        short s10 = (short) ((this.T / 2) + 1);
                        int i13 = (s10 * 6) + 2;
                        ByteBuffer byteBuffer = this.f18600n;
                        if (byteBuffer == null || byteBuffer.capacity() < i13) {
                            this.f18600n = ByteBuffer.allocate(i13);
                        }
                        this.f18600n.position(0);
                        this.f18600n.putShort(s10);
                        int i14 = 0;
                        int i15 = 0;
                        while (true) {
                            i11 = this.T;
                            if (i14 >= i11) {
                                break;
                            }
                            int readUnsignedIntToInt = lVar2.readUnsignedIntToInt();
                            if (i14 % 2 == 0) {
                                this.f18600n.putShort((short) (readUnsignedIntToInt - i15));
                            } else {
                                this.f18600n.putInt(readUnsignedIntToInt - i15);
                            }
                            i14++;
                            i15 = readUnsignedIntToInt;
                        }
                        int i16 = (i10 - this.N) - i15;
                        if (i11 % 2 == 1) {
                            this.f18600n.putInt(i16);
                        } else {
                            this.f18600n.putShort((short) i16);
                            this.f18600n.putInt(0);
                        }
                        byte[] array = this.f18600n.array();
                        y4.l lVar4 = this.f18599m;
                        lVar4.reset(array, i13);
                        mVar.sampleData(lVar4, i13);
                        this.V += i13;
                    }
                }
            } else {
                byte[] bArr = bVar.f18619f;
                if (bArr != null) {
                    lVar.reset(bArr, bArr.length);
                }
            }
            this.O = true;
        }
        int limit = lVar.limit() + i10;
        if (!"V_MPEG4/ISO/AVC".equals(bVar.f18614a) && !"V_MPEGH/ISO/HEVC".equals(bVar.f18614a)) {
            while (true) {
                int i17 = this.N;
                if (i17 >= limit) {
                    break;
                } else {
                    d(fVar, mVar, limit - i17);
                }
            }
        } else {
            y4.l lVar5 = this.f18592f;
            byte[] bArr2 = lVar5.f20517a;
            bArr2[0] = 0;
            bArr2[1] = 0;
            bArr2[2] = 0;
            int i18 = bVar.P;
            int i19 = 4 - i18;
            while (this.N < limit) {
                int i20 = this.U;
                if (i20 == 0) {
                    int min = Math.min(i18, lVar.bytesLeft());
                    ((t3.b) fVar).readFully(bArr2, i19 + min, i18 - min);
                    if (min > 0) {
                        lVar.readBytes(bArr2, i19, min);
                    }
                    this.N += i18;
                    lVar5.setPosition(0);
                    this.U = lVar5.readUnsignedIntToInt();
                    y4.l lVar6 = this.f18591e;
                    lVar6.setPosition(0);
                    mVar.sampleData(lVar6, 4);
                    this.V += 4;
                } else {
                    this.U = i20 - d(fVar, mVar, i20);
                }
            }
        }
        if ("A_VORBIS".equals(bVar.f18614a)) {
            y4.l lVar7 = this.f18594h;
            lVar7.setPosition(0);
            mVar.sampleData(lVar7, 4);
            this.V += 4;
        }
    }

    public final void g(t3.f fVar, byte[] bArr, int i10) throws IOException, InterruptedException {
        int length = bArr.length + i10;
        y4.l lVar = this.f18597k;
        if (lVar.capacity() < length) {
            lVar.f20517a = Arrays.copyOf(bArr, length + i10);
        } else {
            System.arraycopy(bArr, 0, lVar.f20517a, 0, bArr.length);
        }
        ((t3.b) fVar).readFully(lVar.f20517a, bArr.length, i10);
        lVar.reset(length);
    }

    @Override
    public void init(t3.g gVar) {
        this.Y = gVar;
    }

    @Override
    public int read(t3.f fVar, k kVar) throws IOException, InterruptedException {
        boolean z10;
        this.W = false;
        boolean z11 = true;
        while (z11 && !this.W) {
            z11 = ((v3.a) this.f18587a).read(fVar);
            if (z11) {
                long position = ((t3.b) fVar).getPosition();
                if (this.f18610x) {
                    this.f18612z = position;
                    kVar.f18240a = this.f18611y;
                    this.f18610x = false;
                } else {
                    if (this.f18607u) {
                        long j10 = this.f18612z;
                        if (j10 != -1) {
                            kVar.f18240a = j10;
                            this.f18612z = -1L;
                        }
                    }
                    z10 = false;
                    if (!z10) {
                        return 1;
                    }
                }
                z10 = true;
                if (!z10) {
                }
            }
        }
        return z11 ? 0 : -1;
    }

    @Override
    public void release() {
    }

    @Override
    public void seek(long j10, long j11) {
        this.A = -9223372036854775807L;
        this.E = 0;
        ((v3.a) this.f18587a).reset();
        this.f18588b.reset();
        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.f18596j.reset();
    }

    @Override
    public boolean sniff(t3.f fVar) throws IOException, InterruptedException {
        return new e().sniff(fVar);
    }
}