void	ACFLACCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
{	
	// kAudioCodecPropertyMaximumPacketByteSize is handled in the Encoder or Decoder
	
	switch(inPropertyID)
	{
		case kAudioCodecPropertyFormatCFString:
		{
			if (ioPropertyDataSize != sizeof(CFStringRef))
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			
			CABundleLocker lock;
			CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("FLAC"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
			*(CFStringRef*)outPropertyData = name;
			break; 
		}

       case kAudioCodecPropertyRequiresPacketDescription:
  			if(ioPropertyDataSize == sizeof(UInt32))
			{
                *reinterpret_cast<UInt32*>(outPropertyData) = 1; 
            }
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
            break;
			
        case kAudioCodecPropertyHasVariablePacketByteSizes:
  			if(ioPropertyDataSize == sizeof(UInt32))
			{
                *reinterpret_cast<UInt32*>(outPropertyData) = 1; // We are variable bitrate
            }
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
            break;
			
		case kAudioCodecPropertyPacketFrameSize:
			if(ioPropertyDataSize == sizeof(UInt32))
			{
                *reinterpret_cast<UInt32*>(outPropertyData) = kFramesPerPacket;
            }
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		case kAudioCodecPropertyMagicCookie:
			if(ioPropertyDataSize >= GetMagicCookieByteSize())
			{
				GetMagicCookie(outPropertyData, ioPropertyDataSize);
				mMagicCookieLength = ioPropertyDataSize;
			}
			else
			{
				CODEC_THROW(kAudioCodecIllegalOperationError);
			}
			break;
			
        case kAudioCodecPropertyCurrentInputSampleRate:
  			if(ioPropertyDataSize == sizeof(Float64))
			{
                *reinterpret_cast<Float64*>(outPropertyData) = (Float64)(mInputFormat.mSampleRate);
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
            break;
			
		case kAudioCodecPropertyCurrentOutputSampleRate:
  			if(ioPropertyDataSize == sizeof(Float64))
			{
				*reinterpret_cast<Float64*>(outPropertyData) = (Float64)(mOutputFormat.mSampleRate);
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		case kAudioCodecPropertyInputChannelLayout:
		case kAudioCodecPropertyOutputChannelLayout:
			AudioChannelLayout temp1AudioChannelLayout;
			memset(&temp1AudioChannelLayout, 0, sizeof(AudioChannelLayout));
  			if(ioPropertyDataSize == sizeof(AudioChannelLayout))
			{
				temp1AudioChannelLayout.mChannelLayoutTag = sChannelLayoutTags[mInputFormat.mChannelsPerFrame - 1];
				memcpy(outPropertyData, &temp1AudioChannelLayout, ioPropertyDataSize);
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		case kAudioCodecPropertyAvailableInputChannelLayouts:
		case kAudioCodecPropertyAvailableOutputChannelLayouts:
  			if(ioPropertyDataSize == kMaxChannels * sizeof(AudioChannelLayoutTag))
			{
				if(mIsInitialized)
				{
					AudioChannelLayoutTag temp2AudioChannelLayout[1];
					temp2AudioChannelLayout[0] = sChannelLayoutTags[mInputFormat.mChannelsPerFrame - 1];
					ioPropertyDataSize = sizeof(AudioChannelLayoutTag);
					memcpy(reinterpret_cast<AudioChannelLayoutTag*>(outPropertyData), temp2AudioChannelLayout, ioPropertyDataSize);
				}
				else
				{
					AudioChannelLayoutTag tempAudioChannelLayout[kMaxChannels];
					tempAudioChannelLayout[0] = kAudioChannelLayoutTag_Mono;
					tempAudioChannelLayout[1] = kAudioChannelLayoutTag_Stereo;
					tempAudioChannelLayout[2] = kAudioChannelLayoutTag_MPEG_3_0_B;
					tempAudioChannelLayout[3] = kAudioChannelLayoutTag_MPEG_4_0_B;
					tempAudioChannelLayout[4] = kAudioChannelLayoutTag_MPEG_5_0_D;
					tempAudioChannelLayout[5] = kAudioChannelLayoutTag_MPEG_5_1_D;
					tempAudioChannelLayout[6] = kAudioChannelLayoutTag_AAC_6_1;
					tempAudioChannelLayout[7] = kAudioChannelLayoutTag_MPEG_7_1_B;
					memcpy(reinterpret_cast<AudioChannelLayoutTag*>(outPropertyData), tempAudioChannelLayout, ioPropertyDataSize);
				}
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		case kAudioCodecPropertyFormatInfo:
			if(ioPropertyDataSize == sizeof(AudioFormatInfo))
			{
				AudioFormatInfo& formatInfo = *(AudioFormatInfo*)outPropertyData;
				
				// Check for cookie existence
				if((NULL != formatInfo.mMagicCookie) && (formatInfo.mMagicCookieSize > 0))
				{
					UInt32 theByteSize = formatInfo.mMagicCookieSize;
					
					FLAC__StreamMetadata_StreamInfo theConfig;
					memset (&theConfig, 0, sizeof(FLAC__StreamMetadata_StreamInfo));
					ParseMagicCookie(formatInfo.mMagicCookie, theByteSize, &theConfig);
					formatInfo.mASBD.mSampleRate = (Float64)theConfig.sample_rate;
					formatInfo.mASBD.mChannelsPerFrame = theConfig.channels;
					formatInfo.mASBD.mFramesPerPacket = theConfig.max_blocksize;
					formatInfo.mASBD.mBytesPerPacket = 0; // it's never CBR
					switch (theConfig.bits_per_sample)
					{
						case 16:
							formatInfo.mASBD.mFormatFlags = kFLACFormatFlag_16BitSourceData;
							break;
						case 20:
							formatInfo.mASBD.mFormatFlags = kFLACFormatFlag_20BitSourceData;
							break;
						case 24:
							formatInfo.mASBD.mFormatFlags = kFLACFormatFlag_24BitSourceData;
							break;
						case 32:
							formatInfo.mASBD.mFormatFlags = kFLACFormatFlag_32BitSourceData;
							break;
						default: // we don't support this
							formatInfo.mASBD.mFormatFlags = 0;
							break;						
					}
				}
				else
				{
					// We don't have a cookie, we have to check the ASBD 
					// according to the input formats
					UInt32 i;
					for(i = 0; i < GetNumberSupportedInputFormats(); ++i)
					{
						if(mInputFormatList[i].IsEqual(formatInfo.mASBD))
						{
							// IsEqual will treat 0 values as wildcards -- we can't have that with the format flags
							UInt32 tempFormatFlags = formatInfo.mASBD.mFormatFlags;
							// Fill out missing entries
							CAStreamBasicDescription::FillOutFormat(formatInfo.mASBD, mInputFormatList[i]);
							if (tempFormatFlags == 0)
							{
								formatInfo.mASBD.mFormatFlags = 0; // anything assigned here would be bad.
							}
							break;
						}
					}
					if(i == GetNumberSupportedInputFormats())
					{
						// No suitable settings found
						CODEC_THROW(kAudioCodecUnsupportedFormatError);						
					}
				}
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		default:
			ACBaseCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
	}
}
Exemple #2
0
void CASpeexDecoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
{
    dbg_printf(" >> [%08lx] CASpeexDecoder :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
    switch(inPropertyID)
    {
    case kAudioCodecPropertyRequiresPacketDescription:
        if(ioPropertyDataSize == sizeof(UInt32))
        {
            *reinterpret_cast<UInt32*>(outPropertyData) = 1;
        }
        else
        {
            CODEC_THROW(kAudioCodecBadPropertySizeError);
        }
        break;
    case kAudioCodecPropertyHasVariablePacketByteSizes:
        if(ioPropertyDataSize == sizeof(UInt32))
        {
            *reinterpret_cast<UInt32*>(outPropertyData) = 1;
        }
        else
        {
            CODEC_THROW(kAudioCodecBadPropertySizeError);
        }
        break;
    case kAudioCodecPropertyPacketFrameSize:
        if(ioPropertyDataSize == sizeof(UInt32))
        {
            UInt32 *outProp = reinterpret_cast<UInt32*>(outPropertyData);
            if (!mCompressionInitialized)
                *outProp = kSpeexFramesPerPacket;
            else if (mSpeexHeader.frame_size != 0 * mSpeexHeader.frames_per_packet != 0)
                *outProp = mSpeexHeader.frame_size * mSpeexHeader.frames_per_packet;
            else
                *outProp = 8192;
            if (*outProp < 8192 && mInputFormat.mFormatID == kAudioFormatXiphOggFramedSpeex)
                *outProp = 8192;
            dbg_printf("  = [%08lx] CASpeexDecoder :: GetProperty('pakf'): %ld\n",
                       (UInt32) this, *outProp);
        }
        else
        {
            CODEC_THROW(kAudioCodecBadPropertySizeError);
        }
        break;

        //case kAudioCodecPropertyQualitySetting: ???
#if TARGET_OS_MAC
    case kAudioCodecPropertyNameCFString:
        {
            if (ioPropertyDataSize != sizeof(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);

            CABundleLocker lock;
            CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Xiph Speex decoder"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
            *(CFStringRef*)outPropertyData = name;
            break;
        }

        //case kAudioCodecPropertyManufacturerCFString:
#endif
    default:
        ACBaseCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
    }
    dbg_printf("<.. [%08lx] CASpeexDecoder :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
}
Exemple #3
0
void	ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
{
	UInt32 thePacketsToGet;
	
	switch(inPropertyID)
	{
		case kAudioCodecPropertyNameCFString:
		{
			if (ioPropertyDataSize != SizeOf32(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
			
			CABundleLocker lock;
			CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("unknown codec"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
			*(CFStringRef*)outPropertyData = name;
			break; 
		}
		
		case kAudioCodecPropertyManufacturerCFString:
		{
			if (ioPropertyDataSize != SizeOf32(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
			
			CABundleLocker lock;
			CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Apple, Inc."), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
			*(CFStringRef*)outPropertyData = name;
			break; 
		}
        case kAudioCodecPropertyRequiresPacketDescription:
  			if(ioPropertyDataSize == SizeOf32(UInt32))
			{
                *reinterpret_cast<UInt32*>(outPropertyData) = 0; 
            }
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
            break;
			
		case kAudioCodecPropertyMinimumNumberInputPackets :
			if(ioPropertyDataSize != SizeOf32(UInt32)) CODEC_THROW(kAudioCodecBadPropertySizeError);
			*(UInt32*)outPropertyData = 1;
			break;
			
		case kAudioCodecPropertyMinimumNumberOutputPackets :
			if(ioPropertyDataSize != SizeOf32(UInt32)) CODEC_THROW(kAudioCodecBadPropertySizeError);
			*(UInt32*)outPropertyData = 1;
			break;
			
		case kAudioCodecPropertyCurrentInputFormat:
			if(ioPropertyDataSize == SizeOf32(AudioStreamBasicDescription))
			{
				GetCurrentInputFormat(*reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData));
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		case kAudioCodecPropertySupportedInputFormats:
		case kAudioCodecPropertyInputFormatsForOutputFormat:
			thePacketsToGet = ioPropertyDataSize / SizeOf32(AudioStreamBasicDescription);
			GetSupportedInputFormats(reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData), thePacketsToGet);
			ioPropertyDataSize = thePacketsToGet * SizeOf32(AudioStreamBasicDescription);
			break;
			
		case kAudioCodecPropertyCurrentOutputFormat:
			if(ioPropertyDataSize == SizeOf32(AudioStreamBasicDescription))
			{
				GetCurrentOutputFormat(*reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData));
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		case kAudioCodecPropertySupportedOutputFormats:
		case kAudioCodecPropertyOutputFormatsForInputFormat:
			thePacketsToGet = ioPropertyDataSize / SizeOf32(AudioStreamBasicDescription);
			GetSupportedOutputFormats(reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData), thePacketsToGet);
			ioPropertyDataSize = thePacketsToGet * SizeOf32(AudioStreamBasicDescription);
			break;
			
		case kAudioCodecPropertyMagicCookie:
			if(ioPropertyDataSize >= GetMagicCookieByteSize())
			{
				GetMagicCookie(outPropertyData, ioPropertyDataSize);
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		case kAudioCodecPropertyInputBufferSize:
			if(ioPropertyDataSize == SizeOf32(UInt32))
			{
				*reinterpret_cast<UInt32*>(outPropertyData) = GetInputBufferByteSize();
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		case kAudioCodecPropertyUsedInputBufferSize:
			if(ioPropertyDataSize == SizeOf32(UInt32))
			{
				*reinterpret_cast<UInt32*>(outPropertyData) = GetUsedInputBufferByteSize();
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
		case kAudioCodecPropertyIsInitialized:
			if(ioPropertyDataSize == SizeOf32(UInt32))
			{
				*reinterpret_cast<UInt32*>(outPropertyData) = IsInitialized() ? 1 : 0;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
			
        case kAudioCodecPropertyAvailableNumberChannels:
  			if(ioPropertyDataSize == SizeOf32(UInt32) * 2)
			{
				(reinterpret_cast<UInt32*>(outPropertyData))[0] = 1;
				(reinterpret_cast<UInt32*>(outPropertyData))[1] = 2;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

        case kAudioCodecPropertyPrimeMethod:
  			if(ioPropertyDataSize == SizeOf32(UInt32))
			{
				*reinterpret_cast<UInt32*>(outPropertyData) = (UInt32)kAudioCodecPrimeMethod_None;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

		case kAudioCodecPropertyPrimeInfo:
  			if(ioPropertyDataSize == SizeOf32(AudioCodecPrimeInfo) )
			{
				(reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->leadingFrames = 0;
				(reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->trailingFrames = 0;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

        case kAudioCodecPropertyDoesSampleRateConversion:
  			if(ioPropertyDataSize == SizeOf32(UInt32))
			{
				*reinterpret_cast<UInt32*>(outPropertyData) = 0;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

		default:
			CODEC_THROW(kAudioCodecUnknownPropertyError);
			break;
			
	};
}
void	ACAppleIMA4Encoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
{	
	switch(inPropertyID)
	{
#if !BUILD_ADEC_LIB
		case kAudioCodecPropertyNameCFString:
		{
			if (ioPropertyDataSize != sizeof(CFStringRef))
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			CABundleLocker lock;
			CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Acme IMA4 encoder"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
			*(CFStringRef*)outPropertyData = name;
			break; 
		}
#endif
		case kAudioCodecPropertyAvailableNumberChannels:
  			if(ioPropertyDataSize == sizeof(UInt32) * kMaxIMA4Channels)
			{
				memcpy(reinterpret_cast<UInt32*>(outPropertyData), mSupportedChannelTotals, ioPropertyDataSize);
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
		case kAudioCodecPropertyAvailableInputSampleRates:
  			if(ioPropertyDataSize == sizeof(AudioValueRange) )
			{
				(reinterpret_cast<AudioValueRange*>(outPropertyData))->mMinimum = 0.0;
				(reinterpret_cast<AudioValueRange*>(outPropertyData))->mMaximum = 0.0;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
		case kAudioCodecPropertyAvailableOutputSampleRates:
  			if(ioPropertyDataSize == sizeof(AudioValueRange) )
			{
				(reinterpret_cast<AudioValueRange*>(outPropertyData))->mMinimum = 0.0;
				(reinterpret_cast<AudioValueRange*>(outPropertyData))->mMaximum = 0.0;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
		case kAudioCodecPropertyPrimeInfo:
  			if(ioPropertyDataSize == sizeof(AudioCodecPrimeInfo) )
			{
				(reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->leadingFrames = 0;
				(reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->trailingFrames = mZeroesPadded;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
		case kAudioCodecPropertyZeroFramesPadded:
			if(ioPropertyDataSize == sizeof(UInt32))
			{
				*reinterpret_cast<UInt32*>(outPropertyData) = mZeroesPadded;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;
		default:
			ACAppleIMA4Codec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
	}
}
Exemple #5
0
void	ACShepA52Codec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData) {
    switch(inPropertyID) {
    case kAudioCodecPropertyManufacturerCFString:
    {
        if (ioPropertyDataSize != sizeof(CFStringRef)) {
            CODEC_THROW(kAudioCodecBadPropertySizeError);
        }

        CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Shepmaster Productions"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
        *(CFStringRef*)outPropertyData = name;
        break;
    }

    case kAudioCodecPropertyMaximumPacketByteSize:

        if(ioPropertyDataSize == sizeof(UInt32)) {
            *reinterpret_cast<UInt32*>(outPropertyData) = 3840; //Stolen from liba52 docs
        } else {
            CODEC_THROW(kAudioCodecBadPropertySizeError);
        }

        break;
    case kAudioCodecPropertyRequiresPacketDescription:

        if(ioPropertyDataSize == sizeof(UInt32)) {
            *reinterpret_cast<UInt32*>(outPropertyData) = 0;
        } else {
            CODEC_THROW(kAudioCodecBadPropertySizeError);
        }

        break;
    case kAudioCodecPropertyHasVariablePacketByteSizes:

        if(ioPropertyDataSize == sizeof(UInt32)) {
            *reinterpret_cast<UInt32*>(outPropertyData) = 1;
        } else {
            CODEC_THROW(kAudioCodecBadPropertySizeError);
        }

        break;
    case kAudioCodecPropertyPacketFrameSize:

        if(ioPropertyDataSize == sizeof(UInt32)) {
            *reinterpret_cast<UInt32*>(outPropertyData) = 6 * 256; // A frame has 6 blocks of 256 samples
        } else {
            CODEC_THROW(kAudioCodecBadPropertySizeError);
        }

        break;
    default:
        ACSimpleCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
    }
}
void	ACFLACEncoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
{
	switch(inPropertyID)
	{
		case kAudioCodecPropertyNameCFString:
		{
			if (ioPropertyDataSize != sizeof(CFStringRef))
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			CABundleLocker lock;
			CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("FLAC encoder"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
			*(CFStringRef*)outPropertyData = name;
			break; 
		}
		
		case kAudioCodecPropertyAvailableNumberChannels:
  			if(ioPropertyDataSize == sizeof(UInt32) * kFLACNumberSupportedChannelTotals)
			{
				memcpy(reinterpret_cast<UInt32*>(outPropertyData), mSupportedChannelTotals, ioPropertyDataSize);
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

		case kAudioCodecPropertyAvailableInputSampleRates:
  			if(ioPropertyDataSize == sizeof(AudioValueRange) )
			{
				(reinterpret_cast<AudioValueRange*>(outPropertyData))->mMinimum = 0.0;
				(reinterpret_cast<AudioValueRange*>(outPropertyData))->mMaximum = 0.0;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

		case kAudioCodecPropertyAvailableOutputSampleRates:
  			if(ioPropertyDataSize == sizeof(AudioValueRange) )
			{
				(reinterpret_cast<AudioValueRange*>(outPropertyData))->mMinimum = 0.0;
				(reinterpret_cast<AudioValueRange*>(outPropertyData))->mMaximum = 0.0;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

        case kAudioCodecPropertyPrimeMethod:
  			if(ioPropertyDataSize == sizeof(UInt32))
			{
				*reinterpret_cast<UInt32*>(outPropertyData) = (UInt32)kAudioCodecPrimeMethod_None;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

		case kAudioCodecPropertyPrimeInfo:
  			if(ioPropertyDataSize == sizeof(AudioCodecPrimeInfo) )
			{
				(reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->leadingFrames = 0;
				(reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->trailingFrames = mTrailingFrames;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

        case kAudioCodecPropertyQualitySetting:
  			if(ioPropertyDataSize == sizeof(UInt32))
			{
                *reinterpret_cast<UInt32*>(outPropertyData) = mQuality;
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

       case kAudioCodecPropertyMaximumPacketByteSize:
			if(ioPropertyDataSize == sizeof(UInt32))
			{
				if (mMaxFrameBytes)
				{
					*reinterpret_cast<UInt32*>(outPropertyData) = mMaxFrameBytes;
				}
				else // default case
				{
					*reinterpret_cast<UInt32*>(outPropertyData) = mMaxFrameBytes = kInputBufferPackets * mOutputFormat.mChannelsPerFrame * (mBitDepth >> 3) + kMaxEscapeHeaderBytes;
				}
			#if VERBOSE
				printf("Max packet size == %lu, mBitDepth == %lu\n", mMaxFrameBytes, mBitDepth);
			#endif
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

		case kAudioCodecInputFormatsForOutputFormat:
			if(ioPropertyDataSize >= sizeof(AudioStreamBasicDescription))
			{
				UInt32 bitDepth, numFormats = 1, tempSize;
				switch ( ( ( (AudioStreamBasicDescription*)(outPropertyData) )[0].mFormatFlags) & 0x00000007)
				{
					case kFLACFormatFlag_16BitSourceData:
						bitDepth = 16;
						break;
					case kFLACFormatFlag_20BitSourceData:
						bitDepth = 24;
						break;
					case kFLACFormatFlag_24BitSourceData:
						bitDepth = 24;
						break;						
					case kFLACFormatFlag_32BitSourceData:
						bitDepth = 32;
						break;
					default: // Check the currently set input format bit depth
						bitDepth = mInputFormat.mBitsPerChannel;
						numFormats = 2;
						break;
				}
				AudioStreamBasicDescription theInputFormat = {kAudioStreamAnyRate, kAudioFormatLinearPCM, kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked, 0, 1, 0, 0, bitDepth, 0};
				tempSize = sizeof(AudioStreamBasicDescription) * numFormats;
				if ( tempSize <= ioPropertyDataSize )
				{
					ioPropertyDataSize = tempSize;
				}
				else
				{
					CODEC_THROW(kAudioCodecBadPropertySizeError);
				}
				if ( numFormats == 1 )
				{
					memcpy(outPropertyData, &theInputFormat, ioPropertyDataSize);
				}
				else // numFormats == 2
				{
					theInputFormat.mBitsPerChannel = 16;
					memcpy(outPropertyData, &theInputFormat, sizeof(AudioStreamBasicDescription));
					theInputFormat.mBitsPerChannel = 24;
					memcpy((void *)((Byte *)outPropertyData + sizeof(AudioStreamBasicDescription)), &theInputFormat, sizeof(AudioStreamBasicDescription));
				}
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

        case kAudioCodecPropertyZeroFramesPadded:
			if(ioPropertyDataSize == sizeof(UInt32))
			{
				*reinterpret_cast<UInt32*>(outPropertyData) = 0; // we never append any extra zeros
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

		case kAudioCodecPropertySettings:
  			if(ioPropertyDataSize == sizeof(CFDictionaryRef *) )
			{
				BuildSettingsDictionary(reinterpret_cast<CFDictionaryRef *>(outPropertyData) );
			}
			else
			{
				CODEC_THROW(kAudioCodecBadPropertySizeError);
			}
			break;

		default:
			ACFLACCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
	}