-
Notifications
You must be signed in to change notification settings - Fork 40
Track related functions
ISOErr ISONewMovieTrack( ISOMovie theMovie, u32 newTrackFlags, ISOTrack *outTrack )Creates a new track for the movie. The newTrackFlags parameter can be zero, or one of:
ISONewTrackIsVisual
if the track will contain visual media
ISONewTrackIsAudio
if the track will contain audio media
ISONewTrackIsPrivate
if the track will not contain a media type known to MPEG-4
ISONewTrackIsMetadata
if the track will be a meta-data track
ISOErr ISONewMovieTrackwithID( ISOMovie theMovie,
u32 newTrackFlags,
u32 newTrackID,
ISOTrack *outTrack )Creates a new track for the movie with a specified track ID.
The newTrackFlags parameter can be zero, or one of:
ISONewTrackIsVisual
if the track will contain visual media
ISONewTrackIsAudio
if the track will contain audio media
ISONewTrackIsPrivate
if the track will not contain a media type known to MPEG-4
ISOErr ISOAddTrackReference( ISOTrack theTrack,
ISOTrack dependsOn,
u32 referenceType,
u32 *outReferenceNumber );Indicate that there exists a dependency between two tracks. The type of dependency can be one of:
MP4HintTrackReferenceType
for hint tracks, to point to the media track they depend on
MP4StreamDependencyReferenceType
for elementary stream tracks, to indicate other elementary stream tracks they depend on (an enhancement layer points to a base layer, for example)
MP4ODTrackReferenceType
for object descriptor tracks, to point to the elementary stream whose metadata is being updated.
The reference number is returned in outReferenceNumber. This is only useful for OD streams because the other reference types only allow one reference per track.
ISOErr ISOAddTrackReferenceWithID( ISOTrack theTrack,
u32 dependsOnID, u32 referenceType,
u32 *outReferenceNumber );Like ISOAddTrackReference, but allows you to set the reference using a track ID rather than a track.
ISOErr ISOGetMovieIndTrack( ISOMovie theMovie,
u32 trackIndex,
ISOTrack *outTrack );Use this to sequence through tracks in the Movie without regard to the trackID. The index ranges between 1 and the number of tracks in the Movie.
ISOErr ISOGetMovieTrackCount( ISOMovie theMovie, u32* outTrackCount );This function allows you to determine the number of Tracks in a Movie.
ISOErr ISOSetTrackEnabled( ISOTrack theTrack, u32 enabled );Enables or disables the track. Set enabled to a nonzero value to enable the track, or zero to disable the track.
ISOErr ISOGetTrackEnabled( ISOTrack theTrack, u32 *outEnabled );This returns a non-zero value in outEnabled if the track is enabled.
ISOErr ISOGetTrackEditlistEntryCount( ISOTrack theTrack, u32 *entryCount );This returns the number of existent Edit list entries in entryCount if the Edit list information is present, otherwise 0.
ISOErr ISOGetTrackEditlist( ISOTrack theTrack,
u32 *outSegmentDuration,
s64 *outMediaTime,
u32 entryIndex );This returns a non-zero value in outSegmentDuration and outMediaTime if the Edit list information is present and valid. entryIndex defines the one-based index of the entry to return.
ISOErr ISOGetTrackID( ISOTrack theTrack, u32 *outTrackID );Use to get the elementary stream ID for a given Track.
ISOErr ISOGetTrackMedia( ISOTrack theTrack, ISOMedia *outMedia );Returns the Media for a given Track. An error is returned if the track contains no media.
ISOErr ISOGetTrackMovie( ISOTrack theTrack, ISOMovie *outMovie );Get the Movie associated with a Track.
ISOErr ISOGetTrackOffset( ISOTrack theTrack, u32 *outMovieOffsetTime );Get the track's offset (the length of its initial empty edit). The returned offset is expressed in the Movie's time scale.
ISOErr ISOGetTrackReference( ISOTrack theTrack,
u32 referenceType,
u32 referenceIndex,
ISOTrack *outReferencedTrack );Use this to obtain a specific track reference of the specified type.
referenceType
The type of track reference you wish to index
referenceIndex
The particular reference of this type that you wish to retrieve. This is usually one, since most track references only allow one entry.
outReferencedTrack
The track that is referenced.
ISOErr ISOGetTrackReferenceCount( ISOTrack theTrack,
u32 referenceType,
u32 *outReferenceIndex );Use this to determine the number of a particular type of track references that are contained in a track. If the track doesn’t contain any references of the specified type the return value will be zero.
ISOErr ISOInsertMediaIntoTrack( ISOTrack trak,
u32 trackStartTime,
u32 mediaStartTime,
u64 segmentDuration,
s32 mediaRate );Adds a reference to the specified segment of media into a Track. This may create an edit list entry for this track. Besides the Track, the parameters are:
trackstartTime
time (in the movie’s time scale) at which the media is to be inserted in to the Track
mediastartTime
time (in the media’s time scale) at which the desired media segment begins
segmentDuration
duration (in the media’s time scale) of the segment
mediaRate
The desired playback rate of the media. A value of 1 indicates normal rate. The only other permitted value is -1 which indicates a ’dwell’ should occur.
ISOErr ISONewTrackMedia( ISOTrack theTrack,
ISOMedia *outMedia,
u32 handlerType, u32 timeScale,
ISOHandle dataReference );Creates the media container for a track. Parameters include:
handlerType
Describes the stream type at a high level. Use one of the handler types from ISOMovies.h. Examples are ISOVisualHandlerType, ISOAudioHandlerType and ISOHintHandlerType.
timeScale
The media time scale. This is the time coordinate system for the media. You express durations as a multiple of this value, so typical values are the sampling rate for audio, or frame rate for video.
dataReference
A URL that indicates the location of the media samples. This must either be NULL to indicate that the samples are included in the movie’s file, or a "file://" URL encoded in UTF-8. This data reference is given index 1 in the Media. You can add others using ISOAddMediaDataReference.
ISOErr ISOSetTrackOffset( ISOTrack theTrack, u32 movieOffsetTime );Modifies the duration of the empty space that lies at the beginning of the track, thus changing the duration of the entire track. You specify this time offset as a time value in the movie’s time scale. Call this function after you have constructed your track (e.g. after addMySamples in the example) — it relies on being able to find the duration of the media in the track.
ISOErr ISOTrackTimeToMediaTime( ISOTrack theTrack,
u64 inTrackTime,
u64 *outMediaTime )Used to convert from a time expressed in the movie time scale to a time expressed in the media time scale.
ISOErr MP4AddTrackToMovieIOD( ISOTrack theTrack );Add track's ES_Descriptor to its movie's initial object descriptor. This should be called for any tracks that need to appear in the initial object descriptor other than the initial BIFS track or the OD track.
ISOErr MJ2SetTrackMatrix( ISOTrack theTrack, u32 matrix[9] );This sets the overall transformation matrix for the movie as a whole. The matrix allows for 2D transformations; see the MJ2 specification for the details of how it is applied. The default matrix is the unitary transform.
ISOErr MJ2GetTrackMatrix( ISOTrack theTrack, u32 outMatrix[9] );This returns the current matrix.
ISOErr MJ2SetTrackLayer( ISOTrack theTrack, s16 layer );This sets the ordering of the visual tracks. It should be set if there is more than one visual track. Smaller numbers are closer to the front.
ISOErr MJ2GetTrackLayer( ISOTrack theTrack, s16 *outLayer );This returns the currently set track layer.
ISOErr MJ2SetTrackDimensions( ISOTrack theTrack,
u32 width,
u32 height );This sets the width and height of a track. Note that this may be different from the width and height of the media; scaling may occur. All MJ2 visual tracks should have this set explicitly.
ISOErr MJ2GetTrackDimensions( ISOTrack theTrack,
u32 *outWidth,
u32 *outHeight );This returns the currently set dimensions.
ISOErr MJ2SetTrackVolume( ISOTrack theTrack, s16 volume );This sets the normal volume of the track. The normal, default, value is 1.0. The volume is expressed as an 8.8 fixed-point number. Different audio tracks may have different volume settings; they are mixed for playback.
ISOErr MJ2GetTrackVolume( ISOTrack theTrack, s16 *outVolume );Returns the currently set track volume.
ISOErr ISOSetTrackFragmentDefaults(u32 duration, u32 size, u32 is_sync, u8 pad );Sets the default sample duration, size, sync-flag, and padding bits for samples added into movie fragments, for this track. This function must be called for each track to which fragment samples will be added, before the first fragment is started.
ISOErr ISOGetTrackDuration(ISOMovie theMovie, u64* outDuration);This calculates and returns the duration of the track, as expressed in the movie’s timescale. If there is an edit list, it is the sum of the durations of the edits. In the absence of an edit list, it is the track’s cumulative sample durations.
ISOErr MP4AddAtomToTrack( MP4Track theTrack, MP4GenericAtom the_atom );Adds the given atom (see Mp4NewForeignAtom and MP4NewUUIDAtom) to the track.
How to use
API documentation single page
- Data Types
- Movie related functions
- Track related functions
- Media related functions
- MPEG sample auxiliary information functions
- MPEG sync-layer functions
- MPEG SLConfig functions
- General Sample Description functions
- AVC Sample Description functions
- MetaData Sample Description functions
- Meta data functions
- Track reader functions
- MPEG-4 IPMPX related functions
- ISMACrypt Support
- Utility functions