use of com.lansosdk.box.DrawPad in project LanSoEditor_advance by LanSoSdk.
the class Demo1LayerMothedActivity method addYUVLayer.
/**
* 增加YUV图层.
*/
private void addYUVLayer() {
mYuvLayer = drawPadView.addYUVLayer(960, 720);
mData = readDataFromAssets("data.log");
drawPadView.setOnDrawPadThreadProgressListener(new onDrawPadThreadProgressListener() {
@Override
public void onThreadProgress(DrawPad v, long currentTimeUs) {
if (mYuvLayer != null) {
/**
* 把外面的数据作为一个图层投递DrawPad中
* @param data nv21格式的数据.
* @param rotate 数据渲染到DrawPad中时,是否要旋转角度, 可旋转0/90/180/270
* @param flipHorizontal 数据是否要横向翻转, 把左边的放 右边,把右边的放左边.
* @param flipVertical 数据是否要竖向翻转, 把上面的放下面, 把下面的放上边.
*/
count++;
if (count > 200) {
// 这里仅仅是演示把yuv push到容器里, 实际使用中, 你拿到的byte[]的yuv数据,可以直接push
mYuvLayer.pushNV21DataToTexture(mData.yuv, 270, false, false);
} else if (count > 150) {
mYuvLayer.pushNV21DataToTexture(mData.yuv, 180, false, false);
} else if (count > 100) {
mYuvLayer.pushNV21DataToTexture(mData.yuv, 90, false, false);
} else {
mYuvLayer.pushNV21DataToTexture(mData.yuv, 0, false, false);
}
}
}
});
}
use of com.lansosdk.box.DrawPad in project LanSoEditor_advance by LanSoSdk.
the class LayerLayoutDemoActivity method initDrawPad.
/**
* 第一步: init DrawPad 初始化容器
*
* @param mp
*/
private void initDrawPad() {
int padWidth = 480;
int padHeight = 480;
/**
* 设置当前DrawPad的宽度和高度,并把宽度自动缩放到父view的宽度,然后等比例调整高度.
*/
drawPadView.setDrawPadSize(padWidth, padHeight, new onDrawPadSizeChangedListener() {
@Override
public void onSizeChanged(int viewWidth, int viewHeight) {
startDrawPad();
}
});
drawPadView.setRealEncodeEnable(padWidth, padHeight, 1000000, (int) mInfo.vFrameRate, editTmpPath);
drawPadView.setOnDrawPadProgressListener(new onDrawPadProgressListener() {
@Override
public void onProgress(DrawPad v, long currentTimeUs) {
}
});
}
use of com.lansosdk.box.DrawPad in project LanSoEditor_advance by LanSoSdk.
the class MoreLayHeadSeekActivity method setupDrawPad.
/**
* Step1: 设置DrawPad 容器的尺寸.并设置是否实时录制容器上的内容.
*/
private void setupDrawPad() {
videoWidth = firstInfo.vWidth;
videoHeight = firstInfo.vHeight;
if (firstInfo.vRotateAngle == 90 || firstInfo.vRotateAngle == 270) {
videoWidth = firstInfo.vHeight;
videoHeight = firstInfo.vWidth;
}
joinCopySecondVideo();
secondInfo = new MediaInfo(videoPath2, false);
secondInfo.prepare();
bmpLayerStartTime = (long) (firstInfo.vDuration * 1000 * 1000);
// 设置最大值.
totalTimeUs = (long) (firstInfo.vDuration * 1000 * 1000) + BITMAP_DURATION + (long) (secondInfo.vDuration * 1000 * 1000);
skbTime.setMax((int) totalTimeUs);
drawPadView.setRealEncodeEnable(videoWidth, videoHeight, 1500000, (int) 25, dstPath);
// 25是帧率.
drawPadView.setUpdateMode(DrawPadUpdateMode.AUTO_FLUSH, 25);
drawPadView.setDrawPadSize(videoWidth, videoHeight, new onDrawPadSizeChangedListener() {
@Override
public void onSizeChanged(int viewWidth, int viewHeight) {
drawPadView.pauseDrawPad();
startDrawPad();
}
});
drawPadView.setOnDrawPadRunTimeListener(new onDrawPadRunTimeListener() {
@Override
public void onRunTime(DrawPad v, long curerntTimeUs) {
playVideo1(curerntTimeUs);
playVideo2(curerntTimeUs);
playPicture(curerntTimeUs);
}
});
drawPadView.setOnDrawPadProgressListener(new onDrawPadProgressListener() {
@Override
public void onProgress(DrawPad v, long currentTimeUs) {
}
});
}
use of com.lansosdk.box.DrawPad in project LanSoEditor_advance by LanSoSdk.
the class VideoLayerTransformActivity method initDrawPad.
// Step1: 设置DrawPad 容器的尺寸.并设置是否实时录制容器上的内容.
private void initDrawPad() {
/**
* 设置录制的参数.
*/
mDrawPad.setRealEncodeEnable(480, 480, 1000000, (int) 25, dstPath);
// 25是帧率.
mDrawPad.setUpdateMode(DrawPadUpdateMode.AUTO_FLUSH, 25);
mDrawPad.setDrawPadSize(480, 480, new onDrawPadSizeChangedListener() {
@Override
public void onSizeChanged(int viewWidth, int viewHeight) {
startDrawPad();
}
});
mDrawPad.setOnDrawPadProgressListener(new onDrawPadProgressListener() {
@Override
public void onProgress(DrawPad v, long currentTimeUs) {
if (currentTimeUs > 18 * 1000 * 1000) {
// 18秒的时候停止.
stopDrawPad();
}
if (currentTimeUs > 15 * 1000 * 1000) {
showFourLayer();
}
if (currentTimeUs > 3 * 1000 * 1000 && bmpLayer == null) {
// 3秒的时候, 增加图片.
showSecondLayer(currentTimeUs);
}
if (currentTimeUs > 8 * 1000 * 1000 && videoLayer2 == null) {
// 8秒的时候增加一个视频.
showThreeLayer(currentTimeUs);
}
}
});
}
use of com.lansosdk.box.DrawPad in project LanSoEditor_advance by LanSoSdk.
the class MVLayerDemoActivity method initDrawPad.
/**
* Step1: 开始运行 DrawPad 容器
*/
private void initDrawPad() {
// 设置使能 实时录制, 即把正在DrawPad中呈现的画面实时的保存下来,实现所见即所得的模式
mDrawPadView.setRealEncodeEnable(480, 480, 1000000, (int) mInfo.vFrameRate, editTmpPath);
mDrawPadView.setOnDrawPadProgressListener(new onDrawPadProgressListener() {
@Override
public void onProgress(DrawPad v, long currentTimeUs) {
// TODO Auto-generated method stub
// Log.i(TAG,"MV当前时间戳是"+currentTimeUs);
}
});
// 设置当前DrawPad的宽度和高度,并把宽度自动缩放到父view的宽度,然后等比例调整高度.
mDrawPadView.setDrawPadSize(480, 480, new onDrawPadSizeChangedListener() {
@Override
public void onSizeChanged(int viewWidth, int viewHeight) {
// 开始DrawPad的渲染线程.
startDrawPad();
}
});
mDrawPadView.setOnViewAvailable(new onViewAvailable() {
@Override
public void viewAvailable(DrawPadView v) {
startPlayVideo();
}
});
}
Aggregations