CMMetadataFormatDescriptionRef and adding extensions

Hello


I am successfully creating CMMetadataFormatDescriptionRef's via CMMetadataFormatDescriptionCreateWithMetadataSpecifications - and am able to write samples via AVTimedMetadataGroup and friends. Awesome!


I woud like to add extension keys to my format description so that I can add kCMFormatDescriptionExtension_FormatName, kCMFormatDescriptionExtension_Vendor, and kCMFormatDescriptionExtension_Version flags to my sample buffers and thus ensure that they are properly tagged, able to be introspected and able to be handled by playback software should they support my format and versions.


However, I can't create a custom metadata format description using the basic CMFormatDescriptionCreate - and the documentation specifies this might be the case (see the header for CMFormatDescriptionCreate).

Since CMFormatDescriptionRefs are opaque and non mutable, is it possible to add such keys to metadata format descriptions in an API correct manner?


Ive attempted to use CMMetadataFormatDescriptionCreateWithMetadataFormatDescriptionAndMetadataSpecifications (whew thats a doozy) - but it only accepts metadata key/values - not extension keys. I get invalid parameter error if passing a buffer.


Ive attempted to use CMMetadataFormatDescriptionCreateByMergingMetadataFormatDescriptions and CMMetadataFormatDescriptionCreateWithMetadataFormatDescriptionAndMetadataSpecifications, which both also throw kCMFormatDescriptionError_InvalidParameter since I imagine one of the source format descriptions is not a valid metadata description.


Any insight regarding this would be helpful.