导航菜单

页面标题

页面副标题

jsgt v4.8.1 - b.java 源代码

正在查看: jsgt v4.8.1 应用的 b.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package md;

import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import com.shuyu.gsyvideoplayer.utils.CommonUtil;
import com.shuyu.gsyvideoplayer.utils.FileUtils;
import com.shuyu.gsyvideoplayer.utils.StorageUtils;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import md.a;
import tv.danmaku.ijk.media.player.IMediaPlayer;
import w.f;
import w.g;
import w.p;

public final class b implements a, w.b {
    public static b f;
    public f a;
    public File b;
    public boolean c;
    public a.a d;
    public final c e = new c();

    public static f b(Context context, File file) {
        String str;
        File file2 = null;
        if (file != null) {
            if (c().b == null || c().b.getAbsolutePath().equals(file.getAbsolutePath())) {
                f fVar = c().a;
                if (fVar != null) {
                    return fVar;
                }
                b c = c();
                f d = c().d(context, file);
                c.a = d;
                return d;
            }
            f fVar2 = c().a;
            if (fVar2 != null) {
                a0.c.b0("Shutdown proxy server");
                synchronized (fVar2.a) {
                    for (g gVar : fVar2.c.values()) {
                        gVar.d.clear();
                        if (gVar.c != null) {
                            gVar.c.k = null;
                            gVar.c.e();
                            gVar.c = null;
                        }
                        gVar.a.set(0);
                    }
                    fVar2.c.clear();
                }
                fVar2.g.d.release();
                fVar2.f.interrupt();
                try {
                    if (!fVar2.d.isClosed()) {
                        fVar2.d.close();
                    }
                } catch (IOException e) {
                    String message = new p("Error shutting down proxy server", e).getMessage();
                    if (!TextUtils.isEmpty(message)) {
                        Log.e("HttpProxyCacheServer error", message);
                    }
                }
            }
            b c4 = c();
            f d5 = c().d(context, file);
            c4.a = d5;
            return d5;
        }
        f fVar3 = c().a;
        if (fVar3 != null) {
            return fVar3;
        }
        b c6 = c();
        b c7 = c();
        c7.getClass();
        Context applicationContext = context.getApplicationContext();
        z.a aVar = new z.a(applicationContext);
        try {
            str = Environment.getExternalStorageState();
        } catch (NullPointerException unused) {
            str = "";
        }
        if ("mounted".equals(str) && Build.VERSION.SDK_INT <= 28) {
            File file3 = new File(new File(new File(new File(Environment.getExternalStorageDirectory(), "Android"), "data"), applicationContext.getPackageName()), "cache");
            if (file3.exists() || file3.mkdirs()) {
                file2 = file3;
            } else {
                a0.c.c0("Unable to create external cache directory");
            }
        }
        if (file2 == null) {
            file2 = applicationContext.getCacheDir();
        }
        if (file2 == null) {
            String str2 = "/data/data/" + applicationContext.getPackageName() + "/cache/";
            a0.c.c0("Can't define system cache directory! '" + str2 + "%s' will be used.");
            file2 = new File(str2);
        }
        File file4 = new File(file2, "video-cache");
        x.f fVar4 = new x.f(536870912L);
        ne.c cVar = new ne.c();
        c cVar2 = c7.e;
        cVar2.getClass();
        f fVar5 = new f(new w.c(file4, cVar, fVar4, aVar, cVar2));
        c6.a = fVar5;
        return fVar5;
    }

    public static synchronized b c() {
        b bVar;
        synchronized (b.class) {
            if (f == null) {
                f = new b();
            }
            bVar = f;
        }
        return bVar;
    }

    public final void a(int i, File file) {
        a.a aVar = this.d;
        if (aVar != null) {
            ((ld.b) aVar).m = i;
        }
    }

    public final boolean cachePreview(Context context, File file, String str) {
        return !b(context.getApplicationContext(), file).c(str).startsWith("http");
    }

    public final void clearCache(Context context, File file, String str) {
        if (TextUtils.isEmpty(str)) {
            FileUtils.deleteFiles(new File(StorageUtils.getIndividualCacheDirectory(context.getApplicationContext()).getAbsolutePath()));
            return;
        }
        String e = new ne.c().e(str);
        if (file != null) {
            StringBuilder sb = new StringBuilder();
            sb.append(file.getAbsolutePath());
            String str2 = File.separator;
            sb.append(str2);
            sb.append(e);
            sb.append(".download");
            String sb2 = sb.toString();
            String str3 = file.getAbsolutePath() + str2 + e;
            CommonUtil.deleteFile(sb2);
            CommonUtil.deleteFile(str3);
            return;
        }
        StringBuilder sb3 = new StringBuilder();
        sb3.append(StorageUtils.getIndividualCacheDirectory(context.getApplicationContext()).getAbsolutePath());
        String str4 = File.separator;
        sb3.append(str4);
        sb3.append(e);
        sb3.append(".download");
        String sb4 = sb3.toString();
        String str5 = StorageUtils.getIndividualCacheDirectory(context.getApplicationContext()).getAbsolutePath() + str4 + e;
        CommonUtil.deleteFile(sb4);
        CommonUtil.deleteFile(str5);
    }

    public final w.f d(android.content.Context r8, java.io.File r9) {
        throw new UnsupportedOperationException("Method not decompiled: md.b.d(android.content.Context, java.io.File):w.f");
    }

    public final void doCacheLogic(Context context, IMediaPlayer iMediaPlayer, String str, Map<String, String> map, File file) {
        HashMap hashMap = c.a;
        hashMap.clear();
        if (map != null) {
            hashMap.putAll(map);
        }
        if (str.startsWith("http") && !str.contains("127.0.0.1") && !str.contains(".m3u8")) {
            f b = b(context.getApplicationContext(), file);
            String c = b.c(str);
            boolean z5 = !c.startsWith("http");
            this.c = z5;
            if (!z5) {
                Object[] objArr = {this, str};
                for (int i = 0; i < 2; i++) {
                    objArr[i].getClass();
                }
                synchronized (b.a) {
                    try {
                        b.a(str).d.add(this);
                    } catch (p e) {
                        String message = e.getMessage();
                        if (message != null && !TextUtils.isEmpty(message)) {
                            Log.w("Error registering cache listener", message);
                        }
                    } finally {
                    }
                }
            }
            str = c;
        } else if (!str.startsWith("http") && !str.startsWith("rtmp") && !str.startsWith("rtsp") && !str.contains(".m3u8")) {
            this.c = true;
        }
        try {
            iMediaPlayer.setDataSource(context, Uri.parse(str), map);
        } catch (IOException e4) {
            e4.printStackTrace();
        }
    }

    public final boolean hadCached() {
        return this.c;
    }

    public final void release() {
        f fVar = this.a;
        if (fVar != null) {
            try {
                fVar.f(this);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public final void setCacheAvailableListener(a.a aVar) {
        this.d = aVar;
    }
}