MultipleInputVideoGraph


@UnstableApi
class MultipleInputVideoGraph : VideoGraph


A VideoGraph that handles multiple input streams.

Summary

Public functions

Unit

Flushes the inputs of the VideoGraph.

Surface!
getInputSurface(inputIndex: Int)

Returns the input Surface at inputIndex.

Int

Returns the number of pending input frames at inputIndex that has not been processed yet.

Boolean

Returns whether the VideoGraph has produced a frame with zero presentation timestamp.

Unit

Initialize the VideoGraph}.

Boolean
queueInputBitmap(
    inputIndex: Int,
    inputBitmap: Bitmap!,
    timestampIterator: TimestampIterator!
)

Queues the input Bitmap at inputIndex.

Boolean
queueInputTexture(
    inputIndex: Int,
    textureId: Int,
    presentationTimeUs: Long
)

Queues the input texture at inputIndex.

Unit

Updates an available frame with the modified effects.

Unit
registerInput(inputIndex: @IntRange(from = 0) Int)

Registers a new input to the VideoGraph.

Boolean
registerInputFrame(inputIndex: Int)

Registers a new input frame at inputIndex.

Unit
registerInputStream(
    inputIndex: Int,
    @VideoFrameProcessor.InputType inputType: Int,
    format: Format!,
    effects: (Mutable)List<Effect!>!,
    offsetToAddUs: Long
)

Informs the graph that a new input stream will be queued to the graph input corresponding to inputIndex.

Unit

Releases the associated resources.

Unit
renderOutputFrame(renderTimeNs: Long)

Renders the output frame from the VideoGraph.

Unit
setOnInputFrameProcessedListener(
    inputIndex: Int,
    listener: OnInputFrameProcessedListener!
)

Sets the OnInputFrameProcessedListener at inputIndex.

Unit
setOnInputSurfaceReadyListener(inputIndex: Int, listener: Runnable!)

Sets a listener that's called when the input surface is ready to use at inputIndex.

Unit
setOutputSurfaceInfo(outputSurfaceInfo: SurfaceInfo?)

Sets the output surface and supporting information.

Unit
signalEndOfInput(inputIndex: Int)

Informs that no further inputs should be accepted at inputIndex.

Public functions

flush

fun flush(): Unit

Flushes the inputs of the VideoGraph.

See also
flush

getInputSurface

fun getInputSurface(inputIndex: Int): Surface!

Returns the input Surface at inputIndex.

getPendingInputFrameCount

fun getPendingInputFrameCount(inputIndex: Int): Int

Returns the number of pending input frames at inputIndex that has not been processed yet.

hasProducedFrameWithTimestampZero

fun hasProducedFrameWithTimestampZero(): Boolean

Returns whether the VideoGraph has produced a frame with zero presentation timestamp.

initialize

fun initialize(): Unit

Initialize the VideoGraph}.

This method must be called before calling other methods.

If the method throws, the caller must call #release.

This method must be called at most once.

queueInputBitmap

fun queueInputBitmap(
    inputIndex: Int,
    inputBitmap: Bitmap!,
    timestampIterator: TimestampIterator!
): Boolean

Queues the input Bitmap at inputIndex.

See also
queueInputBitmap

queueInputTexture

fun queueInputTexture(
    inputIndex: Int,
    textureId: Int,
    presentationTimeUs: Long
): Boolean

Queues the input texture at inputIndex.

redraw

fun redraw(): Unit

Updates an available frame with the modified effects.

registerInput

fun registerInput(inputIndex: @IntRange(from = 0) Int): Unit

Registers a new input to the VideoGraph.

All inputs must be registered before rendering frames by calling registerInputFrame, queueInputBitmap or queueInputTexture.

If the method throws, the caller must call release.

Parameters
inputIndex: @IntRange(from = 0) Int

The index of the input which could be used to order the inputs. The index must start from 0.

registerInputFrame

fun registerInputFrame(inputIndex: Int): Boolean

Registers a new input frame at inputIndex.

registerInputStream

fun registerInputStream(
    inputIndex: Int,
    @VideoFrameProcessor.InputType inputType: Int,
    format: Format!,
    effects: (Mutable)List<Effect!>!,
    offsetToAddUs: Long
): Unit

Informs the graph that a new input stream will be queued to the graph input corresponding to inputIndex.

After registering the first input stream, this method must only be called for the same index after the last frame of the already-registered input stream has been registered, last bitmap queued or last texture id queued.

This method blocks the calling thread until the previous input stream corresponding to the same inputIndex has been fully registered internally.

Parameters
inputIndex: Int

The index of the input for which a new input stream should be registered. This index must start from 0.

@VideoFrameProcessor.InputType inputType: Int

The InputType of the new input stream.

format: Format!

The Format of the new input stream. The colorInfo, the width, the height and the pixelWidthHeightRatio must be set.

effects: (Mutable)List<Effect!>!

The list of effects to apply to the new input stream.

offsetToAddUs: Long

The offset that must be added to the frame presentation timestamps, in microseconds. This offset is not part of the input timestamps. It is added to the frame timestamps before processing, and is retained in the output timestamps.

release

fun release(): Unit

Releases the associated resources.

This VideoGraph instance must not be used after this method is called.

renderOutputFrame

fun renderOutputFrame(renderTimeNs: Long): Unit

Renders the output frame from the VideoGraph.

This method must be called only for frames that have become available, calling the method renders the frame that becomes available the earliest but not yet rendered.

setOnInputFrameProcessedListener

fun setOnInputFrameProcessedListener(
    inputIndex: Int,
    listener: OnInputFrameProcessedListener!
): Unit

Sets the OnInputFrameProcessedListener at inputIndex.

setOnInputSurfaceReadyListener

fun setOnInputSurfaceReadyListener(inputIndex: Int, listener: Runnable!): Unit

Sets a listener that's called when the input surface is ready to use at inputIndex.

setOutputSurfaceInfo

fun setOutputSurfaceInfo(outputSurfaceInfo: SurfaceInfo?): Unit

Sets the output surface and supporting information.

The new output SurfaceInfo is applied from the next output frame rendered onwards. If the output SurfaceInfo is null, the VideoGraph will stop rendering pending frames and resume rendering once a non-null SurfaceInfo is set.

If the dimensions given in SurfaceInfo do not match the output size after applying the final effect the frames are resized before rendering to the surface and letter/pillar-boxing is applied.

The caller is responsible for tracking the lifecycle of the surface including calling this method with a new surface if it is destroyed. When this method returns, the previous output surface is no longer being used and can safely be released by the caller.

signalEndOfInput

fun signalEndOfInput(inputIndex: Int): Unit

Informs that no further inputs should be accepted at inputIndex.

See also
signalEndOfInput