Search in sources :

Example 1 with DrawPadVideoExecute

use of com.lansosdk.videoeditor.DrawPadVideoExecute in project LanSoEditor_advance by LanSoSdk.

the class ExecuteFilterDemoActivity method startDrawPadExecute.

private void startDrawPadExecute() {
    if (isExecuting)
        return;
    beforeDraw = System.currentTimeMillis();
    isExecuting = true;
    // 设置pad的宽度和高度.
    int padWidth = mInfo.vWidth;
    int padHeight = mInfo.vHeight;
    if (mInfo.vRotateAngle == 90 || mInfo.vRotateAngle == 270) {
        padWidth = mInfo.vHeight;
        padHeight = mInfo.vWidth;
    }
    mDrawPad = new DrawPadVideoExecute(ExecuteFilterDemoActivity.this, videoPath, padWidth, padHeight, (int) (mInfo.vBitRate * 1.5f), new IF1977Filter(getApplicationContext()), editTmpPath);
    mDrawPad.setUseMainVideoPts(true);
    /**
     * 设置DrawPad处理的进度监听, 回传的currentTimeUs单位是微秒.
     */
    mDrawPad.setDrawPadProgressListener(new onDrawPadProgressListener() {

        @Override
        public void onProgress(DrawPad v, long currentTimeUs) {
            drawPadProgress(v, currentTimeUs);
        }
    });
    /**
     * 设置DrawPad处理完成后的监听.
     */
    mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {

        @Override
        public void onCompleted(DrawPad v) {
            drawPadCompleted();
        }
    });
    mDrawPad.pauseRecord();
    if (mDrawPad.startDrawPad()) {
        mainVideoLayer = mDrawPad.getMainVideoLayer();
        // 开始恢复处理.
        mDrawPad.resumeRecord();
    } else {
        new AlertDialog.Builder(this).setTitle("提示").setMessage("DrawPad开启错误.或许视频分辨率过高导致..").setPositiveButton("确定", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
            }
        }).show();
    }
}
Also used : DrawPad(com.lansosdk.box.DrawPad) DrawPadVideoExecute(com.lansosdk.videoeditor.DrawPadVideoExecute) DialogInterface(android.content.DialogInterface) OnClickListener(android.view.View.OnClickListener) com.lansosdk.box.onDrawPadProgressListener(com.lansosdk.box.onDrawPadProgressListener) IF1977Filter(jp.co.cyberagent.lansongsdk.gpuimage.IF1977Filter) com.lansosdk.box.onDrawPadCompletedListener(com.lansosdk.box.onDrawPadCompletedListener)

Example 2 with DrawPadVideoExecute

use of com.lansosdk.videoeditor.DrawPadVideoExecute in project LanSoEditor_advance by LanSoSdk.

the class VHeaderConcat method start.

public void start(Context ctx, String videoHeader, String recordVideo) {
    this.recordVideo = recordVideo;
    videoPath = videoHeader;
    mInfo = new MediaInfo(recordVideo);
    if (mInfo.prepare()) {
        int padWidth = mInfo.vWidth;
        int padHeight = mInfo.vHeight;
        if (mInfo.vRotateAngle == 90 || mInfo.vRotateAngle == 270) {
            padWidth = mInfo.vHeight;
            padHeight = mInfo.vWidth;
        }
        editTmpPath = SDKFileUtils.newMp4PathInBox();
        dstPath = SDKFileUtils.newMp4PathInBox();
        /**
         * 片头缩放成 recordVideo的尺寸.
         */
        mDrawPad = new DrawPadVideoExecute(ctx, videoPath, padWidth, padHeight, (int) (mInfo.vBitRate * 1.5f), null, editTmpPath);
        mDrawPad.setUseMainVideoPts(true);
        /**
         * 设置DrawPad处理完成后的监听.
         */
        mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {

            @Override
            public void onCompleted(DrawPad v) {
                // TODO Auto-generated method stub
                drawPadCompleted();
            }
        });
        mDrawPad.pauseRecord();
        if (mDrawPad.startDrawPad()) {
            // 开始恢复处理.
            mDrawPad.resumeRecord();
        }
    }
}
Also used : DrawPad(com.lansosdk.box.DrawPad) DrawPadVideoExecute(com.lansosdk.videoeditor.DrawPadVideoExecute) MediaInfo(com.lansosdk.videoeditor.MediaInfo) com.lansosdk.box.onDrawPadCompletedListener(com.lansosdk.box.onDrawPadCompletedListener)

Example 3 with DrawPadVideoExecute

use of com.lansosdk.videoeditor.DrawPadVideoExecute in project LanSoEditor_advance by LanSoSdk.

the class ExecuteVideoLayerActivity method startDrawPad.

/**
 * 从这里开始演示.
 */
private void startDrawPad() {
    if (isExecuting)
        return;
    isExecuting = true;
    mDrawPad = new DrawPadVideoExecute(mContext, videoPath, 480, 480, 1000 * 1000, null, editTmpPath);
    mDrawPad.setUpdateMode(DrawPadUpdateMode.AUTO_FLUSH, (int) mInfo.vFrameRate);
    mDrawPad.setDrawPadErrorListener(new onDrawPadErrorListener() {

        @Override
        public void onError(DrawPad d, int what) {
            // TODO Auto-generated method stub
            mDrawPad.stopDrawPad();
            Log.e(TAG, "后台容器线程 运行失败,您请检查下是否码率分辨率设置过大,或者联系我们!...");
        }
    });
    /**
     * 设置DrawPad处理的进度监听, 回传的currentTimeUs单位是微秒.
     */
    mDrawPad.setDrawPadProgressListener(new onDrawPadProgressListener() {

        @Override
        public void onProgress(DrawPad v, long currentTimeUs) {
            // TODO Auto-generated method stub
            tvProgressHint.setText(String.valueOf(currentTimeUs));
            // 6秒后消失
            if (currentTimeUs > 6000000 && bitmapLayer != null)
                v.removeLayer(bitmapLayer);
            else if (// 3秒的时候,放大一倍.
            currentTimeUs > 3000000 && bitmapLayer != null)
                bitmapLayer.setScale(2.0f);
        }
    });
    /**
     * 设置DrawPad完成后的监听.
     */
    mDrawPad.setDrawPadCompletedListener(new onDrawPadCompletedListener() {

        @Override
        public void onCompleted(DrawPad v) {
            // TODO Auto-generated method stub
            tvProgressHint.setText("DrawPadExecute Completed!!!");
            isExecuting = false;
            if (isInsertAudio) {
                // 如果增加了其他声音, 则会在内部合成声音, 外界无需另外addAudio的操作, 这是和别的Drawpad操作不同之处.
                dstPath = editTmpPath;
            } else {
                if (SDKFileUtils.fileExist(editTmpPath)) {
                    boolean ret = VideoEditor.encoderAddAudio(videoPath, editTmpPath, SDKDir.TMP_DIR, dstPath);
                    if (ret == false) {
                        dstPath = editTmpPath;
                    }
                }
            }
            findViewById(R.id.id_video_edit_btn2).setEnabled(true);
        }
    });
    mDrawPad.setDrawPadThreadProgressListener(new onDrawPadThreadProgressListener() {

        @Override
        public void onThreadProgress(DrawPad v, long currentTimeUs) {
        // TODO Auto-generated method stub
        }
    });
    // mDrawPad.setUseMainVideoPts(true);
    addOtherAudio();
    // 在开启前,先设置为暂停录制,因为要增加一些图层.
    mDrawPad.pauseRecord();
    /**
     * 开始执行这个DrawPad
     */
    if (mDrawPad.startDrawPad()) {
        // 增加一些图层.
        addLayers();
    } else {
        Log.e(TAG, "后台容器线程  运行失败,您请检查下是否是路径设置有无, 请用MediaInfo.checkFile执行查看下....");
    }
}
Also used : DrawPad(com.lansosdk.box.DrawPad) DrawPadVideoExecute(com.lansosdk.videoeditor.DrawPadVideoExecute) com.lansosdk.box.onDrawPadErrorListener(com.lansosdk.box.onDrawPadErrorListener) com.lansosdk.box.onDrawPadProgressListener(com.lansosdk.box.onDrawPadProgressListener) com.lansosdk.box.onDrawPadThreadProgressListener(com.lansosdk.box.onDrawPadThreadProgressListener) com.lansosdk.box.onDrawPadCompletedListener(com.lansosdk.box.onDrawPadCompletedListener) Paint(android.graphics.Paint)

Aggregations

DrawPad (com.lansosdk.box.DrawPad)3 com.lansosdk.box.onDrawPadCompletedListener (com.lansosdk.box.onDrawPadCompletedListener)3 DrawPadVideoExecute (com.lansosdk.videoeditor.DrawPadVideoExecute)3 com.lansosdk.box.onDrawPadProgressListener (com.lansosdk.box.onDrawPadProgressListener)2 DialogInterface (android.content.DialogInterface)1 Paint (android.graphics.Paint)1 OnClickListener (android.view.View.OnClickListener)1 com.lansosdk.box.onDrawPadErrorListener (com.lansosdk.box.onDrawPadErrorListener)1 com.lansosdk.box.onDrawPadThreadProgressListener (com.lansosdk.box.onDrawPadThreadProgressListener)1 MediaInfo (com.lansosdk.videoeditor.MediaInfo)1 IF1977Filter (jp.co.cyberagent.lansongsdk.gpuimage.IF1977Filter)1