Search in sources :

Example 1 with LanSongAlphaPixelFilter

use of com.lansosdk.box.LanSongAlphaPixelFilter in project LanSoEditor_advance by LanSoSdk.

the class CameraLayerKTVDemoActivity method initDrawPad.

/**
 * Step1: 开始运行 DrawPad 容器
 */
private void initDrawPad() {
    // 因手机屏幕是16:9;全屏模式,建议分辨率设置为960x544;
    int padWidth = 960;
    int padHeight = 544;
    int bitrate = 3000 * 1024;
    int frameRate = 25;
    drawPadCamera.setRealEncodeEnable(padWidth, padHeight, bitrate, frameRate, dstPath);
    /**
     * 设置进度回调
     */
    drawPadCamera.setOnDrawPadProgressListener(drawPadProgressListener);
    drawPadCamera.setOnDrawPadThreadProgressListener(new onDrawPadThreadProgressListener() {

        @Override
        public void onThreadProgress(DrawPad v, long currentTimeUs) {
            // 如果第二个视频要切换
            if (isChangedVideo) {
                // 重新增加这个图层.
                drawPadCamera.removeLayer(currentLayer);
                currentLayer = null;
                currentLayer = drawPadCamera.addVideoLayer(videoWidth, videoHeight, null);
                drawPadCamera.changeLayerPosition(currentLayer, 0);
                if (vplayer2 != null) {
                    vplayer2.setSurface(new Surface(currentLayer.getVideoTexture()));
                    vplayer2.start();
                } else if (vplayer3 != null) {
                    vplayer3.setSurface(new Surface(currentLayer.getVideoTexture()));
                    vplayer3.start();
                }
                isChangedVideo = false;
            }
        }
    });
    drawPadCamera.setRecordMic(true);
    alphaPixelFilter = new LanSongAlphaPixelFilter();
    beautyFilter = new LanSongBeautyAdvanceFilter();
    // drawPadCamera.setCameraParam(false, beautyFilter,true);  //设置为美颜.
    // 设置是否前置.
    drawPadCamera.setCameraParam(false, alphaPixelFilter, true);
    drawPadCamera.setOnViewAvailable(new onViewAvailable() {

        @Override
        public void viewAvailable(DrawPadCameraView v) {
            startDrawPad();
        }
    });
}
Also used : DrawPad(com.lansosdk.box.DrawPad) LanSongAlphaPixelFilter(com.lansosdk.box.LanSongAlphaPixelFilter) DrawPadCameraView(com.lansosdk.videoeditor.DrawPadCameraView) DrawPadCameraView.onViewAvailable(com.lansosdk.videoeditor.DrawPadCameraView.onViewAvailable) com.lansosdk.box.onDrawPadThreadProgressListener(com.lansosdk.box.onDrawPadThreadProgressListener) Paint(android.graphics.Paint) LanSongBeautyAdvanceFilter(jp.co.cyberagent.lansongsdk.gpuimage.LanSongBeautyAdvanceFilter) Surface(android.view.Surface)

Aggregations

Paint (android.graphics.Paint)1 Surface (android.view.Surface)1 DrawPad (com.lansosdk.box.DrawPad)1 LanSongAlphaPixelFilter (com.lansosdk.box.LanSongAlphaPixelFilter)1 com.lansosdk.box.onDrawPadThreadProgressListener (com.lansosdk.box.onDrawPadThreadProgressListener)1 DrawPadCameraView (com.lansosdk.videoeditor.DrawPadCameraView)1 DrawPadCameraView.onViewAvailable (com.lansosdk.videoeditor.DrawPadCameraView.onViewAvailable)1 LanSongBeautyAdvanceFilter (jp.co.cyberagent.lansongsdk.gpuimage.LanSongBeautyAdvanceFilter)1