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();
}
}
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();
}
}
}
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执行查看下....");
}
}
Aggregations