use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class Demo3LayerFilterActivity method initDrawPad.
/**
* Step1:开始 DrawPad 容器
*/
private void initDrawPad() {
MediaInfo info = new MediaInfo(mVideoPath);
if (info.prepare()) {
drawPadView.setUpdateMode(DrawPadUpdateMode.ALL_VIDEO_READY, 25);
drawPadView.setRealEncodeEnable(480, 480, 1000000, (int) info.vFrameRate, editTmpPath);
drawPadView.setOnDrawPadCompletedListener(new DrawPadCompleted());
drawPadView.setDrawPadSize(480, 480, new onDrawPadSizeChangedListener() {
@Override
public void onSizeChanged(int viewWidth, int viewHeight) {
startDrawPad();
}
});
}
}
use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class DemoApplication method getVideoMediaInfo.
public MediaInfo getVideoMediaInfo() {
if (mInfo == null) {
mInfo = new MediaInfo(srcVideo);
if (mInfo.prepare() == false) {
srcVideo = CopyFileFromAssets.copyAssets(getContext(), "ping20s.mp4");
mInfo = new MediaInfo(srcVideo);
mInfo.prepare();
}
}
return mInfo;
}
use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class ExecuteFilterDemoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
videoPath = getIntent().getStringExtra("videopath");
mInfo = new MediaInfo(videoPath);
mInfo.prepare();
setContentView(R.layout.execute_edit_demo_layout);
initView();
// 在手机的默认路径下创建一个文件名,用来保存生成的视频文件,(在onDestroy中删除)
editTmpPath = SDKFileUtils.newMp4PathInBox();
dstPath = SDKFileUtils.newMp4PathInBox();
}
use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class ExecuteTwoVideoLayerDemoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
videoPath = getIntent().getStringExtra("videopath");
mInfo = new MediaInfo(videoPath);
mInfo.prepare();
setContentView(R.layout.execute_edit_demo_layout);
initUI();
// 在手机的默认路径下创建一个文件名,用来保存生成的视频文件,(在onDestroy中删除)
editTmpPath = SDKFileUtils.newMp4PathInBox();
if (SDKFileUtils.fileExist(editTmpPath)) {
SDKFileUtils.deleteFile(editTmpPath);
}
dstPath = SDKFileUtils.newMp4PathInBox();
}
use of com.lansosdk.videoeditor.MediaInfo in project LanSoEditor_advance by LanSoSdk.
the class ExecuteTwoVideoLayerDemoActivity method addDataLayer.
/**
* 增加一个DataLayer, 数据图层. 数据图层是可以把外界的数据图片RGBA, 作为一个图层, 传到到DrawPad中.
* <p>
* 流程是: 把gif作为一个视频文件, 一帧一帧的解码,把解码得到的数据通过DataLayer传递到容器中.
*/
private void addDataLayer() {
String gifPath = CopyDefaultVideoAsyncTask.copyFile(getApplicationContext(), "a.gif");
gifInfo = new MediaInfo(gifPath);
if (gifInfo.prepare()) {
decoderHandler = BoxDecoder.decoderInit(gifPath);
mGLRgbBuffer = IntBuffer.allocate(gifInfo.vWidth * gifInfo.vHeight);
gifInterval = (int) (mInfo.vFrameRate / gifInfo.vFrameRate);
dataLayer = mDrawPad.addDataLayer(gifInfo.vWidth, gifInfo.vHeight);
/**
* 容器中的onDrawPadThreadProgressListener监听,与 onDrawPadProgressListener不同的地方在于:
* 此回调是在DrawPad渲染完一帧后,立即执行这个回调中的代码,不通过Handler传递出去.
*/
mDrawPad.setDrawPadThreadProgressListener(new onDrawPadThreadProgressListener() {
@Override
public void onThreadProgress(DrawPad v, long currentTimeUs) {
// TODO Auto-generated method stub
if (dataLayer != null) {
if (canDrawNext()) {
int seekZero = -1;
if (decoderHandler != 0 && BoxDecoder.decoderIsEnd(decoderHandler)) {
seekZero = 0;
}
BoxDecoder.decoderFrame(decoderHandler, seekZero, mGLRgbBuffer.array());
dataLayer.pushFrameToTexture(mGLRgbBuffer);
mGLRgbBuffer.position(0);
}
}
}
});
}
}
Aggregations