TestTransformerBuilder


@UnstableApi
public final class TestTransformerBuilder


A builder of Transformer instances for testing with Robolectric.

Transcoding video is unsupported in Robolectric tests. In order for a Transformer test instance to succeed with video input, make sure to configure the export in such a way that video samples are transmuxed (for example by not adding any video effects).

Images are unsupported in Robolectric tests.

Summary

Public constructors

Creates a new instance.

Public methods

TestTransformerBuilder

Adds a Transformer.Listener.

Transformer

Builds a Transformer instance for testing with Robolectric.

TestTransformerBuilder

Sets whether to use an MP4 edit list for trimming.

TestTransformerBuilder
@CanIgnoreReturnValue
experimentalSetTrimOptimizationEnabled(
    boolean trimOptimizationEnabled
)

Sets whether to enable the trim optimization.

TestTransformerBuilder

Sets the AssetLoader.Factory to use.

TestTransformerBuilder

Sets the audio MIME type of the output.

TestTransformerBuilder
@CanIgnoreReturnValue
setFallbackEnabled(boolean fallbackEnabled)

Sets whether to enable fallback.

TestTransformerBuilder
@CanIgnoreReturnValue
setForceTransformerToFail(boolean forceTransformerToFail)

Sets whether Transformer should be forced to fail.

TestTransformerBuilder

Sets the Looper that must be used for all calls to the transformer and that is used to call listeners on.

TestTransformerBuilder
@CanIgnoreReturnValue
setMaxDelayBetweenMuxerSamplesMs(long maxDelayBetweenMuxerSamplesMs)

Sets the maximum delay allowed between output samples.

TestTransformerBuilder

Sets the Muxer.Factory to use.

Public constructors

TestTransformerBuilder

public TestTransformerBuilder(Context context)

Creates a new instance.

Public methods

addListener

@CanIgnoreReturnValue
public TestTransformerBuilder addListener(Transformer.Listener listener)

Adds a Transformer.Listener.

Parameters
Transformer.Listener listener

A @link Transformer.Listener}.

Returns
TestTransformerBuilder

This builder.

See also
addListener

build

public Transformer build()

Builds a Transformer instance for testing with Robolectric.

experimentalSetMp4EditListTrimEnabled

@CanIgnoreReturnValue
public TestTransformerBuilder experimentalSetMp4EditListTrimEnabled(boolean enabled)

Sets whether to use an MP4 edit list for trimming.

Parameters
boolean enabled

Whether to enable the trim optimization.

Returns
TestTransformerBuilder

This builder.

experimentalSetTrimOptimizationEnabled

@CanIgnoreReturnValue
public TestTransformerBuilder experimentalSetTrimOptimizationEnabled(
    boolean trimOptimizationEnabled
)

Sets whether to enable the trim optimization.

Parameters
boolean trimOptimizationEnabled

Whether to enable the trim optimization.

Returns
TestTransformerBuilder

This builder.

setAssetLoaderFactory

@CanIgnoreReturnValue
public TestTransformerBuilder setAssetLoaderFactory(AssetLoader.Factory assetLoaderFactory)

Sets the AssetLoader.Factory to use.

Parameters
AssetLoader.Factory assetLoaderFactory

The AssetLoader.Factory to use.

Returns
TestTransformerBuilder

This builder.

setAudioMimeType

@CanIgnoreReturnValue
public TestTransformerBuilder setAudioMimeType(String audioMimeType)

Sets the audio MIME type of the output.

Parameters
String audioMimeType

The audio MIME type of the output.

Returns
TestTransformerBuilder

This builder.

See also
setAudioMimeType

setFallbackEnabled

@CanIgnoreReturnValue
public TestTransformerBuilder setFallbackEnabled(boolean fallbackEnabled)

Sets whether to enable fallback.

The default value is false.

Parameters
boolean fallbackEnabled

Whether to enable fallback.

Returns
TestTransformerBuilder

This builder.

setForceTransformerToFail

@CanIgnoreReturnValue
public TestTransformerBuilder setForceTransformerToFail(boolean forceTransformerToFail)

Sets whether Transformer should be forced to fail.

If set, transformer's onError callback will be called when transformer fails.

The default value is false.

Parameters
boolean forceTransformerToFail

Whether Transformer should be forced to fail.

Returns
TestTransformerBuilder

This builder.

setLooper

@CanIgnoreReturnValue
public TestTransformerBuilder setLooper(Looper looper)

Sets the Looper that must be used for all calls to the transformer and that is used to call listeners on.

Parameters
Looper looper

The Looper to use.

Returns
TestTransformerBuilder

This builder.

See also
setLooper

setMaxDelayBetweenMuxerSamplesMs

@CanIgnoreReturnValue
public TestTransformerBuilder setMaxDelayBetweenMuxerSamplesMs(long maxDelayBetweenMuxerSamplesMs)

Sets the maximum delay allowed between output samples.

Parameters
long maxDelayBetweenMuxerSamplesMs

The maximum delay allowed between output samples, in milliseconds.

Returns
TestTransformerBuilder

This builder.

setMuxerFactory

@CanIgnoreReturnValue
public TestTransformerBuilder setMuxerFactory(Muxer.Factory muxerFactory)

Sets the Muxer.Factory to use.

Parameters
Muxer.Factory muxerFactory

The Muxer.Factory to use.

Returns
TestTransformerBuilder

This builder.

See also
setMuxerFactory