Search in sources :

Example 1 with MediaInfo

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();
            }
        });
    }
}
Also used : com.lansosdk.box.onDrawPadSizeChangedListener(com.lansosdk.box.onDrawPadSizeChangedListener) MediaInfo(com.lansosdk.videoeditor.MediaInfo) Paint(android.graphics.Paint)

Example 2 with MediaInfo

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;
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo)

Example 3 with MediaInfo

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();
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo)

Example 4 with MediaInfo

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();
}
Also used : MediaInfo(com.lansosdk.videoeditor.MediaInfo)

Example 5 with MediaInfo

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);
                    }
                }
            }
        });
    }
}
Also used : DrawPad(com.lansosdk.box.DrawPad) MediaInfo(com.lansosdk.videoeditor.MediaInfo) com.lansosdk.box.onDrawPadThreadProgressListener(com.lansosdk.box.onDrawPadThreadProgressListener)

Aggregations

MediaInfo (com.lansosdk.videoeditor.MediaInfo)59 Handler (android.os.Handler)12 com.lansosdk.box.onDrawPadSizeChangedListener (com.lansosdk.box.onDrawPadSizeChangedListener)9 Paint (android.graphics.Paint)8 TextView (android.widget.TextView)6 Intent (android.content.Intent)5 View (android.view.View)5 OnClickListener (android.view.View.OnClickListener)5 CanvasRunnable (com.lansosdk.box.CanvasRunnable)5 DrawPad (com.lansosdk.box.DrawPad)5 Bitmap (android.graphics.Bitmap)4 DrawPadView (com.lansosdk.videoeditor.DrawPadView)4 File (java.io.File)3 SurfaceTexture (android.graphics.SurfaceTexture)2 MediaPlayer (android.media.MediaPlayer)2 DisplayMetrics (android.util.DisplayMetrics)2 Surface (android.view.Surface)2 SurfaceTextureListener (android.view.TextureView.SurfaceTextureListener)2 VideoPlayerActivity (com.example.advanceDemo.VideoPlayerActivity)2 DrawPadVideoRunnable (com.lansosdk.box.DrawPadVideoRunnable)2