package com.applovin.impl; import com.applovin.exoplayer2.common.base.Splitter; import com.applovin.impl.jk; import java.util.ArrayList; import java.util.List; /* loaded from: classes.dex */ final class mj { private static final Splitter d = Splitter.on(':'); private static final Splitter e = Splitter.on('*'); private final List a = new ArrayList(); private int b = 0; private int c; private void a(l8 l8Var, th thVar) { bh bhVar = new bh(8); l8Var.d(bhVar.c(), 0, 8); this.c = bhVar.m() + 8; if (bhVar.j() != 1397048916) { thVar.a = 0L; } else { thVar.a = l8Var.f() - (this.c - 12); this.b = 2; } } private void b(l8 l8Var, th thVar) { long a2 = l8Var.a(); int i = this.c - 20; bh bhVar = new bh(i); l8Var.d(bhVar.c(), 0, i); for (int i2 = 0; i2 < i / 12; i2++) { bhVar.g(2); short o = bhVar.o(); if (o != 2192 && o != 2816 && o != 2817 && o != 2819 && o != 2820) { bhVar.g(8); } else { this.a.add(new a(o, (a2 - this.c) - bhVar.m(), bhVar.m())); } } if (this.a.isEmpty()) { thVar.a = 0L; } else { this.b = 3; thVar.a = ((a) this.a.get(0)).b; } } public static final class a { public final int a; public final long b; public final int c; public a(int i, long j, int i2) { this.a = i; this.b = j; this.c = i2; } } private static int a(String str) { str.hashCode(); switch (str) { case "SlowMotion_Data": return 2192; case "Super_SlowMotion_Edit_Data": return 2819; case "Super_SlowMotion_Data": return 2816; case "Super_SlowMotion_Deflickering_On": return 2820; case "Super_SlowMotion_BGM": return 2817; default: throw dh.a("Invalid SEF name", null); } } public int a(l8 l8Var, th thVar, List list) { int i = this.b; long j = 0; if (i == 0) { long a2 = l8Var.a(); if (a2 != -1 && a2 >= 8) { j = a2 - 8; } thVar.a = j; this.b = 1; } else if (i == 1) { a(l8Var, thVar); } else if (i == 2) { b(l8Var, thVar); } else { if (i != 3) { throw new IllegalStateException(); } a(l8Var, list); thVar.a = 0L; } return 1; } private void a(l8 l8Var, List list) { long f = l8Var.f(); int a2 = (int) ((l8Var.a() - l8Var.f()) - this.c); bh bhVar = new bh(a2); l8Var.d(bhVar.c(), 0, a2); for (int i = 0; i < this.a.size(); i++) { a aVar = (a) this.a.get(i); bhVar.f((int) (aVar.b - f)); bhVar.g(4); int m = bhVar.m(); int a3 = a(bhVar.c(m)); int i2 = aVar.c - (m + 8); if (a3 == 2192) { list.add(a(bhVar, i2)); } else if (a3 != 2816 && a3 != 2817 && a3 != 2819 && a3 != 2820) { throw new IllegalStateException(); } } } private static jk a(bh bhVar, int i) { ArrayList arrayList = new ArrayList(); List splitToList = e.splitToList(bhVar.c(i)); for (int i2 = 0; i2 < splitToList.size(); i2++) { List splitToList2 = d.splitToList(splitToList.get(i2)); if (splitToList2.size() == 3) { try { arrayList.add(new jk.b(Long.parseLong(splitToList2.get(0)), Long.parseLong(splitToList2.get(1)), 1 << (Integer.parseInt(splitToList2.get(2)) - 1))); } catch (NumberFormatException e2) { throw dh.a(null, e2); } } else { throw dh.a(null, null); } } return new jk(arrayList); } public void a() { this.a.clear(); this.b = 0; } }