Skip to content

General Sample Description functions

Dimitri Podborski edited this page Sep 17, 2020 · 1 revision

These functions can be used to build general sample descriptions (i.e. non-MP4 ones).

ISONewGeneralSampleDescription

ISOErr ISONewGeneralSampleDescription( 
            MP4Track theTrack,
            MP4Handle sampleDescriptionH,
            u32 dataReferenceIndex,
            u32 sampleEntryType,
            MP4GenericAtom extensionAtom );

This function can be used to create a basic sample description that can be used for calls to AddMediaSample. This will create the proper kind of sample entry atom for the track type. It takes the following parameters:

sampleDescriptionH The handle that will contain the new sample description.

dataReferenceIndex The index of the data reference that describes the media samples. If you haven’t called ISOAddMediaDataReference this parameter should be set to 1. Otherwise set it to the proper reference index for these samples.

sampleEntryType The four-character-code for the type of sample entry. Use a pre-defined type or the macro MP4_FOUR_CHAR_CODE, which takes four single character arguments.

extensionAtom You can supply an extra atom to be placed into the sample entry here.

MP4GetMediaSampleDescription

ISOErr MP4GetMediaSampleDescription( 
            MP4Media theMedia, 
            u32 index, 
            MP4Handle outDescriptionH, 
            u32 *outDataReferenceIndex );

This returns the sample description at the given index, with the data reference index that is associated with it.

ISOSetSampleDescriptionDimensions

ISOErr ISOSetSampleDescriptionDimensions(
            MP4Handle sampleEntryH, 
            u16 width, 
            u16 height);

This function sets the visual width and height of a sample description.

ISOGetSampleDescriptionDimensions

ISOErr ISOGetSampleDescriptionDimensions(
            MP4Handle sampleEntryH, 
            u16 *width, 
            u16 *height);

This function gets the visual width and height of a sample description.

ISOSetSampleDescriptionType

ISOErr ISOSetSampleDescriptionType(
            MP4Handle sampleEntryH, 
            u32 type);

This function can be used to (re)set the type of a sample description. Be careful; do not set the type away from, and back to, an MPEG-4 type, or the elementary stream descriptor atom will be lost.

ISOGetSampleDescriptionType

ISOErr ISOGetSampleDescriptionType(
            MP4Handle sampleEntryH, 
            u32 *type);

This function returns the type of a sample description.

ISOAddAtomToSampleDescription

ISOErr ISOAddAtomToSampleDescription(MP4Handle sampleEntryH, MP4GenericAtom extensionAtom);

This function adds an arbitrary atom to a sample entry (description).

ISOAddBitrateToSampleDescription

ISOErr ISOAddBitrateToSampleDescription(MP4Handle sampleEntryH, u8 is_3GPP, u32 buffersizeDB, u32 maxBitrate, u32 avgBitrate);

This function adds a bitrate atom to a sample entry (description).

ISOGetAtomFromSampleDescription

ISOErr ISOGetAtomFromSampleDescription(MP4Handle sampleEntryH, u32 atomType, MP4GenericAtom* outAtom);

This function finds the atom of the given type and returns it.

ISONewXMLMetaDataSampleDescription

ISOErr ISONewXMLMetaDataSampleDescription( MP4Track theTrack,
            MP4Handle sampleDescriptionH,
            u32 dataReferenceIndex,
            char*	content_encoding,
            char*	xml_namespace,
            char*	schema_location );

This function makes a sample description for a timed XML meta-data track.

ISONewTextMetaDataSampleDescription

ISOErr ISONewTextMetaDataSampleDescription(  MP4Track theTrack,
            MP4Handle sampleDescriptionH,
            u32 dataReferenceIndex,
            char*	content_encoding,
            char*	mime_format );

This function makes a sample description for a timed text meta-data track.

ISONewH263SampleDescription

ISOErr ISONewH263SampleDescription(  MP4Track theTrack,
            MP4Handle sampleDescriptionH,
            u32 dataReferenceIndex,
            u32 vendor,
            u8 decoder_version,
            u8 H263_level,
            u8 H263_profile);

This function creates a new H.263 video sample description according to the 3GPP specifications.

ISONewAMRSampleDescription

ISOErr ISONewAMRSampleDescription(  MP4Track theTrack,
            MP4Handle sampleDescriptionH,
            u32 dataReferenceIndex,
            u8 is_WB,
            u32 vendor,
            u8 decoder_version,
            u16 mode_set,
            u8 mode_change_period,
            u8 frames_per_sample);

This function creates a new AMR audio sample description according to the 3GPP specifications.

ISONewAMRWPSampleDescription

ISOErr ISONewAMRWPSampleDescription(  MP4Track theTrack,
            MP4Handle sampleDescriptionH,
            u32 dataReferenceIndex,
            u32 vendor,
            u8 decoder_version);

This function creates a new AMR wideband plus audio sample description according to the 3GPP specifications.

Clone this wiki locally