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