TextureAssetLoader
@UnstableApi
public final class TextureAssetLoader implements AssetLoader
An AssetLoader implementation that loads videos from traditional GLES texture instances.
Typically instantiated in a custom AssetLoader.Factory saving a reference to the created TextureAssetLoader. Provide video frames as input by calling queueInputTexture, then signal the end of input when finished. Those methods must be called from the same thread, which can be any thread.
Summary
Public constructors |
|---|
Creates an instance. |
Public methods |
|
|---|---|
ImmutableMap<Integer, String> |
Return the used decoders' names. |
int |
@Transformer.ProgressStateReturns the current |
boolean |
Attempts to provide an input texture. |
void |
Stops loading data and releases all resources associated with the asset loader. |
void |
Signals that no further input frames will be rendered. |
void |
Starts the asset loader. |
Inherited Constants |
||||
|---|---|---|---|---|
|
Public constructors
TextureAssetLoader
publicTextureAssetLoader(
EditedMediaItem editedMediaItem,
AssetLoader.Listener assetLoaderListener,
Format format,
OnInputFrameProcessedListener frameProcessedListener
)
Creates an instance.
The durationUs, width and height must be set.
| Parameters | |
|---|---|
EditedMediaItem editedMediaItem |
Information about the media item for which frames are provided. |
AssetLoader.Listener assetLoaderListener |
Listener for asset loading events. |
Format format |
Information about the format of video frames. |
OnInputFrameProcessedListener frameProcessedListener |
Listener for the event when a frame has been processed. The listener receives a GL sync object (if supported) to allow reusing the texture after it's no longer in use. |
Public methods
getDecoderNames
public ImmutableMap<Integer, String>getDecoderNames()
Return the used decoders' names.
| Returns | |
|---|---|
ImmutableMap<Integer, String> |
The decoders' names keyed by |
getProgress
@Transformer.ProgressState
public intgetProgress(ProgressHolder progressHolder)
Returns the current Transformer.ProgressState and updates progressHolder with the current progress if it is available.
| Parameters | |
|---|---|
ProgressHolder progressHolder |
A |
| Returns | |
|---|---|
int |
queueInputTexture
public boolean queueInputTexture(int texId, long presentationTimeUs)Attempts to provide an input texture.
Must be called on the same thread as signalEndOfVideoInput.
| Parameters | |
|---|---|
int texId |
The ID of the texture to queue. |
long presentationTimeUs |
The presentation time for the texture, in microseconds. |
| Returns | |
|---|---|
boolean |
Whether the texture was successfully queued. If |
release
public void release()Stops loading data and releases all resources associated with the asset loader.
signalEndOfVideoInput
public void signalEndOfVideoInput()Signals that no further input frames will be rendered.
Must be called on the same thread as queueInputTexture.