Skip to content

AVC Sample Description functions

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

These convenience functions can be used to build and inspect AVC sample descriptions (i.e. non-MP4 ones).

ISONewAVCSampleDescription

ISOErr ISONewAVCSampleDescription(  MP4Track theTrack,
            MP4Handle sampleDescriptionH,
            u32 dataReferenceIndex,
            u32 length_size, 
            MP4Handle first_sps, 
            MP4Handle first_pps, 
            MP4Handle first_spsext );

This builds a new sample entry. The length_size is the size of the NAL Unit length field (and must be 1, 2 or 4). The remaining three parameters are parameter sets (sequence, picture, and sequence extension, respectively), or NULL. The sequence parameter set MUST be passed – it is used to get the profile, level, etc. It will only be added to the configuration if a picture parameter set is also present. The sequence extension parameter set is only used if an appropriate profile is used, of course.

You almost certainly will need to set the sample description width and height, after calling this function.

ISOAddVCSampleDescriptionPS

ISOErr ISOAddVCSampleDescriptionPS(  MP4Handle sampleEntryH, MP4Handle ps, u32 where );

This adds another parameter set (which is not, in fact, inspected), to the configuration. where can be AVCsps, AVCpps or AVCspsext.

ISOGetAVCSampleDescription

ISOErr ISOGetAVCSampleDescription( MP4Handle sampleEntryH,
            u32 *dataReferenceIndex,
            u32 *length_size,
            u32* sps_count, 
            u32* pps_count, 
            u32* spsext_count );

This gets the basic parameters of the AVC sample entry.

ISOGetVCSampleDescriptionPS

ISOErr ISOGetVCSampleDescriptionPS(  MP4Handle sampleEntryH, MP4Handle ps, u32 where, u32 index );

This gets a parameter set, placing it in the given handle. where is interpreted as for adding parameter sets; the indexes start at 1 (1 is the first parameter set in the indicated array).