@UnstableApi
class Track


Encapsulates information describing an MP4 track.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
annotation Track.Transformation

The transformation to apply to samples in the track, if any.

Constants

const Int

A transformation for caption samples in cdat atoms.

const Int

A no-op sample transformation.

Public constructors

Track(
    id: Int,
    @C.TrackType type: Int,
    timescale: Long,
    movieTimescale: Long,
    durationUs: Long,
    mediaDurationUs: Long,
    format: Format!,
    @Track.Transformation sampleTransformation: Int,
    sampleDescriptionEncryptionBoxes: Array<TrackEncryptionBox!>?,
    nalUnitLengthFieldLength: Int,
    editListDurations: LongArray?,
    editListMediaTimes: LongArray?
)

Public functions

Track!
Track!
TrackEncryptionBox?
getSampleDescriptionEncryptionBox(sampleDescriptionIndex: Int)

Returns the TrackEncryptionBox for the given sample description index.

Public properties

Long

The duration of the track in microseconds, or TIME_UNSET if unknown.

LongArray<Long>?

Durations of edit list segments in the movie timescale.

LongArray<Long>?

Media times for edit list segments in the track timescale.

Format!

The format.

Int

The track identifier.

Long

The duration of the media in microseconds, or TIME_UNSET if unknown.

Long

The movie timescale.

Int

The length in bytes of the NALUnitLength field in each sample.

Int

One of TRANSFORMATION_*.

Long

The track timescale, defined as the number of time units that pass in one second.

Int

One of TRACK_TYPE_AUDIO, TRACK_TYPE_VIDEO and TRACK_TYPE_TEXT.

Constants

TRANSFORMATION_CEA608_CDAT

const val TRANSFORMATION_CEA608_CDAT = 1: Int

A transformation for caption samples in cdat atoms.

TRANSFORMATION_NONE

const val TRANSFORMATION_NONE = 0: Int

A no-op sample transformation.

Public constructors

Track

Track(
    id: Int,
    @C.TrackType type: Int,
    timescale: Long,
    movieTimescale: Long,
    durationUs: Long,
    mediaDurationUs: Long,
    format: Format!,
    @Track.Transformation sampleTransformation: Int,
    sampleDescriptionEncryptionBoxes: Array<TrackEncryptionBox!>?,
    nalUnitLengthFieldLength: Int,
    editListDurations: LongArray?,
    editListMediaTimes: LongArray?
)

Public functions

copyWithFormat

fun copyWithFormat(format: Format!): Track!

copyWithoutEditLists

fun copyWithoutEditLists(): Track!

getSampleDescriptionEncryptionBox

fun getSampleDescriptionEncryptionBox(sampleDescriptionIndex: Int): TrackEncryptionBox?

Returns the TrackEncryptionBox for the given sample description index.

Parameters
sampleDescriptionIndex: Int

The given sample description index

Returns
TrackEncryptionBox?

The TrackEncryptionBox for the given sample description index. Maybe null if no such entry exists.

Public properties

durationUs

val durationUsLong

The duration of the track in microseconds, or TIME_UNSET if unknown.

editListDurations

val editListDurationsLongArray<Long>?

Durations of edit list segments in the movie timescale. Null if there is no edit list.

editListMediaTimes

val editListMediaTimesLongArray<Long>?

Media times for edit list segments in the track timescale. Null if there is no edit list.

format

val formatFormat!

The format.

id

val idInt

The track identifier.

mediaDurationUs

val mediaDurationUsLong

The duration of the media in microseconds, or TIME_UNSET if unknown.

movieTimescale

val movieTimescaleLong

The movie timescale.

nalUnitLengthFieldLength

val nalUnitLengthFieldLengthInt

The length in bytes of the NALUnitLength field in each sample. 0 for tracks that don't use length-delimited NAL units.

sampleTransformation

@Track.Transformation
val sampleTransformationInt

One of TRANSFORMATION_*. Defines the transformation to apply before outputting each sample.

timescale

val timescaleLong

The track timescale, defined as the number of time units that pass in one second.