ISOBMFF
ISO Base Media File Format Reference Software Documentation
 
Loading...
Searching...
No Matches
Media related functions

Functions to operate with ISOMedia/MP4Media objects. More...

Functions

MP4Err MP4AddMediaDataReference (MP4Media theMedia, u32 *outReferenceIndex, MP4Handle urlHandle, MP4Handle urnHandle)
 Use this to add a data reference to a media container.
 
MP4Err MP4AddMediaSampleReference (MP4Media media, u64 dataOffset, u32 sampleCount, MP4Handle durationsH, MP4Handle sizesH, MP4Handle sampleEntryH, MP4Handle decodingOffsetsH, MP4Handle syncSamplesH)
 Use this function to add samples to a media by reference.
 
MP4Err MP4AddMediaSamples (MP4Media media, MP4Handle sampleH, u32 sampleCount, MP4Handle durationsH, MP4Handle sizesH, MP4Handle sampleEntryH, MP4Handle decodingOffsetsH, MP4Handle syncSamplesH)
 Use this function to samples to the media.
 
MP4Err MP4AddMediaSampleReferencePad (MP4Media media, u64 dataOffset, u32 sampleCount, MP4Handle durationsH, MP4Handle sizesH, MP4Handle sampleEntryH, MP4Handle decodingOffsetsH, MP4Handle syncSamplesH, MP4Handle padsH)
 Add media samples by reference with padding bits.
 
MP4Err MP4AddMediaSamplesPad (MP4Media media, MP4Handle sampleH, u32 sampleCount, MP4Handle durationsH, MP4Handle sizesH, MP4Handle sampleEntryH, MP4Handle decodingOffsetsH, MP4Handle syncSamplesH, MP4Handle padsH)
 Add media samples with padding bits.
 
MP4Err ISOAddGroupDescription (MP4Media media, u32 groupType, MP4Handle description, u32 *index)
 Adds a Sample Group Description to the indicated media.
 
MP4Err ISOGetGroupDescription (MP4Media media, u32 groupType, u32 index, MP4Handle description)
 Returns in the handle ‘description’ the group description associated with the given group index of the given group type.
 
MP4Err ISOGetGroupDescriptionEntryCount (MP4Media media, u32 groupType, u32 *outEntryCount)
 Returns the entry_count of the desired SampleGroupDescriptionBox of the given type.
 
MP4Err ISOSetSamplestoGroupType (MP4Media media, sampleToGroupType_t sampleToGroupType)
 Set the SampleToGroup mapping type.
 
MP4Err ISOMapSamplestoGroup (MP4Media media, u32 groupType, u32 group_index, s32 sample_index, u32 count)
 Maps a set of samples to a group of a given type.
 
MP4Err ISOGetSampletoGroupMap (MP4Media media, u32 groupType, u32 sample_number, u32 *group_index)
 Returns in group_index the group index associated with the given sample number of the given group type.
 
MP4Err ISOGetSampleGroupSampleNumbers (MP4Media media, u32 groupType, u32 group_index, u32 **outSampleNubers, u32 *outSampleCnt)
 Get all sample numbers associated with the given group type and index of the description.
 
MP4Err ISOSetSampleDependency (MP4Media media, s32 sample_index, MP4Handle dependencies)
 Sets the sample dependency of a set of samples, after having added the samples.
 
MP4Err ISOGetSampleDependency (MP4Media media, s32 sample_index, u8 *dependency)
 Returns in dependency the sample dependency associated with the given sample number.
 
MP4Err MP4BeginMediaEdits (MP4Media theMedia)
 Use this function to prepare the media before adding samples.
 
MP4Err MP4CheckMediaDataReferences (MP4Media theMedia)
 Tests all data references in the media to ensure that the references exist and are readable.
 
MP4Err MP4EndMediaEdits (MP4Media theMedia)
 Call this function when you have finished adding samples to the media.
 
MP4Err MP4GetIndMediaSampleWithPad (MP4Media theMedia, u32 sampleNumber, MP4Handle outSample, u32 *outSize, u64 *outDTS, s32 *outCTSOffset, u64 *outDuration, u32 *outSampleFlags, u32 *outSampleDescIndex, u8 *outPad)
 Returns a sample with padding bits from the media, given the sample's index.
 
MP4Err MP4GetIndMediaSample (MP4Media theMedia, u32 sampleNumber, MP4Handle outSample, u32 *outSize, u64 *outDTS, s32 *outCTSOffset, u64 *outDuration, u32 *outSampleFlags, u32 *outSampleDescIndex)
 Returns a sample from the media, given the sample's index.
 
MP4Err MP4GetIndMediaSampleReference (MP4Media theMedia, u32 sampleNumber, u32 *outOffset, u32 *outSize, u32 *outDuration, u32 *outSampleFlags, u32 *outSampleDescIndex, MP4Handle sampleDesc)
 Returns a reference (offset and size) for the sample from the media, given the sample's index.
 
MP4Err MP4GetMediaDataRefCount (MP4Media theMedia, u32 *outCount)
 Returns the number of data references.
 
MP4Err MP4UseSignedCompositionTimeOffsets (MP4Media media)
 Sets the version of the MP4CompositionOffsetAtom to 1.
 
MP4Err MP4GetMediaDataReference (MP4Media theMedia, u32 index, MP4Handle referenceURL, MP4Handle referenceURN, u32 *outReferenceType, u32 *outReferenceAttributes)
 Use this to get information about a specific data reference to a media container.
 
MP4Err MP4GetMediaDuration (MP4Media theMedia, u64 *outDuration)
 Get the total duration of the media, expressed in the media’s time scale.
 
MP4Err MP4GetMediaHandlerDescription (MP4Media theMedia, u32 *outType, MP4Handle *outName)
 This function can be used to obtain the media type.
 
MP4Err MP4GetMediaLanguage (MP4Media theMedia, char *outThreeCharCode)
 Returns the ISO 639-2/T three character language code associated with the media.
 
MP4Err MP4GetMediaExtendedLanguageTag (MP4Media theMedia, char **extended_language)
 Returns the extended language, based on RFC 4646 (Best Common Practices – BCP – 47) industry standard.
 
MP4Err MP4GetMediaNextInterestingTime (MP4Media theMedia, u32 interestingTimeFlags, u64 searchFromTime, u32 searchDirection, u64 *outInterestingTime, u64 *outInterestingDuration)
 Search for interesging time.
 
MP4Err MP4GetMediaSample (MP4Media theMedia, MP4Handle outSample, u32 *outSize, u64 desiredDecodingTime, u64 *outDecodingTime, u64 *outCompositionTime, u64 *outDuration, MP4Handle outSampleDescription, u32 *outSampleDescriptionIndex, u32 *outSampleFlags)
 Returns a closest sample from the media, given the desired decoding time.
 
MP4Err MP4GetMediaSampleWithPad (MP4Media theMedia, MP4Handle outSample, u32 *outSize, u64 desiredDecodingTime, u64 *outDecodingTime, u64 *outCompositionTime, u64 *outDuration, MP4Handle outSampleDescription, u32 *outSampleDescriptionIndex, u32 *outSampleFlags, u8 *outPad)
 Returns a closest sample with padding bits, given the desired decoding time.
 
MP4Err MP4GetMediaSampleCount (MP4Media theMedia, u32 *outCount)
 Use this to determine the total number of samples contained in the media.
 
MP4Err MP4GetMediaTimeScale (MP4Media theMedia, u32 *outTimeScale)
 Returns the time scale associated with the media.
 
MP4Err MP4GetMediaTrack (MP4Media theMedia, MP4Track *outTrack)
 Returns the track that is associated with this media.
 
MP4Err MP4MediaTimeToSampleNum (MP4Media theMedia, u64 mediaTime, u32 *outSampleNum, u64 *outSampleCTS, u64 *outSampleDTS, s32 *outSampleDuration)
 Use this to obtain the sample number for a sample with the given decoding time.
 
MP4Err MP4SampleNumToMediaTime (MP4Media theMedia, u32 sampleNum, u64 *outSampleCTS, u64 *outSampleDTS, s32 *outSampleDuration)
 Use this to obtain the decoding and composition times for a particular media sample.
 
MP4Err MP4SetMediaLanguage (MP4Media theMedia, char *threeCharCode)
 Use this to indicate the ISO 639-2/T three character language code that is to be associated with the media.
 
MP4Err MP4SetMediaExtendedLanguageTag (MP4Media theMedia, char *extended_language)
 The extended language tag box represents media language information, based on RFC 4646 (Best Common Practices – BCP – 47) industry standard.
 
MP4Err ISOSetSampleSizeField (MP4Media theMedia, u32 fieldsize)
 Use this to set the size of samplesize entries in the sample size table.
 
MP4Err MP4GetElementaryStreamPacket (MP4Media theMedia, MP4Handle outSample, u32 *outSize, u32 sequenceNumber, u64 desiredTime, u64 *outActualTime, u64 *outDuration)
 
MP4Err MP4GetMediaDecoderConfig (MP4Media theMedia, u32 sampleDescIndex, MP4Handle decoderConfigH)
 Use this to obtain the decoder configuration descriptor for a given sample description.
 
MP4Err MP4GetMediaDecoderInformation (MP4Media theMedia, u32 sampleDescIndex, u32 *outObjectType, u32 *outStreamType, u32 *outBufferSize, u32 *outUpstream, u32 *outMaxBitrate, u32 *outAvgBitrate, MP4Handle specificInfoH)
 Obtain the complete decoder configuration and specific info without having to parse the decoder config descriptor.
 
MP4Err MP4GetMediaDecoderType (MP4Media theMedia, u32 sampleDescIndex, u32 *outObjectType, u32 *outStreamType, u32 *outBufferSize, MP4Handle specificInfoH)
 Use this to obtain the decoder configuration and specific info without having to parse the decoder config descriptor.
 
MP4Err MP4CheckMediaDataRef (MP4Media theMedia, u32 dataEntryIndex)
 Tests a specific data reference in the media to ensure that the reference exists and is readable.
 

Detailed Description

Functions to operate with ISOMedia/MP4Media objects.

Function Documentation

◆ ISOAddGroupDescription()

MP4Err ISOAddGroupDescription ( MP4Media  media,
u32  groupType,
MP4Handle  description,
u32 *  index 
)

Adds a Sample Group Description to the indicated media.

Parameters
mediainput media object
groupTypegrouping_type of the SampleGroupDescriptionBox
descriptionSampleGroupDescriptionEntry pre-serialized (big-endian) group description
indexoutput index of the added group
Returns
MP4Err error code

◆ ISOGetGroupDescription()

MP4Err ISOGetGroupDescription ( MP4Media  media,
u32  groupType,
u32  index,
MP4Handle  description 
)

Returns in the handle ‘description’ the group description associated with the given group index of the given group type.

Parameters
mediamedia object where to look for the specific group description
groupTypegrouping_type
indexindex starting with 1
descriptionoutput handle holding the SampleGroupDescriptionEntry
Returns
MP4Err error code

◆ ISOGetGroupDescriptionEntryCount()

MP4Err ISOGetGroupDescriptionEntryCount ( MP4Media  media,
u32  groupType,
u32 *  outEntryCount 
)

Returns the entry_count of the desired SampleGroupDescriptionBox of the given type.

Parameters
mediamedia object where to look for the specific group description
groupTypegrouping_type of 'sgpd'
outEntryCountentry_count output
Returns
MP4Err error code

◆ ISOGetSampleDependency()

MP4Err ISOGetSampleDependency ( MP4Media  media,
s32  sample_index,
u8 *  dependency 
)

Returns in dependency the sample dependency associated with the given sample number.

Parameters
mediainput media object
sample_indexindex of the sample
dependencyoutput dependency byte as defined in SampleDependencyTypeBox
Returns
MP4Err error code

◆ ISOGetSampleGroupSampleNumbers()

MP4Err ISOGetSampleGroupSampleNumbers ( MP4Media  media,
u32  groupType,
u32  group_index,
u32 **  outSampleNubers,
u32 *  outSampleCnt 
)

Get all sample numbers associated with the given group type and index of the description.

Parameters
mediainput media object
groupTypegrouping_type of the sample group
group_indexgroup description index
outSampleNubersoutput array containing all sample numbers
outSampleCntoutput number of samples (size of outSampleNubers)
Returns
MP4Err error code

◆ ISOGetSampletoGroupMap()

MP4Err ISOGetSampletoGroupMap ( MP4Media  media,
u32  groupType,
u32  sample_number,
u32 *  group_index 
)

Returns in group_index the group index associated with the given sample number of the given group type.

Parameters
mediainput media object
groupTypegrouping_type of the sample group
sample_numberinput sample number
group_indexoutput group description index
Returns
MP4Err error code

◆ ISOMapSamplestoGroup()

MP4Err ISOMapSamplestoGroup ( MP4Media  media,
u32  groupType,
u32  group_index,
s32  sample_index,
u32  count 
)

Maps a set of samples to a group of a given type.

sample_index can also be negative. For example, a sample_index of -2 and a count of 2 sets the mapping for the last two samples. If movie fragments are in use, the sample index is relative to the current fragment (and cannot be outside it), not the whole movie.

Parameters
mediainput media object
groupTypegrouping_type of the sample group
group_indexeither 0 (to map samples to no group of this type) or an index value obtained using ISOAddGroupDescription()
sample_indexthe first sample index to map. If it is zero or positive, it is the sample at that offset from the first sample in the media. If it is negative, it is at that offset from the last sample in the media.
countthe number of samples for which to set the mapping
Returns
MP4Err error code

◆ ISOSetSampleDependency()

MP4Err ISOSetSampleDependency ( MP4Media  media,
s32  sample_index,
MP4Handle  dependencies 
)

Sets the sample dependency of a set of samples, after having added the samples.

Note
The number of samples for which to set the mapping is specified by the size of the dependencies handle.
Parameters
mediainput media object
sample_indexthe first same index as in ISOMapSamplestoGroup()
dependenciesThe handle contains a set of one-byte values each made from OR-ing together the at most one from each pair of the sample dependency constants (does_depend_on, does_not_depend_on, is_depended_on, is_not_depended_on, has_redundancy, etc.)
Returns
MP4Err error code

◆ ISOSetSampleSizeField()

MP4Err ISOSetSampleSizeField ( MP4Media  theMedia,
u32  fieldsize 
)

Use this to set the size of samplesize entries in the sample size table.

The default value is 32, which gives the ‘old’ sample size table. Values of 4, 8, or 16 (the size in bits of the field) may be given, to request the ‘compact’ sample size table.

◆ ISOSetSamplestoGroupType()

MP4Err ISOSetSamplestoGroupType ( MP4Media  media,
sampleToGroupType_t  sampleToGroupType 
)

Set the SampleToGroup mapping type.

Note
Calling this function will also change the mapping type in the current movie or fragment.
Parameters
mediamedia object
sampleToGroupTypechoose between SAMPLE_GROUP_NORMAL ('sbgp' default), SAMPLE_GROUP_COMPACT ('csgp') or SAMPLE_GROUP_AUTO (decide automatically, smaller size wins)
Returns
MP4Err error code

◆ MP4AddMediaDataReference()

MP4Err MP4AddMediaDataReference ( MP4Media  theMedia,
u32 *  outReferenceIndex,
MP4Handle  urlHandle,
MP4Handle  urnHandle 
)

Use this to add a data reference to a media container.

The data reference specifies a location for media samples. The outReferenceIndex parameter is updated to contain the index for the new reference. (You will need to use this index to create a sample description that will point to this new data reference.)

Parameters
theMediainput media object
outReferenceIndexoutput the index for the new reference
urlHandleUTF-8 encoded file:// URL that indicates the file containing the samples. Set this to NULL to indicate that the samples are in the movie’s file.
urnHandleUTF-8 encoded URN. This may be used in addition to urlHandle to indicate the uniform resource name associated with this media file. If no URN is used, set urnHandle to NULL
Returns
MP4Err error code

◆ MP4AddMediaSampleReference()

MP4Err MP4AddMediaSampleReference ( MP4Media  media,
u64  dataOffset,
u32  sampleCount,
MP4Handle  durationsH,
MP4Handle  sizesH,
MP4Handle  sampleEntryH,
MP4Handle  decodingOffsetsH,
MP4Handle  syncSamplesH 
)

Use this function to add samples to a media by reference.

This is usually used when the samples are already present in some file, for example when you are making reference to samples contained in an external file.

Parameters
mediainput media object
dataOffsetThe byte offset into the file containing the samples. All samples added in this function are assumed to be contiguous in the file starting at this offset.
sampleCountThe number of samples to be added in this call.
durationsHA handle containing u32[] durations for each sample to be added. If the durations differ you must supply a duration for each sample. If the durations are constant you should only place one entry in this handle.
sizesHA handle containing u32[] sizes (in bytes) for each sample to be added. If the sizes differ you must indicate a size for each sample. If the sizes are constant you should only place one entry in this handle.
sampleEntryHContains a sample entry that describes the samples to be added. For MPEG-4, this entry can be created using MP4CreateSampleDescriptionAtom(), or for both MJ2 and MP4 you can supply your own as long as it is formatted according to the appropriate standard. If this handle is set to NULL the previous non-null sample entry will be used.
decodingOffsetsHIf the media contains separate decoding and composition timestamps you must use this handle to indicate the offset between the composition time and the decoding time for each sample in a u32[]. Note that samples must be added in decoding order.
syncSamplesHIf all the samples added are sync samples you can set this to NULL. Otherwise, place the one-based indexes of each sync sample into this handle as a u32[]. If none of the samples you are adding is a sync sample this handle will have a size of zero.
Returns
MP4Err error code

◆ MP4AddMediaSampleReferencePad()

MP4Err MP4AddMediaSampleReferencePad ( MP4Media  media,
u64  dataOffset,
u32  sampleCount,
MP4Handle  durationsH,
MP4Handle  sizesH,
MP4Handle  sampleEntryH,
MP4Handle  decodingOffsetsH,
MP4Handle  syncSamplesH,
MP4Handle  padsH 
)

Add media samples by reference with padding bits.

Parameters
padsHpadding bits. May be NULL, indicating no pad, or may be a handle to an array of padding values (which are 8 bits each). If the array has only one value, then it is used for all the samples. Otherwise, the array should be sampleCount long.
Note
Other parameters are exactly the same as in MP4AddMediaSampleReference()

◆ MP4AddMediaSamples()

MP4Err MP4AddMediaSamples ( MP4Media  media,
MP4Handle  sampleH,
u32  sampleCount,
MP4Handle  durationsH,
MP4Handle  sizesH,
MP4Handle  sampleEntryH,
MP4Handle  decodingOffsetsH,
MP4Handle  syncSamplesH 
)

Use this function to samples to the media.

Parameters
sampleHcontains the data for all the samples
Note
Other parameters are exactly the same as in MP4AddMediaSampleReference()
Returns
MP4Err error code

◆ MP4AddMediaSamplesPad()

MP4Err MP4AddMediaSamplesPad ( MP4Media  media,
MP4Handle  sampleH,
u32  sampleCount,
MP4Handle  durationsH,
MP4Handle  sizesH,
MP4Handle  sampleEntryH,
MP4Handle  decodingOffsetsH,
MP4Handle  syncSamplesH,
MP4Handle  padsH 
)

Add media samples with padding bits.

Parameters
padsHpadding bits as in MP4AddMediaSampleReferencePad()
Note
Other parameters are exactly the same as in MP4AddMediaSampleReference()

◆ MP4BeginMediaEdits()

MP4Err MP4BeginMediaEdits ( MP4Media  theMedia)

Use this function to prepare the media before adding samples.

Todo:
finish the implementation

◆ MP4CheckMediaDataReferences()

MP4Err MP4CheckMediaDataReferences ( MP4Media  theMedia)

Tests all data references in the media to ensure that the references exist and are readable.

Parameters
theMediainput media object
Returns
MP4Err error code

◆ MP4GetIndMediaSample()

MP4Err MP4GetIndMediaSample ( MP4Media  theMedia,
u32  sampleNumber,
MP4Handle  outSample,
u32 *  outSize,
u64 *  outDTS,
s32 *  outCTSOffset,
u64 *  outDuration,
u32 *  outSampleFlags,
u32 *  outSampleDescIndex 
)

Returns a sample from the media, given the sample's index.

Parameters are the same as in MP4GetIndMediaSampleWithPad()

◆ MP4GetIndMediaSampleReference()

MP4Err MP4GetIndMediaSampleReference ( MP4Media  theMedia,
u32  sampleNumber,
u32 *  outOffset,
u32 *  outSize,
u32 *  outDuration,
u32 *  outSampleFlags,
u32 *  outSampleDescIndex,
MP4Handle  sampleDesc 
)

Returns a reference (offset and size) for the sample from the media, given the sample's index.

Other parameters are similar to MP4GetIndMediaSampleWithPad()

Parameters
outOffsetThe offset of the returned sample in bytes
sampleDescThe sample description that corresponds to this sample in the media. Set this to NULL if you do not want this information to be returned.
Returns
MP4Err error code

◆ MP4GetIndMediaSampleWithPad()

MP4Err MP4GetIndMediaSampleWithPad ( MP4Media  theMedia,
u32  sampleNumber,
MP4Handle  outSample,
u32 *  outSize,
u64 *  outDTS,
s32 *  outCTSOffset,
u64 *  outDuration,
u32 *  outSampleFlags,
u32 *  outSampleDescIndex,
u8 *  outPad 
)

Returns a sample with padding bits from the media, given the sample's index.

Note
If the track has no recorded padding table (no padding information) then the padding value returned will be 0xF8. This is not a legal value for actual padding and should not be supplied to calls which add samples.
Parameters
theMediainput media object
sampleNumberThe index of the desired sample within its Media. This index runs from one to the total number of samples in the Media.
outSampleThe data for the desired sample. This is the raw access unit without headers
outSizeThe size of the returned sample in bytes
outDTSThe decoding time for the sample using the media time scale
outCTSOffsetThe composition time offset for the sample using the media time scale
outDurationThe sample's duration in units of media time scale
outSampleFlagsFlags that indicate the nature of this sample. Values are combinations of MP4MediaSampleNotSync if the sample is not a sync sample and MP4MediaSampleHasCompositionOffset if the sample's DTS differs from its CTS.
outSampleDescIndexThe index of the sample description that corresponds to this sample
outPadoutput padding bits. Returns dummy 0xF8 value if no padding information is found
Returns
MP4Err error code

◆ MP4GetMediaDataRefCount()

MP4Err MP4GetMediaDataRefCount ( MP4Media  theMedia,
u32 *  outCount 
)

Returns the number of data references.

Parameters
theMediainput media object
outCountoutput number of data references
Returns
MP4Err error code

◆ MP4GetMediaDataReference()

MP4Err MP4GetMediaDataReference ( MP4Media  theMedia,
u32  index,
MP4Handle  referenceURL,
MP4Handle  referenceURN,
u32 *  outReferenceType,
u32 *  outReferenceAttributes 
)

Use this to get information about a specific data reference to a media container.

The data reference specifies a location for media samples. Note that data references to samples contained in the movie's file are treated as URL reference types with no name and a special attribute bit set.

Parameters
theMediainput media object
indexThe index of the desired data reference. This number ranges from one to the number of data references in the media.
referenceURLWill be set to a UTF-8 encoded file:// URL that indicates the file containing the samples. If the data reference doesn't contain a URL the handle size will be set to zero. Set referenceURL to NULL if you do not want this information.
referenceURNUTF-8 encoded URN. This may be used in addition to urlHandle to indicate the uniform resource name associated with this media file. If the data reference does not contain a URN the handle size will be set to zero. Set referenceURN to NULL if you do not want this information.
outReferenceTypeThis will be set to MP4URLDataReferenceType or MP4URNDataReferenceType to indicate the type of data reference.
outReferenceAttributesReturns the attributes of the data reference as a bit set. The only bit currently defined is MP4DataRefSelfReferenceMask which will be set if the media's samples are contained in the same file as the movie.
Returns
MP4Err error code

◆ MP4GetMediaDecoderConfig()

MP4Err MP4GetMediaDecoderConfig ( MP4Media  theMedia,
u32  sampleDescIndex,
MP4Handle  decoderConfigH 
)

Use this to obtain the decoder configuration descriptor for a given sample description.

Parameters
sampleDescIndexsample description index (starts with 1)
decoderConfigHoutput decoder confiburation handle

◆ MP4GetMediaDecoderInformation()

MP4Err MP4GetMediaDecoderInformation ( MP4Media  theMedia,
u32  sampleDescIndex,
u32 *  outObjectType,
u32 *  outStreamType,
u32 *  outBufferSize,
u32 *  outUpstream,
u32 *  outMaxBitrate,
u32 *  outAvgBitrate,
MP4Handle  specificInfoH 
)

Obtain the complete decoder configuration and specific info without having to parse the decoder config descriptor.

Parameters
sampleDescIndexIndex of the sample description you desire (>0)
outObjectTypeWill contain the object type for this decoder config.
outStreamTypeWill contain the stream type for this decoder config.
outBufferSizeWill contain the decoder buffer size.
outUpstreamWill contain the value of the upstream flag.
outMaxBitrateWill contain the maximum bitrate for this decoder config.
outAvgBitrateWill contain the average bitrate for this decoder config.
specificInfoHHandle that will contain the specific info for this decoder config The tag and length fields are stripped from the descriptor so only the configuration data remains. Set specificInfoH to NULL if you do not want this information.

◆ MP4GetMediaDecoderType()

MP4Err MP4GetMediaDecoderType ( MP4Media  theMedia,
u32  sampleDescIndex,
u32 *  outObjectType,
u32 *  outStreamType,
u32 *  outBufferSize,
MP4Handle  specificInfoH 
)

Use this to obtain the decoder configuration and specific info without having to parse the decoder config descriptor.

See MP4GetMediaDecoderConfig() if you need all the configuration information.

Parameters
sampleDescIndexIndex of the sample description you desire (>0)
outObjectTypeWill contain the object type for this decoder config.
outStreamTypeWill contain the stream type for this decoder config.
outBufferSizeWill contain the decoder buffer size.
specificInfoHHandle that will contain the specific info for this decoder config The tag and length fields are stripped from the descriptor so only the configuration data remains. Set specificInfoH to NULL if you do not want this information.

◆ MP4GetMediaDuration()

MP4Err MP4GetMediaDuration ( MP4Media  theMedia,
u64 *  outDuration 
)

Get the total duration of the media, expressed in the media’s time scale.

Parameters
theMediainput media object
outDurationoutput duration of the media in media's time scale
Returns
MP4Err error code

◆ MP4GetMediaExtendedLanguageTag()

MP4Err MP4GetMediaExtendedLanguageTag ( MP4Media  theMedia,
char **  extended_language 
)

Returns the extended language, based on RFC 4646 (Best Common Practices – BCP – 47) industry standard.

Parameters
theMediainput media object
extended_languageAllocates memory for extended_language string. extended_language string will be set to NULL if there is no extended language tag.
Returns
MP4Err error code

◆ MP4GetMediaHandlerDescription()

MP4Err MP4GetMediaHandlerDescription ( MP4Media  theMedia,
u32 *  outType,
MP4Handle outName 
)

This function can be used to obtain the media type.

The handler type and the decoder config information, can be used to obtain enough information to instantiate a decoder.

Parameters
theMediainput media object
outTypecontains the media handler (ISOVisualHandlerType, ISOAudioHandlerType, etc.)
outNameIf you want to retrieve the name for the handler you must supply a handle for outName, otherwise set outName to NULL.
Returns
MP4Err error code

◆ MP4GetMediaLanguage()

MP4Err MP4GetMediaLanguage ( MP4Media  theMedia,
char *  outThreeCharCode 
)

Returns the ISO 639-2/T three character language code associated with the media.

Parameters
theMediainput media object
outThreeCharCodeoutput ISO 639-2/T three character language code
Returns
MP4Err error code

◆ MP4GetMediaNextInterestingTime()

MP4Err MP4GetMediaNextInterestingTime ( MP4Media  theMedia,
u32  interestingTimeFlags,
u64  searchFromTime,
u32  searchDirection,
u64 *  outInterestingTime,
u64 *  outInterestingDuration 
)

Search for interesging time.

Bug:
NB: This ignores any edit list present in the Media's Track
Parameters
theMediainput media object
interestingTimeFlagseg: MP4NextTimeMediaSample
searchFromTimein Media time scale
searchDirectioneg: MP4NextTimeSearchForward
outInterestingTimeoutput interesting time in Media time scale
outInterestingDurationoutput interesting duration in Media's time coordinate system
Returns
MP4Err error code

◆ MP4GetMediaSample()

MP4Err MP4GetMediaSample ( MP4Media  theMedia,
MP4Handle  outSample,
u32 *  outSize,
u64  desiredDecodingTime,
u64 *  outDecodingTime,
u64 *  outCompositionTime,
u64 *  outDuration,
MP4Handle  outSampleDescription,
u32 *  outSampleDescriptionIndex,
u32 *  outSampleFlags 
)

Returns a closest sample from the media, given the desired decoding time.

Parameters
theMediainput media object
outSampleThe data for the desired sample. This is the raw access unit without headers.
outSizeThe size of the returned sample in bytes.
desiredDecodingTimeThe decoding time of the sample to be retrieved. You must specify this value in the media’s time scale.
outDecodingTimeThe decoding time for the sample using the media time scale. This time may differ from the value specified in the desiredDecodingTime parameter if that parameter's value is not at a sample time boundary.
outCompositionTimeThe composition time for the sample expressed in the media time scale
outDurationThe sample's duration in units of media time scale.
outSampleDescriptionThe sample description that corresponds to this sample in the media. Set this to NULL if you do not want this information to be returned.
outSampleDescriptionIndexThe index of the sample description that corresponds to this sample in the media.
outSampleFlagsFlags that indicate the nature of this sample. Same as in MP4GetIndMediaSampleWithPad()
Returns
MP4Err error code

◆ MP4GetMediaSampleCount()

MP4Err MP4GetMediaSampleCount ( MP4Media  theMedia,
u32 *  outCount 
)

Use this to determine the total number of samples contained in the media.

Parameters
theMediainput media object
outCountoutput number of samples in the media
Returns
MP4Err error code

◆ MP4GetMediaSampleWithPad()

MP4Err MP4GetMediaSampleWithPad ( MP4Media  theMedia,
MP4Handle  outSample,
u32 *  outSize,
u64  desiredDecodingTime,
u64 *  outDecodingTime,
u64 *  outCompositionTime,
u64 *  outDuration,
MP4Handle  outSampleDescription,
u32 *  outSampleDescriptionIndex,
u32 *  outSampleFlags,
u8 *  outPad 
)

Returns a closest sample with padding bits, given the desired decoding time.

Note
If the track has no recorded padding table (no padding information) then the padding value returned will be 0xF8. This is not a legal value for actual padding and should not be supplied to calls which add samples.
Parameters
outPadoutput padding bits of the sample.

other parameters are the same as in MP4GetMediaSample()

◆ MP4GetMediaTimeScale()

MP4Err MP4GetMediaTimeScale ( MP4Media  theMedia,
u32 *  outTimeScale 
)

Returns the time scale associated with the media.

Parameters
theMediainput media object
outTimeScaleoutput time scale
Returns
MP4Err error code

◆ MP4GetMediaTrack()

MP4Err MP4GetMediaTrack ( MP4Media  theMedia,
MP4Track outTrack 
)

Returns the track that is associated with this media.

Parameters
theMediainput media object
outTrackoutput track object
Returns
MP4Err error code

◆ MP4MediaTimeToSampleNum()

MP4Err MP4MediaTimeToSampleNum ( MP4Media  theMedia,
u64  mediaTime,
u32 *  outSampleNum,
u64 *  outSampleCTS,
u64 *  outSampleDTS,
s32 *  outSampleDuration 
)

Use this to obtain the sample number for a sample with the given decoding time.

Note
The time may differ from the mediaTime if the desired time is not on a sample boundary.
Parameters
theMediainput media object
mediaTimeThe decoding time of the desired sample. In the media's time scale.
outSampleNumThe sample number index for the desired sample.
outSampleCTSThe composition time for the desired sample.
outSampleDTSThe decoding time for the desired sample.
outSampleDurationThe duration of the sample, expressed in the media time scale.
Returns
MP4Err error code

◆ MP4SampleNumToMediaTime()

MP4Err MP4SampleNumToMediaTime ( MP4Media  theMedia,
u32  sampleNum,
u64 *  outSampleCTS,
u64 *  outSampleDTS,
s32 *  outSampleDuration 
)

Use this to obtain the decoding and composition times for a particular media sample.

Parameters
theMediainput media object
sampleNumThe sample number index for the desired sample.
outSampleCTSThe composition time for the desired sample.
outSampleDTSThe decoding time for the desired sample.
outSampleDurationThe duration of the sample, expressed in the media time scale.
Returns
MP4Err error code

◆ MP4UseSignedCompositionTimeOffsets()

MP4Err MP4UseSignedCompositionTimeOffsets ( MP4Media  media)

Sets the version of the MP4CompositionOffsetAtom to 1.

This means that negative offsets for the composition time are enabled. Call this function before adding samples to the media. This function also adds the composition to decode atom to the sample table.

Note
before you start a new movie fragment you have to call ISOSetCompositonToDecodePropertiesForFragments() to set the composition to decode fields manually, because they cannot be automatically computed for fragments.
Parameters
mediainput media object
Returns
MP4Err error code