@UnstableApi
class TransformerUtil


Utility methods for Transformer.

Summary

Public functions

java-static ColorInfo!
getDecoderOutputColor(
    decoderInputColor: ColorInfo!,
    isMediaCodecToneMappingRequested: Boolean
)

Returns the decoder output color taking tone mapping into account.

java-static Int

Returns MediaCodec flags corresponding to C.BufferFlags.

java-static Pair<String!, Int!>!
getOutputMimeTypeAndHdrModeAfterFallback(
    @Composition.HdrMode hdrMode: Int,
    requestedOutputMimeType: String!,
    colorInfo: ColorInfo?
)

Calculate what the MIME type and HdrMode to use, applying fallback measure if necessary.

java-static Int

Returns the track type constant corresponding to how a specified MIME type should be processed, which may be TRACK_TYPE_UNKNOWN if it could not be determined.

java-static ColorInfo!
getValidColor(colorInfo: ColorInfo?)

Adjust for invalid ColorInfo values, by defaulting to SDR_BT709_LIMITED.

java-static Unit
maybeSetMuxerWrapperAdditionalRotationDegrees(
    muxerWrapper: MuxerWrapper!,
    videoEffects: ImmutableList<Effect!>!,
    inputFormat: Format!
)

Sets the additionalRotationDegrees on the given MuxerWrapper if the given videoEffects only contains a mix of regular rotations and no-ops.

java-static Boolean
shouldTranscodeAudio(
    inputFormat: Format!,
    composition: Composition!,
    sequenceIndex: Int,
    transformationRequest: TransformationRequest!,
    encoderFactory: Codec.EncoderFactory!,
    muxerWrapper: MuxerWrapper!
)

Returns whether the audio track should be transcoded.

java-static Boolean
shouldTranscodeVideo(
    inputFormat: Format!,
    composition: Composition!,
    sequenceIndex: Int,
    transformationRequest: TransformationRequest!,
    encoderFactory: Codec.EncoderFactory!,
    muxerWrapper: MuxerWrapper!
)

Returns whether the video track should be transcoded.

Public functions

getDecoderOutputColor

java-static fun getDecoderOutputColor(
    decoderInputColor: ColorInfo!,
    isMediaCodecToneMappingRequested: Boolean
): ColorInfo!

Returns the decoder output color taking tone mapping into account.

getMediaCodecFlags

java-static fun getMediaCodecFlags(@C.BufferFlags flags: Int): Int

Returns MediaCodec flags corresponding to C.BufferFlags.

getOutputMimeTypeAndHdrModeAfterFallback

java-static fun getOutputMimeTypeAndHdrModeAfterFallback(
    @Composition.HdrMode hdrMode: Int,
    requestedOutputMimeType: String!,
    colorInfo: ColorInfo?
): Pair<String!, Int!>!

Calculate what the MIME type and HdrMode to use, applying fallback measure if necessary.

Parameters
@Composition.HdrMode hdrMode: Int

The HdrMode.

requestedOutputMimeType: String!

The desired output MIME type.

colorInfo: ColorInfo?

The ColorInfo.

Returns
Pair<String!, Int!>!

a Pair of the output MIME type and HdrMode.

getProcessedTrackType

@C.TrackType
java-static fun getProcessedTrackType(mimeType: String?): Int

Returns the track type constant corresponding to how a specified MIME type should be processed, which may be TRACK_TYPE_UNKNOWN if it could not be determined.

Image MIME types are processed as TRACK_TYPE_VIDEO.

See getTrackType for more details.

getValidColor

java-static fun getValidColor(colorInfo: ColorInfo?): ColorInfo!

Adjust for invalid ColorInfo values, by defaulting to SDR_BT709_LIMITED.

maybeSetMuxerWrapperAdditionalRotationDegrees

java-static fun maybeSetMuxerWrapperAdditionalRotationDegrees(
    muxerWrapper: MuxerWrapper!,
    videoEffects: ImmutableList<Effect!>!,
    inputFormat: Format!
): Unit

Sets the additionalRotationDegrees on the given MuxerWrapper if the given videoEffects only contains a mix of regular rotations and no-ops. A regular rotation is a rotation divisible by 90 degrees.

shouldTranscodeAudio

java-static fun shouldTranscodeAudio(
    inputFormat: Format!,
    composition: Composition!,
    sequenceIndex: Int,
    transformationRequest: TransformationRequest!,
    encoderFactory: Codec.EncoderFactory!,
    muxerWrapper: MuxerWrapper!
): Boolean

Returns whether the audio track should be transcoded.

shouldTranscodeVideo

java-static fun shouldTranscodeVideo(
    inputFormat: Format!,
    composition: Composition!,
    sequenceIndex: Int,
    transformationRequest: TransformationRequest!,
    encoderFactory: Codec.EncoderFactory!,
    muxerWrapper: MuxerWrapper!
): Boolean

Returns whether the video track should be transcoded.