示例#1
0
void
STSDAtom::ReadDecoderConfig(uint8 **pDecoderConfig, size_t *pDecoderConfigSize,
	AudioDescription *pAudioDescription, VideoDescription *pVideoDescription)
{
	// Check for a Decoder Config and if it exists copy it back to the caller
	// MPEG-4 video/audio use the various decoder config structures to pass
	// additional decoder information to the decoder.  The extractor sometimes
	// needs to decode the data to work out how to properly construct the
	// decoder
	
	// First make sure we have a something
	if (GetBytesRemaining() > 0) {
		// Well something is there so read it as an atom
		AtomBase *aAtomBase = GetAtom(theStream);
	
		aAtomBase->ProcessMetaData();
		printf("%s [%Ld]\n",aAtomBase->GetAtomName(),aAtomBase->GetAtomSize());

		if (dynamic_cast<DecoderConfigAtom *>(aAtomBase)) {
			// DecoderConfig atom good
			DecoderConfigAtom *aDecoderConfigAtom = 
				dynamic_cast<DecoderConfigAtom *>(aAtomBase);
			aDecoderConfigAtom->OverrideAudioDescription(pAudioDescription);
			aDecoderConfigAtom->OverrideVideoDescription(pVideoDescription);

			delete aAtomBase;
		} else {
			// Unknown atom bad
			printf("Unknown atom %s\n",aAtomBase->GetAtomName());
			delete aAtomBase;
		}
	}
}