FileDocCategorySizeDatePackage
CameraEffectsRecordingSample.javaAPI DocAndroid 5.1 API3528Thu Mar 12 22:22:30 GMT 2015android.media.filterfw.samples

CameraEffectsRecordingSample

public class CameraEffectsRecordingSample extends android.app.Activity

Fields Summary
private android.widget.Button
mRunButton
private android.view.SurfaceView
mCameraView
private android.filterfw.core.GraphRunner
mRunner
private int
mCameraId
private String
mOutFileName
private android.view.View.OnClickListener
mRunButtonClick
Constructors Summary
Methods Summary
private voidcreateGraph()

        Bitmap sourceBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.android);
        GraphEnvironment graphEnvironment = new GraphEnvironment();
        graphEnvironment.createGLEnvironment();
        graphEnvironment.addReferences("cameraView", mCameraView);
        graphEnvironment.addReferences("cameraId", mCameraId);
        graphEnvironment.addReferences("outputFileName", mOutFileName);
        int graphId = graphEnvironment.loadGraph(this, R.raw.cameraeffectsrecordingsample);
        mRunner = graphEnvironment.getRunner(graphId, GraphEnvironment.MODE_ASYNCHRONOUS);
    
public voidonCreate(android.os.Bundle savedInstanceState)


        
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mRunButton = (Button) findViewById(R.id.runbutton);
        mCameraView = (SurfaceView) findViewById(R.id.cameraview);
        mRunButton.setOnClickListener(mRunButtonClick);

        Intent intent = getIntent();
        if (intent.hasExtra("OUTPUT_FILENAME")) {
            mOutFileName = intent.getStringExtra("OUTPUT_FILENAME");
        }
        // Set up the references and load the filter graph
        createGraph();
    
public booleanonKeyDown(int keyCode, android.view.KeyEvent event)

        switch (keyCode) {
            case KeyEvent.KEYCODE_CAMERA:
                mRunButton.performClick();
                return true;
        }
        return super.onKeyDown(keyCode, event);
    
protected voidonPause()

        super.onPause();
        if (mRunner.isRunning()) {
            mRunner.stop();
            mRunButton.setText("Record");
        }