@UnstableApi
class Track


Encapsulates information describing an MP4 track.

Summary

Nested types

Builder for Track.

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

Constants

const Long

An unset or unknown timescale.

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?,
    shouldBeExposed: Boolean,
    chapterTrackId: Int
)

This function is deprecated.

Use Builder instead.

Public functions

Track.Builder!

Returns a new Builder initialized with the values of this instance.

Track!

This function is deprecated.

Use buildUpon instead.

Track!

This function is deprecated.

Use buildUpon instead.

TrackEncryptionBox?
getSampleDescriptionEncryptionBox(sampleDescriptionIndex: Int)

Returns the TrackEncryptionBox for the given sample description index.

Public properties

Int

The identifier of the associated chapter track, or INDEX_UNSET if there is none.

Long

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

ImmutableLongArray?

Durations of edit list segments in the movie timescale, or null if there is no edit list.

ImmutableLongArray?

Media times for edit list segments in the track timescale, or null if there is no edit list.

Format!

The format.

Int

The track identifier.

Long

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

Long

The movie timescale, or TIMESCALE_UNSET if unknown.

Int

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

Int

One of TRANSFORMATION_*.

Boolean

Whether the track should be exposed to the player.

Long

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

Int

One of TRACK_TYPE_AUDIO, TRACK_TYPE_VIDEO and TRACK_TYPE_TEXT.

Constants

TIMESCALE_UNSET

const val TIMESCALE_UNSET = -1: Long

An unset or unknown timescale.

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?,
    shouldBeExposed: Boolean,
    chapterTrackId: Int
)

Public functions

buildUpon

fun buildUpon(): Track.Builder!

Returns a new Builder initialized with the values of this instance.

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

chapterTrackId

val chapterTrackIdInt

The identifier of the associated chapter track, or INDEX_UNSET if there is none.

durationUs

val durationUsLong

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

editListDurations

val editListDurationsImmutableLongArray?

Durations of edit list segments in the movie timescale, or null if there is no edit list.

editListMediaTimes

val editListMediaTimesImmutableLongArray?

Media times for edit list segments in the track timescale, or 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, or TIMESCALE_UNSET if unknown.

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.

shouldBeExposed

val shouldBeExposedBoolean

Whether the track should be exposed to the player.

timescale

val timescaleLong

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