diff options
Diffstat (limited to 'libs/appleutility/CoreAudio/AudioCodecs')
12 files changed, 213 insertions, 213 deletions
diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp index f1ffdf7f1b..f545edd365 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp @@ -2,14 +2,14 @@ File: ACBaseCodec.cpp Abstract: ACBaseCodec.h Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ //============================================================================= // Includes @@ -93,27 +93,27 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out outPropertyDataSize = SizeOf32(CFStringRef); outWritable = false; break; - + case kAudioCodecPropertyManufacturerCFString: outPropertyDataSize = SizeOf32(CFStringRef); outWritable = false; break; - + case kAudioCodecPropertyFormatCFString: outPropertyDataSize = SizeOf32(CFStringRef); outWritable = false; - break; + break; #endif case kAudioCodecPropertyRequiresPacketDescription: outPropertyDataSize = SizeOf32(UInt32); outWritable = false; break; - + case kAudioCodecPropertyMinimumNumberInputPackets : outPropertyDataSize = SizeOf32(UInt32); outWritable = false; break; - + case kAudioCodecPropertyMinimumNumberOutputPackets : outPropertyDataSize = SizeOf32(UInt32); outWritable = false; @@ -123,39 +123,39 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out outPropertyDataSize = SizeOf32(AudioStreamBasicDescription); outWritable = true; break; - + case kAudioCodecPropertySupportedInputFormats: case kAudioCodecPropertyInputFormatsForOutputFormat: outPropertyDataSize = GetNumberSupportedInputFormats() * SizeOf32(AudioStreamBasicDescription); outWritable = false; break; - + case kAudioCodecPropertyCurrentOutputFormat: outPropertyDataSize = SizeOf32(AudioStreamBasicDescription); outWritable = true; break; - + case kAudioCodecPropertySupportedOutputFormats: case kAudioCodecPropertyOutputFormatsForInputFormat: outPropertyDataSize = GetNumberSupportedOutputFormats() * SizeOf32(AudioStreamBasicDescription); outWritable = false; break; - + case kAudioCodecPropertyMagicCookie: outPropertyDataSize = GetMagicCookieByteSize(); outWritable = true; break; - + case kAudioCodecPropertyInputBufferSize: outPropertyDataSize = SizeOf32(UInt32); outWritable = false; break; - + case kAudioCodecPropertyUsedInputBufferSize: outPropertyDataSize = SizeOf32(UInt32); outWritable = false; break; - + case kAudioCodecPropertyIsInitialized: outPropertyDataSize = SizeOf32(UInt32); outWritable = false; @@ -165,7 +165,7 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out outPropertyDataSize = SizeOf32(UInt32) * 2; // Mono, stereo outWritable = false; break; - + case kAudioCodecPropertyPrimeMethod: outPropertyDataSize = SizeOf32(UInt32); outWritable = false; @@ -184,35 +184,35 @@ void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& out default: CODEC_THROW(kAudioCodecUnknownPropertyError); break; - + }; } void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData) { UInt32 thePacketsToGet; - + switch(inPropertyID) { #if !BUILD_ADEC_LIB 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; + 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; + break; } #else // If called on the device these should return nothing but 0 @@ -226,24 +226,24 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope case kAudioCodecPropertyRequiresPacketDescription: if(ioPropertyDataSize == SizeOf32(UInt32)) { - *reinterpret_cast<UInt32*>(outPropertyData) = 0; + *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)) { @@ -254,14 +254,14 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope 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)) { @@ -272,14 +272,14 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope 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()) { @@ -290,7 +290,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope CODEC_THROW(kAudioCodecBadPropertySizeError); } break; - + case kAudioCodecPropertyInputBufferSize: if(ioPropertyDataSize == SizeOf32(UInt32)) { @@ -301,7 +301,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope CODEC_THROW(kAudioCodecBadPropertySizeError); } break; - + case kAudioCodecPropertyUsedInputBufferSize: if(ioPropertyDataSize == SizeOf32(UInt32)) { @@ -312,7 +312,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope CODEC_THROW(kAudioCodecBadPropertySizeError); } break; - + case kAudioCodecPropertyIsInitialized: if(ioPropertyDataSize == SizeOf32(UInt32)) { @@ -323,7 +323,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope CODEC_THROW(kAudioCodecBadPropertySizeError); } break; - + case kAudioCodecPropertyAvailableNumberChannels: if(ioPropertyDataSize == SizeOf32(UInt32) * 2) { @@ -373,7 +373,7 @@ void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPrope default: CODEC_THROW(kAudioCodecUnknownPropertyError); break; - + }; } @@ -384,7 +384,7 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper { CODEC_THROW(kAudioCodecIllegalOperationError); } - + switch(inPropertyID) { case kAudioCodecPropertyCurrentInputFormat: @@ -397,7 +397,7 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper CODEC_THROW(kAudioCodecBadPropertySizeError); } break; - + case kAudioCodecPropertyCurrentOutputFormat: if(inPropertyDataSize == SizeOf32(AudioStreamBasicDescription)) { @@ -408,11 +408,11 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper CODEC_THROW(kAudioCodecBadPropertySizeError); } break; - + case kAudioCodecPropertyMagicCookie: SetMagicCookie(inPropertyData, inPropertyDataSize); break; - + case kAudioCodecPropertyMinimumNumberOutputPackets : case kAudioCodecPropertyMinimumNumberInputPackets : case kAudioCodecPropertyInputBufferSize: @@ -432,7 +432,7 @@ void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProper case kAudioCodecPropertyRequiresPacketDescription: CODEC_THROW(kAudioCodecIllegalOperationError); break; - + default: CODEC_THROW(kAudioCodecUnknownPropertyError); break; @@ -462,13 +462,13 @@ void ACBaseCodec::GetSupportedInputFormats(AudioStreamBasicDescription* outInput { UInt32 theNumberFormats = (UInt32)mInputFormatList.size(); ioNumberInputFormats = (theNumberFormats < ioNumberInputFormats) ? theNumberFormats : ioNumberInputFormats; - + FormatList::const_iterator theIterator = mInputFormatList.begin(); theNumberFormats = ioNumberInputFormats; while((theNumberFormats > 0) && (theIterator != mInputFormatList.end())) { *outInputFormats = *theIterator; - + ++outInputFormats; --theNumberFormats; std::advance(theIterator, 1); @@ -501,13 +501,13 @@ void ACBaseCodec::GetSupportedOutputFormats(AudioStreamBasicDescription* outOutp { UInt32 theNumberFormats = (UInt32)mOutputFormatList.size(); ioNumberOutputFormats = (theNumberFormats < ioNumberOutputFormats) ? theNumberFormats : ioNumberOutputFormats; - + FormatList::const_iterator theIterator = mOutputFormatList.begin(); theNumberFormats = ioNumberOutputFormats; while((theNumberFormats > 0) && (theIterator != mOutputFormatList.end())) { *outOutputFormats = *theIterator; - + ++outOutputFormats; --theNumberFormats; std::advance(theIterator, 1); diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h index 6689d91fbe..2329d94ec2 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h @@ -2,14 +2,14 @@ File: ACBaseCodec.h Abstract: Part of CoreAudio Utility Classes Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ #if !defined(__ACBaseCodec_h__) #define __ACBaseCodec_h__ @@ -92,7 +92,7 @@ public: protected: virtual void ReallocateInputBuffer(UInt32 inInputBufferByteSize) = 0; - + bool mIsInitialized; // Format Management @@ -102,13 +102,13 @@ public: void GetCurrentInputFormat(AudioStreamBasicDescription& outInputFormat); virtual void SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat); - + UInt32 GetNumberSupportedOutputFormats() const; void GetSupportedOutputFormats(AudioStreamBasicDescription* outOutputFormats, UInt32& ioNumberOutputFormats) const; - + void GetCurrentOutputFormat(AudioStreamBasicDescription& outOutputFormat); virtual void SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat); - + virtual UInt32 GetMagicCookieByteSize() const; virtual void GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const; virtual void SetMagicCookie(const void* outMagicCookieData, UInt32 inMagicCookieDataByteSize); @@ -119,11 +119,11 @@ public: protected: void AddInputFormat(const AudioStreamBasicDescription& inInputFormat); void AddOutputFormat(const AudioStreamBasicDescription& inOutputFormat); - + OSType GetSubType(); - + typedef std::vector<CAStreamBasicDescription> FormatList; - + FormatList mInputFormatList; #if TARGET_OS_WIN32 // VC 2005 screws up if this is not aligned to 8-byte boundaries @@ -131,7 +131,7 @@ protected: #else CAStreamBasicDescription mInputFormat; #endif - + FormatList mOutputFormatList; #if TARGET_OS_WIN32 // VC 2005 screws up if this is not aligned to 8-byte boundaries diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp index 512f93842a..19cc0cd3da 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp @@ -2,14 +2,14 @@ File: ACCodec.cpp Abstract: ACCodec.h Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ //============================================================================= // Includes @@ -83,18 +83,18 @@ ACCodec::~ACCodec() OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCodec *inThis) { OSStatus theError = kAudioCodecNoError; - + try { switch (inParameters->what) { // these selectors don't use the object pointer - + case kComponentOpenSelect: case kComponentCloseSelect: theError = ComponentBase::ComponentEntryDispatch(inParameters, inThis); break; - + case kComponentCanDoSelect: { switch (GetSelectorForCanDo(inParameters)) @@ -115,7 +115,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo } } break; - + default: // these selectors use the object pointer if(inThis != NULL) @@ -125,16 +125,16 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo case kComponentVersionSelect: theError = inThis->Version(); break; - + case kAudioCodecGetPropertyInfoSelect: { PARAM(AudioCodecPropertyID, inPropertyID, 0, 3); PARAM(UInt32 *, outSize, 1, 3); PARAM(Boolean *, outWritable, 2, 3); - + UInt32 theSize = 0; Boolean isWritable = false; - + inThis->GetPropertyInfo(inPropertyID, theSize, isWritable); if(outSize != NULL) { @@ -146,13 +146,13 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo } } break; - + case kAudioCodecGetPropertySelect: { PARAM(AudioCodecPropertyID, inPropertyID, 0, 3); PARAM(UInt32 *, ioPropertyDataSize, 1, 3); PARAM(void *, outPropertyData, 2, 3); - + if((ioPropertyDataSize != NULL) && (outPropertyData != NULL)) { inThis->GetProperty(inPropertyID, *ioPropertyDataSize, outPropertyData); @@ -163,13 +163,13 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo } } break; - + case kAudioCodecSetPropertySelect: { PARAM(AudioCodecPropertyID, inPropertyID, 0, 3); PARAM(UInt32, inPropertyDataSize, 1, 3); PARAM(const void *, inPropertyData, 2, 3); - + if(inPropertyData != NULL) { inThis->SetProperty(inPropertyID, inPropertyDataSize, inPropertyData); @@ -180,31 +180,31 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo } } break; - + case kAudioCodecInitializeSelect: { PARAM(const AudioStreamBasicDescription *, inInputFormat, 0, 4); PARAM(const AudioStreamBasicDescription *, inOutputFormat, 1, 4); PARAM(const void *, inMagicCookie, 2, 4); PARAM(UInt32, inMagicCookieByteSize, 3, 4); - + inThis->Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize); } break; - + case kAudioCodecUninitializeSelect: { inThis->Uninitialize(); } break; - + case kAudioCodecAppendInputDataSelect: { PARAM(const void *, inInputData, 0, 4); PARAM(UInt32 *, ioInputDataByteSize, 1, 4); PARAM(UInt32 *, ioNumberPackets, 2, 4); PARAM(const AudioStreamPacketDescription *, inPacketDescription, 3, 4); - + if((inInputData != NULL) && (ioInputDataByteSize != NULL)) { if(ioNumberPackets != NULL) @@ -223,7 +223,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo } } break; - + case kAudioCodecProduceOutputDataSelect: { PARAM(void *, outOutputData, 0, 5); @@ -231,7 +231,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo PARAM(UInt32 *, ioNumberPackets, 2, 5); PARAM(AudioStreamPacketDescription *, outPacketDescription, 3, 5); PARAM(UInt32 *, outStatus, 4, 5); - + if((outOutputData != NULL) && (ioOutputDataByteSize != NULL) && (ioNumberPackets != NULL) && (outStatus != NULL)) { *outStatus = inThis->ProduceOutputPackets(outOutputData, *ioOutputDataByteSize, *ioNumberPackets, outPacketDescription); @@ -246,7 +246,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo } } break; - + #if AC_NON_INTERLEAVED_SUPPORT case kAudioCodecAppendInputBufferListSelect: { @@ -254,7 +254,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo PARAM(UInt32 *, ioNumberPackets, 1, 4); PARAM(const AudioStreamPacketDescription *, inPacketDescription, 2, 4); PARAM(UInt32 *, outBytesConsumed, 3, 4); - + if((inBufferList != NULL) && (outBytesConsumed != NULL)) { if(ioNumberPackets != NULL) @@ -273,14 +273,14 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo } } break; - + case kAudioCodecProduceOutputBufferListSelect: { PARAM(AudioBufferList *, ioBufferList, 0, 4); PARAM(UInt32 *, ioNumberPackets, 1, 4); PARAM(AudioStreamPacketDescription *, outPacketDescription, 2, 4); PARAM(UInt32 *, outStatus, 3, 4); - + if((ioBufferList != NULL) && (ioNumberPackets != NULL) && (outStatus != NULL)) { *outStatus = inThis->ProduceOutputBufferList(ioBufferList, *ioNumberPackets, outPacketDescription); @@ -296,13 +296,13 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo } break; #endif // AC_NON_INTERLEAVED_SUPPORT - + case kAudioCodecResetSelect: { inThis->Reset(); } break; - + default: theError = badComponentSelector; break; @@ -323,7 +323,7 @@ OSStatus ACCodec::ComponentEntryDispatch(ComponentParameters *inParameters, ACCo { theError = kAudioCodecUnspecifiedError; } - + return theError; } #endif // !CA_USE_AUDIO_PLUGIN_ONLY && !TARGET_OS_IPHONE diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.h index b0d93165ab..9b7fecdb07 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.h +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodec.h @@ -2,14 +2,14 @@ File: ACCodec.h Abstract: Part of CoreAudio Utility Classes Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ #if !defined(__ACCodec_h__) #define __ACCodec_h__ @@ -75,7 +75,7 @@ class ACCodec : public ComponentBase public: ACCodec(AudioComponentInstance inInstance); virtual ~ACCodec(); - + #if !CA_USE_AUDIO_PLUGIN_ONLY && !TARGET_OS_IPHONE static OSStatus ComponentEntryDispatch(ComponentParameters *p, ACCodec *This); #endif @@ -91,10 +91,10 @@ public: virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize) = 0; virtual void Uninitialize() = 0; virtual void Reset() = 0; - + virtual void AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription) = 0; virtual void AppendInputBufferList(const AudioBufferList *ioBufferList, UInt32& ioNumberPackets, const AudioStreamPacketDescription *inPacketDescription, UInt32 *outBytesConsumed) = 0; - + virtual UInt32 ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets, AudioStreamPacketDescription* outPacketDescription) = 0; virtual UInt32 ProduceOutputBufferList(AudioBufferList *ioBufferList, UInt32& ioNumberPackets, AudioStreamPacketDescription *outPacketDescription) = 0; diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h index 42c2bc5ba6..1969d744da 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h @@ -2,14 +2,14 @@ File: ACCodecDispatchTypes.h Abstract: Part of CoreAudio Utility Classes Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ #if !defined(__ACCodecDispatchTypes_h__) #define __ACCodecDispatchTypes_h__ diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h index 2cff483fde..8d82d12390 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h @@ -2,14 +2,14 @@ File: ACConditionalMacros.h Abstract: Part of CoreAudio Utility Classes Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ #if !defined(__ACConditionalMacros_h__) #define __ACConditionalMacros_h__ diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.cpp index de9599b186..e2204b8be8 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.cpp +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.cpp @@ -2,14 +2,14 @@ File: ACPlugInDispatch.cpp Abstract: ACPlugInDispatch.h Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ #if AUDIOCODECS_SUPPORT_PLUGINS #include "ACPlugInDispatch.h" @@ -242,10 +242,10 @@ AudioComponentMethod AudioCodecNonInterleavedEncoderLookup::Lookup (SInt16 selec AudioComponentMethod method = AudioCodecLookup::Lookup(selector); if (method) return method; - + if (selector == kAudioCodecAppendInputBufferListSelect) return (AudioComponentMethod)AppendInputBufferList; - + return NULL; } @@ -254,10 +254,10 @@ AudioComponentMethod AudioCodecNonInterleavedDecoderLookup::Lookup (SInt16 selec AudioComponentMethod method = AudioCodecLookup::Lookup(selector); if (method) return method; - + if (selector == kAudioCodecProduceOutputBufferListSelect) return (AudioComponentMethod)ProduceOutputBufferList; - + return NULL; } #endif @@ -269,14 +269,14 @@ AudioComponentMethod AudioCodecHWCodecLookup::Lookup (SInt16 selector) { AudioComponentMethod method = AudioCodecLookup::Lookup(selector); if (method) return method; - + switch (selector) { case kAudioCodecAcquireHardwareSelect: return (AudioComponentMethod)AcquireHardware; case kAudioCodecReleaseHardwareSelect: return (AudioComponentMethod)ReleaseHardware; default: break; } - return NULL; + return NULL; } #endif // TARGET_OS_IPHONE && AUDIOCONV_HAVE_AMC diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.h index 252a4af0aa..7c84cac70a 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.h +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACPlugInDispatch.h @@ -2,14 +2,14 @@ File: ACPlugInDispatch.h Abstract: Part of CoreAudio Utility Classes Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ #ifndef __ACPlugInDispatch_h__ #define __ACPlugInDispatch_h__ diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.cpp index b10add9dac..bc78a15b67 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.cpp +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.cpp @@ -2,14 +2,14 @@ File: ACSimpleCodec.cpp Abstract: ACSimpleCodec.h Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ //============================================================================= // Includes @@ -81,8 +81,8 @@ void ACSimpleCodec::Initialize(const AudioStreamBasicDescription* inInputFormat, if (mInputFormat.mBytesPerPacket == 0) { CODEC_THROW(kAudioCodecUnsupportedFormatError); - } - + } + ACBaseCodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize); } @@ -91,11 +91,11 @@ void ACSimpleCodec::Uninitialize() // get rid of the buffer delete[] mInputBuffer; mInputBuffer = NULL; - + // reset the ring buffer state mInputBufferStart = 0; mInputBufferEnd = 0; - + ACBaseCodec::Uninitialize(); } @@ -105,11 +105,11 @@ void ACSimpleCodec::Reset() if (mInputBuffer) { // could be called before allocated. memset(mInputBuffer, 0, mInputBufferByteSize); } - + // reset the ring buffer state mInputBufferStart = 0; mInputBufferEnd = 0; - + ACBaseCodec::Reset(); } @@ -121,7 +121,7 @@ UInt32 ACSimpleCodec::GetInputBufferByteSize() const UInt32 ACSimpleCodec::GetUsedInputBufferByteSize() const { UInt32 theAnswer = 0; - + // this object uses a ring buffer if(mInputBufferStart <= mInputBufferEnd) { @@ -130,10 +130,10 @@ UInt32 ACSimpleCodec::GetUsedInputBufferByteSize() const } else { - // the active region wraps around + // the active region wraps around theAnswer = (mInputBufferByteSize - mInputBufferStart) + mInputBufferEnd; } - + return theAnswer; } @@ -142,7 +142,7 @@ void ACSimpleCodec::AppendInputData(const void* inInputData, UInt32& ioInputData { // this buffer handling code doesn't care about such things as the packet descriptions if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError); - + // this is a ring buffer we're dealing with, so we need to set up a few things UInt32 theUsedByteSize = GetUsedInputBufferByteSize(); UInt32 theAvailableByteSize = GetInputBufferByteSize() - theUsedByteSize; @@ -150,51 +150,51 @@ void ACSimpleCodec::AppendInputData(const void* inInputData, UInt32& ioInputData UInt32 theMaxAvailableInputBytes = ioInputDataByteSize; // we can't consume more than we get const Byte* theInputData = static_cast<const Byte*>(inInputData); - + // >>jamesmcc: added this because ioNumberPackets was not being updated if less was taken than given. // THIS ASSUMES CBR! UInt32 bytesPerPacketOfInput = mInputFormat.mBytesPerPacket; UInt32 theAvailablePacketSize = theAvailableByteSize / bytesPerPacketOfInput; - + UInt32 minPacketSize = ioNumberPackets < theAvailablePacketSize ? ioNumberPackets : theAvailablePacketSize; UInt32 minByteSize = minPacketSize * bytesPerPacketOfInput; - + // we can copy only as much data as there is or up to how much space is availiable ioNumberPackets = minPacketSize; ioInputDataByteSize = minByteSize; - + // ioInputDataByteSize had better be <= to theMaxAvailableInputBytes or we're screwed if (ioInputDataByteSize > theMaxAvailableInputBytes) { CODEC_THROW(kAudioCodecStateError); } - // <<jamesmcc - + // <<jamesmcc + // now we have to copy the data taking into account the wrap around and where the start is if(mInputBufferEnd + ioInputDataByteSize < mInputBufferByteSize) { // no wrap around here memcpy(mInputBuffer + mInputBufferEnd, theInputData, ioInputDataByteSize); - + // adjust the end point mInputBufferEnd += ioInputDataByteSize; } else { // the copy will wrap - + // copy the first part UInt32 theBeforeWrapByteSize = mInputBufferByteSize - mInputBufferEnd; memcpy(mInputBuffer + mInputBufferEnd, theInputData, theBeforeWrapByteSize); - + // and the rest UInt32 theAfterWrapByteSize = ioInputDataByteSize - theBeforeWrapByteSize; memcpy(mInputBuffer, theInputData + theBeforeWrapByteSize, theAfterWrapByteSize); - + // adjust the end point mInputBufferEnd = theAfterWrapByteSize; } - + } @@ -202,46 +202,46 @@ void ACSimpleCodec::ZeroPadInputData(UInt32& ioNumberPackets, const AudioStreamP { // this buffer handling code doesn't care about such things as the packet descriptions if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError); - - + + // this is a ring buffer we're dealing with, so we need to set up a few things UInt32 theUsedByteSize = GetUsedInputBufferByteSize(); UInt32 theAvailableByteSize = GetInputBufferByteSize() - theUsedByteSize; - + // >>jamesmcc: added this because ioNumberPackets was not being updated if less was taken than given. // THIS ASSUMES CBR! UInt32 bytesPerPacketOfInput = mInputFormat.mBytesPerPacket; UInt32 theAvailablePacketSize = theAvailableByteSize / bytesPerPacketOfInput; - + UInt32 minPacketSize = ioNumberPackets < theAvailablePacketSize ? ioNumberPackets : theAvailablePacketSize; UInt32 minByteSize = minPacketSize * bytesPerPacketOfInput; - + // we can copy only as much data as there is or up to how much space is availiable ioNumberPackets = minPacketSize; - - // <<jamesmcc - + + // <<jamesmcc + // now we have to copy the data taking into account the wrap around and where the start is if(mInputBufferEnd + minByteSize < mInputBufferByteSize) { // no wrap around here memset(mInputBuffer + mInputBufferEnd, 0, minByteSize); - + // adjust the end point mInputBufferEnd += minByteSize; } else { // the copy will wrap - + // copy the first part UInt32 theBeforeWrapByteSize = mInputBufferByteSize - mInputBufferEnd; memset(mInputBuffer + mInputBufferEnd, 0, theBeforeWrapByteSize); - + // and the rest UInt32 theAfterWrapByteSize = minByteSize - theBeforeWrapByteSize; memset(mInputBuffer, 0, theAfterWrapByteSize); - + // adjust the end point mInputBufferEnd = theAfterWrapByteSize; } @@ -252,32 +252,32 @@ void ACSimpleCodec::ConsumeInputData(UInt32 inConsumedByteSize) { // this is a convenience routine to make maintaining the ring buffer state easy UInt32 theContiguousRange = GetInputBufferContiguousByteSize(); - + if(inConsumedByteSize > GetUsedInputBufferByteSize()) CODEC_THROW(kAudioCodecUnspecifiedError); - + if(inConsumedByteSize <= theContiguousRange) { // the region to consume doesn't wrap - + // figure out how much to consume inConsumedByteSize = (theContiguousRange < inConsumedByteSize) ? theContiguousRange : inConsumedByteSize; - + // clear the consumed bits memset(mInputBuffer + mInputBufferStart, 0, inConsumedByteSize); - + // adjust the start mInputBufferStart += inConsumedByteSize; } else { // the region to consume will wrap - + // clear the bits to the end of the buffer memset(mInputBuffer + mInputBufferStart, 0, theContiguousRange); - + // now clear the bits left from the start memset(mInputBuffer, 0, inConsumedByteSize - theContiguousRange); - + // adjust the start mInputBufferStart = inConsumedByteSize - theContiguousRange; } @@ -287,24 +287,24 @@ void ACSimpleCodec::ConsumeInputData(UInt32 inConsumedByteSize) Byte* ACSimpleCodec::GetBytes(UInt32& ioNumberBytes) const { // if a client's algorithm has to have contiguous data and mInputBuffer wraps, then someone has to make a copy. - // I can do it more efficiently than the client. - + // I can do it more efficiently than the client. + if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError); UInt32 theUsedByteSize = GetUsedInputBufferByteSize(); //UInt32 theAvailableByteSize = GetInputBufferByteSize() - theUsedByteSize; - + if (ioNumberBytes > theUsedByteSize) ioNumberBytes = theUsedByteSize; - + SInt32 leftOver = mInputBufferStart + ioNumberBytes - mInputBufferByteSize; - + if(leftOver > 0) { - // need to copy beginning of buffer to the end. + // need to copy beginning of buffer to the end. // We cleverly over allocated our buffer space to make this possible. memmove(mInputBuffer + mInputBufferByteSize, mInputBuffer, leftOver); } - + return GetInputBufferStart(); } @@ -312,17 +312,17 @@ Byte* ACSimpleCodec::GetBytes(UInt32& ioNumberBytes) const void ACSimpleCodec::ReallocateInputBuffer(UInt32 inInputBufferByteSize) { mInputBufferByteSize = inInputBufferByteSize + kBufferPad; - + // toss the old buffer delete[] mInputBuffer; mInputBuffer = NULL; - + // allocate the new one // allocate extra in order to allow making contiguous data. UInt32 allocSize = 2*inInputBufferByteSize + kBufferPad; mInputBuffer = new Byte[allocSize]; memset(mInputBuffer, 0, allocSize); - + // reset the ring buffer state mInputBufferStart = 0; mInputBufferEnd = 0; @@ -359,6 +359,6 @@ void ACSimpleCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inProp break; default: ACBaseCodec::SetProperty(inPropertyID, inPropertyDataSize, inPropertyData); - break; + break; } } diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.h index f41fe54b93..f8b5d0f0be 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.h +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/ACSimpleCodec.h @@ -2,14 +2,14 @@ File: ACSimpleCodec.h Abstract: Part of CoreAudio Utility Classes Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ #if !defined(__ACSimpleCodec_h__) #define __ACSimpleCodec_h__ @@ -84,17 +84,17 @@ public: virtual void SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData); protected: - void ConsumeInputData(UInt32 inConsumedByteSize); + void ConsumeInputData(UInt32 inConsumedByteSize); Byte* GetInputBufferStart() const { return mInputBuffer + mInputBufferStart; } UInt32 GetInputBufferContiguousByteSize() const { return (mInputBufferStart <= mInputBufferEnd) ? (mInputBufferEnd - mInputBufferStart) : (mInputBufferByteSize - mInputBufferStart); } virtual void ReallocateInputBuffer(UInt32 inInputBufferByteSize); - - // returns a pointer to contiguous bytes. + + // returns a pointer to contiguous bytes. // will do some copying if the request wraps around the internal buffer. // request must be less than available bytes Byte* GetBytes(UInt32& ioNumberBytes) const; -private: +private: Byte* mInputBuffer; UInt32 mInputBufferByteSize; UInt32 mInputBufferStart; diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp index 8954c8dd56..f0b0ef9b15 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp @@ -2,14 +2,14 @@ File: GetCodecBundle.cpp Abstract: GetCodecBundle.h Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ #include "GetCodecBundle.h" @@ -59,7 +59,7 @@ const CFStringRef kCodecBundleID = CFSTR("com.apple.audio.codecs.Components"); CFBundleRef GetCodecBundle() { static CFBundleRef sAudioCodecBundle = 0; - if (!sAudioCodecBundle) + if (!sAudioCodecBundle) { #if TARGET_OS_WIN32 sAudioCodecBundle = CFBundleGetBundleWithIdentifier(CFSTR(kCodecBundleID)); diff --git a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h index 96e3d9e2b4..f6c501a347 100644 --- a/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h +++ b/libs/appleutility/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h @@ -2,14 +2,14 @@ File: GetCodecBundle.h Abstract: Part of CoreAudio Utility Classes Version: 1.1 - + Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. - + In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the @@ -25,13 +25,13 @@ implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. - + The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. - + IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -40,9 +40,9 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + Copyright (C) 2014 Apple Inc. All Rights Reserved. - + */ #ifndef _GetCodecBundle_ #define _GetCodecBundle_ |