FacePro.apk(点击下载) / a.java


package com.tencent.liteav;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.SurfaceTexture;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Surface;
import android.view.TextureView;
import com.huawei.hms.framework.common.ContainerUtils;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.tencent.liteav.base.ContextUtils;
import com.tencent.liteav.base.datareport.Event4XReporter;
import com.tencent.liteav.base.system.LiteavSystemInfo;
import com.tencent.liteav.base.util.LiteavLog;
import com.tencent.liteav.base.util.TimeUtil;
import com.tencent.liteav.base.util.r;
import com.tencent.liteav.base.util.t;
import com.tencent.liteav.sdk.common.LicenseChecker;
import com.tencent.liteav.txcplayer.ITXVCubePlayer;
import com.tencent.liteav.txcplayer.common.VodPlayerControl;
import com.tencent.liteav.txcplayer.ext.service.RenderProcessService;
import com.tencent.liteav.txcplayer.model.b;
import com.tencent.liteav.txcvodplayer.TXCVodVideoView;
import com.tencent.liteav.txcvodplayer.hlsencoder.TXCHLSEncoder;
import com.tencent.liteav.txcvodplayer.renderer.TextureRenderView;
import com.tencent.liteav.txcvodplayer.renderer.c;
import com.tencent.liteav.txcvodplayer.renderer.d;
import com.tencent.liteav.txcvodplayer.renderer.e;
import com.tencent.liteav.txcvodplayer.renderer.h;
import com.tencent.liteav.videobase.base.GLConstants;
import com.tencent.liteav.videobase.frame.PixelFrame;
import com.tencent.liteav.videobase.utils.Rotation;
import com.tencent.liteav.videobase.videobase.g;
import com.tencent.rtmp.ITXLivePlayListener;
import com.tencent.rtmp.ITXVodPlayListener;
import com.tencent.rtmp.TXPlayInfoParams;
import com.tencent.rtmp.TXPlayerDrmBuilder;
import com.tencent.rtmp.TXTrackInfo;
import com.tencent.rtmp.TXVodConstants;
import com.tencent.rtmp.TXVodPlayConfig;
import com.tencent.rtmp.TXVodPlayer;
import com.tencent.rtmp.ui.TXCloudVideoView;
import com.tencent.rtmp.ui.TXSubtitleView;
import com.tencent.thumbplayer.api.TPSubtitleFrameBuffer;
import com.tencent.thumbplayer.api.TPTrackInfo;
import com.tencent.trtc.TRTCCloudDef;
import com.tencent.ugc.datereport.UGCDataReportDef;
import com.tencent.ugc.videoprocessor.watermark.data.AnimatedPasterJsonConfig;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.microedition.khronos.egl.EGLContext;

public final class a implements d.a {
    public d A;
    public Object B;
    public TXSubtitleView C;
    private Context D = null;
    private float E = 1.0f;
    private int F = ITXVCubePlayer.INITIAL_BITRATE_INDEX_VALUE;
    private int G;
    private int H;
    private C0129a I;
    private boolean J;
    private boolean K;
    private c L;
    private com.tencent.liteav.txcplayer.d M = new com.tencent.liteav.txcplayer.d() {
        /* class com.tencent.liteav.a.AnonymousClass3 */

        /* JADX WARNING: Code restructure failed: missing block: B:112:0x0307, code lost:
            if (r12.f8274a.f8253h == false) goto L_0x0277;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:90:0x0275, code lost:
            if (r12.f8274a.f8253h == false) goto L_0x0277;
         */
        @Override // com.tencent.liteav.txcplayer.d
        public final void a(int i10, Bundle bundle) {
            String str;
            com.tencent.liteav.txcvodplayer.a.a aVar;
            String str2;
            String str3;
            int i11;
            com.tencent.liteav.txcvodplayer.a.a aVar2;
            int i12;
            int i13;
            String str4;
            Bundle bundle2 = new Bundle(bundle);
            int i14 = -6101;
            if (i10 != -6101) {
                i14 = -2301;
                if (i10 != -2301) {
                    if (i10 == 2011) {
                        bundle2.putInt("EVT_PARAM1", a.this.f8250e.getMetaRotationDegree());
                    } else if (!(i10 == 2026 || i10 == 2103)) {
                        if (i10 != 2106) {
                            if (i10 != 2013) {
                                boolean z10 = true;
                                int i15 = 0;
                                if (i10 != 2014) {
                                    switch (i10) {
                                        case -2305:
                                            aVar2 = a.this.f8252g;
                                            i11 = -2305;
                                            str3 = "HLS decrypt key error";
                                            aVar2.a(i11, str3);
                                            break;
                                        case -2304:
                                            a.this.f8252g.a(-2304, "h265 decode failed");
                                            break;
                                        case -2303:
                                            aVar2 = a.this.f8252g;
                                            i11 = -2303;
                                            str3 = "file not found";
                                            aVar2.a(i11, str3);
                                            break;
                                        default:
                                            switch (i10) {
                                                case 2003:
                                                    LiteavLog.i("TXCVodPlayer", "util onPlayEvent VOD_PLAY_EVT_RCV_FIRST_I_FRAME");
                                                    a.this.f8252g.d();
                                                    if (a.this.f8253h) {
                                                        z10 = false;
                                                    } else {
                                                        a.this.f8253h = true;
                                                        com.tencent.liteav.txcvodplayer.a.a aVar3 = a.this.f8252g;
                                                        LiteavLog.i("TXCVodPlayCollection", "renderStart");
                                                        if (aVar3.f9014l == 0) {
                                                            aVar3.f9014l = (int) (System.currentTimeMillis() - aVar3.f9006d);
                                                        }
                                                        Bundle bundle3 = new Bundle();
                                                        bundle3.putInt(TXVodConstants.EVT_ID, 2008);
                                                        bundle3.putLong("EVT_TIME", TimeUtil.a());
                                                        bundle3.putLong("EVT_UTC_TIME", TimeUtil.b());
                                                        b mediaInfo = a.this.f8250e.getMediaInfo();
                                                        if (mediaInfo == null || (str4 = mediaInfo.f8935c) == null || !str4.toLowerCase().contains("hevc")) {
                                                            bundle3.putCharSequence("description", a.this.f8256k ? "Enables hardware decoding" : "Enables software decoding");
                                                            i12 = 0;
                                                        } else {
                                                            bundle3.putCharSequence("description", a.this.f8256k ? "Enables hardware decoding H265" : "Enables software decoding h265");
                                                            i12 = 1;
                                                        }
                                                        bundle3.putInt("EVT_PARAM1", a.this.f8256k ? 1 : 2);
                                                        bundle3.putInt(TXVodConstants.EVT_CODEC_TYPE, i12);
                                                        if (a.this.f8256k) {
                                                            i13 = i12 == 0 ? 1 : 3;
                                                        } else {
                                                            if (i12 != 0) {
                                                                i15 = 2;
                                                            }
                                                            i13 = i15;
                                                        }
                                                        a.this.f8252g.f9023u = i13;
                                                        a(2008, bundle3);
                                                    }
                                                    if (!z10) {
                                                        return;
                                                    }
                                                    break;
                                                case 2004:
                                                    str2 = "util onPlayEvent VOD_PLAY_EVT_PLAY_BEGIN";
                                                    break;
                                                case 2005:
                                                    com.tencent.liteav.txcvodplayer.a.a aVar4 = a.this.f8252g;
                                                    int i16 = bundle.getInt("EVT_PLAY_DURATION", 0);
                                                    int i17 = bundle.getInt("EVT_PLAY_PROGRESS", 0);
                                                    aVar4.f9011i = i16;
                                                    int a10 = i17 / com.tencent.liteav.txcvodplayer.a.b.a(aVar4.f9003a).a(aVar4.A);
                                                    if (a10 != aVar4.f9012j) {
                                                        aVar4.f9012j = a10;
                                                        if (!aVar4.f9008f) {
                                                            aVar4.b();
                                                            break;
                                                        }
                                                    }
                                                    break;
                                                case 2006:
                                                    a.this.f8252g.c();
                                                    if (a.this.f8270y) {
                                                        Bundle bundle4 = new Bundle();
                                                        bundle4.putString("EVT_MSG", "loop once playback complete");
                                                        a.this.a((a) 6001, (int) bundle4);
                                                        a.this.f8250e.a();
                                                        a.this.f8252g.a(true);
                                                        LiteavLog.d("TXCVodPlayer", "loop play");
                                                        return;
                                                    }
                                                    break;
                                                case 2007:
                                                    com.tencent.liteav.txcvodplayer.a.a aVar5 = a.this.f8252g;
                                                    if (!aVar5.f9018p && aVar5.f9014l != 0 && !aVar5.f9010h) {
                                                        aVar5.f9007e = System.currentTimeMillis();
                                                        aVar5.f9019q = true;
                                                        LiteavLog.i("TXCVodPlayCollection", "setLoadBegin mBeginLoadTS= " + aVar5.f9007e);
                                                        break;
                                                    }
                                                case 2008:
                                                    break;
                                                case 2009:
                                                    if (a.this.A != null) {
                                                        d dVar = a.this.A;
                                                        dVar.a(h.a(dVar, a.this.f8250e.getVideoWidth(), a.this.f8250e.getVideoHeight()), "setVideoSize");
                                                        break;
                                                    }
                                                    break;
                                                default:
                                                    switch (i10) {
                                                        case TXVodConstants.VOD_PLAY_EVT_TCP_CONNECT_SUCC /*{ENCODED_INT: 2016}*/:
                                                            LiteavLog.i("TXCVodPlayer", "util play tcp connect success");
                                                            com.tencent.liteav.txcvodplayer.a.a aVar6 = a.this.f8252g;
                                                            if (aVar6.f9024v == 0) {
                                                                aVar6.f9024v = (int) (System.currentTimeMillis() - aVar6.f9005c);
                                                                LiteavLog.i("TXCVodPlayCollection", "mTcpConnectTS = " + aVar6.f9024v + ", mOriginBeginPlayTS = " + aVar6.f9005c + ", " + System.currentTimeMillis());
                                                                return;
                                                            }
                                                            return;
                                                        case TXVodConstants.VOD_PLAY_EVT_FIRST_VIDEO_PACKET /*{ENCODED_INT: 2017}*/:
                                                            LiteavLog.i("TXCVodPlayer", "util play first video packet");
                                                            com.tencent.liteav.txcvodplayer.a.a aVar7 = a.this.f8252g;
                                                            if (aVar7.f9026x == 0) {
                                                                aVar7.f9026x = (int) (System.currentTimeMillis() - aVar7.f9006d);
                                                                return;
                                                            }
                                                            return;
                                                        case TXVodConstants.VOD_PLAY_EVT_DNS_RESOLVED /*{ENCODED_INT: 2018}*/:
                                                            LiteavLog.i("TXCVodPlayer", "util play dns resolved");
                                                            com.tencent.liteav.txcvodplayer.a.a aVar8 = a.this.f8252g;
                                                            if (aVar8.f9025w == 0) {
                                                                aVar8.f9025w = (int) (System.currentTimeMillis() - aVar8.f9005c);
                                                                return;
                                                            }
                                                            return;
                                                        case TXVodConstants.VOD_PLAY_EVT_SEEK_COMPLETE /*{ENCODED_INT: 2019}*/:
                                                        case TXVodConstants.VOD_PLAY_EVT_SELECT_TRACK_COMPLETE /*{ENCODED_INT: 2020}*/:
                                                            break;
                                                        default:
                                                            LiteavLog.d("TXCVodPlayer", "miss match event ".concat(String.valueOf(i10)));
                                                            return;
                                                    }
                                            }
                                            break;
                                    }
                                } else {
                                    com.tencent.liteav.txcvodplayer.a.a aVar9 = a.this.f8252g;
                                    if (!aVar9.f9018p && aVar9.f9014l != 0 && !aVar9.f9010h) {
                                        LiteavLog.i("TXCVodPlayCollection", "setLoadEnd mFirstFrame=" + aVar9.f9014l + " , mIsLoading = " + aVar9.f9019q + ",mBeginLoadTS = " + aVar9.f9007e);
                                        if (aVar9.f9019q) {
                                            int currentTimeMillis = (int) (System.currentTimeMillis() - aVar9.f9007e);
                                            aVar9.f9016n += currentTimeMillis;
                                            aVar9.f9015m++;
                                            if (aVar9.f9017o < currentTimeMillis) {
                                                aVar9.f9017o = currentTimeMillis;
                                            }
                                            aVar9.f9019q = false;
                                        }
                                    }
                                    if (aVar9.f9018p) {
                                        aVar9.f9018p = false;
                                    }
                                    a.this.f8252g.d();
                                }
                            } else {
                                str2 = "util onPlayEvent VOD_PLAY_EVT_VOD_PLAY_PREPARED";
                            }
                            LiteavLog.i("TXCVodPlayer", str2);
                        }
                        a.this.f8256k = false;
                        a aVar10 = a.this;
                        aVar10.a(aVar10.f8251f);
                    }
                    bundle2.putString("EVT_MSG", bundle.getString("description", ""));
                    a.this.a((a) i10, (int) bundle2);
                }
                aVar = a.this.f8252g;
                str = "network disconnect, has retry reconnect, but still failed!";
            } else {
                aVar = a.this.f8252g;
                str = bundle.getString("description", "");
            }
            aVar.a(i14, str);
            bundle2.putString("EVT_MSG", bundle.getString("description", ""));
            a.this.a((a) i10, (int) bundle2);
        }

        @Override // com.tencent.liteav.txcplayer.d
        public final void a(Bundle bundle) {
            Bundle bundle2 = new Bundle();
            int[] a10 = t.a();
            bundle2.putCharSequence("CPU_USAGE", a10[0] + "%");
            bundle2.putInt("VIDEO_FPS", (int) bundle.getFloat("fps"));
            bundle2.putInt("VIDEO_DPS", (int) bundle.getFloat("dps"));
            bundle2.putInt("NET_SPEED", ((int) bundle.getLong("tcpSpeed")) / 1000);
            bundle2.putInt("VIDEO_CACHE", ((int) bundle.getLong("cachedBytes")) / 1000);
            bundle2.putInt("VIDEO_WIDTH", a.this.f8250e.getVideoWidth());
            bundle2.putInt("VIDEO_HEIGHT", a.this.f8250e.getVideoHeight());
            bundle2.putString("SERVER_IP", a.this.f8250e.getServerIp());
            com.tencent.liteav.txcvodplayer.a.a aVar = a.this.f8252g;
            String serverIp = a.this.f8250e.getServerIp();
            aVar.f9027y = serverIp;
            if (serverIp == null) {
                aVar.f9027y = "";
            }
            a.this.a((a) 15001, (int) bundle2);
        }
    };
    private ITXVCubePlayer.b N = new ITXVCubePlayer.b() {
        /* class com.tencent.liteav.a.AnonymousClass4 */

        @Override // com.tencent.liteav.txcplayer.ITXVCubePlayer.b
        public final void a(ITXVCubePlayer iTXVCubePlayer, TPSubtitleFrameBuffer tPSubtitleFrameBuffer) {
            Bitmap bitmap;
            if (a.this.L == null) {
                a.this.L = new c();
            }
            c cVar = a.this.L;
            if (tPSubtitleFrameBuffer == null) {
                LiteavLog.i("SubtitleRender", "[renderToBitmap] subtitleFrameBuffer is null");
                bitmap = null;
            } else {
                LiteavLog.i("SubtitleRender", "[renderToBitmap] subtitleFrameBuffer, trackId: " + tPSubtitleFrameBuffer.trackID + " ,width: " + tPSubtitleFrameBuffer.getSrcWidth() + ", height: " + tPSubtitleFrameBuffer.getSrcHeight());
                Bitmap bitmap2 = cVar.f9175a;
                if (!(bitmap2 != null && bitmap2.getWidth() == tPSubtitleFrameBuffer.getSrcWidth() && cVar.f9175a.getHeight() == tPSubtitleFrameBuffer.getSrcHeight())) {
                    cVar.f9175a = Bitmap.createBitmap(tPSubtitleFrameBuffer.getSrcWidth(), tPSubtitleFrameBuffer.getSrcHeight(), Bitmap.Config.ARGB_8888);
                }
                cVar.f9175a.copyPixelsFromBuffer(ByteBuffer.wrap(tPSubtitleFrameBuffer.getData()[0]));
                bitmap = cVar.f9175a;
            }
            if (a.this.C != null) {
                a.this.C.show(bitmap);
            }
        }
    };

    /* renamed from: a  reason: collision with root package name */
    public TXCloudVideoView f8246a = null;

    /* renamed from: b  reason: collision with root package name */
    public ITXLivePlayListener f8247b;

    /* renamed from: c  reason: collision with root package name */
    public ITXVodPlayListener f8248c;

    /* renamed from: d  reason: collision with root package name */
    public WeakReference<TXVodPlayer> f8249d;

    /* renamed from: e  reason: collision with root package name */
    public TXCVodVideoView f8250e;

    /* renamed from: f  reason: collision with root package name */
    public TXVodPlayConfig f8251f;

    /* renamed from: g  reason: collision with root package name */
    public com.tencent.liteav.txcvodplayer.a.a f8252g = null;

    /* renamed from: h  reason: collision with root package name */
    public boolean f8253h;

    /* renamed from: i  reason: collision with root package name */
    public boolean f8254i = true;

    /* renamed from: j  reason: collision with root package name */
    public boolean f8255j = true;

    /* renamed from: k  reason: collision with root package name */
    public boolean f8256k = true;

    /* renamed from: l  reason: collision with root package name */
    public Surface f8257l;

    /* renamed from: m  reason: collision with root package name */
    public boolean f8258m = false;

    /* renamed from: n  reason: collision with root package name */
    public String f8259n;

    /* renamed from: o  reason: collision with root package name */
    public final Map<String, Object> f8260o;

    /* renamed from: p  reason: collision with root package name */
    public boolean f8261p = false;

    /* renamed from: q  reason: collision with root package name */
    public TXPlayInfoParams f8262q;

    /* renamed from: r  reason: collision with root package name */
    public String f8263r;

    /* renamed from: s  reason: collision with root package name */
    public String f8264s;

    /* renamed from: t  reason: collision with root package name */
    public String f8265t = "";

    /* renamed from: u  reason: collision with root package name */
    public boolean f8266u = false;

    /* renamed from: v  reason: collision with root package name */
    public int f8267v = -1;

    /* renamed from: w  reason: collision with root package name */
    public com.tencent.liteav.txcvodplayer.b.d f8268w;

    /* renamed from: x  reason: collision with root package name */
    public boolean f8269x;

    /* renamed from: y  reason: collision with root package name */
    public boolean f8270y;

    /* renamed from: z  reason: collision with root package name */
    protected float f8271z;

    /* renamed from: com.tencent.liteav.a$a  reason: collision with other inner class name */
    static class C0129a {

        /* renamed from: a  reason: collision with root package name */
        Class f8279a;

        /* renamed from: b  reason: collision with root package name */
        Class f8280b;

        /* renamed from: c  reason: collision with root package name */
        Class f8281c;

        /* renamed from: d  reason: collision with root package name */
        Field f8282d;

        /* renamed from: e  reason: collision with root package name */
        Field f8283e;

        /* renamed from: f  reason: collision with root package name */
        Field f8284f;

        /* renamed from: g  reason: collision with root package name */
        Field f8285g;

        /* renamed from: h  reason: collision with root package name */
        Field f8286h;

        /* renamed from: i  reason: collision with root package name */
        Field f8287i;

        /* renamed from: j  reason: collision with root package name */
        Field f8288j;

        /* renamed from: k  reason: collision with root package name */
        Field f8289k;

        /* renamed from: l  reason: collision with root package name */
        Field f8290l;

        public C0129a(Object obj) {
            try {
                this.f8279a = obj.getClass();
                this.f8280b = TRTCCloudDef.TRTCTexture.class;
                this.f8281c = TRTCCloudDef.TRTCVideoFrame.class;
                this.f8282d = TRTCCloudDef.TRTCTexture.class.getDeclaredField("textureId");
                this.f8283e = this.f8280b.getDeclaredField("eglContext10");
                this.f8285g = this.f8281c.getDeclaredField("texture");
                this.f8286h = this.f8281c.getDeclaredField(AnimatedPasterJsonConfig.CONFIG_WIDTH);
                this.f8287i = this.f8281c.getDeclaredField(AnimatedPasterJsonConfig.CONFIG_HEIGHT);
                this.f8288j = this.f8281c.getDeclaredField("pixelFormat");
                this.f8289k = this.f8281c.getDeclaredField("bufferType");
                this.f8290l = this.f8281c.getDeclaredField("timestamp");
                if (LiteavSystemInfo.getSystemOSVersionInt() >= 17) {
                    this.f8284f = this.f8280b.getDeclaredField("eglContext14");
                }
            } catch (Exception e10) {
                LiteavLog.e("TXCVodPlayer", "init TRTCCloudClassInvokeWrapper error ", e10);
            }
        }
    }

    static {
        r.a();
    }

    public a(Context context) {
        if (context != null) {
            Context applicationContext = context.getApplicationContext();
            this.D = applicationContext;
            ContextUtils.initApplicationContext(applicationContext);
            ContextUtils.setDataDirectorySuffix("liteav");
        }
        this.f8260o = new HashMap();
        this.f8247b = null;
        this.f8248c = null;
        RenderProcessService.getInstance().checkInit(context.getApplicationContext());
        TXCVodVideoView tXCVodVideoView = new TXCVodVideoView(context);
        this.f8250e = tXCVodVideoView;
        tXCVodVideoView.setListener(this.M);
        this.f8250e.setTXCOnSubtitleFrameDataListener(this.N);
    }

    public static List<TXTrackInfo> a(List<TXTrackInfo> list, int i10) {
        ArrayList arrayList = new ArrayList();
        for (TXTrackInfo tXTrackInfo : list) {
            if (tXTrackInfo.getTrackType() == i10) {
                arrayList.add(tXTrackInfo);
            }
        }
        return arrayList;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(int i10, Bundle bundle) {
        TXVodPlayer tXVodPlayer;
        TXVodPlayer tXVodPlayer2;
        if (i10 == 15001) {
            ITXLivePlayListener iTXLivePlayListener = this.f8247b;
            if (iTXLivePlayListener != null) {
                iTXLivePlayListener.onNetStatus(bundle);
            }
            if (this.f8248c != null && (tXVodPlayer2 = this.f8249d.get()) != null) {
                this.f8248c.onNetStatus(tXVodPlayer2, bundle);
                return;
            }
            return;
        }
        ITXLivePlayListener iTXLivePlayListener2 = this.f8247b;
        if (iTXLivePlayListener2 != null) {
            iTXLivePlayListener2.onPlayEvent(i10, bundle);
        }
        if (this.f8248c != null && (tXVodPlayer = this.f8249d.get()) != null) {
            this.f8248c.onPlayEvent(tXVodPlayer, i10, bundle);
        }
    }

    public static void a(TXCloudVideoView tXCloudVideoView, int i10) {
        if (tXCloudVideoView != null) {
            tXCloudVideoView.setVisibility(i10);
            TextureView a10 = g.a(tXCloudVideoView);
            if (a10 != null) {
                a10.setVisibility(i10);
            }
        }
    }

    private static void a(List<TXTrackInfo> list, TPTrackInfo[] tPTrackInfoArr) {
        for (int i10 = 0; i10 < tPTrackInfoArr.length; i10++) {
            TPTrackInfo tPTrackInfo = tPTrackInfoArr[i10];
            TXTrackInfo tXTrackInfo = new TXTrackInfo();
            tXTrackInfo.trackIndex = i10;
            tXTrackInfo.trackType = tPTrackInfo.trackType;
            tXTrackInfo.name = tPTrackInfo.name;
            tXTrackInfo.isSelected = tPTrackInfo.isSelected;
            tXTrackInfo.isExclusive = tPTrackInfo.isExclusive;
            tXTrackInfo.isInternal = tPTrackInfo.isInternal;
            list.add(tXTrackInfo);
        }
    }

    public static String b(String str) {
        return TXCHLSEncoder.a(str);
    }

    private String c(String str) {
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        String str7;
        boolean z10;
        int i10;
        boolean z11;
        String[] split;
        String str8 = str;
        boolean contains = str8.contains("&oversign=");
        boolean z12 = false;
        String str9 = ContainerUtils.KEY_VALUE_DELIMITER;
        boolean z13 = true;
        if (contains && str8.contains("&oversign=")) {
            int indexOf = str8.indexOf("&oversign=");
            int lastIndexOf = str8.lastIndexOf("&oversign=");
            String substring = str8.substring(indexOf + 1, lastIndexOf);
            if (!TextUtils.isEmpty(substring) && (split = substring.split(ContainerUtils.FIELD_DELIMITER)) != null && split.length == 6 && !TextUtils.isEmpty(split[4].split(str9)[1]) && !TextUtils.isEmpty(split[5].split(str9)[1])) {
                String a10 = TXCHLSEncoder.a(Integer.valueOf(split[0].split(str9)[1]).intValue(), split[1].split(str9)[1], split[2].split(str9)[1], Integer.valueOf(split[3].split(str9)[1]).intValue());
                a(TXCHLSEncoder.b(a10, split[4].split(str9)[1]), TXCHLSEncoder.b(a10, split[5].split(str9)[1]));
            }
            if (indexOf > 0 && indexOf < lastIndexOf) {
                str8 = str8.substring(0, indexOf) + str8.substring(lastIndexOf + 10);
            }
        }
        if (str8.startsWith("http")) {
            str8 = com.tencent.liteav.txcplayer.b.a.c(str8);
        }
        String trim = str8.trim();
        String str10 = this.f8259n;
        if (str10 != null) {
            trim = c(trim, str10);
        }
        Uri parse = Uri.parse(trim);
        String query = parse.getQuery();
        String str11 = "";
        if (query == null || query.isEmpty()) {
            str2 = trim;
            z12 = false;
        } else {
            String[] split2 = query.split(ContainerUtils.FIELD_DELIMITER);
            String str12 = "0";
            if (split2.length > 0) {
                int length = split2.length;
                int i11 = 0;
                int i12 = 0;
                str6 = str11;
                str5 = str6;
                str4 = str5;
                while (i11 < length) {
                    String str13 = split2[i11];
                    String[] split3 = str13.split(str9);
                    if (split3.length != 2) {
                        str7 = str9;
                        i10 = i12;
                        z11 = true;
                        z10 = false;
                        LiteavLog.e("TXCVodPlayer", "fieldIds.length != 2");
                    } else if ("spfileid".equalsIgnoreCase(split3[0])) {
                        z11 = true;
                        str11 = split3[1];
                        str7 = str9;
                        i10 = i12 + 1;
                        z10 = false;
                    } else {
                        i10 = i12;
                        z10 = false;
                        str7 = str9;
                        if ("spdrmtype".equalsIgnoreCase(split3[0])) {
                            z11 = true;
                            str6 = split3[1];
                        } else if ("spappid".equalsIgnoreCase(split3[0])) {
                            z11 = true;
                            str5 = split3[1];
                        } else {
                            z11 = true;
                            if (!str4.isEmpty()) {
                                str4 = str4 + ContainerUtils.FIELD_DELIMITER;
                            }
                            str4 = str4 + str13;
                        }
                        i10++;
                    }
                    i11++;
                    z13 = z11;
                    z12 = z10;
                    str9 = str7;
                    trim = trim;
                    i12 = i10;
                    split2 = split2;
                }
                str2 = trim;
                if (i12 == 3) {
                    str12 = PushConstants.PUSH_TYPE_THROUGH_MESSAGE;
                    z12 = z13;
                } else {
                    z12 = z12;
                }
            } else {
                str2 = trim;
                str6 = str11;
                str5 = str6;
                str4 = str5;
            }
            if (z12) {
                LiteavLog.d("TXCVodPlayer", "spfileid, " + str11 + ", spdrmtype= " + str6 + ", spappid=" + str5);
                com.tencent.liteav.txcvodplayer.a.a aVar = this.f8252g;
                aVar.f9022t = str11;
                aVar.f9028z = str6;
                if (TextUtils.isEmpty(aVar.A)) {
                    aVar.A = str5;
                }
                this.f8252g.f9021s = str12;
            }
            str11 = str4;
        }
        if (z12) {
            str3 = parse.buildUpon().clearQuery().build().toString();
            if (!str11.isEmpty()) {
                str3 = Uri.decode(parse.buildUpon().clearQuery().query(str11).build().toString());
            }
        } else {
            str3 = str2;
        }
        LiteavLog.i("TXCVodPlayer", "parsePlayUrl url: ".concat(String.valueOf(str3)));
        return str3;
    }

    /* access modifiers changed from: private */
    public static String c(String str, String str2) {
        String path;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (TextUtils.isEmpty(str2) || (path = Uri.parse(str).getPath()) == null) {
            return str;
        }
        String[] split = path.split("/");
        if (split.length <= 0) {
            return str;
        }
        int lastIndexOf = str.lastIndexOf(split[split.length - 1]);
        return str.substring(0, lastIndexOf) + "voddrm.token." + str2 + "." + str.substring(lastIndexOf);
    }

    private void c(boolean z10) {
        try {
            Object obj = this.B;
            if (obj != null) {
                obj.getClass().getDeclaredMethod("enableCustomVideoCapture", Integer.TYPE, Boolean.TYPE).invoke(obj, 2, Boolean.valueOf(z10));
            }
        } catch (Exception e10) {
            LiteavLog.e("TXCVodPlayer", "setTRTCCustomVideoCapture error ", e10);
        }
    }

    public final int a(String str) {
        boolean z10;
        TXVodPlayConfig tXVodPlayConfig;
        if (str == null || TextUtils.isEmpty(str)) {
            LiteavLog.i("TXCVodPlayer", "startPlay playUrl is empty, player=" + hashCode());
            return -1;
        }
        this.f8252g = new com.tencent.liteav.txcvodplayer.a.a(this.D);
        String c10 = c(str);
        com.tencent.liteav.txcvodplayer.a.a aVar = this.f8252g;
        LiteavLog.i("TXCVodPlayCollection", "setUrl: ".concat(String.valueOf(c10)));
        aVar.f9004b = c10;
        this.f8252g.a(this.f8255j);
        if (com.tencent.liteav.txcplayer.common.c.a() == LicenseChecker.d.OK || VodPlayerControl.getPlayerLicenceControlStrategy() == 0) {
            z10 = true;
        } else {
            LiteavLog.e("TXCVodPlayer", "startPlay error, licence check failed(-5)! click the link to apply trial licence: https://cloud.tencent.com/act/event/License .Official licence requires payment.");
            Bundle bundle = new Bundle();
            bundle.putString("EVT_MSG", "VOD_PLAY_ERR_INVALID_LICENCE(-5)");
            a(-5, bundle);
            new Event4XReporter(UGCDataReportDef.COMMAND_ID_DAU, 1004, "", true, 1).reportDau(1997, 0, "");
            this.f8252g.a();
            z10 = false;
        }
        if (!z10) {
            return -5;
        }
        this.f8265t = str;
        int i10 = this.F;
        a(false);
        this.F = i10;
        TXCloudVideoView tXCloudVideoView = this.f8246a;
        if (tXCloudVideoView != null) {
            tXCloudVideoView.clearLog();
            this.f8246a.setVisibility(0);
            if (g.a(this.f8246a) == null) {
                TextureRenderView textureRenderView = new TextureRenderView(this.f8246a.getContext());
                this.f8246a.addVideoView(textureRenderView);
                this.f8250e.setTextureRenderView(textureRenderView);
            }
            a(this.f8246a, 0);
        } else {
            Surface surface = this.f8257l;
            if (surface != null) {
                this.f8250e.setRenderSurface(surface);
            }
        }
        d dVar = this.A;
        if (dVar != null) {
            dVar.a(e.a(dVar), "Start");
        }
        if (TextUtils.isEmpty(com.tencent.liteav.txcplayer.common.b.a()) && (tXVodPlayConfig = this.f8251f) != null) {
            com.tencent.liteav.txcplayer.common.b.a(tXVodPlayConfig.getCacheFolderPath());
        }
        a(this.f8251f);
        this.f8250e.setPrivateConfig(this.f8260o);
        this.f8253h = false;
        this.f8250e.setStartTime(this.f8271z);
        this.f8250e.setPlayerType(this.f8251f.getPlayerType());
        this.f8250e.b(this.f8254i);
        this.f8250e.setVideoPath(c10);
        this.f8250e.setAutoPlay(this.f8255j);
        this.f8250e.setMute(this.f8266u);
        int i11 = this.f8267v;
        if (i11 >= 0) {
            this.f8250e.setAudioPlayoutVolume(i11);
        }
        c(this.F);
        a(this.E);
        b(this.H);
        a(this.G);
        b(this.f8269x);
        this.f8250e.a();
        this.f8252g.f9020r = this.f8250e.getPlayerType();
        if (this.J) {
            b();
        }
        if (this.K) {
            d();
        }
        LiteavLog.d("TXCVodPlayer", "startPlay url=" + c10 + " player=" + hashCode());
        if (this.f8262q != null && !TextUtils.isEmpty(this.f8263r)) {
            com.tencent.liteav.txcvodplayer.c.a a10 = com.tencent.liteav.txcvodplayer.c.a.a();
            int appId = this.f8262q.getAppId();
            String fileId = this.f8262q.getFileId();
            String str2 = this.f8263r;
            String str3 = this.f8264s;
            if (TextUtils.isEmpty(fileId) || TextUtils.isEmpty(str2) || TextUtils.isEmpty(str3) || TextUtils.isEmpty(c10)) {
                LiteavLog.w("PlayInfoProtocolV4Storage", "put params empty fileId: " + fileId + " overlayKey:" + str2 + " overlayIv:" + str3 + " url:" + c10);
            } else {
                com.tencent.liteav.txcplayer.common.a.a().execute(com.tencent.liteav.txcvodplayer.c.b.a(a10, appId, fileId, c10, str2, str3));
            }
        }
        Event4XReporter event4XReporter = new Event4XReporter(UGCDataReportDef.COMMAND_ID_DAU, 1004, "", true, 1);
        event4XReporter.reportDau(1997, 0, "");
        this.f8252g.a();
        try {
            Class.forName("com.tencent.liteav.demo.play.SuperPlayerView");
            event4XReporter.reportDau(1556, 0, "");
        } catch (Exception unused) {
        }
        return 0;
    }

    public final int a(String str, String str2, String str3, String str4, String str5) {
        this.f8260o.put("TXC_DRM_KEY_URL", str2);
        this.f8260o.put("TXC_DRM_PROVISION_URL", new TXPlayerDrmBuilder().getDeviceCertificateUrl());
        this.f8260o.put("TXC_DRM_SIMPLE_AES_URL", str3);
        this.f8260o.put("TXC_DRM_ENABLE", Boolean.TRUE);
        a(str4, str5);
        return a(str);
    }

    public final int a(boolean z10) {
        this.f8258m = true;
        this.f8250e.b();
        com.tencent.liteav.txcvodplayer.b.d dVar = this.f8268w;
        if (dVar != null) {
            dVar.a(null);
            this.f8268w = null;
        }
        d dVar2 = this.A;
        if (dVar2 != null) {
            dVar2.a(true);
        }
        TXCloudVideoView tXCloudVideoView = this.f8246a;
        if (!(tXCloudVideoView == null || g.a(tXCloudVideoView) == null || !z10)) {
            a(this.f8246a, 8);
            this.f8246a.removeVideoView();
        }
        com.tencent.liteav.txcvodplayer.a.a aVar = this.f8252g;
        if (aVar != null) {
            aVar.c();
        }
        this.F = ITXVCubePlayer.INITIAL_BITRATE_INDEX_VALUE;
        c cVar = this.L;
        if (cVar != null) {
            cVar.a();
            this.L = null;
        }
        TXSubtitleView tXSubtitleView = this.C;
        if (tXSubtitleView == null) {
            return 0;
        }
        tXSubtitleView.show(null);
        return 0;
    }

    public final List<TXTrackInfo> a() {
        TPTrackInfo[] trackInfo = this.f8250e.getTrackInfo();
        if (trackInfo == null || trackInfo.length == 0) {
            return new ArrayList(0);
        }
        ArrayList arrayList = new ArrayList();
        a(arrayList, trackInfo);
        return arrayList;
    }

    public final void a(float f10) {
        this.E = f10;
        this.f8250e.setRate(f10);
        com.tencent.liteav.txcvodplayer.a.a aVar = this.f8252g;
        if (aVar != null) {
            aVar.a(f10);
        }
    }

    public final void a(int i10) {
        this.G = i10;
        if (i10 == 1) {
            this.f8250e.setRenderMode(0);
        } else {
            this.f8250e.setRenderMode(1);
        }
        d dVar = this.A;
        if (dVar != null) {
            dVar.a(GLConstants.GLScaleType.a(i10));
        }
    }

    @Override // com.tencent.liteav.txcvodplayer.renderer.d.a
    public final void a(SurfaceTexture surfaceTexture) {
        Surface surface = new Surface(surfaceTexture);
        this.f8257l = surface;
        this.f8250e.setRenderSurface(surface);
    }

    @Override // com.tencent.liteav.txcvodplayer.renderer.d.a
    public final void a(PixelFrame pixelFrame) {
        Field field;
        Object gLContext;
        Object obj;
        if (this.J) {
            try {
                if (this.I == null && (obj = this.B) != null) {
                    this.I = new C0129a(obj);
                }
                C0129a aVar = this.I;
                if (aVar != null) {
                    Object obj2 = this.B;
                    try {
                        Object newInstance = aVar.f8280b.newInstance();
                        aVar.f8282d.set(newInstance, Integer.valueOf(pixelFrame.getTextureId()));
                        if (pixelFrame.getGLContext() instanceof EGLContext) {
                            field = aVar.f8283e;
                            gLContext = pixelFrame.getGLContext();
                        } else {
                            field = aVar.f8284f;
                            gLContext = pixelFrame.getGLContext();
                        }
                        field.set(newInstance, gLContext);
                        Object newInstance2 = aVar.f8281c.newInstance();
                        aVar.f8285g.set(newInstance2, newInstance);
                        aVar.f8286h.set(newInstance2, Integer.valueOf(pixelFrame.getWidth()));
                        aVar.f8287i.set(newInstance2, Integer.valueOf(pixelFrame.getHeight()));
                        aVar.f8288j.set(newInstance2, 2);
                        aVar.f8289k.set(newInstance2, 3);
                        aVar.f8290l.set(newInstance2, 0);
                        aVar.f8279a.getDeclaredMethod("sendCustomVideoData", Integer.TYPE, newInstance2.getClass()).invoke(obj2, 2, newInstance2);
                    } catch (Exception e10) {
                        LiteavLog.e("TXCVodPlayer", "sendCustomVideoData method error ", e10);
                    }
                }
            } catch (Exception e11) {
                LiteavLog.e("TXCVodPlayer", "get enableCustomVideoCapture method error ", e11);
            }
        }
    }

    public final void a(TXVodPlayConfig tXVodPlayConfig) {
        String str;
        this.f8251f = tXVodPlayConfig;
        if (tXVodPlayConfig == null) {
            this.f8251f = new TXVodPlayConfig();
        }
        com.tencent.liteav.txcplayer.e eVar = new com.tencent.liteav.txcplayer.e();
        float connectRetryCount = (float) this.f8251f.getConnectRetryCount();
        if (connectRetryCount >= 1.0f && connectRetryCount <= 10.0f) {
            eVar.f8902a = (int) connectRetryCount;
        }
        float connectRetryInterval = (float) this.f8251f.getConnectRetryInterval();
        if (connectRetryInterval >= 3.0f && connectRetryInterval <= 30.0f) {
            eVar.f8903b = (int) connectRetryInterval;
        }
        eVar.f8904c = (int) ((float) this.f8251f.getTimeout());
        eVar.f8905d = this.f8256k;
        eVar.f8906e = this.f8251f.getCacheFolderPath();
        eVar.f8907f = this.f8251f.getMaxCacheItems();
        eVar.f8908g = this.f8251f.getPlayerType();
        eVar.f8909h = this.f8251f.getHeaders();
        eVar.f8910i = this.f8251f.isEnableAccurateSeek();
        eVar.f8911j = this.f8251f.isSmoothSwitchBitrate();
        eVar.f8912k = this.f8251f.getCacheMp4ExtName();
        eVar.f8913l = this.f8251f.getProgressInterval();
        eVar.f8914m = this.f8251f.getMaxBufferSize();
        if (this.f8262q != null || !TextUtils.isEmpty(this.f8263r)) {
            eVar.f8922u = this.f8263r;
            str = this.f8264s;
        } else {
            eVar.f8922u = this.f8251f.getOverlayKey();
            str = this.f8251f.getOverlayIv();
        }
        eVar.f8923v = str;
        eVar.f8925x = this.f8251f.getExtInfoMap();
        eVar.f8927z = this.f8251f.isEnableRenderProcess();
        eVar.f8926y = this.f8251f.isAutoRotate();
        eVar.f8920s = this.f8251f.getPreferredResolution();
        eVar.A = this.f8251f.getMediaType();
        LiteavLog.i("TXCVodPlayer", "setConfig [connectRetryCount:" + this.f8251f.getConnectRetryCount() + "(default 3 times)][connectRetryInterval:" + this.f8251f.getConnectRetryInterval() + "(default 3s,min:3s max:30s)][vodTimeout:" + this.f8251f.getTimeout() + "(default 10s)][enableHardwareDecoder:" + this.f8256k + "(default false)][cacheFolderPath for mp4/HLS:" + this.f8251f.getCacheFolderPath() + "][maxCacheItems:" + this.f8251f.getMaxCacheItems() + "][enableAccurateSeek:" + this.f8251f.isEnableAccurateSeek() + "(default true)][autoRotate:" + this.f8251f.isAutoRotate() + "(default true)][HLS smoothSwitchBitrate:" + this.f8251f.isSmoothSwitchBitrate() + "(default false)][progressInterval:" + this.f8251f.getProgressInterval() + "(default 0.5s)][preload maxBufferSize:" + this.f8251f.getMaxBufferSize() + "][mOverlayKey for HLS Encrypt:" + this.f8251f.getOverlayKey() + "][mOverlayIv for HLS Encrypt:" + this.f8251f.getOverlayIv() + "][mEnableRenderProcess:" + this.f8251f.isEnableRenderProcess() + "][mPreferredResolution:" + this.f8251f.getPreferredResolution() + "][mMediaType:" + this.f8251f.getMediaType() + "]");
        this.f8250e.setConfig(eVar);
        RenderProcessService.getInstance().setEnableRenderProcess(this.f8251f.isEnableRenderProcess());
    }

    public final void a(String str, String str2) {
        this.f8263r = str;
        this.f8264s = str2;
    }

    public final void b() {
        this.J = true;
        c(true);
    }

    public final void b(float f10) {
        this.f8271z = f10;
        this.f8250e.setStartTime(f10);
    }

    public final void b(int i10) {
        this.H = i10;
        this.f8250e.setVideoRotationDegree(i10);
        d dVar = this.A;
        if (dVar != null) {
            dVar.a(Rotation.a(i10));
        }
    }

    public final void b(boolean z10) {
        this.f8269x = z10;
        TextureView a10 = g.a(this.f8246a);
        if (a10 != null) {
            float f10 = -1.0f;
            if (!this.f8251f.isAutoRotate() || !(this.f8250e.getMetaRotationDegree() == 90 || this.f8250e.getMetaRotationDegree() == 270)) {
                if (!z10) {
                    f10 = 1.0f;
                }
                a10.setScaleX(f10);
            } else {
                if (!z10) {
                    f10 = 1.0f;
                }
                a10.setScaleY(f10);
            }
        }
        com.tencent.liteav.txcvodplayer.a.a aVar = this.f8252g;
        if (aVar != null) {
            aVar.b(z10);
        }
    }

    public final void c() {
        this.J = false;
        c(false);
    }

    public final void c(int i10) {
        com.tencent.liteav.txcvodplayer.a.a aVar;
        this.f8250e.setBitrateIndex(i10);
        this.F = i10;
        if (i10 != -1 && this.f8253h && (aVar = this.f8252g) != null) {
            aVar.c(this.f8251f.isSmoothSwitchBitrate());
        }
    }

    public final void d() {
        this.K = true;
        this.f8250e.d();
    }

    public final void e() {
        this.K = false;
        ITXVCubePlayer iTXVCubePlayer = this.f8250e.f8958c;
        if (iTXVCubePlayer != null) {
            iTXVCubePlayer.unpublishAudioToNetwork();
        }
    }

    @Override // com.tencent.liteav.txcvodplayer.renderer.d.a
    public final void f() {
        this.f8257l = null;
        this.f8250e.setRenderSurface(null);
    }

    public final void g() {
        this.f8260o.put("TXC_DRM_ENABLE", Boolean.FALSE);
    }
}