小爽音 v1.3版本的 MD5 值为:448355de843c720d712f30c7cdfbd99b
以下内容为反编译后的 b.java 源代码,内容仅作参考
package h.v.a.e;
import android.content.Context;
import android.net.Uri;
import android.os.Environment;
import android.text.TextUtils;
import com.shuyu.gsyvideoplayer.utils.CommonUtil;
import com.shuyu.gsyvideoplayer.utils.FileUtils;
import com.shuyu.gsyvideoplayer.utils.StorageUtils;
import h.f.a.f;
import h.f.a.g;
import h.f.a.h;
import h.f.a.n;
import h.v.a.e.a;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
import tv.danmaku.ijk.media.player.IMediaPlayer;
import tv.danmaku.ijk.media.player.IjkMediaMeta;
public class b implements a, h.f.a.b {
public static b f6298h;
public g c;
public File f6299d;
public boolean f6300e;
public a.InterfaceC0121a f6301f;
public c f6302g = new c();
public static g b(Context context, File file) {
String str;
File file2;
if (file == null) {
g gVar = c().c;
if (gVar == null) {
b c = c();
b c2 = c();
Objects.requireNonNull(c2);
Context applicationContext = context.getApplicationContext();
h.f.a.t.a aVar = new h.f.a.t.a(applicationContext);
try {
str = Environment.getExternalStorageState();
} catch (NullPointerException unused) {
str = "";
}
if ("mounted".equals(str)) {
file2 = new File(new File(new File(new File(Environment.getExternalStorageDirectory(), "Android"), "data"), applicationContext.getPackageName()), "cache");
if (!file2.exists() && !file2.mkdirs()) {
f.b("HttpProxyCacheDebuger", "Unable to create external cache directory");
}
if (file2 == null) {
file2 = applicationContext.getCacheDir();
}
if (file2 == null) {
StringBuilder P = h.b.a.a.a.P("/data/data/");
P.append(applicationContext.getPackageName());
P.append("/cache/");
String sb = P.toString();
f.b("HttpProxyCacheDebuger", "Can't define system cache directory! '" + sb + "%s' will be used.");
file2 = new File(sb);
}
File file3 = new File(file2, "video-cache");
h.f.a.r.g gVar2 = new h.f.a.r.g(IjkMediaMeta.AV_CH_STEREO_LEFT);
h.f.a.r.f fVar = new h.f.a.r.f();
c cVar = c2.f6302g;
Objects.requireNonNull(cVar);
g gVar3 = new g(new h.f.a.c(file3, fVar, gVar2, aVar, cVar), null);
c.c = gVar3;
return gVar3;
}
file2 = null;
if (file2 == null) {
}
if (file2 == null) {
}
File file32 = new File(file2, "video-cache");
h.f.a.r.g gVar22 = new h.f.a.r.g(IjkMediaMeta.AV_CH_STEREO_LEFT);
h.f.a.r.f fVar2 = new h.f.a.r.f();
c cVar2 = c2.f6302g;
Objects.requireNonNull(cVar2);
g gVar32 = new g(new h.f.a.c(file32, fVar2, gVar22, aVar, cVar2), null);
c.c = gVar32;
return gVar32;
}
return gVar;
} else if (c().f6299d != null && !c().f6299d.getAbsolutePath().equals(file.getAbsolutePath())) {
g gVar4 = c().c;
if (gVar4 != null) {
TextUtils.isEmpty("Shutdown proxy server");
synchronized (gVar4.a) {
for (h hVar : gVar4.c.values()) {
hVar.f2941d.clear();
if (hVar.c != null) {
hVar.c.f2933k = null;
hVar.c.f();
hVar.c = null;
}
hVar.a.set(0);
}
gVar4.c.clear();
}
gVar4.f2937g.f2927d.release();
gVar4.f2936f.interrupt();
try {
if (!gVar4.f2934d.isClosed()) {
gVar4.f2934d.close();
}
} catch (IOException e2) {
gVar4.e(new n("Error shutting down proxy server", e2));
}
}
b c3 = c();
g d2 = c().d(context, file);
c3.c = d2;
return d2;
} else {
g gVar5 = c().c;
if (gVar5 == null) {
b c4 = c();
g d3 = c().d(context, file);
c4.c = d3;
return d3;
}
return gVar5;
}
}
public static synchronized b c() {
b bVar;
synchronized (b.class) {
if (f6298h == null) {
f6298h = new b();
}
bVar = f6298h;
}
return bVar;
}
@Override
public void a(File file, String str, int i2) {
a.InterfaceC0121a interfaceC0121a = this.f6301f;
if (interfaceC0121a != null) {
((h.v.a.b) interfaceC0121a).f6289n = i2;
}
}
@Override
public boolean cachePreview(Context context, File file, String str) {
return !b(context.getApplicationContext(), file).c(str).startsWith("http");
}
@Override
public void clearCache(Context context, File file, String str) {
if (TextUtils.isEmpty(str)) {
FileUtils.deleteFiles(new File(StorageUtils.getIndividualCacheDirectory(context.getApplicationContext()).getAbsolutePath()));
return;
}
String a = new h.f.a.r.f().a(str);
if (file != null) {
StringBuilder sb = new StringBuilder();
sb.append(file.getAbsolutePath());
String str2 = File.separator;
CommonUtil.deleteFile(h.b.a.a.a.L(sb, str2, a, ".download"));
CommonUtil.deleteFile(file.getAbsolutePath() + str2 + a);
return;
}
StringBuilder sb2 = new StringBuilder();
sb2.append(StorageUtils.getIndividualCacheDirectory(context.getApplicationContext()).getAbsolutePath());
String str3 = File.separator;
CommonUtil.deleteFile(h.b.a.a.a.L(sb2, str3, a, ".download"));
CommonUtil.deleteFile(StorageUtils.getIndividualCacheDirectory(context.getApplicationContext()).getAbsolutePath() + str3 + a);
}
public g d(Context context, File file) {
String str;
File file2;
if (!file.exists()) {
file.mkdirs();
}
h.f.a.t.a aVar = new h.f.a.t.a(context);
try {
str = Environment.getExternalStorageState();
} catch (NullPointerException unused) {
str = "";
}
if ("mounted".equals(str)) {
file2 = new File(new File(new File(new File(Environment.getExternalStorageDirectory(), "Android"), "data"), context.getPackageName()), "cache");
if (!file2.exists() && !file2.mkdirs()) {
f.b("HttpProxyCacheDebuger", "Unable to create external cache directory");
}
if (file2 == null) {
file2 = context.getCacheDir();
}
if (file2 == null) {
StringBuilder P = h.b.a.a.a.P("/data/data/");
P.append(context.getPackageName());
P.append("/cache/");
String sb = P.toString();
f.b("HttpProxyCacheDebuger", "Can't define system cache directory! '" + sb + "%s' will be used.");
file2 = new File(sb);
}
new File(file2, "video-cache");
h.f.a.r.g gVar = new h.f.a.r.g(IjkMediaMeta.AV_CH_STEREO_LEFT);
h.f.a.r.f fVar = new h.f.a.r.f();
c cVar = this.f6302g;
Objects.requireNonNull(cVar);
this.f6299d = file;
return new g(new h.f.a.c(file, fVar, gVar, aVar, cVar), null);
}
file2 = null;
if (file2 == null) {
}
if (file2 == null) {
}
new File(file2, "video-cache");
h.f.a.r.g gVar2 = new h.f.a.r.g(IjkMediaMeta.AV_CH_STEREO_LEFT);
h.f.a.r.f fVar2 = new h.f.a.r.f();
c cVar2 = this.f6302g;
Objects.requireNonNull(cVar2);
this.f6299d = file;
return new g(new h.f.a.c(file, fVar2, gVar2, aVar, cVar2), null);
}
@Override
public void doCacheLogic(Context context, IMediaPlayer iMediaPlayer, String str, Map<String, String> map, File file) {
Map<String, String> map2 = c.a;
map2.clear();
if (map != null) {
map2.putAll(map);
}
if (str.startsWith("http") && !str.contains("127.0.0.1") && !str.contains(".m3u8")) {
g b = b(context.getApplicationContext(), file);
String c = b.c(str);
boolean z = !c.startsWith("http");
this.f6300e = z;
if (!z) {
Object[] objArr = {this, str};
for (int i2 = 0; i2 < 2; i2++) {
Objects.requireNonNull(objArr[i2]);
}
synchronized (b.a) {
try {
b.a(str).f2941d.add(this);
} catch (n e2) {
f.b("Error registering cache listener", e2.getMessage());
}
}
}
str = c;
} else if (!str.startsWith("http") && !str.startsWith("rtmp") && !str.startsWith("rtsp") && !str.contains(".m3u8")) {
this.f6300e = true;
}
try {
iMediaPlayer.setDataSource(context, Uri.parse(str), map);
} catch (IOException e3) {
e3.printStackTrace();
}
}
@Override
public boolean hadCached() {
return this.f6300e;
}
@Override
public void release() {
g gVar = this.c;
if (gVar != null) {
try {
gVar.g(this);
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
@Override
public void setCacheAvailableListener(a.InterfaceC0121a interfaceC0121a) {
this.f6301f = interfaceC0121a;
}
}