搜书大师 v23.2版本的 MD5 值为:5ee433f6456b6278bd6e80a5d44df55e

以下内容为反编译后的 c.java 源代码,内容仅作参考


package com.bykv.vk.component.ttvideo.a;

import android.text.TextUtils;
import com.bykv.vk.component.ttvideo.DataLoaderHelper;
import com.bykv.vk.component.ttvideo.log.MyLog;
import com.bykv.vk.component.ttvideo.mediakit.medialoader.AVMDLDataLoader;
import com.bykv.vk.component.ttvideo.mediakit.medialoader.AVMDLDataLoaderConfigure;
import com.bykv.vk.component.ttvideo.mediakit.medialoader.AVMDLDataLoaderListener;
import com.bykv.vk.component.ttvideo.player.n;
import com.zk.deviceidentifier.impl.DeviceConstant;
import java.net.URLEncoder;
import org.json.JSONException;
import org.json.JSONObject;

public class c implements AVMDLDataLoaderListener {
    public AVMDLDataLoaderConfigure a;
    private volatile boolean b;
    private volatile com.bykv.vk.component.ttvideo.a.a c;
    private b d;
    private n e;
    private com.bykv.vk.component.ttvideo.log.a f;
    private boolean g;
    private boolean h;

    public static class a {
        private static c a = new c();
    }

    private c() {
        this.b = false;
        this.c = null;
        this.g = false;
        this.h = false;
        this.a = AVMDLDataLoaderConfigure.getDefaultonfigure();
    }

    public static c a() {
        return a.a;
    }

    private boolean a(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        String lowerCase = str.toLowerCase();
        return (lowerCase.startsWith("http://127.0.0.1") || lowerCase.startsWith("http://localhost") || lowerCase.startsWith("file://") || lowerCase.startsWith(com.ksdk.ssds.manager.b.b) || lowerCase.endsWith(".mpd") || lowerCase.contains(".mpd?") || lowerCase.contains(".m3u8?") || lowerCase.endsWith(".m3u8")) ? false : true;
    }

    private boolean f() {
        if (this.h) {
            if (!g()) {
                MyLog.i("MediaLoaderWrapper", String.format("library load fail", new Object[0]));
                return false;
            }
            if (AVMDLDataLoader.a(this.c != null) != 0) {
                MyLog.d("MediaLoaderWrapper", String.format("library has not been loaded", new Object[0]));
                return false;
            }
        }
        try {
            AVMDLDataLoader.a().a(107, this);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            MyLog.i("MediaLoaderWrapper", String.format("create loader failed: exception is" + e.toString(), new Object[0]));
            return false;
        }
    }

    private boolean g() {
        if (this.c == null) {
            return true;
        }
        if (this.c != null && !this.b) {
            this.b = this.c.a("avmdl");
        }
        return this.b;
    }

    public long a(int i) {
        MyLog.i("MediaLoaderWrapper", "get long value from loader");
        AVMDLDataLoader a2 = AVMDLDataLoader.a();
        if (i == 7218) {
            if (a2 == null) {
                return -1L;
            }
            return a2.a(7218);
        }
        switch (i) {
            case 8100:
                if (a2 == null) {
                    return -1L;
                }
                return a2.a(8100);
            case 8101:
                if (a2 == null) {
                    return -1L;
                }
                return a2.a(8101);
            case 8102:
                return (a2 != null ? a2.a(8102) : -1L) == 1 ? 1L : 0L;
            default:
                return -1L;
        }
    }

    public String a(String str, Boolean bool) {
        StringBuilder sb;
        String str2;
        String str3 = null;
        if (str == null) {
            return null;
        }
        if (!a(str)) {
            return str;
        }
        String i = AVMDLDataLoader.a().i();
        if (TextUtils.isEmpty(i)) {
            return null;
        }
        try {
            str3 = URLEncoder.encode(str, "UTF-8");
        } catch (Throwable th) {
            th.printStackTrace();
        }
        String str4 = i + "?rk=v02004b50000bh9ajqhdli3lfv2rgsgg&k=426161df8c5ce110209a6fc6641e049ddfrfgaf&u0=" + str3;
        if (bool.booleanValue()) {
            sb = new StringBuilder();
            str2 = DataLoaderHelper.MDL_PREFIX;
        } else {
            sb = new StringBuilder();
            str2 = "http://";
        }
        sb.append(str2);
        sb.append(str4);
        return sb.toString();
    }

    public void a(int i, int i2) {
        if (i == 51) {
            this.a.mRWTimeOut = i2;
            return;
        }
        if (i == 52) {
            this.a.mOpenTimeOut = i2;
            return;
        }
        if (i == 53) {
            this.a.mTryCount = i2;
            return;
        }
        if (i == 49) {
            MyLog.i("MediaLoaderWrapper", "allow p2p:" + i2);
            this.a.mLiveP2pAllow = i2;
            return;
        }
        if (i == 50) {
            MyLog.i("MediaLoaderWrapper", "loader type:" + i2);
            this.a.mLiveLoaderType = i2;
        }
    }

    public void a(int i, long j) {
        AVMDLDataLoader a2 = AVMDLDataLoader.a();
        if (a2 != null && i == 59) {
            a2.a(1100, j);
        }
    }

    public void a(int i, String str) {
        AVMDLDataLoader a2 = AVMDLDataLoader.a();
        if (a2 == null) {
            return;
        }
        a2.a(i, str);
    }

    public void a(int i, String str, int i2) {
        AVMDLDataLoader a2 = AVMDLDataLoader.a();
        if (a2 == null) {
            return;
        }
        a2.a(i, str, (i == 7213 || i == 7215) ? i2 : System.currentTimeMillis());
    }

    public void a(b bVar) {
        this.d = bVar;
        try {
            AVMDLDataLoader.a().a(107, this);
        } catch (Exception e) {
            e.printStackTrace();
            MyLog.i("MediaLoaderWrapper", String.format("create loader failed: exception is" + e.toString(), new Object[0]));
        }
    }

    public void a(com.bykv.vk.component.ttvideo.log.a aVar) {
        this.f = aVar;
    }

    public void a(n nVar) {
        this.e = nVar;
    }

    public String b(int i) {
        MyLog.i("MediaLoaderWrapper", "get string value from loader");
        AVMDLDataLoader a2 = AVMDLDataLoader.a();
        if (i == 11 && a2 != null) {
            return a2.b(11);
        }
        return null;
    }

    public void b() {
        this.h = true;
    }

    public void c() {
        if (this.g) {
            return;
        }
        if (!f()) {
            throw new Exception("init mediaLoader fail");
        }
        JSONObject jSONObject = new JSONObject();
        try {
            String str = com.bykv.vk.component.ttvideo.a.d;
            if (str != null) {
                if (!TextUtils.isEmpty(str)) {
                    jSONObject.put("app_channel", com.bykv.vk.component.ttvideo.a.d);
                }
                if (!TextUtils.isEmpty(com.bykv.vk.component.ttvideo.a.c)) {
                    jSONObject.put("app_name", com.bykv.vk.component.ttvideo.a.c);
                }
                if (!TextUtils.isEmpty(com.bykv.vk.component.ttvideo.a.f)) {
                    jSONObject.put(DeviceConstant.DEVICE_SP_NAME, com.bykv.vk.component.ttvideo.a.f);
                }
                if (!TextUtils.isEmpty(com.bykv.vk.component.ttvideo.a.e)) {
                    jSONObject.put("app_version", com.bykv.vk.component.ttvideo.a.e);
                }
                jSONObject.put("app_id", com.bykv.vk.component.ttvideo.a.b);
            }
        } catch (JSONException e) {
            e.printStackTrace();
            jSONObject = null;
        }
        if (jSONObject == null) {
            return;
        }
        this.a.mAppInfo = jSONObject.toString();
        if (com.bykv.vk.component.ttvideo.a.b != -1) {
            MyLog.i("MediaLoaderWrapper", "set config");
            AVMDLDataLoader.a().a(this.a);
        }
        if (AVMDLDataLoader.a().d() < 0) {
            throw new Exception("start mediaLoader fail");
        }
        this.g = true;
    }

    public void d() {
        if (!this.g) {
            MyLog.e("MediaLoaderWrapper", "MediaLoader not started, not need close");
            return;
        }
        this.d = null;
        AVMDLDataLoader.a().f();
        AVMDLDataLoader.a().g();
        this.g = false;
    }

    public boolean e() {
        if (AVMDLDataLoader.a() == null) {
            return false;
        }
        return AVMDLDataLoader.a().e();
    }

    @Override
    public String getCheckSumInfo(String str) {
        return null;
    }

    @Override
    public long getInt64Value(int i, long j) {
        b bVar;
        MyLog.i("MediaLoaderWrapper", "getInt64Value:" + i);
        if (i != 8003) {
            return (i == 8004 && (bVar = this.d) != null) ? bVar.a(0, j) : j;
        }
        n nVar = this.e;
        return nVar != null ? nVar.a(73, 0L) : j;
    }

    @Override
    public String getStringValue(int i, long j, String str) {
        return null;
    }

    @Override
    public void onNotify(com.bykv.vk.component.ttvideo.mediakit.medialoader.a aVar) {
        StringBuilder sb;
        String str;
        if (aVar == null || this.d == null) {
            return;
        }
        MyLog.i("MediaLoaderWrapper", "what:" + aVar.a);
        int i = aVar.a;
        if (i == 9) {
            b bVar = this.d;
            if (bVar != null) {
                bVar.a((int) aVar.c, aVar.d);
            }
            sb = new StringBuilder();
            sb.append("live loader errorCode:");
            sb.append(aVar.c);
            str = " errorInfo:";
        } else {
            if (i != 12) {
                return;
            }
            b bVar2 = this.d;
            if (bVar2 != null) {
                bVar2.b((int) aVar.c, aVar.d);
            }
            sb = new StringBuilder();
            sb.append("switch reason:");
            sb.append(aVar.c);
            str = " switchInfo:";
        }
        sb.append(str);
        sb.append(aVar.d);
        MyLog.i("MediaLoaderWrapper", sb.toString());
    }
}