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);
}
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;
}
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;
}
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");
}
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;
}
Aggregations