TransformerUtil
@UnstableApi
class TransformerUtil
Utility methods for Transformer.
Summary
Nested types |
|---|
@RequiresApi(value = 35)Utility for setting LogSessionId on MediaFormat (API 35+). |
Public functions |
|
|---|---|
java-static Boolean |
containsSpeedChangingEffects(Returns whether |
java-static ColorInfo! |
getDecoderOutputColor(Returns the decoder output color taking tone mapping into account. |
java-static String? |
getImageMimeType(context: Context!, mediaItem: MediaItem!)Returns the image MIME type corresponding to a |
java-static Int |
getMediaCodecFlags(@C.BufferFlags flags: Int)Returns |
java-static Pair<String!, Int!>! |
getOutputMimeTypeAndHdrModeAfterFallback(Calculate what the MIME type and |
java-static Int |
@C.TrackTypeReturns the |
java-static ColorInfo! |
getValidColor(colorInfo: ColorInfo?)Adjust for invalid |
java-static Boolean |
Returns whether the provided |
java-static Unit |
maybeSetMuxerWrapperAdditionalRotationDegrees(Sets |
java-static Boolean |
shouldTranscodeAudio(Returns whether the audio track should be transcoded. |
java-static Boolean |
shouldTranscodeVideo(Returns whether the video track should be transcoded. |
java-static Boolean |
validateSpeedChangingEffects(Checks whether any speed changing effects at the first position of each pipeline match |
Public functions
containsSpeedChangingEffects
java-static fun containsSpeedChangingEffects(
effects: Effects!,
ignoreFirstEffect: Boolean
): Boolean
Returns whether Effects contains speed changing effects.
ignoreFirstEffect controls whether TimestampAdjustment and SpeedChangingAudioProcessor are ignored as first elements of the video and audio pipelines, respectively.
getDecoderOutputColor
java-static fun getDecoderOutputColor(
decoderInputColor: ColorInfo!,
isMediaCodecToneMappingRequested: Boolean
): ColorInfo!
Returns the decoder output color taking tone mapping into account.
getImageMimeType
java-static fun getImageMimeType(context: Context!, mediaItem: MediaItem!): String?
Returns the image MIME type corresponding to a MediaItem.
This method only supports some common image MIME types.
| Returns | |
|---|---|
String? |
The MIME type. |
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.
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.
isImage
java-static fun isImage(context: Context!, mediaItem: MediaItem!): Boolean
Returns whether the provided MediaItem corresponds to an image.
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.
validateSpeedChangingEffects
java-static fun validateSpeedChangingEffects(
effects: Effects!,
speedProvider: SpeedProvider!
): Boolean
Checks whether any speed changing effects at the first position of each pipeline match
speedProvider.
The method verifies that any TimestampAdjustment or SpeedChangingAudioProcessor instance set as the first effect of its pipeline has a SpeedProvider equal to speedProvider.
If no speed changing effects are present, this method returns true.