package com.tencent.mm.plugin.emojicapture.ui.b;

import a.f.a.a;
import a.f.b.j;
import a.l;
import a.v;
import a.y;
import android.os.HandlerThread;
import android.view.Surface;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.ak;
import javax.microedition.khronos.egl.EGL;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
import javax.microedition.khronos.opengles.GL10;

@l(dWo = {1, 1, 13}, dWp = {"\u0000|\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0010\u0012\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005J\u0010\u0010$\u001a\u00020\u00032\u0006\u0010%\u001a\u00020\u000bH\u0002J\u0006\u0010&\u001a\u00020\u001bJ\u001c\u0010'\u001a\u00020\u001b2\u0014\u0010(\u001a\u0010\u0012\u0004\u0012\u00020*\u0012\u0004\u0012\u00020\u001b\u0018\u00010)J\u0006\u0010+\u001a\u00020#J\u0018\u0010,\u001a\u00020\u001b2\u0010\b\u0002\u0010-\u001a\n\u0012\u0004\u0012\u00020\u001b\u0018\u00010\u001aJ\b\u0010.\u001a\u00020\u001bH\u0002J(\u0010/\u001a\u00020\u001b2\b\u00100\u001a\u0004\u0018\u0001012\u0016\b\u0002\u0010(\u001a\u0010\u0012\u0004\u0012\u000202\u0012\u0004\u0012\u00020\u001b\u0018\u00010)J\b\u00103\u001a\u00020\u001bH\u0002J\u0014\u00104\u001a\u00020\u001b2\f\u0010(\u001a\b\u0012\u0004\u0012\u00020\u001b0\u001aJ\u000e\u00105\u001a\u00020\u001b2\u0006\u00106\u001a\u000202R\u000e\u0010\u0006\u001a\u00020\u0007XD¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u0004\u0018\u00010\u000bX\u000e¢\u0006\u0002\n\u0000R\u0016\u0010\f\u001a\n \u000e*\u0004\u0018\u00010\r0\rX\u000e¢\u0006\u0002\n\u0000R\u0016\u0010\u000f\u001a\n \u000e*\u0004\u0018\u00010\u00100\u0010X\u000e¢\u0006\u0002\n\u0000R\u0016\u0010\u0011\u001a\n \u000e*\u0004\u0018\u00010\u00120\u0012X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0014X.¢\u0006\u0002\n\u0000R\u000e\u0010\u0015\u001a\u00020\u0016X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u0018X\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0003X\u0004¢\u0006\u0002\n\u0000R\"\u0010\u0019\u001a\n\u0012\u0004\u0012\u00020\u001b\u0018\u00010\u001aX\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001c\u0010\u001d\"\u0004\b\u001e\u0010\u001fR\u000e\u0010 \u001a\u00020!X.¢\u0006\u0002\n\u0000R\u000e\u0010\"\u001a\u00020#X.¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0004¢\u0006\u0002\n\u0000¨\u00067"}, dWq = {"Lcom/tencent/mm/plugin/emojicapture/ui/gl/EmojiCaptureMixEGLPixelBuffer;", "", "width", "", "height", "(II)V", "TAG", "", "eGL", "Ljavax/microedition/khronos/egl/EGL10;", "eGLConfig", "Ljavax/microedition/khronos/egl/EGLConfig;", "eGLContext", "Ljavax/microedition/khronos/egl/EGLContext;", "kotlin.jvm.PlatformType", "eGLDisplay", "Ljavax/microedition/khronos/egl/EGLDisplay;", "eGLSurface", "Ljavax/microedition/khronos/egl/EGLSurface;", "gl", "Ljavax/microedition/khronos/opengles/GL10;", "glThread", "Landroid/os/HandlerThread;", "glThreadHandler", "Lcom/tencent/mm/sdk/platformtools/MMHandler;", "onPrepareDrawFrame", "Lkotlin/Function0;", "", "getOnPrepareDrawFrame", "()Lkotlin/jvm/functions/Function0;", "setOnPrepareDrawFrame", "(Lkotlin/jvm/functions/Function0;)V", "renderer", "Lcom/tencent/mm/plugin/emojicapture/ui/gl/EmojiCaptureMixRenderer;", "videoDecodeSurface", "Landroid/view/Surface;", "createEGLContext", "config", "destroyGL", "getRenderContent", "callback", "Lkotlin/Function1;", "", "getVideoDecodeSurface", "init", "afterInitCallback", "initPixelBuffer", "mixVideoAndEmojiFrame", "nextFrameInfo", "Lcom/tencent/mm/media/mix/MixFrameSyncMgr$NextFrameInfo;", "", "onVideoSurfaceFrameAvailable", "queue", "setRemoveBackground", "remove", "plugin-emojicapture_release"})
public final class d {
    public final String TAG = "MicroMsg.EmojiCaptureEGLPixelBuffer";
    final int height;
    final EGL10 loO;
    EGLDisplay loP;
    EGLContext loQ;
    EGLSurface loR;
    EGLConfig loS;
    public GL10 loT;
    public e loU;
    Surface loV;
    public ak loW;
    HandlerThread loX;
    public a<y> loY;
    final int width;

    public d(int i, int i2) {
        AppMethodBeat.i(3164);
        this.width = i;
        this.height = i2;
        EGL egl = EGLContext.getEGL();
        if (egl == null) {
            v vVar = new v("null cannot be cast to non-null type javax.microedition.khronos.egl.EGL10");
            AppMethodBeat.o(3164);
            throw vVar;
        }
        this.loO = (EGL10) egl;
        this.loP = EGL10.EGL_NO_DISPLAY;
        this.loQ = EGL10.EGL_NO_CONTEXT;
        this.loR = EGL10.EGL_NO_SURFACE;
        HandlerThread anM = com.tencent.mm.sdk.g.d.anM("EmojiCaptureMixEGLPixelBuffer_GLThread");
        j.o(anM, "ThreadPool.newFreeHandle…EGLPixelBuffer_GLThread\")");
        this.loX = anM;
        this.loX.start();
        this.loW = new ak(this.loX.getLooper());
        this.loW.post((Runnable) new 1(this));
        AppMethodBeat.o(3164);
    }

    public static final /* synthetic */ e a(d dVar) {
        AppMethodBeat.i(3165);
        e eVar = dVar.loU;
        if (eVar == null) {
            j.avw("renderer");
        }
        AppMethodBeat.o(3165);
        return eVar;
    }

    public final void b(a<y> aVar) {
        AppMethodBeat.i(3162);
        j.p(aVar, "callback");
        this.loW.post((Runnable) new e(aVar));
        AppMethodBeat.o(3162);
    }

    public final Surface bog() {
        AppMethodBeat.i(3163);
        Surface surface = this.loV;
        if (surface == null) {
            j.avw("videoDecodeSurface");
        }
        AppMethodBeat.o(3163);
        return surface;
    }
}
