if (mObject == null) {
throw new NullPointerException("ObjectSource producing frame with no object set!");
}
- FrameFormat outputFormat = ObjectFormat.fromObject(mObject, FrameFormat.TARGET_JAVA);
+ FrameFormat outputFormat = ObjectFormat.fromObject(mObject, FrameFormat.TARGET_SIMPLE);
mFrame = context.getFrameManager().newFrame(outputFormat);
mFrame.setObjectValue(mObject);
mFrame.setTimestamp(Frame.TIMESTAMP_UNKNOWN);
// Create format for this input
if (mLogVerbose) Log.v(TAG, "Filter " + this + " adding " + fieldPort);
MutableFrameFormat format = ObjectFormat.fromClass(field.getType(),
- FrameFormat.TARGET_JAVA);
+ FrameFormat.TARGET_SIMPLE);
fieldPort.setPortFormat(format);
// Add port
// Create format for this input
if (mLogVerbose) Log.v(TAG, "Filter " + this + " adding " + programPort);
MutableFrameFormat format = ObjectFormat.fromClass(varType,
- FrameFormat.TARGET_JAVA);
+ FrameFormat.TARGET_SIMPLE);
programPort.setPortFormat(format);
// Add port
if (mLogVerbose) Log.v(TAG, "Setting immediate value " + value + " for port " + name + "!");
FilterPort port = getInputPort(name);
port.open();
- port.setFrame(JavaFrame.wrapObject(value, null));
+ port.setFrame(SimpleFrame.wrapObject(value, null));
}
private final void transferInputFrames(FilterContext context) {
}
private final Frame wrapInputValue(String inputName, Object value) {
- MutableFrameFormat inputFormat = ObjectFormat.fromObject(value, FrameFormat.TARGET_JAVA);
+ MutableFrameFormat inputFormat = ObjectFormat.fromObject(value, FrameFormat.TARGET_SIMPLE);
if (value == null) {
// If the value is null, the format cannot guess the class, so we adjust it to the
// class of the input port here
// Create frame wrapper
Frame frame = shouldSerialize
? new SerializedFrame(inputFormat, null)
- : new JavaFrame(inputFormat, null);
+ : new SimpleFrame(inputFormat, null);
frame.setObjectValue(value);
return frame;
}
public static final int TYPE_OBJECT = 8;
public static final int TARGET_UNSPECIFIED = 0;
- public static final int TARGET_JAVA = 1;
+ public static final int TARGET_SIMPLE = 1;
public static final int TARGET_NATIVE = 2;
public static final int TARGET_GPU = 3;
public static final int TARGET_VERTEXBUFFER = 4;
public static String targetToString(int target) {
switch (target) {
case TARGET_UNSPECIFIED: return "unspecified";
- case TARGET_JAVA: return "java";
+ case TARGET_SIMPLE: return "simple";
case TARGET_NATIVE: return "native";
case TARGET_GPU: return "gpu";
case TARGET_VERTEXBUFFER: return "vbo";
return FrameFormat.TARGET_NATIVE;
} else if (targetString.equalsIgnoreCase("GPU")) {
return FrameFormat.TARGET_GPU;
- } else if (targetString.equalsIgnoreCase("JAVA")) {
- return FrameFormat.TARGET_JAVA;
+ } else if (targetString.equalsIgnoreCase("SIMPLE")) {
+ return FrameFormat.TARGET_SIMPLE;
} else if (targetString.equalsIgnoreCase("VERTEXBUFFER")) {
return FrameFormat.TARGET_VERTEXBUFFER;
} else if (targetString.equalsIgnoreCase("UNSPECIFIED")) {
nativeCopyFromNative((NativeFrame)frame);
} else if (frame instanceof GLFrame) {
nativeCopyFromGL((GLFrame)frame);
- } else if (frame instanceof JavaFrame) {
+ } else if (frame instanceof SimpleFrame) {
setObjectValue(frame.getObjectValue());
} else {
super.setDataFromFrame(frame);
+++ /dev/null
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package android.filterfw.core;
-
-import android.filterfw.core.Frame;
-import android.filterfw.core.KeyValueMap;
-import android.filterfw.core.Program;
-
-/**
- * @hide
- */
-public abstract class JavaProgram extends Program {
-
- private KeyValueMap mHostVariables;
-
- public JavaProgram() {
- mHostVariables = new KeyValueMap();
- }
-
- @Override
- public abstract void process(Frame[] inputs, Frame output);
-
- @Override
- public void setHostValue(String variableName, Object value) {
- mHostVariables.put(variableName, value);
- }
-
- @Override
- public Object getHostValue(String variableName) {
- return mHostVariables.get(variableName);
- }
-
-}
nativeCopyFromNative((NativeFrame)frame);
} else if (frame instanceof GLFrame) {
nativeCopyFromGL((GLFrame)frame);
- } else if (frame instanceof JavaFrame) {
+ } else if (frame instanceof SimpleFrame) {
setObjectValue(frame.getObjectValue());
} else {
super.setDataFromFrame(frame);
}
static SerializedFrame wrapObject(Object object, FrameManager frameManager) {
- FrameFormat format = ObjectFormat.fromObject(object, FrameFormat.TARGET_JAVA);
+ FrameFormat format = ObjectFormat.fromObject(object, FrameFormat.TARGET_SIMPLE);
SerializedFrame result = new SerializedFrame(format, frameManager);
result.setObjectValue(object);
return result;
/**
* @hide
*/
-public class JavaFrame extends Frame {
+public class SimpleFrame extends Frame {
private Object mObject;
- JavaFrame(FrameFormat format, FrameManager frameManager) {
+ SimpleFrame(FrameFormat format, FrameManager frameManager) {
super(format, frameManager);
initWithFormat(format);
setReusable(false);
}
- static JavaFrame wrapObject(Object object, FrameManager frameManager) {
- FrameFormat format = ObjectFormat.fromObject(object, FrameFormat.TARGET_JAVA);
- JavaFrame result = new JavaFrame(format, frameManager);
+ static SimpleFrame wrapObject(Object object, FrameManager frameManager) {
+ FrameFormat format = ObjectFormat.fromObject(object, FrameFormat.TARGET_SIMPLE);
+ SimpleFrame result = new SimpleFrame(format, frameManager);
result.setObjectValue(object);
return result;
}
} else if (!format.getObjectClass().isAssignableFrom(object.getClass())) {
throw new RuntimeException(
"Attempting to set object value of type '" + object.getClass() + "' on " +
- "JavaFrame of type '" + format.getObjectClass() + "'!");
+ "SimpleFrame of type '" + format.getObjectClass() + "'!");
}
// Set the object value
@Override
public String toString() {
- return "JavaFrame (" + getFormat() + ")";
+ return "SimpleFrame (" + getFormat() + ")";
}
}
import android.filterfw.core.FrameManager;
import android.filterfw.core.GLFrame;
import android.filterfw.core.NativeFrame;
-import android.filterfw.core.JavaFrame;
+import android.filterfw.core.SimpleFrame;
import android.filterfw.core.VertexFrame;
/**
private Frame createNewFrame(FrameFormat format) {
Frame result = null;
switch(format.getTarget()) {
- case FrameFormat.TARGET_JAVA:
- result = new JavaFrame(format, this);
+ case FrameFormat.TARGET_SIMPLE:
+ result = new SimpleFrame(format, this);
break;
case FrameFormat.TARGET_NATIVE:
result.setDimensions(width, height);
result.setBytesPerSample(bytesPerSample);
result.setMetaValue(COLORSPACE_KEY, colorspace);
- if (target == FrameFormat.TARGET_JAVA) {
+ if (target == FrameFormat.TARGET_SIMPLE) {
result.setObjectClass(Bitmap.class);
}
return result;
@Override
public void setupPorts() {
addMaskedInputPort("image", ImageFormat.create(ImageFormat.COLORSPACE_RGBA));
- addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_JAVA));
+ addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_SIMPLE));
addOutputBasedOnInput("image", "image");
}
FrameFormat.TARGET_GPU);
addMaskedInputPort("source", imageFormatMask);
addMaskedInputPort("overlay", imageFormatMask);
- addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_JAVA));
+ addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_SIMPLE));
addOutputBasedOnInput("image", "source");
}
public void setupPorts() {
addMaskedInputPort("image", ImageFormat.create(ImageFormat.COLORSPACE_RGBA,
FrameFormat.TARGET_GPU));
- addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_JAVA));
+ addMaskedInputPort("box", ObjectFormat.fromClass(Quad.class, FrameFormat.TARGET_SIMPLE));
addOutputBasedOnInput("image", "image");
}
import android.filterfw.core.Frame;
import android.filterfw.core.FrameFormat;
import android.filterfw.core.GenerateFieldPort;
-import android.filterfw.core.JavaFrame;
import android.filterfw.format.ObjectFormat;
import java.lang.Math;
@Override
public void setupPorts() {
- mOutputFormat = ObjectFormat.fromClass(Float.class, FrameFormat.TARGET_JAVA);
+ mOutputFormat = ObjectFormat.fromClass(Float.class, FrameFormat.TARGET_SIMPLE);
addOutputPort("value", mOutputFormat);
}
import android.filterfw.core.Frame;
import android.filterfw.core.FrameFormat;
import android.filterfw.core.GenerateFieldPort;
-import android.filterfw.core.JavaFrame;
import android.filterfw.format.ObjectFormat;
import android.os.SystemClock;
addInputPort("frame");
// Add output ports
- mOutputFormat = ObjectFormat.fromClass(Throughput.class, FrameFormat.TARGET_JAVA);
+ mOutputFormat = ObjectFormat.fromClass(Throughput.class, FrameFormat.TARGET_SIMPLE);
addOutputBasedOnInput("frame", "frame");
addOutputPort("throughput", mOutputFormat);
}
import android.filterfw.core.FilterContext;
import android.filterfw.core.Frame;
import android.filterfw.core.FrameFormat;
-import android.filterfw.core.JavaFrame;
import android.filterfw.format.ObjectFormat;
import android.util.Log;
@Override
public void setupPorts() {
- addMaskedInputPort("string", ObjectFormat.fromClass(String.class, FrameFormat.TARGET_JAVA));
+ addMaskedInputPort("string", ObjectFormat.fromClass(String.class,
+ FrameFormat.TARGET_SIMPLE));
}
@Override
import android.filterfw.core.GenerateFieldPort;
import android.filterfw.core.KeyValueMap;
import android.filterfw.core.MutableFrameFormat;
-import android.filterfw.core.JavaFrame;
import android.filterfw.format.ObjectFormat;
/**
@Override
public void setupPorts() {
- mOutputFormat = ObjectFormat.fromClass(String.class, FrameFormat.TARGET_JAVA);
+ mOutputFormat = ObjectFormat.fromClass(String.class, FrameFormat.TARGET_SIMPLE);
addOutputPort("string", mOutputFormat);
}
import android.filterfw.core.FilterContext;
import android.filterfw.core.Frame;
import android.filterfw.core.FrameFormat;
-import android.filterfw.core.JavaFrame;
import android.filterfw.format.ObjectFormat;
/**
@Override
public void setupPorts() {
- mOutputFormat = ObjectFormat.fromClass(String.class, FrameFormat.TARGET_JAVA);
+ mOutputFormat = ObjectFormat.fromClass(String.class, FrameFormat.TARGET_SIMPLE);
addMaskedInputPort("mixedcase", mOutputFormat);
addOutputPort("uppercase", mOutputFormat);
}