discord-jadx/app/src/main/java/c/i/a/c/a2/d0/d.java

145 lines
4.6 KiB
Java

package c.i.a.c.a2.d0;
import androidx.annotation.Nullable;
import c.i.a.c.a2.g;
import c.i.a.c.i2.w;
import com.google.android.exoplayer2.extractor.flv.TagPayloadReader;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* compiled from: ScriptTagPayloadReader */
public final class d extends TagPayloadReader {
public long b = -9223372036854775807L;
/* renamed from: c reason: collision with root package name */
public long[] f649c = new long[0];
public long[] d = new long[0];
public d() {
super(new g());
}
@Nullable
public static Object d(w wVar, int i) {
if (i == 0) {
return Double.valueOf(Double.longBitsToDouble(wVar.m()));
}
boolean z2 = false;
if (i == 1) {
if (wVar.s() == 1) {
z2 = true;
}
return Boolean.valueOf(z2);
} else if (i == 2) {
return f(wVar);
} else {
if (i == 3) {
HashMap hashMap = new HashMap();
while (true) {
String f = f(wVar);
int s2 = wVar.s();
if (s2 == 9) {
return hashMap;
}
Object d = d(wVar, s2);
if (d != null) {
hashMap.put(f, d);
}
}
} else if (i == 8) {
return e(wVar);
} else {
if (i == 10) {
int v = wVar.v();
ArrayList arrayList = new ArrayList(v);
for (int i2 = 0; i2 < v; i2++) {
Object d2 = d(wVar, wVar.s());
if (d2 != null) {
arrayList.add(d2);
}
}
return arrayList;
} else if (i != 11) {
return null;
} else {
Date date = new Date((long) Double.valueOf(Double.longBitsToDouble(wVar.m())).doubleValue());
wVar.E(2);
return date;
}
}
}
}
public static HashMap<String, Object> e(w wVar) {
int v = wVar.v();
HashMap<String, Object> hashMap = new HashMap<>(v);
for (int i = 0; i < v; i++) {
String f = f(wVar);
Object d = d(wVar, wVar.s());
if (d != null) {
hashMap.put(f, d);
}
}
return hashMap;
}
public static String f(w wVar) {
int x2 = wVar.x();
int i = wVar.b;
wVar.E(x2);
return new String(wVar.a, i, x2);
}
@Override // com.google.android.exoplayer2.extractor.flv.TagPayloadReader
public boolean b(w wVar) {
return true;
}
@Override // com.google.android.exoplayer2.extractor.flv.TagPayloadReader
public boolean c(w wVar, long j) {
if (wVar.s() != 2 || !"onMetaData".equals(f(wVar)) || wVar.s() != 8) {
return false;
}
HashMap<String, Object> e = e(wVar);
Object obj = e.get("duration");
if (obj instanceof Double) {
double doubleValue = ((Double) obj).doubleValue();
if (doubleValue > 0.0d) {
this.b = (long) (doubleValue * 1000000.0d);
}
}
Object obj2 = e.get("keyframes");
if (obj2 instanceof Map) {
Map map = (Map) obj2;
Object obj3 = map.get("filepositions");
Object obj4 = map.get("times");
if ((obj3 instanceof List) && (obj4 instanceof List)) {
List list = (List) obj3;
List list2 = (List) obj4;
int size = list2.size();
this.f649c = new long[size];
this.d = new long[size];
int i = 0;
while (true) {
if (i >= size) {
break;
}
Object obj5 = list.get(i);
Object obj6 = list2.get(i);
if (!(obj6 instanceof Double) || !(obj5 instanceof Double)) {
break;
}
this.f649c[i] = (long) (((Double) obj6).doubleValue() * 1000000.0d);
this.d[i] = ((Double) obj5).longValue();
i++;
}
this.f649c = new long[0];
this.d = new long[0];
}
}
return false;
}
}