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 EditedMediaItem! |
getEditedMediaItem(Returns the |
java-static EditedMediaItemSequence! |
getEditedMediaItemSequence(Returns the |
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 Long |
getOffsetToCompositionTimeUs(Returns the offset between a renderer timestamp and the start of the |
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 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.
getEditedMediaItem
java-static fun getEditedMediaItem(
timeline: Timeline!,
mediaPeriodId: MediaSource.MediaPeriodId!
): EditedMediaItem!
Returns the EditedMediaItem corresponding to mediaPeriodId within
timeline.
| Parameters | |
|---|---|
timeline: Timeline! |
The |
mediaPeriodId: MediaSource.MediaPeriodId! |
The |
getEditedMediaItemSequence
java-static fun getEditedMediaItemSequence(
timeline: Timeline!,
mediaPeriodId: MediaSource.MediaPeriodId!
): EditedMediaItemSequence!
Returns the EditedMediaItemSequence corresponding to mediaPeriodId within timeline.
If mediaPeriodId does not map to a sequence this method will throw a IllegalStateException.
| Parameters | |
|---|---|
timeline: Timeline! |
The |
mediaPeriodId: MediaSource.MediaPeriodId! |
The |
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.
getOffsetToCompositionTimeUs
java-static fun getOffsetToCompositionTimeUs(
timeline: Timeline!,
mediaPeriodId: MediaSource.MediaPeriodId!,
offsetUs: Long
): Long
Returns the offset between a renderer timestamp and the start of the Composition.
| Parameters | |
|---|---|
timeline: Timeline! |
The |
mediaPeriodId: MediaSource.MediaPeriodId! |
|
offsetUs: Long |
The offset added to timestamps of buffers to ensure monotonically increasing timestamps, in microseconds. This is the constant offset between the current MediaPeriod timestamps and the renderer timestamp. |
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.
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.