SingleInputVideoGraph


@UnstableApi
abstract class SingleInputVideoGraph : VideoGraph

Known direct subclasses
PreviewingSingleInputVideoGraph

A Previewing specific implementation of .


A VideoGraph that handles one input stream.

Summary

Constants

const Int

The ID registerInput returns.

Public constructors

SingleInputVideoGraph(
    context: Context!,
    videoFrameProcessorFactory: VideoFrameProcessor.Factory!,
    inputColorInfo: ColorInfo!,
    outputColorInfo: ColorInfo!,
    listener: VideoGraph.Listener!,
    debugViewProvider: DebugViewProvider!,
    listenerExecutor: Executor!,
    videoCompositorSettings: VideoCompositorSettings!,
    renderFramesAutomatically: Boolean,
    presentation: Presentation?,
    initialTimestampOffsetUs: Long
)

Creates an instance.

Public functions

VideoFrameProcessor!
getProcessor(inputId: Int)

Returns the VideoFrameProcessor that handles the processing for an input registered via registerInput.

Boolean

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

Unit

Initialize the VideoGraph}.

Int

Registers a new input to the VideoGraph.

Unit

Releases the associated resources.

Unit
setOutputSurfaceInfo(outputSurfaceInfo: SurfaceInfo?)

Sets the output surface and supporting information.

Constants

SINGLE_INPUT_INDEX

const val SINGLE_INPUT_INDEX = 0: Int

The ID registerInput returns.

Public constructors

SingleInputVideoGraph

SingleInputVideoGraph(
    context: Context!,
    videoFrameProcessorFactory: VideoFrameProcessor.Factory!,
    inputColorInfo: ColorInfo!,
    outputColorInfo: ColorInfo!,
    listener: VideoGraph.Listener!,
    debugViewProvider: DebugViewProvider!,
    listenerExecutor: Executor!,
    videoCompositorSettings: VideoCompositorSettings!,
    renderFramesAutomatically: Boolean,
    presentation: Presentation?,
    initialTimestampOffsetUs: Long
)

Creates an instance.

videoCompositorSettings must be DEFAULT.

Public functions

getProcessor

fun getProcessor(inputId: Int): VideoFrameProcessor!

Returns the VideoFrameProcessor that handles the processing for an input registered via registerInput. If the inputId is not registered before, this method will throw an IllegalStateException.

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.

registerInput

fun registerInput(): Int

Registers a new input to the VideoGraph.

A underlying processing VideoFrameProcessor is created every time this method is called.

If the method throws, the caller must call release.

Returns
Int

The id of the registered input, which can be used to get the underlying via getProcessor.

release

fun release(): Unit

Releases the associated resources.

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

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.

Protected properties

initialTimestampOffsetUs

protected val initialTimestampOffsetUsLong

inputColorInfo

protected val inputColorInfoColorInfo!

presentation

protected val presentationPresentation?