package com.ss.android.ugc.aweme.video.simplayer;

import X.2aZ;
import X.2nK;
import X.4Ms;
import X.AnonymousClass7dQ;
import X.AnonymousClass7e1;
import X.AnonymousClass7e2;
import X.AnonymousClass805;
import X.AnonymousClass8CH;
import X.AnonymousClass8D6;
import X.AnonymousClass8D7;
import X.AnonymousClass8DK;
import X.AnonymousClass8ES;
import X.AnonymousClass8F6;
import X.AnonymousClass8FP;
import X.AnonymousClass8RT;
import X.AnonymousClass8YM;
import X.AnonymousClass9Y3;
import X.AnonymousClass9YM;
import X.C00727Sn;
import X.C03347cp;
import X.C03387ct;
import X.C03417cw;
import X.C03507df;
import X.C03657du;
import X.C16248Bj;
import X.C16738Dg;
import X.C16758Di;
import X.C16798Dm;
import X.C16948Eb;
import X.C17658Gu;
import X.C18608Kl;
import X.C18618Km;
import X.C20548Rx;
import X.C21188Uj;
import X.C403195y;
import X.C53279iI;
import X.MDV;
import android.content.Context;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.ss.android.common.applog.AppLog;
import com.ss.android.ugc.aweme.common.MobClick;
import com.ss.android.ugc.aweme.video.config.ISimPlayerConfig;
import java.io.File;
import java.net.URI;
import java.util.List;
import org.json.JSONObject;

public class PlayerConfigImpl implements ISimPlayerConfig {
    static {
        Covode.recordClassIndex(123080);
    }

    public AnonymousClass8D6 createAudioUrlProcessor() {
        return null;
    }

    public AnonymousClass8D7 createSubUrlProcessor() {
        return null;
    }

    public AnonymousClass8CH createVideoUrlProcessor() {
        return null;
    }

    public boolean disableSleepResume(String str) {
        return false;
    }

    public void downloadFile(String str, String str2, String str3, String str4) {
    }

    public boolean enableByteVc1FailCheckCountPolicy() {
        return false;
    }

    public boolean enableFileIoOpt(String str) {
        return false;
    }

    public boolean enableForceUseH264CheckPolicy() {
        return true;
    }

    public boolean enableForceUseH264Global() {
        return false;
    }

    public int getBitrateQuality() {
        return 1;
    }

    public AnonymousClass8FP getBitrateSelectListener() {
        return null;
    }

    public AnonymousClass8DK getBitrateSelector() {
        return null;
    }

    public AnonymousClass8F6 getDashProcessUrlData(String str, boolean z, long j) {
        return null;
    }

    public int getPlayerType() {
        return 0;
    }

    public int getTTPlayerPlan() {
        return 0;
    }

    public boolean ignoreExoReleaseState() {
        return true;
    }

    public boolean isPluginApplied() {
        return false;
    }

    public boolean isUseLastNetworkSpeed() {
        return true;
    }

    public void onRecordFirstFrameTime(String str, long j, String str2, boolean z, boolean z2) {
    }

    public void onRecordPrepareTime(String str, long j, String str2, boolean z, boolean z2) {
    }

    public boolean perfEventEnabled() {
        return false;
    }

    public int getAverageSpeedInKBps() {
        return C21188Uj.LJFF();
    }

    public C16948Eb getPreRenderConfig() {
        return new C16948Eb() {
            static {
                /*
                    r0 = 122747(0x1df7b, float:1.72005E-40)
                    com.bytedance.covode.number.Covode.recordClassIndex(r0)
                    return
                */
                throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.video.config.ISimPlayerConfig.AnonymousClass1.<clinit>():void");
            }

            public final java.util.List LIZ(
/*
Method generation error in method: com.ss.android.ugc.aweme.video.config.ISimPlayerConfig.1.LIZ():java.util.List, dex: classes4.dex
            jadx.core.utils.exceptions.JadxRuntimeException: Method args not loaded: com.ss.android.ugc.aweme.video.config.ISimPlayerConfig.1.LIZ():java.util.List, class status: UNLOADED
            	at jadx.core.dex.nodes.MethodNode.getArgRegs(MethodNode.java:278)
            	at jadx.core.codegen.MethodGen.addDefinition(MethodGen.java:116)
            	at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:313)
            	at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:271)
            	at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:240)
            	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
            	at java.util.ArrayList.forEach(ArrayList.java:1259)
            	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
            	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
            	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483)
            	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
            	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
            	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
            	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
            	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
            	at jadx.core.codegen.ClassGen.addInnerClsAndMethods(ClassGen.java:236)
            	at jadx.core.codegen.ClassGen.addClassBody(ClassGen.java:227)
            	at jadx.core.codegen.InsnGen.inlineAnonymousConstructor(InsnGen.java:676)
            	at jadx.core.codegen.InsnGen.makeConstructor(InsnGen.java:607)
            	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:364)
            	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:231)
            	at jadx.core.codegen.InsnGen.addWrappedArg(InsnGen.java:123)
            	at jadx.core.codegen.InsnGen.addArg(InsnGen.java:107)
            	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:314)
            	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:250)
            	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:221)
            	at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:109)
            	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:55)
            	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:92)
            	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:58)
            	at jadx.core.codegen.MethodGen.addRegionInsns(MethodGen.java:211)
            	at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:204)
            	at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:318)
            	at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:271)
            	at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:240)
            	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
            	at java.util.ArrayList.forEach(ArrayList.java:1259)
            	at java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
            	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
            	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483)
            	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
            	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
            	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
            	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
            	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
            	at jadx.core.codegen.ClassGen.addInnerClsAndMethods(ClassGen.java:236)
            	at jadx.core.codegen.ClassGen.addClassBody(ClassGen.java:227)
            	at jadx.core.codegen.ClassGen.addClassCode(ClassGen.java:112)
            	at jadx.core.codegen.ClassGen.makeClass(ClassGen.java:78)
            	at jadx.core.codegen.CodeGen.wrapCodeGen(CodeGen.java:44)
            	at jadx.core.codegen.CodeGen.generateJavaCode(CodeGen.java:33)
            	at jadx.core.codegen.CodeGen.generate(CodeGen.java:21)
            	at jadx.core.ProcessClass.generateCode(ProcessClass.java:61)
            	at jadx.core.dex.nodes.ClassNode.decompile(ClassNode.java:273)
            
*/
        };
    }

    public boolean isPlayerPreferchCaption() {
        return C03657du.LIZJ();
    }

    public boolean isPlayerPreferchTtsAudio() {
        return C03657du.LIZIZ();
    }

    public boolean isCache(C16758Di r2) {
        return C03347cp.LIZIZ().LIZ(r2);
    }

    public static File INVOKEVIRTUAL_com_ss_android_ugc_aweme_video_simplayer_PlayerConfigImpl_com_ss_android_ugc_aweme_lancet_ContextLancet_getCacheDir(Context context) {
        if (4Ms.LIZIZ != null && 4Ms.LJ) {
            return 4Ms.LIZIZ;
        }
        File cacheDir = context.getCacheDir();
        4Ms.LIZIZ = cacheDir;
        return cacheDir;
    }

    public String getThumbCacheDir(Context context) {
        File LIZIZ;
        if (!AnonymousClass805.LJ()) {
            LIZIZ = INVOKEVIRTUAL_com_ss_android_ugc_aweme_video_simplayer_PlayerConfigImpl_com_ss_android_ugc_aweme_lancet_ContextLancet_getCacheDir(context);
            if (C20548Rx.LIZ()) {
                LIZIZ = C20548Rx.LIZIZ(context, AnonymousClass8RT.PREFER_PRIVATE);
            }
        } else {
            LIZIZ = AnonymousClass805.LIZIZ(context);
            if (C20548Rx.LIZ()) {
                LIZIZ = C20548Rx.LIZIZ(context, AnonymousClass8RT.PREFER_EXTERNAL);
            }
        }
        File file = new File(LIZIZ, "cache/thumbs");
        if (!file.exists()) {
            file.mkdirs();
        }
        return file.getAbsolutePath();
    }

    public boolean isHttpsVideoUrlModel(C16758Di r5) {
        List<String> urlList;
        if (r5 == null || (urlList = r5.getUrlList()) == null || urlList.size() <= 0) {
            return false;
        }
        for (String isCookieSharedUrl : urlList) {
            if (!isCookieSharedUrl(AnonymousClass7dQ.LIZ, isCookieSharedUrl)) {
                return false;
            }
        }
        return true;
    }

    public AnonymousClass8ES getISimPlayerPlaySessionConfig(boolean z) {
        boolean z2;
        boolean z3;
        boolean z4;
        boolean z5;
        boolean z6;
        boolean z7;
        boolean z8;
        boolean z9;
        AnonymousClass8ES r4 = new AnonymousClass8ES();
        if (C18618Km.LIZ == null) {
            C18618Km.LIZ = new MDV();
        }
        r4.LIZLLL = z;
        boolean z10 = false;
        if (!C03657du.LJ() || !C03657du.LIZLLL()) {
            r4.LJI = AnonymousClass9Y3.LIZ(AnonymousClass9Y3.LIZ(), true, "player_v3_pool_max_size", 5);
            r4.LJII = AnonymousClass9Y3.LIZ(AnonymousClass9Y3.LIZ(), true, "player_v3_pool_core_size", 3);
            if (!C03657du.LJFF() || AnonymousClass9Y3.LIZ(AnonymousClass9Y3.LIZ(), true, "player_v3_session_reuse_enable", 0) != 1) {
                z2 = false;
            } else {
                z2 = true;
            }
            r4.LJ = z2;
            if (!C03657du.LJFF() || C18618Km.LIZ.LIZLLL() != 1) {
                z3 = false;
            } else {
                z3 = true;
            }
            r4.LJIIIZ = z3;
            r4.LJIIIIZZ = AnonymousClass9Y3.LIZ(AnonymousClass9Y3.LIZ(), true, "player_v3_session_pool_size", 1);
        } else {
            r4.LJI = AnonymousClass9Y3.LIZ(AnonymousClass9Y3.LIZ(), true, "player_v3_mtk_pool_max_size", 5);
            r4.LJII = AnonymousClass9Y3.LIZ(AnonymousClass9Y3.LIZ(), true, "player_v3_mtk_pool_core_size", 3);
            if (!C03657du.LJFF() || C18618Km.LIZ.LIZ() != 1) {
                z7 = false;
            } else {
                z7 = true;
            }
            r4.LJ = z7;
            r4.LJIIIIZZ = C18618Km.LIZ.LIZIZ();
            if (C18618Km.LIZ.LIZJ() == 1) {
                z8 = true;
            } else {
                z8 = false;
            }
            r4.LJIILL = z8;
            if (!C03657du.LJFF() || C18618Km.LIZ.LIZLLL() != 1) {
                z9 = false;
            } else {
                z9 = true;
            }
            r4.LJIIIZ = z9;
            r4.LJIILJJIL = true;
        }
        if (AnonymousClass9Y3.LIZ(AnonymousClass9Y3.LIZ(), true, "player_v3_session_reuse_codec_type_enable", 0) == 1) {
            z4 = true;
        } else {
            z4 = false;
        }
        r4.LJFF = z4;
        if (AnonymousClass9Y3.LIZ(AnonymousClass9Y3.LIZ(), true, "player_v3_single_reuse_h264_enable", 0) == 1) {
            z5 = true;
        } else {
            z5 = false;
        }
        r4.LJIIJJI = z5;
        if (C18618Km.LIZ.LJ() == 1) {
            z6 = true;
        } else {
            z6 = false;
        }
        r4.LJIILIIL = z6;
        if (!z) {
            if (C18618Km.LIZ.LJFF() == 1) {
                z10 = true;
            }
            r4.LJIILLIIL = z10;
        }
        if (AnonymousClass9YM.LIZ()) {
            AnonymousClass7e1.LIZ("SimPlayerBuilder", "PlayerManager con singleThreadMode:" + r4.LIZLLL + ", maxPoolSize:" + r4.LJI + ", corePoolSize:" + r4.LJII + ", enableSessionPool:" + r4.LJ + ", sessionPoolSize:" + r4.LJIIIIZZ + ", enableSameCodecSessionReuse:" + r4.LJFF + ", enableH264SingleSessionReuse:" + r4.LJIIJJI + ", enableSessionReuseRefactor:" + r4.LJIILIIL);
        }
        return r4;
    }

    public AnonymousClass8YM getProperResolution(String str, C16738Dg r3) {
        return C03417cw.LIZ().LJI().LIZ(str, r3);
    }

    public C16758Di getVideoPlayAddr(C16798Dm r2, C03387ct r3) {
        if (r2 == null) {
            return null;
        }
        if (shouldPlayInBytevc1(r2, r3)) {
            return r2.getPlayAddrBytevc1();
        }
        return r2.getPlayAddrH264();
    }

    public boolean shouldPlayInBytevc1(C16798Dm r2, C03387ct r3) {
        if (!AnonymousClass7e2.LIZ((C16248Bj) r2.getPlayAddrBytevc1()) || !AnonymousClass7e2.LIZ(r3)) {
            return false;
        }
        return true;
    }

    public boolean isCookieSharedUrl(Context context, String str) {
        if (!TextUtils.isEmpty(str) && str.startsWith("https://")) {
            try {
                if (C53279iI.LIZ(context).LIZLLL(URI.create(str).getHost()) != null) {
                    return true;
                }
            } catch (Exception unused) {
            }
        }
        return false;
    }

    public void recordMiscLog(Context context, String str, JSONObject jSONObject) {
        AppLog.recordMiscLog(context, str, jSONObject);
    }

    public C18608Kl getPlayerConfig(C03387ct r2, boolean z, boolean z2) {
        return C18618Km.LIZ(r2, z, z2);
    }

    private JSONObject getPrepareOrFirstFrameExtraJSON(long j, boolean z, int i) {
        2aZ r2 = new 2aZ();
        r2.LIZ("duration", String.valueOf(j));
        r2.LIZ("is_cache", Boolean.valueOf(z));
        r2.LIZ("bytevc1", Boolean.valueOf(C17658Gu.LIZ(i)));
        r2.LIZ("video_duration", Long.valueOf(C03507df.LJJJI().LJIIIZ()));
        C00727Sn.LIZ(r2);
        return r2.LIZ();
    }

    public void onRecordPrepareTime(String str, long j, String str2, boolean z, int i) {
        C403195y.LIZ(str, getPrepareOrFirstFrameExtraJSON(j, z, i));
    }

    public void onRecordFirstFrameTime(String str, long j, String str2, boolean z, int i) {
        MobClick obtain = MobClick.obtain();
        obtain.setEventName(str2);
        obtain.setLabelName("perf_monitor");
        obtain.setExtValueLong(j);
        2nK.onEvent(obtain);
        C403195y.LIZ(str, getPrepareOrFirstFrameExtraJSON(j, z, i));
    }
}
