package com.tencent.liteav.txcvodplayer.b; import android.os.Handler; import android.text.TextUtils; import com.huawei.hms.framework.common.ContainerUtils; import com.meizu.cloud.pushsdk.constants.PushConstants; import com.tencent.imsdk.v2.V2TIMOfflinePushInfo; import com.tencent.liteav.base.ThreadUtils; import com.tencent.liteav.base.util.LiteavLog; import com.tencent.liteav.txcvodplayer.b.a; import com.tencent.liteav.txcvodplayer.hlsencoder.TXCHLSEncoder; import com.tencent.rtmp.TXPlayInfoParams; import java.util.ArrayList; import org.json.JSONException; import org.json.JSONObject; public final class c { /* renamed from: a reason: collision with root package name */ TXPlayInfoParams f9060a; /* renamed from: b reason: collision with root package name */ public b f9061b; /* renamed from: c reason: collision with root package name */ public f f9062c; /* renamed from: d reason: collision with root package name */ public String f9063d; /* renamed from: e reason: collision with root package name */ public String f9064e; /* renamed from: f reason: collision with root package name */ private final String f9065f = "https://playvideo.qcloud.com/getplayinfo/v4"; /* renamed from: g reason: collision with root package name */ private Handler f9066g; /* renamed from: h reason: collision with root package name */ private String f9067h; public interface a { void a(int i10, String str); void a(c cVar, TXPlayInfoParams tXPlayInfoParams); } public static class b { /* renamed from: a reason: collision with root package name */ public ArrayList<String> f9079a; /* renamed from: b reason: collision with root package name */ public String f9080b; } /* renamed from: com.tencent.liteav.txcvodplayer.b.c$c reason: collision with other inner class name */ public static class C0141c { /* renamed from: a reason: collision with root package name */ public String f9081a; /* renamed from: b reason: collision with root package name */ public float f9082b; public final String toString() { return "TCPlayKeyFrameDescInfo{content='" + this.f9081a + '\'' + ", time=" + this.f9082b + '}'; } } public static class d { /* renamed from: a reason: collision with root package name */ public String f9083a; /* renamed from: b reason: collision with root package name */ public int f9084b; /* renamed from: c reason: collision with root package name */ public int f9085c; /* renamed from: d reason: collision with root package name */ public String f9086d; } public c(TXPlayInfoParams tXPlayInfoParams) { this.f9060a = tXPlayInfoParams; this.f9066g = ThreadUtils.getUiThreadHandler(); } public final String a() { b bVar = this.f9061b; if (bVar != null) { String a10 = bVar.a("SimpleAES"); return !TextUtils.isEmpty(a10) ? a10 : this.f9061b.a("plain"); } f fVar = this.f9062c; if (fVar != null) { return fVar.a(); } return null; } public final void a(final a aVar) { if (this.f9060a != null) { com.tencent.liteav.txcplayer.common.a.a().execute(new Runnable() { /* class com.tencent.liteav.txcvodplayer.b.c.AnonymousClass1 */ /* JADX WARNING: Removed duplicated region for block: B:24:0x00fe */ /* JADX WARNING: Removed duplicated region for block: B:29:0x010e */ /* JADX WARNING: Removed duplicated region for block: B:33:0x0157 */ /* JADX WARNING: Removed duplicated region for block: B:39:0x0168 */ /* JADX WARNING: Removed duplicated region for block: B:42:0x0190 */ /* JADX WARNING: Removed duplicated region for block: B:45:0x01aa */ public final void run() { String str; String str2; String str3; String[] split; c cVar = c.this; String format = String.format("%s/%d/%s", "https://playvideo.qcloud.com/getplayinfo/v4", Integer.valueOf(cVar.f9060a.getAppId()), cVar.f9060a.getFileId()); String str4 = null; if (cVar.f9060a.getPSign() != null) { String pSign = cVar.f9060a.getPSign(); StringBuilder sb2 = new StringBuilder(); if (!TextUtils.isEmpty(null)) { sb2.append("pcfg=" + ((String) null) + ContainerUtils.FIELD_DELIMITER); } if (!TextUtils.isEmpty(pSign)) { sb2.append("psign=" + pSign + ContainerUtils.FIELD_DELIMITER); } com.tencent.liteav.txcvodplayer.c.a a10 = com.tencent.liteav.txcvodplayer.c.a.a(); int appId = cVar.f9060a.getAppId(); String fileId = cVar.f9060a.getFileId(); if (TextUtils.isEmpty(fileId)) { LiteavLog.w("PlayInfoProtocolV4Storage", "get fileId is empty"); } else { String a11 = com.tencent.liteav.txcvodplayer.c.a.a(appId, fileId); String string = a10.f9121b.getString(a11); if (TextUtils.isEmpty(string)) { string = a10.f9120a.getString(a11); } if (!TextUtils.isEmpty(string) && (split = string.split("_")) != null && split.length >= 2) { String a12 = TXCHLSEncoder.a(appId, V2TIMOfflinePushInfo.IOS_OFFLINE_PUSH_DEFAULT_SOUND, fileId, 0); String b10 = TXCHLSEncoder.b(a12, split[0]); String b11 = TXCHLSEncoder.b(a12, split[1]); LiteavLog.i("PlayInfoProtocolV4Storage", "get key: " + b10 + " iv: " + b11); str = b10 + "_" + b11; if (TextUtils.isEmpty(str)) { String[] split2 = str.split("_"); if (split2 != null && split2.length == 2) { cVar.f9063d = split2[0]; str3 = split2[1]; } LiteavLog.i("TXCPlayInfoProtocolV4", "V4 protocol send request fileId : " + cVar.f9060a.getFileId() + " | overlayKey: " + cVar.f9063d + " | overlayIv: " + cVar.f9064e); String a13 = TXCHLSEncoder.a(cVar.f9063d); String a14 = TXCHLSEncoder.a(cVar.f9064e); str2 = (!TextUtils.isEmpty(a13) || TextUtils.isEmpty(a14)) ? "" : PushConstants.PUSH_TYPE_THROUGH_MESSAGE; if (!TextUtils.isEmpty(str2)) { sb2.append("cipheredOverlayKey="); sb2.append(a13); sb2.append(ContainerUtils.FIELD_DELIMITER); sb2.append("cipheredOverlayIv="); sb2.append(a14); sb2.append(ContainerUtils.FIELD_DELIMITER); sb2.append("keyId="); sb2.append(str2); sb2.append(ContainerUtils.FIELD_DELIMITER); } if (!TextUtils.isEmpty(null)) { sb2.append("context=" + ((String) null) + ContainerUtils.FIELD_DELIMITER); } if (sb2.length() > 1) { sb2.deleteCharAt(sb2.length() - 1); } str4 = sb2.toString(); } else { cVar.f9063d = TXCHLSEncoder.a(); str3 = TXCHLSEncoder.a(); } cVar.f9064e = str3; LiteavLog.i("TXCPlayInfoProtocolV4", "V4 protocol send request fileId : " + cVar.f9060a.getFileId() + " | overlayKey: " + cVar.f9063d + " | overlayIv: " + cVar.f9064e); String a132 = TXCHLSEncoder.a(cVar.f9063d); String a142 = TXCHLSEncoder.a(cVar.f9064e); if (!TextUtils.isEmpty(a132)) { } if (!TextUtils.isEmpty(str2)) { } if (!TextUtils.isEmpty(null)) { } if (sb2.length() > 1) { } str4 = sb2.toString(); } } str = null; if (TextUtils.isEmpty(str)) { } cVar.f9064e = str3; LiteavLog.i("TXCPlayInfoProtocolV4", "V4 protocol send request fileId : " + cVar.f9060a.getFileId() + " | overlayKey: " + cVar.f9063d + " | overlayIv: " + cVar.f9064e); String a1322 = TXCHLSEncoder.a(cVar.f9063d); String a1422 = TXCHLSEncoder.a(cVar.f9064e); if (!TextUtils.isEmpty(a1322)) { } if (!TextUtils.isEmpty(str2)) { } if (!TextUtils.isEmpty(null)) { } if (sb2.length() > 1) { } str4 = sb2.toString(); } if (!TextUtils.isEmpty(str4)) { format = format + "?" + str4; } LiteavLog.d("TXCPlayInfoProtocolV4", "request url: ".concat(String.valueOf(format))); a.C0140a.f9043a.a(format, new a.b() { /* class com.tencent.liteav.txcvodplayer.b.c.AnonymousClass1.AnonymousClass1 */ @Override // com.tencent.liteav.txcvodplayer.b.a.b public final void a() { c.this.a(new Runnable() { /* class com.tencent.liteav.txcvodplayer.b.c.AnonymousClass1.AnonymousClass1.AnonymousClass2 */ public final void run() { a aVar = aVar; if (aVar != null) { aVar.a(-1, "http request error."); } } }); } @Override // com.tencent.liteav.txcvodplayer.b.a.b public final void a(String str) { AnonymousClass1 r02 = AnonymousClass1.this; if (c.this.a(str, aVar)) { c.this.a(new Runnable() { /* class com.tencent.liteav.txcvodplayer.b.c.AnonymousClass1.AnonymousClass1.AnonymousClass1 */ public final void run() { AnonymousClass1 r02 = AnonymousClass1.this; a aVar = aVar; c cVar = c.this; aVar.a(cVar, cVar.f9060a); } }); } } }); } }); } } /* access modifiers changed from: package-private */ public final void a(Runnable runnable) { if (ThreadUtils.runningOnUiThread()) { runnable.run(); } else { this.f9066g.post(runnable); } } /* access modifiers changed from: package-private */ public final boolean a(String str, final a aVar) { if (TextUtils.isEmpty(str)) { LiteavLog.e("TXCPlayInfoProtocolV4", "parseJson err, content is empty!"); a(new Runnable() { /* class com.tencent.liteav.txcvodplayer.b.c.AnonymousClass2 */ public final void run() { aVar.a(-1, "request return error!"); } }); return false; } try { JSONObject jSONObject = new JSONObject(str); final int i10 = jSONObject.getInt(PushConstants.BASIC_PUSH_STATUS_CODE); final String optString = jSONObject.optString("message"); String optString2 = jSONObject.optString("warning"); this.f9067h = jSONObject.optString("context"); LiteavLog.i("TXCPlayInfoProtocolV4", "context : " + this.f9067h); LiteavLog.i("TXCPlayInfoProtocolV4", "message: ".concat(String.valueOf(optString))); LiteavLog.i("TXCPlayInfoProtocolV4", "warning: ".concat(String.valueOf(optString2))); if (i10 == 0) { int i11 = jSONObject.getInt("version"); LiteavLog.i("TXCPlayInfoProtocolV4", "version: ".concat(String.valueOf(i11))); if (i11 == 2) { this.f9063d = null; this.f9064e = null; this.f9062c = new f(jSONObject); return true; } else if (i11 != 4) { return true; } else { this.f9061b = new b(jSONObject); return true; } } else { a(new Runnable() { /* class com.tencent.liteav.txcvodplayer.b.c.AnonymousClass3 */ public final void run() { aVar.a(i10, optString); } }); return false; } } catch (JSONException e10) { e10.printStackTrace(); LiteavLog.e("TXCPlayInfoProtocolV4", "parseJson err"); return true; } } public final String b() { b bVar = this.f9061b; if (bVar != null) { return bVar.a(); } return null; } public final int c() { b bVar = this.f9061b; if (bVar != null) { return bVar.f9047d; } f fVar = this.f9062c; if (fVar != null) { return fVar.b(); } return -1; } public final String d() { b bVar = this.f9061b; return bVar != null ? bVar.f9050g : ""; } }