DefaultGlFrameProcessor


@ExperimentalApi
@RequiresApi(value = 26)
public final class DefaultGlFrameProcessor implements FrameProcessor


A FrameProcessor implementation that executes a chain of GlTextureFrameConsumers.

Summary

Nested types

A FrameProcessor.Factory that creates DefaultGlFrameProcessor instances.

Constants

static final String
KEY_COMPOSITION_EFFECTS = "KEY_COMPOSITION_EFFECTS"

Metadata key for storing the List of video effects to apply on the composited frames, in frame metadata.

static final String
KEY_COMPOSITION_SEQUENCE_INDEX = "KEY_COMPOSITION_SEQUENCE_INDEX"

Metadata key for storing the integer index to identify the source sequence in a Composition from which an input frame comes, in frame metadata.

static final String
KEY_COMPOSITOR_SETTINGS = "KEY_COMPOSITOR_SETTINGS"

Metadata key for storing the VideoCompositorSettings, in frame metadata.

static final String
KEY_FRAME_DISCONTINUITY_NUMBER = "KEY_FRAME_DISCONTINUITY_NUMBER"

Metadata key for storing the frame discontinuity number, in getMetadata and getMetadata.

static final String
KEY_ITEM_EFFECTS = "KEY_ITEM_EFFECTS"

Metadata key for storing the List of video effects to apply on a single media item, in frame metadata.

Public methods

void

Blocks until all resources are released.

boolean

Attempts to queue a List of frames for processing.

void

Notifies this processor that the current stream has ended.

Inherited methods

From java.lang.AutoCloseable
abstract void

Constants

KEY_COMPOSITION_EFFECTS

public static final String KEY_COMPOSITION_EFFECTS = "KEY_COMPOSITION_EFFECTS"

Metadata key for storing the List of video effects to apply on the composited frames, in frame metadata.

The order of effect application is KEY_ITEM_EFFECTS, KEY_COMPOSITOR_SETTINGS and then KEY_COMPOSITION_EFFECTS.

KEY_COMPOSITION_SEQUENCE_INDEX

public static final String KEY_COMPOSITION_SEQUENCE_INDEX = "KEY_COMPOSITION_SEQUENCE_INDEX"

Metadata key for storing the integer index to identify the source sequence in a Composition from which an input frame comes, in frame metadata.

KEY_COMPOSITOR_SETTINGS

public static final String KEY_COMPOSITOR_SETTINGS = "KEY_COMPOSITOR_SETTINGS"

Metadata key for storing the VideoCompositorSettings, in frame metadata.

When using CompositionPlayer or Transformer, the value is Composition#videoCompositorSettings.

The order of effect application is KEY_ITEM_EFFECTS, KEY_COMPOSITOR_SETTINGS and then KEY_COMPOSITION_EFFECTS.

KEY_FRAME_DISCONTINUITY_NUMBER

public static final String KEY_FRAME_DISCONTINUITY_NUMBER = "KEY_FRAME_DISCONTINUITY_NUMBER"

Metadata key for storing the frame discontinuity number, in getMetadata and getMetadata.

The number is an integer, incremented every time the player reports a discontinuity (for example, when seeking).

The number is only mandatory for previewing use cases. It is used to trigger flushes in GlShaderProgram implementations during discontinuities.

KEY_ITEM_EFFECTS

public static final String KEY_ITEM_EFFECTS = "KEY_ITEM_EFFECTS"

Metadata key for storing the List of video effects to apply on a single media item, in frame metadata.

The order of effect application is KEY_ITEM_EFFECTS, KEY_COMPOSITOR_SETTINGS and then KEY_COMPOSITION_EFFECTS.

Public methods

close

public void close()

Blocks until all resources are released.

queue

public boolean queue(List<AsyncFrame> frames)

Attempts to queue a List of frames for processing.

All frames provided in a single invocation of this method represent the exact same point in time.

If this consumer is at capacity, this method returns false and the onWakeup will be invoked when capacity becomes available.

If this method returns true, onFrameProcessed must be called once with every input frame instance queued, once the FrameProcessor has finished processing the frames.

Parameters
List<AsyncFrame> frames

The frames to queue.

Returns
boolean

true if the frames were queued, false if the consumer is at capacity.

signalEndOfStream

public void signalEndOfStream()

Notifies this processor that the current stream has ended.

More frames may be queued after calling this method, if the current stream changes.