OutputHandler

public class OutputHandler<OutputT extends TaskResult, InputT>

Base class for handling MediaPipe task graph outputs.

Summary

Nested types

public interface OutputHandler.OutputPacketConverter<OutputT extends TaskResult, InputT>

Interface for converting MediaPipe graph output Packets to task result object and task input object.

public interface OutputHandler.ProgressListener<OutputT>

Interface for the customizable MediaPipe task result listener that receives partial task updates until it is invoked with `done` set to true.

public interface OutputHandler.PureResultListener<OutputT extends TaskResult>

Interface for the customizable MediaPipe task result listener that can only retrieve task result objects.

public interface OutputHandler.ResultListener<OutputT extends TaskResult, InputT>

Interface for the customizable MediaPipe task result listener that can retrieve both task result objects and the corresponding input data.

public interface OutputHandler.ValueListener<OutputT>

Interface for the customizable MediaPipe task result listener that only receives a task's output value.

Public constructors

Public methods

long
OutputT
void

Sets a callback to be invoked when exceptions are thrown from the task graph.

void
setHandleTimestampBoundChanges(boolean handleTimestampBoundChanges)

Sets whether the output handler should react to the timestamp bound changes that are represented as empty output Packets.

void

Sets a callback to be invoked to convert a Packet list to a task result object and a task input object.

void
setResultListener(
    OutputHandler.ResultListener<OutputT, InputT> listener
)

Sets a callback to be invoked when task result objects become available.

Protected fields

cachedTaskResult

protected OutputT cachedTaskResult

errorListener

protected ErrorListener errorListener

latestOutputTimestamp

protected long latestOutputTimestamp

Public constructors

OutputHandler

public OutputHandler()

Public methods

getLatestOutputTimestamp

public long getLatestOutputTimestamp()

retrieveCachedTaskResult

public OutputT retrieveCachedTaskResult()

setErrorListener

public void setErrorListener(ErrorListener listener)

Sets a callback to be invoked when exceptions are thrown from the task graph.

Parameters
ErrorListener listener

The user-defined ErrorListener callback.

setHandleTimestampBoundChanges

public void setHandleTimestampBoundChanges(boolean handleTimestampBoundChanges)

Sets whether the output handler should react to the timestamp bound changes that are represented as empty output Packets.

Parameters
boolean handleTimestampBoundChanges

A boolean value.

setOutputPacketConverter

public void setOutputPacketConverter(
    OutputHandler.OutputPacketConverter<OutputT, InputT> converter
)

Sets a callback to be invoked to convert a Packet list to a task result object and a task input object.

Parameters
OutputHandler.OutputPacketConverter<OutputT, InputT> converter

the task-specific OutputPacketConverter callback.

setResultListener

public void setResultListener(
    OutputHandler.ResultListener<OutputT, InputT> listener
)

Sets a callback to be invoked when task result objects become available.

Parameters
OutputHandler.ResultListener<OutputT, InputT> listener

the user-defined ResultListener callback.