Functions to operate with ISOTrack/MP4Track objects. More...
Enumerations | |
enum | { MP4HintTrackReferenceType = MP4_FOUR_CHAR_CODE('h', 'i', 'n', 't') , MP4StreamDependencyReferenceType = MP4_FOUR_CHAR_CODE('d', 'p', 'n', 'd') , MP4ODTrackReferenceType = MP4_FOUR_CHAR_CODE('m', 'p', 'o', 'd') , MP4SyncTrackReferenceType = MP4_FOUR_CHAR_CODE('s', 'y', 'n', 'c') , MP4DescTrackReferenceType = MP4_FOUR_CHAR_CODE('c', 'd', 's', 'c') } |
Track reference types. More... | |
Functions | |
ISOErr | MJ2SetTrackMatrix (ISOTrack theTrack, u32 matrix[9]) |
This sets the overall transformation matrix for the movie as a whole. | |
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. | |
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. | |
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. | |
ISOErr | MJ2GetTrackVolume (ISOTrack theTrack, s16 *outVolume) |
Returns the currently set track volume. | |
MP4Err | MP4AddTrackReference (MP4Track theTrack, MP4Track dependsOn, u32 referenceType, u32 *outReferenceIndex) |
Indicate that there exists a dependency between two tracks. | |
MP4Err | MP4AddTrackReferenceWithID (MP4Track theTrack, u32 dependsOnID, u32 dependencyType, u32 *outReferenceIndex) |
Indicate that there exists a dependency between two tracks. | |
MP4Err | MP4AddSubSampleInformationToTrack (MP4Track theTrack, MP4GenericAtom *subs) |
MP4Err | MP4SetSubSampleInformationFlags (MP4GenericAtom subsample, u32 flags) |
MP4Err | MP4GetSubSampleInformationEntryFromTrack (MP4Track theTrack, u32 *flags, u32 *entry_count, u32 **sample_delta, u32 **subsample_count, u32 ***subsample_size_array, u32 ***subsample_priority_array, u32 ***subsample_discardable_array) |
MP4Err | MP4AddSubSampleInformationEntry (MP4GenericAtom subsample, u32 sample_delta, u32 subsample_count, MP4Handle subsample_size_array, MP4Handle subsample_priority_array, MP4Handle subsample_discardable_array) |
MP4Err | MP4AddSubSampleInformationEntry2 (MP4GenericAtom subsample, u32 sample_delta, u32 subsample_count, MP4Handle subsample_size_array, MP4Handle subsample_priority_array, MP4Handle subsample_discardable_array, MP4Handle codec_specific_parameters_array) |
Same as MP4AddSubSampleInformationEntry but also allows to add the codec specific parameters. | |
MP4Err | MP4AddTrackGroup (MP4Track theTrack, u32 groupID, u32 dependencyType) |
Add track to a track group ID. | |
MP4Err | MP4AddTrackToMovieIOD (MP4Track theTrack) |
Add track's ES_Descriptor to its movie's initial object descriptor. | |
MP4Err | MP4GetMovieIndTrack (MP4Movie theMovie, u32 trackIndex, MP4Track *outTrack) |
Get track using the track index. | |
MP4Err | MP4GetMovieIndTrackSampleEntryType (MP4Movie theMovie, u32 idx, u32 *SEType) |
Get sample entry type of a track. | |
MP4Err | MP4GetMovieTrackCount (MP4Movie theMovie, u32 *outTrackCount) |
This function allows you to determine the number of Tracks in a Movie. | |
MP4Err | MP4GetTrackDuration (MP4Track theTrack, u64 *outDuration) |
Calculates and returns the duration of the track. | |
MP4Err | MP4GetTrackEnabled (MP4Track theTrack, u32 *outEnabled) |
This returns a non-zero value in outEnabled if the track is enabled. | |
MP4Err | MP4GetTrackID (MP4Track theTrack, u32 *outTrackID) |
Get the elementary stream ID for a given Track. | |
MP4Err | MP4GetTrackMedia (MP4Track theTrack, MP4Media *outMedia) |
Returns the Media for a given Track. | |
MP4Err | MP4GetTrackMovie (MP4Track theTrack, MP4Movie *outMovie) |
Get the Movie associated with a Track. | |
MP4Err | MP4GetTrackOffset (MP4Track track, u32 *outMovieOffsetTime) |
Get the track's offset (the length of its initial empty edit). | |
MP4Err | MP4GetTrackReference (MP4Track theTrack, u32 referenceType, u32 referenceIndex, MP4Track *outReferencedTrack) |
Obtain a specific track reference of the specified type. | |
MP4Err | MP4GetTrackReferenceCount (MP4Track theTrack, u32 referenceType, u32 *outReferenceCount) |
Determine the number of a particular type of track references that are contained in a track. | |
MP4Err | MP4GetTrackGroup (MP4Track theTrack, u32 groupType, u32 *outGroupId) |
Get the track group of a track. | |
MP4Err | MP4AddAtomToTrack (MP4Track theTrack, MP4GenericAtom the_atom) |
Adds the given atom to the track. | |
MP4Err | MP4InsertMediaIntoTrack (MP4Track trak, s32 trackStartTime, s32 mediaStartTime, u64 segmentDuration, s32 mediaRate) |
Adds a reference to the specified segment of media into a Track. | |
MP4Err | MP4NewMovieTrack (MP4Movie theMovie, u32 newTrackFlags, MP4Track *outTrack) |
Creates a new track for the movie. | |
MP4Err | MP4NewMovieTrackWithID (MP4Movie theMovie, u32 newTrackFlags, u32 newTrackID, MP4Track *outTrack) |
Creates a new track for the movie with a specified track ID. | |
MP4Err | MP4NewTrackMedia (MP4Track theTrack, MP4Media *outMedia, u32 handlerType, u32 timeScale, MP4Handle dataReference) |
Creates the media container for a track. | |
MP4Err | MP4SetTrackEnabled (MP4Track theTrack, u32 enabled) |
Enables or disables the track. | |
MP4Err | MP4SetTrackOffset (MP4Track track, 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. | |
MP4Err | MP4TrackTimeToMediaTime (MP4Track theTrack, u64 inTrackTime, s64 *outMediaTime) |
Convert from a time expressed in the movie time scale to a time expressed in the media time scale. | |
MP4Err | ISOSetTrackFragmentDefaults (MP4Track theTrack, 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. | |
MP4Err | MP4GetTrackEditlistEntryCount (MP4Track theTrack, u32 *entryCount) |
This returns the number of existent Edit list entries. | |
MP4Err | MP4GetTrackEditlist (MP4Track theTrack, u64 *outSegmentDuration, s64 *outMediaTime, u32 entryIndex) |
This returns a non-zero value in outSegmentDuration and outMediaTime if the Edit list information is present and valid. | |
Functions to operate with ISOTrack/MP4Track objects.
anonymous enum |
Track reference types.
MP4Err ISOSetTrackFragmentDefaults | ( | MP4Track | theTrack, |
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.
theTrack | input track object |
duration | default sample duration |
size | default sample size |
is_sync | default sample sync-flag |
pad | default sample padding bits |
ISOErr MJ2GetTrackDimensions | ( | ISOTrack | theTrack, |
u32 * | outWidth, | ||
u32 * | outHeight | ||
) |
This returns the currently set dimensions.
theTrack | input track object |
outWidth | output width |
outHeight | output height |
ISOErr MJ2GetTrackLayer | ( | ISOTrack | theTrack, |
s16 * | outLayer | ||
) |
This returns the currently set track layer.
theTrack | input track object |
outLayer | output layer value |
ISOErr MJ2GetTrackMatrix | ( | ISOTrack | theTrack, |
u32 | outMatrix[9] | ||
) |
This returns the current matrix.
theTrack | input track object |
outMatrix | output matrix |
ISOErr MJ2GetTrackVolume | ( | ISOTrack | theTrack, |
s16 * | outVolume | ||
) |
Returns the currently set track volume.
theTrack | input track object |
outVolume | output volume |
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.
theTrack | input track object |
width | input width |
height | input height |
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.
theTrack | input track object |
layer | layer value |
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.
theTrack | input track object |
matrix | input matrix |
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.
theTrack | input track object |
volume | input volume |
MP4Err MP4AddAtomToTrack | ( | MP4Track | theTrack, |
MP4GenericAtom | the_atom | ||
) |
Adds the given atom to the track.
theTrack | input track object |
the_atom | atom to add |
MP4Err MP4AddSubSampleInformationEntry | ( | MP4GenericAtom | subsample, |
u32 | sample_delta, | ||
u32 | subsample_count, | ||
MP4Handle | subsample_size_array, | ||
MP4Handle | subsample_priority_array, | ||
MP4Handle | subsample_discardable_array | ||
) |
subsample | |
sample_delta | |
subsample_count | |
subsample_size_array | |
subsample_priority_array | |
subsample_discardable_array |
MP4Err MP4AddSubSampleInformationEntry2 | ( | MP4GenericAtom | subsample, |
u32 | sample_delta, | ||
u32 | subsample_count, | ||
MP4Handle | subsample_size_array, | ||
MP4Handle | subsample_priority_array, | ||
MP4Handle | subsample_discardable_array, | ||
MP4Handle | codec_specific_parameters_array | ||
) |
Same as MP4AddSubSampleInformationEntry but also allows to add the codec specific parameters.
subsample | |
sample_delta | |
subsample_count | |
subsample_size_array | |
subsample_priority_array | |
subsample_discardable_array | |
codec_specific_parameters_array |
MP4Err MP4AddSubSampleInformationToTrack | ( | MP4Track | theTrack, |
MP4GenericAtom * | subs | ||
) |
theTrack | input track object |
subs |
Add track to a track group ID.
If no track group with the dependency type is found in the track one is created and added to theTrack.
theTrack | input track object |
groupID | track_group_id in the TrackGroupTypeBox |
dependencyType | track_group_type of the TrackGroupTypeBox |
MP4Err MP4AddTrackReference | ( | MP4Track | theTrack, |
MP4Track | dependsOn, | ||
u32 | referenceType, | ||
u32 * | outReferenceIndex | ||
) |
Indicate that there exists a dependency between two tracks.
theTrack | track object to which the track reference will be added |
dependsOn | track object on which theTrack depends |
referenceType | refenrece type fourcc. Could be one of the following values, or any other reference type set with MP4_FOUR_CHAR_CODE(): |
outReferenceIndex | output reference number. This is only useful for OD streams because the other reference types only allow one reference per track. |
MP4Err MP4AddTrackReferenceWithID | ( | MP4Track | theTrack, |
u32 | dependsOnID, | ||
u32 | dependencyType, | ||
u32 * | outReferenceIndex | ||
) |
Indicate that there exists a dependency between two tracks.
Similar to MP4AddTrackReference() but allows you to set the reference using a track ID rather than a track.
theTrack | track object to which the track reference will be added |
dependsOnID | track ID on which theTrack depends |
dependencyType | same as in MP4AddTrackReference() |
outReferenceIndex | output reference number |
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.
theTrack | input track object |
Get track using the track index.
Use this to sequence through tracks in the Movie without regard to the trackID.
theMovie | input movie object |
trackIndex | index of the track ranges between 1 and the number of tracks in theMovie. |
outTrack | output track object |
Get sample entry type of a track.
theMovie | input movie object |
idx | index of the track ranges between 1 and the number of tracks in theMovie. |
SEType | [out] sample entry type (4CC) |
This function allows you to determine the number of Tracks in a Movie.
theMovie | input movie object |
outTrackCount | output number of tracks. |
MP4Err MP4GetSubSampleInformationEntryFromTrack | ( | MP4Track | theTrack, |
u32 * | flags, | ||
u32 * | entry_count, | ||
u32 ** | sample_delta, | ||
u32 ** | subsample_count, | ||
u32 *** | subsample_size_array, | ||
u32 *** | subsample_priority_array, | ||
u32 *** | subsample_discardable_array | ||
) |
theTrack | input track object |
flags | |
entry_count | |
sample_delta | |
subsample_count | |
subsample_size_array | |
subsample_priority_array | |
subsample_discardable_array |
Calculates and returns the duration of the track.
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.
theTrack | input track object |
outDuration | output duration of the track in the movie's timescale. |
MP4Err MP4GetTrackEditlist | ( | MP4Track | theTrack, |
u64 * | outSegmentDuration, | ||
s64 * | outMediaTime, | ||
u32 | entryIndex | ||
) |
This returns a non-zero value in outSegmentDuration and outMediaTime if the Edit list information is present and valid.
theTrack | input track object |
outSegmentDuration | output segment duration |
outMediaTime | output media time |
entryIndex | defines the one-based index of the entry to return |
This returns the number of existent Edit list entries.
Returns the number of existent Edit list entries in entryCount if the Edit list information is present, otherwise 0.
theTrack | input track object |
entryCount | output number of Edit list entries |
This returns a non-zero value in outEnabled if the track is enabled.
theTrack | input track object |
outEnabled | output enabled flag is a non-zero value if the track is enabled |
Get the track group of a track.
theTrack | input track object |
groupType | group type |
outGroupId | output group ID |
Get the elementary stream ID for a given Track.
theTrack | input track object |
outTrackID | output track ID |
Returns the Media for a given Track.
An error is returned if the track contains no media
theTrack | input track object |
outMedia | output pointer to a track media object |
Get the Movie associated with a Track.
theTrack | input track object |
outMovie | output pointer to a movie object |
Get the track's offset (the length of its initial empty edit).
track | input track object |
outMovieOffsetTime | output movie offset value in the Movie's time scale. |
MP4Err MP4GetTrackReference | ( | MP4Track | theTrack, |
u32 | referenceType, | ||
u32 | referenceIndex, | ||
MP4Track * | outReferencedTrack | ||
) |
Obtain a specific track reference of the specified type.
theTrack | input track object |
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 | output pointer to a track object that is referenced. |
Determine the number of a particular type of track references that are contained in a track.
theTrack | input track object |
referenceType | input reference type |
outReferenceCount | number of track references of a specific type. If the track doesn't contain any references of the specified type the return value will be zero. |
MP4Err MP4InsertMediaIntoTrack | ( | MP4Track | trak, |
s32 | trackStartTime, | ||
s32 | mediaStartTime, | ||
u64 | segmentDuration, | ||
s32 | mediaRate | ||
) |
Adds a reference to the specified segment of media into a Track.
trak | input track object |
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. |
Creates a new track for the movie.
theMovie | input movie object | ||||||||||
newTrackFlags | track flags can be zero or one of:
| ||||||||||
outTrack | output track object |
MP4Err MP4NewMovieTrackWithID | ( | MP4Movie | theMovie, |
u32 | newTrackFlags, | ||
u32 | newTrackID, | ||
MP4Track * | outTrack | ||
) |
Creates a new track for the movie with a specified track ID.
theMovie | input movie object |
newTrackFlags | track flags as in MP4NewMovieTrack() |
newTrackID | input track ID to set for a new track |
outTrack | output track object |
MP4Err MP4NewTrackMedia | ( | MP4Track | theTrack, |
MP4Media * | outMedia, | ||
u32 | handlerType, | ||
u32 | timeScale, | ||
MP4Handle | dataReference | ||
) |
Creates the media container for a track.
theTrack | input track object |
outMedia | output pointer to a media object |
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 MP4AddMediaDataReference() |
MP4Err MP4SetSubSampleInformationFlags | ( | MP4GenericAtom | subsample, |
u32 | flags | ||
) |
subsample | |
flags |
Enables or disables the track.
theTrack | input track object |
enabled | Set enabled to a nonzero value to enable the track, or zero to disable the track |
Modifies the duration of the empty space that lies at the beginning of the track, thus changing the duration of the entire track.
track | input track object |
movieOffsetTime | time offset as a time value in the movie’s time scale |
Convert from a time expressed in the movie time scale to a time expressed in the media time scale.
theTrack | input track object |
inTrackTime | input track timestamp |
outMediaTime | output media timestamp (in the media time scale) |