Search in sources :

Example 66 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by ParanoidAndroid.

the class SurfaceRenderFilter method prepare.

@Override
public void prepare(FilterContext context) {
    // Create identity shader to render, and make sure to render upside-down, as textures
    // are stored internally bottom-to-top.
    mProgram = ShaderProgram.createIdentity(context);
    mProgram.setSourceRect(0, 1, 1, -1);
    mProgram.setClearsOutput(true);
    mProgram.setClearColor(0.0f, 0.0f, 0.0f);
    updateRenderMode();
    // Create a frame representing the screen
    MutableFrameFormat screenFormat = ImageFormat.create(mSurfaceView.getWidth(), mSurfaceView.getHeight(), ImageFormat.COLORSPACE_RGBA, FrameFormat.TARGET_GPU);
    mScreen = (GLFrame) context.getFrameManager().newBoundFrame(screenFormat, GLFrame.EXISTING_FBO_BINDING, 0);
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 67 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by ParanoidAndroid.

the class MediaEncoderFilter method startRecording.

private void startRecording(FilterContext context) {
    if (mLogVerbose)
        Log.v(TAG, "Starting recording");
    // Create a frame representing the screen
    MutableFrameFormat screenFormat = new MutableFrameFormat(FrameFormat.TYPE_BYTE, FrameFormat.TARGET_GPU);
    screenFormat.setBytesPerSample(4);
    int width, height;
    boolean widthHeightSpecified = mWidth > 0 && mHeight > 0;
    // of that in the profile.
    if (mProfile != null && !widthHeightSpecified) {
        width = mProfile.videoFrameWidth;
        height = mProfile.videoFrameHeight;
    } else {
        width = mWidth;
        height = mHeight;
    }
    screenFormat.setDimensions(width, height);
    mScreen = (GLFrame) context.getFrameManager().newBoundFrame(screenFormat, GLFrame.EXISTING_FBO_BINDING, 0);
    // Initialize the media recorder
    mMediaRecorder = new MediaRecorder();
    updateMediaRecorderParams();
    try {
        mMediaRecorder.prepare();
    } catch (IllegalStateException e) {
        throw e;
    } catch (IOException e) {
        throw new RuntimeException("IOException in" + "MediaRecorder.prepare()!", e);
    } catch (Exception e) {
        throw new RuntimeException("Unknown Exception in" + "MediaRecorder.prepare()!", e);
    }
    // Make sure start() is called before trying to
    // register the surface. The native window handle needed to create
    // the surface is initiated in start()
    mMediaRecorder.start();
    if (mLogVerbose)
        Log.v(TAG, "Open: registering surface from Mediarecorder");
    mSurfaceId = context.getGLEnvironment().registerSurfaceFromMediaRecorder(mMediaRecorder);
    mNumFramesEncoded = 0;
    mRecordingActive = true;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat) MediaRecorder(android.media.MediaRecorder) IOException(java.io.IOException) Point(android.filterfw.geometry.Point) IOException(java.io.IOException)

Example 68 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by ParanoidAndroid.

the class ToRGBAFilter method getConvertedFormat.

public FrameFormat getConvertedFormat(FrameFormat format) {
    MutableFrameFormat result = format.mutableCopy();
    result.setMetaValue(ImageFormat.COLORSPACE_KEY, ImageFormat.COLORSPACE_RGBA);
    result.setBytesPerSample(4);
    return result;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 69 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by ParanoidAndroid.

the class ToRGBFilter method setupPorts.

@Override
public void setupPorts() {
    MutableFrameFormat mask = new MutableFrameFormat(FrameFormat.TYPE_BYTE, FrameFormat.TARGET_NATIVE);
    mask.setDimensionCount(2);
    addMaskedInputPort("image", mask);
    addOutputBasedOnInput("image", "image");
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 70 with MutableFrameFormat

use of android.filterfw.core.MutableFrameFormat in project android_frameworks_base by ParanoidAndroid.

the class ImageStitcher method calcOutputFormatForInput.

private FrameFormat calcOutputFormatForInput(FrameFormat format) {
    MutableFrameFormat outputFormat = format.mutableCopy();
    mInputWidth = format.getWidth();
    mInputHeight = format.getHeight();
    mSliceWidth = mInputWidth - 2 * mPadSize;
    mSliceHeight = mInputHeight - 2 * mPadSize;
    mImageWidth = mSliceWidth * mXSlices;
    mImageHeight = mSliceHeight * mYSlices;
    outputFormat.setDimensions(mImageWidth, mImageHeight);
    return outputFormat;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Aggregations

MutableFrameFormat (android.filterfw.core.MutableFrameFormat)126 Frame (android.filterfw.core.Frame)36 FrameFormat (android.filterfw.core.FrameFormat)24 ShaderProgram (android.filterfw.core.ShaderProgram)12 Point (android.filterfw.geometry.Point)12 Quad (android.filterfw.geometry.Quad)12 GLFrame (android.filterfw.core.GLFrame)6 KeyValueMap (android.filterfw.core.KeyValueMap)6 MediaRecorder (android.media.MediaRecorder)6 IOException (java.io.IOException)6 NativeFrame (android.filterfw.core.NativeFrame)2