Methods Summary |
---|
public synchronized void | close()
if (isRunning()) {
throw new RuntimeException("Cannot close graph while it is running!");
}
if (mLogVerbose) Log.v(TAG, "Closing filters.");
mRunner.close();
|
public synchronized java.lang.Exception | getError()
return mException;
|
public FilterGraph | getGraph()
return mRunner != null ? mRunner.getGraph() : null;
|
public synchronized boolean | isRunning()Check if background processing is happening
return isProcessing;
|
public synchronized void | run()Execute the graph in a background thread.
if (mLogVerbose) Log.v(TAG, "Running graph.");
setException(null);
if (isRunning()) {
throw new RuntimeException("Graph is already running!");
}
if (mRunner == null) {
throw new RuntimeException("Cannot run before a graph is set!");
}
mRunTask = this.new AsyncRunnerTask();
setRunning(true);
mRunTask.execute(mRunner);
|
public void | setDoneCallback(OnRunnerDoneListener listener)Set a callback to be called in the UI thread once the AsyncRunner
completes running a graph, whether the completion is due to a stop() call
or the filters running out of data to process.
mDoneListener = listener;
|
private synchronized void | setException(java.lang.Exception exception)
mException = exception;
|
public synchronized void | setGraph(FilterGraph graph)Sets the graph to be run. Will call prepare() on graph. Cannot be called
when a graph is already running.
if (isRunning()) {
throw new RuntimeException("Graph is already running!");
}
mRunner = new SyncRunner(mFilterContext, graph, mSchedulerClass);
|
private synchronized void | setRunning(boolean running)
isProcessing = running;
|
public synchronized void | stop()Stop graph execution. This is an asynchronous call; register a callback
with setDoneCallback to be notified of when the background processing has
been completed. Calling stop will close the filter graph.
if (mRunTask != null && !mRunTask.isCancelled() ) {
if (mLogVerbose) Log.v(TAG, "Stopping graph.");
mRunTask.cancel(false);
}
|