From 2b76d6da3004701cee9bf29ca8d42dd63590a719 Mon Sep 17 00:00:00 2001 From: astrange Date: Sat, 10 Dec 2011 06:49:44 +0000 Subject: [PATCH] Xcode project cleanup and Lion SDK updates - Update ACPublic/PublicUtility to Lion version. API changed in various ways. Rather than copy the files I've just included them from the Developer directory, which may turn out to be a bad idea. Removed use of ACSimpleCodec along the way. - Stop including ffmpeg/**, which will improve compilation speed. - Some other changes to better use Xcode 4 schemes --- ACPublic/ACBaseCodec.cpp | 627 ------------------ ACPublic/ACBaseCodec.h | 125 ---- ACPublic/ACCodec.cpp | 69 -- ACPublic/ACCodec.h | 97 --- ACPublic/ACCodecDispatch.h | 267 -------- ACPublic/ACCodecDispatchTypes.h | 254 ------- ACPublic/ACCompatibility.h | 109 +++ ACPublic/ACConditionalMacros.h | 68 -- ACPublic/ACSimpleCodec.cpp | 353 ---------- ACPublic/ACSimpleCodec.h | 100 --- ACPublic/GetCodecBundle.cpp | 97 ++- ACPublic/GetCodecBundle.h | 62 -- CAPublicUtility/CABundleLocker.cpp | 84 --- CAPublicUtility/CABundleLocker.h | 69 -- CAPublicUtility/CAConditionalMacros.h | 74 --- CAPublicUtility/CADebugMacros.cpp | 84 --- CAPublicUtility/CADebugMacros.h | 414 ------------ CAPublicUtility/CADebugPrintf.h | 83 --- CAPublicUtility/CAStreamBasicDescription.cpp | 464 ------------- CAPublicUtility/CAStreamBasicDescription.h | 224 ------- Codecprintf.c | 5 +- CommonUtils.c | 13 +- CompressAudioCodec.cpp | 13 +- CompressAudioCodec.h | 10 +- CompressVideoCodec.c | 3 +- FFissionCodec/FFissionCodec.cpp | 22 +- FFissionCodec/FFissionCodec.h | 13 +- FFissionCodec/FFissionDecoder.cpp | 51 +- FFissionCodec/FFissionDecoder.h | 8 +- FFmpegUtils.c | 5 +- FFmpegUtils.h | 2 +- FFusionCodec.c | 2 +- FrameBuffer.c | 5 +- MatroskaImportPrivate.cpp | 2 +- Perian.xcodeproj/project.pbxproj | 195 +++--- .../contents.xcworkspacedata | 7 + .../xcshareddata/WorkspaceSettings.xcsettings | 8 + .../Debug in QuickTime Player.xcscheme | 5 +- Subtitles/SubImport.mm | 10 +- Subtitles/SubUtilities.m | 2 +- VobSubCodec.c | 13 +- bitstream_info.c | 26 +- codecID.c.m4 | 5 +- ff_MovieImport.c | 3 +- ff_dataref.c | 3 +- ff_private.c | 15 +- ff_private.h | 2 +- 47 files changed, 411 insertions(+), 3761 deletions(-) delete mode 100644 ACPublic/ACBaseCodec.cpp delete mode 100644 ACPublic/ACBaseCodec.h delete mode 100644 ACPublic/ACCodec.cpp delete mode 100644 ACPublic/ACCodec.h delete mode 100644 ACPublic/ACCodecDispatch.h delete mode 100644 ACPublic/ACCodecDispatchTypes.h create mode 100644 ACPublic/ACCompatibility.h delete mode 100644 ACPublic/ACConditionalMacros.h delete mode 100644 ACPublic/ACSimpleCodec.cpp delete mode 100644 ACPublic/ACSimpleCodec.h delete mode 100644 ACPublic/GetCodecBundle.h delete mode 100644 CAPublicUtility/CABundleLocker.cpp delete mode 100644 CAPublicUtility/CABundleLocker.h delete mode 100644 CAPublicUtility/CAConditionalMacros.h delete mode 100644 CAPublicUtility/CADebugMacros.cpp delete mode 100644 CAPublicUtility/CADebugMacros.h delete mode 100644 CAPublicUtility/CADebugPrintf.h delete mode 100644 CAPublicUtility/CAStreamBasicDescription.cpp delete mode 100644 CAPublicUtility/CAStreamBasicDescription.h create mode 100644 Perian.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Perian.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/ACPublic/ACBaseCodec.cpp b/ACPublic/ACBaseCodec.cpp deleted file mode 100644 index 667bebd..0000000 --- a/ACPublic/ACBaseCodec.cpp +++ /dev/null @@ -1,627 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - ACBaseCodec.cpp - -=============================================================================*/ - -//============================================================================= -// Includes -//============================================================================= - -#include "ACBaseCodec.h" -#include -#include "CABundleLocker.h" - -#if TARGET_OS_WIN32 - #include "CAWin32StringResources.h" -#endif - -//============================================================================= -// ACBaseCodec -//============================================================================= - -ACBaseCodec::ACBaseCodec() -: - ACCodec(), - mIsInitialized(false), - mInputFormatList(), - mInputFormat(), - mOutputFormatList(), - mOutputFormat() -{ -} - -ACBaseCodec::~ACBaseCodec() -{ -} - -void ACBaseCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable) -{ - switch(inPropertyID) - { - case kAudioCodecPropertyNameCFString: - outPropertyDataSize = sizeof(CFStringRef); - outWritable = false; - break; - case kAudioCodecPropertyManufacturerCFString: - outPropertyDataSize = sizeof(CFStringRef); - outWritable = false; - break; - case kAudioCodecPropertyFormatCFString: - outPropertyDataSize = sizeof(CFStringRef); - outWritable = false; - break; - case kAudioCodecPropertyRequiresPacketDescription: - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; - case kAudioCodecPropertyMinimumNumberInputPackets : - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; - case kAudioCodecPropertyMinimumNumberOutputPackets : - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; - case kAudioCodecPropertyInputChannelLayout : - case kAudioCodecPropertyOutputChannelLayout : - // by default a codec doesn't support channel layouts. - CODEC_THROW(kAudioCodecIllegalOperationError); - break; - case kAudioCodecPropertyAvailableInputChannelLayouts : - case kAudioCodecPropertyAvailableOutputChannelLayouts : - // by default a codec doesn't support channel layouts. - CODEC_THROW(kAudioCodecIllegalOperationError); - break; - - case kAudioCodecPropertyCurrentInputFormat: - outPropertyDataSize = sizeof(AudioStreamBasicDescription); - outWritable = true; - break; - - case kAudioCodecPropertySupportedInputFormats: - case kAudioCodecInputFormatsForOutputFormat: - outPropertyDataSize = GetNumberSupportedInputFormats() * sizeof(AudioStreamBasicDescription); - outWritable = false; - break; - - case kAudioCodecPropertyCurrentOutputFormat: - outPropertyDataSize = sizeof(AudioStreamBasicDescription); - outWritable = true; - break; - - case kAudioCodecPropertySupportedOutputFormats: - case kAudioCodecOutputFormatsForInputFormat: - outPropertyDataSize = GetNumberSupportedOutputFormats() * sizeof(AudioStreamBasicDescription); - outWritable = false; - break; - - case kAudioCodecPropertyMagicCookie: - outPropertyDataSize = GetMagicCookieByteSize(); - outWritable = true; - break; - - case kAudioCodecPropertyInputBufferSize: - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; - - case kAudioCodecPropertyUsedInputBufferSize: - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; - - case kAudioCodecPropertyIsInitialized: - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; - - case kAudioCodecPropertyAvailableNumberChannels: - outPropertyDataSize = sizeof(UInt32) * 2; // Mono, stereo - outWritable = false; - break; - - case kAudioCodecPropertyPrimeMethod: - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; - - case kAudioCodecPropertyPrimeInfo: - outPropertyDataSize = sizeof(AudioCodecPrimeInfo); - outWritable = false; - break; - - case kAudioCodecUseRecommendedSampleRate: - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; - - case kAudioCodecOutputPrecedence: - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; - - case kAudioCodecDoesSampleRateConversion: - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; -#ifdef kAudioCodecRequiresMagicCookie - case kAudioCodecRequiresMagicCookie: - outPropertyDataSize = sizeof(UInt32); - outWritable = false; - break; -#endif - - default: - CODEC_THROW(kAudioCodecUnknownPropertyError); - break; - - }; -} - -void ACBaseCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData) -{ - UInt32 thePacketsToGet; - - switch(inPropertyID) - { - case kAudioCodecPropertyNameCFString: - { - if (ioPropertyDataSize != sizeof(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError); - - CABundleLocker lock; - CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("unknown codec"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR("")); - *(CFStringRef*)outPropertyData = name; - break; - } - case kAudioCodecPropertyManufacturerCFString: - { - if (ioPropertyDataSize != sizeof(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError); - - CABundleLocker lock; - CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Apple Computer, Inc."), CFSTR("CodecNames"), GetCodecBundle(), CFSTR("")); - *(CFStringRef*)outPropertyData = name; - break; - } - case kAudioCodecPropertyRequiresPacketDescription: - if(ioPropertyDataSize == sizeof(UInt32)) - { - *reinterpret_cast(outPropertyData) = 0; - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - case kAudioCodecPropertyMinimumNumberInputPackets : - if(ioPropertyDataSize != sizeof(UInt32)) CODEC_THROW(kAudioCodecBadPropertySizeError); - *(UInt32*)outPropertyData = 1; - break; - case kAudioCodecPropertyMinimumNumberOutputPackets : - if(ioPropertyDataSize != sizeof(UInt32)) CODEC_THROW(kAudioCodecBadPropertySizeError); - *(UInt32*)outPropertyData = 1; - break; - - case kAudioCodecPropertyInputChannelLayout : - case kAudioCodecPropertyOutputChannelLayout : - // by default a codec doesn't support channel layouts. - CODEC_THROW(kAudioCodecIllegalOperationError); - break; - case kAudioCodecPropertyAvailableInputChannelLayouts : - case kAudioCodecPropertyAvailableOutputChannelLayouts : - // by default a codec doesn't support channel layouts. - CODEC_THROW(kAudioCodecIllegalOperationError); - break; - - case kAudioCodecPropertyCurrentInputFormat: - if(ioPropertyDataSize == sizeof(AudioStreamBasicDescription)) - { - GetCurrentInputFormat(*reinterpret_cast(outPropertyData)); - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertySupportedInputFormats: - case kAudioCodecInputFormatsForOutputFormat: - thePacketsToGet = ioPropertyDataSize / sizeof(AudioStreamBasicDescription); - GetSupportedInputFormats(reinterpret_cast(outPropertyData), thePacketsToGet); - ioPropertyDataSize = thePacketsToGet * sizeof(AudioStreamBasicDescription); - break; - - case kAudioCodecPropertyCurrentOutputFormat: - if(ioPropertyDataSize == sizeof(AudioStreamBasicDescription)) - { - GetCurrentOutputFormat(*reinterpret_cast(outPropertyData)); - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertySupportedOutputFormats: - case kAudioCodecOutputFormatsForInputFormat: - thePacketsToGet = ioPropertyDataSize / sizeof(AudioStreamBasicDescription); - GetSupportedOutputFormats(reinterpret_cast(outPropertyData), thePacketsToGet); - ioPropertyDataSize = thePacketsToGet * sizeof(AudioStreamBasicDescription); - break; - - case kAudioCodecPropertyMagicCookie: - if(ioPropertyDataSize >= GetMagicCookieByteSize()) - { - GetMagicCookie(outPropertyData, ioPropertyDataSize); - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertyInputBufferSize: - if(ioPropertyDataSize == sizeof(UInt32)) - { - *reinterpret_cast(outPropertyData) = GetInputBufferByteSize(); - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertyUsedInputBufferSize: - if(ioPropertyDataSize == sizeof(UInt32)) - { - *reinterpret_cast(outPropertyData) = GetUsedInputBufferByteSize(); - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertyIsInitialized: - if(ioPropertyDataSize == sizeof(UInt32)) - { - *reinterpret_cast(outPropertyData) = IsInitialized() ? 1 : 0; - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertyAvailableNumberChannels: - if(ioPropertyDataSize == sizeof(UInt32) * 2) - { - (reinterpret_cast(outPropertyData))[0] = 1; - (reinterpret_cast(outPropertyData))[1] = 2; - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertyPrimeMethod: - if(ioPropertyDataSize == sizeof(UInt32)) - { - *reinterpret_cast(outPropertyData) = (UInt32)kAudioCodecPrimeMethod_None; - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertyPrimeInfo: - if(ioPropertyDataSize == sizeof(AudioCodecPrimeInfo) ) - { - (reinterpret_cast(outPropertyData))->leadingFrames = 0; - (reinterpret_cast(outPropertyData))->trailingFrames = 0; - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecUseRecommendedSampleRate: - if(ioPropertyDataSize == sizeof(UInt32)) - { - *reinterpret_cast(outPropertyData) = 0; - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecOutputPrecedence: - if(ioPropertyDataSize == sizeof(UInt32)) - { - *reinterpret_cast(outPropertyData) = kAudioCodecOutputPrecedenceNone; - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecDoesSampleRateConversion: - if(ioPropertyDataSize == sizeof(UInt32)) - { - *reinterpret_cast(outPropertyData) = 0; - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - -#ifdef kAudioCodecRequiresMagicCookie - case kAudioCodecRequiresMagicCookie: - if(ioPropertyDataSize == sizeof(UInt32)) - { - *reinterpret_cast(outPropertyData) = 0; - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; -#endif - default: - CODEC_THROW(kAudioCodecUnknownPropertyError); - break; - - }; -} - -void ACBaseCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData) -{ - switch(inPropertyID) - { - case kAudioCodecPropertyMinimumNumberInputPackets : - CODEC_THROW(kAudioCodecIllegalOperationError); - break; - case kAudioCodecPropertyMinimumNumberOutputPackets : - CODEC_THROW(kAudioCodecIllegalOperationError); - break; - - case kAudioCodecPropertyInputChannelLayout : - case kAudioCodecPropertyOutputChannelLayout : - // by default a codec doesn't support channel layouts. - CODEC_THROW(kAudioCodecIllegalOperationError); - break; - - case kAudioCodecPropertyAvailableInputChannelLayouts : - case kAudioCodecPropertyAvailableOutputChannelLayouts : - // by default a codec doesn't support channel layouts. - CODEC_THROW(kAudioCodecIllegalOperationError); - break; - - case kAudioCodecPropertyCurrentInputFormat: - if(inPropertyDataSize == sizeof(AudioStreamBasicDescription)) - { - SetCurrentInputFormat(*reinterpret_cast(inPropertyData)); - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertyCurrentOutputFormat: - if(inPropertyDataSize == sizeof(AudioStreamBasicDescription)) - { - SetCurrentOutputFormat(*reinterpret_cast(inPropertyData)); - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - - case kAudioCodecPropertyMagicCookie: - SetMagicCookie(inPropertyData, inPropertyDataSize); - break; - - case kAudioCodecPropertyHasVariablePacketByteSizes: - case kAudioCodecPropertyInputBufferSize: - case kAudioCodecPropertyNameCFString: - case kAudioCodecPropertyManufacturerCFString: - case kAudioCodecPropertyFormatCFString: - case kAudioCodecPropertySupportedInputFormats: - case kAudioCodecPropertySupportedOutputFormats: - case kAudioCodecPropertyUsedInputBufferSize: - case kAudioCodecPropertyIsInitialized: - case kAudioCodecPropertyAvailableNumberChannels: - case kAudioCodecPropertyPrimeMethod: - case kAudioCodecPropertyPrimeInfo: - case kAudioCodecOutputFormatsForInputFormat: - case kAudioCodecInputFormatsForOutputFormat: - case kAudioCodecUseRecommendedSampleRate: - case kAudioCodecOutputPrecedence: - case kAudioCodecDoesSampleRateConversion: -#ifdef kAudioCodecRequiresMagicCookie - case kAudioCodecRequiresMagicCookie: -#endif - case kAudioCodecPropertyRequiresPacketDescription: - CODEC_THROW(kAudioCodecIllegalOperationError); - break; - - default: - CODEC_THROW(kAudioCodecUnknownPropertyError); - break; - - }; -} - -void ACBaseCodec::Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize) -{ - mIsInitialized = true; -} - -void ACBaseCodec::Uninitialize() -{ - mIsInitialized = false; -} - -void ACBaseCodec::Reset() -{ -} - -UInt32 ACBaseCodec::GetNumberSupportedInputFormats() const -{ - return mInputFormatList.size(); -} - -void ACBaseCodec::GetSupportedInputFormats(AudioStreamBasicDescription* outInputFormats, UInt32& ioNumberInputFormats) const -{ - UInt32 theNumberFormats = 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); - } -} - -void ACBaseCodec::GetCurrentInputFormat(AudioStreamBasicDescription& outInputFormat) -{ - outInputFormat = mInputFormat; -} - -void ACBaseCodec::SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat) -{ - if(!mIsInitialized) - { - mInputFormat = inInputFormat; - } - else - { - CODEC_THROW(kAudioCodecStateError); - } -} - -UInt32 ACBaseCodec::GetNumberSupportedOutputFormats() const -{ - return mOutputFormatList.size(); -} - -void ACBaseCodec::GetSupportedOutputFormats(AudioStreamBasicDescription* outOutputFormats, UInt32& ioNumberOutputFormats) const -{ - UInt32 theNumberFormats = 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); - } -} - -void ACBaseCodec::GetCurrentOutputFormat(AudioStreamBasicDescription& outOutputFormat) -{ - outOutputFormat = mOutputFormat; -} - -void ACBaseCodec::SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat) -{ - if(!mIsInitialized) - { - mOutputFormat = inOutputFormat; - } - else - { - CODEC_THROW(kAudioCodecStateError); - } -} - -UInt32 ACBaseCodec::GetMagicCookieByteSize() const -{ - return 0; -} - -void ACBaseCodec::GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const -{ - ioMagicCookieDataByteSize = 0; -} - -void ACBaseCodec::SetMagicCookie(const void* outMagicCookieData, UInt32 inMagicCookieDataByteSize) -{ - if(mIsInitialized) - { - CODEC_THROW(kAudioCodecStateError); - } -} - -void ACBaseCodec::AddInputFormat(const AudioStreamBasicDescription& inInputFormat) -{ - FormatList::iterator theIterator = std::find(mInputFormatList.begin(), mInputFormatList.end(), inInputFormat); - if(theIterator == mInputFormatList.end()) - { - theIterator = std::lower_bound(mInputFormatList.begin(), mInputFormatList.end(), inInputFormat); - mInputFormatList.insert(theIterator, inInputFormat); - } -} - -void ACBaseCodec::AddOutputFormat(const AudioStreamBasicDescription& inOutputFormat) -{ - FormatList::iterator theIterator = std::find(mOutputFormatList.begin(), mOutputFormatList.end(), inOutputFormat); - if(theIterator == mOutputFormatList.end()) - { - theIterator = std::lower_bound(mOutputFormatList.begin(), mOutputFormatList.end(), inOutputFormat); - mOutputFormatList.insert(theIterator, inOutputFormat); - } -} diff --git a/ACPublic/ACBaseCodec.h b/ACPublic/ACBaseCodec.h deleted file mode 100644 index 30764bc..0000000 --- a/ACPublic/ACBaseCodec.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - ACBaseCodec.h - -=============================================================================*/ -#if !defined(__ACBaseCodec_h__) -#define __ACBaseCodec_h__ - -//============================================================================= -// Includes -//============================================================================= - -#include "ACCodec.h" -#include "CAStreamBasicDescription.h" -#include -#include "GetCodecBundle.h" - -//============================================================================= -// ACBaseCodec -// -// An abstract subclass of ACCodec that implements all the nuts and bolts -// of the ACCodec interface, except for buffer handling. This class does -// the proper dispatching of property requests and manages the list of -// input and output formats. -//============================================================================= - -class ACBaseCodec -: - public ACCodec -{ - -// Construction/Destruction -public: - ACBaseCodec(); - virtual ~ACBaseCodec(); - -// Property Management -public: - virtual void GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable); - virtual void GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData); - virtual void SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData); - -// Data Handling -public: - bool IsInitialized() const { return mIsInitialized; } - virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize); - virtual void Uninitialize(); - virtual void Reset(); - virtual UInt32 GetInputBufferByteSize() const = 0; - virtual UInt32 GetUsedInputBufferByteSize() const = 0; - -protected: - virtual void ReallocateInputBuffer(UInt32 inInputBufferByteSize) = 0; - - bool mIsInitialized; - -// Format Management -public: - UInt32 GetNumberSupportedInputFormats() const; - void GetSupportedInputFormats(AudioStreamBasicDescription* outInputFormats, UInt32& ioNumberInputFormats) const; - - 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); - -protected: - void AddInputFormat(const AudioStreamBasicDescription& inInputFormat); - void AddOutputFormat(const AudioStreamBasicDescription& inOutputFormat); - - typedef std::vector FormatList; - - FormatList mInputFormatList; - CAStreamBasicDescription mInputFormat; - - FormatList mOutputFormatList; - CAStreamBasicDescription mOutputFormat; - -}; - -#endif diff --git a/ACPublic/ACCodec.cpp b/ACPublic/ACCodec.cpp deleted file mode 100644 index ce0e062..0000000 --- a/ACPublic/ACCodec.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - ACCodec.cpp - -=============================================================================*/ - -//============================================================================= -// Includes -//============================================================================= - -#include "ACCodec.h" - -//============================================================================= -// ACCodec -//============================================================================= - -ACCodec::ACCodec() -{ -} - -ACCodec::~ACCodec() -{ -} - -bool ACCodec::Register() const -{ - return true; -} - -UInt32 ACCodec::GetVersion() const -{ - return 0x00FFFFFF; -} diff --git a/ACPublic/ACCodec.h b/ACPublic/ACCodec.h deleted file mode 100644 index 6b9667c..0000000 --- a/ACPublic/ACCodec.h +++ /dev/null @@ -1,97 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - ACCodec.h - -=============================================================================*/ -#if !defined(__ACCodec_h__) -#define __ACCodec_h__ - -//============================================================================= -// Includes -//============================================================================= - -#include "CAConditionalMacros.h" - -#if CoreAudio_Use_Framework_Includes - #include -#else - #include "AudioCodec.h" -#endif - -//============================================================================= -// ACCodec -// -// A totally abstract base class for implementing components that conform to -// the AudioCodec API. -//============================================================================= - -class ACCodec -{ - -// Construction/Destruction -public: - ACCodec(); - virtual ~ACCodec(); - -// Property Management -public: - virtual void GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outSize, bool& outWritable) = 0; - virtual void GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData) = 0; - virtual void SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData) = 0; - -// Data Handling -public: - virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize) = 0; - virtual void Uninitialize() = 0; - virtual void AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription) = 0; - virtual UInt32 ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets, AudioStreamPacketDescription* outPacketDescription) = 0; - virtual void Reset() = 0; - -// Component Support -public: - virtual bool Register() const; - virtual UInt32 GetVersion() const; - -}; - -// when throwing static_cast to ComponentResult so the catch will grab the error code correctly -#define CODEC_THROW(err) \ - throw static_cast(err) - -#endif diff --git a/ACPublic/ACCodecDispatch.h b/ACPublic/ACCodecDispatch.h deleted file mode 100644 index 4be7eaf..0000000 --- a/ACPublic/ACCodecDispatch.h +++ /dev/null @@ -1,267 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - ACCodecDispatch.h - -=============================================================================*/ -#if !defined(__ACCodecDispatch_h__) -#define __ACCodecDispatch_h__ - -//============================================================================= -// Includes -//============================================================================= - -#include "ACCodec.h" -#include "ACCodecDispatchTypes.h" - -//============================================================================= -// ACCodecDispatch -// -// A function template that implements a component dispatch routine for an -// AudioCodec in terms of an instance of a subclass of ACCodec. -// It is best used when called from the primary codec dispatcher like so: -// -// extern "C" -// ComponentResult FooCodecDispatch(ComponentParameters* inParameters, FooCodec* inThis) -// { -// return ACCodecDispatch(inParameters, inThis); -// } -// -// The reason this exists is to better encapuslate all the necessary code -// to do the dispatching without having to figure out what the C++ mangled -// name for the entry point to put in the exported symbols file. -//============================================================================= - -template -ComponentResult ACCodecDispatch(ComponentParameters* inParameters, CodecClass* inThis) -{ - ComponentResult theError = kAudioCodecNoError; - - try - { - switch (inParameters->what) - { - // these selectors don't use the object pointer - - case kComponentOpenSelect: - { - CodecClass* theCodec = new CodecClass(); - SetComponentInstanceStorage(((AudioCodecOpenGluePB*)inParameters)->inCodec, (Handle)theCodec); - } - break; - - case kComponentCloseSelect: - delete inThis; - break; - - case kComponentCanDoSelect: - switch (*((SInt16*)&inParameters->params[1])) - { - case kComponentOpenSelect: - case kComponentCloseSelect: - case kComponentCanDoSelect: - case kComponentRegisterSelect: - case kComponentVersionSelect: - case kAudioCodecGetPropertyInfoSelect: - case kAudioCodecGetPropertySelect: - case kAudioCodecSetPropertySelect: - case kAudioCodecInitializeSelect: - case kAudioCodecAppendInputDataSelect: - case kAudioCodecProduceOutputDataSelect: - case kAudioCodecResetSelect: - theError = 1; - break; - }; - break; - - default: - // these selectors use the object pointer - if(inThis != NULL) - { - switch (inParameters->what) - { - case kComponentRegisterSelect: - if(!inThis->Register()) - { - theError = componentDontRegister; - } - break; - - case kComponentVersionSelect: - theError = inThis->GetVersion(); - break; - - case kAudioCodecGetPropertyInfoSelect: - { - AudioCodecGetPropertyInfoGluePB* thePB = (AudioCodecGetPropertyInfoGluePB*)inParameters; - UInt32 theSize = 0; - bool isWritable = false; - - inThis->GetPropertyInfo(thePB->inPropertyID, theSize, isWritable); - if(thePB->outSize != NULL) - { - *(thePB->outSize) = theSize; - } - if(thePB->outWritable != NULL) - { - *(thePB->outWritable) = isWritable ? 1 : 0; - } - } - break; - - case kAudioCodecGetPropertySelect: - { - AudioCodecGetPropertyGluePB* thePB = (AudioCodecGetPropertyGluePB*)inParameters; - - if((thePB->ioPropertyDataSize != NULL) && (thePB->outPropertyData != NULL)) - { - inThis->GetProperty(thePB->inPropertyID, *(thePB->ioPropertyDataSize), thePB->outPropertyData); - } - else - { - theError = paramErr; - } - } - break; - - case kAudioCodecSetPropertySelect: - { - AudioCodecSetPropertyGluePB* thePB = (AudioCodecSetPropertyGluePB*)inParameters; - - if(thePB->inPropertyData != NULL) - { - inThis->SetProperty(thePB->inPropertyID, thePB->inPropertyDataSize, thePB->inPropertyData); - } - else - { - theError = paramErr; - } - } - break; - - case kAudioCodecInitializeSelect: - { - AudioCodecInitializeGluePB* thePB = (AudioCodecInitializeGluePB*)inParameters; - - inThis->Initialize(thePB->inInputFormat, thePB->inOutputFormat, thePB->inMagicCookie, thePB->inMagicCookieByteSize); - } - break; - - case kAudioCodecUninitializeSelect: - { - //AudioCodecUninitializeGluePB* thePB = (AudioCodecUninitializeGluePB*)inParameters; - - inThis->Uninitialize(); - } - break; - - case kAudioCodecAppendInputDataSelect: - { - AudioCodecAppendInputDataGluePB* thePB = (AudioCodecAppendInputDataGluePB*)inParameters; - - if((thePB->inInputData != NULL) && (thePB->ioInputDataByteSize != NULL)) - { - if(thePB->ioNumberPackets != NULL) - { - inThis->AppendInputData(thePB->inInputData, *(thePB->ioInputDataByteSize), *(thePB->ioNumberPackets), thePB->inPacketDescription); - } - else - { - UInt32 theNumberPackets = 0; - inThis->AppendInputData(thePB->inInputData, *(thePB->ioInputDataByteSize), theNumberPackets, thePB->inPacketDescription); - } - } - else - { - theError = paramErr; - } - } - break; - - case kAudioCodecProduceOutputDataSelect: - { - AudioCodecProduceOutputPacketsGluePB* thePB = (AudioCodecProduceOutputPacketsGluePB*)inParameters; - - if((thePB->outOutputData != NULL) && (thePB->ioOutputDataByteSize != NULL) && (thePB->ioNumberPackets != NULL) && (thePB->outStatus != NULL)) - { - *(thePB->outStatus) = inThis->ProduceOutputPackets(thePB->outOutputData, *(thePB->ioOutputDataByteSize), *(thePB->ioNumberPackets), thePB->outPacketDescription); - if(kAudioCodecProduceOutputPacketFailure == *(thePB->outStatus)) - { - theError = paramErr; - } - } - else - { - theError = paramErr; - } - } - break; - - case kAudioCodecResetSelect: - { - //AudioCodecResetGluePB* thePB = (AudioCodecResetGluePB*)inParameters; - - inThis->Reset(); - } - break; - - default: - theError = badComponentSelector; - break; - }; - } - else - { - theError = paramErr; - } - break; - }; - } - catch(ComponentResult inErrorCode) - { - theError = inErrorCode; - } - catch(...) - { - theError = kAudioCodecUnspecifiedError; - } - - return theError; -} - -#endif diff --git a/ACPublic/ACCodecDispatchTypes.h b/ACPublic/ACCodecDispatchTypes.h deleted file mode 100644 index 24f5192..0000000 --- a/ACPublic/ACCodecDispatchTypes.h +++ /dev/null @@ -1,254 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - ACCodecDispatchTypes.h - -=============================================================================*/ -#if !defined(__ACCodecDispatchTypes_h__) -#define __ACCodecDispatchTypes_h__ - -//============================================================================= -// Includes -//============================================================================= - -// note that AudioCodec.h needs to be included prior to including this file -#if !defined(__AudioCodec_h__) - #error AudioCodec.h needs to be included prior to including this file -#endif - -//============================================================================= -// Parameter Blocks for AudioCodec Component Routines -// -// Note that the arguments for all the AudioCodec component routines are -// 4 bytes in size (assuming pointers are 4 bytes). This means that even on -// Windows (where all arguments are forced into SInt32s), we can get away with -// mass casting the argument list through the appropriate paramblock structure. -// This gets around the fact that the component glue passes the arguments in -// a different order depending on the platform and therefore makes writing the -// calling glue and the dispatcher much simpler. -//============================================================================= - -#if PRAGMA_STRUCT_ALIGN - #pragma options align=mac68k -#elif PRAGMA_STRUCT_PACKPUSH - #pragma pack(push, 2) -#elif PRAGMA_STRUCT_PACK - #pragma pack(2) -#endif - -#define AudioCodecStandardGluePBFields UInt8 componentFlags; UInt8 componentParamSize; SInt16 componentWhat - -#if !TARGET_OS_WIN32 -struct AudioCodecOpenGluePB { - AudioCodecStandardGluePBFields; - AudioCodec inCodec; - void* unused; -}; -#else -struct AudioCodecOpenGluePB { - AudioCodecStandardGluePBFields; - AudioCodec inCodec; -}; -#endif -typedef struct AudioCodecOpenGluePB AudioCodecOpenGluePB; - -#if !TARGET_OS_WIN32 -struct AudioCodecGetPropertyInfoGluePB -{ - AudioCodecStandardGluePBFields; - Boolean* outWritable; - UInt32* outSize; - AudioCodecPropertyID inPropertyID; - AudioCodec inCodec; -}; -#else -struct AudioCodecGetPropertyInfoGluePB -{ - AudioCodecStandardGluePBFields; - AudioCodecPropertyID inPropertyID; - UInt32* outSize; - Boolean* outWritable; -}; -#endif -typedef struct AudioCodecGetPropertyInfoGluePB AudioCodecGetPropertyInfoGluePB; - -#if !TARGET_OS_WIN32 -struct AudioCodecGetPropertyGluePB -{ - AudioCodecStandardGluePBFields; - void* outPropertyData; - UInt32* ioPropertyDataSize; - AudioCodecPropertyID inPropertyID; - AudioCodec inCodec; -}; -#else -struct AudioCodecGetPropertyGluePB -{ - AudioCodecStandardGluePBFields; - AudioCodecPropertyID inPropertyID; - UInt32* ioPropertyDataSize; - void* outPropertyData; -}; -#endif -typedef struct AudioCodecGetPropertyGluePB AudioCodecGetPropertyGluePB; - -#if !TARGET_OS_WIN32 -struct AudioCodecSetPropertyGluePB -{ - AudioCodecStandardGluePBFields; - const void* inPropertyData; - UInt32 inPropertyDataSize; - AudioCodecPropertyID inPropertyID; - AudioCodec inCodec; -}; -#else -struct AudioCodecSetPropertyGluePB -{ - AudioCodecStandardGluePBFields; - AudioCodecPropertyID inPropertyID; - UInt32 inPropertyDataSize; - const void* inPropertyData; -}; -#endif -typedef struct AudioCodecSetPropertyGluePB AudioCodecSetPropertyGluePB; - -#if !TARGET_OS_WIN32 -struct AudioCodecInitializeGluePB -{ - AudioCodecStandardGluePBFields; - UInt32 inMagicCookieByteSize; - const void* inMagicCookie; - const AudioStreamBasicDescription* inOutputFormat; - const AudioStreamBasicDescription* inInputFormat; - AudioCodec inCodec; -}; -#else -struct AudioCodecInitializeGluePB -{ - AudioCodecStandardGluePBFields; - const AudioStreamBasicDescription* inInputFormat; - const AudioStreamBasicDescription* inOutputFormat; - const void* inMagicCookie; - UInt32 inMagicCookieByteSize; -}; -#endif -typedef struct AudioCodecInitializeGluePB AudioCodecInitializeGluePB; - -#if !TARGET_OS_WIN32 -struct AudioCodecUninitializeGluePB -{ - AudioCodecStandardGluePBFields; - AudioCodec inCodec; -}; -#else -struct AudioCodecUninitializeGluePB -{ - AudioCodecStandardGluePBFields; -}; -#endif -typedef struct AudioCodecUninitializeGluePB AudioCodecUninitializeGluePB; - -#if !TARGET_OS_WIN32 -struct AudioCodecAppendInputDataGluePB -{ - AudioCodecStandardGluePBFields; - const AudioStreamPacketDescription* inPacketDescription; - UInt32* ioNumberPackets; - UInt32* ioInputDataByteSize; - const void* inInputData; - AudioCodec inCodec; -}; -#else -struct AudioCodecAppendInputDataGluePB -{ - AudioCodecStandardGluePBFields; - const void* inInputData; - UInt32* ioInputDataByteSize; - UInt32* ioNumberPackets; - const AudioStreamPacketDescription* inPacketDescription; -}; -#endif -typedef struct AudioCodecAppendInputDataGluePB AudioCodecAppendInputDataGluePB; - -#if !TARGET_OS_WIN32 -struct AudioCodecProduceOutputPacketsGluePB -{ - AudioCodecStandardGluePBFields; - UInt32* outStatus; - AudioStreamPacketDescription* outPacketDescription; - UInt32* ioNumberPackets; - UInt32* ioOutputDataByteSize; - void* outOutputData; - AudioCodec inCodec; -}; -#else -struct AudioCodecProduceOutputPacketsGluePB -{ - AudioCodecStandardGluePBFields; - void* outOutputData; - UInt32* ioOutputDataByteSize; - UInt32* ioNumberPackets; - AudioStreamPacketDescription* outPacketDescription; - UInt32* outStatus; -}; -#endif -typedef struct AudioCodecProduceOutputPacketsGluePB AudioCodecProduceOutputPacketsGluePB; - -#if !TARGET_OS_WIN32 -struct AudioCodecResetGluePB -{ - AudioCodecStandardGluePBFields; - AudioCodec inCodec; -}; -#else -struct AudioCodecResetGluePB -{ - AudioCodecStandardGluePBFields; -}; -#endif -typedef struct AudioCodecResetGluePB AudioCodecResetGluePB; - -#if PRAGMA_STRUCT_ALIGN - #pragma options align=reset -#elif PRAGMA_STRUCT_PACKPUSH - #pragma pack(pop) -#elif PRAGMA_STRUCT_PACK - #pragma pack() -#endif - -#endif diff --git a/ACPublic/ACCompatibility.h b/ACPublic/ACCompatibility.h new file mode 100644 index 0000000..285916d --- /dev/null +++ b/ACPublic/ACCompatibility.h @@ -0,0 +1,109 @@ +/* Copyright � 2007 Apple Inc. All Rights Reserved. + + 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 + "Apple Software"), to use, reproduce, modify and redistribute the Apple + Software, with or without modifications, in source and/or binary forms; + provided that if you redistribute the Apple Software in its entirety and + without modifications, you must retain this notice and the following + text and disclaimers in all such redistributions of the Apple Software. + Neither the name, trademarks, service marks or logos of Apple Inc. + may be used to endorse or promote products derived from the Apple + Software without specific prior written permission from Apple. Except + as expressly stated in this notice, no other rights or licenses, express + or 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 + INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, + MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED + 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. +*/ +#if !defined __ACCOMPATIBILITY_H__ +#define __ACCOMPATIBILITY_H__ + +#if TARGET_OS_MAC + +#include + +#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__) +#include +#include +#else +#include "CoreAudioTypes.h" +#include "AudioCodec.h" +#endif + +/* Redefine the following symbols only for Tiger */ +#if COREAUDIOTYPES_VERSION < 1050// && !defined(MAC_OS_X_VERSION_10_5) + +struct AudioFormatInfo +{ + AudioStreamBasicDescription mASBD; + const void* mMagicCookie; + UInt32 mMagicCookieSize; +}; +typedef struct AudioFormatInfo AudioFormatInfo; + +struct AudioFormatListItem +{ + AudioStreamBasicDescription mASBD; + AudioChannelLayoutTag mChannelLayoutTag; +}; +typedef struct AudioFormatListItem AudioFormatListItem; + +struct AudioCodecMagicCookieInfo +{ + UInt32 mMagicCookieSize; + const void* mMagicCookie; +}; +typedef struct AudioCodecMagicCookieInfo AudioCodecMagicCookieInfo; +typedef struct AudioCodecMagicCookieInfo MagicCookieInfo; + + +enum +{ + /* Renamed properties */ + kAudioCodecPropertyCurrentInputChannelLayout = kAudioCodecPropertyInputChannelLayout, + kAudioCodecPropertyCurrentOutputChannelLayout = kAudioCodecPropertyOutputChannelLayout, + kAudioCodecPropertyAvailableInputChannelLayoutTags = kAudioCodecPropertyAvailableInputChannelLayouts, + kAudioCodecPropertyAvailableOutputChannelLayoutTags = kAudioCodecPropertyAvailableOutputChannelLayouts, + kAudioCodecPropertyBitRateControlMode = kAudioCodecBitRateFormat, + kAudioCodecPropertyPaddedZeros = kAudioCodecPropertyZeroFramesPadded, + kAudioCodecPropertyInputFormatsForOutputFormat = kAudioCodecInputFormatsForOutputFormat, + kAudioCodecPropertyOutputFormatsForInputFormat = kAudioCodecOutputFormatsForInputFormat, + kAudioCodecPropertyDoesSampleRateConversion = kAudioCodecDoesSampleRateConversion +}; +#else +#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__) +#include +#else +#include "AudioFormat.h" +#endif + +#endif // #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 + +#else + #include "AudioFormat.h" +#endif // #if TARGET_OS_MAC + +#endif // #if !defined __ACCOMPATIBILITY_H__ diff --git a/ACPublic/ACConditionalMacros.h b/ACPublic/ACConditionalMacros.h deleted file mode 100644 index 913420c..0000000 --- a/ACPublic/ACConditionalMacros.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - ACConditionalMacros.h - -=============================================================================*/ -#if !defined(__ACConditionalMacros_h__) -#define __ACConditionalMacros_h__ - -//============================================================================= -// This file exists to make figuring out how to include system headers -// easier. We throw in an include of the standard ConditionalMacros too. -//============================================================================= - -// TargetConditionals.h defines the bare minimum we need -#include "TargetConditionals.h" - -// Determine whether or not to use framework style includes for system headers -#if !defined(AC_Use_Framework_Includes) - #if TARGET_OS_MAC && TARGET_RT_MAC_MACHO - #define AC_Use_Framework_Includes 1 - #else - #define AC_Use_Framework_Includes 0 - #endif -#endif - -#if AC_Use_Framework_Includes - #include -#else - #include "ConditionalMacros.h" -#endif - -#endif diff --git a/ACPublic/ACSimpleCodec.cpp b/ACPublic/ACSimpleCodec.cpp deleted file mode 100644 index 194f036..0000000 --- a/ACPublic/ACSimpleCodec.cpp +++ /dev/null @@ -1,353 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - ACSimpleCodec.cpp - -=============================================================================*/ - -//============================================================================= -// Includes -//============================================================================= - -#include "ACSimpleCodec.h" -#include - -//============================================================================= -// ACSimpleCodec -//============================================================================= - -static const UInt32 kBufferPad = 64; // this is used to prevent end from passing start. - -ACSimpleCodec::ACSimpleCodec(UInt32 inInputBufferByteSize) -: - ACBaseCodec(), - mInputBuffer(NULL), - mInputBufferByteSize(inInputBufferByteSize+kBufferPad), - mInputBufferStart(0), - mInputBufferEnd(0) -{ -} - -ACSimpleCodec::~ACSimpleCodec() -{ - delete[] mInputBuffer; -} - -void ACSimpleCodec::Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize) -{ - ReallocateInputBuffer(mInputBufferByteSize - kBufferPad); - - ACBaseCodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize); -} - -void ACSimpleCodec::Uninitialize() -{ - // get rid of the buffer - delete[] mInputBuffer; - mInputBuffer = NULL; - - // reset the ring buffer state - mInputBufferStart = 0; - mInputBufferEnd = 0; - - ACBaseCodec::Uninitialize(); -} - -void ACSimpleCodec::Reset() -{ - // clear the entire input buffer - if (mInputBuffer) { // could be called before allocated. - memset(mInputBuffer, 0, mInputBufferByteSize); - } - - // reset the ring buffer state - mInputBufferStart = 0; - mInputBufferEnd = 0; - - ACBaseCodec::Reset(); -} - -UInt32 ACSimpleCodec::GetInputBufferByteSize() const -{ - return mInputBufferByteSize - kBufferPad; // minus kBufferPad to prevent end moving past start -} - -UInt32 ACSimpleCodec::GetUsedInputBufferByteSize() const -{ - UInt32 theAnswer = 0; - - // this object uses a ring buffer - if(mInputBufferStart <= mInputBufferEnd) - { - // the active region is contiguous - theAnswer = mInputBufferEnd - mInputBufferStart; - } - else - { - // the active region wraps around - theAnswer = (mInputBufferByteSize - mInputBufferStart) + mInputBufferEnd; - } - - return theAnswer; -} - - -void ACSimpleCodec::AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription) -{ - // 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; - - UInt32 theMaxAvailableInputBytes = ioInputDataByteSize; // we can't consume more than we get - - const Byte* theInputData = static_cast(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: 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; - - // < 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; - } -} - - -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. - - 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. - // We cleverly over allocated our buffer space to make this possible. - memcpy(mInputBuffer + mInputBufferByteSize, mInputBuffer, leftOver); - } - - return GetInputBufferStart(); -} - - -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; -} - -void ACSimpleCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable) -{ - switch(inPropertyID) - { - case kAudioCodecPropertyInputBufferSize: - outPropertyDataSize = sizeof(UInt32); - outWritable = true; - break; - default: - ACBaseCodec::GetPropertyInfo(inPropertyID, outPropertyDataSize, outWritable); - break; - } - -} - -void ACSimpleCodec::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData) -{ - switch(inPropertyID) - { - case kAudioCodecPropertyInputBufferSize: - if(inPropertyDataSize == sizeof(UInt32)) - { - ReallocateInputBuffer(*reinterpret_cast(inPropertyData)); - } - else - { - CODEC_THROW(kAudioCodecBadPropertySizeError); - } - break; - default: - ACBaseCodec::SetProperty(inPropertyID, inPropertyDataSize, inPropertyData); - break; - } -} diff --git a/ACPublic/ACSimpleCodec.h b/ACPublic/ACSimpleCodec.h deleted file mode 100644 index b8a9ad5..0000000 --- a/ACPublic/ACSimpleCodec.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - ACSimpleCodec.h - -=============================================================================*/ -#if !defined(__ACSimpleCodec_h__) -#define __ACSimpleCodec_h__ - -//============================================================================= -// Includes -//============================================================================= - -#include "ACBaseCodec.h" - -//============================================================================= -// ACSimpleCodec -// -// This extension of ACBaseCodec provides for a simple ring buffer to handle -// input data. -//============================================================================= - -class ACSimpleCodec -: - public ACBaseCodec -{ - -// Construction/Destruction -public: - ACSimpleCodec(UInt32 inInputBufferByteSize); - virtual ~ACSimpleCodec(); - -// Data Handling -public: - virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize) = 0; - virtual void Uninitialize(); - virtual void Reset(); - - virtual void AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription); - virtual void ZeroPadInputData(UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription); - virtual UInt32 GetInputBufferByteSize() const; - virtual UInt32 GetUsedInputBufferByteSize() const; - virtual void GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable); - virtual void SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData); - -protected: - 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. - // 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: - Byte* mInputBuffer; - UInt32 mInputBufferByteSize; - UInt32 mInputBufferStart; - UInt32 mInputBufferEnd; - -}; - -#endif diff --git a/ACPublic/GetCodecBundle.cpp b/ACPublic/GetCodecBundle.cpp index 9172648..911bb97 100644 --- a/ACPublic/GetCodecBundle.cpp +++ b/ACPublic/GetCodecBundle.cpp @@ -1,69 +1,54 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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 � 2007 Apple Inc. All Rights Reserved. + + 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 + "Apple Software"), to use, reproduce, modify and redistribute the Apple + Software, with or without modifications, in source and/or binary forms; + provided that if you redistribute the Apple Software in its entirety and + without modifications, you must retain this notice and the following + text and disclaimers in all such redistributions of the Apple Software. + Neither the name, trademarks, service marks or logos of Apple Inc. + may be used to endorse or promote products derived from the Apple + Software without specific prior written permission from Apple. Except + as expressly stated in this notice, no other rights or licenses, express + or 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 + INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, + MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED + 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. */ -/*============================================================================= - GetCodecBundle.cpp - - - * Created by James McCartney on Thu Apr 10 2003. -=============================================================================*/ - #include "GetCodecBundle.h" +#include "CommonUtils.h" -#if TARGET_OS_WIN32 - #include "CAWin32StringResources.h" -#endif - -#ifdef _MSC_VER // QuickTime 6.4 and before is broken -#define kCodecBundleID "com.apple.audio.codecs.Components" -#else -const CFStringRef kCodecBundleID = CFSTR("com.apple.audio.codecs.Components"); -#endif +const CFStringRef kCodecBundleID = PERIAN_PREF_DOMAIN; // must match CFBundleIdentifier in plist file CFBundleRef GetCodecBundle() { static CFBundleRef sAudioCodecBundle = 0; if (!sAudioCodecBundle) { - #ifdef _MSC_VER // QuickTime 6.4 and before is broken - sAudioCodecBundle = CFBundleGetBundleWithIdentifier(CFSTR(kCodecBundleID)); - #else sAudioCodecBundle = CFBundleGetBundleWithIdentifier(kCodecBundleID); - #endif if (sAudioCodecBundle) { CFRetain(sAudioCodecBundle); diff --git a/ACPublic/GetCodecBundle.h b/ACPublic/GetCodecBundle.h deleted file mode 100644 index 8a9215f..0000000 --- a/ACPublic/GetCodecBundle.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - GetCodecBundle.h - - - * Created by James McCartney on Thu Apr 10 2003. -=============================================================================*/ - -#ifndef _GetCodecBundle_ -#define _GetCodecBundle_ - -#include - -#if TARGET_OS_MAC - -#include - -#else - -#include "CFBundle.h" - -#endif - -CFBundleRef GetCodecBundle(); - -#endif diff --git a/CAPublicUtility/CABundleLocker.cpp b/CAPublicUtility/CABundleLocker.cpp deleted file mode 100644 index bb666d3..0000000 --- a/CAPublicUtility/CABundleLocker.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/* - * CABundleLocker.cpp - * CAServices - * - * Created by James McCartney on Tue Dec 21 2004. - * Copyright (c) 2004 Apple Computer. All rights reserved. - * - */ - -#include "CABundleLocker.h" -#include - -/* -some bundle operations are not thread safe, notably CFCopyLocalizedStringFromTableInBundle -*/ - -static pthread_mutex_t sCABundleLocker = PTHREAD_MUTEX_INITIALIZER; - -#define RECURSIVE_LOCK 0 - -#if RECURSIVE_LOCK -static pthread_once_t sOnce = PTHREAD_ONCE_INIT; - -static void InitCABundleLocker() -{ - // have to do this because OS X lacks PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&sCABundleLocker, &attr); - pthread_mutexattr_destroy(&attr); -} -#endif - -CABundleLocker::CABundleLocker() -{ -#if RECURSIVE_LOCK - pthread_once(&sOnce, InitCABundleLocker); -#endif - pthread_mutex_lock(&sCABundleLocker); -} - -CABundleLocker::~CABundleLocker() -{ - pthread_mutex_unlock(&sCABundleLocker); -} - diff --git a/CAPublicUtility/CABundleLocker.h b/CAPublicUtility/CABundleLocker.h deleted file mode 100644 index c1b2a8d..0000000 --- a/CAPublicUtility/CABundleLocker.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/* - * CABundleLocker.h - * - * Created by James McCartney on Tue Dec 21 2004. - * Copyright (c) 2004 Apple Computer. All rights reserved. - * - */ - -#ifndef _CABundleLocker_h_ -#define _CABundleLocker_h_ - - -#include "CAConditionalMacros.h" - -/* -some bundle operations are not thread safe, notably CFCopyLocalizedStringFromTableInBundle -*/ - -class CABundleLocker -{ -public: - -#if TARGET_OS_MAC - CABundleLocker(); - ~CABundleLocker(); -#else - CABundleLocker() {} - ~CABundleLocker() {} -#endif -}; - -#endif diff --git a/CAPublicUtility/CAConditionalMacros.h b/CAPublicUtility/CAConditionalMacros.h deleted file mode 100644 index 62f6427..0000000 --- a/CAPublicUtility/CAConditionalMacros.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - CAConditionalMacros.h - -=============================================================================*/ -#if !defined(__CAConditionalMacros_h__) -#define __CAConditionalMacros_h__ - -//============================================================================= -// This file exists to make figuring out how to include system headers -// easier in a cross platform world. We throw in an include of the standard -// ConditionalMacros too. -//============================================================================= - -// ########## THIS FILE SHOULD GO AWAY SOON, replaced by __COREAUDIO_USE_FLAT_INCLUDES__ -// but for now, use this as a way to define __COREAUDIO_USE_FLAT_INCLUDES__ programmatically - -// TargetConditionals.h defines the bare minimum we need -#include "TargetConditionals.h" - -// Determine whether or not to use framework style includes for system headers -#if !defined(CoreAudio_Use_Framework_Includes) && !defined(__COREAUDIO_USE_FLAT_INCLUDES__) - #if TARGET_RT_MAC_MACHO - #define CoreAudio_Use_Framework_Includes 1 - #else - #define CoreAudio_Use_Framework_Includes 0 - #endif -#endif - -// Include the regular ConditionalMacros.h too, since it has useful stuff that -// TargetConditionals.h lacks for some reason. -#if CoreAudio_Use_Framework_Includes - #include -#else - #include "ConditionalMacros.h" -#endif - -#endif diff --git a/CAPublicUtility/CADebugMacros.cpp b/CAPublicUtility/CADebugMacros.cpp deleted file mode 100644 index edee1f3..0000000 --- a/CAPublicUtility/CADebugMacros.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - CADebugMacros.cp - -=============================================================================*/ - -#include "CADebugMacros.h" -#include -#include -#if TARGET_API_MAC_OSX - #include -#endif - -#if DEBUG -#include - -void DebugPrint(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - vprintf(fmt, args); - va_end(args); -} -#endif // DEBUG - -#if TARGET_API_MAC_OSX -void LogError(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); -#if DEBUG - vprintf(fmt, args); -#endif - vsyslog(LOG_ERR, fmt, args); - va_end(args); -} - -void LogWarning(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); -#if DEBUG - vprintf(fmt, args); -#endif - vsyslog(LOG_WARNING, fmt, args); - va_end(args); -} -#endif diff --git a/CAPublicUtility/CADebugMacros.h b/CAPublicUtility/CADebugMacros.h deleted file mode 100644 index 1abae40..0000000 --- a/CAPublicUtility/CADebugMacros.h +++ /dev/null @@ -1,414 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - CADebugMacros.h - -=============================================================================*/ -#if !defined(__CADebugMacros_h__) -#define __CADebugMacros_h__ - -//============================================================================= -// CADebugMacros -//============================================================================= - -//#define CoreAudio_StopOnFailure 1 -//#define CoreAudio_TimeStampMessages 1 -//#define CoreAudio_ThreadStampMessages 1 -//#define CoreAudio_FlushDebugMessages 1 - -#define CA4CCToCString(the4CC) { ((char*)&the4CC)[0], ((char*)&the4CC)[1], ((char*)&the4CC)[2], ((char*)&the4CC)[3], 0 } - -#pragma mark Basic Definitions - -#if DEBUG || CoreAudio_Debug - - // can be used to break into debugger immediately, also see CADebugger - #define BusError() (*(long *)0 = 0) - - // basic debugging print routines - #if TARGET_OS_MAC && !TARGET_API_MAC_CARBON - extern pascal void DebugStr(const unsigned char* debuggerMsg); - #define DebugMessage(msg) DebugStr("\p"msg) - #define DebugMessageN1(msg, N1) - #define DebugMessageN2(msg, N1, N2) - #define DebugMessageN3(msg, N1, N2, N3) - #else - #include "CADebugPrintf.h" - - #if (CoreAudio_FlushDebugMessages && !CoreAudio_UseSysLog) || defined(CoreAudio_UseSideFile) - #define FlushRtn ;fflush(DebugPrintfFile) - #else - #define FlushRtn - #endif - - #if CoreAudio_ThreadStampMessages - #include - #include "CAHostTimeBase.h" - #define DebugMessage(msg) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: %s"DebugPrintfLineEnding, pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), msg) FlushRtn - #define DebugMessageN1(msg, N1) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: "msg"\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1) FlushRtn - #define DebugMessageN2(msg, N1, N2) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: "msg"\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2) FlushRtn - #define DebugMessageN3(msg, N1, N2, N3) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: "msg"\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3) FlushRtn - #define DebugMessageN4(msg, N1, N2, N3, N4) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: "msg"\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4) FlushRtn - #define DebugMessageN5(msg, N1, N2, N3, N4, N5) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: "msg"\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5) FlushRtn - #define DebugMessageN6(msg, N1, N2, N3, N4, N5, N6) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: "msg"\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5, N6) FlushRtn - #define DebugMessageN7(msg, N1, N2, N3, N4, N5, N6, N7) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: "msg"\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5, N6, N7) FlushRtn - #define DebugMessageN8(msg, N1, N2, N3, N4, N5, N6, N7, N8) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: "msg"\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5, N6, N7, N8) FlushRtn - #define DebugMessageN9(msg, N1, N2, N3, N4, N5, N6, N7, N8, N9) DebugPrintfRtn(DebugPrintfFile, "%p %.4f: "msg"\n", pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5, N6, N7, N8, N9) FlushRtn - #elif CoreAudio_TimeStampMessages - #include "CAHostTimeBase.h" - #define DebugMessage(msg) DebugPrintfRtn(DebugPrintfFile, "%.4f: %s"DebugPrintfLineEnding, pthread_self(), ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), msg) FlushRtn - #define DebugMessageN1(msg, N1) DebugPrintfRtn(DebugPrintfFile, "%.4f: "msg DebugPrintfLineEnding, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1) FlushRtn - #define DebugMessageN2(msg, N1, N2) DebugPrintfRtn(DebugPrintfFile, "%.4f: "msg DebugPrintfLineEnding, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2) FlushRtn - #define DebugMessageN3(msg, N1, N2, N3) DebugPrintfRtn(DebugPrintfFile, "%.4f: "msg DebugPrintfLineEnding, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3) FlushRtn - #define DebugMessageN4(msg, N1, N2, N3, N4) DebugPrintfRtn(DebugPrintfFile, "%.4f: "msg DebugPrintfLineEnding, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4) FlushRtn - #define DebugMessageN5(msg, N1, N2, N3, N4, N5) DebugPrintfRtn(DebugPrintfFile, "%.4f: "msg DebugPrintfLineEnding, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5) FlushRtn - #define DebugMessageN6(msg, N1, N2, N3, N4, N5, N6) DebugPrintfRtn(DebugPrintfFile, "%.4f: "msg DebugPrintfLineEnding, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5, N6) FlushRtn - #define DebugMessageN7(msg, N1, N2, N3, N4, N5, N6, N7) DebugPrintfRtn(DebugPrintfFile, "%.4f: "msg DebugPrintfLineEnding, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5, N6, N7) FlushRtn - #define DebugMessageN8(msg, N1, N2, N3, N4, N5, N6, N7, N8) DebugPrintfRtn(DebugPrintfFile, "%.4f: "msg DebugPrintfLineEnding, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5, N6, N7, N8) FlushRtn - #define DebugMessageN9(msg, N1, N2, N3, N4, N5, N6, N7, N8, N9) DebugPrintfRtn(DebugPrintfFile, "%.4f: "msg DebugPrintfLineEnding, ((Float64)(CAHostTimeBase::GetCurrentTimeInNanos()) / 1000000.0), N1, N2, N3, N4, N5, N6, N7, N8, N9) FlushRtn - #else - #define DebugMessage(msg) DebugPrintfRtn(DebugPrintfFile, "%s"DebugPrintfLineEnding, msg) FlushRtn - #define DebugMessageN1(msg, N1) DebugPrintfRtn(DebugPrintfFile, msg DebugPrintfLineEnding, N1) FlushRtn - #define DebugMessageN2(msg, N1, N2) DebugPrintfRtn(DebugPrintfFile, msg DebugPrintfLineEnding, N1, N2) FlushRtn - #define DebugMessageN3(msg, N1, N2, N3) DebugPrintfRtn(DebugPrintfFile, msg DebugPrintfLineEnding, N1, N2, N3) FlushRtn - #define DebugMessageN4(msg, N1, N2, N3, N4) DebugPrintfRtn(DebugPrintfFile, msg DebugPrintfLineEnding, N1, N2, N3, N4) FlushRtn - #define DebugMessageN5(msg, N1, N2, N3, N4, N5) DebugPrintfRtn(DebugPrintfFile, msg DebugPrintfLineEnding, N1, N2, N3, N4, N5) FlushRtn - #define DebugMessageN6(msg, N1, N2, N3, N4, N5, N6) DebugPrintfRtn(DebugPrintfFile, msg DebugPrintfLineEnding, N1, N2, N3, N4, N5, N6) FlushRtn - #define DebugMessageN7(msg, N1, N2, N3, N4, N5, N6, N7) DebugPrintfRtn(DebugPrintfFile, msg DebugPrintfLineEnding, N1, N2, N3, N4, N5, N6, N7) FlushRtn - #define DebugMessageN8(msg, N1, N2, N3, N4, N5, N6, N7, N8) DebugPrintfRtn(DebugPrintfFile, msg DebugPrintfLineEnding, N1, N2, N3, N4, N5, N6, N7, N8) FlushRtn - #define DebugMessageN9(msg, N1, N2, N3, N4, N5, N6, N7, N8, N9) DebugPrintfRtn(DebugPrintfFile, msg DebugPrintfLineEnding, N1, N2, N3, N4, N5, N6, N7, N8, N9) FlushRtn - #endif - #endif - void DebugPrint(const char *fmt, ...); // can be used like printf - #define DEBUGPRINT(msg) DebugPrint msg // have to double-parenthesize arglist (see Debugging.h) - #if VERBOSE - #define vprint(msg) DEBUGPRINT(msg) - #else - #define vprint(msg) - #endif - - #if CoreAudio_StopOnFailure - #include "CADebugger.h" - #define STOP CADebuggerStop() - #else - #define STOP - #endif - -#else - #define DebugMessage(msg) - #define DebugMessageN1(msg, N1) - #define DebugMessageN2(msg, N1, N2) - #define DebugMessageN3(msg, N1, N2, N3) - #define DebugMessageN4(msg, N1, N2, N3, N4) - #define DebugMessageN5(msg, N1, N2, N3, N4, N5) - #define DebugMessageN6(msg, N1, N2, N3, N4, N5, N6) - #define DebugMessageN7(msg, N1, N2, N3, N4, N5, N6, N7) - #define DebugMessageN8(msg, N1, N2, N3, N4, N5, N6, N7, N8) - #define DebugMessageN9(msg, N1, N2, N3, N4, N5, N6, N7, N8, N9) - #define DEBUGPRINT(msg) - #define vprint(msg) - #define STOP -#endif - -void LogError(const char *fmt, ...); // writes to syslog (and stderr if debugging) -void LogWarning(const char *fmt, ...); // writes to syslog (and stderr if debugging) - -#if DEBUG || CoreAudio_Debug - -#pragma mark Debug Macros - -#define Assert(inCondition, inMessage) \ - if(!(inCondition)) \ - { \ - DebugMessage(inMessage); \ - STOP; \ - } - -#define AssertNoError(inError, inMessage) \ - { \ - SInt32 __Err = (inError); \ - if(__Err != 0) \ - { \ - char __4CC[5] = CA4CCToCString(__Err); \ - DebugMessageN2(inMessage ", Error: %ld (%s)", __Err, __4CC); \ - STOP; \ - } \ - } - -#define AssertNoKernelError(inError, inMessage) \ - { \ - unsigned int __Err = (unsigned int)(inError); \ - if(__Err != 0) \ - { \ - DebugMessageN1(inMessage ", Error: 0x%X", __Err); \ - STOP; \ - } \ - } - -#define FailIf(inCondition, inHandler, inMessage) \ - if(inCondition) \ - { \ - DebugMessage(inMessage); \ - STOP; \ - goto inHandler; \ - } - -#define FailWithAction(inCondition, inAction, inHandler, inMessage) \ - if(inCondition) \ - { \ - DebugMessage(inMessage); \ - STOP; \ - { inAction; } \ - goto inHandler; \ - } - -#define FailIfNULL(inPointer, inAction, inHandler, inMessage) \ - if((inPointer) == NULL) \ - { \ - DebugMessage(inMessage); \ - STOP; \ - { inAction; } \ - goto inHandler; \ - } - -#define FailIfKernelError(inKernelError, inException, inMessage) \ - { \ - kern_return_t __Err = (inKernelError); \ - if(__Err != 0) \ - { \ - DebugMessageN1(inMessage ", Error: 0x%X", __Err); \ - STOP; \ - { inAction; } \ - goto inHandler; \ - } \ - } - -#define FailIfError(inError, inException, inMessage) \ - { \ - SInt32 __Err = (inError); \ - if(__Err != 0) \ - { \ - char __4CC[5] = CA4CCToCString(__Err); \ - DebugMessageN2(inMessage ", Error: %ld (%s)", __Err, __4CC); \ - STOP; \ - { inAction; } \ - goto inHandler; \ - } \ - } - -#if defined(__cplusplus) - -#define Throw(inException) STOP; throw (inException) - -#define ThrowIf(inCondition, inException, inMessage) \ - if(inCondition) \ - { \ - DebugMessage(inMessage); \ - Throw(inException); \ - } - -#define ThrowIfNULL(inPointer, inException, inMessage) \ - if((inPointer) == NULL) \ - { \ - DebugMessage(inMessage); \ - Throw(inException); \ - } - -#define ThrowIfKernelError(inKernelError, inException, inMessage) \ - { \ - kern_return_t __Err = (inKernelError); \ - if(__Err != 0) \ - { \ - DebugMessageN1(inMessage ", Error: 0x%X", __Err); \ - Throw(inException); \ - } \ - } - -#define ThrowIfError(inError, inException, inMessage) \ - { \ - SInt32 __Err = (inError); \ - if(__Err != 0) \ - { \ - char __4CC[5] = CA4CCToCString(__Err); \ - DebugMessageN2(inMessage ", Error: %ld (%s)", __Err, __4CC); \ - Throw(inException); \ - } \ - } - -#if TARGET_OS_WIN32 -#define ThrowIfWinError(inError, inException, inMessage) \ - { \ - HRESULT __Err = (inError); \ - if(FAILED(__Err)) \ - { \ - DebugMessageN1(inMessage ", Error: 0x%X", __Err); \ - Throw(inException); \ - } \ - } -#endif - -#define SubclassResponsibility(inMethodName, inException) \ - { \ - DebugMessage(inMethodName": Subclasses must implement this method"); \ - Throw(inException); \ - } - -#endif // defined(__cplusplus) - -#else - -#pragma mark Release Macros - -#define Assert(inCondition, inMessage) \ - if(!(inCondition)) \ - { \ - STOP; \ - } - -#define AssertNoError(inError, inMessage) \ - { \ - SInt32 __Err = (inError); \ - if(__Err != 0) \ - { \ - STOP; \ - } \ - } - -#define AssertNoKernelError(inError, inMessage) \ - { \ - unsigned int __Err = (unsigned int)(inError); \ - if(__Err != 0) \ - { \ - STOP; \ - } \ - } - -#define FailIf(inCondition, inHandler, inMessage) \ - if(inCondition) \ - { \ - STOP; \ - goto inHandler; \ - } - -#define FailWithAction(inCondition, inAction, inHandler, inMessage) \ - if(inCondition) \ - { \ - STOP; \ - { inAction; } \ - goto inHandler; \ - } - -#define FailIfNULL(inPointer, inAction, inHandler, inMessage) \ - if((inPointer) == NULL) \ - { \ - STOP; \ - { inAction; } \ - goto inHandler; \ - } - -#define FailIfKernelError(inKernelError, inException, inMessage) \ - if((inKernelError) != 0) \ - { \ - STOP; \ - { inAction; } \ - goto inHandler; \ - } - -#define FailIfError(inError, inException, inMessage) \ - if((inError) != 0) \ - { \ - STOP; \ - { inAction; } \ - goto inHandler; \ - } - -#if defined(__cplusplus) - -#define Throw(inException) STOP; throw (inException) - -#define ThrowIf(inCondition, inException, inMessage) \ - if(inCondition) \ - { \ - Throw(inException); \ - } - -#define ThrowIfNULL(inPointer, inException, inMessage) \ - if((inPointer) == NULL) \ - { \ - Throw(inException); \ - } - -#define ThrowIfKernelError(inKernelError, inException, inMessage) \ - { \ - kern_return_t __Err = (inKernelError); \ - if(__Err != 0) \ - { \ - Throw(inException); \ - } \ - } - -#define ThrowIfError(inError, inException, inMessage) \ - { \ - SInt32 __Err = (inError); \ - if(__Err != 0) \ - { \ - Throw(inException); \ - } \ - } - -#if TARGET_OS_WIN32 -#define ThrowIfWinError(inError, inException, inMessage) \ - { \ - HRESULT __Err = (inError); \ - if(FAILED(__Err)) \ - { \ - Throw(inException); \ - } \ - } -#endif - -#define SubclassResponsibility(inMethodName, inException) \ - { \ - Throw(inException); \ - } - -#endif // defined(__cplusplus) - -#endif // DEBUG || CoreAudio_Debug - -#endif diff --git a/CAPublicUtility/CADebugPrintf.h b/CAPublicUtility/CADebugPrintf.h deleted file mode 100644 index 2153290..0000000 --- a/CAPublicUtility/CADebugPrintf.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - CADebugPrintf.h - -=============================================================================*/ -#if !defined(__CADebugPrintf_h__) -#define __CADebugPrintf_h__ - -//============================================================================= -// Macros to redirect debugging output to various logging services -//============================================================================= - -//#define CoreAudio_UseSysLog 1 -//#define CoreAudio_UseSideFile "/CoreAudio-%d.txt" - -#if DEBUG || CoreAudio_Debug - - #if CoreAudio_UseSysLog - #include - #define DebugPrintfRtn syslog - #define DebugPrintfFile LOG_ERR - #define DebugPrintfLineEnding "" - #elif defined(CoreAudio_UseSideFile) - #include - #if defined(__cplusplus) - extern "C" - #endif - void OpenDebugPrintfSideFile(); - extern FILE* sDebugPrintfSideFile; - #define DebugPrintfRtn fprintf - #define DebugPrintfFile ((sDebugPrintfSideFile != NULL) ? sDebugPrintfSideFile : stderr) - #define DebugPrintfLineEnding "\n" - #else - #include - #define DebugPrintfRtn fprintf - #define DebugPrintfFile stderr - #define DebugPrintfLineEnding "\n" - #endif - -#else - #define DebugPrintfRtn - #define DebugPrintfFile - #define DebugPrintfLineEnding -#endif - - -#endif diff --git a/CAPublicUtility/CAStreamBasicDescription.cpp b/CAPublicUtility/CAStreamBasicDescription.cpp deleted file mode 100644 index ed1a5f9..0000000 --- a/CAPublicUtility/CAStreamBasicDescription.cpp +++ /dev/null @@ -1,464 +0,0 @@ -/* Copyright: © Copyright 2004 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - CAStreamBasicDescription.cpp - -=============================================================================*/ - -#include "CAConditionalMacros.h" - -#include "CAStreamBasicDescription.h" - -#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__) - #include -#else - #include -#endif - -const AudioStreamBasicDescription CAStreamBasicDescription::sEmpty = { 0.0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -CAStreamBasicDescription::CAStreamBasicDescription(double inSampleRate, UInt32 inFormatID, - UInt32 inBytesPerPacket, UInt32 inFramesPerPacket, - UInt32 inBytesPerFrame, UInt32 inChannelsPerFrame, - UInt32 inBitsPerChannel, UInt32 inFormatFlags) -{ - mSampleRate = inSampleRate; - mFormatID = inFormatID; - mBytesPerPacket = inBytesPerPacket; - mFramesPerPacket = inFramesPerPacket; - mBytesPerFrame = inBytesPerFrame; - mChannelsPerFrame = inChannelsPerFrame; - mBitsPerChannel = inBitsPerChannel; - mFormatFlags = inFormatFlags; -} - -void CAStreamBasicDescription::PrintFormat(FILE *f, const char *indent, const char *name) const -{ - fprintf(f, "%s%s ", indent, name); - char formatID[5]; - *(UInt32 *)formatID = EndianU32_NtoB(mFormatID); - formatID[4] = '\0'; - fprintf(f, "%2ld ch, %6.0f Hz, '%-4.4s' (0x%08lX) ", - NumberChannels(), mSampleRate, formatID, - mFormatFlags); - if (mFormatID == kAudioFormatLinearPCM) { - bool isInt = !(mFormatFlags & kLinearPCMFormatFlagIsFloat); - int wordSize = SampleWordSize(); - const char *endian = (wordSize > 1) ? - ((mFormatFlags & kLinearPCMFormatFlagIsBigEndian) ? " big-endian" : " little-endian" ) : ""; - const char *sign = isInt ? - ((mFormatFlags & kLinearPCMFormatFlagIsSignedInteger) ? " signed" : " unsigned") : ""; - const char *floatInt = isInt ? "integer" : "float"; - char packed[32]; - if (PackednessIsSignificant()) { - if (mFormatFlags & kLinearPCMFormatFlagIsPacked) - sprintf(packed, "packed in %d bytes", wordSize); - else - sprintf(packed, "unpacked in %d bytes", wordSize); - } else - packed[0] = '\0'; - const char *align = AlignmentIsSignificant() ? - ((mFormatFlags & kLinearPCMFormatFlagIsAlignedHigh) ? " high-aligned" : " low-aligned") : ""; - const char *deinter = (mFormatFlags & kAudioFormatFlagIsNonInterleaved) ? ", deinterleaved" : ""; - const char *commaSpace = (packed[0]!='\0') || (align[0]!='\0') ? ", " : ""; - - fprintf(f, "%ld-bit%s%s %s%s%s%s%s\n", - mBitsPerChannel, endian, sign, floatInt, - commaSpace, packed, align, deinter); - } else - fprintf(f, "%ld bits/channel, %ld bytes/packet, %ld frames/packet, %ld bytes/frame\n", - mBitsPerChannel, mBytesPerPacket, mFramesPerPacket, mBytesPerFrame); -} - -void CAStreamBasicDescription::NormalizeLinearPCMFormat(AudioStreamBasicDescription& ioDescription) -{ - if(ioDescription.mFormatID == kAudioFormatLinearPCM) - { - // we have to doctor the linear PCM format because we always - // only export 32 bit, native endian, fully packed floats - ioDescription.mBitsPerChannel = sizeof(Float32) * 8; - ioDescription.mBytesPerFrame = sizeof(Float32) * ioDescription.mChannelsPerFrame; - ioDescription.mFramesPerPacket = 1; - ioDescription.mBytesPerPacket = ioDescription.mFramesPerPacket * ioDescription.mBytesPerFrame; - - ioDescription.mFormatFlags = kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked; - ioDescription.mFormatFlags |= kAudioFormatFlagsNativeEndian; - } -} - -void CAStreamBasicDescription::ResetFormat(AudioStreamBasicDescription& ioDescription) -{ - ioDescription.mSampleRate = 0; - ioDescription.mFormatID = 0; - ioDescription.mBytesPerPacket = 0; - ioDescription.mFramesPerPacket = 0; - ioDescription.mBytesPerFrame = 0; - ioDescription.mChannelsPerFrame = 0; - ioDescription.mBitsPerChannel = 0; - ioDescription.mFormatFlags = 0; -} - -void CAStreamBasicDescription::FillOutFormat(AudioStreamBasicDescription& ioDescription, const AudioStreamBasicDescription& inTemplateDescription) -{ - if(ioDescription.mSampleRate == 0) - { - ioDescription.mSampleRate = inTemplateDescription.mSampleRate; - } - if(ioDescription.mFormatID == 0) - { - ioDescription.mFormatID = inTemplateDescription.mFormatID; - } - if(ioDescription.mFormatFlags == 0) - { - ioDescription.mFormatFlags = inTemplateDescription.mFormatFlags; - } - if(ioDescription.mBytesPerPacket == 0) - { - ioDescription.mBytesPerPacket = inTemplateDescription.mBytesPerPacket; - } - if(ioDescription.mFramesPerPacket == 0) - { - ioDescription.mFramesPerPacket = inTemplateDescription.mFramesPerPacket; - } - if(ioDescription.mBytesPerFrame == 0) - { - ioDescription.mBytesPerFrame = inTemplateDescription.mBytesPerFrame; - } - if(ioDescription.mChannelsPerFrame == 0) - { - ioDescription.mChannelsPerFrame = inTemplateDescription.mChannelsPerFrame; - } - if(ioDescription.mBitsPerChannel == 0) - { - ioDescription.mBitsPerChannel = inTemplateDescription.mBitsPerChannel; - } -} - -void CAStreamBasicDescription::GetSimpleName(const AudioStreamBasicDescription& inDescription, char* outName, bool inAbbreviate) -{ - switch(inDescription.mFormatID) - { - case kAudioFormatLinearPCM: - { - const char* theEndianString = NULL; - if((inDescription.mFormatFlags & kAudioFormatFlagIsBigEndian) != 0) - { - #if TARGET_RT_LITTLE_ENDIAN - theEndianString = "Big Endian"; - #endif - } - else - { - #if TARGET_RT_BIG_ENDIAN - theEndianString = "Little Endian"; - #endif - } - - const char* theKindString = NULL; - if((inDescription.mFormatFlags & kAudioFormatFlagIsFloat) != 0) - { - theKindString = (inAbbreviate ? "Float" : "Floating Point"); - } - else if((inDescription.mFormatFlags & kAudioFormatFlagIsSignedInteger) != 0) - { - theKindString = (inAbbreviate ? "SInt" : "Signed Integer"); - } - else - { - theKindString = (inAbbreviate ? "UInt" : "Unsigned Integer"); - } - - const char* thePackingString = NULL; - if((inDescription.mFormatFlags & kAudioFormatFlagIsPacked) == 0) - { - if((inDescription.mFormatFlags & kAudioFormatFlagIsAlignedHigh) != 0) - { - thePackingString = "High"; - } - else - { - thePackingString = "Low"; - } - } - - if(inAbbreviate) - { - if(theEndianString != NULL) - { - if(thePackingString != NULL) - { - sprintf(outName, "%d Ch %s %s %s%d/%s%d", (int)inDescription.mChannelsPerFrame, theEndianString, thePackingString, theKindString, (int)inDescription.mBitsPerChannel, theKindString, (int)(inDescription.mBytesPerFrame / inDescription.mChannelsPerFrame) * 8); - } - else - { - sprintf(outName, "%d Ch %s %s%d", (int)inDescription.mChannelsPerFrame, theEndianString, theKindString, (int)inDescription.mBitsPerChannel); - } - } - else - { - if(thePackingString != NULL) - { - sprintf(outName, "%d Ch %s %s%d/%s%d", (int)inDescription.mChannelsPerFrame, thePackingString, theKindString, (int)inDescription.mBitsPerChannel, theKindString, (int)((inDescription.mBytesPerFrame / inDescription.mChannelsPerFrame) * 8)); - } - else - { - sprintf(outName, "%d Ch %s%d", (int)inDescription.mChannelsPerFrame, theKindString, (int)inDescription.mBitsPerChannel); - } - } - } - else - { - if(theEndianString != NULL) - { - if(thePackingString != NULL) - { - sprintf(outName, "%d Channel %d Bit %s %s Aligned %s in %d Bits", (int)inDescription.mChannelsPerFrame, (int)inDescription.mBitsPerChannel, theEndianString, theKindString, thePackingString, (int)(inDescription.mBytesPerFrame / inDescription.mChannelsPerFrame) * 8); - } - else - { - sprintf(outName, "%d Channel %d Bit %s %s", (int)inDescription.mChannelsPerFrame, (int)inDescription.mBitsPerChannel, theEndianString, theKindString); - } - } - else - { - sprintf(outName, "%d Channel %d Bit %s", (int)inDescription.mChannelsPerFrame, (int)inDescription.mBitsPerChannel, theKindString); - if(thePackingString != NULL) - { - sprintf(outName, "%d Channel %d Bit %s Aligned %s in %d Bits", (int)inDescription.mChannelsPerFrame, (int)inDescription.mBitsPerChannel, theKindString, thePackingString, (int)(inDescription.mBytesPerFrame / inDescription.mChannelsPerFrame) * 8); - } - else - { - sprintf(outName, "%d Channel %d Bit %s", (int)inDescription.mChannelsPerFrame, (int)inDescription.mBitsPerChannel, theKindString); - } - } - } - } - break; - - case kAudioFormatAC3: - strcpy(outName, "AC-3"); - break; - - case kAudioFormat60958AC3: - strcpy(outName, "AC-3 for SPDIF"); - break; - - default: - { - char* the4CCString = (char*)&inDescription.mFormatID; - outName[0] = the4CCString[0]; - outName[1] = the4CCString[1]; - outName[2] = the4CCString[2]; - outName[3] = the4CCString[3]; - outName[4] = 0; - } - break; - }; -} - -#if CoreAudio_Debug -#include "CALogMacros.h" - -void CAStreamBasicDescription::PrintToLog(const AudioStreamBasicDescription& inDesc) -{ - PrintFloat (" Sample Rate: ", inDesc.mSampleRate); - Print4CharCode (" Format ID: ", inDesc.mFormatID); - PrintHex (" Format Flags: ", inDesc.mFormatFlags); - PrintInt (" Bytes per Packet: ", inDesc.mBytesPerPacket); - PrintInt (" Frames per Packet: ", inDesc.mFramesPerPacket); - PrintInt (" Bytes per Frame: ", inDesc.mBytesPerFrame); - PrintInt (" Channels per Frame: ", inDesc.mChannelsPerFrame); - PrintInt (" Bits per Channel: ", inDesc.mBitsPerChannel); -} -#endif - -bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y) -{ - bool theAnswer = false; - bool isDone = false; - - // note that if either side is 0, that field is skipped - - // format ID is the first order sort - if((!isDone) && ((x.mFormatID != 0) && (y.mFormatID != 0))) - { - if(x.mFormatID != y.mFormatID) - { - // formats are sorted numerically except that linear - // PCM is always first - if(x.mFormatID == kAudioFormatLinearPCM) - { - theAnswer = true; - } - else if(y.mFormatID == kAudioFormatLinearPCM) - { - theAnswer = false; - } - else - { - theAnswer = x.mFormatID < y.mFormatID; - } - isDone = true; - } - } - - // floating point vs integer for linear PCM only - if((!isDone) && ((x.mFormatID == kAudioFormatLinearPCM) && (y.mFormatID == kAudioFormatLinearPCM))) - { - if((x.mFormatFlags & kAudioFormatFlagIsFloat) != (y.mFormatFlags & kAudioFormatFlagIsFloat)) - { - // floating point is better than integer - theAnswer = y.mFormatFlags & kAudioFormatFlagIsFloat; - isDone = true; - } - } - - // bit depth - if((!isDone) && ((x.mBitsPerChannel != 0) && (y.mBitsPerChannel != 0))) - { - if(x.mBitsPerChannel != y.mBitsPerChannel) - { - // deeper bit depths are higher quality - theAnswer = x.mBitsPerChannel < y.mBitsPerChannel; - isDone = true; - } - } - - // sample rate - if((!isDone) && ((x.mSampleRate != 0) && (y.mSampleRate != 0))) - { - if(x.mSampleRate != y.mSampleRate) - { - // higher sample rates are higher quality - theAnswer = x.mSampleRate < y.mSampleRate; - isDone = true; - } - } - - // number of channels - if((!isDone) && ((x.mChannelsPerFrame != 0) && (y.mChannelsPerFrame != 0))) - { - if(x.mChannelsPerFrame != y.mChannelsPerFrame) - { - // more channels is higher quality - theAnswer = x.mChannelsPerFrame < y.mChannelsPerFrame; - isDone = true; - } - } - - return theAnswer; -} - -static bool MatchFormatFlags(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y) -{ - UInt32 xFlags = x.mFormatFlags; - UInt32 yFlags = y.mFormatFlags; - - // match wildcards - if (x.mFormatID == 0 || y.mFormatID == 0 || xFlags == 0 || yFlags == 0) - return true; - - if (x.mFormatID == kAudioFormatLinearPCM) - { - // knock off the all clear flag - xFlags = xFlags & ~kAudioFormatFlagsAreAllClear; - yFlags = yFlags & ~kAudioFormatFlagsAreAllClear; - - // if both kAudioFormatFlagIsPacked bits are set, then we don't care about the kAudioFormatFlagIsAlignedHigh bit. - if (xFlags & yFlags & kAudioFormatFlagIsPacked) { - xFlags = xFlags & ~kAudioFormatFlagIsAlignedHigh; - yFlags = yFlags & ~kAudioFormatFlagIsAlignedHigh; - } - - // if both kAudioFormatFlagIsFloat bits are set, then we don't care about the kAudioFormatFlagIsSignedInteger bit. - if (xFlags & yFlags & kAudioFormatFlagIsFloat) { - xFlags = xFlags & ~kAudioFormatFlagIsSignedInteger; - yFlags = yFlags & ~kAudioFormatFlagIsSignedInteger; - } - - // if the bit depth is 8 bits or less and the format is packed, we don't care about endianness - if((x.mBitsPerChannel <= 8) && ((xFlags & kAudioFormatFlagIsPacked) == kAudioFormatFlagIsPacked)) - { - xFlags = xFlags & ~kAudioFormatFlagIsBigEndian; - } - if((y.mBitsPerChannel <= 8) && ((yFlags & kAudioFormatFlagIsPacked) == kAudioFormatFlagIsPacked)) - { - yFlags = yFlags & ~kAudioFormatFlagIsBigEndian; - } - } - return xFlags == yFlags; -} - -bool operator==(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y) -{ - // the semantics for equality are: - // 1) Values must match exactly - // 2) wildcard's are ignored in the comparison - -#define MATCH(name) ((x.name) == 0 || (y.name) == 0 || (x.name) == (y.name)) - - return - // check the sample rate - MATCH(mSampleRate) - - // check the format ids - && MATCH(mFormatID) - - // check the format flags - && MatchFormatFlags(x, y) - - // check the bytes per packet - && MATCH(mBytesPerPacket) - - // check the frames per packet - && MATCH(mFramesPerPacket) - - // check the bytes per frame - && MATCH(mBytesPerFrame) - - // check the channels per frame - && MATCH(mChannelsPerFrame) - - // check the channels per frame - && MATCH(mBitsPerChannel) ; -} - -bool SanityCheck(const AudioStreamBasicDescription& x) -{ - return (x.mSampleRate >= 0.); -} diff --git a/CAPublicUtility/CAStreamBasicDescription.h b/CAPublicUtility/CAStreamBasicDescription.h deleted file mode 100644 index aa41c40..0000000 --- a/CAPublicUtility/CAStreamBasicDescription.h +++ /dev/null @@ -1,224 +0,0 @@ -/* Copyright: © Copyright 2005 Apple Computer, Inc. All rights reserved. - - Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Computer, 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 "Apple Software"), to use, - reproduce, modify and redistribute the Apple Software, with or without - modifications, in source and/or binary forms; provided that if you redistribute - the Apple Software in its entirety and without modifications, you must retain - this notice and the following text and disclaimers in all such redistributions of - the Apple Software. Neither the name, trademarks, service marks or logos of - Apple Computer, Inc. may be used to endorse or promote products derived from the - Apple Software without specific prior written permission from Apple. Except as - expressly stated in this notice, no other rights or licenses, express or 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 INTERRUPTION) - ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION - OF THE APPLE SOFTWARE, HOWEVER CAUSED 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. -*/ -/*============================================================================= - CAStreamBasicDescription.h - -=============================================================================*/ - -#ifndef __CAStreamBasicDescription_h__ -#define __CAStreamBasicDescription_h__ - -#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__) - #include - #include -#else - #include "CoreAudioTypes.h" - #include "CoreFoundation.h" -#endif - -#include "CADebugMacros.h" -#include // for memset, memcpy -#include // for FILE * - -#pragma mark This file needs to compile on more earlier versions of the OS, so please keep that in mind when editing it - -// define the IsMixable format flag for all versions of the system -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) - enum { kIsNonMixableFlag = kAudioFormatFlagIsNonMixable }; -#else - enum { kIsNonMixableFlag = (1L << 6) }; -#endif - -//============================================================================= -// CAStreamBasicDescription -// -// This is a wrapper class for the AudioStreamBasicDescription struct. -// It adds a number of convenience routines, but otherwise adds nothing -// to the footprint of the original struct. -//============================================================================= -class CAStreamBasicDescription : - public AudioStreamBasicDescription -{ - -// Constants -public: - static const AudioStreamBasicDescription sEmpty; - -// Construction/Destruction -public: - CAStreamBasicDescription() { memset (this, 0, sizeof(AudioStreamBasicDescription)); } - - CAStreamBasicDescription(const AudioStreamBasicDescription &desc) - { - SetFrom(desc); - } - - CAStreamBasicDescription( double inSampleRate, UInt32 inFormatID, - UInt32 inBytesPerPacket, UInt32 inFramesPerPacket, - UInt32 inBytesPerFrame, UInt32 inChannelsPerFrame, - UInt32 inBitsPerChannel, UInt32 inFormatFlags); - -// Assignment - CAStreamBasicDescription& operator=(const AudioStreamBasicDescription& v) { SetFrom(v); return *this; } - - void SetFrom(const AudioStreamBasicDescription &desc) - { - memcpy(this, &desc, sizeof(AudioStreamBasicDescription)); - } - - // _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - // - // interrogation - - bool IsPCM() const { return mFormatID == kAudioFormatLinearPCM; } - - bool PackednessIsSignificant() const - { - Assert(IsPCM(), "PackednessIsSignificant only applies for PCM"); - return (SampleWordSize() << 3) != mBitsPerChannel; - } - - bool AlignmentIsSignificant() const - { - return PackednessIsSignificant() || (mBitsPerChannel & 7) != 0; - } - - bool IsInterleaved() const - { - return !IsPCM() || !(mFormatFlags & kAudioFormatFlagIsNonInterleaved); - } - - // for sanity with interleaved/deinterleaved possibilities, never access mChannelsPerFrame, use these: - UInt32 NumberInterleavedChannels() const { return IsInterleaved() ? mChannelsPerFrame : 1; } - UInt32 NumberChannelStreams() const { return IsInterleaved() ? 1 : mChannelsPerFrame; } - UInt32 NumberChannels() const { return mChannelsPerFrame; } - UInt32 SampleWordSize() const { return (mBytesPerFrame > 0) ? mBytesPerFrame / NumberInterleavedChannels() : 0;} - - UInt32 FramesToBytes(UInt32 nframes) const { return nframes * mBytesPerFrame; } - UInt32 BytesToFrames(UInt32 nbytes) const { - Assert(mBytesPerFrame > 0, "bytesPerFrame must be > 0 in BytesToFrames"); - return nbytes / mBytesPerFrame; - } - - bool SameChannelsAndInterleaving(const CAStreamBasicDescription &a) const - { - return this->NumberChannels() == a.NumberChannels() && this->IsInterleaved() == a.IsInterleaved(); - } - - // _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - // - // manipulation - - void SetCanonical(UInt32 nChannels, bool interleaved) - // note: leaves sample rate untouched - { - mFormatID = kAudioFormatLinearPCM; - mFormatFlags = kAudioFormatFlagsNativeFloatPacked; - mBitsPerChannel = 32; - mChannelsPerFrame = nChannels; - mFramesPerPacket = 1; - if (interleaved) - mBytesPerPacket = mBytesPerFrame = nChannels * sizeof(Float32); - else { - mBytesPerPacket = mBytesPerFrame = sizeof(Float32); - mFormatFlags |= kAudioFormatFlagIsNonInterleaved; - } - } - - void ChangeNumberChannels(UInt32 nChannels, bool interleaved) - // alter an existing format - { - Assert(IsPCM(), "ChangeNumberChannels only works for PCM formats"); - UInt32 wordSize = SampleWordSize(); // get this before changing ANYTHING - if (wordSize == 0) - wordSize = (mBitsPerChannel + 7) / 8; - mChannelsPerFrame = nChannels; - mFramesPerPacket = 1; - if (interleaved) { - mBytesPerPacket = mBytesPerFrame = nChannels * wordSize; - mFormatFlags &= ~kAudioFormatFlagIsNonInterleaved; - } else { - mBytesPerPacket = mBytesPerFrame = wordSize; - mFormatFlags |= kAudioFormatFlagIsNonInterleaved; - } - } - - // _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - // - // other - - void Print() const - { - Print (stdout); - } - - void Print(FILE* file) const - { - PrintFormat (file, "", "AudioStreamBasicDescription:"); - } - - void PrintFormat(FILE *f, const char *indent, const char *name) const; - - OSStatus Save(CFPropertyListRef *outData) const; - - OSStatus Restore(CFPropertyListRef &inData); - -// Operations - static bool IsMixable(const AudioStreamBasicDescription& inDescription) { return (inDescription.mFormatID == kAudioFormatLinearPCM) && ((inDescription.mFormatFlags & kIsNonMixableFlag) == 0); } - static void NormalizeLinearPCMFormat(AudioStreamBasicDescription& ioDescription); - static void ResetFormat(AudioStreamBasicDescription& ioDescription); - static void FillOutFormat(AudioStreamBasicDescription& ioDescription, const AudioStreamBasicDescription& inTemplateDescription); - static void GetSimpleName(const AudioStreamBasicDescription& inDescription, char* outName, bool inAbbreviate); -#if CoreAudio_Debug - static void PrintToLog(const AudioStreamBasicDescription& inDesc); -#endif -}; - -bool operator<(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y); -bool operator==(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y); -#if TARGET_OS_MAC || (TARGET_OS_WIN32 && (_MSC_VER > 600)) -inline bool operator!=(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y) { return !(x == y); } -inline bool operator<=(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y) { return (x < y) || (x == y); } -inline bool operator>=(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y) { return !(x < y); } -inline bool operator>(const AudioStreamBasicDescription& x, const AudioStreamBasicDescription& y) { return !((x < y) || (x == y)); } -#endif - -bool SanityCheck(const AudioStreamBasicDescription& x); - - -#endif // __CAStreamBasicDescription_h__ diff --git a/Codecprintf.c b/Codecprintf.c index c210e6d..97c687e 100644 --- a/Codecprintf.c +++ b/Codecprintf.c @@ -19,10 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Codecprintf.h" #include #include -#include "log.h" +#include + +#include "Codecprintf.h" #define CODEC_HEADER "Perian: " diff --git a/CommonUtils.c b/CommonUtils.c index 3aba2e0..89d657b 100644 --- a/CommonUtils.c +++ b/CommonUtils.c @@ -19,12 +19,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "avcodec.h" + +#include +#include +#include +#include + +#include #include "CommonUtils.h" -#import -#import -#import -#import + typedef struct LanguageTriplet { char twoChar[3]; diff --git a/CompressAudioCodec.cpp b/CompressAudioCodec.cpp index e80cdb1..cf60916 100644 --- a/CompressAudioCodec.cpp +++ b/CompressAudioCodec.cpp @@ -19,7 +19,6 @@ */ #include "CompressAudioCodec.h" -#include "ACCodecDispatch.h" #include "CodecIDs.h" #include "CompressCodecUtils.h" @@ -35,7 +34,7 @@ static const OSType kAllInputFormats[] = static const UInt32 kIntPCMOutFormatFlag = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kLinearPCMFormatFlagIsPacked; -CompressAudioCodec::CompressAudioCodec(UInt32 inInputBufferByteSize) : FFissionCodec(0) +CompressAudioCodec::CompressAudioCodec(AudioComponentInstance inInstance) : FFissionCodec(inInstance) { for (int i = 0; kAllInputFormats[i] != CODEC_ID_NONE; i++) { CAStreamBasicDescription theInputFormat(kAudioStreamAnyRate, kAllInputFormats[i], 0, 1, 0, 0, 0, 0); @@ -245,8 +244,8 @@ UInt32 CompressAudioCodec::ProduceOutputPackets(void* outOutputData, UInt32& ioO return status; } -extern "C" -ComponentResult CompressAudioDecoderEntry(ComponentParameters* inParameters, CompressAudioCodec* inThis) -{ - return ACCodecDispatch(inParameters, inThis); -} \ No newline at end of file +#include "ACPlugInDispatch.h" + +#define CompressAudioCodecEntry CompressAudioDecoderEntry + +AUDIOCOMPONENT_ENTRY(AudioCodecFactory, CompressAudioCodec) \ No newline at end of file diff --git a/CompressAudioCodec.h b/CompressAudioCodec.h index 6af660a..bbd3cfb 100644 --- a/CompressAudioCodec.h +++ b/CompressAudioCodec.h @@ -26,13 +26,13 @@ class CompressAudioCodec : public FFissionCodec { public: - CompressAudioCodec(UInt32 inInputBufferByteSize = 76800); + CompressAudioCodec(AudioComponentInstance inInstance); virtual ~CompressAudioCodec(); virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize); virtual void Uninitialize(); virtual void Reset(); - + virtual void GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData); virtual void SetMagicCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize); @@ -41,7 +41,11 @@ class CompressAudioCodec : public FFissionCodec virtual void AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets, const AudioStreamPacketDescription* inPacketDescription); virtual UInt32 ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets, AudioStreamPacketDescription* outPacketDescription); - + + virtual void ReallocateInputBuffer(UInt32 inInputBufferByteSize) {} + virtual UInt32 GetInputBufferByteSize() const {return 0;} + virtual UInt32 GetUsedInputBufferByteSize() const {return 0;} + private: UInt32 ParseCookieAtom(const uint8_t* inAtom, UInt32 inAtomMaxSize); void ParseCookie(const uint8_t* inMagicCookie, UInt32 inMagicCookieByteSize); diff --git a/CompressVideoCodec.c b/CompressVideoCodec.c index 2d067e4..e9906d5 100644 --- a/CompressVideoCodec.c +++ b/CompressVideoCodec.c @@ -22,10 +22,11 @@ #include #include +#include + #include "PerianResourceIDs.h" #include "Codecprintf.h" #include "CommonUtils.h" -#include "avcodec.h" #include "CompressCodecUtils.h" typedef struct { diff --git a/FFissionCodec/FFissionCodec.cpp b/FFissionCodec/FFissionCodec.cpp index 86cd286..d40a253 100644 --- a/FFissionCodec/FFissionCodec.cpp +++ b/FFissionCodec/FFissionCodec.cpp @@ -25,14 +25,14 @@ * It should be merged into FFissionDecoder unless we get some. */ +#include extern "C" { -#include "avcodec.h" +#include } -#include #include "FFissionCodec.h" #include "FFmpegUtils.h" -FFissionCodec::FFissionCodec(UInt32 inInputBufferByteSize) : ACSimpleCodec(inInputBufferByteSize) +FFissionCodec::FFissionCodec(AudioComponentInstance inInstance) : ACBaseCodec(inInstance) { FFInitFFmpeg(); @@ -74,10 +74,10 @@ void FFissionCodec::Initialize(const AudioStreamBasicDescription* inInputFormat, CODEC_THROW(kAudioCodecUnsupportedFormatError); } - ACSimpleCodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize); + ACBaseCodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize); } -void FFissionCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable) { +void FFissionCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, Boolean& outWritable) { switch(inPropertyID) { case kAudioCodecPropertyMaximumPacketByteSize: @@ -101,7 +101,7 @@ void FFissionCodec::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& o break; default: - ACSimpleCodec::GetPropertyInfo(inPropertyID, outPropertyDataSize, outWritable); + ACBaseCodec::GetPropertyInfo(inPropertyID, outPropertyDataSize, outWritable); break; } } @@ -125,9 +125,15 @@ void FFissionCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPro switch (inPropertyID) { case kAudioCodecPropertyManufacturerCFString: - *(CFStringRef*)outPropertyData = CFCopyLocalizedStringFromTableInBundle(CFSTR("Perian Project"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR("")); + *(CFStringRef*)outPropertyData = CFSTR("Perian"); break; + case kAudioCodecPropertyNameCFString: + case kAudioCodecPropertyFormatCFString: + // FIXME read our Rez strings here + CODEC_THROW(kAudioCodecUnknownPropertyError); + break; + case kAudioCodecPropertyMaximumPacketByteSize: if (avContext && avContext->block_align) *reinterpret_cast(outPropertyData) = avContext->block_align; @@ -153,6 +159,6 @@ void FFissionCodec::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPro break; default: - ACSimpleCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData); + ACBaseCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData); } } diff --git a/FFissionCodec/FFissionCodec.h b/FFissionCodec/FFissionCodec.h index d452020..0036737 100644 --- a/FFissionCodec/FFissionCodec.h +++ b/FFissionCodec/FFissionCodec.h @@ -23,30 +23,31 @@ #ifndef __FFISSIONCODEC_H__ #define __FFISSIONCODEC_H__ -#include "ACSimpleCodec.h" +#include +#include extern "C" { -#include "avcodec.h" +#include #undef CodecType } //============================================================================= -// ACffAudioCodec +// FFissionCodec // // This class encapsulates the common implementation of an audio codec using ffmpeg. //============================================================================= -class FFissionCodec : public ACSimpleCodec { +class FFissionCodec : public ACBaseCodec { // Construction/Destruction public: - FFissionCodec(UInt32 inInputBufferByteSize); + FFissionCodec(AudioComponentInstance inInstance); virtual ~FFissionCodec(); // Data Handling virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize); virtual void GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData); - virtual void GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable); + virtual void GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, Boolean& outWritable); protected: AVCodec *avCodec; diff --git a/FFissionCodec/FFissionDecoder.cpp b/FFissionCodec/FFissionDecoder.cpp index f820ff0..ff23801 100644 --- a/FFissionCodec/FFissionDecoder.cpp +++ b/FFissionCodec/FFissionDecoder.cpp @@ -20,13 +20,14 @@ */ #include +#include + +#include "ComponentBase.h" #include "FFissionDecoder.h" -#include "ACCodecDispatch.h" #include "PerianResourceIDs.h" #include "Codecprintf.h" #include "FFmpegUtils.h" #include "CodecIDs.h" -#include "dca.h" #define MY_APP_DOMAIN CFSTR("org.perian.Perian") #define PASSTHROUGH_KEY CFSTR("attemptDTSPassthrough") @@ -86,7 +87,7 @@ static void ParseWaveFormat(const WaveFormatEx *wEx, AVCodecContext *avContext) avContext->bit_rate = EndianU32_LtoN(wEx->nAvgBytesPerSec) * 8; } -FFissionDecoder::FFissionDecoder(UInt32 inInputBufferByteSize) : FFissionCodec(0) +FFissionDecoder::FFissionDecoder(AudioComponentInstance inInstance) : FFissionCodec(inInstance) { magicCookie = NULL; magicCookieSize = 0; @@ -100,7 +101,7 @@ FFissionDecoder::FFissionDecoder(UInt32 inInputBufferByteSize) : FFissionCodec(0 CAStreamBasicDescription theOutputFormat(kAudioStreamAnyRate, kAudioFormatLinearPCM, 0, 1, 0, 0, 16, kIntPCMOutFormatFlag); AddOutputFormat(theOutputFormat); - inputBuffer.Initialize(inInputBufferByteSize); + inputBuffer.Initialize(4096); /* allocation hint, it will resize */ outBufUsed = 0; outBufSize = AVCODEC_MAX_AUDIO_FRAME_SIZE; outputBuffer = new Byte[outBufSize]; @@ -297,20 +298,12 @@ void FFissionDecoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioP switch (inPropertyID) { case kAudioCodecPropertyNameCFString: *(CFStringRef*)outPropertyData = CFCopyLocalizedStringFromTableInBundle(CFSTR("Perian FFmpeg audio decoder"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR("")); - break; - - case kAudioCodecPropertyInputBufferSize: - *reinterpret_cast(outPropertyData) = inputBuffer.GetBufferByteSize(); - break; - - case kAudioCodecPropertyUsedInputBufferSize: - *reinterpret_cast(outPropertyData) = inputBuffer.GetDataAvailable(); break; case kAudioCodecPropertyFormatInfo: { AudioFormatInfo *info = (AudioFormatInfo*)outPropertyData; - FFissionDecoder *dec = new FFissionDecoder(); + FFissionDecoder *dec = new FFissionDecoder(mComponentInstance); // XXX // We need to fake an output format, doesn't matter what it says as long as it inits static const AudioStreamBasicDescription DefaultOutputASBD = @@ -337,6 +330,22 @@ void FFissionDecoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioP } } +void FFissionDecoder::ReallocateInputBuffer(UInt32 inInputBufferByteSize) +{ + inputBuffer.Reset(); + inputBuffer.Reallocate(inInputBufferByteSize); +} + +UInt32 FFissionDecoder::GetInputBufferByteSize() const +{ + return inputBuffer.GetBufferByteSize(); +} + +UInt32 FFissionDecoder::GetUsedInputBufferByteSize() const +{ + return inputBuffer.GetDataAvailable(); +} + void FFissionDecoder::SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat) { if(mIsInitialized) { @@ -725,20 +734,14 @@ void FFissionVBRDecoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& *reinterpret_cast(outPropertyData) = true; break; + // FIXME implement priming + default: FFissionDecoder::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData); } } +#include "ACPlugInDispatch.h" -extern "C" -ComponentResult FFissionDecoderEntry(ComponentParameters* inParameters, FFissionDecoder* inThis) -{ - return ACCodecDispatch(inParameters, inThis); -} - -extern "C" -ComponentResult FFissionVBRDecoderEntry(ComponentParameters* inParameters, FFissionVBRDecoder* inThis) -{ - return ACCodecDispatch(inParameters, inThis); -} +AUDIOCOMPONENT_ENTRY(AudioCodecFactory, FFissionDecoder) +AUDIOCOMPONENT_ENTRY(AudioCodecFactory, FFissionVBRDecoder) \ No newline at end of file diff --git a/FFissionCodec/FFissionDecoder.h b/FFissionCodec/FFissionDecoder.h index 9ca2abd..3d5eb79 100644 --- a/FFissionCodec/FFissionDecoder.h +++ b/FFissionCodec/FFissionDecoder.h @@ -28,7 +28,7 @@ class FFissionDecoder : public FFissionCodec { public: - FFissionDecoder(UInt32 inInputBufferByteSize = 76800); + FFissionDecoder(AudioComponentInstance inInstance); virtual ~FFissionDecoder(); virtual void Initialize(const AudioStreamBasicDescription* inInputFormat, const AudioStreamBasicDescription* inOutputFormat, const void* inMagicCookie, UInt32 inMagicCookieByteSize); @@ -46,6 +46,10 @@ class FFissionDecoder : public FFissionCodec virtual UInt32 InterleaveSamples(void *outputDataUntyped, Byte *inputDataUntyped, int amountToCopy); virtual UInt32 ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets, AudioStreamPacketDescription* outPacketDescription); + virtual void ReallocateInputBuffer(UInt32 inInputBufferByteSize); + virtual UInt32 GetInputBufferByteSize() const; + virtual UInt32 GetUsedInputBufferByteSize() const; + private: void SetupExtradata(); int ConvertXiphVorbisCookie(); @@ -69,7 +73,7 @@ class FFissionDecoder : public FFissionCodec class FFissionVBRDecoder : public FFissionDecoder { public: - FFissionVBRDecoder() : FFissionDecoder() { } + FFissionVBRDecoder(AudioComponentInstance inInstance) : FFissionDecoder(inInstance) { } virtual void GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData); }; diff --git a/FFmpegUtils.c b/FFmpegUtils.c index 90e7409..fff2b27 100644 --- a/FFmpegUtils.c +++ b/FFmpegUtils.c @@ -23,12 +23,13 @@ * FFmpeg API interfaces and such */ +#include +#include + #include "FFmpegUtils.h" #include "CommonUtils.h" #include "Codecprintf.h" #include "CodecIDs.h" -#include -#include "avformat.h" void FFAVCodecContextToASBD(AVCodecContext *avctx, AudioStreamBasicDescription *asbd) { diff --git a/FFmpegUtils.h b/FFmpegUtils.h index 7a10c3c..3e77275 100644 --- a/FFmpegUtils.h +++ b/FFmpegUtils.h @@ -31,7 +31,7 @@ __BEGIN_DECLS -#include "avcodec.h" +#include void FFAVCodecContextToASBD(AVCodecContext *avctx, AudioStreamBasicDescription *asbd); diff --git a/FFusionCodec.c b/FFusionCodec.c index 55ca2f0..449b532 100644 --- a/FFusionCodec.c +++ b/FFusionCodec.c @@ -33,9 +33,9 @@ #include #include #include +#include #include "PerianResourceIDs.h" -#include "avcodec.h" #include "Codecprintf.h" #include "ColorConversions.h" #include "bitstream_info.h" diff --git a/FrameBuffer.c b/FrameBuffer.c index 831a651..2e3d646 100644 --- a/FrameBuffer.c +++ b/FrameBuffer.c @@ -19,10 +19,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include +#include + #include "FrameBuffer.h" -#include "avcodec.h" #include "CommonUtils.h" -#include void FFusionDataSetup(FFusionData *data, int dataSize, int bufferSize) { diff --git a/MatroskaImportPrivate.cpp b/MatroskaImportPrivate.cpp index 197b50d..0af2bb6 100644 --- a/MatroskaImportPrivate.cpp +++ b/MatroskaImportPrivate.cpp @@ -51,7 +51,7 @@ #include "CompressCodecUtils.h" extern "C" { -#include "avutil.h" +#include #include "ff_private.h" #undef CodecType } diff --git a/Perian.xcodeproj/project.pbxproj b/Perian.xcodeproj/project.pbxproj index 8d50bdd..4b32a9b 100644 --- a/Perian.xcodeproj/project.pbxproj +++ b/Perian.xcodeproj/project.pbxproj @@ -130,6 +130,12 @@ 3D211A300B6B1AD80051299D /* SubParsing.m.rl in Sources */ = {isa = PBXBuildFile; fileRef = 3D211A2F0B6B1AD80051299D /* SubParsing.m.rl */; }; 3D2A136F1213D3CC002BFAEA /* KaxDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D2A136E1213D3CC002BFAEA /* KaxDefines.h */; }; 3D41BEB40BCD3B510069E7C2 /* libuniversaldetector.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D41BE9A0BCD3B330069E7C2 /* libuniversaldetector.a */; }; + 3D4893F01492DD7400E0A09D /* ACBaseCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D4893E31492DD7400E0A09D /* ACBaseCodec.cpp */; }; + 3D4893F11492DD7400E0A09D /* ACCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D4893E51492DD7400E0A09D /* ACCodec.cpp */; }; + 3D4893F71492DDD700E0A09D /* GetCodecBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D4893F61492DDD700E0A09D /* GetCodecBundle.cpp */; }; + 3D4894101492DEBC00E0A09D /* ComponentBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D4894071492DEBC00E0A09D /* ComponentBase.cpp */; }; + 3D4894951492E25700E0A09D /* CABundleLocker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D4894331492E25700E0A09D /* CABundleLocker.cpp */; }; + 3D4894B21492E25700E0A09D /* CAStreamBasicDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D4894771492E25700E0A09D /* CAStreamBasicDescription.cpp */; }; 3D4A7A990B5533BC004C5D6A /* ColorConversions.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D4A7A980B5533BC004C5D6A /* ColorConversions.c */; settings = {COMPILER_FLAGS = "-O3"; }; }; 3D5AB53C10BB52B500D1E688 /* CommonUtils.c in Sources */ = {isa = PBXBuildFile; fileRef = 61D517720AE0402E00A671E1 /* CommonUtils.c */; }; 3D70B04B13CC187900711D41 /* KaxSemantic.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D70B04A13CC187900711D41 /* KaxSemantic.h */; }; @@ -185,15 +191,8 @@ 3DE8D9D5104451A80007C7E7 /* Perian - Open in QT Player.app in Resources */ = {isa = PBXBuildFile; fileRef = 3DE8D6DE104440F60007C7E7 /* Perian - Open in QT Player.app */; }; 3DEFA3F9120560AD0097FE4C /* libavcore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DEFA3F8120560AD0097FE4C /* libavcore.a */; }; 3DF2958C104F0EF40047B8EC /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11629EF30B51E4FB006591C8 /* AppKit.framework */; }; - 6116E5510B43C27B0020F1CE /* ACBaseCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6116E5370B43C27B0020F1CE /* ACBaseCodec.cpp */; }; - 6116E5520B43C27B0020F1CE /* ACCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6116E5390B43C27B0020F1CE /* ACCodec.cpp */; }; - 6116E5530B43C27B0020F1CE /* ACSimpleCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6116E53E0B43C27B0020F1CE /* ACSimpleCodec.cpp */; }; - 6116E5570B43C27B0020F1CE /* CAStreamBasicDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6116E5490B43C27B0020F1CE /* CAStreamBasicDescription.cpp */; }; 6116E5580B43C27B0020F1CE /* FFissionCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6116E54C0B43C27B0020F1CE /* FFissionCodec.cpp */; }; 6116E55A0B43C27B0020F1CE /* FFissionDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6116E54F0B43C27B0020F1CE /* FFissionDecoder.cpp */; }; - 6116E61C0B44A5A70020F1CE /* GetCodecBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6116E5400B43C27B0020F1CE /* GetCodecBundle.cpp */; }; - 6116E6200B44A5B30020F1CE /* CADebugMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6116E5460B43C27B0020F1CE /* CADebugMacros.cpp */; }; - 6116E6220B44A5BC0020F1CE /* CABundleLocker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6116E5430B43C27B0020F1CE /* CABundleLocker.cpp */; }; 6123D6260AD0A3FF003EDE52 /* VobSubCodec.c in Sources */ = {isa = PBXBuildFile; fileRef = 6123D6220AD0A3FE003EDE52 /* VobSubCodec.c */; }; 613CD51E0AD1FB650098A825 /* TextSubCodec.c in Sources */ = {isa = PBXBuildFile; fileRef = 613CD51A0AD1FB650098A825 /* TextSubCodec.c */; }; 6156986F0BCDA87700E17ADE /* ringbuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6156986D0BCDA87700E17ADE /* ringbuffer.cpp */; }; @@ -627,12 +626,12 @@ 11C85ED30A641E6400DF3D73 /* ff_dataref.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ff_dataref.c; sourceTree = ""; }; 11C85ED40A641E6400DF3D73 /* ff_MovieImport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ff_MovieImport.c; sourceTree = ""; }; 11C85ED50A641E6400DF3D73 /* ff_MovieImportVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ff_MovieImportVersion.h; sourceTree = ""; }; - 11C85ED60A641E6400DF3D73 /* ff_private.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ff_private.c; sourceTree = ""; }; + 11C85ED60A641E6400DF3D73 /* ff_private.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = ff_private.c; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.c; }; 11C85ED70A641E6400DF3D73 /* ff_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ff_private.h; sourceTree = ""; }; 11D4EED50A3CE7EC0066D45F /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = System/Library/Frameworks/QuickTime.framework; sourceTree = SDKROOT; }; 11D4EEFC0A3CE7FA0066D45F /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; 11D4EFA10A3CE8C10066D45F /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = ../Universal/libavcodec.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 11D4EFA20A3CE8C10066D45F /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = ../../../Users/astrange/Projects/video/Perian/DerivedData/Perian/Build/Products/Universal/libavutil.a; sourceTree = SDKROOT; }; + 11D4EFA20A3CE8C10066D45F /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = ../Universal/libavutil.a; sourceTree = BUILT_PRODUCTS_DIR; }; 11F28DAB0B52EB75000AF78C /* SUUpdateAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdateAlert.h; sourceTree = ""; }; 11F28DAC0B52EB75000AF78C /* SUUpdateAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdateAlert.m; sourceTree = ""; }; 3D0A039710068CAF0087E580 /* Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.h; sourceTree = ""; }; @@ -646,6 +645,22 @@ 3D2A136E1213D3CC002BFAEA /* KaxDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KaxDefines.h; path = libmatroska/matroska/KaxDefines.h; sourceTree = ""; }; 3D41BE8C0BCD3B330069E7C2 /* UniversalDetector.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = UniversalDetector.xcodeproj; path = UniversalDetector/UniversalDetector.xcodeproj; sourceTree = ""; }; 3D41BEBC0BCD63510069E7C2 /* UniversalDetector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = UniversalDetector.h; path = UniversalDetector/UniversalDetector.h; sourceTree = ""; }; + 3D4893DC1491ED9700E0A09D /* QD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QD.framework; path = ../../../../../System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework; sourceTree = ""; }; + 3D4893E31492DD7400E0A09D /* ACBaseCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ACBaseCodec.cpp; sourceTree = ""; }; + 3D4893E41492DD7400E0A09D /* ACBaseCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ACBaseCodec.h; sourceTree = ""; }; + 3D4893E51492DD7400E0A09D /* ACCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ACCodec.cpp; sourceTree = ""; }; + 3D4893E61492DD7400E0A09D /* ACCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ACCodec.h; sourceTree = ""; }; + 3D4893E71492DD7400E0A09D /* ACCodecDispatchTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ACCodecDispatchTypes.h; sourceTree = ""; }; + 3D4893E91492DD7400E0A09D /* ACConditionalMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ACConditionalMacros.h; sourceTree = ""; }; + 3D4893EF1492DD7400E0A09D /* GetCodecBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetCodecBundle.h; sourceTree = ""; }; + 3D4893F61492DDD700E0A09D /* GetCodecBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GetCodecBundle.cpp; path = ACPublic/GetCodecBundle.cpp; sourceTree = SOURCE_ROOT; }; + 3D4893F81492DE6A00E0A09D /* ACCompatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ACCompatibility.h; path = ACPublic/ACCompatibility.h; sourceTree = SOURCE_ROOT; }; + 3D4894071492DEBC00E0A09D /* ComponentBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComponentBase.cpp; sourceTree = ""; }; + 3D4894081492DEBC00E0A09D /* ComponentBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComponentBase.h; sourceTree = ""; }; + 3D4894331492E25700E0A09D /* CABundleLocker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CABundleLocker.cpp; sourceTree = ""; }; + 3D4894341492E25700E0A09D /* CABundleLocker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CABundleLocker.h; sourceTree = ""; }; + 3D4894771492E25700E0A09D /* CAStreamBasicDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAStreamBasicDescription.cpp; sourceTree = ""; }; + 3D4894781492E25700E0A09D /* CAStreamBasicDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAStreamBasicDescription.h; sourceTree = ""; }; 3D4A7A970B5533BC004C5D6A /* ColorConversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorConversions.h; sourceTree = ""; }; 3D4A7A980B5533BC004C5D6A /* ColorConversions.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ColorConversions.c; sourceTree = ""; }; 3D70B04A13CC187900711D41 /* KaxSemantic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KaxSemantic.h; path = libmatroska/matroska/KaxSemantic.h; sourceTree = ""; }; @@ -654,7 +669,7 @@ 3D802EC21032B9B50034BF4A /* ssa2pdf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ssa2pdf.m; path = Subtitles/ssa2pdf.m; sourceTree = ""; }; 3D802F8510336EE90034BF4A /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = ""; }; 3D95B9000E208965007C8F51 /* libbz2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbz2.dylib; path = /usr/lib/libbz2.dylib; sourceTree = ""; }; - 3DA6322312865F5400AC1962 /* FFmpegUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFmpegUtils.h; sourceTree = ""; }; + 3DA6322312865F5400AC1962 /* FFmpegUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = FFmpegUtils.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 3DA6322412865F5400AC1962 /* FFmpegUtils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = FFmpegUtils.c; sourceTree = ""; }; 3DAD08080FBF7C6F001E156F /* ssa2html */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ssa2html; sourceTree = BUILT_PRODUCTS_DIR; }; 3DAD08240FBF7DA9001E156F /* ssa2html.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ssa2html.m; path = Subtitles/ssa2html.m; sourceTree = ""; }; @@ -673,31 +688,12 @@ 3DE8D74E10444A6E0007C7E7 /* OpenerMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = OpenerMainMenu.xib; path = Opener/OpenerMainMenu.xib; sourceTree = ""; }; 3DE8D9C810444E680007C7E7 /* AppleScriptKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppleScriptKit.framework; path = /System/Library/Frameworks/AppleScriptKit.framework; sourceTree = ""; }; 3DEFA3F8120560AD0097FE4C /* libavcore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcore.a; path = ../Universal/libavcore.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 6116E5370B43C27B0020F1CE /* ACBaseCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ACBaseCodec.cpp; sourceTree = ""; }; - 6116E5380B43C27B0020F1CE /* ACBaseCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACBaseCodec.h; sourceTree = ""; }; - 6116E5390B43C27B0020F1CE /* ACCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ACCodec.cpp; sourceTree = ""; }; - 6116E53A0B43C27B0020F1CE /* ACCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACCodec.h; sourceTree = ""; }; - 6116E53B0B43C27B0020F1CE /* ACCodecDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACCodecDispatch.h; sourceTree = ""; }; - 6116E53C0B43C27B0020F1CE /* ACCodecDispatchTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACCodecDispatchTypes.h; sourceTree = ""; }; - 6116E53D0B43C27B0020F1CE /* ACConditionalMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACConditionalMacros.h; sourceTree = ""; }; - 6116E53E0B43C27B0020F1CE /* ACSimpleCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ACSimpleCodec.cpp; sourceTree = ""; }; - 6116E53F0B43C27B0020F1CE /* ACSimpleCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACSimpleCodec.h; sourceTree = ""; }; - 6116E5400B43C27B0020F1CE /* GetCodecBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GetCodecBundle.cpp; sourceTree = ""; }; - 6116E5410B43C27B0020F1CE /* GetCodecBundle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GetCodecBundle.h; sourceTree = ""; }; - 6116E5430B43C27B0020F1CE /* CABundleLocker.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CABundleLocker.cpp; sourceTree = ""; }; - 6116E5440B43C27B0020F1CE /* CABundleLocker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CABundleLocker.h; sourceTree = ""; }; - 6116E5450B43C27B0020F1CE /* CAConditionalMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAConditionalMacros.h; sourceTree = ""; }; - 6116E5460B43C27B0020F1CE /* CADebugMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CADebugMacros.cpp; sourceTree = ""; }; - 6116E5470B43C27B0020F1CE /* CADebugMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CADebugMacros.h; sourceTree = ""; }; - 6116E5480B43C27B0020F1CE /* CADebugPrintf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CADebugPrintf.h; sourceTree = ""; }; - 6116E5490B43C27B0020F1CE /* CAStreamBasicDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAStreamBasicDescription.cpp; sourceTree = ""; }; - 6116E54A0B43C27B0020F1CE /* CAStreamBasicDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAStreamBasicDescription.h; sourceTree = ""; }; 6116E54C0B43C27B0020F1CE /* FFissionCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FFissionCodec.cpp; sourceTree = ""; }; - 6116E54D0B43C27B0020F1CE /* FFissionCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FFissionCodec.h; sourceTree = ""; }; + 6116E54D0B43C27B0020F1CE /* FFissionCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = FFissionCodec.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 6116E54F0B43C27B0020F1CE /* FFissionDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FFissionDecoder.cpp; sourceTree = ""; }; 6116E5500B43C27B0020F1CE /* FFissionDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FFissionDecoder.h; sourceTree = ""; }; 6116E74E0B4738CE0020F1CE /* CodecIDs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodecIDs.h; sourceTree = ""; }; - 6123D6220AD0A3FE003EDE52 /* VobSubCodec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = VobSubCodec.c; sourceTree = ""; }; + 6123D6220AD0A3FE003EDE52 /* VobSubCodec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = VobSubCodec.c; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.c; }; 6123D6250AD0A3FF003EDE52 /* VobSubCodecDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VobSubCodecDispatch.h; sourceTree = ""; }; 613CD51A0AD1FB650098A825 /* TextSubCodec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = TextSubCodec.c; sourceTree = ""; }; 613CD51D0AD1FB650098A825 /* TextSubCodecDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextSubCodecDispatch.h; sourceTree = ""; }; @@ -803,7 +799,7 @@ 61D514DC0ADF3DBA00A671E1 /* SubImport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SubImport.h; path = Subtitles/SubImport.h; sourceTree = ""; }; 61D514DD0ADF3DBA00A671E1 /* SubImport.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = SubImport.mm; path = Subtitles/SubImport.mm; sourceTree = ""; }; 61D517710AE0402E00A671E1 /* CommonUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonUtils.h; sourceTree = ""; }; - 61D517720AE0402E00A671E1 /* CommonUtils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CommonUtils.c; sourceTree = ""; }; + 61D517720AE0402E00A671E1 /* CommonUtils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = CommonUtils.c; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.c; }; 61D6914E0AC8E382000EFC7D /* DataHandlerCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DataHandlerCallback.cpp; sourceTree = ""; }; 61D6914F0AC8E382000EFC7D /* DataHandlerCallback.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DataHandlerCallback.h; sourceTree = ""; }; 61D691500AC8E382000EFC7D /* MatroskaCodecIDs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MatroskaCodecIDs.cpp; sourceTree = ""; }; @@ -831,20 +827,20 @@ 8F483B8B0A642886002CCA73 /* PerianAviImporter.r */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.rez; path = PerianAviImporter.r; sourceTree = ""; }; 8F483BBC0A642B3D002CCA73 /* ff_MovieImportDispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ff_MovieImportDispatch.h; sourceTree = ""; }; F50E79F41014F61B00D3E6FF /* codecResources.r.m4 */ = {isa = PBXFileReference; explicitFileType = sourcecode.c; fileEncoding = 4; path = codecResources.r.m4; sourceTree = ""; }; - F50E79F51014F61B00D3E6FF /* codecID.c.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = codecID.c.m4; sourceTree = ""; }; + F50E79F51014F61B00D3E6FF /* codecID.c.m4 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; lineEnding = 0; path = codecID.c.m4; sourceTree = ""; }; F52286240B50625E00F8CF7D /* bitstream_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitstream_info.h; sourceTree = ""; }; - F52286250B50625E00F8CF7D /* bitstream_info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream_info.c; sourceTree = ""; }; + F52286250B50625E00F8CF7D /* bitstream_info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = bitstream_info.c; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.c; }; F539CD110B62BC82005A72C9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; F53E18E40B4F483C003A0471 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = ""; }; F560DECD03D61B6101ABA332 /* Components.k.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Components.k.h; sourceTree = ""; }; F560DEFE03D61C4601ABA332 /* FFusionCodecDispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFusionCodecDispatch.h; sourceTree = ""; }; - F560DF0003D61D0101ABA332 /* FFusionCodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = FFusionCodec.c; sourceTree = ""; }; - F57676040BE1A18300B2434B /* FrameBuffer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = FrameBuffer.c; sourceTree = ""; }; + F560DF0003D61D0101ABA332 /* FFusionCodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = FFusionCodec.c; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.c; }; + F57676040BE1A18300B2434B /* FrameBuffer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = FrameBuffer.c; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.c; }; F57676050BE1A18300B2434B /* FrameBuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameBuffer.h; sourceTree = ""; }; F57755F40B51EB1800C7D833 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; F59B2AB81007A0D000FAAAD8 /* PerianResources.r */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.rez; path = PerianResources.r; sourceTree = ""; }; F5BD450112171BDE0089D5FA /* CompressVideoCodecDispatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompressVideoCodecDispatch.h; sourceTree = ""; }; - F5BD450A12171C4C0089D5FA /* CompressVideoCodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CompressVideoCodec.c; sourceTree = ""; }; + F5BD450A12171C4C0089D5FA /* CompressVideoCodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; lineEnding = 0; path = CompressVideoCodec.c; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.c; }; F5BD4762121769B90089D5FA /* CompressCodecUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompressCodecUtils.h; sourceTree = ""; }; F5BD4763121769B90089D5FA /* CompressCodecUtils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CompressCodecUtils.c; sourceTree = ""; }; F5BD47DB121771960089D5FA /* CompressAudioCodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompressAudioCodec.h; sourceTree = ""; }; @@ -981,6 +977,7 @@ 089C166AFE841209C02AAC07 /* ffmpeg DivX */ = { isa = PBXGroup; children = ( + 3D4893DC1491ED9700E0A09D /* QD.framework */, 08FB77ADFE841716C02AAC07 /* Source */, 089C167CFE841241C02AAC07 /* Resources */, 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, @@ -1057,9 +1054,8 @@ F53AD5E20B2A4EC000D93AC9 /* FFMPEG */, 61D691460AC8E333000EFC7D /* Matroska */, 6123D61D0AD0A052003EDE52 /* Subtitles */, - 6116E5360B43C27B0020F1CE /* ACPublic */, - 6116E5420B43C27B0020F1CE /* CAPublicUtility */, F50E79F51014F61B00D3E6FF /* codecID.c.m4 */, + 3D4893E11492DD4D00E0A09D /* CoreAudio */, F560DECD03D61B6101ABA332 /* Components.k.h */, 113F58980A6B091600509987 /* Codecprintf.h */, 113F58990A6B091600509987 /* Codecprintf.c */, @@ -1135,46 +1131,63 @@ name = Products; sourceTree = ""; }; - 3DE8D6ED104444420007C7E7 /* Opener */ = { + 3D4893E11492DD4D00E0A09D /* CoreAudio */ = { isa = PBXGroup; children = ( - 3DE8D6EE104444420007C7E7 /* Application.applescript */, - 3DE8D6EF104444420007C7E7 /* main.m */, + 3D4893F91492DEBC00E0A09D /* AUBase */, + 3D4893E21492DD7400E0A09D /* ACPublic */, + 3D4894111492E25700E0A09D /* PublicUtility */, ); - path = Opener; + name = CoreAudio; + path = Extras/CoreAudio; + sourceTree = DEVELOPER_DIR; + }; + 3D4893E21492DD7400E0A09D /* ACPublic */ = { + isa = PBXGroup; + children = ( + 3D4893E31492DD7400E0A09D /* ACBaseCodec.cpp */, + 3D4893E41492DD7400E0A09D /* ACBaseCodec.h */, + 3D4893E51492DD7400E0A09D /* ACCodec.cpp */, + 3D4893E61492DD7400E0A09D /* ACCodec.h */, + 3D4893E71492DD7400E0A09D /* ACCodecDispatchTypes.h */, + 3D4893F81492DE6A00E0A09D /* ACCompatibility.h */, + 3D4893E91492DD7400E0A09D /* ACConditionalMacros.h */, + 3D4893F61492DDD700E0A09D /* GetCodecBundle.cpp */, + 3D4893EF1492DD7400E0A09D /* GetCodecBundle.h */, + ); + name = ACPublic; + path = AudioCodecs/ACPublic; sourceTree = ""; }; - 6116E5360B43C27B0020F1CE /* ACPublic */ = { + 3D4893F91492DEBC00E0A09D /* AUBase */ = { isa = PBXGroup; children = ( - 6116E5370B43C27B0020F1CE /* ACBaseCodec.cpp */, - 6116E5380B43C27B0020F1CE /* ACBaseCodec.h */, - 6116E5390B43C27B0020F1CE /* ACCodec.cpp */, - 6116E53A0B43C27B0020F1CE /* ACCodec.h */, - 6116E53B0B43C27B0020F1CE /* ACCodecDispatch.h */, - 6116E53C0B43C27B0020F1CE /* ACCodecDispatchTypes.h */, - 6116E53D0B43C27B0020F1CE /* ACConditionalMacros.h */, - 6116E53E0B43C27B0020F1CE /* ACSimpleCodec.cpp */, - 6116E53F0B43C27B0020F1CE /* ACSimpleCodec.h */, - 6116E5400B43C27B0020F1CE /* GetCodecBundle.cpp */, - 6116E5410B43C27B0020F1CE /* GetCodecBundle.h */, - ); - path = ACPublic; + 3D4894071492DEBC00E0A09D /* ComponentBase.cpp */, + 3D4894081492DEBC00E0A09D /* ComponentBase.h */, + ); + name = AUBase; + path = AudioUnits/AUPublic/AUBase; sourceTree = ""; }; - 6116E5420B43C27B0020F1CE /* CAPublicUtility */ = { + 3D4894111492E25700E0A09D /* PublicUtility */ = { isa = PBXGroup; children = ( - 6116E5430B43C27B0020F1CE /* CABundleLocker.cpp */, - 6116E5440B43C27B0020F1CE /* CABundleLocker.h */, - 6116E5450B43C27B0020F1CE /* CAConditionalMacros.h */, - 6116E5460B43C27B0020F1CE /* CADebugMacros.cpp */, - 6116E5470B43C27B0020F1CE /* CADebugMacros.h */, - 6116E5480B43C27B0020F1CE /* CADebugPrintf.h */, - 6116E5490B43C27B0020F1CE /* CAStreamBasicDescription.cpp */, - 6116E54A0B43C27B0020F1CE /* CAStreamBasicDescription.h */, - ); - path = CAPublicUtility; + 3D4894331492E25700E0A09D /* CABundleLocker.cpp */, + 3D4894341492E25700E0A09D /* CABundleLocker.h */, + 3D4894771492E25700E0A09D /* CAStreamBasicDescription.cpp */, + 3D4894781492E25700E0A09D /* CAStreamBasicDescription.h */, + ); + name = PublicUtility; + path = Extras/CoreAudio/PublicUtility; + sourceTree = DEVELOPER_DIR; + }; + 3DE8D6ED104444420007C7E7 /* Opener */ = { + isa = PBXGroup; + children = ( + 3DE8D6EE104444420007C7E7 /* Application.applescript */, + 3DE8D6EF104444420007C7E7 /* main.m */, + ); + path = Opener; sourceTree = ""; }; 6116E54B0B43C27B0020F1CE /* Audio Codec */ = { @@ -2001,15 +2014,8 @@ 613CD51E0AD1FB650098A825 /* TextSubCodec.c in Sources */, 61D514DE0ADF3DBA00A671E1 /* SubImport.mm in Sources */, 61D517730AE0402E00A671E1 /* CommonUtils.c in Sources */, - 6116E5510B43C27B0020F1CE /* ACBaseCodec.cpp in Sources */, - 6116E5520B43C27B0020F1CE /* ACCodec.cpp in Sources */, - 6116E5530B43C27B0020F1CE /* ACSimpleCodec.cpp in Sources */, - 6116E5570B43C27B0020F1CE /* CAStreamBasicDescription.cpp in Sources */, 6116E5580B43C27B0020F1CE /* FFissionCodec.cpp in Sources */, 6116E55A0B43C27B0020F1CE /* FFissionDecoder.cpp in Sources */, - 6116E61C0B44A5A70020F1CE /* GetCodecBundle.cpp in Sources */, - 6116E6200B44A5B30020F1CE /* CADebugMacros.cpp in Sources */, - 6116E6220B44A5BC0020F1CE /* CABundleLocker.cpp in Sources */, 61FD41330B4F6F0800BEEFEA /* MatroskaImportPrivate.cpp in Sources */, F52286260B50625E00F8CF7D /* bitstream_info.c in Sources */, 3D4A7A990B5533BC004C5D6A /* ColorConversions.c in Sources */, @@ -2022,6 +2028,12 @@ F5BD4764121769B90089D5FA /* CompressCodecUtils.c in Sources */, F5BD48FA121786C50089D5FA /* CompressAudioCodec.cpp in Sources */, 3DA6322512865F5400AC1962 /* FFmpegUtils.c in Sources */, + 3D4893F01492DD7400E0A09D /* ACBaseCodec.cpp in Sources */, + 3D4893F11492DD7400E0A09D /* ACCodec.cpp in Sources */, + 3D4893F71492DDD700E0A09D /* GetCodecBundle.cpp in Sources */, + 3D4894101492DEBC00E0A09D /* ComponentBase.cpp in Sources */, + 3D4894951492E25700E0A09D /* CABundleLocker.cpp in Sources */, + 3D4894B21492E25700E0A09D /* CAStreamBasicDescription.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2287,16 +2299,23 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; EXPORTED_SYMBOLS_FILE = "$(SOURCE_ROOT)/exportedSymbols"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks\"", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_FORCE_CPU_SUBTYPE_ALL = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Prefix.h; HEADER_SEARCH_PATHS = ( + /Developer/Extras/CoreAudio/AudioCodecs/ACPublic, "\"$(BUILT_PRODUCTS_DIR)\"/$(arch)", libmatroska, libebml, - "ffmpeg/**", + ffmpeg, "\"$(BUILT_PRODUCTS_DIR)\"", + /Developer/Extras/CoreAudio/PublicUtility, + /Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase, ); INFOPLIST_FILE = "Plists/Perian-Info.plist"; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-C"; @@ -2324,16 +2343,23 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; EXPORTED_SYMBOLS_FILE = "$(SOURCE_ROOT)/exportedSymbols"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks\"", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_FORCE_CPU_SUBTYPE_ALL = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Prefix.h; HEADER_SEARCH_PATHS = ( + /Developer/Extras/CoreAudio/AudioCodecs/ACPublic, "\"$(BUILT_PRODUCTS_DIR)\"/$(arch)", libmatroska, libebml, - "ffmpeg/**", + ffmpeg, "\"$(BUILT_PRODUCTS_DIR)\"", + /Developer/Extras/CoreAudio/PublicUtility, + /Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase, ); INFOPLIST_FILE = "Plists/Perian-Info.plist"; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-C"; @@ -2403,7 +2429,7 @@ ONLY_ACTIVE_ARCH = YES; PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; - SDKROOT = macosx10.6; + SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; STRIP_STYLE = debugging; WARNING_CFLAGS = "-Wimplicit"; @@ -2441,7 +2467,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.6; PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; - SDKROOT = macosx10.6; + SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = YES; STRIP_STYLE = debugging; WARNING_CFLAGS = "-Wimplicit"; @@ -2483,6 +2509,10 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_BIT)"; EXPORTED_SYMBOLS_FILE = "$(SOURCE_ROOT)/exportedSymbols"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks\"", + ); GCC_C_LANGUAGE_STANDARD = gnu99; GCC_FORCE_CPU_SUBTYPE_ALL = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -2491,8 +2521,11 @@ "\"$(BUILT_PRODUCTS_DIR)\"/$(arch)", libmatroska, libebml, - "ffmpeg/**", + ffmpeg, "\"$(BUILT_PRODUCTS_DIR)\"", + /Developer/Extras/CoreAudio/AudioCodecs/ACPublic, + /Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase, + /Developer/Extras/CoreAudio/PublicUtility, ); INFOPLIST_FILE = "Plists/Perian-Info.plist"; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-C"; @@ -2601,7 +2634,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.6; PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; - SDKROOT = macosx10.6; + SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; STRIP_STYLE = debugging; WARNING_CFLAGS = "-Wimplicit"; diff --git a/Perian.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Perian.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..0a95d82 --- /dev/null +++ b/Perian.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Perian.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Perian.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..08de0be --- /dev/null +++ b/Perian.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded + + + diff --git a/Perian.xcodeproj/xcshareddata/xcschemes/Debug in QuickTime Player.xcscheme b/Perian.xcodeproj/xcshareddata/xcschemes/Debug in QuickTime Player.xcscheme index c6892a9..bcabaaf 100644 --- a/Perian.xcodeproj/xcshareddata/xcschemes/Debug in QuickTime Player.xcscheme +++ b/Perian.xcodeproj/xcshareddata/xcschemes/Debug in QuickTime Player.xcscheme @@ -25,7 +25,7 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" shouldUseLaunchSchemeArgsEnv = "YES" - buildConfiguration = "Deployment+Debug"> + buildConfiguration = "Development"> @@ -39,6 +39,9 @@ buildConfiguration = "Deployment+Debug" debugDocumentVersioning = "YES" allowLocationSimulation = "YES"> + + diff --git a/Subtitles/SubImport.mm b/Subtitles/SubImport.mm index adbae73..85156a0 100644 --- a/Subtitles/SubImport.mm +++ b/Subtitles/SubImport.mm @@ -20,6 +20,7 @@ */ #include + #include "CommonUtils.h" #include "Codecprintf.h" #include "CodecIDs.h" @@ -70,10 +71,7 @@ short GetFilenameLanguage(CFStringRef filename) } static void AppendSRGBProfile(ImageDescriptionHandle imgDesc) -{ - if (!(*CGColorSpaceCopyICCProfile)) - return; //10.4 weak symbol check - +{ CGColorSpaceRef cSpace = GetSRGBColorSpace(); CFDataRef cSpaceICC = CGColorSpaceCopyICCProfile(cSpace); @@ -89,7 +87,9 @@ void SetSubtitleMediaHandlerTransparent(MediaHandler mh) { if (IsTransparentSubtitleHackEnabled()) { RGBColor blendColor = {0x0000, 0x0000, 0x0000}; - MediaSetGraphicsMode(mh, transparent, &blendColor); + + long transparentMode = 36; // formerly in QuickdrawTypes.h + MediaSetGraphicsMode(mh, transparentMode, &blendColor); } else MediaSetGraphicsMode(mh, graphicsModePreBlackAlpha, NULL); diff --git a/Subtitles/SubUtilities.m b/Subtitles/SubUtilities.m index b67f0c4..eb0540b 100644 --- a/Subtitles/SubUtilities.m +++ b/Subtitles/SubUtilities.m @@ -147,7 +147,7 @@ BOOL SubDifferentiateLatin12(const unsigned char *data, int length) Codecprintf(NULL,"Encoding %s failed, retrying.\n",[enc_str UTF8String]); enc = (enc == NSWindowsCP1252StringEncoding) ? NSWindowsCP1250StringEncoding : NSWindowsCP1252StringEncoding; res = [[[NSString alloc] initWithData:data encoding:enc] autorelease]; - if (!res) Codecprintf(NULL,"Both of latin1/2 failed.\n",[enc_str UTF8String]); + if (!res) Codecprintf(NULL,"Both of latin1/2 failed.\n"); } else Codecprintf(NULL,"Failed to load file as guessed encoding %s.\n",[enc_str UTF8String]); } [ud release]; diff --git a/VobSubCodec.c b/VobSubCodec.c index 5736843..62373be 100644 --- a/VobSubCodec.c +++ b/VobSubCodec.c @@ -18,17 +18,18 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - #include #include + +#include +#include +#include +#include +#include + #include "PerianResourceIDs.h" #include "Codecprintf.h" #include "CommonUtils.h" -#include -#include "avcodec.h" -#include "libavutil/intmath.h" -#include "libavutil/internal.h" -#include "intreadwrite.h" #include "FFmpegUtils.h" // Data structures diff --git a/bitstream_info.c b/bitstream_info.c index f206ba4..cb70b62 100644 --- a/bitstream_info.c +++ b/bitstream_info.c @@ -19,28 +19,26 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "bitstream_info.h" - #include #include -#import "ac3tab.h" -#import "CommonUtils.h" //ffmpeg's struct Picture conflicts with QuickDraw's #define Picture MPEGPICTURE -#include "avcodec.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include "bswap.h" -#include "libavutil/intmath.h" -#include "libavutil/internal.h" -#include "mpegvideo.h" -#include "parser.h" -#include "golomb.h" -#include "mpeg4video.h" -#include "mpeg4video_parser.h" +#include "CommonUtils.h" +#include "bitstream_info.h" #include "Codecprintf.h" - #include "CodecIDs.h" #undef malloc diff --git a/codecID.c.m4 b/codecID.c.m4 index d9615b9..158de1b 100644 --- a/codecID.c.m4 +++ b/codecID.c.m4 @@ -10,9 +10,10 @@ define(, )dnl dnl define(, )dnl define(, )dnl -#include "avcodec.h" -#include "CodecIDs.h" #include +#include + +#include "CodecIDs.h" #include "PerianResourceIDs.h" int getCodecID(OSType componentType) diff --git a/ff_MovieImport.c b/ff_MovieImport.c index 6e30fbe..73ccdd5 100644 --- a/ff_MovieImport.c +++ b/ff_MovieImport.c @@ -20,10 +20,11 @@ * ****************************************************************************/ +#include + #include "ff_MovieImportVersion.h" #include "ff_private.h" #include "Codecprintf.h" -#include "riff.h" #include "SubImport.h" #include "CommonUtils.h" #include "FFmpegUtils.h" diff --git a/ff_dataref.c b/ff_dataref.c index 4764175..0dead76 100644 --- a/ff_dataref.c +++ b/ff_dataref.c @@ -20,9 +20,8 @@ * ****************************************************************************/ -#include "avformat.h" - #include +#include struct _dataref_private { Handle dataRef; diff --git a/ff_private.c b/ff_private.c index 41d275d..c381e38 100644 --- a/ff_private.c +++ b/ff_private.c @@ -20,23 +20,22 @@ * ****************************************************************************/ +#include +#include +#include +#include + #include "ff_private.h" -#include "avcodec.h" #include "Codecprintf.h" #include "CommonUtils.h" #include "CodecIDs.h" #include "FFmpegUtils.h" +#include "bitstream_info.h" +#include "MatroskaCodecIDs.h" #undef malloc #undef free -#include -#include -#include - -#include "bitstream_info.h" -#include "MatroskaCodecIDs.h" - /* This function prepares the target Track to receivve the movie data, * it is called if QT has asked an import operation which should just * load this track. After success, *outmap points to a valid stream maping diff --git a/ff_private.h b/ff_private.h index daea255..dbb1d96 100644 --- a/ff_private.h +++ b/ff_private.h @@ -23,8 +23,8 @@ #ifndef __FF_PRIVATE__ #define __FF_PRIVATE__ -#include "avformat.h" #include +#include /* Data structres needed for import */ struct _NCStream {