FileDocCategorySizeDatePackage
ObjectSource.javaAPI DocAndroid 5.1 API2718Thu Mar 12 22:22:30 GMT 2015android.filterpacks.base

ObjectSource

public class ObjectSource extends android.filterfw.core.Filter
hide

Fields Summary
private Object
mObject
private android.filterfw.core.FrameFormat
mOutputFormat
boolean
mRepeatFrame
private android.filterfw.core.Frame
mFrame
Constructors Summary
public ObjectSource(String name)


       
        super(name);
    
Methods Summary
public voidfieldPortValueUpdated(java.lang.String name, android.filterfw.core.FilterContext context)

        // Release our internal frame, so that it is regenerated on the next call to process().
        if (name.equals("object")) {
            if (mFrame != null) {
                mFrame.release();
                mFrame = null;
            }
        }
    
public voidprocess(android.filterfw.core.FilterContext context)

        // If no frame has been created, create one now.
        if (mFrame == null) {
            if (mObject == null) {
                throw new NullPointerException("ObjectSource producing frame with no object set!");
            }
            FrameFormat outputFormat = ObjectFormat.fromObject(mObject, FrameFormat.TARGET_SIMPLE);
            mFrame = context.getFrameManager().newFrame(outputFormat);
            mFrame.setObjectValue(mObject);
            mFrame.setTimestamp(Frame.TIMESTAMP_UNKNOWN);
        }

        // Push output
        pushOutput("frame", mFrame);

        // Wait for free output
        if (!mRepeatFrame) {
            closeOutputPort("frame");
        }
    
public voidsetupPorts()

        addOutputPort("frame", mOutputFormat);
    
public voidtearDown(android.filterfw.core.FilterContext context)

        mFrame.release();