Search in sources :

Example 26 with MutableFrameFormat

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

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 27 with MutableFrameFormat

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

the class RetargetFilter method getOutputFormat.

@Override
public FrameFormat getOutputFormat(String portName, FrameFormat inputFormat) {
    MutableFrameFormat retargeted = inputFormat.mutableCopy();
    retargeted.setTarget(mTarget);
    return retargeted;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 28 with MutableFrameFormat

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

the class ObjectFormat method fromClass.

public static MutableFrameFormat fromClass(Class clazz, int count, int target) {
    // Create frame format
    MutableFrameFormat result = new MutableFrameFormat(FrameFormat.TYPE_OBJECT, target);
    result.setObjectClass(getBoxedClass(clazz));
    if (count != FrameFormat.SIZE_UNSPECIFIED) {
        result.setDimensions(count);
    }
    result.setBytesPerSample(bytesPerSampleForClass(clazz, target));
    return result;
}
Also used : MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 29 with MutableFrameFormat

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

the class FrameFormat method mutableCopy.

public MutableFrameFormat mutableCopy() {
    MutableFrameFormat result = new MutableFrameFormat();
    result.setBaseType(getBaseType());
    result.setTarget(getTarget());
    result.setBytesPerSample(getBytesPerSample());
    result.setDimensions(getDimensions());
    result.setObjectClass(getObjectClass());
    result.mMetaData = mMetaData == null ? null : (KeyValueMap) mMetaData.clone();
    return result;
}
Also used : KeyValueMap(android.filterfw.core.KeyValueMap) MutableFrameFormat(android.filterfw.core.MutableFrameFormat)

Example 30 with MutableFrameFormat

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

the class RetargetFilter method getOutputFormat.

@Override
public FrameFormat getOutputFormat(String portName, FrameFormat inputFormat) {
    MutableFrameFormat retargeted = inputFormat.mutableCopy();
    retargeted.setTarget(mTarget);
    return retargeted;
}
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