Initial commit
This commit is contained in:
16
sources/com/baidu/cloud/media/download/DownloadObserver.java
Normal file
16
sources/com/baidu/cloud/media/download/DownloadObserver.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.baidu.cloud.media.download;
|
||||
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class DownloadObserver implements Observer {
|
||||
public abstract void update(DownloadableVideoItem downloadableVideoItem);
|
||||
|
||||
@Override // java.util.Observer
|
||||
public void update(Observable observable, Object obj) {
|
||||
if (observable instanceof DownloadableVideoItem) {
|
||||
update((DownloadableVideoItem) observable);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,108 @@
|
||||
package com.baidu.cloud.media.download;
|
||||
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import java.util.Observable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class DownloadableVideoItem extends Observable {
|
||||
public static final int ERROR_CODE_INVALID_URL = 1;
|
||||
public static final int ERROR_CODE_M3U8_DRM_INVALID = 6;
|
||||
public static final int ERROR_CODE_M3U8_INVALID_FORMAT = 4;
|
||||
public static final int ERROR_CODE_M3U8_SAVE_FAILED = 5;
|
||||
public static final int ERROR_CODE_NETWORK_FAILED = 2;
|
||||
public static final int ERROR_CODE_NO_ERROR = 0;
|
||||
public static final int ERROR_CODE_SDCARD_UNMOUNTED = 3;
|
||||
public static final int ERROR_CODE_TS_SAVE_FAILED = 7;
|
||||
public static final String[] a = {"ERROR_CODE_NO_ERROR", "ERROR_CODE_INVALID_URL", "ERROR_CODE_NETWORK_FAILED", "ERROR_CODE_SDCARD_UNMOUNTED", "ERROR_CODE_M3U8_INVALID_FORMAT", "ERROR_CODE_M3U8_SAVE_FAILED", "ERROR_CODE_M3U8_DRM_INVALID", "ERROR_CODE_TS_SAVE_FAILED"};
|
||||
protected String b;
|
||||
protected String c;
|
||||
protected String d;
|
||||
protected volatile int e;
|
||||
protected volatile int f;
|
||||
protected volatile int g;
|
||||
protected volatile DownloadStatus h = DownloadStatus.NONE;
|
||||
protected String i;
|
||||
protected volatile int j;
|
||||
|
||||
public enum DownloadStatus {
|
||||
NONE(0, "first add"),
|
||||
DOWNLOADING(1, "downloading videos"),
|
||||
PAUSED(2, "paused"),
|
||||
COMPLETED(3, Course.STATUS_COMPLETED),
|
||||
ERROR(4, "failed to download"),
|
||||
DELETED(5, "delete manually"),
|
||||
PENDING(6, "pending, will start automatically(blocked by Parallel Strategy)");
|
||||
|
||||
private int code;
|
||||
private String msg;
|
||||
|
||||
DownloadStatus(int i, String str) {
|
||||
this.code = i;
|
||||
this.msg = str;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return this.msg;
|
||||
}
|
||||
}
|
||||
|
||||
public int getErrorCode() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public String getFailReason() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public String getLocalAbsolutePath() {
|
||||
String str = this.d;
|
||||
if (str == null || str.equals("")) {
|
||||
return this.c;
|
||||
}
|
||||
String str2 = this.c;
|
||||
if (str2 == null || str2.equals("")) {
|
||||
return null;
|
||||
}
|
||||
return this.c + "/" + this.d;
|
||||
}
|
||||
|
||||
public float getProgress() {
|
||||
return this.e / 100.0f;
|
||||
}
|
||||
|
||||
public String getSpeed() {
|
||||
StringBuilder sb;
|
||||
String str;
|
||||
if (this.h != DownloadStatus.DOWNLOADING) {
|
||||
return "0KB/s";
|
||||
}
|
||||
if (this.f < 1024) {
|
||||
sb = new StringBuilder();
|
||||
sb.append(this.f);
|
||||
str = "KB/s";
|
||||
} else {
|
||||
sb = new StringBuilder();
|
||||
sb.append(this.f / DataDecryptTool.DECRYPT_SP_FILE);
|
||||
str = "MB/s";
|
||||
}
|
||||
sb.append(str);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public DownloadStatus getStatus() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public int getTotalSize() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
47
sources/com/baidu/cloud/media/download/LocalHlsSec.java
Normal file
47
sources/com/baidu/cloud/media/download/LocalHlsSec.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package com.baidu.cloud.media.download;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LocalHlsSec {
|
||||
static {
|
||||
System.loadLibrary("hls-download");
|
||||
}
|
||||
|
||||
public static String bytes2HexStr(byte[] bArr) {
|
||||
if (bArr == null || bArr.length == 0) {
|
||||
return null;
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < bArr.length; i++) {
|
||||
if ((bArr[i] & 255) < 16) {
|
||||
stringBuffer.append("0");
|
||||
}
|
||||
stringBuffer.append(Long.toHexString(bArr[i] & 255));
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static String decryptStr(Context context, String str) {
|
||||
return bytes2HexStr(new LocalHlsSec().crypt(context, hexStr2Bytes(str), 1));
|
||||
}
|
||||
|
||||
public static byte[] hexStr2Bytes(String str) {
|
||||
if (str.length() < 1) {
|
||||
return null;
|
||||
}
|
||||
byte[] bArr = new byte[str.length() / 2];
|
||||
for (int i = 0; i < str.length() / 2; i++) {
|
||||
int i2 = i * 2;
|
||||
int i3 = i2 + 1;
|
||||
bArr[i] = (byte) ((Integer.parseInt(str.substring(i2, i3), 16) * 16) + Integer.parseInt(str.substring(i3, i2 + 2), 16));
|
||||
}
|
||||
return bArr;
|
||||
}
|
||||
|
||||
public native byte[] crypt(Context context, byte[] bArr, int i);
|
||||
|
||||
public String getMD5(String str) {
|
||||
return a.b(str);
|
||||
}
|
||||
}
|
238
sources/com/baidu/cloud/media/download/VideoDownloadManager.java
Normal file
238
sources/com/baidu/cloud/media/download/VideoDownloadManager.java
Normal file
@@ -0,0 +1,238 @@
|
||||
package com.baidu.cloud.media.download;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.baidu.cloud.media.download.DownloadableVideoItem;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class VideoDownloadManager {
|
||||
private static int c = 5;
|
||||
private static volatile VideoDownloadManager i;
|
||||
private static volatile String j;
|
||||
private String a;
|
||||
private String b;
|
||||
private Context f;
|
||||
private String g;
|
||||
private volatile int d = 0;
|
||||
private Queue<String> e = new LinkedList();
|
||||
private ConcurrentHashMap<String, b> h = new ConcurrentHashMap<>();
|
||||
|
||||
private VideoDownloadManager(Context context, String str) {
|
||||
this.a = "_unk@nown_##$ default $##_unk@nown_";
|
||||
this.b = "4f0fecb0c26217433bafbf2a0d595c4e";
|
||||
this.f = context.getApplicationContext();
|
||||
this.a = str;
|
||||
this.b = a.b(str);
|
||||
f();
|
||||
}
|
||||
|
||||
protected static VideoDownloadManager b() {
|
||||
return i;
|
||||
}
|
||||
|
||||
private void f() {
|
||||
this.h.clear();
|
||||
try {
|
||||
for (Map.Entry entry : ((HashMap) this.f.getSharedPreferences(e(), 0).getAll()).entrySet()) {
|
||||
try {
|
||||
String str = (String) entry.getKey();
|
||||
JSONObject jSONObject = new JSONObject((String) entry.getValue());
|
||||
jSONObject.put("urle", str);
|
||||
this.h.put(jSONObject.getString("url"), b.a(this.f, e(), jSONObject));
|
||||
} catch (Exception e) {
|
||||
Log.d("VideoDownloadManager", "" + e.getMessage());
|
||||
}
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
Log.d("VideoDownloadManager", "" + e2.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized VideoDownloadManager getInstance(Context context, String str) {
|
||||
synchronized (VideoDownloadManager.class) {
|
||||
if (str != null) {
|
||||
if (!str.equals("")) {
|
||||
if (!str.equals(j)) {
|
||||
j = str;
|
||||
if (i != null) {
|
||||
i.stopAll();
|
||||
i = null;
|
||||
}
|
||||
}
|
||||
if (i == null) {
|
||||
i = new VideoDownloadManager(context, str);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
Log.e("VideoDownloadManager", "getInstance failed, userName is null or empty.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected String a() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
protected boolean a(String str) {
|
||||
boolean z;
|
||||
synchronized (this.e) {
|
||||
z = false;
|
||||
if (!this.e.contains(str)) {
|
||||
if (this.d >= c) {
|
||||
this.e.offer(str);
|
||||
} else {
|
||||
this.d++;
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
protected void b(String str) {
|
||||
synchronized (this.e) {
|
||||
this.e.remove(str);
|
||||
}
|
||||
}
|
||||
|
||||
protected void c() {
|
||||
int i2;
|
||||
synchronized (this.e) {
|
||||
if (!this.e.isEmpty()) {
|
||||
b bVar = this.h.get(this.e.poll());
|
||||
if (bVar.getStatus() == DownloadableVideoItem.DownloadStatus.PENDING) {
|
||||
bVar.a();
|
||||
} else if (this.d > 0) {
|
||||
i2 = this.d;
|
||||
this.d = i2 - 1;
|
||||
}
|
||||
} else if (this.d > 0) {
|
||||
i2 = this.d;
|
||||
this.d = i2 - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void changeMaxDownloadingItems(int i2) {
|
||||
if (i2 <= 0 || i2 > 10) {
|
||||
Log.e("VideoDownloadManager", "changeMaxDownloadingItems, maxItems should be 0<x<100");
|
||||
} else {
|
||||
c = i2;
|
||||
}
|
||||
}
|
||||
|
||||
protected String d() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public void deleteDownloader(String str) {
|
||||
b bVar = this.h.get(str);
|
||||
if (bVar == null) {
|
||||
Log.e("VideoDownloadManager", "deleteDownloader but there is no downloader for url=" + str);
|
||||
return;
|
||||
}
|
||||
if (bVar.getStatus() == DownloadableVideoItem.DownloadStatus.PENDING) {
|
||||
b(str);
|
||||
}
|
||||
bVar.c();
|
||||
this.h.remove(str);
|
||||
}
|
||||
|
||||
protected String e() {
|
||||
return "__cyberplayer_dl_" + d();
|
||||
}
|
||||
|
||||
public HashMap<String, DownloadableVideoItem> getAllDownloadableVideoItems() {
|
||||
HashMap<String, DownloadableVideoItem> hashMap = new HashMap<>();
|
||||
hashMap.putAll(this.h);
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
public String getDownloadRootForCurrentUser() {
|
||||
File externalFilesDir = this.f.getExternalFilesDir(null);
|
||||
if (externalFilesDir == null) {
|
||||
return null;
|
||||
}
|
||||
return externalFilesDir.getAbsolutePath() + "/cyberplayer_download_videos/" + d() + "/";
|
||||
}
|
||||
|
||||
public DownloadableVideoItem getDownloadableVideoItemByUrl(String str) {
|
||||
return this.h.get(str);
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void pauseDownloader(String str) {
|
||||
b bVar = this.h.get(str);
|
||||
if (bVar != null) {
|
||||
if (bVar.getStatus() == DownloadableVideoItem.DownloadStatus.PENDING) {
|
||||
b(str);
|
||||
}
|
||||
bVar.b();
|
||||
} else {
|
||||
Log.e("VideoDownloadManager", "pauseDownloader but there is no downloader for url=" + str);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCustomizedPlayerId(String str) {
|
||||
this.g = str;
|
||||
}
|
||||
|
||||
public void startOrResumeDownloader(String str, DownloadObserver downloadObserver) {
|
||||
startOrResumeDownloaderWithToken(str, null, downloadObserver);
|
||||
}
|
||||
|
||||
public void startOrResumeDownloaderWithToken(String str, String str2, DownloadObserver downloadObserver) {
|
||||
String str3;
|
||||
if (str == null) {
|
||||
Log.e("VideoDownloadManager", "url is null");
|
||||
return;
|
||||
}
|
||||
b bVar = this.h.get(str);
|
||||
if (bVar == null) {
|
||||
String b = a.b(str);
|
||||
String downloadRootForCurrentUser = getDownloadRootForCurrentUser();
|
||||
if (downloadRootForCurrentUser != null) {
|
||||
str3 = downloadRootForCurrentUser + b + "/";
|
||||
} else {
|
||||
str3 = null;
|
||||
}
|
||||
bVar = new b(this.f, str, b, str3, b + ".m3u8", e());
|
||||
this.h.put(str, bVar);
|
||||
}
|
||||
if (downloadObserver != null) {
|
||||
bVar.addObserver(downloadObserver);
|
||||
}
|
||||
if (str2 != null && !str2.equals("")) {
|
||||
bVar.a(str2);
|
||||
}
|
||||
if (a(str)) {
|
||||
bVar.a();
|
||||
} else {
|
||||
bVar.a(DownloadableVideoItem.DownloadStatus.PENDING);
|
||||
Log.w("VideoDownloadManager", "startOrResumeDownloader: too many tasks are downloading , this task is suspending now(will download automatically after other task down)");
|
||||
}
|
||||
}
|
||||
|
||||
public void stopAll() {
|
||||
try {
|
||||
Iterator<Map.Entry<String, b>> it = this.h.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().getValue().b();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("VideoDownloadManager", "" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
255
sources/com/baidu/cloud/media/download/a.java
Normal file
255
sources/com/baidu/cloud/media/download/a.java
Normal file
@@ -0,0 +1,255 @@
|
||||
package com.baidu.cloud.media.download;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.util.Log;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class a {
|
||||
/* JADX WARN: Can't wrap try/catch for region: R(22:28|29|(1:31)|32|(1:34)|35|(1:37)|38|39|40|41|(2:42|(1:44)(1:45))|46|(2:48|(10:50|(1:52)|53|54|55|56|57|58|(2:61|62)|60)(1:70))(1:72)|71|54|55|56|57|58|(0)|60) */
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Removed duplicated region for block: B:105:0x015d A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:109:0x0156 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:113:0x014f A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:117:0x0129 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:125:0x0172 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:131:? A[SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:132:0x016b A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:136:0x0164 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:61:0x00eb A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:88:0x0147 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:92:0x0140 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:96:0x0139 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Type inference failed for: r11v10 */
|
||||
/* JADX WARN: Type inference failed for: r11v11 */
|
||||
/* JADX WARN: Type inference failed for: r11v2, types: [java.io.File] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public static com.baidu.cloud.media.download.c.b a(java.lang.String r16, java.lang.String r17) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 374
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.baidu.cloud.media.download.a.a(java.lang.String, java.lang.String):com.baidu.cloud.media.download.c$b");
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:63:0x006a, code lost:
|
||||
|
||||
r5.disconnect();
|
||||
*/
|
||||
/* JADX WARN: Removed duplicated region for block: B:48:0x0098 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:54:? A[SYNTHETIC] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:55:0x0091 A[EXC_TOP_SPLITTER, SYNTHETIC] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public static java.lang.String a(java.lang.String r5) {
|
||||
/*
|
||||
java.lang.StringBuilder r0 = new java.lang.StringBuilder
|
||||
r0.<init>()
|
||||
r1 = 0
|
||||
java.net.URL r2 = new java.net.URL // Catch: java.lang.Throwable -> L73 java.lang.Exception -> L76
|
||||
r2.<init>(r5) // Catch: java.lang.Throwable -> L73 java.lang.Exception -> L76
|
||||
java.net.URLConnection r5 = r2.openConnection() // Catch: java.lang.Throwable -> L73 java.lang.Exception -> L76
|
||||
java.net.HttpURLConnection r5 = (java.net.HttpURLConnection) r5 // Catch: java.lang.Throwable -> L73 java.lang.Exception -> L76
|
||||
r2 = 30000(0x7530, float:4.2039E-41)
|
||||
r5.setConnectTimeout(r2) // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
r5.setReadTimeout(r2) // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
r5.connect() // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
int r2 = r5.getResponseCode() // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
int r2 = r2 / 100
|
||||
r3 = 2
|
||||
if (r2 != r3) goto L68
|
||||
int r2 = r5.getContentLength() // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
r3 = 5242880(0x500000, float:7.34684E-39)
|
||||
if (r2 <= r3) goto L2e
|
||||
goto L68
|
||||
L2e:
|
||||
java.io.BufferedReader r2 = new java.io.BufferedReader // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
java.io.InputStreamReader r3 = new java.io.InputStreamReader // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
java.io.InputStream r4 = r5.getInputStream() // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
r3.<init>(r4) // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
r2.<init>(r3) // Catch: java.lang.Throwable -> L6e java.lang.Exception -> L70
|
||||
L3c:
|
||||
java.lang.String r3 = r2.readLine() // Catch: java.lang.Exception -> L66 java.lang.Throwable -> L8d
|
||||
if (r3 == 0) goto L57
|
||||
java.lang.StringBuilder r4 = new java.lang.StringBuilder // Catch: java.lang.Exception -> L66 java.lang.Throwable -> L8d
|
||||
r4.<init>() // Catch: java.lang.Exception -> L66 java.lang.Throwable -> L8d
|
||||
r4.append(r3) // Catch: java.lang.Exception -> L66 java.lang.Throwable -> L8d
|
||||
java.lang.String r3 = "\n"
|
||||
r4.append(r3) // Catch: java.lang.Exception -> L66 java.lang.Throwable -> L8d
|
||||
java.lang.String r3 = r4.toString() // Catch: java.lang.Exception -> L66 java.lang.Throwable -> L8d
|
||||
r0.append(r3) // Catch: java.lang.Exception -> L66 java.lang.Throwable -> L8d
|
||||
goto L3c
|
||||
L57:
|
||||
java.lang.String r0 = r0.toString() // Catch: java.lang.Exception -> L66 java.lang.Throwable -> L8d
|
||||
r2.close() // Catch: java.lang.Exception -> L5f
|
||||
goto L60
|
||||
L5f:
|
||||
L60:
|
||||
if (r5 == 0) goto L65
|
||||
r5.disconnect() // Catch: java.lang.Exception -> L65
|
||||
L65:
|
||||
return r0
|
||||
L66:
|
||||
r0 = move-exception
|
||||
goto L79
|
||||
L68:
|
||||
if (r5 == 0) goto L6d
|
||||
r5.disconnect() // Catch: java.lang.Exception -> L6d
|
||||
L6d:
|
||||
return r1
|
||||
L6e:
|
||||
r0 = move-exception
|
||||
goto L8f
|
||||
L70:
|
||||
r0 = move-exception
|
||||
r2 = r1
|
||||
goto L79
|
||||
L73:
|
||||
r0 = move-exception
|
||||
r5 = r1
|
||||
goto L8f
|
||||
L76:
|
||||
r0 = move-exception
|
||||
r5 = r1
|
||||
r2 = r5
|
||||
L79:
|
||||
java.lang.String r3 = "DownloadUtils"
|
||||
java.lang.String r4 = ""
|
||||
android.util.Log.d(r3, r4, r0) // Catch: java.lang.Throwable -> L8d
|
||||
if (r2 == 0) goto L87
|
||||
r2.close() // Catch: java.lang.Exception -> L86
|
||||
goto L87
|
||||
L86:
|
||||
L87:
|
||||
if (r5 == 0) goto L8c
|
||||
r5.disconnect() // Catch: java.lang.Exception -> L8c
|
||||
L8c:
|
||||
return r1
|
||||
L8d:
|
||||
r0 = move-exception
|
||||
r1 = r2
|
||||
L8f:
|
||||
if (r1 == 0) goto L96
|
||||
r1.close() // Catch: java.lang.Exception -> L95
|
||||
goto L96
|
||||
L95:
|
||||
L96:
|
||||
if (r5 == 0) goto L9b
|
||||
r5.disconnect() // Catch: java.lang.Exception -> L9b
|
||||
L9b:
|
||||
throw r0
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.baidu.cloud.media.download.a.a(java.lang.String):java.lang.String");
|
||||
}
|
||||
|
||||
public static boolean a(Context context) {
|
||||
NetworkInfo[] allNetworkInfo;
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
|
||||
if (connectivityManager != null && (allNetworkInfo = connectivityManager.getAllNetworkInfo()) != null && allNetworkInfo.length > 0) {
|
||||
for (NetworkInfo networkInfo : allNetworkInfo) {
|
||||
if (networkInfo.getState() == NetworkInfo.State.CONNECTED) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean a(byte[] bArr, String str) {
|
||||
File file;
|
||||
FileOutputStream fileOutputStream = null;
|
||||
try {
|
||||
try {
|
||||
file = new File(str);
|
||||
try {
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
file.createNewFile();
|
||||
FileOutputStream fileOutputStream2 = new FileOutputStream(file);
|
||||
try {
|
||||
fileOutputStream2.write(bArr);
|
||||
fileOutputStream2.flush();
|
||||
fileOutputStream2.close();
|
||||
try {
|
||||
fileOutputStream2.close();
|
||||
} catch (IOException e) {
|
||||
Log.d("DownloadUtils", "" + e.getMessage());
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
Log.d("DownloadUtils", "" + Log.getStackTraceString(e));
|
||||
if (file != null && file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
if (fileOutputStream != null) {
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e3) {
|
||||
Log.d("DownloadUtils", "" + e3.getMessage());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
if (fileOutputStream != null) {
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException e4) {
|
||||
Log.d("DownloadUtils", "" + e4.getMessage());
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (Exception e5) {
|
||||
e = e5;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
} catch (Exception e6) {
|
||||
e = e6;
|
||||
file = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String b(String str) {
|
||||
byte[] bytes = str.getBytes();
|
||||
char[] cArr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
try {
|
||||
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
|
||||
messageDigest.update(bytes);
|
||||
byte[] digest = messageDigest.digest();
|
||||
char[] cArr2 = new char[32];
|
||||
int i = 0;
|
||||
for (int i2 = 0; i2 < 16; i2++) {
|
||||
byte b = digest[i2];
|
||||
int i3 = i + 1;
|
||||
cArr2[i] = cArr[(b >>> 4) & 15];
|
||||
i = i3 + 1;
|
||||
cArr2[i3] = cArr[b & 15];
|
||||
}
|
||||
return new String(cArr2);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.e("DownloadUtils", "", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
464
sources/com/baidu/cloud/media/download/b.java
Normal file
464
sources/com/baidu/cloud/media/download/b.java
Normal file
@@ -0,0 +1,464 @@
|
||||
package com.baidu.cloud.media.download;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import com.baidu.cloud.media.download.DownloadableVideoItem;
|
||||
import com.baidu.cloud.media.download.c;
|
||||
import com.baidu.cloud.media.download.d;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class b extends DownloadableVideoItem {
|
||||
private volatile boolean m;
|
||||
private ArrayList<String> n;
|
||||
private String o;
|
||||
private String p;
|
||||
private Context q;
|
||||
private ExecutorService k = null;
|
||||
private volatile int l = 0;
|
||||
private String r = null;
|
||||
|
||||
public b(Context context, String str, String str2, String str3, String str4, String str5) {
|
||||
this.o = "";
|
||||
this.p = "";
|
||||
this.q = context;
|
||||
this.b = str;
|
||||
this.o = str2;
|
||||
this.c = str3;
|
||||
this.d = str4;
|
||||
this.p = str5;
|
||||
}
|
||||
|
||||
public static b a(Context context, String str, JSONObject jSONObject) {
|
||||
b bVar;
|
||||
try {
|
||||
String string = jSONObject.getString("url");
|
||||
String string2 = jSONObject.getString("urle");
|
||||
String optString = jSONObject.optString("fold", null);
|
||||
String string3 = jSONObject.getString("file");
|
||||
int i = jSONObject.getInt("st");
|
||||
int i2 = jSONObject.getInt("prgr");
|
||||
int i3 = jSONObject.getInt("tsdl");
|
||||
bVar = new b(context, string, string2, optString, string3, str);
|
||||
try {
|
||||
bVar.a(i, i2, i3);
|
||||
} catch (Exception e) {
|
||||
e = e;
|
||||
Log.e("HLSVideoDownloader", "" + Log.getStackTraceString(e));
|
||||
return bVar;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
bVar = null;
|
||||
}
|
||||
return bVar;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(c.a aVar) {
|
||||
if (this.l >= this.n.size()) {
|
||||
i();
|
||||
return;
|
||||
}
|
||||
c cVar = new c(this.n.get(this.l), this.c + "/" + (this.l + 1) + ".ts", aVar);
|
||||
ExecutorService executorService = this.k;
|
||||
if (executorService == null || executorService.isShutdown()) {
|
||||
Log.d("HLSVideoDownloader", "new executor is created now");
|
||||
this.k = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
this.k.execute(cVar);
|
||||
}
|
||||
|
||||
private void d() {
|
||||
try {
|
||||
if (!new URL(this.b).getPath().endsWith(".m3u8")) {
|
||||
this.i = "only download m3u8 video";
|
||||
this.j = 1;
|
||||
a(DownloadableVideoItem.DownloadStatus.ERROR);
|
||||
return;
|
||||
}
|
||||
String str = this.c;
|
||||
if (str == null || str.equals("")) {
|
||||
String downloadRootForCurrentUser = VideoDownloadManager.b().getDownloadRootForCurrentUser();
|
||||
if (downloadRootForCurrentUser == null) {
|
||||
this.i = "sdcard is unmounted";
|
||||
this.j = 3;
|
||||
a(DownloadableVideoItem.DownloadStatus.ERROR);
|
||||
return;
|
||||
} else {
|
||||
this.c = downloadRootForCurrentUser + this.o + "/";
|
||||
}
|
||||
}
|
||||
if (!this.m) {
|
||||
if (!g()) {
|
||||
if (!e()) {
|
||||
a(DownloadableVideoItem.DownloadStatus.ERROR);
|
||||
return;
|
||||
}
|
||||
Runnable runnable = new Runnable() { // from class: com.baidu.cloud.media.download.b.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
d.a aVar = new d.a() { // from class: com.baidu.cloud.media.download.b.1.1
|
||||
@Override // com.baidu.cloud.media.download.d.a
|
||||
public void a(int i) {
|
||||
if (b.this.h == DownloadableVideoItem.DownloadStatus.DOWNLOADING) {
|
||||
Log.d("HLSVideoDownloader", "Parse failed: error code is " + i);
|
||||
b.this.i = "parse M3U8 failed, reason = " + DownloadableVideoItem.a[i];
|
||||
b bVar = b.this;
|
||||
bVar.j = i;
|
||||
bVar.a(DownloadableVideoItem.DownloadStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.download.d.a
|
||||
public void a(List<String> list) {
|
||||
if (b.this.h == DownloadableVideoItem.DownloadStatus.DOWNLOADING) {
|
||||
b.this.n = (ArrayList) list;
|
||||
b.this.f();
|
||||
b.this.m = true;
|
||||
b.this.h();
|
||||
}
|
||||
}
|
||||
};
|
||||
d dVar = new d(b.this.q, b.this.c + "/" + b.this.d);
|
||||
b bVar = b.this;
|
||||
dVar.a(bVar.b, bVar.r, aVar);
|
||||
}
|
||||
};
|
||||
ExecutorService executorService = this.k;
|
||||
if (executorService == null || executorService.isShutdown()) {
|
||||
Log.d("HLSVideoDownloader", "new executor is created now to download m3u8 file");
|
||||
this.k = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
this.k.execute(runnable);
|
||||
return;
|
||||
}
|
||||
this.m = true;
|
||||
}
|
||||
h();
|
||||
} catch (Exception e) {
|
||||
Log.d("HLSVideoDownloader", "" + e.getMessage());
|
||||
this.i = "url format is invalid";
|
||||
this.j = 1;
|
||||
a(DownloadableVideoItem.DownloadStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ int e(b bVar) {
|
||||
int i = bVar.l;
|
||||
bVar.l = i + 1;
|
||||
return i;
|
||||
}
|
||||
|
||||
private boolean e() {
|
||||
boolean z = true;
|
||||
try {
|
||||
if (!"mounted".equals(Environment.getExternalStorageState())) {
|
||||
this.i = "save file failed, sdcard unmounted";
|
||||
this.j = 3;
|
||||
z = false;
|
||||
}
|
||||
if (a.a(this.q)) {
|
||||
return z;
|
||||
}
|
||||
this.i = "network is not available";
|
||||
this.j = 2;
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
Log.d("HLSVideoDownloader", "checkEnvironment " + e.getMessage());
|
||||
return z;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
public void f() {
|
||||
ArrayList<String> arrayList = this.n;
|
||||
if (arrayList == null || arrayList.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
FileOutputStream fileOutputStream = null;
|
||||
fileOutputStream = null;
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
FileOutputStream fileOutputStream2 = new FileOutputStream(this.c + "/tsdl.data");
|
||||
try {
|
||||
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream2);
|
||||
objectOutputStream.writeObject(this.n);
|
||||
fileOutputStream2.close();
|
||||
fileOutputStream = objectOutputStream;
|
||||
} catch (Exception e) {
|
||||
e = e;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
Log.d("HLSVideoDownloader", "" + e.getMessage());
|
||||
if (fileOutputStream != null) {
|
||||
fileOutputStream.close();
|
||||
fileOutputStream = fileOutputStream;
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
fileOutputStream = fileOutputStream2;
|
||||
if (fileOutputStream != null) {
|
||||
try {
|
||||
fileOutputStream.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
}
|
||||
} catch (IOException unused2) {
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean g() {
|
||||
if (!new File(this.c + "/" + this.d).exists()) {
|
||||
return false;
|
||||
}
|
||||
if (this.n != null) {
|
||||
return true;
|
||||
}
|
||||
FileInputStream fileInputStream = null;
|
||||
try {
|
||||
try {
|
||||
FileInputStream fileInputStream2 = new FileInputStream(this.c + "/tsdl.data");
|
||||
try {
|
||||
this.n = (ArrayList) new ObjectInputStream(fileInputStream2).readObject();
|
||||
try {
|
||||
fileInputStream2.close();
|
||||
return true;
|
||||
} catch (IOException unused) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e = e;
|
||||
fileInputStream = fileInputStream2;
|
||||
Log.d("HLSVideoDownloader", "" + e.getMessage());
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException unused2) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
fileInputStream = fileInputStream2;
|
||||
if (fileInputStream != null) {
|
||||
try {
|
||||
fileInputStream.close();
|
||||
} catch (IOException unused3) {
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void h() {
|
||||
ArrayList<String> arrayList = this.n;
|
||||
if (arrayList == null || arrayList.size() == 0) {
|
||||
this.i = "tsList.size == 0";
|
||||
this.j = 4;
|
||||
a(DownloadableVideoItem.DownloadStatus.ERROR);
|
||||
} else if (e()) {
|
||||
a(new c.a() { // from class: com.baidu.cloud.media.download.b.2
|
||||
@Override // com.baidu.cloud.media.download.c.a
|
||||
public void a(int i, int i2, int i3) {
|
||||
b bVar;
|
||||
int i4;
|
||||
if (i == 1) {
|
||||
if (b.this.h == DownloadableVideoItem.DownloadStatus.PAUSED || b.this.h == DownloadableVideoItem.DownloadStatus.DELETED) {
|
||||
return;
|
||||
}
|
||||
b.e(b.this);
|
||||
b.this.a(i2, i3);
|
||||
b.this.a(this);
|
||||
return;
|
||||
}
|
||||
if (b.this.h == DownloadableVideoItem.DownloadStatus.PAUSED || b.this.h == DownloadableVideoItem.DownloadStatus.DELETED) {
|
||||
return;
|
||||
}
|
||||
if (i == -2) {
|
||||
bVar = b.this;
|
||||
bVar.i = "network has problem";
|
||||
i4 = 2;
|
||||
} else {
|
||||
b.this.i = "save the " + b.this.l + "th ts file - interrupted";
|
||||
bVar = b.this;
|
||||
i4 = 7;
|
||||
}
|
||||
bVar.j = i4;
|
||||
b.this.a(DownloadableVideoItem.DownloadStatus.ERROR);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
a(DownloadableVideoItem.DownloadStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
private void i() {
|
||||
a(DownloadableVideoItem.DownloadStatus.COMPLETED);
|
||||
}
|
||||
|
||||
private void j() {
|
||||
String k;
|
||||
if (this.h == DownloadableVideoItem.DownloadStatus.DELETED || (k = k()) == null) {
|
||||
return;
|
||||
}
|
||||
SharedPreferences.Editor edit = this.q.getSharedPreferences(this.p, 0).edit();
|
||||
edit.putString(this.o, k);
|
||||
if (Build.VERSION.SDK_INT >= 9) {
|
||||
edit.apply();
|
||||
} else {
|
||||
edit.commit();
|
||||
}
|
||||
}
|
||||
|
||||
private String k() {
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
jSONObject.put("url", this.b);
|
||||
jSONObject.put("fold", this.c);
|
||||
jSONObject.put("file", this.d);
|
||||
jSONObject.put("st", this.h.getCode());
|
||||
jSONObject.put("prgr", this.e);
|
||||
jSONObject.put("tsdl", this.l);
|
||||
return jSONObject.toString();
|
||||
} catch (Exception e) {
|
||||
Log.e("HLSVideoDownloader", "" + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void a(int i, int i2) {
|
||||
ArrayList<String> arrayList;
|
||||
if (this.h == DownloadableVideoItem.DownloadStatus.DOWNLOADING && (arrayList = this.n) != null && arrayList.size() > 0) {
|
||||
this.e = Math.round((this.l / this.n.size()) * 10000.0f);
|
||||
this.f = i;
|
||||
this.g += i2;
|
||||
}
|
||||
j();
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
protected void a(int i, int i2, int i3) {
|
||||
this.e = i2;
|
||||
this.l = i3;
|
||||
DownloadableVideoItem.DownloadStatus downloadStatus = DownloadableVideoItem.DownloadStatus.values()[i];
|
||||
if (downloadStatus == DownloadableVideoItem.DownloadStatus.DOWNLOADING || downloadStatus == DownloadableVideoItem.DownloadStatus.PENDING) {
|
||||
downloadStatus = DownloadableVideoItem.DownloadStatus.PAUSED;
|
||||
}
|
||||
this.h = downloadStatus;
|
||||
}
|
||||
|
||||
protected void a(DownloadableVideoItem.DownloadStatus downloadStatus) {
|
||||
VideoDownloadManager b;
|
||||
DownloadableVideoItem.DownloadStatus downloadStatus2 = this.h;
|
||||
DownloadableVideoItem.DownloadStatus downloadStatus3 = DownloadableVideoItem.DownloadStatus.DOWNLOADING;
|
||||
if (downloadStatus2 == downloadStatus3 && downloadStatus != downloadStatus3 && (b = VideoDownloadManager.b()) != null) {
|
||||
b.c();
|
||||
}
|
||||
this.h = downloadStatus;
|
||||
if (downloadStatus != DownloadableVideoItem.DownloadStatus.PAUSED && downloadStatus != DownloadableVideoItem.DownloadStatus.ERROR) {
|
||||
this.i = "";
|
||||
}
|
||||
if (downloadStatus != DownloadableVideoItem.DownloadStatus.ERROR) {
|
||||
this.j = 0;
|
||||
}
|
||||
a(0, 0);
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.r = str;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
DownloadableVideoItem.DownloadStatus downloadStatus = this.h;
|
||||
DownloadableVideoItem.DownloadStatus downloadStatus2 = DownloadableVideoItem.DownloadStatus.DOWNLOADING;
|
||||
if (downloadStatus != downloadStatus2) {
|
||||
a(downloadStatus2);
|
||||
d();
|
||||
return true;
|
||||
}
|
||||
Log.e("HLSVideoDownloader", "start failed because downloadStatus = " + this.h.name());
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
if (this.h == DownloadableVideoItem.DownloadStatus.PAUSED || this.h == DownloadableVideoItem.DownloadStatus.COMPLETED || this.h == DownloadableVideoItem.DownloadStatus.DELETED) {
|
||||
Log.e("HLSVideoDownloader", "pause not work, && downloadStatus = " + this.h.name());
|
||||
return false;
|
||||
}
|
||||
ExecutorService executorService = this.k;
|
||||
if (executorService != null && !executorService.isShutdown()) {
|
||||
this.k.shutdownNow();
|
||||
}
|
||||
this.i = "manually pause";
|
||||
a(DownloadableVideoItem.DownloadStatus.PAUSED);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean c() {
|
||||
try {
|
||||
a(DownloadableVideoItem.DownloadStatus.DELETED);
|
||||
if (this.k != null && !this.k.isTerminated() && !this.k.isShutdown()) {
|
||||
this.k.shutdownNow();
|
||||
}
|
||||
SharedPreferences.Editor edit = this.q.getSharedPreferences(this.p, 0).edit();
|
||||
edit.remove(this.o);
|
||||
if (Build.VERSION.SDK_INT >= 9) {
|
||||
edit.apply();
|
||||
} else {
|
||||
edit.commit();
|
||||
}
|
||||
if (this.c != null) {
|
||||
File file = new File(this.c);
|
||||
if (file.exists() && file.isDirectory()) {
|
||||
File[] listFiles = file.listFiles();
|
||||
for (int i = 0; i < listFiles.length; i++) {
|
||||
if (listFiles[i].isFile()) {
|
||||
listFiles[i].delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.c = "";
|
||||
this.d = "";
|
||||
this.e = 0;
|
||||
this.j = 0;
|
||||
this.i = "delete manually";
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Log.e("HLSVideoDownloader", "" + e.getMessage());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
33
sources/com/baidu/cloud/media/download/c.java
Normal file
33
sources/com/baidu/cloud/media/download/c.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.baidu.cloud.media.download;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class c implements Runnable {
|
||||
String a;
|
||||
String b;
|
||||
a c;
|
||||
|
||||
public static abstract class a {
|
||||
public abstract void a(int i, int i2, int i3);
|
||||
}
|
||||
|
||||
static class b {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
|
||||
b() {
|
||||
}
|
||||
}
|
||||
|
||||
public c(String str, String str2, a aVar) {
|
||||
this.a = str;
|
||||
this.b = str2;
|
||||
this.c = aVar;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
b a2 = com.baidu.cloud.media.download.a.a(this.a, this.b);
|
||||
this.c.a(a2.a, a2.b, a2.c);
|
||||
}
|
||||
}
|
222
sources/com/baidu/cloud/media/download/d.java
Normal file
222
sources/com/baidu/cloud/media/download/d.java
Normal file
@@ -0,0 +1,222 @@
|
||||
package com.baidu.cloud.media.download;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class d {
|
||||
private String a;
|
||||
private List<String> b;
|
||||
private a c;
|
||||
private Context d;
|
||||
private String f;
|
||||
private String e = null;
|
||||
private String g = null;
|
||||
|
||||
public static abstract class a {
|
||||
public abstract void a(int i);
|
||||
|
||||
public abstract void a(List<String> list);
|
||||
}
|
||||
|
||||
public d(Context context, String str) {
|
||||
this.a = "";
|
||||
this.b = null;
|
||||
this.c = null;
|
||||
this.d = context.getApplicationContext();
|
||||
this.f = str;
|
||||
this.a = "";
|
||||
this.b = new ArrayList();
|
||||
this.c = null;
|
||||
}
|
||||
|
||||
private long a(String str) {
|
||||
try {
|
||||
String[] split = str.split(":|=|,");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
if (split[i].trim().equals("BANDWIDTH")) {
|
||||
return Long.parseLong(split[i + 1].trim());
|
||||
}
|
||||
}
|
||||
return 0L;
|
||||
} catch (Exception e) {
|
||||
Log.d("M3U8Parser", "" + e.getMessage());
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
private void a() {
|
||||
SharedPreferences.Editor edit = this.d.getSharedPreferences("__cyberplayer_dl_sec", 0).edit();
|
||||
edit.putString(this.f, this.e);
|
||||
if (Build.VERSION.SDK_INT >= 9) {
|
||||
edit.apply();
|
||||
} else {
|
||||
edit.commit();
|
||||
}
|
||||
}
|
||||
|
||||
private void a(String str, List<String> list) {
|
||||
String str2;
|
||||
if (str == null || TextUtils.isEmpty(str)) {
|
||||
this.c.a(1);
|
||||
return;
|
||||
}
|
||||
Scanner scanner = new Scanner(str);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String str3 = null;
|
||||
long j = 0;
|
||||
String str4 = null;
|
||||
boolean z = false;
|
||||
boolean z2 = false;
|
||||
while (true) {
|
||||
try {
|
||||
String str5 = "";
|
||||
if (!scanner.hasNextLine()) {
|
||||
scanner.close();
|
||||
if (!z) {
|
||||
if (this.e != null) {
|
||||
a();
|
||||
}
|
||||
if (com.baidu.cloud.media.download.a.a(sb.toString().getBytes(), this.f)) {
|
||||
this.c.a(this.b);
|
||||
return;
|
||||
} else {
|
||||
this.c.a(5);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.b.clear();
|
||||
if (!str3.startsWith("http://")) {
|
||||
str5 = this.a;
|
||||
}
|
||||
a(com.baidu.cloud.media.download.a.a(str5 + str3), this.b);
|
||||
return;
|
||||
}
|
||||
String nextLine = scanner.nextLine();
|
||||
if (!z2 && !nextLine.startsWith("#EXTM3U")) {
|
||||
scanner.close();
|
||||
this.c.a(4);
|
||||
return;
|
||||
}
|
||||
if (TextUtils.isEmpty(str4) || !str4.startsWith("#EXT-X-STREAM-INF:")) {
|
||||
if (!TextUtils.isEmpty(str4) && str4.startsWith("#EXTINF:")) {
|
||||
if (!nextLine.contains("://")) {
|
||||
str5 = this.a;
|
||||
}
|
||||
if (nextLine.startsWith("/")) {
|
||||
str5 = str5.substring(0, str5.indexOf("/", str5.indexOf("://") + 3));
|
||||
} else if (nextLine.startsWith("../")) {
|
||||
if (str5.endsWith("/")) {
|
||||
str5 = str5.substring(0, str5.length() - 1);
|
||||
}
|
||||
str5 = str5.substring(0, str5.lastIndexOf("/") + 1);
|
||||
nextLine = nextLine.substring(3);
|
||||
}
|
||||
list.add(str5 + nextLine);
|
||||
str2 = String.valueOf(list.size()) + ".ts\n";
|
||||
} else if (TextUtils.isEmpty(nextLine) || !nextLine.startsWith("#EXT-X-KEY:")) {
|
||||
str2 = nextLine + "\n";
|
||||
} else {
|
||||
String b = b(nextLine);
|
||||
if (b == null) {
|
||||
scanner.close();
|
||||
this.c.a(6);
|
||||
return;
|
||||
} else {
|
||||
str2 = b + "\n";
|
||||
}
|
||||
}
|
||||
sb.append(str2);
|
||||
str4 = nextLine;
|
||||
} else {
|
||||
long a2 = a(str4);
|
||||
if (a2 > j) {
|
||||
str3 = nextLine;
|
||||
} else {
|
||||
a2 = j;
|
||||
}
|
||||
j = a2;
|
||||
str4 = nextLine;
|
||||
z = true;
|
||||
}
|
||||
z2 = true;
|
||||
} catch (Exception e) {
|
||||
Log.d("M3U8Parser", Log.getStackTraceString(e));
|
||||
this.c.a(2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String b(String str) {
|
||||
String str2;
|
||||
String str3 = null;
|
||||
try {
|
||||
boolean contains = str.contains("=media-drm-player-binding");
|
||||
boolean contains2 = str.contains("=media-drm-safe-code");
|
||||
boolean contains3 = str.contains("=media-drm-token");
|
||||
if (!contains && !contains2 && !contains3) {
|
||||
return str;
|
||||
}
|
||||
if (this.e == null) {
|
||||
String substring = str.substring(str.indexOf("URI=\"") + 5);
|
||||
String substring2 = substring.substring(0, substring.indexOf("\""));
|
||||
String str4 = "pid-android-1";
|
||||
try {
|
||||
String a2 = VideoDownloadManager.b().a();
|
||||
if (!TextUtils.isEmpty(a2)) {
|
||||
str4 = a2;
|
||||
}
|
||||
} catch (Exception unused) {
|
||||
}
|
||||
String str5 = substring2 + "&playerId=" + str4;
|
||||
if (contains3) {
|
||||
str5 = str5 + "&token=" + this.g;
|
||||
}
|
||||
this.e = LocalHlsSec.bytes2HexStr(new LocalHlsSec().crypt(this.d, LocalHlsSec.hexStr2Bytes(new JSONObject(com.baidu.cloud.media.download.a.a(str5)).getString("encryptedVideoKey")), 0));
|
||||
}
|
||||
if (contains) {
|
||||
str2 = "media-drm-player-binding";
|
||||
} else if (contains2) {
|
||||
str2 = "media-drm-safe-code";
|
||||
} else {
|
||||
if (!contains3) {
|
||||
return str;
|
||||
}
|
||||
str2 = "media-drm-token";
|
||||
}
|
||||
try {
|
||||
str = str.replace(str2, "media-drm-local-key");
|
||||
return str;
|
||||
} catch (Exception e) {
|
||||
str3 = str;
|
||||
e = e;
|
||||
Log.d("M3U8Parser", "", e);
|
||||
return str3;
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e = e2;
|
||||
}
|
||||
}
|
||||
|
||||
public int a(String str, String str2, a aVar) {
|
||||
if (TextUtils.isEmpty(str) || aVar == null) {
|
||||
return 1;
|
||||
}
|
||||
this.g = str2;
|
||||
this.c = aVar;
|
||||
this.b.clear();
|
||||
if (TextUtils.isEmpty(this.a)) {
|
||||
this.a = str.substring(0, str.lastIndexOf(47) + 1);
|
||||
}
|
||||
a(com.baidu.cloud.media.download.a.a(str), this.b);
|
||||
return 0;
|
||||
}
|
||||
}
|
138
sources/com/baidu/cloud/media/player/AbstractMediaPlayer.java
Normal file
138
sources/com/baidu/cloud/media/player/AbstractMediaPlayer.java
Normal file
@@ -0,0 +1,138 @@
|
||||
package com.baidu.cloud.media.player;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.baidu.cloud.media.player.IMediaPlayer;
|
||||
import com.baidu.cloud.media.player.misc.IMediaDataSource;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractMediaPlayer implements IMediaPlayer {
|
||||
private IMediaPlayer.OnPreparedListener a;
|
||||
private IMediaPlayer.OnCompletionListener b;
|
||||
private IMediaPlayer.OnBufferingUpdateListener c;
|
||||
private IMediaPlayer.OnSeekCompleteListener d;
|
||||
private IMediaPlayer.OnVideoSizeChangedListener e;
|
||||
private IMediaPlayer.OnErrorListener f;
|
||||
private IMediaPlayer.OnInfoListener g;
|
||||
private IMediaPlayer.OnTimedTextListener h;
|
||||
private IMediaPlayer.OnMetadataListener i;
|
||||
|
||||
protected final void a() {
|
||||
IMediaPlayer.OnPreparedListener onPreparedListener = this.a;
|
||||
if (onPreparedListener != null) {
|
||||
onPreparedListener.onPrepared(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected final void a(int i) {
|
||||
IMediaPlayer.OnBufferingUpdateListener onBufferingUpdateListener = this.c;
|
||||
if (onBufferingUpdateListener != null) {
|
||||
onBufferingUpdateListener.onBufferingUpdate(this, i);
|
||||
}
|
||||
}
|
||||
|
||||
protected final void a(int i, int i2, int i3, int i4) {
|
||||
IMediaPlayer.OnVideoSizeChangedListener onVideoSizeChangedListener = this.e;
|
||||
if (onVideoSizeChangedListener != null) {
|
||||
onVideoSizeChangedListener.onVideoSizeChanged(this, i, i2, i3, i4);
|
||||
}
|
||||
}
|
||||
|
||||
protected final void a(Bundle bundle) {
|
||||
IMediaPlayer.OnMetadataListener onMetadataListener = this.i;
|
||||
if (onMetadataListener != null) {
|
||||
onMetadataListener.onMetadata(this, bundle);
|
||||
}
|
||||
}
|
||||
|
||||
protected final void a(BDTimedText bDTimedText) {
|
||||
IMediaPlayer.OnTimedTextListener onTimedTextListener = this.h;
|
||||
if (onTimedTextListener != null) {
|
||||
onTimedTextListener.onTimedText(this, bDTimedText);
|
||||
}
|
||||
}
|
||||
|
||||
protected final boolean a(int i, int i2) {
|
||||
IMediaPlayer.OnErrorListener onErrorListener = this.f;
|
||||
return onErrorListener != null && onErrorListener.onError(this, i, i2);
|
||||
}
|
||||
|
||||
protected final void b() {
|
||||
IMediaPlayer.OnCompletionListener onCompletionListener = this.b;
|
||||
if (onCompletionListener != null) {
|
||||
onCompletionListener.onCompletion(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected final boolean b(int i, int i2) {
|
||||
IMediaPlayer.OnInfoListener onInfoListener = this.g;
|
||||
return onInfoListener != null && onInfoListener.onInfo(this, i, i2);
|
||||
}
|
||||
|
||||
protected final void c() {
|
||||
IMediaPlayer.OnSeekCompleteListener onSeekCompleteListener = this.d;
|
||||
if (onSeekCompleteListener != null) {
|
||||
onSeekCompleteListener.onSeekComplete(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetListeners() {
|
||||
this.a = null;
|
||||
this.c = null;
|
||||
this.b = null;
|
||||
this.d = null;
|
||||
this.e = null;
|
||||
this.f = null;
|
||||
this.g = null;
|
||||
this.h = null;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public void setDataSource(IMediaDataSource iMediaDataSource) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public final void setOnBufferingUpdateListener(IMediaPlayer.OnBufferingUpdateListener onBufferingUpdateListener) {
|
||||
this.c = onBufferingUpdateListener;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public final void setOnCompletionListener(IMediaPlayer.OnCompletionListener onCompletionListener) {
|
||||
this.b = onCompletionListener;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public final void setOnErrorListener(IMediaPlayer.OnErrorListener onErrorListener) {
|
||||
this.f = onErrorListener;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public final void setOnInfoListener(IMediaPlayer.OnInfoListener onInfoListener) {
|
||||
this.g = onInfoListener;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public final void setOnMetadataListener(IMediaPlayer.OnMetadataListener onMetadataListener) {
|
||||
this.i = onMetadataListener;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public final void setOnPreparedListener(IMediaPlayer.OnPreparedListener onPreparedListener) {
|
||||
this.a = onPreparedListener;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public final void setOnSeekCompleteListener(IMediaPlayer.OnSeekCompleteListener onSeekCompleteListener) {
|
||||
this.d = onSeekCompleteListener;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public final void setOnTimedTextListener(IMediaPlayer.OnTimedTextListener onTimedTextListener) {
|
||||
this.h = onTimedTextListener;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.IMediaPlayer
|
||||
public final void setOnVideoSizeChangedListener(IMediaPlayer.OnVideoSizeChangedListener onVideoSizeChangedListener) {
|
||||
this.e = onVideoSizeChangedListener;
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.baidu.cloud.media.player;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface BDCloudLibLoader {
|
||||
void loadLibrary(String str) throws UnsatisfiedLinkError, SecurityException;
|
||||
}
|
1488
sources/com/baidu/cloud/media/player/BDCloudMediaPlayer.java
Normal file
1488
sources/com/baidu/cloud/media/player/BDCloudMediaPlayer.java
Normal file
File diff suppressed because it is too large
Load Diff
24
sources/com/baidu/cloud/media/player/BDTimedText.java
Normal file
24
sources/com/baidu/cloud/media/player/BDTimedText.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.baidu.cloud.media.player;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class BDTimedText {
|
||||
private Rect a;
|
||||
private String b;
|
||||
|
||||
public BDTimedText(Rect rect, String str) {
|
||||
this.a = null;
|
||||
this.b = null;
|
||||
this.a = rect;
|
||||
this.b = str;
|
||||
}
|
||||
|
||||
public Rect getBounds() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
165
sources/com/baidu/cloud/media/player/IMediaPlayer.java
Normal file
165
sources/com/baidu/cloud/media/player/IMediaPlayer.java
Normal file
@@ -0,0 +1,165 @@
|
||||
package com.baidu.cloud.media.player;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
import com.baidu.cloud.media.player.misc.IMediaDataSource;
|
||||
import com.baidu.cloud.media.player.misc.ITrackInfo;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IMediaPlayer {
|
||||
public static final int MEDIA_ERROR_AUTH_FAILURE = -1000;
|
||||
public static final int MEDIA_ERROR_IO = -1004;
|
||||
public static final int MEDIA_ERROR_MALFORMED = -1007;
|
||||
public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200;
|
||||
public static final int MEDIA_ERROR_SERVER_DIED = 100;
|
||||
public static final int MEDIA_ERROR_TIMED_OUT = -110;
|
||||
public static final int MEDIA_ERROR_UNKNOWN = 1;
|
||||
public static final int MEDIA_ERROR_UNSUPPORTED = -1010;
|
||||
public static final int MEDIA_INFO_AUDIO_RENDERING_START = 10002;
|
||||
public static final int MEDIA_INFO_BAD_INTERLEAVING = 800;
|
||||
public static final int MEDIA_INFO_BUFFERING_END = 702;
|
||||
public static final int MEDIA_INFO_BUFFERING_START = 701;
|
||||
public static final int MEDIA_INFO_FRAMECHASING_END = 10004;
|
||||
public static final int MEDIA_INFO_FRAMECHASING_START = 10003;
|
||||
public static final int MEDIA_INFO_MEDIA_CHANGE_END = 10006;
|
||||
public static final int MEDIA_INFO_MEDIA_CHANGE_START = 10005;
|
||||
public static final int MEDIA_INFO_METADATA_UPDATE = 802;
|
||||
public static final int MEDIA_INFO_NETWORK_BANDWIDTH = 703;
|
||||
public static final int MEDIA_INFO_NOT_SEEKABLE = 801;
|
||||
public static final int MEDIA_INFO_STARTED_AS_NEXT = 2;
|
||||
public static final int MEDIA_INFO_SUBTITLE_TIMED_OUT = 902;
|
||||
public static final int MEDIA_INFO_TIMED_TEXT_ERROR = 900;
|
||||
public static final int MEDIA_INFO_UNKNOWN = 1;
|
||||
public static final int MEDIA_INFO_UNSUPPORTED_SUBTITLE = 901;
|
||||
public static final int MEDIA_INFO_VIDEO_RENDERING_START = 3;
|
||||
public static final int MEDIA_INFO_VIDEO_ROTATION_CHANGED = 10001;
|
||||
public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING = 700;
|
||||
|
||||
public interface OnBufferingUpdateListener {
|
||||
void onBufferingUpdate(IMediaPlayer iMediaPlayer, int i);
|
||||
}
|
||||
|
||||
public interface OnCompletionListener {
|
||||
void onCompletion(IMediaPlayer iMediaPlayer);
|
||||
}
|
||||
|
||||
public interface OnErrorListener {
|
||||
boolean onError(IMediaPlayer iMediaPlayer, int i, int i2);
|
||||
}
|
||||
|
||||
public interface OnInfoListener {
|
||||
boolean onInfo(IMediaPlayer iMediaPlayer, int i, int i2);
|
||||
}
|
||||
|
||||
public interface OnMetadataListener {
|
||||
void onMetadata(IMediaPlayer iMediaPlayer, Bundle bundle);
|
||||
}
|
||||
|
||||
public interface OnPreparedListener {
|
||||
void onPrepared(IMediaPlayer iMediaPlayer);
|
||||
}
|
||||
|
||||
public interface OnSeekCompleteListener {
|
||||
void onSeekComplete(IMediaPlayer iMediaPlayer);
|
||||
}
|
||||
|
||||
public interface OnTimedTextListener {
|
||||
void onTimedText(IMediaPlayer iMediaPlayer, BDTimedText bDTimedText);
|
||||
}
|
||||
|
||||
public interface OnVideoSizeChangedListener {
|
||||
void onVideoSizeChanged(IMediaPlayer iMediaPlayer, int i, int i2, int i3, int i4);
|
||||
}
|
||||
|
||||
int getAudioSessionId();
|
||||
|
||||
long getCurrentPosition();
|
||||
|
||||
String getDataSource();
|
||||
|
||||
long getDuration();
|
||||
|
||||
c getMediaInfo();
|
||||
|
||||
ITrackInfo[] getTrackInfo();
|
||||
|
||||
int getVideoHeight();
|
||||
|
||||
int getVideoSarDen();
|
||||
|
||||
int getVideoSarNum();
|
||||
|
||||
int getVideoWidth();
|
||||
|
||||
boolean isLooping();
|
||||
|
||||
boolean isPlayable();
|
||||
|
||||
boolean isPlaying();
|
||||
|
||||
void pause() throws IllegalStateException;
|
||||
|
||||
void prepareAsync() throws IllegalStateException;
|
||||
|
||||
void release();
|
||||
|
||||
void reset();
|
||||
|
||||
void seekTo(long j) throws IllegalStateException;
|
||||
|
||||
void setAudioStreamType(int i);
|
||||
|
||||
void setDataSource(Context context, Uri uri) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException;
|
||||
|
||||
void setDataSource(Context context, Uri uri, Map<String, String> map) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException;
|
||||
|
||||
void setDataSource(IMediaDataSource iMediaDataSource);
|
||||
|
||||
void setDataSource(FileDescriptor fileDescriptor) throws IOException, IllegalArgumentException, IllegalStateException;
|
||||
|
||||
void setDataSource(String str) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException;
|
||||
|
||||
void setDisplay(SurfaceHolder surfaceHolder);
|
||||
|
||||
void setKeepInBackground(boolean z);
|
||||
|
||||
void setLogEnabled(boolean z);
|
||||
|
||||
void setLooping(boolean z);
|
||||
|
||||
void setOnBufferingUpdateListener(OnBufferingUpdateListener onBufferingUpdateListener);
|
||||
|
||||
void setOnCompletionListener(OnCompletionListener onCompletionListener);
|
||||
|
||||
void setOnErrorListener(OnErrorListener onErrorListener);
|
||||
|
||||
void setOnInfoListener(OnInfoListener onInfoListener);
|
||||
|
||||
void setOnMetadataListener(OnMetadataListener onMetadataListener);
|
||||
|
||||
void setOnPreparedListener(OnPreparedListener onPreparedListener);
|
||||
|
||||
void setOnSeekCompleteListener(OnSeekCompleteListener onSeekCompleteListener);
|
||||
|
||||
void setOnTimedTextListener(OnTimedTextListener onTimedTextListener);
|
||||
|
||||
void setOnVideoSizeChangedListener(OnVideoSizeChangedListener onVideoSizeChangedListener);
|
||||
|
||||
void setScreenOnWhilePlaying(boolean z);
|
||||
|
||||
void setSurface(Surface surface);
|
||||
|
||||
void setVolume(float f, float f2);
|
||||
|
||||
void setWakeMode(Context context, int i);
|
||||
|
||||
void start() throws IllegalStateException;
|
||||
|
||||
void stop() throws IllegalStateException;
|
||||
}
|
193
sources/com/baidu/cloud/media/player/a.java
Normal file
193
sources/com/baidu/cloud/media/player/a.java
Normal file
@@ -0,0 +1,193 @@
|
||||
package com.baidu.cloud.media.player;
|
||||
|
||||
import android.media.MediaCodecInfo;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.ubt.jimu.base.util.FileUtil;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class a {
|
||||
private static Map<String, Integer> d;
|
||||
public MediaCodecInfo a;
|
||||
public int b = 0;
|
||||
public String c;
|
||||
|
||||
public static a a(MediaCodecInfo mediaCodecInfo, String str) {
|
||||
if (mediaCodecInfo == null || Build.VERSION.SDK_INT < 16) {
|
||||
return null;
|
||||
}
|
||||
String name = mediaCodecInfo.getName();
|
||||
if (TextUtils.isEmpty(name)) {
|
||||
return null;
|
||||
}
|
||||
String lowerCase = name.toLowerCase(Locale.US);
|
||||
int i = 600;
|
||||
if (!lowerCase.startsWith("omx.")) {
|
||||
i = 100;
|
||||
} else if (lowerCase.startsWith("omx.pv") || lowerCase.startsWith("omx.google.") || lowerCase.startsWith("omx.ffmpeg.") || lowerCase.startsWith("omx.k3.ffmpeg.") || lowerCase.startsWith("omx.avcodec.")) {
|
||||
i = 200;
|
||||
} else {
|
||||
if (!lowerCase.startsWith("omx.ittiam.")) {
|
||||
if (!lowerCase.startsWith("omx.mtk.")) {
|
||||
Integer num = a().get(lowerCase);
|
||||
if (num != null) {
|
||||
i = num.intValue();
|
||||
} else {
|
||||
try {
|
||||
if (mediaCodecInfo.getCapabilitiesForType(str) != null) {
|
||||
i = IMediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING;
|
||||
}
|
||||
} catch (Throwable unused) {
|
||||
}
|
||||
}
|
||||
} else if (Build.VERSION.SDK_INT >= 18 && !lowerCase.endsWith("decoder.mpeg4")) {
|
||||
i = 800;
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
}
|
||||
a aVar = new a();
|
||||
aVar.a = mediaCodecInfo;
|
||||
aVar.b = i;
|
||||
aVar.c = str;
|
||||
return aVar;
|
||||
}
|
||||
|
||||
public static String a(int i) {
|
||||
return i != 1 ? i != 2 ? i != 4 ? i != 8 ? i != 16 ? i != 32 ? i != 64 ? "Unknown" : "High444" : "High422" : "High10" : "High" : "Extends" : "Main" : "Baseline";
|
||||
}
|
||||
|
||||
public static String a(int i, int i2) {
|
||||
return String.format(Locale.US, " %s Profile Level %s (%d,%d)", a(i), b(i2), Integer.valueOf(i), Integer.valueOf(i2));
|
||||
}
|
||||
|
||||
private static synchronized Map<String, Integer> a() {
|
||||
synchronized (a.class) {
|
||||
if (d != null) {
|
||||
return d;
|
||||
}
|
||||
d = new TreeMap(String.CASE_INSENSITIVE_ORDER);
|
||||
d.put("OMX.Nvidia.h264.decode", 800);
|
||||
d.put("OMX.Nvidia.h264.decode.secure", 300);
|
||||
d.put("OMX.Intel.hw_vd.h264", Integer.valueOf(IMediaPlayer.MEDIA_INFO_NOT_SEEKABLE));
|
||||
d.put("OMX.Intel.VideoDecoder.AVC", 800);
|
||||
d.put("OMX.qcom.video.decoder.avc", 800);
|
||||
d.put("OMX.ittiam.video.decoder.avc", 0);
|
||||
d.put("OMX.SEC.avc.dec", 800);
|
||||
d.put("OMX.SEC.AVC.Decoder", 799);
|
||||
d.put("OMX.SEC.avcdec", 798);
|
||||
d.put("OMX.SEC.avc.sw.dec", 200);
|
||||
d.put("OMX.Exynos.avc.dec", 800);
|
||||
d.put("OMX.Exynos.AVC.Decoder", 799);
|
||||
d.put("OMX.k3.video.decoder.avc", 800);
|
||||
d.put("OMX.IMG.MSVDX.Decoder.AVC", 800);
|
||||
d.put("OMX.TI.DUCATI1.VIDEO.DECODER", 800);
|
||||
d.put("OMX.rk.video_decoder.avc", 800);
|
||||
d.put("OMX.amlogic.avc.decoder.awesome", 800);
|
||||
d.put("OMX.MARVELL.VIDEO.HW.CODA7542DECODER", 800);
|
||||
d.put("OMX.MARVELL.VIDEO.H264DECODER", 200);
|
||||
d.remove("OMX.Action.Video.Decoder");
|
||||
d.remove("OMX.allwinner.video.decoder.avc");
|
||||
d.remove("OMX.BRCM.vc4.decoder.avc");
|
||||
d.remove("OMX.brcm.video.h264.hw.decoder");
|
||||
d.remove("OMX.brcm.video.h264.decoder");
|
||||
d.remove("OMX.cosmo.video.decoder.avc");
|
||||
d.remove("OMX.duos.h264.decoder");
|
||||
d.remove("OMX.hantro.81x0.video.decoder");
|
||||
d.remove("OMX.hantro.G1.video.decoder");
|
||||
d.remove("OMX.hisi.video.decoder");
|
||||
d.remove("OMX.LG.decoder.video.avc");
|
||||
d.remove("OMX.MS.AVC.Decoder");
|
||||
d.remove("OMX.RENESAS.VIDEO.DECODER.H264");
|
||||
d.remove("OMX.RTK.video.decoder");
|
||||
d.remove("OMX.sprd.h264.decoder");
|
||||
d.remove("OMX.ST.VFM.H264Dec");
|
||||
d.remove("OMX.vpu.video_decoder.avc");
|
||||
d.remove("OMX.WMT.decoder.avc");
|
||||
d.remove("OMX.bluestacks.hw.decoder");
|
||||
d.put("OMX.google.h264.decoder", 200);
|
||||
d.put("OMX.google.h264.lc.decoder", 200);
|
||||
d.put("OMX.k3.ffmpeg.decoder", 200);
|
||||
d.put("OMX.ffmpeg.video.decoder", 200);
|
||||
d.put("OMX.sprd.soft.h264.decoder", 200);
|
||||
return d;
|
||||
}
|
||||
}
|
||||
|
||||
public static String b(int i) {
|
||||
if (i == 1) {
|
||||
return "1";
|
||||
}
|
||||
if (i == 2) {
|
||||
return "1b";
|
||||
}
|
||||
switch (i) {
|
||||
case 4:
|
||||
return "11";
|
||||
case 8:
|
||||
return "12";
|
||||
case 16:
|
||||
return "13";
|
||||
case 32:
|
||||
return "2";
|
||||
case 64:
|
||||
return "21";
|
||||
case PeripheralType.SERVO /* 128 */:
|
||||
return "22";
|
||||
case DataDecryptTool.DECRYPT_ALL_FILE /* 256 */:
|
||||
return "3";
|
||||
case DataDecryptTool.DECRYPT_DB_FILE /* 512 */:
|
||||
return "31";
|
||||
case DataDecryptTool.DECRYPT_SP_FILE /* 1024 */:
|
||||
return "32";
|
||||
case 2048:
|
||||
return "4";
|
||||
case FileUtil.ZIP_BUFFER_SIZE /* 4096 */:
|
||||
return "41";
|
||||
case UnityActivity.BLOCKLY_TYPE_NONE /* 8192 */:
|
||||
return "42";
|
||||
case 16384:
|
||||
return "5";
|
||||
case 32768:
|
||||
return "51";
|
||||
case 65536:
|
||||
return "52";
|
||||
default:
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
int i;
|
||||
int i2;
|
||||
if (Build.VERSION.SDK_INT < 16) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
MediaCodecInfo.CodecCapabilities capabilitiesForType = this.a.getCapabilitiesForType(str);
|
||||
if (capabilitiesForType == null || capabilitiesForType.profileLevels == null) {
|
||||
i = 0;
|
||||
i2 = 0;
|
||||
} else {
|
||||
i = 0;
|
||||
i2 = 0;
|
||||
for (MediaCodecInfo.CodecProfileLevel codecProfileLevel : capabilitiesForType.profileLevels) {
|
||||
if (codecProfileLevel != null) {
|
||||
i = Math.max(i, codecProfileLevel.profile);
|
||||
i2 = Math.max(i2, codecProfileLevel.level);
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.i("BDCloudMediaCodecInfo", String.format(Locale.US, "%s", a(i, i2)));
|
||||
} catch (Throwable unused) {
|
||||
Log.i("BDCloudMediaCodecInfo", "profile-level: exception");
|
||||
}
|
||||
}
|
||||
}
|
89
sources/com/baidu/cloud/media/player/a/a.java
Normal file
89
sources/com/baidu/cloud/media/player/a/a.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package com.baidu.cloud.media.player.a;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import com.baidu.cloud.media.player.BDCloudMediaPlayer;
|
||||
import java.util.Random;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class a {
|
||||
private String a;
|
||||
private String b;
|
||||
private String c = "";
|
||||
private String d = BDCloudMediaPlayer.SDK_VERSION;
|
||||
private String e = "sw";
|
||||
private String f = "";
|
||||
private e g;
|
||||
private f h;
|
||||
private c i;
|
||||
private JSONObject j;
|
||||
|
||||
public a(Context context, String str) {
|
||||
this.g = new e(context, str);
|
||||
this.h = new f(context);
|
||||
this.i = new c(context);
|
||||
}
|
||||
|
||||
private String a(int i) {
|
||||
Random random = new Random();
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
stringBuffer.append("abcdefghijklmnopqrstuvwxyz".charAt(random.nextInt(26)));
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
private String c() {
|
||||
return ("" + System.currentTimeMillis()) + a(8);
|
||||
}
|
||||
|
||||
public JSONObject a() {
|
||||
if (this.j == null) {
|
||||
this.j = new JSONObject();
|
||||
try {
|
||||
this.j.put("url", this.a);
|
||||
this.j.put("vvid", this.b);
|
||||
this.j.put("isLive", true);
|
||||
this.j.put("playerVersion", this.d);
|
||||
this.j.put("decodeMode", this.e);
|
||||
this.j.put("ak", this.f);
|
||||
this.j.put("bitrate", 0);
|
||||
} catch (Exception e) {
|
||||
Log.d("BaseInfo", "" + e.getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.j.put("playID", this.c);
|
||||
} catch (JSONException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
if (str == null || str.equals("")) {
|
||||
return;
|
||||
}
|
||||
this.a = str;
|
||||
this.b = c();
|
||||
Log.i("BaseInfo", "Current vvid is:" + this.b);
|
||||
this.j = null;
|
||||
}
|
||||
|
||||
public void a(String str, String str2, String str3) {
|
||||
this.d = str;
|
||||
this.e = str2;
|
||||
this.f = str3;
|
||||
this.j = null;
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public void b(String str) {
|
||||
this.c = str;
|
||||
}
|
||||
}
|
398
sources/com/baidu/cloud/media/player/a/b.java
Normal file
398
sources/com/baidu/cloud/media/player/a/b.java
Normal file
@@ -0,0 +1,398 @@
|
||||
package com.baidu.cloud.media.player.a;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.baidu.cloud.media.player.BDCloudMediaPlayer;
|
||||
import com.baidu.uaq.agent.android.AgentConfig;
|
||||
import com.baidu.uaq.agent.android.UAQ;
|
||||
import com.baidu.uaq.agent.android.customtransmission.APMAgent;
|
||||
import com.baidu.uaq.agent.android.customtransmission.APMUploadConfigure;
|
||||
import com.baidu.uaq.agent.android.customtransmission.APMUploadHandler;
|
||||
import com.baidu.uaq.agent.android.customtransmission.MergeBlockCallBack;
|
||||
import com.ubt.jimu.course.view.fragment.JimuMissionListFragment;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class b {
|
||||
private static String a = "";
|
||||
private static boolean b = false;
|
||||
private static b h;
|
||||
private a c;
|
||||
private APMAgent i;
|
||||
private final APMUploadHandler j;
|
||||
private APMUploadHandler k;
|
||||
private long d = 0;
|
||||
private boolean e = false;
|
||||
private long f = 0;
|
||||
private ExecutorService g = null;
|
||||
private MergeBlockCallBack l = new MergeBlockCallBack() { // from class: com.baidu.cloud.media.player.a.b.3
|
||||
};
|
||||
private MergeBlockCallBack m = new MergeBlockCallBack() { // from class: com.baidu.cloud.media.player.a.b.4
|
||||
};
|
||||
|
||||
private b(Context context) {
|
||||
this.c = new a(context, a);
|
||||
d.a().a(context);
|
||||
this.i = UAQ.getInstance().setConfig(new AgentConfig.Builder().APIKey("6ab8e94e75b94316ae7cf4bfb6bd46e7").usePersistentUUID(true).reportCrashes(true).thingsMonitor(true).build()).startAPM(context.getApplicationContext());
|
||||
APMUploadConfigure aPMUploadConfigure = new APMUploadConfigure(APMUploadConfigure.APMUPLOADNAME, null, this.m);
|
||||
long j = 60;
|
||||
aPMUploadConfigure.setInterval4g(j);
|
||||
long j2 = 15;
|
||||
aPMUploadConfigure.setIntervalWifi(j2);
|
||||
long j3 = 204800;
|
||||
long j4 = 86400;
|
||||
aPMUploadConfigure.setMaxbytes4g(j3, j4);
|
||||
long j5 = 0;
|
||||
aPMUploadConfigure.setMaxbyteswifi(j5, j4);
|
||||
aPMUploadConfigure.enableRetransmission(true);
|
||||
HashMap<String, String> hashMap = new HashMap<>();
|
||||
hashMap.put("Content-Type", "application/json");
|
||||
hashMap.put("Content-Encoding", "deflate");
|
||||
aPMUploadConfigure.setHeaderMap(hashMap);
|
||||
this.j = this.i.addUploadConfigure(aPMUploadConfigure);
|
||||
if (b) {
|
||||
APMUploadConfigure aPMUploadConfigure2 = new APMUploadConfigure("userOperation", "https://drm.media.baidubce.com:8888/v2/sdk/player", this.l);
|
||||
aPMUploadConfigure2.setInterval4g(j);
|
||||
aPMUploadConfigure2.setIntervalWifi(j2);
|
||||
aPMUploadConfigure2.setMaxbytes4g(j3, j4);
|
||||
aPMUploadConfigure2.setMaxbyteswifi(j5, j4);
|
||||
aPMUploadConfigure2.enableRetransmission(true);
|
||||
HashMap<String, String> hashMap2 = new HashMap<>();
|
||||
hashMap2.put("Content-Type", "application/json");
|
||||
hashMap2.put("Content-Encoding", "gzip");
|
||||
aPMUploadConfigure2.setHeaderMap(hashMap2);
|
||||
this.k = this.i.addUploadConfigure(aPMUploadConfigure2);
|
||||
}
|
||||
}
|
||||
|
||||
public static b a(Context context) {
|
||||
if (h == null) {
|
||||
h = new b(context);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
public static void a(String str) {
|
||||
a = str;
|
||||
}
|
||||
|
||||
private void a(String str, JSONObject jSONObject) throws JSONException {
|
||||
if (!b || this.k == null) {
|
||||
return;
|
||||
}
|
||||
jSONObject.put("type", str);
|
||||
jSONObject.put("time", System.currentTimeMillis());
|
||||
if (!TextUtils.isEmpty(this.c.b())) {
|
||||
jSONObject.put("session", this.c.b());
|
||||
}
|
||||
final String jSONObject2 = jSONObject.toString();
|
||||
Runnable runnable = new Runnable() { // from class: com.baidu.cloud.media.player.a.b.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
try {
|
||||
b.this.i.addLogWithHandler(b.this.k, jSONObject2);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "" + e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
ExecutorService executorService = this.g;
|
||||
if (executorService == null || executorService.isShutdown()) {
|
||||
this.g = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
this.g.execute(runnable);
|
||||
}
|
||||
|
||||
public static void a(boolean z) {
|
||||
b = z;
|
||||
}
|
||||
|
||||
private void d(JSONObject jSONObject) {
|
||||
try {
|
||||
JSONObject jSONObject2 = new JSONObject();
|
||||
jSONObject2.put("TraceId", this.c.b());
|
||||
jSONObject2.put("CommData", this.c.a());
|
||||
jSONObject2.put("Event", jSONObject);
|
||||
JSONObject jSONObject3 = new JSONObject();
|
||||
jSONObject3.put("Trace", jSONObject2);
|
||||
final String jSONObject4 = jSONObject3.toString();
|
||||
Runnable runnable = new Runnable() { // from class: com.baidu.cloud.media.player.a.b.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
try {
|
||||
b.this.i.addLogWithHandler(b.this.j, jSONObject4);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "" + e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
if (this.g == null || this.g.isShutdown()) {
|
||||
this.g = Executors.newSingleThreadExecutor();
|
||||
}
|
||||
this.g.execute(runnable);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
try {
|
||||
a("dealloc", new JSONObject());
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "release " + e.getMessage());
|
||||
}
|
||||
this.i.stopAPM();
|
||||
h = null;
|
||||
}
|
||||
|
||||
public void a(float f) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put(JimuMissionListFragment.POSITION, f);
|
||||
a("pause", jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onUserPause " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "domainIPFound");
|
||||
jSONObject.put("StartTime", System.currentTimeMillis());
|
||||
jSONObject.put("Duration", i);
|
||||
d(jSONObject);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(int i, int i2, int i3) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
JSONObject jSONObject2 = new JSONObject();
|
||||
try {
|
||||
jSONObject.put(BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR, i);
|
||||
jSONObject.put("errorInfo", i2);
|
||||
jSONObject2.put("Name", "playEnd");
|
||||
jSONObject2.put("StartTime", System.currentTimeMillis());
|
||||
jSONObject2.put("Code", i3);
|
||||
JSONObject jSONObject3 = new JSONObject();
|
||||
jSONObject3.put("detail", "what=" + i + ";extra=" + i2);
|
||||
jSONObject2.put("EventData", jSONObject3);
|
||||
a(BDCloudMediaPlayer.OnNativeInvokeListener.ARG_ERROR, jSONObject);
|
||||
d(jSONObject2);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onPlayFail " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void a(long j) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "httpConnected");
|
||||
jSONObject.put("StartTime", System.currentTimeMillis());
|
||||
jSONObject.put("Duration", j);
|
||||
d(jSONObject);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void a(String str, String str2, String str3) {
|
||||
this.c.a(str, str2, str3);
|
||||
}
|
||||
|
||||
public void a(JSONObject jSONObject) {
|
||||
try {
|
||||
a("play", jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onUserPlay " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void b() {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "playerCreated");
|
||||
jSONObject.put("StartTime", System.currentTimeMillis());
|
||||
d(jSONObject);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(int i) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "networkSpeed");
|
||||
jSONObject.put("StartTime", System.currentTimeMillis());
|
||||
JSONObject jSONObject2 = new JSONObject();
|
||||
jSONObject2.put("speed", i);
|
||||
jSONObject.put("EventData", jSONObject2);
|
||||
d(jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onNetworkSpeedReport " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void b(long j) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "firstFrameRendered");
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
jSONObject.put("StartTime", currentTimeMillis);
|
||||
jSONObject.put("Duration", currentTimeMillis - j);
|
||||
d(jSONObject);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void b(String str) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("videoUrl", str);
|
||||
a("init", jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "release " + e.getMessage());
|
||||
}
|
||||
this.c.a(str);
|
||||
}
|
||||
|
||||
public void b(JSONObject jSONObject) {
|
||||
try {
|
||||
a("end", jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onUserPlayEnd " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void c() {
|
||||
this.e = true;
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "frameChasingStart");
|
||||
this.f = System.currentTimeMillis();
|
||||
jSONObject.put("StartTime", this.f);
|
||||
d(jSONObject);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void c(long j) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "firstBufferingEnd");
|
||||
jSONObject.put("StartTime", System.currentTimeMillis());
|
||||
jSONObject.put("Duration", j);
|
||||
d(jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onFirstBufferEnd " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void c(String str) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "updateCdn");
|
||||
jSONObject.put("StartTime", System.currentTimeMillis());
|
||||
JSONObject jSONObject2 = new JSONObject();
|
||||
jSONObject2.put("cdnIp", str);
|
||||
jSONObject.put("EventData", jSONObject2);
|
||||
d(jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onUpdateCdn " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void c(JSONObject jSONObject) {
|
||||
try {
|
||||
a("seek", jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onUserSeek " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void d() {
|
||||
this.e = false;
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
if (this.f <= 0) {
|
||||
Log.d("APMEventHandle", "onFrameCharingEnd error: need invoke onFrameChasingStart first");
|
||||
return;
|
||||
}
|
||||
jSONObject.put("Name", "frameChasingEnd");
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
jSONObject.put("StartTime", currentTimeMillis);
|
||||
jSONObject.put("Duration", currentTimeMillis - this.f);
|
||||
this.f = 0L;
|
||||
d(jSONObject);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void d(String str) {
|
||||
this.c.b(str);
|
||||
}
|
||||
|
||||
public void e() {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "bufferingStart");
|
||||
this.d = System.currentTimeMillis();
|
||||
jSONObject.put("StartTime", this.d);
|
||||
JSONObject jSONObject2 = new JSONObject();
|
||||
jSONObject2.put("isFrameChasing", this.e);
|
||||
jSONObject.put("EventData", jSONObject2);
|
||||
d(jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onBufferingStart " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void e(String str) {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("crashInfo", str);
|
||||
a("crash", jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onPlayerCrash " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void f() {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
if (this.d <= 0) {
|
||||
Log.d("APMEventHandle", "onBufferingEnd error: need invoke onBufferingStart first");
|
||||
return;
|
||||
}
|
||||
jSONObject.put("Name", "bufferingEnd");
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
jSONObject.put("StartTime", currentTimeMillis);
|
||||
jSONObject.put("Duration", currentTimeMillis - this.d);
|
||||
this.d = 0L;
|
||||
d(jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onBufferingEnd " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void g() {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("Name", "keepPlaying");
|
||||
jSONObject.put("StartTime", System.currentTimeMillis());
|
||||
d(jSONObject);
|
||||
} catch (Exception e) {
|
||||
Log.d("APMEventHandle", "onPlayCount " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
31
sources/com/baidu/cloud/media/player/a/c.java
Normal file
31
sources/com/baidu/cloud/media/player/a/c.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.baidu.cloud.media.player.a;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class c {
|
||||
private String a;
|
||||
private String b;
|
||||
private String c;
|
||||
private String d;
|
||||
|
||||
public c(Context context) {
|
||||
a(context);
|
||||
}
|
||||
|
||||
private void a(Context context) {
|
||||
try {
|
||||
this.b = context.getPackageName();
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(this.b, 0);
|
||||
this.d = packageInfo.versionName;
|
||||
this.c = "" + packageInfo.versionCode;
|
||||
this.a = (String) packageManager.getApplicationLabel(packageInfo.applicationInfo);
|
||||
} catch (Exception e) {
|
||||
Log.d("BaseInfo", "" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
51
sources/com/baidu/cloud/media/player/a/d.java
Normal file
51
sources/com/baidu/cloud/media/player/a/d.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.baidu.cloud.media.player.a;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.Thread;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class d implements Thread.UncaughtExceptionHandler {
|
||||
private static d a = new d();
|
||||
private Thread.UncaughtExceptionHandler b = null;
|
||||
private Context c = null;
|
||||
|
||||
private d() {
|
||||
}
|
||||
|
||||
public static d a() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public void a(Context context) {
|
||||
if (this.b == null) {
|
||||
this.b = Thread.getDefaultUncaughtExceptionHandler();
|
||||
Thread.setDefaultUncaughtExceptionHandler(this);
|
||||
}
|
||||
if (this.c == null) {
|
||||
this.c = context.getApplicationContext();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.lang.Thread.UncaughtExceptionHandler
|
||||
public void uncaughtException(Thread thread, Throwable th) {
|
||||
try {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
PrintWriter printWriter = new PrintWriter(stringWriter);
|
||||
th.printStackTrace(printWriter);
|
||||
printWriter.close();
|
||||
String obj = stringWriter.toString();
|
||||
if (obj.contains("com.baidu.cloud.media")) {
|
||||
b.a(this.c).e(obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("SDKCrashHandler", "" + e.getMessage());
|
||||
}
|
||||
if (this.b.equals(this)) {
|
||||
return;
|
||||
}
|
||||
this.b.uncaughtException(thread, th);
|
||||
}
|
||||
}
|
65
sources/com/baidu/cloud/media/player/a/e.java
Normal file
65
sources/com/baidu/cloud/media/player/a/e.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.baidu.cloud.media.player.a;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class e {
|
||||
private String b;
|
||||
private int c;
|
||||
private String d;
|
||||
private String e;
|
||||
private String f;
|
||||
private int g;
|
||||
private int h;
|
||||
private String i;
|
||||
private String j;
|
||||
private String k;
|
||||
private String l;
|
||||
private String a = "android";
|
||||
private String m = "";
|
||||
|
||||
public e(Context context, String str) {
|
||||
a(context, str);
|
||||
}
|
||||
|
||||
private void a(Context context, String str) {
|
||||
int i;
|
||||
try {
|
||||
this.b = Build.VERSION.RELEASE;
|
||||
this.c = Build.VERSION.SDK_INT;
|
||||
this.d = Build.MODEL;
|
||||
this.e = Build.BRAND;
|
||||
this.f = Build.CPU_ABI;
|
||||
this.i = Locale.getDefault().getLanguage();
|
||||
this.l = Settings.Secure.getString(context.getContentResolver(), "android_id");
|
||||
this.j = this.l;
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
if (Build.VERSION.SDK_INT >= 17) {
|
||||
((WindowManager) context.getSystemService("window")).getDefaultDisplay().getRealMetrics(displayMetrics);
|
||||
} else {
|
||||
((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
|
||||
}
|
||||
if (displayMetrics.widthPixels > displayMetrics.heightPixels) {
|
||||
this.g = displayMetrics.heightPixels;
|
||||
i = displayMetrics.widthPixels;
|
||||
} else {
|
||||
this.g = displayMetrics.widthPixels;
|
||||
i = displayMetrics.heightPixels;
|
||||
}
|
||||
this.h = i;
|
||||
if (context.checkCallingOrSelfPermission("android.permission.READ_PHONE_STATE") != -1) {
|
||||
this.k = ((TelephonyManager) context.getSystemService("phone")).getDeviceId();
|
||||
}
|
||||
this.m = str;
|
||||
} catch (Exception e) {
|
||||
Log.d("BaseInfo", "" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
75
sources/com/baidu/cloud/media/player/a/f.java
Normal file
75
sources/com/baidu/cloud/media/player/a/f.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.baidu.cloud.media.player.a;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class f {
|
||||
private String a;
|
||||
private String b;
|
||||
private String c;
|
||||
|
||||
public f(Context context) {
|
||||
b(context);
|
||||
}
|
||||
|
||||
private void b(Context context) {
|
||||
try {
|
||||
this.c = a(context);
|
||||
this.a = ((TelephonyManager) context.getSystemService("phone")).getNetworkOperator();
|
||||
this.b = ((TelephonyManager) context.getSystemService("phone")).getNetworkOperatorName();
|
||||
} catch (Exception e) {
|
||||
Log.d("BaseInfo", "" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public String a(Context context) {
|
||||
NetworkInfo activeNetworkInfo;
|
||||
NetworkInfo.State state;
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
|
||||
if (connectivityManager == null || (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) == null || !activeNetworkInfo.isAvailable()) {
|
||||
return "NONE";
|
||||
}
|
||||
NetworkInfo networkInfo = connectivityManager.getNetworkInfo(1);
|
||||
if (networkInfo != null && (state = networkInfo.getState()) != null && (state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING)) {
|
||||
return "WIFI";
|
||||
}
|
||||
NetworkInfo networkInfo2 = connectivityManager.getNetworkInfo(0);
|
||||
if (networkInfo2 == null) {
|
||||
return "";
|
||||
}
|
||||
NetworkInfo.State state2 = networkInfo2.getState();
|
||||
networkInfo2.getSubtypeName();
|
||||
if (state2 == null) {
|
||||
return "";
|
||||
}
|
||||
if (state2 != NetworkInfo.State.CONNECTED && state2 != NetworkInfo.State.CONNECTING) {
|
||||
return "";
|
||||
}
|
||||
switch (activeNetworkInfo.getSubtype()) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 7:
|
||||
case 11:
|
||||
return "2G";
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 12:
|
||||
case 14:
|
||||
case 15:
|
||||
return "3G";
|
||||
case 13:
|
||||
return "4G";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.baidu.cloud.media.player.annotations;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public @interface AccessedByNative {
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.baidu.cloud.media.player.annotations;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public @interface CalledByNative {
|
||||
String value();
|
||||
}
|
193
sources/com/baidu/cloud/media/player/b.java
Normal file
193
sources/com/baidu/cloud/media/player/b.java
Normal file
@@ -0,0 +1,193 @@
|
||||
package com.baidu.cloud.media.player;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import com.baidu.cloud.media.player.misc.IMediaFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class b {
|
||||
public Bundle a;
|
||||
public String b;
|
||||
public long c;
|
||||
public long d;
|
||||
public long e;
|
||||
public final ArrayList<a> f = new ArrayList<>();
|
||||
public a g;
|
||||
public a h;
|
||||
|
||||
public static class a {
|
||||
public Bundle a;
|
||||
public final int b;
|
||||
public String c;
|
||||
public String d;
|
||||
public String e;
|
||||
public String f;
|
||||
public String g;
|
||||
public long h;
|
||||
public int i;
|
||||
public int j;
|
||||
public int k;
|
||||
public int l;
|
||||
public int m;
|
||||
public int n;
|
||||
public int o;
|
||||
public int p;
|
||||
public int q;
|
||||
public long r;
|
||||
|
||||
public a(int i) {
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
public int a(String str, int i) {
|
||||
String a = a(str);
|
||||
if (TextUtils.isEmpty(a)) {
|
||||
return i;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(a);
|
||||
} catch (NumberFormatException unused) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
public long a(String str, long j) {
|
||||
String a = a(str);
|
||||
if (TextUtils.isEmpty(a)) {
|
||||
return j;
|
||||
}
|
||||
try {
|
||||
return Long.parseLong(a);
|
||||
} catch (NumberFormatException unused) {
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
public String a() {
|
||||
return !TextUtils.isEmpty(this.e) ? this.e : "N/A";
|
||||
}
|
||||
|
||||
public String a(String str) {
|
||||
return this.a.getString(str);
|
||||
}
|
||||
|
||||
public int b(String str) {
|
||||
return a(str, 0);
|
||||
}
|
||||
|
||||
public String b() {
|
||||
int i = this.i;
|
||||
return (i <= 0 || this.j <= 0) ? "N/A" : (this.o <= 0 || this.p <= 0) ? String.format(Locale.US, "%d x %d", Integer.valueOf(this.i), Integer.valueOf(this.j)) : String.format(Locale.US, "%d x %d [SAR %d:%d]", Integer.valueOf(i), Integer.valueOf(this.j), Integer.valueOf(this.o), Integer.valueOf(this.p));
|
||||
}
|
||||
|
||||
public long c(String str) {
|
||||
return a(str, 0L);
|
||||
}
|
||||
|
||||
public String c() {
|
||||
long j = this.h;
|
||||
return j <= 0 ? "N/A" : j < 1000 ? String.format(Locale.US, "%d bit/s", Long.valueOf(j)) : String.format(Locale.US, "%d kb/s", Long.valueOf(j / 1000));
|
||||
}
|
||||
|
||||
public String d() {
|
||||
int i = this.q;
|
||||
return i <= 0 ? "N/A" : String.format(Locale.US, "%d Hz", Integer.valueOf(i));
|
||||
}
|
||||
}
|
||||
|
||||
public static b a(Bundle bundle) {
|
||||
if (bundle == null) {
|
||||
return null;
|
||||
}
|
||||
b bVar = new b();
|
||||
bVar.a = bundle;
|
||||
bVar.b = bVar.a("format");
|
||||
bVar.c = bVar.b("duration_us");
|
||||
bVar.d = bVar.b("start_us");
|
||||
bVar.e = bVar.b("bitrate");
|
||||
int i = -1;
|
||||
int a2 = bVar.a("video", -1);
|
||||
int a3 = bVar.a("audio", -1);
|
||||
ArrayList<Bundle> c = bVar.c("streams");
|
||||
if (c == null) {
|
||||
return bVar;
|
||||
}
|
||||
Iterator<Bundle> it = c.iterator();
|
||||
while (it.hasNext()) {
|
||||
Bundle next = it.next();
|
||||
i++;
|
||||
if (next != null) {
|
||||
a aVar = new a(i);
|
||||
aVar.a = next;
|
||||
aVar.c = aVar.a("type");
|
||||
aVar.d = aVar.a("language");
|
||||
if (!TextUtils.isEmpty(aVar.c)) {
|
||||
aVar.e = aVar.a("codec_name");
|
||||
aVar.f = aVar.a("codec_profile");
|
||||
aVar.g = aVar.a("codec_long_name");
|
||||
aVar.h = aVar.b("bitrate");
|
||||
if (aVar.c.equalsIgnoreCase("video")) {
|
||||
aVar.i = aVar.b(IMediaFormat.KEY_WIDTH);
|
||||
aVar.j = aVar.b(IMediaFormat.KEY_HEIGHT);
|
||||
aVar.k = aVar.b("fps_num");
|
||||
aVar.l = aVar.b("fps_den");
|
||||
aVar.m = aVar.b("tbr_num");
|
||||
aVar.n = aVar.b("tbr_den");
|
||||
aVar.o = aVar.b("sar_num");
|
||||
aVar.p = aVar.b("sar_den");
|
||||
if (a2 == i) {
|
||||
bVar.g = aVar;
|
||||
}
|
||||
} else if (aVar.c.equalsIgnoreCase("audio")) {
|
||||
aVar.q = aVar.b("sample_rate");
|
||||
aVar.r = aVar.c("channel_layout");
|
||||
if (a3 == i) {
|
||||
bVar.h = aVar;
|
||||
}
|
||||
}
|
||||
bVar.f.add(aVar);
|
||||
}
|
||||
}
|
||||
}
|
||||
return bVar;
|
||||
}
|
||||
|
||||
public int a(String str, int i) {
|
||||
String a2 = a(str);
|
||||
if (TextUtils.isEmpty(a2)) {
|
||||
return i;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt(a2);
|
||||
} catch (NumberFormatException unused) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
public long a(String str, long j) {
|
||||
String a2 = a(str);
|
||||
if (TextUtils.isEmpty(a2)) {
|
||||
return j;
|
||||
}
|
||||
try {
|
||||
return Long.parseLong(a2);
|
||||
} catch (NumberFormatException unused) {
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
||||
public String a(String str) {
|
||||
return this.a.getString(str);
|
||||
}
|
||||
|
||||
public long b(String str) {
|
||||
return a(str, 0L);
|
||||
}
|
||||
|
||||
public ArrayList<Bundle> c(String str) {
|
||||
return this.a.getParcelableArrayList(str);
|
||||
}
|
||||
}
|
57
sources/com/baidu/cloud/media/player/b/a.java
Normal file
57
sources/com/baidu/cloud/media/player/b/a.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.baidu.cloud.media.player.b;
|
||||
|
||||
import android.util.Log;
|
||||
import java.util.Locale;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class a {
|
||||
public static boolean a = true;
|
||||
public static boolean b = false;
|
||||
public static boolean c = true;
|
||||
public static boolean d = false;
|
||||
public static boolean e = false;
|
||||
|
||||
public static void a(String str, String str2) {
|
||||
if (a) {
|
||||
Log.e(str, str2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(String str, String str2, Object... objArr) {
|
||||
if (b) {
|
||||
Log.i(str, String.format(Locale.US, str2, objArr));
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(boolean z) {
|
||||
a = true;
|
||||
c = true;
|
||||
if (z) {
|
||||
b = true;
|
||||
d = true;
|
||||
e = true;
|
||||
} else {
|
||||
b = false;
|
||||
d = false;
|
||||
e = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void b(String str, String str2) {
|
||||
if (b) {
|
||||
Log.i(str, str2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void c(String str, String str2) {
|
||||
if (c) {
|
||||
Log.w(str, str2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void d(String str, String str2) {
|
||||
if (d) {
|
||||
Log.d(str, str2);
|
||||
}
|
||||
}
|
||||
}
|
11
sources/com/baidu/cloud/media/player/c.java
Normal file
11
sources/com/baidu/cloud/media/player/c.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.baidu.cloud.media.player;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class c {
|
||||
public String a;
|
||||
public String b;
|
||||
public String c;
|
||||
public String d;
|
||||
public String e;
|
||||
public b f;
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.baidu.cloud.media.player.ffmpeg;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FFmpegApi {
|
||||
public static native String av_base64_encode(byte[] bArr);
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package com.baidu.cloud.media.player.misc;
|
||||
|
||||
import android.media.MediaFormat;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AndroidMediaFormat implements IMediaFormat {
|
||||
private final MediaFormat a;
|
||||
|
||||
public AndroidMediaFormat(MediaFormat mediaFormat) {
|
||||
this.a = mediaFormat;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.misc.IMediaFormat
|
||||
public int getInteger(String str) {
|
||||
MediaFormat mediaFormat = this.a;
|
||||
if (mediaFormat == null) {
|
||||
return 0;
|
||||
}
|
||||
return mediaFormat.getInteger(str);
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.misc.IMediaFormat
|
||||
public String getString(String str) {
|
||||
MediaFormat mediaFormat = this.a;
|
||||
if (mediaFormat == null) {
|
||||
return null;
|
||||
}
|
||||
return mediaFormat.getString(str);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(PeripheralType.SERVO);
|
||||
sb.append(AndroidMediaFormat.class.getName());
|
||||
sb.append('{');
|
||||
MediaFormat mediaFormat = this.a;
|
||||
sb.append(mediaFormat != null ? mediaFormat.toString() : "null");
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,199 @@
|
||||
package com.baidu.cloud.media.player.misc;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.baidu.cloud.media.player.b;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BDCloudMediaFormat implements IMediaFormat {
|
||||
public static final String CODEC_NAME_H264 = "h264";
|
||||
public static final String KEY_IJK_BIT_RATE_UI = "ijk-bit-rate-ui";
|
||||
public static final String KEY_IJK_CHANNEL_UI = "ijk-channel-ui";
|
||||
public static final String KEY_IJK_CODEC_LONG_NAME_UI = "ijk-codec-long-name-ui";
|
||||
public static final String KEY_IJK_CODEC_NAME_UI = "ijk-codec-name-ui";
|
||||
public static final String KEY_IJK_CODEC_PIXEL_FORMAT_UI = "ijk-pixel-format-ui";
|
||||
public static final String KEY_IJK_CODEC_PROFILE_LEVEL_UI = "ijk-profile-level-ui";
|
||||
public static final String KEY_IJK_FRAME_RATE_UI = "ijk-frame-rate-ui";
|
||||
public static final String KEY_IJK_RESOLUTION_UI = "ijk-resolution-ui";
|
||||
public static final String KEY_IJK_SAMPLE_RATE_UI = "ijk-sample-rate-ui";
|
||||
private static final Map<String, a> b = new HashMap();
|
||||
public final b.a a;
|
||||
|
||||
private static abstract class a {
|
||||
private a() {
|
||||
}
|
||||
|
||||
protected String a() {
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
protected abstract String a(BDCloudMediaFormat bDCloudMediaFormat);
|
||||
|
||||
public String b(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
String a = a(bDCloudMediaFormat);
|
||||
return TextUtils.isEmpty(a) ? a() : a;
|
||||
}
|
||||
}
|
||||
|
||||
public BDCloudMediaFormat(b.a aVar) {
|
||||
b.put(KEY_IJK_CODEC_LONG_NAME_UI, new a() { // from class: com.baidu.cloud.media.player.misc.BDCloudMediaFormat.1
|
||||
@Override // com.baidu.cloud.media.player.misc.BDCloudMediaFormat.a
|
||||
public String a(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
return BDCloudMediaFormat.this.a.a("codec_long_name");
|
||||
}
|
||||
});
|
||||
b.put(KEY_IJK_CODEC_NAME_UI, new a() { // from class: com.baidu.cloud.media.player.misc.BDCloudMediaFormat.2
|
||||
@Override // com.baidu.cloud.media.player.misc.BDCloudMediaFormat.a
|
||||
public String a(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
return BDCloudMediaFormat.this.a.a("codec_name");
|
||||
}
|
||||
});
|
||||
b.put(KEY_IJK_BIT_RATE_UI, new a() { // from class: com.baidu.cloud.media.player.misc.BDCloudMediaFormat.3
|
||||
@Override // com.baidu.cloud.media.player.misc.BDCloudMediaFormat.a
|
||||
protected String a(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
int integer = bDCloudMediaFormat.getInteger("bitrate");
|
||||
if (integer <= 0) {
|
||||
return null;
|
||||
}
|
||||
return integer < 1000 ? String.format(Locale.US, "%d bit/s", Integer.valueOf(integer)) : String.format(Locale.US, "%d kb/s", Integer.valueOf(integer / 1000));
|
||||
}
|
||||
});
|
||||
b.put(KEY_IJK_CODEC_PROFILE_LEVEL_UI, new a() { // from class: com.baidu.cloud.media.player.misc.BDCloudMediaFormat.4
|
||||
@Override // com.baidu.cloud.media.player.misc.BDCloudMediaFormat.a
|
||||
protected String a(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
String str;
|
||||
switch (bDCloudMediaFormat.getInteger("codec_profile_id")) {
|
||||
case 44:
|
||||
str = "CAVLC 4:4:4";
|
||||
break;
|
||||
case 66:
|
||||
str = "Baseline";
|
||||
break;
|
||||
case 77:
|
||||
str = "Main";
|
||||
break;
|
||||
case 88:
|
||||
str = "Extended";
|
||||
break;
|
||||
case 100:
|
||||
str = "High";
|
||||
break;
|
||||
case 110:
|
||||
str = "High 10";
|
||||
break;
|
||||
case 122:
|
||||
str = "High 4:2:2";
|
||||
break;
|
||||
case 144:
|
||||
str = "High 4:4:4";
|
||||
break;
|
||||
case 244:
|
||||
str = "High 4:4:4 Predictive";
|
||||
break;
|
||||
case 578:
|
||||
str = "Constrained Baseline";
|
||||
break;
|
||||
case 2158:
|
||||
str = "High 10 Intra";
|
||||
break;
|
||||
case 2170:
|
||||
str = "High 4:2:2 Intra";
|
||||
break;
|
||||
case 2292:
|
||||
str = "High 4:4:4 Intra";
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(str);
|
||||
String string = bDCloudMediaFormat.getString("codec_name");
|
||||
if (!TextUtils.isEmpty(string) && string.equalsIgnoreCase(BDCloudMediaFormat.CODEC_NAME_H264)) {
|
||||
int integer = bDCloudMediaFormat.getInteger("codec_level");
|
||||
if (integer < 10) {
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(" Profile Level ");
|
||||
sb.append((integer / 10) % 10);
|
||||
int i = integer % 10;
|
||||
if (i != 0) {
|
||||
sb.append(".");
|
||||
sb.append(i);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
});
|
||||
b.put(KEY_IJK_CODEC_PIXEL_FORMAT_UI, new a() { // from class: com.baidu.cloud.media.player.misc.BDCloudMediaFormat.5
|
||||
@Override // com.baidu.cloud.media.player.misc.BDCloudMediaFormat.a
|
||||
protected String a(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
return bDCloudMediaFormat.getString("codec_pixel_format");
|
||||
}
|
||||
});
|
||||
b.put(KEY_IJK_RESOLUTION_UI, new a() { // from class: com.baidu.cloud.media.player.misc.BDCloudMediaFormat.6
|
||||
@Override // com.baidu.cloud.media.player.misc.BDCloudMediaFormat.a
|
||||
protected String a(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
int integer = bDCloudMediaFormat.getInteger(IMediaFormat.KEY_WIDTH);
|
||||
int integer2 = bDCloudMediaFormat.getInteger(IMediaFormat.KEY_HEIGHT);
|
||||
int integer3 = bDCloudMediaFormat.getInteger("sar_num");
|
||||
int integer4 = bDCloudMediaFormat.getInteger("sar_den");
|
||||
if (integer <= 0 || integer2 <= 0) {
|
||||
return null;
|
||||
}
|
||||
return (integer3 <= 0 || integer4 <= 0) ? String.format(Locale.US, "%d x %d", Integer.valueOf(integer), Integer.valueOf(integer2)) : String.format(Locale.US, "%d x %d [SAR %d:%d]", Integer.valueOf(integer), Integer.valueOf(integer2), Integer.valueOf(integer3), Integer.valueOf(integer4));
|
||||
}
|
||||
});
|
||||
b.put(KEY_IJK_FRAME_RATE_UI, new a() { // from class: com.baidu.cloud.media.player.misc.BDCloudMediaFormat.7
|
||||
@Override // com.baidu.cloud.media.player.misc.BDCloudMediaFormat.a
|
||||
protected String a(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
int integer = bDCloudMediaFormat.getInteger("fps_num");
|
||||
int integer2 = bDCloudMediaFormat.getInteger("fps_den");
|
||||
if (integer <= 0 || integer2 <= 0) {
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(integer / integer2);
|
||||
}
|
||||
});
|
||||
b.put(KEY_IJK_SAMPLE_RATE_UI, new a() { // from class: com.baidu.cloud.media.player.misc.BDCloudMediaFormat.8
|
||||
@Override // com.baidu.cloud.media.player.misc.BDCloudMediaFormat.a
|
||||
protected String a(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
int integer = bDCloudMediaFormat.getInteger("sample_rate");
|
||||
if (integer <= 0) {
|
||||
return null;
|
||||
}
|
||||
return String.format(Locale.US, "%d Hz", Integer.valueOf(integer));
|
||||
}
|
||||
});
|
||||
b.put(KEY_IJK_CHANNEL_UI, new a() { // from class: com.baidu.cloud.media.player.misc.BDCloudMediaFormat.9
|
||||
@Override // com.baidu.cloud.media.player.misc.BDCloudMediaFormat.a
|
||||
protected String a(BDCloudMediaFormat bDCloudMediaFormat) {
|
||||
int integer = bDCloudMediaFormat.getInteger("channel_layout");
|
||||
if (integer <= 0) {
|
||||
return null;
|
||||
}
|
||||
long j = integer;
|
||||
return j == 4 ? "mono" : j == 3 ? "stereo" : String.format(Locale.US, "%x", Integer.valueOf(integer));
|
||||
}
|
||||
});
|
||||
this.a = aVar;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.misc.IMediaFormat
|
||||
public int getInteger(String str) {
|
||||
b.a aVar = this.a;
|
||||
if (aVar == null) {
|
||||
return 0;
|
||||
}
|
||||
return aVar.b(str);
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.misc.IMediaFormat
|
||||
public String getString(String str) {
|
||||
if (this.a == null) {
|
||||
return null;
|
||||
}
|
||||
return b.containsKey(str) ? b.get(str).b(this) : this.a.a(str);
|
||||
}
|
||||
}
|
14
sources/com/baidu/cloud/media/player/misc/IAndroidIO.java
Normal file
14
sources/com/baidu/cloud/media/player/misc/IAndroidIO.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.baidu.cloud.media.player.misc;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IAndroidIO {
|
||||
int close() throws IOException;
|
||||
|
||||
int open(String str) throws IOException;
|
||||
|
||||
int read(byte[] bArr, int i) throws IOException;
|
||||
|
||||
long seek(long j, int i) throws IOException;
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package com.baidu.cloud.media.player.misc;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IMediaDataSource {
|
||||
void close() throws IOException;
|
||||
|
||||
long getSize() throws IOException;
|
||||
|
||||
int readAt(long j, byte[] bArr, int i, int i2) throws IOException;
|
||||
}
|
12
sources/com/baidu/cloud/media/player/misc/IMediaFormat.java
Normal file
12
sources/com/baidu/cloud/media/player/misc/IMediaFormat.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.baidu.cloud.media.player.misc;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IMediaFormat {
|
||||
public static final String KEY_HEIGHT = "height";
|
||||
public static final String KEY_MIME = "mime";
|
||||
public static final String KEY_WIDTH = "width";
|
||||
|
||||
int getInteger(String str);
|
||||
|
||||
String getString(String str);
|
||||
}
|
19
sources/com/baidu/cloud/media/player/misc/ITrackInfo.java
Normal file
19
sources/com/baidu/cloud/media/player/misc/ITrackInfo.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.baidu.cloud.media.player.misc;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ITrackInfo {
|
||||
public static final int MEDIA_TRACK_TYPE_AUDIO = 2;
|
||||
public static final int MEDIA_TRACK_TYPE_METADATA = 5;
|
||||
public static final int MEDIA_TRACK_TYPE_SUBTITLE = 4;
|
||||
public static final int MEDIA_TRACK_TYPE_TIMEDTEXT = 3;
|
||||
public static final int MEDIA_TRACK_TYPE_UNKNOWN = 0;
|
||||
public static final int MEDIA_TRACK_TYPE_VIDEO = 1;
|
||||
|
||||
IMediaFormat getFormat();
|
||||
|
||||
String getInfoInline();
|
||||
|
||||
String getLanguage();
|
||||
|
||||
int getTrackType();
|
||||
}
|
67
sources/com/baidu/cloud/media/player/misc/a.java
Normal file
67
sources/com/baidu/cloud/media/player/misc/a.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.baidu.cloud.media.player.misc;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.baidu.cloud.media.player.b;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class a implements ITrackInfo {
|
||||
private int a = 0;
|
||||
private b.a b;
|
||||
|
||||
public a(b.a aVar) {
|
||||
this.b = aVar;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.misc.ITrackInfo
|
||||
public IMediaFormat getFormat() {
|
||||
return new BDCloudMediaFormat(this.b);
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.misc.ITrackInfo
|
||||
public String getInfoInline() {
|
||||
String b;
|
||||
StringBuilder sb = new StringBuilder(PeripheralType.SERVO);
|
||||
int i = this.a;
|
||||
if (i == 1) {
|
||||
sb.append("VIDEO");
|
||||
sb.append(", ");
|
||||
sb.append(this.b.a());
|
||||
sb.append(", ");
|
||||
sb.append(this.b.c());
|
||||
sb.append(", ");
|
||||
b = this.b.b();
|
||||
} else if (i != 2) {
|
||||
b = i != 3 ? i != 4 ? "UNKNOWN" : "SUBTITLE" : "TIMEDTEXT";
|
||||
} else {
|
||||
sb.append("AUDIO");
|
||||
sb.append(", ");
|
||||
sb.append(this.b.a());
|
||||
sb.append(", ");
|
||||
sb.append(this.b.c());
|
||||
sb.append(", ");
|
||||
b = this.b.d();
|
||||
}
|
||||
sb.append(b);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.misc.ITrackInfo
|
||||
public String getLanguage() {
|
||||
b.a aVar = this.b;
|
||||
return (aVar == null || TextUtils.isEmpty(aVar.d)) ? "und" : this.b.d;
|
||||
}
|
||||
|
||||
@Override // com.baidu.cloud.media.player.misc.ITrackInfo
|
||||
public int getTrackType() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return a.class.getSimpleName() + '{' + getInfoInline() + "}";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user