use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.
the class CachedFrameManager method findAvailableFrame.
private Frame findAvailableFrame(FrameFormat format, int bindingType, long bindingId) {
// Look for a frame that is compatible with the requested format
synchronized (mAvailableFrames) {
for (Map.Entry<Integer, Frame> entry : mAvailableFrames.entrySet()) {
Frame frame = entry.getValue();
// Check that format is compatible
if (frame.getFormat().isReplaceableBy(format)) {
// Check that binding is compatible (if frame is bound)
if ((bindingType == frame.getBindingType()) && (bindingType == Frame.NO_BINDING || bindingId == frame.getBindingId())) {
// We found one! Take it out of the set of available frames and attach the
// requested format to it.
super.retainFrame(frame);
mAvailableFrames.remove(entry.getKey());
frame.onFrameFetch();
frame.reset(format);
mStorageSize -= format.getSize();
return frame;
}
}
}
}
return null;
}
use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.
the class CachedFrameManager method dropOldestFrame.
private void dropOldestFrame() {
int oldest = mAvailableFrames.firstKey();
Frame frame = mAvailableFrames.get(oldest);
mStorageSize -= frame.getFormat().getSize();
frame.releaseNativeAllocation();
mAvailableFrames.remove(oldest);
}
use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.
the class FilterContext method tearDown.
public synchronized void tearDown() {
// Release stored frames
for (Frame frame : mStoredFrames.values()) {
frame.release();
}
mStoredFrames.clear();
// Release graphs
for (FilterGraph graph : mGraphs) {
graph.tearDown(this);
}
mGraphs.clear();
// Release frame manager
if (mFrameManager != null) {
mFrameManager.tearDown();
mFrameManager = null;
}
// Release GL context
if (mGLEnvironment != null) {
mGLEnvironment.tearDown();
mGLEnvironment = null;
}
}
use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.
the class StringSource method process.
@Override
public void process(FilterContext env) {
Frame output = env.getFrameManager().newFrame(mOutputFormat);
output.setObjectValue(mString);
output.setTimestamp(Frame.TIMESTAMP_UNKNOWN);
pushOutput("string", output);
closeOutputPort("string");
}
use of android.filterfw.core.Frame in project android_frameworks_base by ParanoidAndroid.
the class ToUpperCase method process.
@Override
public void process(FilterContext env) {
Frame input = pullInput("mixedcase");
String inputString = (String) input.getObjectValue();
Frame output = env.getFrameManager().newFrame(mOutputFormat);
output.setObjectValue(inputString.toUpperCase());
pushOutput("uppercase", output);
}
Aggregations