package com.ss.android.ttve.nativePort;

import X.C0051I1y;
import X.C0057I2e;
import X.C0072I2t;
import X.C0100I3v;
import X.C0103I3y;
import X.C0347IDi;
import X.I2B;
import X.I63;
import X.I65;
import X.I93;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.medialib.presenter.IStickerRequestCallback;
import java.util.List;

public class TEEffectInterface {
    public TEEffectCallback mEffectCallback = new TEEffectCallback();
    public volatile long mHandle;

    static {
        Covode.recordClassIndex(49418);
    }

    private native int nativeCallEffectInterface(long j, long j2);

    private native Object nativeCallEffectInterfaceWithObjectResult(long j, long j2);

    private native int nativeCallEffectInterfaceWithResult(long j, long j2, long j3);

    private native int nativeSetEffectCallback(long j, TEEffectCallback tEEffectCallback);

    public void unregBachAlgorithmCallback() {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.unregBachAlgorithmCallback();
        }
    }

    public void release() {
        C0347IDi.LIZ("TEEffectInterface", "release...");
        this.mEffectCallback = null;
        this.mHandle = 0;
    }

    private void setEffectCallback() {
        MethodCollector.i(828);
        if (this.mEffectCallback != null) {
            nativeSetEffectCallback(this.mHandle, this.mEffectCallback);
        }
        MethodCollector.o(828);
    }

    public void regBachAlgorithmCallback(List<I65> list) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.regBachAlgorithmCallback(list);
        }
    }

    public void setARTextBitmapCallback(C0103I3y i3y) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.setARTextBitmapCallback(i3y);
        }
    }

    public void setARTextParagraphContentCallback(C0051I1y i1y) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.setARTextParagraphContentCallback(i1y);
        }
    }

    public void setEffectAlgorithmInfoCallback(C0100I3v i3v) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.setEffectAlgorithmInfoCallback(i3v);
        }
    }

    public void setFaceDetectListener(C0057I2e i2e) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.setFaceDetectListener(i2e);
        }
    }

    public void setFaceInfoCallback(I63 i63) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.setFaceInfoCallback(i63);
        }
    }

    public void setLandMarkDetectCallback(C0072I2t i2t) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.setLandmarkDetectListener(i2t);
        }
    }

    public void setSmartBeautyCallback(I93 i93) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.setOnSmartBeautyListener(i93);
        }
    }

    public void setStickerRequestCallback(IStickerRequestCallback iStickerRequestCallback) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.setStickerRequestCallback(iStickerRequestCallback);
        }
    }

    public TEEffectInterface(long j) {
        this.mHandle = j;
        setEffectCallback();
    }

    public void setSkeletonDetectCallback(I2B i2b) {
        TEEffectCallback tEEffectCallback = this.mEffectCallback;
        if (tEEffectCallback != null) {
            tEEffectCallback.setSkeletonDetectCallback(i2b);
        } else {
            C0347IDi.LIZLLL("TEEffectInterface", "setSkeletonDetectCallback failed");
        }
    }

    public int callEffectInterface(TEBundle tEBundle) {
        MethodCollector.i(2707);
        if (this.mHandle == 0) {
            C0347IDi.LIZJ("TEEffectInterface", "callEffectInterface, but mHandle is invalid.");
            MethodCollector.o(2707);
            return -1;
        }
        int nativeCallEffectInterface = nativeCallEffectInterface(this.mHandle, tEBundle.getHandle());
        tEBundle.recycle();
        MethodCollector.o(2707);
        return nativeCallEffectInterface;
    }

    public Object callEffectInterfaceWithResult(TEBundle tEBundle) {
        MethodCollector.i(1378);
        if (this.mHandle == 0) {
            C0347IDi.LIZJ("TEEffectInterface", "callEffectInterfaceWithResult, but mHandle is invalid.");
            MethodCollector.o(1378);
            return -1;
        }
        Object nativeCallEffectInterfaceWithObjectResult = nativeCallEffectInterfaceWithObjectResult(this.mHandle, tEBundle.getHandle());
        tEBundle.recycle();
        MethodCollector.o(1378);
        return nativeCallEffectInterfaceWithObjectResult;
    }

    public int callEffectInterfaceWithResult(TEBundle tEBundle, TEBundle tEBundle2) {
        MethodCollector.i(1367);
        if (this.mHandle == 0) {
            C0347IDi.LIZJ("TEEffectInterface", "callEffectInterfaceWithResult, but mHandle is invalid.");
            MethodCollector.o(1367);
            return -1;
        }
        int nativeCallEffectInterfaceWithResult = nativeCallEffectInterfaceWithResult(this.mHandle, tEBundle.getHandle(), tEBundle2.getHandle());
        tEBundle.recycle();
        MethodCollector.o(1367);
        return nativeCallEffectInterfaceWithResult;
    }
}
