bool SFB::Audio::CoreAudioDecoder::HandlesMIMEType(CFStringRef mimeType) { if(nullptr == mimeType) return false; SFB::CFArray supportedMIMETypes = CreateSupportedMIMETypes(); if(!supportedMIMETypes) return false; CFIndex numberOfSupportedMIMETypes = CFArrayGetCount(supportedMIMETypes); for(CFIndex currentIndex = 0; currentIndex < numberOfSupportedMIMETypes; ++currentIndex) { CFStringRef currentMIMEType = (CFStringRef)CFArrayGetValueAtIndex(supportedMIMETypes, currentIndex); if(kCFCompareEqualTo == CFStringCompare(mimeType, currentMIMEType, kCFCompareCaseInsensitive)) return true; } return false; }
bool AudioDecoder::HandlesMIMEType(CFStringRef mimeType) { if(NULL == mimeType) return false; CFArrayRef supportedMIMETypes = CreateSupportedMIMETypes(); if(NULL == supportedMIMETypes) return false; bool mimeTypeIsSupported = false; CFIndex numberOfSupportedMIMETypes = CFArrayGetCount(supportedMIMETypes); for(CFIndex currentIndex = 0; currentIndex < numberOfSupportedMIMETypes; ++currentIndex) { CFStringRef currentMIMEType = static_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedMIMETypes, currentIndex)); if(kCFCompareEqualTo == CFStringCompare(mimeType, currentMIMEType, kCFCompareCaseInsensitive)) { mimeTypeIsSupported = true; break; } } CFRelease(supportedMIMETypes), supportedMIMETypes = NULL; return mimeTypeIsSupported; }