@UnstableApi
public final class Track


Encapsulates information describing an MP4 track.

Summary

Nested types

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

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

Constants

static final int

A transformation for caption samples in cdat atoms.

static final int

A no-op sample transformation.

Public fields

final long

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

final @Nullable long[]

Durations of edit list segments in the movie timescale.

final @Nullable long[]

Media times for edit list segments in the track timescale.

final Format

The format.

final int

The track identifier.

final long

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

final long

The movie timescale.

final int

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

final int

One of TRANSFORMATION_*.

final long

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

final int

One of TRACK_TYPE_AUDIO, TRACK_TYPE_VIDEO and TRACK_TYPE_TEXT.

Public constructors

Track(
    int id,
    @C.TrackType int type,
    long timescale,
    long movieTimescale,
    long durationUs,
    long mediaDurationUs,
    Format format,
    @Track.Transformation int sampleTransformation,
    @Nullable TrackEncryptionBox[] sampleDescriptionEncryptionBoxes,
    int nalUnitLengthFieldLength,
    @Nullable long[] editListDurations,
    @Nullable long[] editListMediaTimes
)

Public methods

Track
Track
@Nullable TrackEncryptionBox
getSampleDescriptionEncryptionBox(int sampleDescriptionIndex)

Returns the TrackEncryptionBox for the given sample description index.

Constants

TRANSFORMATION_CEA608_CDAT

public static final int TRANSFORMATION_CEA608_CDAT = 1

A transformation for caption samples in cdat atoms.

TRANSFORMATION_NONE

public static final int TRANSFORMATION_NONE = 0

A no-op sample transformation.

Public fields

durationUs

public final long durationUs

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

editListDurations

public final @Nullable long[] editListDurations

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

editListMediaTimes

public final @Nullable long[] editListMediaTimes

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

format

public final Format format

The format.

id

public final int id

The track identifier.

mediaDurationUs

public final long mediaDurationUs

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

movieTimescale

public final long movieTimescale

The movie timescale.

nalUnitLengthFieldLength

public final int nalUnitLengthFieldLength

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
public final int sampleTransformation

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

timescale

public final long timescale

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

type

@C.TrackType
public final int type

One of TRACK_TYPE_AUDIO, TRACK_TYPE_VIDEO and TRACK_TYPE_TEXT.

Public constructors

Track

public Track(
    int id,
    @C.TrackType int type,
    long timescale,
    long movieTimescale,
    long durationUs,
    long mediaDurationUs,
    Format format,
    @Track.Transformation int sampleTransformation,
    @Nullable TrackEncryptionBox[] sampleDescriptionEncryptionBoxes,
    int nalUnitLengthFieldLength,
    @Nullable long[] editListDurations,
    @Nullable long[] editListMediaTimes
)

Public methods

copyWithFormat

public Track copyWithFormat(Format format)

copyWithoutEditLists

public Track copyWithoutEditLists()

getSampleDescriptionEncryptionBox

public @Nullable TrackEncryptionBox getSampleDescriptionEncryptionBox(int sampleDescriptionIndex)

Returns the TrackEncryptionBox for the given sample description index.

Parameters
int sampleDescriptionIndex

The given sample description index

Returns
@Nullable TrackEncryptionBox

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