RawAssetLoader
@UnstableApi
public final class RawAssetLoader implements AssetLoader
An AssetLoader implementation that loads raw audio and/or video data.
Typically instantiated in a custom AssetLoader.Factory saving a reference to the created RawAssetLoader.
Provide raw audio data as input by calling queueAudioData. This method must always be called from the same thread, which can be any thread.
Provide video frames as input by calling queueInputTexture, then signal the end of input when finished. These two methods must be called from the same thread, which can be any thread.
All other methods are for internal use only and must never be called.
Summary
Public constructors |
|---|
RawAssetLoader(Creates an instance. |
Public methods |
|
|---|---|
ImmutableMap<Integer, String> |
Return the used decoders' names. |
int |
@Transformer.ProgressStateReturns the current |
boolean |
queueAudioData(Attempts to provide raw audio data. |
boolean |
queueInputTexture(int texId, long presentationTimeUs)Attempts to provide an input texture. |
void |
release()Stops loading data and releases all resources associated with the asset loader. |
void |
Signals that no further input frames will be rendered. |
void |
start()Starts the asset loader. |
Inherited Constants |
||||
|---|---|---|---|---|
|
Public constructors
RawAssetLoader
public RawAssetLoader(
EditedMediaItem editedMediaItem,
AssetLoader.Listener assetLoaderListener,
@Nullable Format audioFormat,
@Nullable Format videoFormat,
@Nullable OnInputFrameProcessedListener frameProcessedListener
)
Creates an instance.
| Parameters | |
|---|---|
EditedMediaItem editedMediaItem |
The |
AssetLoader.Listener assetLoaderListener |
Listener for asset loading events. |
@Nullable Format audioFormat |
The audio format, or |
@Nullable Format videoFormat |
The video format, or |
@Nullable OnInputFrameProcessedListener frameProcessedListener |
Listener for the event when a frame has been processed, or |
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 int getProgress(ProgressHolder progressHolder)
Returns the current Transformer.ProgressState and updates progressHolder with the current progress if it is available.
| Parameters | |
|---|---|
ProgressHolder progressHolder |
A |
| Returns | |
|---|---|
int |
queueAudioData
public boolean queueAudioData(
ByteBuffer audioData,
long presentationTimeUs,
boolean isLast
)
Attempts to provide raw audio data.
| Parameters | |
|---|---|
ByteBuffer audioData |
The raw audio data. The |
long presentationTimeUs |
The presentation time for the raw audio data, in microseconds. |
boolean isLast |
Signals the last audio data. |
| Returns | |
|---|---|
boolean |
Whether the raw audio data was successfully queued. If |
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.