DefaultAssetLoaderFactory


@UnstableApi
public final class DefaultAssetLoaderFactory implements AssetLoader.Factory


The default AssetLoader.Factory implementation.

Summary

Public constructors

DefaultAssetLoaderFactory(
    Context context,
    boolean forceInterpretHdrAsSdr,
    BitmapLoader bitmapLoader
)

Creates an instance with the default Clock and Codec.DecoderFactory.

DefaultAssetLoaderFactory(
    Context context,
    Codec.DecoderFactory decoderFactory,
    boolean forceInterpretHdrAsSdr,
    Clock clock
)

Creates an instance.

DefaultAssetLoaderFactory(
    Context context,
    Codec.DecoderFactory decoderFactory,
    boolean forceInterpretHdrAsSdr,
    Clock clock,
    MediaSource.Factory mediaSourceFactory,
    BitmapLoader bitmapLoader
)

Creates an instance.

Public methods

AssetLoader
createAssetLoader(
    EditedMediaItem editedMediaItem,
    Looper looper,
    AssetLoader.Listener listener
)

Creates an AssetLoader instance.

Public constructors

DefaultAssetLoaderFactory

public DefaultAssetLoaderFactory(
    Context context,
    boolean forceInterpretHdrAsSdr,
    BitmapLoader bitmapLoader
)

Creates an instance with the default Clock and Codec.DecoderFactory.

For multi-picture formats (e.g. gifs), a single image frame from the container is loaded. The frame loaded is determined by the BitmapLoader implementation.

Parameters
Context context

The Context.

boolean forceInterpretHdrAsSdr

Whether to apply HDR_MODE_EXPERIMENTAL_FORCE_INTERPRET_HDR_AS_SDR.

BitmapLoader bitmapLoader

The BitmapLoader to use to load and decode images.

DefaultAssetLoaderFactory

public DefaultAssetLoaderFactory(
    Context context,
    Codec.DecoderFactory decoderFactory,
    boolean forceInterpretHdrAsSdr,
    Clock clock
)

Creates an instance.

Uses DataSourceBitmapLoader to load images, setting the inPreferredColorSpace to SRGB when possible.

Parameters
Context context

The Context.

Codec.DecoderFactory decoderFactory

The Codec.DecoderFactory to use to decode the samples (if necessary).

boolean forceInterpretHdrAsSdr

Whether to apply HDR_MODE_EXPERIMENTAL_FORCE_INTERPRET_HDR_AS_SDR.

Clock clock

The Clock to use. It should always be DEFAULT, except for testing.

DefaultAssetLoaderFactory

public DefaultAssetLoaderFactory(
    Context context,
    Codec.DecoderFactory decoderFactory,
    boolean forceInterpretHdrAsSdr,
    Clock clock,
    MediaSource.Factory mediaSourceFactory,
    BitmapLoader bitmapLoader
)

Creates an instance.

Parameters
Context context

The Context.

Codec.DecoderFactory decoderFactory

The Codec.DecoderFactory to use to decode the samples (if necessary).

boolean forceInterpretHdrAsSdr

Whether to apply HDR_MODE_EXPERIMENTAL_FORCE_INTERPRET_HDR_AS_SDR.

Clock clock

The Clock to use. It should always be DEFAULT, except for testing.

MediaSource.Factory mediaSourceFactory

The MediaSource.Factory to use to retrieve the samples to transform when an ExoPlayerAssetLoader is used.

BitmapLoader bitmapLoader

The BitmapLoader to use to load and decode images.

Public methods

createAssetLoader

public AssetLoader createAssetLoader(
    EditedMediaItem editedMediaItem,
    Looper looper,
    AssetLoader.Listener listener
)

Creates an AssetLoader instance.

Parameters
EditedMediaItem editedMediaItem

The EditedMediaItem to load.

Looper looper

The Looper that's used to access the AssetLoader after it's been created.

AssetLoader.Listener listener

The Listener on which the AssetLoader should notify of events.

Returns
AssetLoader

An AssetLoader.