Class Transformer.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.transformer.Transformer.Builder
-
- Enclosing class:
- Transformer
public static final class Transformer.Builder extends Object
A builder forTransformer
instances.
-
-
Method Summary
-
-
-
Method Detail
-
setTransformationRequest
@CanIgnoreReturnValue public Transformer.Builder setTransformationRequest(TransformationRequest transformationRequest)
Sets theTransformationRequest
which configures the editing and transcoding options.Actual applied values may differ, per device capabilities.
Transformer.Listener.onFallbackApplied(Composition, TransformationRequest, TransformationRequest)
will be invoked with the actual applied values.- Parameters:
transformationRequest
- TheTransformationRequest
.- Returns:
- This builder.
-
setAudioProcessors
@CanIgnoreReturnValue @Deprecated public Transformer.Builder setAudioProcessors(List<AudioProcessor> audioProcessors)
Deprecated.Set the audio processors in anEditedMediaItem
, and pass it toTransformer.start(EditedMediaItem, String)
instead.
-
setVideoEffects
@CanIgnoreReturnValue @Deprecated public Transformer.Builder setVideoEffects(List<Effect> effects)
Deprecated.Set the video effects in anEditedMediaItem
, and pass it toTransformer.start(EditedMediaItem, String)
instead.
-
setRemoveAudio
@CanIgnoreReturnValue @Deprecated public Transformer.Builder setRemoveAudio(boolean removeAudio)
Deprecated.UseEditedMediaItem.Builder.setRemoveAudio(boolean)
to remove the audio from theEditedMediaItem
passed toTransformer.start(EditedMediaItem, String)
instead.
-
setRemoveVideo
@CanIgnoreReturnValue @Deprecated public Transformer.Builder setRemoveVideo(boolean removeVideo)
Deprecated.UseEditedMediaItem.Builder.setRemoveVideo(boolean)
to remove the video from theEditedMediaItem
passed toTransformer.start(EditedMediaItem, String)
instead.
-
setFlattenForSlowMotion
@CanIgnoreReturnValue @Deprecated public Transformer.Builder setFlattenForSlowMotion(boolean flattenForSlowMotion)
Deprecated.UseEditedMediaItem.Builder.setFlattenForSlowMotion(boolean)
to flatten theEditedMediaItem
passed toTransformer.start(EditedMediaItem, String)
instead.
-
setListener
@CanIgnoreReturnValue @Deprecated public Transformer.Builder setListener(Transformer.Listener listener)
Deprecated.
-
addListener
@CanIgnoreReturnValue public Transformer.Builder addListener(Transformer.Listener listener)
Adds aTransformer.Listener
to listen to the export events.This is equivalent to
Transformer.addListener(Listener)
.- Parameters:
listener
- ATransformer.Listener
.- Returns:
- This builder.
-
removeListener
@CanIgnoreReturnValue public Transformer.Builder removeListener(Transformer.Listener listener)
Removes aTransformer.Listener
.This is equivalent to
Transformer.removeListener(Listener)
.- Parameters:
listener
- ATransformer.Listener
.- Returns:
- This builder.
-
removeAllListeners
@CanIgnoreReturnValue public Transformer.Builder removeAllListeners()
Removes all listeners.This is equivalent to
Transformer.removeAllListeners()
.- Returns:
- This builder.
-
setAssetLoaderFactory
@CanIgnoreReturnValue public Transformer.Builder setAssetLoaderFactory(AssetLoader.Factory assetLoaderFactory)
Sets theAssetLoader.Factory
to be used to retrieve the samples to export.The default value is a
DefaultAssetLoaderFactory
built with aDefaultMediaSourceFactory
and aDefaultDecoderFactory
.- Parameters:
assetLoaderFactory
- AnAssetLoader.Factory
.- Returns:
- This builder.
-
setVideoFrameProcessorFactory
@CanIgnoreReturnValue public Transformer.Builder setVideoFrameProcessorFactory(VideoFrameProcessor.Factory videoFrameProcessorFactory)
Sets the factory to be used to createVideoFrameProcessor
instances.The default value is a
DefaultVideoFrameProcessor.Factory
built with default values.- Parameters:
videoFrameProcessorFactory
- AVideoFrameProcessor.Factory
.- Returns:
- This builder.
-
setEncoderFactory
@CanIgnoreReturnValue public Transformer.Builder setEncoderFactory(Codec.EncoderFactory encoderFactory)
Sets theCodec.EncoderFactory
that will be used by the transformer.The default value is a
DefaultEncoderFactory
instance.- Parameters:
encoderFactory
- TheCodec.EncoderFactory
instance.- Returns:
- This builder.
-
setMuxerFactory
@CanIgnoreReturnValue public Transformer.Builder setMuxerFactory(Muxer.Factory muxerFactory)
Sets the factory for muxers that write the media container.The default value is a
DefaultMuxer.Factory
.- Parameters:
muxerFactory
- AMuxer.Factory
.- Returns:
- This builder.
-
setLooper
@CanIgnoreReturnValue public Transformer.Builder setLooper(Looper looper)
Sets theLooper
that must be used for all calls to the transformer and that is used to call listeners on.The default value is the Looper of the thread that this builder was created on, or if that thread does not have a Looper, the Looper of the application's main thread.
- Parameters:
looper
- ALooper
.- Returns:
- This builder.
-
setDebugViewProvider
@CanIgnoreReturnValue public Transformer.Builder setDebugViewProvider(DebugViewProvider debugViewProvider)
Sets a provider for views to show diagnostic information (if available) during export.This is intended for debugging. The default value is
DebugViewProvider.NONE
, which doesn't show any debug info.Not all exports will result in debug views being populated.
- Parameters:
debugViewProvider
- Provider for debug views.- Returns:
- This builder.
-
build
public Transformer build()
Builds aTransformer
instance.- Throws:
IllegalStateException
- If both audio and video have been removed (otherwise the output would not contain any samples).IllegalStateException
- If the muxer doesn't support the requested audio/video MIME type.
-
-