[xiph-commits] r10322 - in trunk/xiph-qt: . AppleSDK AppleSDK/CoreAudio AppleSDK/CoreAudio/AudioCodecs AppleSDK/CoreAudio/AudioCodecs/ACPublic AppleSDK/CoreAudio/AudioUnits AppleSDK/CoreAudio/AudioUnits/AUPublic AppleSDK/CoreAudio/AudioUnits/AUPublic/AUBase AppleSDK/CoreAudio/PublicUtility CASpeex CASpeex/CASpeex.xcodeproj CASpeex/English.lproj CASpeex/build CASpeex/src CAVorbis CAVorbis/CAVorbis.xcodeproj CAVorbis/English.lproj CAVorbis/build CAVorbis/src OggImport OggImport/English.lproj OggImport/OggImport.xcodeproj OggImport/build OggImport/src common resources utils

arek at svn.xiph.org arek at svn.xiph.org
Wed Nov 2 03:23:34 PST 2005


Author: arek
Date: 2005-11-02 03:22:05 -0800 (Wed, 02 Nov 2005)
New Revision: 10322

Added:
   trunk/xiph-qt/AUTHORS
   trunk/xiph-qt/AppleSDK/
   trunk/xiph-qt/AppleSDK/CoreAudio/
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodec.h
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatch.h
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACComponentResources.r
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/AudioCodecComponentGlue.c
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioUnits/
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioUnits/AUPublic/
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioUnits/AUPublic/AUBase/
   trunk/xiph-qt/AppleSDK/CoreAudio/AudioUnits/AUPublic/AUBase/AUResources.r
   trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/
   trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CABundleLocker.cpp
   trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CABundleLocker.h
   trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAConditionalMacros.h
   trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CADebugMacros.cpp
   trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CADebugMacros.h
   trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAMath.h
   trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp
   trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAStreamBasicDescription.h
   trunk/xiph-qt/CAFLAC/
   trunk/xiph-qt/CASpeex/
   trunk/xiph-qt/CASpeex/CASpeex.xcodeproj/
   trunk/xiph-qt/CASpeex/CASpeex.xcodeproj/project.pbxproj
   trunk/xiph-qt/CASpeex/CASpeex_Prefix.pch
   trunk/xiph-qt/CASpeex/English.lproj/
   trunk/xiph-qt/CASpeex/English.lproj/InfoPlist.strings
   trunk/xiph-qt/CASpeex/Info.plist
   trunk/xiph-qt/CASpeex/PkgInfo
   trunk/xiph-qt/CASpeex/build/
   trunk/xiph-qt/CASpeex/src/
   trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.cpp
   trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.h
   trunk/xiph-qt/CASpeex/src/CASpeexCodec.exp
   trunk/xiph-qt/CASpeex/src/CASpeexDecoder.cpp
   trunk/xiph-qt/CASpeex/src/CASpeexDecoder.h
   trunk/xiph-qt/CASpeex/src/CASpeexDecoderPublic.r
   trunk/xiph-qt/CASpeex/src/speex_entrypoints.cpp
   trunk/xiph-qt/CASpeex/src/speex_versions.h
   trunk/xiph-qt/CAVorbis/
   trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj/
   trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj/project.pbxproj
   trunk/xiph-qt/CAVorbis/CAVorbis_Prefix.pch
   trunk/xiph-qt/CAVorbis/English.lproj/
   trunk/xiph-qt/CAVorbis/English.lproj/InfoPlist.strings
   trunk/xiph-qt/CAVorbis/Info.plist
   trunk/xiph-qt/CAVorbis/PkgInfo
   trunk/xiph-qt/CAVorbis/build/
   trunk/xiph-qt/CAVorbis/src/
   trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.cpp
   trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.h
   trunk/xiph-qt/CAVorbis/src/CAVorbisCodec.exp
   trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp
   trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h
   trunk/xiph-qt/CAVorbis/src/CAVorbisDecoderPublic.r
   trunk/xiph-qt/CAVorbis/src/vorbis_entrypoints.cpp
   trunk/xiph-qt/CAVorbis/src/vorbis_versions.h
   trunk/xiph-qt/COPYING
   trunk/xiph-qt/OggImport/
   trunk/xiph-qt/OggImport/COPYING.qtcomponents
   trunk/xiph-qt/OggImport/English.lproj/
   trunk/xiph-qt/OggImport/English.lproj/InfoPlist.strings
   trunk/xiph-qt/OggImport/Info.plist
   trunk/xiph-qt/OggImport/MetaDataConfig.plist
   trunk/xiph-qt/OggImport/OggImport.xcodeproj/
   trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj
   trunk/xiph-qt/OggImport/OggImport_Prefix.pch
   trunk/xiph-qt/OggImport/PkgInfo
   trunk/xiph-qt/OggImport/build/
   trunk/xiph-qt/OggImport/src/
   trunk/xiph-qt/OggImport/src/OggImport.c
   trunk/xiph-qt/OggImport/src/OggImport.exp
   trunk/xiph-qt/OggImport/src/OggImport.h
   trunk/xiph-qt/OggImport/src/OggImport.r
   trunk/xiph-qt/OggImport/src/OggImportDispatch.h
   trunk/xiph-qt/OggImport/src/common.c
   trunk/xiph-qt/OggImport/src/common.h
   trunk/xiph-qt/OggImport/src/importer_types.h
   trunk/xiph-qt/OggImport/src/rb.c
   trunk/xiph-qt/OggImport/src/rb.h
   trunk/xiph-qt/OggImport/src/stream_speex.c
   trunk/xiph-qt/OggImport/src/stream_speex.h
   trunk/xiph-qt/OggImport/src/stream_types_speex.h
   trunk/xiph-qt/OggImport/src/stream_types_vorbis.h
   trunk/xiph-qt/OggImport/src/stream_vorbis.c
   trunk/xiph-qt/OggImport/src/stream_vorbis.h
   trunk/xiph-qt/OggImport/src/versions.h
   trunk/xiph-qt/README
   trunk/xiph-qt/common/
   trunk/xiph-qt/common/XCACodec.cpp
   trunk/xiph-qt/common/XCACodec.h
   trunk/xiph-qt/common/data_types.h
   trunk/xiph-qt/common/fccs.h
   trunk/xiph-qt/resources/
   trunk/xiph-qt/resources/icon.icns
   trunk/xiph-qt/resources/icon.r
   trunk/xiph-qt/utils/
   trunk/xiph-qt/utils/debug.h
   trunk/xiph-qt/utils/ringbuffer.cpp
   trunk/xiph-qt/utils/ringbuffer.h
   trunk/xiph-qt/utils/wrap_ogg.cpp
   trunk/xiph-qt/utils/wrap_ogg.h
Log:
Initial XiphQT source code import: so far, Ogg importer and CoreAudio Vorbis and Speex decoder codecs.

Added: trunk/xiph-qt/AUTHORS
===================================================================
--- trunk/xiph-qt/AUTHORS	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AUTHORS	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1 @@
+Arek Korbik  <arkadini at gmail.com>

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,579 @@
+/*	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 <algorithm>
+#include "CABundleLocker.h"
+
+//=============================================================================
+//	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 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 = true;
+			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;
+
+		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 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<AudioStreamBasicDescription*>(outPropertyData));
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+			
+		case kAudioCodecPropertySupportedInputFormats:
+		case kAudioCodecInputFormatsForOutputFormat:
+			thePacketsToGet = ioPropertyDataSize / sizeof(AudioStreamBasicDescription);
+			GetSupportedInputFormats(reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData), thePacketsToGet);
+			ioPropertyDataSize = thePacketsToGet * sizeof(AudioStreamBasicDescription);
+			break;
+			
+		case kAudioCodecPropertyCurrentOutputFormat:
+			if(ioPropertyDataSize == sizeof(AudioStreamBasicDescription))
+			{
+				GetCurrentOutputFormat(*reinterpret_cast<AudioStreamBasicDescription*>(outPropertyData));
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+			
+		case kAudioCodecPropertySupportedOutputFormats:
+		case kAudioCodecOutputFormatsForInputFormat:
+			thePacketsToGet = ioPropertyDataSize / sizeof(AudioStreamBasicDescription);
+			GetSupportedOutputFormats(reinterpret_cast<AudioStreamBasicDescription*>(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<UInt32*>(outPropertyData) = GetInputBufferByteSize();
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+			
+		case kAudioCodecPropertyUsedInputBufferSize:
+			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+				*reinterpret_cast<UInt32*>(outPropertyData) = GetUsedInputBufferByteSize();
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+			
+		case kAudioCodecPropertyIsInitialized:
+			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+				*reinterpret_cast<UInt32*>(outPropertyData) = IsInitialized() ? 1 : 0;
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+			
+        case kAudioCodecPropertyAvailableNumberChannels:
+  			if(ioPropertyDataSize == sizeof(UInt32) * 2)
+			{
+				(reinterpret_cast<UInt32*>(outPropertyData))[0] = 1;
+				(reinterpret_cast<UInt32*>(outPropertyData))[1] = 2;
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+
+        case kAudioCodecPropertyPrimeMethod:
+  			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+				*reinterpret_cast<UInt32*>(outPropertyData) = (UInt32)kAudioCodecPrimeMethod_None;
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+
+		case kAudioCodecPropertyPrimeInfo:
+  			if(ioPropertyDataSize == sizeof(AudioCodecPrimeInfo) )
+			{
+				(reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->leadingFrames = 0;
+				(reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->trailingFrames = 0;
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+
+        case kAudioCodecUseRecommendedSampleRate:
+  			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+				*reinterpret_cast<UInt32*>(outPropertyData) = 0;
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+
+        case kAudioCodecOutputPrecedence:
+  			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+				*reinterpret_cast<UInt32*>(outPropertyData) = kAudioCodecOutputPrecedenceNone;
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+
+		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<const AudioStreamBasicDescription*>(inPropertyData));
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+			
+		case kAudioCodecPropertyCurrentOutputFormat:
+			if(inPropertyDataSize == sizeof(AudioStreamBasicDescription))
+			{
+				SetCurrentOutputFormat(*reinterpret_cast<const AudioStreamBasicDescription*>(inPropertyData));
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+			
+		case kAudioCodecPropertyMagicCookie:
+			SetMagicCookie(inPropertyData, inPropertyDataSize);
+			break;
+			
+		case kAudioCodecPropertyInputBufferSize:
+			if(inPropertyDataSize == sizeof(UInt32))
+			{
+				ReallocateInputBuffer(*reinterpret_cast<const UInt32*>(inPropertyData));
+			}
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+			
+		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:
+			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);
+	}
+}

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACBaseCodec.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,125 @@
+/*	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 <vector>
+#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<CAStreamBasicDescription>	FormatList;
+	
+	FormatList						mInputFormatList;
+	CAStreamBasicDescription		mInputFormat;
+	
+	FormatList						mOutputFormatList;
+	CAStreamBasicDescription		mOutputFormat;
+
+};
+
+#endif

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodec.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,69 @@
+/*	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;
+}

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodec.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodec.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodec.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,97 @@
+/*	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 <AudioUnit/AudioCodec.h>
+#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<ComponentResult>(err)
+
+#endif

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatch.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatch.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatch.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,267 @@
+/*	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 <class CodecClass>
+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

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACCodecDispatchTypes.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,254 @@
+/*	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

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACComponentResources.r
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACComponentResources.r	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACComponentResources.r	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,192 @@
+/*	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.
+*/
+/*=============================================================================
+	ACComponentResources.r
+
+=============================================================================*/
+
+#ifndef GEN_MISSING
+	#define GEN_MISSING 0
+#endif
+
+#ifndef thng_RezTemplateVersion
+	#define thng_RezTemplateVersion	2
+#endif
+
+//=============================================================================
+//	Includes
+//=============================================================================
+
+#include "ConditionalMacros.r"
+#include "MacTypes.r"
+#include "Components.r"
+
+//=============================================================================
+//	Platform constants for the thng resources
+//=============================================================================
+
+#if	TARGET_OS_MAC && TARGET_API_MAC_OSX
+	#define Target_PlatformType		1000
+	#define Target_CodeResType		'dlle'
+	#define kUseDLLEResource		1
+#elif TARGET_OS_WIN32
+	#define Target_PlatformType      platformWin32
+	#define Target_CodeResType		'dlle'
+	#define kUseDLLEResource		1
+#else
+	#define Target_PlatformType		platformPowerPC
+	#define Target_CodeResType		'tppc'
+	#define kUseDLLEResource		0
+#endif
+
+#if kComponentIsThreadSafe
+	#ifndef cmpThreadSafeOnMac	// so we don't need Panther headers to build
+		#define cmpThreadSafeOnMac	0x10000000
+	#endif
+	#define COMPONENT_FLAGS		cmpThreadSafeOnMac
+#else
+	#define COMPONENT_FLAGS		0
+#endif
+
+//=============================================================================
+//	The thng and related resources
+//
+//	The definitions below use the following macros, all of which must be
+//	defined. Note that kPrimaryResourceID is used to define two 'STR '
+//	resources with consecutive IDs so be sure to space them at least two'
+//	apart. Here's a sample of how to do the defines:
+//	
+//	#define kPrimaryResourceID				128
+//	#define kComponentType					'aenc'
+//	#define kComponentSubtype				'ima4'
+//	#define kComponentManufacturer			'appl'
+//	#define	kComponentFlags					0
+//	#define kComponentVersion				0x00010000
+//	#define kComponentName					"Apple IMA4 Encoder"
+//	#define kComponentInfo					"An AudioCodec that encodes linear PCM data into IMA4"
+//	#define kComponentEntryPoint			"ACAppleIMA4EncoderEntry"
+//	#define	kComponentPublicResourceMapType	0
+//	#define kComponentIsThreadSafe			1
+//=============================================================================
+
+#ifndef AC_LOCALIZED
+resource 'strn' (kPrimaryResourceID, purgeable)
+{
+	kComponentName
+};
+
+resource 'stri' (kPrimaryResourceID, purgeable)
+{
+	kComponentInfo
+};
+#endif
+
+#if !GEN_MISSING
+
+#if kUseDLLEResource
+
+	resource 'dlle' (kPrimaryResourceID)
+	{
+		kComponentEntryPoint
+	};
+
+#endif
+
+#define kComponentRegistrationFlags	componentHasMultiplePlatforms | componentDoAutoVersion | componentLoadResident
+resource 'thng' (kPrimaryResourceID, kComponentName)
+{
+	kComponentType,											//	Component type
+	kComponentSubtype,										//	Component subtype
+	kComponentManufacturer,									//	Component manufacturer
+	kComponentFlags,										//	Component flags
+	0,														//	Component flags mask
+	0, 0,													//	Code type, Code ID
+	'strn',	kPrimaryResourceID,								//	Name resource type, resource ID
+	'stri',	kPrimaryResourceID,								//	Info resource type, resource ID
+	0, 0,													//	Icon resource type, resource ID
+	kComponentVersion,										//	Component version
+	kComponentRegistrationFlags,							//	Registration flags
+	0,														//	Icon family resource ID
+	{														//	Beginning of platform info
+		COMPONENT_FLAGS,									//	Component flags
+		Target_CodeResType, kPrimaryResourceID,				//	Code resource type, resource ID
+		Target_PlatformType,								//	Platform type
+	},
+#if thng_RezTemplateVersion >= 2
+	kComponentPublicResourceMapType, kPrimaryResourceID		//	Resource map type, resource map ID
+#endif	
+};
+
+#else	//	GEN_MISSING
+
+resource 'thga' (kPrimaryResourceID) {
+	kComponentType,											//	Component type
+	kComponentSubtype,										//	Component subtype
+	kComponentManufacturer,									//	Component manufacturer
+	kComponentFlags,										//	Component flags
+	0,														//	Component flags mask
+	0, 0,													//	Code type, Code ID
+	'strn',	kPrimaryResourceID,								//	Name resource type, resource ID
+	'stri',	kPrimaryResourceID,								//	Info resource type, resource ID
+	0, 0,													//	Icon resource type, resource ID
+	'miss',													//	Alias component type
+	'base',													//	Alias component subtype
+	0,														//	Alias component manufacturer
+	0,														//	Alias component flags
+	0,														//	Alias component flags mask
+#if thng_RezTemplateVersion >= 2
+	kComponentPublicResourceMapType, kPrimaryResourceID,	//	Resource map type, resource map ID
+	cmpAliasNoFlags											//	Alias flags	
+#endif
+};
+
+#endif	//	GEN_MISSING
+
+#undef kPrimaryResourceID
+#undef kComponentType
+#undef kComponentSubtype
+#undef kComponentManufacturer
+#undef kComponentVersion
+#undef kComponentRegistrationFlags
+#undef kComponentName
+#undef kComponentInfo
+#undef kComponentEntryPoint
+#undef kComponentPublicResourceMapType
+#undef Target_PlatformType
+#undef Target_CodeResType
+#undef kUseDLLEResource

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/ACConditionalMacros.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,68 @@
+/*	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 <CoreServices/../Frameworks/CarbonCore.framework/Headers/ConditionalMacros.h>
+#else
+	#include "ConditionalMacros.h"
+#endif
+
+#endif

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,70 @@
+/*	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.cpp
+
+
+ *  Created by James McCartney on Thu Apr 10 2003.
+=============================================================================*/
+
+#include "GetCodecBundle.h"
+
+#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
+
+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);
+		}
+	}
+	return sAudioCodecBundle;
+}
+

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/ACPublic/GetCodecBundle.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,62 @@
+/*	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 <TargetConditionals.h>
+
+#if TARGET_OS_MAC
+
+#include <CoreServices/CoreServices.h>
+
+#else
+
+#include "CFBundle.h"
+
+#endif
+
+CFBundleRef GetCodecBundle();
+
+#endif

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/AudioCodecComponentGlue.c
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/AudioCodecComponentGlue.c	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioCodecs/AudioCodecComponentGlue.c	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,273 @@
+/*	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.
+*/
+/*=============================================================================
+	AudioCodecComponentGlue.c
+
+=============================================================================*/
+
+//=============================================================================
+//	Includes
+//=============================================================================
+
+#include <AudioUnit/AudioCodec.h>
+#include "ACCodecDispatchTypes.h"
+
+#if	!TARGET_OS_MAC || !TARGET_RT_MAC_MACHO
+	#include <MixedMode.h>
+	#if MP_SUPPORT
+		#include "MPMixedModeSupport.h"
+	#endif
+#endif
+
+DEFINE_API(ComponentResult)
+AudioCodecGetPropertyInfo(	AudioCodec				inCodec,
+							AudioCodecPropertyID	inPropertyID,
+							UInt32*					outSize,
+							Boolean*				outWritable)
+{
+	AudioCodecGetPropertyInfoGluePB myAudioCodecGetPropertyInfoGluePB;
+	myAudioCodecGetPropertyInfoGluePB.componentFlags = 0;
+	myAudioCodecGetPropertyInfoGluePB.componentParamSize = 12;
+	myAudioCodecGetPropertyInfoGluePB.componentWhat = kAudioCodecGetPropertyInfoSelect;
+	
+	#if	!TARGET_OS_WIN32
+		myAudioCodecGetPropertyInfoGluePB.inCodec = inCodec;
+	#endif
+	
+	myAudioCodecGetPropertyInfoGluePB.outWritable = outWritable;
+	myAudioCodecGetPropertyInfoGluePB.outSize = outSize;
+	myAudioCodecGetPropertyInfoGluePB.inPropertyID = inPropertyID;
+
+	#if TARGET_API_MAC_OS8
+		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myAudioCodecGetPropertyInfoGluePB);
+	#elif TARGET_API_MAC_OSX
+		return (ComponentResult)CallComponentDispatch((ComponentParameters*)&myAudioCodecGetPropertyInfoGluePB);
+	#else
+		return (ComponentResult)CallComponent(inCodec, (ComponentParameters*)&myAudioCodecGetPropertyInfoGluePB);
+	#endif
+}
+
+DEFINE_API(ComponentResult)
+AudioCodecGetProperty(	AudioCodec				inCodec,
+						AudioCodecPropertyID	inPropertyID,
+						UInt32*					ioPropertyDataSize,
+						void*					outPropertyData)
+{
+	AudioCodecGetPropertyGluePB myAudioCodecGetPropertyGluePB;
+	myAudioCodecGetPropertyGluePB.componentFlags = 0;
+	myAudioCodecGetPropertyGluePB.componentParamSize = 12;
+	myAudioCodecGetPropertyGluePB.componentWhat = kAudioCodecGetPropertySelect;
+	
+	#if	!TARGET_OS_WIN32
+		myAudioCodecGetPropertyGluePB.inCodec = inCodec;
+	#endif
+	
+	myAudioCodecGetPropertyGluePB.outPropertyData = outPropertyData;
+	myAudioCodecGetPropertyGluePB.ioPropertyDataSize = ioPropertyDataSize;
+	myAudioCodecGetPropertyGluePB.inPropertyID = inPropertyID;
+
+	#if TARGET_API_MAC_OS8
+		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myAudioCodecGetPropertyGluePB);
+	#elif TARGET_API_MAC_OSX
+		return (ComponentResult)CallComponentDispatch((ComponentParameters*)&myAudioCodecGetPropertyGluePB);
+	#else
+		return (ComponentResult)CallComponent(inCodec, (ComponentParameters*)&myAudioCodecGetPropertyGluePB);
+	#endif
+}
+
+DEFINE_API(ComponentResult)
+AudioCodecSetProperty(	AudioCodec				inCodec,
+						AudioCodecPropertyID	inPropertyID,
+						UInt32					inPropertyDataSize,
+						const void*				inPropertyData)
+{
+	AudioCodecSetPropertyGluePB myAudioCodecSetPropertyGluePB;
+	myAudioCodecSetPropertyGluePB.componentFlags = 0;
+	myAudioCodecSetPropertyGluePB.componentParamSize = 12;
+	myAudioCodecSetPropertyGluePB.componentWhat = kAudioCodecSetPropertySelect;
+	
+	#if	!TARGET_OS_WIN32
+		myAudioCodecSetPropertyGluePB.inCodec = inCodec;
+	#endif
+	
+	myAudioCodecSetPropertyGluePB.inPropertyData = inPropertyData;
+	myAudioCodecSetPropertyGluePB.inPropertyDataSize = inPropertyDataSize;
+	myAudioCodecSetPropertyGluePB.inPropertyID = inPropertyID;
+
+	#if TARGET_API_MAC_OS8
+		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myAudioCodecSetPropertyGluePB);
+	#elif TARGET_API_MAC_OSX
+		return (ComponentResult)CallComponentDispatch((ComponentParameters*)&myAudioCodecSetPropertyGluePB);
+	#else
+		return (ComponentResult)CallComponent(inCodec, (ComponentParameters*)&myAudioCodecSetPropertyGluePB);
+	#endif
+}
+
+DEFINE_API(ComponentResult)
+AudioCodecInitialize(	AudioCodec							inCodec,
+						const AudioStreamBasicDescription*	inInputFormat,
+						const AudioStreamBasicDescription*	inOutputFormat,
+						const void*							inMagicCookie,
+						UInt32								inMagicCookieByteSize)
+{
+	AudioCodecInitializeGluePB myAudioCodecInitializeGluePB;
+	myAudioCodecInitializeGluePB.componentFlags = 0;
+	myAudioCodecInitializeGluePB.componentParamSize = 16;
+	myAudioCodecInitializeGluePB.componentWhat = kAudioCodecInitializeSelect;
+	
+	#if	!TARGET_OS_WIN32
+		myAudioCodecInitializeGluePB.inCodec = inCodec;
+	#endif
+	
+	myAudioCodecInitializeGluePB.inMagicCookieByteSize = inMagicCookieByteSize;
+	myAudioCodecInitializeGluePB.inMagicCookie = inMagicCookie;
+	myAudioCodecInitializeGluePB.inOutputFormat = inOutputFormat;
+	myAudioCodecInitializeGluePB.inInputFormat = inInputFormat;
+
+	#if TARGET_API_MAC_OS8
+		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myAudioCodecInitializeGluePB);
+	#elif TARGET_API_MAC_OSX
+		return (ComponentResult)CallComponentDispatch((ComponentParameters*)&myAudioCodecInitializeGluePB);
+	#else
+		return (ComponentResult)CallComponent(inCodec, (ComponentParameters*)&myAudioCodecInitializeGluePB);
+	#endif
+}
+
+DEFINE_API(ComponentResult)
+AudioCodecUninitialize(AudioCodec inCodec)
+{
+	AudioCodecUninitializeGluePB myAudioCodecUninitializeGluePB;
+	myAudioCodecUninitializeGluePB.componentFlags = 0;
+	myAudioCodecUninitializeGluePB.componentParamSize = 0;
+	myAudioCodecUninitializeGluePB.componentWhat = kAudioCodecUninitializeSelect;
+	
+	#if	!TARGET_OS_WIN32
+		myAudioCodecUninitializeGluePB.inCodec = inCodec;
+	#endif
+
+	#if TARGET_API_MAC_OS8
+		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myAudioCodecUninitializeGluePB);
+	#elif TARGET_API_MAC_OSX
+		return (ComponentResult)CallComponentDispatch((ComponentParameters*)&myAudioCodecUninitializeGluePB);
+	#else
+		return (ComponentResult)CallComponent(inCodec, (ComponentParameters*)&myAudioCodecUninitializeGluePB);
+	#endif
+}
+
+DEFINE_API(ComponentResult)
+AudioCodecAppendInputData(	AudioCodec							inCodec,
+							const void*							inInputData,
+							UInt32*								ioInputDataByteSize,
+							UInt32*								ioNumberPackets,
+							const AudioStreamPacketDescription*	inPacketDescription)
+{
+	AudioCodecAppendInputDataGluePB myAudioCodecAppendInputDataGluePB;
+	myAudioCodecAppendInputDataGluePB.componentFlags = 0;
+	myAudioCodecAppendInputDataGluePB.componentParamSize = 16;
+	myAudioCodecAppendInputDataGluePB.componentWhat = kAudioCodecAppendInputDataSelect;
+	
+	#if	!TARGET_OS_WIN32
+		myAudioCodecAppendInputDataGluePB.inCodec = inCodec;
+	#endif
+	
+	myAudioCodecAppendInputDataGluePB.inPacketDescription = inPacketDescription;
+	myAudioCodecAppendInputDataGluePB.ioNumberPackets = ioNumberPackets;
+	myAudioCodecAppendInputDataGluePB.ioInputDataByteSize = ioInputDataByteSize;
+	myAudioCodecAppendInputDataGluePB.inInputData = inInputData;
+
+	#if TARGET_API_MAC_OS8
+		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myAudioCodecAppendInputDataGluePB);
+	#elif TARGET_API_MAC_OSX
+		return (ComponentResult)CallComponentDispatch((ComponentParameters*)&myAudioCodecAppendInputDataGluePB);
+	#else
+		return (ComponentResult)CallComponent(inCodec, (ComponentParameters*)&myAudioCodecAppendInputDataGluePB);
+	#endif
+}
+
+DEFINE_API(ComponentResult)
+AudioCodecProduceOutputPackets(	AudioCodec						inCodec,
+								void*							outOutputData,
+								UInt32*							ioOutputDataByteSize,
+								UInt32*							ioNumberPackets,
+								AudioStreamPacketDescription*	outPacketDescription,
+								UInt32*							outStatus)
+{
+	AudioCodecProduceOutputPacketsGluePB myAudioCodecProduceOutputPacketsGluePB;
+	myAudioCodecProduceOutputPacketsGluePB.componentFlags = 0;
+	myAudioCodecProduceOutputPacketsGluePB.componentParamSize = 20;
+	myAudioCodecProduceOutputPacketsGluePB.componentWhat = kAudioCodecProduceOutputDataSelect;
+	
+	#if	!TARGET_OS_WIN32
+		myAudioCodecProduceOutputPacketsGluePB.inCodec = inCodec;
+	#endif
+	
+	myAudioCodecProduceOutputPacketsGluePB.outStatus = outStatus;
+	myAudioCodecProduceOutputPacketsGluePB.outPacketDescription = outPacketDescription;
+	myAudioCodecProduceOutputPacketsGluePB.ioNumberPackets = ioNumberPackets;
+	myAudioCodecProduceOutputPacketsGluePB.ioOutputDataByteSize = ioOutputDataByteSize;
+	myAudioCodecProduceOutputPacketsGluePB.outOutputData = outOutputData;
+
+	#if TARGET_API_MAC_OS8
+		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myAudioCodecProduceOutputPacketsGluePB);
+	#elif TARGET_API_MAC_OSX
+		return (ComponentResult)CallComponentDispatch((ComponentParameters*)&myAudioCodecProduceOutputPacketsGluePB);
+	#else
+		return (ComponentResult)CallComponent(inCodec, (ComponentParameters*)&myAudioCodecProduceOutputPacketsGluePB);
+	#endif
+}
+
+DEFINE_API(ComponentResult)
+AudioCodecReset(AudioCodec inCodec)
+{
+	AudioCodecResetGluePB myAudioCodecResetGluePB;
+	myAudioCodecResetGluePB.componentFlags = 0;
+	myAudioCodecResetGluePB.componentParamSize = 0;
+	myAudioCodecResetGluePB.componentWhat = kAudioCodecResetSelect;
+	
+	#if	!TARGET_OS_WIN32
+		myAudioCodecResetGluePB.inCodec = inCodec;
+	#endif
+
+	#if TARGET_API_MAC_OS8
+		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myAudioCodecResetGluePB);
+	#elif TARGET_API_MAC_OSX
+		return (ComponentResult)CallComponentDispatch((ComponentParameters*)&myAudioCodecResetGluePB);
+	#else
+		return (ComponentResult)CallComponent(inCodec, (ComponentParameters*)&myAudioCodecResetGluePB);
+	#endif
+}

Added: trunk/xiph-qt/AppleSDK/CoreAudio/AudioUnits/AUPublic/AUBase/AUResources.r
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/AudioUnits/AUPublic/AUBase/AUResources.r	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/AudioUnits/AUPublic/AUBase/AUResources.r	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,144 @@
+/*	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.
+*/
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//	AUResources.r
+//
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//	AUResources.r
+//
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+/* sample macro definitions -- all of these symbols must be defined
+#define RES_ID			kHALOutputResID
+#define COMP_TYPE		kAudioUnitComponentType
+#define COMP_SUBTYPE	kAudioUnitOutputSubType
+#define COMP_MANUF		kAudioUnitAudioHardwareOutputSubSubType
+#define VERSION			0x00010000
+#define NAME			"AudioHALOutput"
+#define DESCRIPTION		"Audio hardware output AudioUnit"
+#define ENTRY_POINT		"AUHALEntry"
+*/
+#define UseExtendedThingResource 1
+
+#include <CoreServices/CoreServices.r>
+
+// this is a define used to indicate that a component has no static data that would mean 
+// that no more than one instance could be open at a time - never been true for AUs
+#ifndef cmpThreadSafeOnMac
+#define cmpThreadSafeOnMac	0x10000000
+#endif
+
+// define these based on the kind of build you want to generate.
+// BOTH symbols must be defined for rez to work with the defines below.
+#if !defined(TARGET_REZ_MAC_PPC)
+	#define TARGET_REZ_MAC_PPC 1
+#endif
+
+#if !defined(TARGET_REZ_MAC_X86)
+	#define TARGET_REZ_MAC_X86 1
+#endif
+
+#if TARGET_OS_MAC
+	#if TARGET_REZ_MAC_PPC && TARGET_REZ_MAC_X86
+		#define TARGET_REZ_FAT_COMPONENTS	1
+		#define Target_PlatformType			platformPowerPCNativeEntryPoint
+		#define Target_SecondPlatformType	platformIA32NativeEntryPoint
+	#elif TARGET_REZ_MAC_X86
+		#define Target_PlatformType			platformIA32NativeEntryPoint
+	#else
+		#define Target_PlatformType			platformPowerPCNativeEntryPoint
+	#endif
+	#define Target_CodeResType		'dlle'
+	#define TARGET_REZ_USE_DLLE		1
+#else
+	#error get a real platform type
+#endif // not TARGET_OS_MAC
+
+#if !defined(TARGET_REZ_FAT_COMPONENTS)
+  #define TARGET_REZ_FAT_COMPONENTS			0
+#endif
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+resource 'STR ' (RES_ID, purgeable) {
+	NAME
+};
+
+resource 'STR ' (RES_ID + 1, purgeable) {
+	DESCRIPTION
+};
+
+resource 'dlle' (RES_ID) {
+	ENTRY_POINT
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+resource 'thng' (RES_ID, NAME) {
+	COMP_TYPE,
+	COMP_SUBTYPE,
+	COMP_MANUF,
+	0, 0, 0, 0,								//	no 68K
+	'STR ',	RES_ID,
+	'STR ',	RES_ID + 1,
+	0,	0,			/* icon */
+	VERSION,
+	componentHasMultiplePlatforms | componentDoAutoVersion,
+	0,
+	{
+		cmpThreadSafeOnMac, 
+		Target_CodeResType, RES_ID,
+		Target_PlatformType,
+#if TARGET_REZ_FAT_COMPONENTS
+		cmpThreadSafeOnMac, 
+		Target_CodeResType, RES_ID,
+		Target_SecondPlatformType,
+#endif
+	}
+};
+
+#undef RES_ID
+#undef COMP_TYPE
+#undef COMP_SUBTYPE
+#undef COMP_MANUF
+#undef VERSION
+#undef NAME
+#undef DESCRIPTION
+#undef ENTRY_POINT

Added: trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CABundleLocker.cpp
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CABundleLocker.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CABundleLocker.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,84 @@
+/*	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 <pthread.h>
+
+/*
+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);
+}
+

Added: trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CABundleLocker.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CABundleLocker.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CABundleLocker.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,69 @@
+/*	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

Added: trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAConditionalMacros.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAConditionalMacros.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAConditionalMacros.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,74 @@
+/*	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 <CoreServices/../Frameworks/CarbonCore.framework/Headers/ConditionalMacros.h>
+#else
+	#include "ConditionalMacros.h"
+#endif
+
+#endif

Added: trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CADebugMacros.cpp
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CADebugMacros.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CADebugMacros.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,84 @@
+/*	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 <stdio.h>
+#include <stdarg.h>
+#if TARGET_API_MAC_OSX
+	#include <syslog.h>
+#endif
+
+#if DEBUG
+#include <stdio.h>
+
+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

Added: trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CADebugMacros.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CADebugMacros.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CADebugMacros.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,414 @@
+/*	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 <pthread.h>
+			#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

Added: trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAMath.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAMath.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAMath.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,64 @@
+/*	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.
+*/
+/*=============================================================================
+	CAMath.h
+	
+=============================================================================*/
+
+#ifndef __CAMath_h__
+#define __CAMath_h__
+
+#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
+	#include <CoreAudio/CoreAudioTypes.h>
+#else
+	#include <CoreAudioTypes.h>
+#endif
+
+inline bool fiszero(Float64 f) { return (f == 0.); }
+inline bool fiszero(Float32 f) { return (f == 0.f); }
+
+inline bool fnonzero(Float64 f) { return !fiszero(f); }
+inline bool fnonzero(Float32 f) { return !fiszero(f); }
+
+inline bool fequal(const Float64 &a, const Float64 &b) { return a == b; }
+inline bool fequal(const Float32 &a, const Float32 &b) { return a == b; }
+
+inline bool fnotequal(const Float64 &a, const Float64 &b) { return !fequal(a, b); }
+inline bool fnotequal(const Float32 &a, const Float32 &b) { return !fequal(a, b); }
+
+#endif // __CAMath_h__

Added: trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAStreamBasicDescription.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,518 @@
+/*	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.cpp
+ 
+=============================================================================*/
+
+#include "CAConditionalMacros.h"
+
+#include "CAStreamBasicDescription.h"
+#include "CAMath.h"
+
+#if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
+	#include <CoreServices/CoreServices.h>
+#else
+	#include <Endian.h>
+#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 (wordSize > 0 && 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 = (wordSize > 0 && 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 if (mFormatID == kAudioFormatAppleLossless) {
+		int sourceBits = 0;
+		switch (mFormatFlags)
+		{
+			case kAppleLosslessFormatFlag_16BitSourceData:
+				sourceBits = 16;
+				break;
+    		case kAppleLosslessFormatFlag_20BitSourceData:
+    			sourceBits = 20;
+    			break;
+    		case kAppleLosslessFormatFlag_24BitSourceData:
+    			sourceBits = 24;
+    			break;
+    		case kAppleLosslessFormatFlag_32BitSourceData:
+    			sourceBits = 32;
+    			break;
+		}
+		if (sourceBits)
+			fprintf(f, "from %d-bit source, ", sourceBits);
+		else
+			fprintf(f, "from UNKNOWN source bit depth, ");
+			
+		fprintf(f, "%ld frames/packet\n", mFramesPerPacket);
+	}
+	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)
+{
+	//  the only thing that changes is to make mixable linear PCM into the canonical linear PCM format
+	if((ioDescription.mFormatID == kAudioFormatLinearPCM) && ((ioDescription.mFormatFlags & kIsNonMixableFlag) == 0))
+	{
+		//  the canonical linear PCM format is 32 bit native endian floats
+		ioDescription.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+		ioDescription.mBytesPerPacket = sizeof(Float32) * ioDescription.mChannelsPerFrame;
+		ioDescription.mFramesPerPacket = 1;
+		ioDescription.mBytesPerFrame = sizeof(Float32) * ioDescription.mChannelsPerFrame;
+		ioDescription.mBitsPerChannel = 8 * sizeof(Float32);
+	}
+}
+
+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(fiszero(ioDescription.mSampleRate))
+	{
+		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";
+					}
+				}
+				
+				const char* theMixabilityString = NULL;
+				if((inDescription.mFormatFlags & kIsNonMixableFlag) == 0)
+				{
+					theMixabilityString = "Mixable";
+				}
+				else
+				{
+					theMixabilityString = "Unmixable";
+				}
+				
+				if(inAbbreviate)
+				{
+					if(theEndianString != NULL)
+					{
+						if(thePackingString != NULL)
+						{
+							sprintf(outName, "%s %d Ch %s %s %s%d/%s%d", theMixabilityString, (int)inDescription.mChannelsPerFrame, theEndianString, thePackingString, theKindString, (int)inDescription.mBitsPerChannel, theKindString, (int)(inDescription.mBytesPerFrame / inDescription.mChannelsPerFrame) * 8);
+						}
+						else
+						{
+							sprintf(outName, "%s %d Ch %s %s%d", theMixabilityString, (int)inDescription.mChannelsPerFrame, theEndianString, theKindString, (int)inDescription.mBitsPerChannel);
+						}
+					}
+					else
+					{
+						if(thePackingString != NULL)
+						{
+							sprintf(outName, "%s %d Ch %s %s%d/%s%d", theMixabilityString, (int)inDescription.mChannelsPerFrame, thePackingString, theKindString, (int)inDescription.mBitsPerChannel, theKindString, (int)((inDescription.mBytesPerFrame / inDescription.mChannelsPerFrame) * 8));
+						}
+						else
+						{
+							sprintf(outName, "%s %d Ch %s%d", theMixabilityString, (int)inDescription.mChannelsPerFrame, theKindString, (int)inDescription.mBitsPerChannel);
+						}
+					}
+				}
+				else
+				{
+					if(theEndianString != NULL)
+					{
+						if(thePackingString != NULL)
+						{
+							sprintf(outName, "%s %d Channel %d Bit %s %s Aligned %s in %d Bits", theMixabilityString, (int)inDescription.mChannelsPerFrame, (int)inDescription.mBitsPerChannel, theEndianString, theKindString, thePackingString, (int)(inDescription.mBytesPerFrame / inDescription.mChannelsPerFrame) * 8);
+						}
+						else
+						{
+							sprintf(outName, "%s %d Channel %d Bit %s %s", theMixabilityString, (int)inDescription.mChannelsPerFrame, (int)inDescription.mBitsPerChannel, theEndianString, theKindString);
+						}
+					}
+					else
+					{
+						if(thePackingString != NULL)
+						{
+							sprintf(outName, "%s %d Channel %d Bit %s Aligned %s in %d Bits", theMixabilityString, (int)inDescription.mChannelsPerFrame, (int)inDescription.mBitsPerChannel, theKindString, thePackingString, (int)(inDescription.mBytesPerFrame / inDescription.mChannelsPerFrame) * 8);
+						}
+						else
+						{
+							sprintf(outName, "%s %d Channel %d Bit %s", theMixabilityString, (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;
+		}
+	}
+	
+	
+	//  mixable is always better than non-mixable for linear PCM and should be the second order sort item
+	if((!isDone) && ((x.mFormatID == kAudioFormatLinearPCM) && (y.mFormatID == kAudioFormatLinearPCM)))
+	{
+		if(((x.mFormatFlags & kIsNonMixableFlag) == 0) && ((y.mFormatFlags & kIsNonMixableFlag) != 0))
+		{
+			theAnswer = true;
+			isDone = true;
+		}
+		else if(((x.mFormatFlags & kIsNonMixableFlag) != 0) && ((y.mFormatFlags & kIsNonMixableFlag) == 0))
+		{
+			theAnswer = false;
+			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) && fnonzero(x.mSampleRate) && fnonzero(y.mSampleRate))
+	{
+		if(fnotequal(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;
+		}
+		
+		//	if the number of channels is 0 or 1, we don't care about non-interleavedness
+		if (x.mChannelsPerFrame <= 1 && y.mChannelsPerFrame <= 1) {
+			xFlags &= ~kLinearPCMFormatFlagIsNonInterleaved;
+			yFlags &= ~kLinearPCMFormatFlagIsNonInterleaved;
+		}
+	}
+	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
+		(fiszero(x.mSampleRate) || fiszero(y.mSampleRate) || fequal(x.mSampleRate, y.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.);
+}

Added: trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAStreamBasicDescription.h
===================================================================
--- trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAStreamBasicDescription.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/AppleSDK/CoreAudio/PublicUtility/CAStreamBasicDescription.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,220 @@
+/*	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 <CoreAudio/CoreAudioTypes.h>
+	#include <CoreFoundation/CoreFoundation.h>
+#else
+	#include "CoreAudioTypes.h"
+	#include "CoreFoundation.h"
+#endif
+
+#include "CADebugMacros.h"
+#include <string.h>	// for memset, memcpy
+#include <stdio.h>	// for FILE *
+
+//  temporarily define a place holder for kAudioFormatFlagIsNonMixable since the constant
+//  isn't on all Panther systems
+#pragma mark	this needs to be removed eventually
+enum { kIsNonMixableFlag = (1L << 6) };
+
+//=============================================================================
+//	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__


Property changes on: trunk/xiph-qt/CASpeex/CASpeex.xcodeproj
___________________________________________________________________
Name: svn:ignore
   + *.mode*
*.pbxuser


Added: trunk/xiph-qt/CASpeex/CASpeex.xcodeproj/project.pbxproj
===================================================================
--- trunk/xiph-qt/CASpeex/CASpeex.xcodeproj/project.pbxproj	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/CASpeex.xcodeproj/project.pbxproj	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,540 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 42;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		736FE585090DAFD800BC8DCC /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 736FE584090DAFD800BC8DCC /* Ogg.framework */; };
+		737447C009112E05006D2F02 /* wrap_ogg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737447BE09112E05006D2F02 /* wrap_ogg.cpp */; };
+		73814BBB0908014700C478FC /* Speex.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73814BBA0908014700C478FC /* Speex.framework */; };
+		73814BE30908018800C478FC /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73814BE20908018800C478FC /* AudioUnit.framework */; };
+		73814BF10908027600C478FC /* CASpeexDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814BE70908027600C478FC /* CASpeexDecoder.cpp */; };
+		73814BF20908027600C478FC /* speex_entrypoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814BEB0908027600C478FC /* speex_entrypoints.cpp */; };
+		73814BF30908027600C478FC /* XCACodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814BED0908027600C478FC /* XCACodec.cpp */; };
+		73814C180908039E00C478FC /* ACBaseCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814C000908039E00C478FC /* ACBaseCodec.cpp */; };
+		73814C190908039E00C478FC /* ACCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814C020908039E00C478FC /* ACCodec.cpp */; };
+		73814C1A0908039E00C478FC /* GetCodecBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814C080908039E00C478FC /* GetCodecBundle.cpp */; };
+		73814C1B0908039E00C478FC /* AudioCodecComponentGlue.c in Sources */ = {isa = PBXBuildFile; fileRef = 73814C0A0908039E00C478FC /* AudioCodecComponentGlue.c */; };
+		73814C1C0908039E00C478FC /* CABundleLocker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814C100908039E00C478FC /* CABundleLocker.cpp */; };
+		73814C1D0908039E00C478FC /* CADebugMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814C130908039E00C478FC /* CADebugMacros.cpp */; };
+		73814C1E0908039E00C478FC /* CAStreamBasicDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814C160908039E00C478FC /* CAStreamBasicDescription.cpp */; };
+		73814C25090803C600C478FC /* ringbuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73814C22090803C600C478FC /* ringbuffer.cpp */; };
+		73814C300908060E00C478FC /* PkgInfo in CopyFiles */ = {isa = PBXBuildFile; fileRef = 73814BF70908034600C478FC /* PkgInfo */; };
+		7398ABEE090A7F2F0003F1A2 /* CASpeexDecoderPublic.r in Rez */ = {isa = PBXBuildFile; fileRef = 73814BEA0908027600C478FC /* CASpeexDecoderPublic.r */; };
+		73E8B293090D4E6E00686EE5 /* CAOggSpeexDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 73E8B291090D4E6E00686EE5 /* CAOggSpeexDecoder.cpp */; };
+		8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
+		8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXBuildStyle section */
+		4F9091AC011F3BD104CA0E50 /* Development */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4F9091AD011F3BD104CA0E50 /* Deployment */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+/* End PBXBuildStyle section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		73814C2D090805DF00C478FC /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = Contents;
+			dstSubfolderSpec = 1;
+			files = (
+				73814C300908060E00C478FC /* PkgInfo in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+		32BAE0B30371A71500C91783 /* CASpeex_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CASpeex_Prefix.pch; sourceTree = "<group>"; };
+		730DC2AE09086D3B00B7BB6A /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = "<group>"; };
+		736FE584090DAFD800BC8DCC /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = /Library/Frameworks/Ogg.framework; sourceTree = "<absolute>"; };
+		737447470911261B006D2F02 /* fccs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fccs.h; path = ../common/fccs.h; sourceTree = SOURCE_ROOT; };
+		737447BD09112E05006D2F02 /* wrap_ogg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wrap_ogg.h; sourceTree = "<group>"; };
+		737447BE09112E05006D2F02 /* wrap_ogg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_ogg.cpp; sourceTree = "<group>"; };
+		73814BBA0908014700C478FC /* Speex.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Speex.framework; path = /Library/Frameworks/Speex.framework; sourceTree = "<absolute>"; };
+		73814BE20908018800C478FC /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
+		73814BE60908027600C478FC /* CASpeexCodec.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; name = CASpeexCodec.exp; path = src/CASpeexCodec.exp; sourceTree = "<group>"; };
+		73814BE70908027600C478FC /* CASpeexDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CASpeexDecoder.cpp; path = src/CASpeexDecoder.cpp; sourceTree = "<group>"; };
+		73814BE80908027600C478FC /* CASpeexDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CASpeexDecoder.h; path = src/CASpeexDecoder.h; sourceTree = "<group>"; };
+		73814BEA0908027600C478FC /* CASpeexDecoderPublic.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = CASpeexDecoderPublic.r; path = src/CASpeexDecoderPublic.r; sourceTree = "<group>"; };
+		73814BEB0908027600C478FC /* speex_entrypoints.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = speex_entrypoints.cpp; path = src/speex_entrypoints.cpp; sourceTree = "<group>"; };
+		73814BEC0908027600C478FC /* speex_versions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = speex_versions.h; path = src/speex_versions.h; sourceTree = "<group>"; };
+		73814BED0908027600C478FC /* XCACodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = XCACodec.cpp; path = ../common/XCACodec.cpp; sourceTree = "<group>"; };
+		73814BEE0908027600C478FC /* XCACodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = XCACodec.h; path = ../common/XCACodec.h; sourceTree = "<group>"; };
+		73814BF4090802F600C478FC /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = icon.icns; path = ../resources/icon.icns; sourceTree = SOURCE_ROOT; };
+		73814BF5090802F600C478FC /* icon.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = icon.r; path = ../resources/icon.r; sourceTree = SOURCE_ROOT; };
+		73814BF70908034600C478FC /* PkgInfo */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = PkgInfo; sourceTree = "<group>"; };
+		73814C000908039E00C478FC /* ACBaseCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ACBaseCodec.cpp; sourceTree = "<group>"; };
+		73814C010908039E00C478FC /* ACBaseCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACBaseCodec.h; sourceTree = "<group>"; };
+		73814C020908039E00C478FC /* ACCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ACCodec.cpp; sourceTree = "<group>"; };
+		73814C030908039E00C478FC /* ACCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACCodec.h; sourceTree = "<group>"; };
+		73814C040908039E00C478FC /* ACCodecDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACCodecDispatch.h; sourceTree = "<group>"; };
+		73814C050908039E00C478FC /* ACCodecDispatchTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACCodecDispatchTypes.h; sourceTree = "<group>"; };
+		73814C060908039E00C478FC /* ACComponentResources.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = ACComponentResources.r; sourceTree = "<group>"; };
+		73814C070908039E00C478FC /* ACConditionalMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACConditionalMacros.h; sourceTree = "<group>"; };
+		73814C080908039E00C478FC /* GetCodecBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GetCodecBundle.cpp; sourceTree = "<group>"; };
+		73814C090908039E00C478FC /* GetCodecBundle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GetCodecBundle.h; sourceTree = "<group>"; };
+		73814C0A0908039E00C478FC /* AudioCodecComponentGlue.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = AudioCodecComponentGlue.c; sourceTree = "<group>"; };
+		73814C0E0908039E00C478FC /* AUResources.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = AUResources.r; sourceTree = "<group>"; };
+		73814C100908039E00C478FC /* CABundleLocker.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CABundleLocker.cpp; sourceTree = "<group>"; };
+		73814C110908039E00C478FC /* CABundleLocker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CABundleLocker.h; sourceTree = "<group>"; };
+		73814C120908039E00C478FC /* CAConditionalMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAConditionalMacros.h; sourceTree = "<group>"; };
+		73814C130908039E00C478FC /* CADebugMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CADebugMacros.cpp; sourceTree = "<group>"; };
+		73814C140908039E00C478FC /* CADebugMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CADebugMacros.h; sourceTree = "<group>"; };
+		73814C150908039E00C478FC /* CAMath.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAMath.h; sourceTree = "<group>"; };
+		73814C160908039E00C478FC /* CAStreamBasicDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAStreamBasicDescription.cpp; sourceTree = "<group>"; };
+		73814C170908039E00C478FC /* CAStreamBasicDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAStreamBasicDescription.h; sourceTree = "<group>"; };
+		73814C22090803C600C478FC /* ringbuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ringbuffer.cpp; sourceTree = "<group>"; };
+		73814C23090803C600C478FC /* ringbuffer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ringbuffer.h; sourceTree = "<group>"; };
+		73E8B252090D3C6B00686EE5 /* data_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = data_types.h; path = ../common/data_types.h; sourceTree = SOURCE_ROOT; };
+		73E8B290090D4E6E00686EE5 /* CAOggSpeexDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CAOggSpeexDecoder.h; path = src/CAOggSpeexDecoder.h; sourceTree = "<group>"; };
+		73E8B291090D4E6E00686EE5 /* CAOggSpeexDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CAOggSpeexDecoder.cpp; path = src/CAOggSpeexDecoder.cpp; sourceTree = "<group>"; };
+		8D01CCD10486CAD60068D4B7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+		8D01CCD20486CAD60068D4B7 /* CASpeex.component */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CASpeex.component; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		8D01CCCD0486CAD60068D4B7 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */,
+				73814BBB0908014700C478FC /* Speex.framework in Frameworks */,
+				73814BE30908018800C478FC /* AudioUnit.framework in Frameworks */,
+				736FE585090DAFD800BC8DCC /* Ogg.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		089C166AFE841209C02AAC07 /* CASpeex */ = {
+			isa = PBXGroup;
+			children = (
+				08FB77ADFE841716C02AAC07 /* Source */,
+				089C167CFE841241C02AAC07 /* Resources */,
+				73814BFA0908037D00C478FC /* External Source */,
+				089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
+				19C28FB4FE9D528D11CA2CBB /* Products */,
+			);
+			name = CASpeex;
+			sourceTree = "<group>";
+		};
+		089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				736FE584090DAFD800BC8DCC /* Ogg.framework */,
+				73814BBA0908014700C478FC /* Speex.framework */,
+				73814BE20908018800C478FC /* AudioUnit.framework */,
+				08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */,
+			);
+			name = "External Frameworks and Libraries";
+			sourceTree = "<group>";
+		};
+		089C167CFE841241C02AAC07 /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+				73814BF70908034600C478FC /* PkgInfo */,
+				73814BF4090802F600C478FC /* icon.icns */,
+				73814BF5090802F600C478FC /* icon.r */,
+				73814BEA0908027600C478FC /* CASpeexDecoderPublic.r */,
+				8D01CCD10486CAD60068D4B7 /* Info.plist */,
+				089C167DFE841241C02AAC07 /* InfoPlist.strings */,
+			);
+			name = Resources;
+			sourceTree = "<group>";
+		};
+		08FB77ADFE841716C02AAC07 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				73E8B252090D3C6B00686EE5 /* data_types.h */,
+				73814BE60908027600C478FC /* CASpeexCodec.exp */,
+				73814BE70908027600C478FC /* CASpeexDecoder.cpp */,
+				73814BE80908027600C478FC /* CASpeexDecoder.h */,
+				73814BEB0908027600C478FC /* speex_entrypoints.cpp */,
+				73814BEC0908027600C478FC /* speex_versions.h */,
+				73814BED0908027600C478FC /* XCACodec.cpp */,
+				73814BEE0908027600C478FC /* XCACodec.h */,
+				32BAE0B30371A71500C91783 /* CASpeex_Prefix.pch */,
+				73E8B290090D4E6E00686EE5 /* CAOggSpeexDecoder.h */,
+				73E8B291090D4E6E00686EE5 /* CAOggSpeexDecoder.cpp */,
+				737447470911261B006D2F02 /* fccs.h */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		19C28FB4FE9D528D11CA2CBB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				8D01CCD20486CAD60068D4B7 /* CASpeex.component */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		73814BFA0908037D00C478FC /* External Source */ = {
+			isa = PBXGroup;
+			children = (
+				73814BFC0908039E00C478FC /* AppleSDK */,
+				73814C1F090803C600C478FC /* utils */,
+			);
+			name = "External Source";
+			sourceTree = "<group>";
+		};
+		73814BFC0908039E00C478FC /* AppleSDK */ = {
+			isa = PBXGroup;
+			children = (
+				73814BFD0908039E00C478FC /* CoreAudio */,
+			);
+			name = AppleSDK;
+			path = ../AppleSDK;
+			sourceTree = SOURCE_ROOT;
+		};
+		73814BFD0908039E00C478FC /* CoreAudio */ = {
+			isa = PBXGroup;
+			children = (
+				73814BFE0908039E00C478FC /* AudioCodecs */,
+				73814C0B0908039E00C478FC /* AudioUnits */,
+				73814C0F0908039E00C478FC /* PublicUtility */,
+			);
+			path = CoreAudio;
+			sourceTree = "<group>";
+		};
+		73814BFE0908039E00C478FC /* AudioCodecs */ = {
+			isa = PBXGroup;
+			children = (
+				73814BFF0908039E00C478FC /* ACPublic */,
+				73814C0A0908039E00C478FC /* AudioCodecComponentGlue.c */,
+			);
+			path = AudioCodecs;
+			sourceTree = "<group>";
+		};
+		73814BFF0908039E00C478FC /* ACPublic */ = {
+			isa = PBXGroup;
+			children = (
+				73814C000908039E00C478FC /* ACBaseCodec.cpp */,
+				73814C010908039E00C478FC /* ACBaseCodec.h */,
+				73814C020908039E00C478FC /* ACCodec.cpp */,
+				73814C030908039E00C478FC /* ACCodec.h */,
+				73814C040908039E00C478FC /* ACCodecDispatch.h */,
+				73814C050908039E00C478FC /* ACCodecDispatchTypes.h */,
+				73814C060908039E00C478FC /* ACComponentResources.r */,
+				73814C070908039E00C478FC /* ACConditionalMacros.h */,
+				73814C080908039E00C478FC /* GetCodecBundle.cpp */,
+				73814C090908039E00C478FC /* GetCodecBundle.h */,
+			);
+			path = ACPublic;
+			sourceTree = "<group>";
+		};
+		73814C0B0908039E00C478FC /* AudioUnits */ = {
+			isa = PBXGroup;
+			children = (
+				73814C0C0908039E00C478FC /* AUPublic */,
+			);
+			path = AudioUnits;
+			sourceTree = "<group>";
+		};
+		73814C0C0908039E00C478FC /* AUPublic */ = {
+			isa = PBXGroup;
+			children = (
+				73814C0D0908039E00C478FC /* AUBase */,
+			);
+			path = AUPublic;
+			sourceTree = "<group>";
+		};
+		73814C0D0908039E00C478FC /* AUBase */ = {
+			isa = PBXGroup;
+			children = (
+				73814C0E0908039E00C478FC /* AUResources.r */,
+			);
+			path = AUBase;
+			sourceTree = "<group>";
+		};
+		73814C0F0908039E00C478FC /* PublicUtility */ = {
+			isa = PBXGroup;
+			children = (
+				73814C100908039E00C478FC /* CABundleLocker.cpp */,
+				73814C110908039E00C478FC /* CABundleLocker.h */,
+				73814C120908039E00C478FC /* CAConditionalMacros.h */,
+				73814C130908039E00C478FC /* CADebugMacros.cpp */,
+				73814C140908039E00C478FC /* CADebugMacros.h */,
+				73814C150908039E00C478FC /* CAMath.h */,
+				73814C160908039E00C478FC /* CAStreamBasicDescription.cpp */,
+				73814C170908039E00C478FC /* CAStreamBasicDescription.h */,
+			);
+			path = PublicUtility;
+			sourceTree = "<group>";
+		};
+		73814C1F090803C600C478FC /* utils */ = {
+			isa = PBXGroup;
+			children = (
+				737447BD09112E05006D2F02 /* wrap_ogg.h */,
+				737447BE09112E05006D2F02 /* wrap_ogg.cpp */,
+				73814C22090803C600C478FC /* ringbuffer.cpp */,
+				73814C23090803C600C478FC /* ringbuffer.h */,
+				730DC2AE09086D3B00B7BB6A /* debug.h */,
+			);
+			name = utils;
+			path = ../utils;
+			sourceTree = SOURCE_ROOT;
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		8D01CCC60486CAD60068D4B7 /* CASpeex */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 73814AA00907F9EC00C478FC /* Build configuration list for PBXNativeTarget "CASpeex" */;
+			buildPhases = (
+				8D01CCC90486CAD60068D4B7 /* Resources */,
+				8D01CCCB0486CAD60068D4B7 /* Sources */,
+				8D01CCCD0486CAD60068D4B7 /* Frameworks */,
+				73814C260908053200C478FC /* Rez */,
+				73814C2D090805DF00C478FC /* CopyFiles */,
+				73814C310908064E00C478FC /* ShellScript */,
+			);
+			buildRules = (
+			);
+			buildSettings = {
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = CASpeex_Prefix.pch;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Bundles";
+				PRODUCT_NAME = CASpeex;
+				WRAPPER_EXTENSION = bundle;
+			};
+			dependencies = (
+			);
+			name = CASpeex;
+			productInstallPath = "$(HOME)/Library/Bundles";
+			productName = CASpeex;
+			productReference = 8D01CCD20486CAD60068D4B7 /* CASpeex.component */;
+			productType = "com.apple.product-type.bundle";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		089C1669FE841209C02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 73814AA40907F9EC00C478FC /* Build configuration list for PBXProject "CASpeex" */;
+			buildSettings = {
+			};
+			buildStyles = (
+				4F9091AC011F3BD104CA0E50 /* Development */,
+				4F9091AD011F3BD104CA0E50 /* Deployment */,
+			);
+			hasScannedForEncodings = 1;
+			mainGroup = 089C166AFE841209C02AAC07 /* CASpeex */;
+			projectDirPath = "";
+			targets = (
+				8D01CCC60486CAD60068D4B7 /* CASpeex */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		8D01CCC90486CAD60068D4B7 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+		73814C260908053200C478FC /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				7398ABEE090A7F2F0003F1A2 /* CASpeexDecoderPublic.r in Rez */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		73814C310908064E00C478FC /* ShellScript */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+				../resources/icon.r,
+				../resources/icon.icns,
+			);
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "cd ../resources\n${SYSTEM_DEVELOPER_TOOLS}/Rez -o \"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\"/$'Icon\\x0D' icon.r\n${SYSTEM_DEVELOPER_TOOLS}/SetFile -a CE \"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\"";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		8D01CCCB0486CAD60068D4B7 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				73814BF10908027600C478FC /* CASpeexDecoder.cpp in Sources */,
+				73814BF20908027600C478FC /* speex_entrypoints.cpp in Sources */,
+				73814BF30908027600C478FC /* XCACodec.cpp in Sources */,
+				73814C180908039E00C478FC /* ACBaseCodec.cpp in Sources */,
+				73814C190908039E00C478FC /* ACCodec.cpp in Sources */,
+				73814C1A0908039E00C478FC /* GetCodecBundle.cpp in Sources */,
+				73814C1B0908039E00C478FC /* AudioCodecComponentGlue.c in Sources */,
+				73814C1C0908039E00C478FC /* CABundleLocker.cpp in Sources */,
+				73814C1D0908039E00C478FC /* CADebugMacros.cpp in Sources */,
+				73814C1E0908039E00C478FC /* CAStreamBasicDescription.cpp in Sources */,
+				73814C25090803C600C478FC /* ringbuffer.cpp in Sources */,
+				73E8B293090D4E6E00686EE5 /* CAOggSpeexDecoder.cpp in Sources */,
+				737447C009112E05006D2F02 /* wrap_ogg.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+		089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				089C167EFE841241C02AAC07 /* English */,
+			);
+			name = InfoPlist.strings;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+		73814AA10907F9EC00C478FC /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				EXPORTED_SYMBOLS_FILE = src/CASpeexCodec.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = CASpeex_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Components";
+				OTHER_CFLAGS = "-Wall";
+				PRODUCT_NAME = CASpeex;
+				WRAPPER_EXTENSION = component;
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		73814AA20907F9EC00C478FC /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				EXPORTED_SYMBOLS_FILE = src/CASpeexCodec.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = CASpeex_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					__MACOSX__,
+					NDEBUG,
+				);
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Components";
+				PRODUCT_NAME = CASpeex;
+				WRAPPER_EXTENSION = component;
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		73814AA30907F9EC00C478FC /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXPORTED_SYMBOLS_FILE = src/CASpeexCodec.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = CASpeex_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Components";
+				PRODUCT_NAME = CASpeex;
+				WRAPPER_EXTENSION = component;
+			};
+			name = Default;
+		};
+		73814AA50907F9EC00C478FC /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				OTHER_REZFLAGS = "-D TARGET_REZ_MAC_PPC=1";
+			};
+			name = Development;
+		};
+		73814AA60907F9EC00C478FC /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				OTHER_REZFLAGS = "-D TARGET_REZ_MAC_PPC=1";
+			};
+			name = Deployment;
+		};
+		73814AA70907F9EC00C478FC /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				OTHER_REZFLAGS = "-D TARGET_REZ_MAC_PPC=1";
+			};
+			name = Default;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		73814AA00907F9EC00C478FC /* Build configuration list for PBXNativeTarget "CASpeex" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				73814AA10907F9EC00C478FC /* Development */,
+				73814AA20907F9EC00C478FC /* Deployment */,
+				73814AA30907F9EC00C478FC /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		73814AA40907F9EC00C478FC /* Build configuration list for PBXProject "CASpeex" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				73814AA50907F9EC00C478FC /* Development */,
+				73814AA60907F9EC00C478FC /* Deployment */,
+				73814AA70907F9EC00C478FC /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 089C1669FE841209C02AAC07 /* Project object */;
+}

Added: trunk/xiph-qt/CASpeex/CASpeex_Prefix.pch
===================================================================
--- trunk/xiph-qt/CASpeex/CASpeex_Prefix.pch	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/CASpeex_Prefix.pch	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,5 @@
+//
+// Prefix header for all source files of the 'CASpeex' target in the 'CASpeex' project.
+//
+
+#include <Carbon/Carbon.h>

Added: trunk/xiph-qt/CASpeex/English.lproj/InfoPlist.strings
===================================================================
(Binary files differ)


Property changes on: trunk/xiph-qt/CASpeex/English.lproj/InfoPlist.strings
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/xiph-qt/CASpeex/Info.plist
===================================================================
--- trunk/xiph-qt/CASpeex/Info.plist	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/Info.plist	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>CASpeex</string>
+	<key>CFBundleIconFile</key>
+	<string></string>
+	<key>CFBundleIdentifier</key>
+	<string>net.barelyfocused.xiph.caspeex</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>0.1.1</string>
+	<key>CFBundleSignature</key>
+	<string>adec</string>
+	<key>CFBundleVersion</key>
+	<string>0.1.1</string>
+	<key>CSResourcesFileMapped</key>
+	<true/>
+</dict>
+</plist>

Added: trunk/xiph-qt/CASpeex/PkgInfo
===================================================================
--- trunk/xiph-qt/CASpeex/PkgInfo	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/PkgInfo	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1 @@
+thngadec
\ No newline at end of file


Property changes on: trunk/xiph-qt/CASpeex/build
___________________________________________________________________
Name: svn:ignore
   + *


Added: trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.cpp
===================================================================
--- trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,256 @@
+/*
+ *  CAOggSpeexDecoder.cpp
+ *
+ *    CAOggSpeexDecoder class implementation; translation layer handling
+ *    ogg page encapsulation of Speex packets, using CASpeexDecoder
+ *    for the actual decoding.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "CAOggSpeexDecoder.h"
+
+#include "fccs.h"
+#include "data_types.h"
+
+#include "wrap_ogg.h"
+
+#include "debug.h"
+
+
+CAOggSpeexDecoder::CAOggSpeexDecoder() :
+CASpeexDecoder(true),
+mO_st(), mFramesBufferedList()
+{
+    CAStreamBasicDescription theInputFormat(kAudioStreamAnyRate, kAudioFormatXiphOggFramedSpeex,
+                                            kSpeexBytesPerPacket, kSpeexFramesPerPacket,
+                                            kSpeexBytesPerFrame, kSpeexChannelsPerFrame,
+                                            kSpeexBitsPerChannel, kSpeexFormatFlags);
+    AddInputFormat(theInputFormat);
+    
+    mInputFormat.mSampleRate = 44100;
+    mInputFormat.mFormatID = kAudioFormatXiphOggFramedSpeex;
+    mInputFormat.mFormatFlags = kSpeexFormatFlags;
+    mInputFormat.mBytesPerPacket = kSpeexBytesPerPacket;
+    mInputFormat.mFramesPerPacket = kSpeexFramesPerPacket;
+    mInputFormat.mBytesPerFrame = kSpeexBytesPerFrame;
+    mInputFormat.mChannelsPerFrame = 2;
+    mInputFormat.mBitsPerChannel = 16;
+    
+    CAStreamBasicDescription theOutputFormat1(kAudioStreamAnyRate, kAudioFormatLinearPCM, 0, 1, 0, 0, 16,
+                                              kAudioFormatFlagsNativeEndian |
+                                              kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked);
+    AddOutputFormat(theOutputFormat1);
+    CAStreamBasicDescription theOutputFormat2(kAudioStreamAnyRate, kAudioFormatLinearPCM, 0, 1, 0, 0, 32,
+                                              kAudioFormatFlagsNativeFloatPacked);
+    AddOutputFormat(theOutputFormat2);
+    
+    mOutputFormat.mSampleRate = 44100;
+	mOutputFormat.mFormatID = kAudioFormatLinearPCM;
+	mOutputFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+	mOutputFormat.mBytesPerPacket = 8;
+	mOutputFormat.mFramesPerPacket = 1;
+	mOutputFormat.mBytesPerFrame = 8;
+	mOutputFormat.mChannelsPerFrame = 2;
+	mOutputFormat.mBitsPerChannel = 32;
+}
+
+CAOggSpeexDecoder::~CAOggSpeexDecoder()
+{
+    if (mCompressionInitialized)
+        ogg_stream_clear(&mO_st);
+}
+
+void CAOggSpeexDecoder::SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat)
+{
+	if (!mIsInitialized) {
+		//	check to make sure the input format is legal
+		if (inInputFormat.mFormatID != kAudioFormatXiphOggFramedSpeex) {
+			dprintf("CASpeexDecoder::SetFormats: only supports Xiph Speex (Ogg-framed)for input\n");
+			CODEC_THROW(kAudioCodecUnsupportedFormatError);
+		}
+		
+		//	tell our base class about the new format
+		XCACodec::SetCurrentInputFormat(inInputFormat);
+	} else {
+		CODEC_THROW(kAudioCodecStateError);
+	}
+}
+
+UInt32 CAOggSpeexDecoder::ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
+                                               AudioStreamPacketDescription* outPacketDescription)
+{
+    if (mFramesBufferedList.empty()) {
+        ioOutputDataByteSize = 0;
+        ioNumberPackets = 0;
+        return kAudioCodecProduceOutputPacketNeedsMoreInputData;
+    }
+
+    UInt32 ret = kAudioCodecProduceOutputPacketSuccess;
+    UInt32 speex_packets = mFramesBufferedList.front();
+    UInt32 ogg_packets = 0;
+    UInt32 speex_returned_data = ioOutputDataByteSize;
+    UInt32 speex_total_returned_data = 0;
+    Byte *the_data = static_cast<Byte*> (outOutputData);
+
+    while (true) {
+        UInt32 speex_return = CASpeexDecoder::ProduceOutputPackets(the_data, speex_returned_data, speex_packets, NULL);
+        if (speex_return == kAudioCodecProduceOutputPacketSuccess || speex_return == kAudioCodecProduceOutputPacketSuccessHasMore) {
+            if (speex_packets > 0)
+                mFramesBufferedList.front() -= speex_packets;
+
+            if (mFramesBufferedList.front() <= 0) {
+                ogg_packets++;
+                mFramesBufferedList.erase(mFramesBufferedList.begin());
+            }
+            
+            speex_total_returned_data += speex_returned_data;
+
+            if (speex_total_returned_data == ioOutputDataByteSize || speex_return == kAudioCodecProduceOutputPacketSuccess)
+            {
+                ioNumberPackets = ogg_packets;
+                ioOutputDataByteSize = speex_total_returned_data;
+
+                if (!mFramesBufferedList.empty())
+                    ret = kAudioCodecProduceOutputPacketSuccessHasMore;
+                else
+                    ret = kAudioCodecProduceOutputPacketSuccess;
+
+                break;
+            } else {
+                the_data += speex_returned_data;
+                speex_returned_data = ioOutputDataByteSize - speex_total_returned_data;
+                speex_packets = mFramesBufferedList.front();
+            }
+        } else {
+            ret = kAudioCodecProduceOutputPacketFailure;
+            ioOutputDataByteSize = speex_total_returned_data;
+            ioNumberPackets = ogg_packets;
+        }
+    }
+    return ret;
+}
+
+
+void CAOggSpeexDecoder::BDCInitialize(UInt32 inInputBufferByteSize)
+{
+    CASpeexDecoder::BDCInitialize(inInputBufferByteSize);
+}
+
+void CAOggSpeexDecoder::BDCUninitialize()
+{
+    mFramesBufferedList.clear();
+    CASpeexDecoder::BDCUninitialize();
+}
+
+void CAOggSpeexDecoder::BDCReset()
+{
+    mFramesBufferedList.clear();
+    if (mCompressionInitialized)
+        ogg_stream_reset(&mO_st);
+    CASpeexDecoder::BDCReset();
+}
+
+void CAOggSpeexDecoder::BDCReallocate(UInt32 inInputBufferByteSize)
+{
+    mFramesBufferedList.clear();
+    CASpeexDecoder::BDCReallocate(inInputBufferByteSize);
+}
+
+
+void CAOggSpeexDecoder::InPacket(const void* inInputData, const AudioStreamPacketDescription* inPacketDescription)
+{
+    if (!mCompressionInitialized)
+        CODEC_THROW(kAudioCodecUnspecifiedError);
+    
+    ogg_page op;
+
+    if (!WrapOggPage(&op, inInputData, inPacketDescription->mDataByteSize, inPacketDescription->mStartOffset))
+        CODEC_THROW(kAudioCodecUnspecifiedError);
+
+    ogg_packet opk;
+    UInt32 packet_count = 0;
+    int oret;
+    AudioStreamPacketDescription speex_packet_desc = {0, mSpeexHeader.frame_size, 0};
+    UInt32 page_packets = ogg_page_packets(&op);
+    SInt32 packet_length_adjust = 0;
+
+    if (mSpeexHeader.frame_size != 0 && mSpeexHeader.frames_per_packet != 0) {
+        if (mSpeexHeader.frame_size * mSpeexHeader.frames_per_packet * page_packets != inPacketDescription->mVariableFramesInPacket) {
+            packet_length_adjust = mSpeexHeader.frame_size * mSpeexHeader.frames_per_packet * page_packets - inPacketDescription->mVariableFramesInPacket;
+            if (ogg_page_eos(&op)) {
+                if  (packet_length_adjust > mSpeexHeader.frame_size) {
+                    page_packets -= packet_length_adjust / mSpeexHeader.frame_size;
+                    packet_length_adjust = packet_length_adjust % mSpeexHeader.frame_size;
+                }
+                packet_length_adjust = -packet_length_adjust;
+            }
+        }
+    }
+
+    ogg_stream_pagein(&mO_st, &op);
+    while ((oret = ogg_stream_packetout(&mO_st, &opk)) != 0) {
+        if (oret < 0) {
+            page_packets--;
+            if (packet_length_adjust > 0)
+                packet_length_adjust = 0;
+            continue;
+        }
+        
+        packet_count++;
+
+        speex_packet_desc.mDataByteSize = opk.bytes;
+        speex_packet_desc.mVariableFramesInPacket = mSpeexHeader.frame_size;
+        if (packet_count == 1 && packet_length_adjust > 0) {
+            speex_packet_desc.mVariableFramesInPacket -= packet_length_adjust;
+            packet_length_adjust = 0;
+        } else if (packet_count == page_packets && packet_length_adjust < 0) {
+            speex_packet_desc.mVariableFramesInPacket = - speex_packet_desc.mVariableFramesInPacket - packet_length_adjust;
+        }
+
+        CASpeexDecoder::InPacket(opk.packet, &speex_packet_desc);
+    }
+
+    mFramesBufferedList.push_back(packet_count);
+}
+
+
+void CAOggSpeexDecoder::InitializeCompressionSettings()
+{
+    if (mCookie != NULL) {
+        if (mCompressionInitialized)
+            ogg_stream_clear(&mO_st);
+
+        OggSerialNoAtom *atom = reinterpret_cast<OggSerialNoAtom*> (mCookie);
+    
+        if (EndianS32_BtoN(atom->type) == kCookieTypeOggSerialNo && (mCookieSize - EndianS32_BtoN(atom->size) >= 0)) {
+            ogg_stream_init(&mO_st, EndianS32_BtoN(atom->serialno));
+        }
+    }
+
+    ogg_stream_reset(&mO_st);
+
+    CASpeexDecoder::InitializeCompressionSettings();
+}


Property changes on: trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.cpp
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.h
===================================================================
--- trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,70 @@
+/*
+ *  CAOggSpeexDecoder.h
+ *
+ *    CAOggSpeexDecoder class definition.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__CAOggSpeexDecoder_h__)
+#define __CAOggSpeexDecoder_h__
+
+#include <Ogg/ogg.h>
+#include <vector>
+
+#include "CASpeexDecoder.h"
+
+#include "CAStreamBasicDescription.h"
+
+
+class CAOggSpeexDecoder :
+public CASpeexDecoder
+{
+public:
+    CAOggSpeexDecoder();
+    virtual ~CAOggSpeexDecoder();
+
+    virtual void			SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat);
+    
+    virtual UInt32			ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
+                                                 AudioStreamPacketDescription* outPacketDescription);
+
+protected:
+    virtual void			BDCInitialize(UInt32 inInputBufferByteSize);
+    virtual void			BDCUninitialize();
+    virtual void			BDCReset();
+    virtual void			BDCReallocate(UInt32 inInputBufferByteSize);
+
+    virtual void			InPacket(const void* inInputData, const AudioStreamPacketDescription* inPacketDescription);
+    
+    void					InitializeCompressionSettings();
+
+    ogg_stream_state		mO_st;
+    std::vector<SInt32>		mFramesBufferedList;
+};
+
+
+
+#endif /* __CAOggSpeexDecoder_h__ */


Property changes on: trunk/xiph-qt/CASpeex/src/CAOggSpeexDecoder.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CASpeex/src/CASpeexCodec.exp
===================================================================
--- trunk/xiph-qt/CASpeex/src/CASpeexCodec.exp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/src/CASpeexCodec.exp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,2 @@
+_CASpeexDecoderEntry
+_CAOggSpeexDecoderEntry

Added: trunk/xiph-qt/CASpeex/src/CASpeexDecoder.cpp
===================================================================
--- trunk/xiph-qt/CASpeex/src/CASpeexDecoder.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/src/CASpeexDecoder.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,559 @@
+/*
+ *  CASpeexDecoder.cpp
+ *
+ *    CASpeexDecoder class implementation; the main part of the Speex
+ *    codec functionality.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include <Ogg/ogg.h>
+#include <Speex/speex_callbacks.h>
+
+#include "CASpeexDecoder.h"
+
+#include "CABundleLocker.h"
+
+#include "speex_versions.h"
+#include "fccs.h"
+#include "data_types.h"
+
+//#define NDEBUG
+#include "debug.h"
+
+CASpeexDecoder::CASpeexDecoder(Boolean inSkipFormatsInitialization /* = false */) :
+mCookie(NULL), mCookieSize(0), mCompressionInitialized(false),
+mOutBuffer(NULL), mOutBufferSize(0), mOutBufferUsedSize(0), mOutBufferStart(0),
+mSpeexFPList(),
+mNumFrames(0),
+mSpeexDecoderState(NULL)
+{
+    mSpeexStereoState.balance = 1.0;
+    mSpeexStereoState.e_ratio = 0.5;
+    mSpeexStereoState.smooth_left = 1.0;
+    mSpeexStereoState.smooth_right = 1.0;
+
+    if (inSkipFormatsInitialization)
+        return;
+    
+    CAStreamBasicDescription theInputFormat(kAudioStreamAnyRate, kAudioFormatXiphSpeex,
+                                            kSpeexBytesPerPacket, kSpeexFramesPerPacket,
+                                            kSpeexBytesPerFrame, kSpeexChannelsPerFrame,
+                                            kSpeexBitsPerChannel, kSpeexFormatFlags);
+    AddInputFormat(theInputFormat);
+
+    mInputFormat.mSampleRate = 44100;
+    mInputFormat.mFormatID = kAudioFormatXiphSpeex;
+    mInputFormat.mFormatFlags = kSpeexFormatFlags;
+    mInputFormat.mBytesPerPacket = kSpeexBytesPerPacket;
+    mInputFormat.mFramesPerPacket = kSpeexFramesPerPacket;
+    mInputFormat.mBytesPerFrame = kSpeexBytesPerFrame;
+    mInputFormat.mChannelsPerFrame = 2;
+    mInputFormat.mBitsPerChannel = 16;
+    
+    CAStreamBasicDescription theOutputFormat1(kAudioStreamAnyRate, kAudioFormatLinearPCM, 0, 1, 0, 0, 16,
+                                              kAudioFormatFlagsNativeEndian |
+                                              kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked);
+    AddOutputFormat(theOutputFormat1);
+    CAStreamBasicDescription theOutputFormat2(kAudioStreamAnyRate, kAudioFormatLinearPCM, 0, 1, 0, 0, 32,
+                                              kAudioFormatFlagsNativeFloatPacked);
+    AddOutputFormat(theOutputFormat2);
+
+    mOutputFormat.mSampleRate = 44100;
+	mOutputFormat.mFormatID = kAudioFormatLinearPCM;
+	mOutputFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+	mOutputFormat.mBytesPerPacket = 8;
+	mOutputFormat.mFramesPerPacket = 1;
+	mOutputFormat.mBytesPerFrame = 8;
+	mOutputFormat.mChannelsPerFrame = 2;
+	mOutputFormat.mBitsPerChannel = 32;
+}
+
+CASpeexDecoder::~CASpeexDecoder()
+{
+    if (mCookie != NULL)
+        delete[] mCookie;
+
+    if (mOutBuffer != NULL)
+        delete[] mOutBuffer;
+
+    if (mSpeexDecoderState != NULL)
+        speex_decoder_destroy(mSpeexDecoderState);
+}
+
+void CASpeexDecoder::Initialize(const AudioStreamBasicDescription* inInputFormat,
+                                         const AudioStreamBasicDescription* inOutputFormat,
+                                         const void* inMagicCookie, UInt32 inMagicCookieByteSize)
+{
+    dprintf(" >> [%08lx] CASpeexDecoder :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
+
+    if(inInputFormat != NULL) {
+		SetCurrentInputFormat(*inInputFormat);
+	}
+    
+	if(inOutputFormat != NULL) {
+		SetCurrentOutputFormat(*inOutputFormat);
+	}
+    
+    if ((mInputFormat.mSampleRate != mOutputFormat.mSampleRate) ||
+		(mInputFormat.mChannelsPerFrame != mOutputFormat.mChannelsPerFrame)) {
+		CODEC_THROW(kAudioCodecUnsupportedFormatError);
+	}
+	
+    // needs to be called after input & output format have been set
+    BDCInitialize(kSpeexDecoderInBufferSize);
+
+    //if (inMagicCookieByteSize == 0)
+    //    CODEC_THROW(kAudioCodecUnsupportedFormatError);
+    
+    if (inMagicCookieByteSize != 0) {
+        SetMagicCookie(inMagicCookie, inMagicCookieByteSize);
+    }
+    
+    XCACodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize);
+    dprintf("<.. [%08lx] CASpeexDecoder :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
+}
+
+void	CASpeexDecoder::Uninitialize()
+{
+    dprintf(" >> [%08lx] CASpeexDecoder :: Uninitialize()\n", (UInt32) this);
+
+    BDCUninitialize();
+	XCACodec::Uninitialize();
+
+    dprintf("<.. [%08lx] CASpeexDecoder :: Uninitialize()\n", (UInt32) this);
+}
+
+void	CASpeexDecoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
+{	
+    dprintf(" >> [%08lx] CASpeexDecoder :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+	switch(inPropertyID)
+	{
+        case kAudioCodecPropertyRequiresPacketDescription:
+  			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+                *reinterpret_cast<UInt32*>(outPropertyData) = 1; 
+            }
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+            break;
+        case kAudioCodecPropertyHasVariablePacketByteSizes:
+  			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+                *reinterpret_cast<UInt32*>(outPropertyData) = 1;
+            }
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+            break;
+		case kAudioCodecPropertyPacketFrameSize:
+			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+                *reinterpret_cast<UInt32*>(outPropertyData) = kSpeexFramesPerPacket;
+            }
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+            
+        //case kAudioCodecPropertyQualitySetting: ???
+#if TARGET_OS_MAC
+		case kAudioCodecPropertyNameCFString:
+		{
+			if (ioPropertyDataSize != sizeof(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
+			
+			CABundleLocker lock;
+			CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Xiph Speex decoder"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
+			*(CFStringRef*)outPropertyData = name;
+			break; 
+		}
+
+        //case kAudioCodecPropertyManufacturerCFString:
+#endif
+		default:
+			ACBaseCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
+	}
+    dprintf("<.. [%08lx] CASpeexDecoder :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+}
+
+void	CASpeexDecoder::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable)
+{
+    dprintf(" >> [%08lx] CASpeexDecoder :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+	switch(inPropertyID)
+	{
+		case kAudioCodecPropertyRequiresPacketDescription:
+			outPropertyDataSize = sizeof(UInt32);
+			outWritable = false;
+			break;
+            
+		case kAudioCodecPropertyHasVariablePacketByteSizes:
+			outPropertyDataSize = sizeof(UInt32);
+			outWritable = false;
+			break;
+            
+		case kAudioCodecPropertyPacketFrameSize:
+			outPropertyDataSize = sizeof(UInt32);
+			outWritable = false;
+			break;
+            
+		default:
+			ACBaseCodec::GetPropertyInfo(inPropertyID, outPropertyDataSize, outWritable);
+			break;
+			
+	}
+    dprintf("<.. [%08lx] CASpeexDecoder :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+}
+
+void	CASpeexDecoder::Reset()
+{
+    dprintf(">> [%08lx] CASpeexDecoder :: Reset()\n", (UInt32) this);
+    BDCReset();
+
+	XCACodec::Reset();
+    dprintf("<< [%08lx] CASpeexDecoder :: Reset()\n", (UInt32) this);
+}
+
+UInt32	CASpeexDecoder::GetVersion() const
+{
+	return kCASpeex_adec_Version;
+}
+
+
+void CASpeexDecoder::SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat)
+{
+	if (!mIsInitialized) {
+		//	check to make sure the input format is legal
+		if (inInputFormat.mFormatID != kAudioFormatXiphSpeex) {
+			dprintf("CASpeexDecoder::SetFormats: only supports Xiph Speex for input\n");
+			CODEC_THROW(kAudioCodecUnsupportedFormatError);
+		}
+		
+		//	tell our base class about the new format
+		XCACodec::SetCurrentInputFormat(inInputFormat);
+	} else {
+		CODEC_THROW(kAudioCodecStateError);
+	}
+}
+
+void	CASpeexDecoder::SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat)
+{
+	if (!mIsInitialized)
+	{
+		//	check to make sure the output format is legal
+		if ((inOutputFormat.mFormatID != kAudioFormatLinearPCM) ||
+			!(((inOutputFormat.mFormatFlags == kAudioFormatFlagsNativeFloatPacked) &&
+               (inOutputFormat.mBitsPerChannel == 32)) ||
+			   ((inOutputFormat.mFormatFlags == (kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked)) &&
+                (inOutputFormat.mBitsPerChannel == 16))))
+        {
+			dprintf("CASpeexDecoder::SetFormats: only supports"
+                    " either 16 bit native endian signed integer or 32 bit native endian CoreAudio floats for output\n");
+			CODEC_THROW(kAudioCodecUnsupportedFormatError);
+		}
+		
+		//	tell our base class about the new format
+		XCACodec::SetCurrentOutputFormat(inOutputFormat);
+	} else {
+		CODEC_THROW(kAudioCodecStateError);
+	}
+}
+
+UInt32 CASpeexDecoder::GetMagicCookieByteSize() const
+{
+    return mCookieSize;
+}
+
+void CASpeexDecoder::GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const
+{
+    ioMagicCookieDataByteSize = mCookieSize;
+    
+    if (mCookie != NULL)
+        outMagicCookieData = mCookie;
+}
+
+void CASpeexDecoder::SetMagicCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize)
+{
+    dprintf(" >> [%08lx] CASpeexDecoder :: SetMagicCookie()\n", (UInt32) this);
+	if (mIsInitialized)
+		CODEC_THROW(kAudioCodecStateError);
+    
+    SetCookie(inMagicCookieData, inMagicCookieDataByteSize);
+    
+    InitializeCompressionSettings();
+    
+    if (!mCompressionInitialized)
+        CODEC_THROW(kAudioCodecUnsupportedFormatError);
+    dprintf("<.. [%08lx] CASpeexDecoder :: SetMagicCookie()\n", (UInt32) this);
+}
+
+void CASpeexDecoder::SetCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize)
+{
+    if (mCookie != NULL)
+        delete[] mCookie;
+    
+    mCookieSize = inMagicCookieDataByteSize;
+    if (inMagicCookieDataByteSize != 0) {
+        mCookie = new Byte[inMagicCookieDataByteSize];
+        BlockMoveData(inMagicCookieData, mCookie, inMagicCookieDataByteSize);
+    } else {
+        mCookie = NULL;
+    }
+}
+
+void CASpeexDecoder::InitializeCompressionSettings()
+{
+    if (mCookie == NULL)
+        return;
+    
+    if (mCompressionInitialized) {
+        memset(&mSpeexHeader, 0, sizeof(mSpeexHeader));
+
+        mSpeexStereoState.balance = 1.0;
+        mSpeexStereoState.e_ratio = 0.5;
+        mSpeexStereoState.smooth_left = 1.0;
+        mSpeexStereoState.smooth_right = 1.0;
+
+        if (mSpeexDecoderState != NULL) {
+            speex_decoder_destroy(mSpeexDecoderState);
+            mSpeexDecoderState = NULL;
+        }
+    }
+    
+    mCompressionInitialized = false;
+    
+    OggSerialNoAtom *atom = reinterpret_cast<OggSerialNoAtom*> (mCookie);
+    Byte *ptrheader = mCookie + EndianU32_BtoN(atom->size);
+    CookieAtomHeader *aheader = reinterpret_cast<CookieAtomHeader*> (ptrheader);
+    
+    // scan quickly through the cookie, check types and packet sizes
+    if (EndianS32_BtoN(atom->type) != kCookieTypeOggSerialNo || static_cast<UInt32> (ptrheader - mCookie) > mCookieSize)
+        return;
+    ptrheader += EndianU32_BtoN(aheader->size);
+    if (EndianS32_BtoN(aheader->type) != kCookieTypeSpeexHeader || static_cast<UInt32> (ptrheader - mCookie) > mCookieSize)
+        return;
+    // we ignore the rest: comments and extra headers
+
+    // all OK, back to the first speex packet
+    aheader = reinterpret_cast<CookieAtomHeader*> (mCookie + EndianU32_BtoN(atom->size));
+    SpeexHeader *inheader = reinterpret_cast<SpeexHeader *> (&aheader->data[0]);
+    
+    // TODO: convert, at some point, mSpeexHeader to a pointer?
+    mSpeexHeader.bitrate				= EndianS32_LtoN(inheader->bitrate);
+    mSpeexHeader.extra_headers			= EndianS32_LtoN(inheader->extra_headers);
+    mSpeexHeader.frame_size				= EndianS32_LtoN(inheader->frame_size);
+    mSpeexHeader.frames_per_packet		= EndianS32_LtoN(inheader->frames_per_packet);
+    mSpeexHeader.header_size			= EndianS32_LtoN(inheader->header_size);
+    mSpeexHeader.mode					= EndianS32_LtoN(inheader->mode);
+    mSpeexHeader.mode_bitstream_version	= EndianS32_LtoN(inheader->mode_bitstream_version);
+    mSpeexHeader.nb_channels			= EndianS32_LtoN(inheader->nb_channels);
+    mSpeexHeader.rate					= EndianS32_LtoN(inheader->rate);
+    mSpeexHeader.reserved1				= EndianS32_LtoN(inheader->reserved1);
+    mSpeexHeader.reserved2				= EndianS32_LtoN(inheader->reserved2);
+    mSpeexHeader.speex_version_id		= EndianS32_LtoN(inheader->speex_version_id);
+    mSpeexHeader.vbr					= EndianS32_LtoN(inheader->vbr);
+
+    if (mSpeexHeader.mode >= SPEEX_NB_MODES)
+        CODEC_THROW(kAudioCodecUnsupportedFormatError);
+    
+    //TODO: check bitstream version here
+    
+    mSpeexDecoderState = speex_decoder_init(speex_lib_get_mode(mSpeexHeader.mode));
+
+    if (!mSpeexDecoderState)
+        CODEC_THROW(kAudioCodecUnsupportedFormatError);
+    
+    //TODO: fix some of the header fields here
+    
+    if (mSpeexHeader.nb_channels == 2)
+    {
+        SpeexCallback callback;
+        callback.callback_id = SPEEX_INBAND_STEREO;
+        callback.func = speex_std_stereo_request_handler;
+        callback.data = &mSpeexStereoState;
+        speex_decoder_ctl(mSpeexDecoderState, SPEEX_SET_HANDLER, &callback);
+    }
+
+    mCompressionInitialized = true;
+}
+
+
+#pragma mark BDC handling
+
+void CASpeexDecoder::BDCInitialize(UInt32 inInputBufferByteSize)
+{
+    speex_bits_init(&mSpeexBits);
+
+    if (mOutBuffer)
+        delete[] mOutBuffer;
+
+    mOutBuffer = new Byte[kSpeexDecoderOutBufferSize];
+    mOutBufferSize = kSpeexDecoderOutBufferSize;
+    mOutBufferUsedSize = 0;
+    mOutBufferStart = 0;
+    
+    XCACodec::BDCInitialize(inInputBufferByteSize);
+}
+
+void CASpeexDecoder::BDCUninitialize()
+{
+    speex_bits_destroy(&mSpeexBits);
+    if (mSpeexDecoderState != NULL)
+        speex_decoder_ctl(mSpeexDecoderState, SPEEX_RESET_STATE, NULL); //??!
+
+    mSpeexFPList.clear();
+    
+    if (mOutBuffer)
+        delete[] mOutBuffer;
+    mOutBuffer = NULL;
+    mOutBufferSize = 0;
+    mOutBufferUsedSize = 0;
+    mOutBufferStart = 0;
+    
+    XCACodec::BDCUninitialize();
+}
+
+void CASpeexDecoder::BDCReset()
+{
+    speex_bits_reset(&mSpeexBits);
+    if (mSpeexDecoderState != NULL)
+        speex_decoder_ctl(mSpeexDecoderState, SPEEX_RESET_STATE, NULL); //??!
+
+    mSpeexFPList.clear();
+
+    mNumFrames = 0;
+
+    mOutBufferUsedSize = 0;
+    mOutBufferStart = 0;
+
+    XCACodec::BDCReset();
+}
+
+void CASpeexDecoder::BDCReallocate(UInt32 inInputBufferByteSize)
+{
+    speex_bits_reset(&mSpeexBits);
+
+    mSpeexFPList.clear();
+
+    XCACodec::BDCReallocate(inInputBufferByteSize);
+}
+
+
+void CASpeexDecoder::InPacket(const void* inInputData, const AudioStreamPacketDescription* inPacketDescription)
+{
+    const Byte * theData = static_cast<const Byte *> (inInputData) + inPacketDescription->mStartOffset;
+    UInt32 size = inPacketDescription->mDataByteSize;
+    mBDCBuffer.In(theData, size);
+    mSpeexFPList.push_back(SpeexFramePacket(*reinterpret_cast<const SInt32*> (&inPacketDescription->mVariableFramesInPacket),
+                                            inPacketDescription->mDataByteSize));
+}
+
+
+UInt32 CASpeexDecoder::FramesReady() const
+{
+    return mNumFrames;
+}
+
+Boolean CASpeexDecoder::GenerateFrames()
+{
+    Boolean ret = true;
+    int result;
+
+    mBDCStatus = kBDCStatusOK;
+    SpeexFramePacket &sfp = mSpeexFPList.front();
+
+    speex_bits_read_from(&mSpeexBits, reinterpret_cast<char*> (mBDCBuffer.GetData()), sfp.bytes);
+
+    for (SInt32 i = 0; i < mSpeexHeader.frames_per_packet; i++) {
+        if (mOutputFormat.mFormatFlags & kAudioFormatFlagsNativeFloatPacked != 0)
+            result = speex_decode(mSpeexDecoderState, &mSpeexBits, reinterpret_cast<float*> (mOutBuffer + mOutBufferUsedSize));
+        else
+            result = speex_decode_int(mSpeexDecoderState, &mSpeexBits, reinterpret_cast<SInt16*> (mOutBuffer + mOutBufferUsedSize));
+        
+        if (result < 0) {
+            mBDCStatus = kBDCStatusAbort;
+            return false;
+        }
+        
+        if (mSpeexHeader.nb_channels == 2) {
+            if (mOutputFormat.mFormatFlags & kAudioFormatFlagsNativeFloatPacked != 0)
+                speex_decode_stereo(reinterpret_cast<float*> (mOutBuffer + mOutBufferUsedSize), mSpeexHeader.frame_size, &mSpeexStereoState);
+            else
+                speex_decode_stereo_int(reinterpret_cast<SInt16*> (mOutBuffer + mOutBufferUsedSize), mSpeexHeader.frame_size, &mSpeexStereoState);
+        }
+        mOutBufferUsedSize += mOutputFormat.FramesToBytes(mSpeexHeader.frame_size);
+    }
+
+    if (sfp.frames == 0) {
+        mNumFrames += mSpeexHeader.frame_size * mSpeexHeader.frames_per_packet;
+    } else if (sfp.frames > 0) {
+        mNumFrames += sfp.frames;
+        if (mSpeexHeader.frame_size * mSpeexHeader.frames_per_packet - sfp.frames != 0)
+            mOutBufferStart += mOutputFormat.FramesToBytes(mSpeexHeader.frame_size * mSpeexHeader.frames_per_packet - sfp.frames);
+    } else {
+        mNumFrames -= sfp.frames;
+    }
+
+    mBDCBuffer.Zap(sfp.bytes);
+    mSpeexFPList.erase(mSpeexFPList.begin());
+
+    return ret;
+}
+
+void CASpeexDecoder::OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const
+{
+    if (mOutputFormat.mFormatFlags & kAudioFormatFlagsNativeFloatPacked != 0) {
+        float* theOutputData = static_cast<float*> (outOutputData) + inFramesOffset * mSpeexHeader.nb_channels;
+        float* theSourceData = reinterpret_cast<float*> (mOutBuffer + mOutBufferStart);
+        UInt32 num_floats = inNumberFrames * mSpeexHeader.nb_channels;
+        for (UInt32 i = 0; i < num_floats; i++) {
+            *theOutputData = *theSourceData / 32768.0; // !??
+            theOutputData += 1;
+            theSourceData += 1;
+        }
+    } else {
+        BlockMoveData(mOutBuffer + mOutBufferStart,
+                      static_cast<Byte*> (outOutputData) + mOutputFormat.FramesToBytes(inFramesOffset),
+                      mOutputFormat.FramesToBytes(inNumberFrames));
+    }
+}
+
+void CASpeexDecoder::Zap(UInt32 inFrames)
+{
+    mNumFrames -= inFrames;
+    
+    if (mNumFrames < 0)
+        mNumFrames = 0;
+    
+    if (mNumFrames == 0) {
+        mOutBufferUsedSize = 0;
+        mOutBufferStart = 0;
+    } else {
+        mOutBufferStart += mOutputFormat.FramesToBytes(inFrames);
+    }
+}


Property changes on: trunk/xiph-qt/CASpeex/src/CASpeexDecoder.cpp
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CASpeex/src/CASpeexDecoder.h
===================================================================
--- trunk/xiph-qt/CASpeex/src/CASpeexDecoder.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/src/CASpeexDecoder.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,131 @@
+/*
+ *  CASpeexDecoder.h
+ *
+ *    CASpeexDecoder class definition.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__CASpeexDecoder_h__)
+#define __CASpeexDecoder_h__
+
+
+#include "XCACodec.h"
+
+#include <Speex/speex.h>
+#include <Speex/speex_stereo.h>
+#include <Speex/speex_header.h>
+
+#include <vector>
+
+
+class CASpeexDecoder:
+public XCACodec
+{
+public:
+    CASpeexDecoder(Boolean inSkipFormatsInitialization = false);
+    virtual ~CASpeexDecoder();
+
+    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		GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable);
+    
+    virtual void		SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat);
+    virtual void		SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat);
+    virtual UInt32		GetVersion() const;
+
+	virtual UInt32		GetMagicCookieByteSize() const;
+	virtual void		GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const;
+	virtual void		SetMagicCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize);
+
+protected:
+    virtual void		BDCInitialize(UInt32 inInputBufferByteSize);
+    virtual void		BDCUninitialize();
+    virtual void		BDCReset();
+    virtual void		BDCReallocate(UInt32 inInputBufferByteSize);
+    
+    virtual void		InPacket(const void* inInputData, const AudioStreamPacketDescription* inPacketDescription);
+    
+    virtual UInt32		FramesReady() const;
+    virtual Boolean		GenerateFrames();
+    virtual void		OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const;
+    virtual void		Zap(UInt32 inFrames);
+    
+    void				SetCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize);
+    virtual void		InitializeCompressionSettings();
+
+    //virtual void        FixFormats();
+
+protected:
+    Byte*				mCookie;
+    UInt32				mCookieSize;
+
+    Boolean				mCompressionInitialized;
+
+    Byte*				mOutBuffer;
+    UInt32				mOutBufferSize;
+    UInt32				mOutBufferUsedSize;
+    UInt32				mOutBufferStart;
+
+    struct SpeexFramePacket {
+        SInt32 frames;
+		UInt32 bytes;
+		UInt32 left;
+        
+        SpeexFramePacket() : frames(0), bytes(0), left(0) {};
+        SpeexFramePacket(SInt32 inFrames, UInt32 inBytes) : frames(inFrames), bytes(inBytes), left(inBytes) {};
+    };
+    
+    typedef std::vector<SpeexFramePacket>   SpeexFramePacketList;
+    SpeexFramePacketList    mSpeexFPList;
+
+    UInt32				mNumFrames;
+
+    SpeexHeader			mSpeexHeader;
+    SpeexBits			mSpeexBits;
+    void				*mSpeexDecoderState;
+    SpeexStereoState	mSpeexStereoState;
+
+
+    enum {
+        kSpeexBytesPerPacket = 0,
+        kSpeexFramesPerPacket = 0,
+        kSpeexBytesPerFrame = 0,
+        kSpeexChannelsPerFrame = 0,
+        kSpeexBitsPerChannel = 0,
+        kSpeexFormatFlags = 0,
+
+        kSpeexDecoderInBufferSize = 64 * 1024,
+        kSpeexDecoderOutBufferSize = 64 * 1024
+    };
+};
+
+
+#endif /* __CASpeexDecoder_h__ */


Property changes on: trunk/xiph-qt/CASpeex/src/CASpeexDecoder.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CASpeex/src/CASpeexDecoderPublic.r
===================================================================
--- trunk/xiph-qt/CASpeex/src/CASpeexDecoderPublic.r	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/src/CASpeexDecoderPublic.r	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,58 @@
+/*
+ *  CASpeexDecoderPublic.r
+ *
+ *    Information bit definitions for the 'thng' resource.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "speex_versions.h"
+#include "fccs.h"
+
+
+
+#define RES_ID			-17330
+#define COMP_TYPE		'adec'
+#define COMP_SUBTYPE	kAudioFormatXiphOggFramedSpeex
+#define COMP_MANUF		'Xiph'
+#define VERSION			kCASpeex_adec_Version
+#define NAME			"Xiph Speex (Ogg-framed) Decoder"
+#define DESCRIPTION		"An AudioCodec that decodes Xiph Speex (Ogg-framed) into linear PCM data"
+#define ENTRY_POINT		"CAOggSpeexDecoderEntry"
+
+#include "AUResources.r"
+
+
+
+#define RES_ID			-17334
+#define COMP_TYPE		'adec'
+#define COMP_SUBTYPE	kAudioFormatXiphSpeex
+#define COMP_MANUF		'Xiph'
+#define VERSION			kCASpeex_adec_Version
+#define NAME			"Xiph Speex Decoder"
+#define DESCRIPTION		"An AudioCodec that decodes Xiph Speex into linear PCM data"
+#define ENTRY_POINT		"CASpeexDecoderEntry"
+
+#include "AUResources.r"


Property changes on: trunk/xiph-qt/CASpeex/src/CASpeexDecoderPublic.r
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CASpeex/src/speex_entrypoints.cpp
===================================================================
--- trunk/xiph-qt/CASpeex/src/speex_entrypoints.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/src/speex_entrypoints.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,46 @@
+/*
+ *  speex_entrypoints.cpp
+ *
+ *    Declaration of the entry points for the Speex component.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "CASpeexDecoder.h"
+#include "CAOggSpeexDecoder.h"
+
+#include "ACCodecDispatch.h"
+
+extern "C"
+ComponentResult	CASpeexDecoderEntry(ComponentParameters* inParameters, CASpeexDecoder* inThis)
+{	
+	return	ACCodecDispatch(inParameters, inThis);
+}
+
+extern "C"
+ComponentResult	CAOggSpeexDecoderEntry(ComponentParameters* inParameters, CAOggSpeexDecoder* inThis)
+{	
+	return	ACCodecDispatch(inParameters, inThis);
+}


Property changes on: trunk/xiph-qt/CASpeex/src/speex_entrypoints.cpp
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CASpeex/src/speex_versions.h
===================================================================
--- trunk/xiph-qt/CASpeex/src/speex_versions.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CASpeex/src/speex_versions.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,42 @@
+/*
+ *  speex_versions.h
+ *
+ *    The current version of the Speex component.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__speex_versions_h__)
+#define __speex_versions_h__
+
+
+#ifdef DEBUG
+#define kCASpeex_adec_Version		(0x00FF0101)
+#else
+#define kCASpeex_adec_Version		(0x00000101)
+#endif /* DEBUG */
+
+
+#endif /* __speex_versions_h__ */


Property changes on: trunk/xiph-qt/CASpeex/src/speex_versions.h
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj
___________________________________________________________________
Name: svn:ignore
   + *.mode*
*.pbxuser


Added: trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj/project.pbxproj
===================================================================
--- trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj/project.pbxproj	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj/project.pbxproj	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,582 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 42;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		737C589309125B5900700B79 /* vorbis_entrypoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737C589209125B5900700B79 /* vorbis_entrypoints.cpp */; };
+		737C589D09125C2700700B79 /* XCACodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737C589B09125C2700700B79 /* XCACodec.cpp */; };
+		737C58A109125C7E00700B79 /* wrap_ogg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737C589F09125C7E00700B79 /* wrap_ogg.cpp */; };
+		737C593B09125DB700700B79 /* PkgInfo in CopyFiles */ = {isa = PBXBuildFile; fileRef = 737C589809125BA000700B79 /* PkgInfo */; };
+		737C59960912617B00700B79 /* CAOggVorbisDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737C59940912617B00700B79 /* CAOggVorbisDecoder.cpp */; };
+		737C9EC608F80D3D00DAC36C /* ringbuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737C9EC508F80D3D00DAC36C /* ringbuffer.cpp */; };
+		737C9FE108F82B8B00DAC36C /* CAVorbisDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737C9FE008F82B8B00DAC36C /* CAVorbisDecoder.cpp */; };
+		737CA00A08F82D0600DAC36C /* ACBaseCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737C9FFF08F82D0600DAC36C /* ACBaseCodec.cpp */; };
+		737CA00B08F82D0600DAC36C /* ACCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737CA00108F82D0600DAC36C /* ACCodec.cpp */; };
+		737CA01508F82D7500DAC36C /* GetCodecBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737CA01308F82D7500DAC36C /* GetCodecBundle.cpp */; };
+		737CA03108F82E5F00DAC36C /* CAStreamBasicDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737CA02F08F82E5F00DAC36C /* CAStreamBasicDescription.cpp */; };
+		737CA03C08F82EB400DAC36C /* CADebugMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737CA03A08F82EB400DAC36C /* CADebugMacros.cpp */; };
+		737CA04708F82EF400DAC36C /* CABundleLocker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737CA04508F82EF400DAC36C /* CABundleLocker.cpp */; };
+		737CA0D108F8352A00DAC36C /* AudioCodecComponentGlue.c in Sources */ = {isa = PBXBuildFile; fileRef = 737CA0D008F8352A00DAC36C /* AudioCodecComponentGlue.c */; };
+		737CA1B008F8376400DAC36C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 737CA1AD08F8376400DAC36C /* Carbon.framework */; };
+		737CA1E008F83B2F00DAC36C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 737CA1AC08F8376400DAC36C /* AudioUnit.framework */; };
+		737CA4D908F95A2C00DAC36C /* CAVorbisDecoderPublic.r in Rez */ = {isa = PBXBuildFile; fileRef = 737CA4B708F9588900DAC36C /* CAVorbisDecoderPublic.r */; };
+		737CA65008F9D34000DAC36C /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 737CA64308F9D34000DAC36C /* Ogg.framework */; };
+		737CA65108F9D34000DAC36C /* Vorbis.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 737CA64408F9D34000DAC36C /* Vorbis.framework */; };
+		8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXBuildStyle section */
+		4F9091AC011F3BD104CA0E50 /* Development */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4F9091AD011F3BD104CA0E50 /* Deployment */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+/* End PBXBuildStyle section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		737C593509125CFB00700B79 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = Contents;
+			dstSubfolderSpec = 1;
+			files = (
+				737C593B09125DB700700B79 /* PkgInfo in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		32BAE0B30371A71500C91783 /* CAVorbis_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAVorbis_Prefix.pch; sourceTree = "<group>"; };
+		737C589209125B5900700B79 /* vorbis_entrypoints.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = vorbis_entrypoints.cpp; path = src/vorbis_entrypoints.cpp; sourceTree = "<group>"; };
+		737C589409125B8500700B79 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = icon.icns; path = ../resources/icon.icns; sourceTree = SOURCE_ROOT; };
+		737C589509125B8500700B79 /* icon.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = icon.r; path = ../resources/icon.r; sourceTree = SOURCE_ROOT; };
+		737C589809125BA000700B79 /* PkgInfo */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = PkgInfo; sourceTree = "<group>"; };
+		737C589A09125BFD00700B79 /* fccs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = fccs.h; path = ../common/fccs.h; sourceTree = SOURCE_ROOT; };
+		737C589B09125C2700700B79 /* XCACodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = XCACodec.cpp; path = ../common/XCACodec.cpp; sourceTree = SOURCE_ROOT; };
+		737C589C09125C2700700B79 /* XCACodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = XCACodec.h; path = ../common/XCACodec.h; sourceTree = SOURCE_ROOT; };
+		737C589E09125C7E00700B79 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = "<group>"; };
+		737C589F09125C7E00700B79 /* wrap_ogg.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = wrap_ogg.cpp; sourceTree = "<group>"; };
+		737C58A009125C7E00700B79 /* wrap_ogg.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = wrap_ogg.h; sourceTree = "<group>"; };
+		737C59940912617B00700B79 /* CAOggVorbisDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CAOggVorbisDecoder.cpp; path = src/CAOggVorbisDecoder.cpp; sourceTree = "<group>"; };
+		737C59950912617B00700B79 /* CAOggVorbisDecoder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CAOggVorbisDecoder.h; path = src/CAOggVorbisDecoder.h; sourceTree = "<group>"; };
+		737C9EBB08F804CC00DAC36C /* vorbis_versions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vorbis_versions.h; path = src/vorbis_versions.h; sourceTree = "<group>"; };
+		737C9EC408F80D3D00DAC36C /* ringbuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ringbuffer.h; sourceTree = "<group>"; };
+		737C9EC508F80D3D00DAC36C /* ringbuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ringbuffer.cpp; sourceTree = "<group>"; };
+		737C9FDF08F82B8B00DAC36C /* CAVorbisDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CAVorbisDecoder.h; path = src/CAVorbisDecoder.h; sourceTree = "<group>"; };
+		737C9FE008F82B8B00DAC36C /* CAVorbisDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CAVorbisDecoder.cpp; path = src/CAVorbisDecoder.cpp; sourceTree = "<group>"; };
+		737C9FFF08F82D0600DAC36C /* ACBaseCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ACBaseCodec.cpp; sourceTree = "<group>"; };
+		737CA00008F82D0600DAC36C /* ACBaseCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACBaseCodec.h; sourceTree = "<group>"; };
+		737CA00108F82D0600DAC36C /* ACCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ACCodec.cpp; sourceTree = "<group>"; };
+		737CA00208F82D0600DAC36C /* ACCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACCodec.h; sourceTree = "<group>"; };
+		737CA00308F82D0600DAC36C /* ACCodecDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACCodecDispatch.h; sourceTree = "<group>"; };
+		737CA00408F82D0600DAC36C /* ACCodecDispatchTypes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACCodecDispatchTypes.h; sourceTree = "<group>"; };
+		737CA00508F82D0600DAC36C /* ACComponentResources.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = ACComponentResources.r; sourceTree = "<group>"; };
+		737CA00608F82D0600DAC36C /* ACConditionalMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ACConditionalMacros.h; sourceTree = "<group>"; };
+		737CA00908F82D0600DAC36C /* CAConditionalMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAConditionalMacros.h; sourceTree = "<group>"; };
+		737CA01308F82D7500DAC36C /* GetCodecBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GetCodecBundle.cpp; sourceTree = "<group>"; };
+		737CA01408F82D7500DAC36C /* GetCodecBundle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GetCodecBundle.h; sourceTree = "<group>"; };
+		737CA02F08F82E5F00DAC36C /* CAStreamBasicDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CAStreamBasicDescription.cpp; sourceTree = "<group>"; };
+		737CA03008F82E5F00DAC36C /* CAStreamBasicDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAStreamBasicDescription.h; sourceTree = "<group>"; };
+		737CA03A08F82EB400DAC36C /* CADebugMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CADebugMacros.cpp; sourceTree = "<group>"; };
+		737CA03B08F82EB400DAC36C /* CADebugMacros.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CADebugMacros.h; sourceTree = "<group>"; };
+		737CA04508F82EF400DAC36C /* CABundleLocker.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CABundleLocker.cpp; sourceTree = "<group>"; };
+		737CA04608F82EF400DAC36C /* CABundleLocker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CABundleLocker.h; sourceTree = "<group>"; };
+		737CA0D008F8352A00DAC36C /* AudioCodecComponentGlue.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = AudioCodecComponentGlue.c; sourceTree = "<group>"; };
+		737CA0F408F8361100DAC36C /* CAMath.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CAMath.h; sourceTree = "<group>"; };
+		737CA1AC08F8376400DAC36C /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
+		737CA1AD08F8376400DAC36C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+		737CA4B408F9587200DAC36C /* CAVorbisCodec.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; name = CAVorbisCodec.exp; path = src/CAVorbisCodec.exp; sourceTree = "<group>"; };
+		737CA4B708F9588900DAC36C /* CAVorbisDecoderPublic.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = CAVorbisDecoderPublic.r; path = src/CAVorbisDecoderPublic.r; sourceTree = "<group>"; };
+		737CA4F908F95BCE00DAC36C /* AUResources.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = AUResources.r; sourceTree = "<group>"; };
+		737CA64308F9D34000DAC36C /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = /Library/Frameworks/Ogg.framework; sourceTree = "<absolute>"; };
+		737CA64408F9D34000DAC36C /* Vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Vorbis.framework; path = /Library/Frameworks/Vorbis.framework; sourceTree = "<absolute>"; };
+		73E8B11A090BCD8200686EE5 /* data_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = data_types.h; path = ../common/data_types.h; sourceTree = SOURCE_ROOT; };
+		8D01CCD10486CAD60068D4B7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+		8D01CCD20486CAD60068D4B7 /* CAVorbis.component */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CAVorbis.component; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		8D01CCCD0486CAD60068D4B7 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				737CA1B008F8376400DAC36C /* Carbon.framework in Frameworks */,
+				737CA1E008F83B2F00DAC36C /* AudioUnit.framework in Frameworks */,
+				737CA65008F9D34000DAC36C /* Ogg.framework in Frameworks */,
+				737CA65108F9D34000DAC36C /* Vorbis.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		089C166AFE841209C02AAC07 /* CAVorbis */ = {
+			isa = PBXGroup;
+			children = (
+				08FB77ADFE841716C02AAC07 /* Source */,
+				089C167CFE841241C02AAC07 /* Resources */,
+				737C9EC108F80CA600DAC36C /* External Source */,
+				089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
+				19C28FB4FE9D528D11CA2CBB /* Products */,
+			);
+			name = CAVorbis;
+			sourceTree = "<group>";
+		};
+		089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				737CA64308F9D34000DAC36C /* Ogg.framework */,
+				737CA64408F9D34000DAC36C /* Vorbis.framework */,
+				737CA1AC08F8376400DAC36C /* AudioUnit.framework */,
+				737CA1AD08F8376400DAC36C /* Carbon.framework */,
+			);
+			name = "External Frameworks and Libraries";
+			sourceTree = "<group>";
+		};
+		089C167CFE841241C02AAC07 /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+				737C589809125BA000700B79 /* PkgInfo */,
+				737C589409125B8500700B79 /* icon.icns */,
+				737C589509125B8500700B79 /* icon.r */,
+				737CA4B708F9588900DAC36C /* CAVorbisDecoderPublic.r */,
+				8D01CCD10486CAD60068D4B7 /* Info.plist */,
+				089C167DFE841241C02AAC07 /* InfoPlist.strings */,
+			);
+			name = Resources;
+			sourceTree = "<group>";
+		};
+		08FB77ADFE841716C02AAC07 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				737C59940912617B00700B79 /* CAOggVorbisDecoder.cpp */,
+				737C59950912617B00700B79 /* CAOggVorbisDecoder.h */,
+				737C589B09125C2700700B79 /* XCACodec.cpp */,
+				737C589C09125C2700700B79 /* XCACodec.h */,
+				737C589A09125BFD00700B79 /* fccs.h */,
+				737C589209125B5900700B79 /* vorbis_entrypoints.cpp */,
+				73E8B11A090BCD8200686EE5 /* data_types.h */,
+				737CA4B408F9587200DAC36C /* CAVorbisCodec.exp */,
+				32BAE0B30371A71500C91783 /* CAVorbis_Prefix.pch */,
+				737C9EBB08F804CC00DAC36C /* vorbis_versions.h */,
+				737C9FDF08F82B8B00DAC36C /* CAVorbisDecoder.h */,
+				737C9FE008F82B8B00DAC36C /* CAVorbisDecoder.cpp */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		19C28FB4FE9D528D11CA2CBB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				8D01CCD20486CAD60068D4B7 /* CAVorbis.component */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		737C9EC108F80CA600DAC36C /* External Source */ = {
+			isa = PBXGroup;
+			children = (
+				737C9FFB08F82D0600DAC36C /* AppleSDK */,
+				737C9EC308F80CE600DAC36C /* utils */,
+			);
+			name = "External Source";
+			sourceTree = "<group>";
+		};
+		737C9EC308F80CE600DAC36C /* utils */ = {
+			isa = PBXGroup;
+			children = (
+				737C589E09125C7E00700B79 /* debug.h */,
+				737C589F09125C7E00700B79 /* wrap_ogg.cpp */,
+				737C58A009125C7E00700B79 /* wrap_ogg.h */,
+				737C9EC408F80D3D00DAC36C /* ringbuffer.h */,
+				737C9EC508F80D3D00DAC36C /* ringbuffer.cpp */,
+			);
+			name = utils;
+			path = ../utils;
+			sourceTree = SOURCE_ROOT;
+		};
+		737C9FFB08F82D0600DAC36C /* AppleSDK */ = {
+			isa = PBXGroup;
+			children = (
+				737C9FFC08F82D0600DAC36C /* CoreAudio */,
+			);
+			name = AppleSDK;
+			path = ../AppleSDK;
+			sourceTree = SOURCE_ROOT;
+		};
+		737C9FFC08F82D0600DAC36C /* CoreAudio */ = {
+			isa = PBXGroup;
+			children = (
+				737CA4F608F95BCE00DAC36C /* AudioUnits */,
+				737C9FFD08F82D0600DAC36C /* AudioCodecs */,
+				737CA00808F82D0600DAC36C /* PublicUtility */,
+			);
+			path = CoreAudio;
+			sourceTree = "<group>";
+		};
+		737C9FFD08F82D0600DAC36C /* AudioCodecs */ = {
+			isa = PBXGroup;
+			children = (
+				737CA0D008F8352A00DAC36C /* AudioCodecComponentGlue.c */,
+				737C9FFE08F82D0600DAC36C /* ACPublic */,
+			);
+			path = AudioCodecs;
+			sourceTree = "<group>";
+		};
+		737C9FFE08F82D0600DAC36C /* ACPublic */ = {
+			isa = PBXGroup;
+			children = (
+				737C9FFF08F82D0600DAC36C /* ACBaseCodec.cpp */,
+				737CA00008F82D0600DAC36C /* ACBaseCodec.h */,
+				737CA00108F82D0600DAC36C /* ACCodec.cpp */,
+				737CA00208F82D0600DAC36C /* ACCodec.h */,
+				737CA00308F82D0600DAC36C /* ACCodecDispatch.h */,
+				737CA00408F82D0600DAC36C /* ACCodecDispatchTypes.h */,
+				737CA00508F82D0600DAC36C /* ACComponentResources.r */,
+				737CA00608F82D0600DAC36C /* ACConditionalMacros.h */,
+				737CA01308F82D7500DAC36C /* GetCodecBundle.cpp */,
+				737CA01408F82D7500DAC36C /* GetCodecBundle.h */,
+			);
+			path = ACPublic;
+			sourceTree = "<group>";
+		};
+		737CA00808F82D0600DAC36C /* PublicUtility */ = {
+			isa = PBXGroup;
+			children = (
+				737CA0F408F8361100DAC36C /* CAMath.h */,
+				737CA04508F82EF400DAC36C /* CABundleLocker.cpp */,
+				737CA04608F82EF400DAC36C /* CABundleLocker.h */,
+				737CA03A08F82EB400DAC36C /* CADebugMacros.cpp */,
+				737CA03B08F82EB400DAC36C /* CADebugMacros.h */,
+				737CA02F08F82E5F00DAC36C /* CAStreamBasicDescription.cpp */,
+				737CA03008F82E5F00DAC36C /* CAStreamBasicDescription.h */,
+				737CA00908F82D0600DAC36C /* CAConditionalMacros.h */,
+			);
+			path = PublicUtility;
+			sourceTree = "<group>";
+		};
+		737CA4F608F95BCE00DAC36C /* AudioUnits */ = {
+			isa = PBXGroup;
+			children = (
+				737CA4F708F95BCE00DAC36C /* AUPublic */,
+			);
+			path = AudioUnits;
+			sourceTree = "<group>";
+		};
+		737CA4F708F95BCE00DAC36C /* AUPublic */ = {
+			isa = PBXGroup;
+			children = (
+				737CA4F808F95BCE00DAC36C /* AUBase */,
+			);
+			path = AUPublic;
+			sourceTree = "<group>";
+		};
+		737CA4F808F95BCE00DAC36C /* AUBase */ = {
+			isa = PBXGroup;
+			children = (
+				737CA4F908F95BCE00DAC36C /* AUResources.r */,
+			);
+			path = AUBase;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		8D01CCC60486CAD60068D4B7 /* CAVorbis */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 737C9E9808F7FE4D00DAC36C /* Build configuration list for PBXNativeTarget "CAVorbis" */;
+			buildPhases = (
+				8D01CCC90486CAD60068D4B7 /* Resources */,
+				8D01CCCB0486CAD60068D4B7 /* Sources */,
+				8D01CCCD0486CAD60068D4B7 /* Frameworks */,
+				737CA4B808F9589D00DAC36C /* Rez */,
+				737C593509125CFB00700B79 /* CopyFiles */,
+				737C593709125D1B00700B79 /* ShellScript */,
+			);
+			buildRules = (
+			);
+			buildSettings = {
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = CAVorbis_Prefix.pch;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Bundles";
+				PRODUCT_NAME = CAVorbis;
+				WRAPPER_EXTENSION = bundle;
+			};
+			dependencies = (
+			);
+			name = CAVorbis;
+			productInstallPath = "$(HOME)/Library/Bundles";
+			productName = CAVorbis;
+			productReference = 8D01CCD20486CAD60068D4B7 /* CAVorbis.component */;
+			productType = "com.apple.product-type.bundle";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		089C1669FE841209C02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 737C9E9C08F7FE4D00DAC36C /* Build configuration list for PBXProject "CAVorbis" */;
+			buildSettings = {
+			};
+			buildStyles = (
+				4F9091AC011F3BD104CA0E50 /* Development */,
+				4F9091AD011F3BD104CA0E50 /* Deployment */,
+			);
+			hasScannedForEncodings = 1;
+			mainGroup = 089C166AFE841209C02AAC07 /* CAVorbis */;
+			projectDirPath = "";
+			targets = (
+				8D01CCC60486CAD60068D4B7 /* CAVorbis */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		8D01CCC90486CAD60068D4B7 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+		737CA4B808F9589D00DAC36C /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				737CA4D908F95A2C00DAC36C /* CAVorbisDecoderPublic.r in Rez */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		737C593709125D1B00700B79 /* ShellScript */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+				"../resources/icon.r\n../resources/icon.r",
+				../resources/icon.icns,
+			);
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "cd ../resources\n${SYSTEM_DEVELOPER_TOOLS}/Rez -o \"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\"/$'Icon\\x0D' icon.r\n${SYSTEM_DEVELOPER_TOOLS}/SetFile -a CE \"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\"";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		8D01CCCB0486CAD60068D4B7 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				737C9EC608F80D3D00DAC36C /* ringbuffer.cpp in Sources */,
+				737C9FE108F82B8B00DAC36C /* CAVorbisDecoder.cpp in Sources */,
+				737CA00A08F82D0600DAC36C /* ACBaseCodec.cpp in Sources */,
+				737CA00B08F82D0600DAC36C /* ACCodec.cpp in Sources */,
+				737CA01508F82D7500DAC36C /* GetCodecBundle.cpp in Sources */,
+				737CA03108F82E5F00DAC36C /* CAStreamBasicDescription.cpp in Sources */,
+				737CA03C08F82EB400DAC36C /* CADebugMacros.cpp in Sources */,
+				737CA04708F82EF400DAC36C /* CABundleLocker.cpp in Sources */,
+				737CA0D108F8352A00DAC36C /* AudioCodecComponentGlue.c in Sources */,
+				737C589309125B5900700B79 /* vorbis_entrypoints.cpp in Sources */,
+				737C589D09125C2700700B79 /* XCACodec.cpp in Sources */,
+				737C58A109125C7E00700B79 /* wrap_ogg.cpp in Sources */,
+				737C59960912617B00700B79 /* CAOggVorbisDecoder.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+		089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				089C167EFE841241C02AAC07 /* English */,
+			);
+			name = InfoPlist.strings;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+		737810D108FCC24B00686713 /* Deployment (optimized+) */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				EXPORTED_SYMBOLS_FILE = src/CAVorbisCodec.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = CAVorbis_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					__MACOSX__,
+					NDEBUG,
+				);
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Components";
+				PRODUCT_NAME = CAVorbis;
+				WRAPPER_EXTENSION = component;
+				ZERO_LINK = NO;
+			};
+			name = "Deployment (optimized+)";
+		};
+		737810D208FCC24B00686713 /* Deployment (optimized+) */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = "$(HOME)/Library/Frameworks";
+				GCC_ALTIVEC_EXTENSIONS = YES;
+				GCC_AUTO_VECTORIZATION = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				OTHER_REZFLAGS = "-D TARGET_REZ_MAC_PPC=1";
+			};
+			name = "Deployment (optimized+)";
+		};
+		737C9E9908F7FE4D00DAC36C /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				EXPORTED_SYMBOLS_FILE = src/CAVorbisCodec.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = CAVorbis_Prefix.pch;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Components";
+				OTHER_CFLAGS = "-Wall";
+				PRODUCT_NAME = CAVorbis;
+				WRAPPER_EXTENSION = component;
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		737C9E9A08F7FE4D00DAC36C /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				EXPORTED_SYMBOLS_FILE = src/CAVorbisCodec.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = CAVorbis_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					__MACOSX__,
+					NDEBUG,
+				);
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Components";
+				PRODUCT_NAME = CAVorbis;
+				WRAPPER_EXTENSION = component;
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		737C9E9B08F7FE4D00DAC36C /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXPORTED_SYMBOLS_FILE = src/CAVorbisCodec.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = CAVorbis_Prefix.pch;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Components";
+				PRODUCT_NAME = CAVorbis;
+				WRAPPER_EXTENSION = component;
+			};
+			name = Default;
+		};
+		737C9E9D08F7FE4D00DAC36C /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = "$(HOME)/Library/Frameworks";
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				OTHER_REZFLAGS = "-D TARGET_REZ_MAC_PPC=1";
+			};
+			name = Development;
+		};
+		737C9E9E08F7FE4D00DAC36C /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = "$(HOME)/Library/Frameworks";
+				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				OTHER_REZFLAGS = "-D TARGET_REZ_MAC_PPC=1";
+			};
+			name = Deployment;
+		};
+		737C9E9F08F7FE4D00DAC36C /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = "$(HOME)/Library/Frameworks";
+				GCC_PREPROCESSOR_DEFINITIONS = __MACOSX__;
+				OTHER_REZFLAGS = "-D TARGET_REZ_MAC_PPC=1";
+			};
+			name = Default;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		737C9E9808F7FE4D00DAC36C /* Build configuration list for PBXNativeTarget "CAVorbis" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				737C9E9908F7FE4D00DAC36C /* Development */,
+				737C9E9A08F7FE4D00DAC36C /* Deployment */,
+				737810D108FCC24B00686713 /* Deployment (optimized+) */,
+				737C9E9B08F7FE4D00DAC36C /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		737C9E9C08F7FE4D00DAC36C /* Build configuration list for PBXProject "CAVorbis" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				737C9E9D08F7FE4D00DAC36C /* Development */,
+				737C9E9E08F7FE4D00DAC36C /* Deployment */,
+				737810D208FCC24B00686713 /* Deployment (optimized+) */,
+				737C9E9F08F7FE4D00DAC36C /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 089C1669FE841209C02AAC07 /* Project object */;
+}

Added: trunk/xiph-qt/CAVorbis/CAVorbis_Prefix.pch
===================================================================
--- trunk/xiph-qt/CAVorbis/CAVorbis_Prefix.pch	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/CAVorbis_Prefix.pch	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,5 @@
+//
+// Prefix header for all source files of the 'CAVorbis' target in the 'CAVorbis' project.
+//
+
+#include <Carbon/Carbon.h>

Added: trunk/xiph-qt/CAVorbis/English.lproj/InfoPlist.strings
===================================================================
(Binary files differ)


Property changes on: trunk/xiph-qt/CAVorbis/English.lproj/InfoPlist.strings
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/xiph-qt/CAVorbis/Info.plist
===================================================================
--- trunk/xiph-qt/CAVorbis/Info.plist	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/Info.plist	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>CAVorbis</string>
+	<key>CFBundleIconFile</key>
+	<string></string>
+	<key>CFBundleIdentifier</key>
+	<string>net.barelyfocused.xiph.cavorbis</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>0.1.1</string>
+	<key>CFBundleSignature</key>
+	<string>adec</string>
+	<key>CFBundleVersion</key>
+	<string>0.1.1</string>
+	<key>CSResourcesFileMapped</key>
+	<true/>
+</dict>
+</plist>

Added: trunk/xiph-qt/CAVorbis/PkgInfo
===================================================================
--- trunk/xiph-qt/CAVorbis/PkgInfo	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/PkgInfo	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1 @@
+thngadec
\ No newline at end of file


Property changes on: trunk/xiph-qt/CAVorbis/build
___________________________________________________________________
Name: svn:ignore
   + *


Added: trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.cpp
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,239 @@
+/*
+ *  CAOggVorbisDecoder.cpp
+ *
+ *    CAOggVorbisDecoder class implementation; translation layer handling
+ *    ogg page encapsulation of Vorbis packets, using CAVorbisDecoder
+ *    for the actual decoding.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "CAOggVorbisDecoder.h"
+
+#include "fccs.h"
+#include "data_types.h"
+
+#include "wrap_ogg.h"
+
+#include "debug.h"
+
+
+CAOggVorbisDecoder::CAOggVorbisDecoder() :
+CAVorbisDecoder(true),
+mFramesBufferedList()
+{
+    CAStreamBasicDescription theInputFormat(kAudioStreamAnyRate, kAudioFormatXiphOggFramedVorbis,
+                                            kVorbisBytesPerPacket, kVorbisFramesPerPacket,
+                                            kVorbisBytesPerFrame, kVorbisChannelsPerFrame,
+                                            kVorbisBitsPerChannel, kVorbisFormatFlags);
+    AddInputFormat(theInputFormat);
+    
+    mInputFormat.mSampleRate = 44100;
+    mInputFormat.mFormatID = kAudioFormatXiphOggFramedVorbis;
+    mInputFormat.mFormatFlags = kVorbisFormatFlags;
+    mInputFormat.mBytesPerPacket = kVorbisBytesPerPacket;
+    mInputFormat.mFramesPerPacket = kVorbisFramesPerPacket;
+    mInputFormat.mBytesPerFrame = kVorbisBytesPerFrame;
+    mInputFormat.mChannelsPerFrame = 2;
+    mInputFormat.mBitsPerChannel = kVorbisBitsPerChannel;
+    
+    CAStreamBasicDescription theOutputFormat1(kAudioStreamAnyRate, kAudioFormatLinearPCM, 0, 1, 0, 0, 16,
+                                              kAudioFormatFlagsNativeEndian |
+                                              kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked);
+    AddOutputFormat(theOutputFormat1);
+    CAStreamBasicDescription theOutputFormat2(kAudioStreamAnyRate, kAudioFormatLinearPCM, 0, 1, 0, 0, 32,
+                                              kAudioFormatFlagsNativeFloatPacked);
+    AddOutputFormat(theOutputFormat2);
+    
+    mOutputFormat.mSampleRate = 44100;
+	mOutputFormat.mFormatID = kAudioFormatLinearPCM;
+	mOutputFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+	mOutputFormat.mBytesPerPacket = 8;
+	mOutputFormat.mFramesPerPacket = 1;
+	mOutputFormat.mBytesPerFrame = 8;
+	mOutputFormat.mChannelsPerFrame = 2;
+	mOutputFormat.mBitsPerChannel = 32;
+}
+
+CAOggVorbisDecoder::~CAOggVorbisDecoder()
+{
+    if (mCompressionInitialized)
+        ogg_stream_clear(&mO_st);
+}
+
+void CAOggVorbisDecoder::SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat)
+{
+	if (!mIsInitialized) {
+		if (inInputFormat.mFormatID != kAudioFormatXiphOggFramedVorbis) {
+			dprintf("CAOggVorbisDecoder::SetFormats: only support Xiph Vorbis (Ogg-framed) for input\n");
+			CODEC_THROW(kAudioCodecUnsupportedFormatError);
+		}
+        XCACodec::SetCurrentInputFormat(inInputFormat);
+	} else {
+		CODEC_THROW(kAudioCodecStateError);
+	}
+}
+
+UInt32 CAOggVorbisDecoder::ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
+                                                AudioStreamPacketDescription* outPacketDescription)
+{
+    dprintf(" >> [%08lx] CAOggVorbisDecoder :: ProduceOutputPackets(%ld [%ld])\n", (UInt32) this, ioNumberPackets, ioOutputDataByteSize);
+    UInt32 ret = kAudioCodecProduceOutputPacketSuccess;
+
+    if (mFramesBufferedList.empty()) {
+        ioOutputDataByteSize = 0;
+        ioNumberPackets = 0;
+        ret = kAudioCodecProduceOutputPacketNeedsMoreInputData;
+        dprintf("<!E [%08lx] CAOggVorbisDecoder :: ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n", (UInt32) this,
+                ioNumberPackets, ioOutputDataByteSize, ret, FramesReady());
+        return ret;
+    }
+
+    UInt32 vorbis_packets = mFramesBufferedList.front();
+    UInt32 ogg_packets = 0;
+    UInt32 vorbis_returned_data = ioOutputDataByteSize;
+    UInt32 vorbis_total_returned_data = 0;
+    Byte *the_data = static_cast<Byte*> (outOutputData);
+
+    while (true) {
+        UInt32 vorbis_return = CAVorbisDecoder::ProduceOutputPackets(the_data, vorbis_returned_data, vorbis_packets, NULL);
+        if (vorbis_return == kAudioCodecProduceOutputPacketSuccess || vorbis_return == kAudioCodecProduceOutputPacketSuccessHasMore) {
+            if (vorbis_packets > 0)
+                mFramesBufferedList.front() -= vorbis_packets;
+
+            if (mFramesBufferedList.front() <= 0) {
+                ogg_packets++;
+                mFramesBufferedList.erase(mFramesBufferedList.begin());
+            }
+            
+            vorbis_total_returned_data += vorbis_returned_data;
+
+            if (vorbis_total_returned_data == ioOutputDataByteSize || vorbis_return == kAudioCodecProduceOutputPacketSuccess)
+            {
+                ioNumberPackets = ogg_packets;
+                ioOutputDataByteSize = vorbis_total_returned_data;
+
+                if (!mFramesBufferedList.empty())
+                    ret = kAudioCodecProduceOutputPacketSuccessHasMore;
+                else
+                    ret = kAudioCodecProduceOutputPacketSuccess;
+
+                break;
+            } else {
+                the_data += vorbis_returned_data;
+                vorbis_returned_data = ioOutputDataByteSize - vorbis_total_returned_data;
+                vorbis_packets = mFramesBufferedList.front();
+            }
+        } else {
+            ret = kAudioCodecProduceOutputPacketFailure;
+            ioOutputDataByteSize = vorbis_total_returned_data;
+            ioNumberPackets = ogg_packets;
+            break;
+        }
+    }
+
+    dprintf("<.. [%08lx] CAOggVorbisDecoder :: ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n",
+            (UInt32) this, ioNumberPackets, ioOutputDataByteSize, ret, FramesReady());
+    return ret;
+}
+
+
+void CAOggVorbisDecoder::BDCInitialize(UInt32 inInputBufferByteSize)
+{
+    CAVorbisDecoder::BDCInitialize(inInputBufferByteSize);
+}
+
+void CAOggVorbisDecoder::BDCUninitialize()
+{
+    mFramesBufferedList.clear();
+    CAVorbisDecoder::BDCUninitialize();
+}
+
+void CAOggVorbisDecoder::BDCReset()
+{
+    mFramesBufferedList.clear();
+    if (mCompressionInitialized)
+        ogg_stream_reset(&mO_st);
+    CAVorbisDecoder::BDCReset();
+}
+
+void CAOggVorbisDecoder::BDCReallocate(UInt32 inInputBufferByteSize)
+{
+    mFramesBufferedList.clear();
+    CAVorbisDecoder::BDCReallocate(inInputBufferByteSize);
+}
+
+
+void CAOggVorbisDecoder::InPacket(const void* inInputData, const AudioStreamPacketDescription* inPacketDescription)
+{
+    if (!mCompressionInitialized)
+        CODEC_THROW(kAudioCodecUnspecifiedError);
+    
+    ogg_page op;
+
+    if (!WrapOggPage(&op, inInputData, inPacketDescription->mDataByteSize, inPacketDescription->mStartOffset))
+        CODEC_THROW(kAudioCodecUnspecifiedError);
+
+    ogg_packet opk;
+    SInt32 packet_count = 0;
+    int oret;
+    AudioStreamPacketDescription vorbis_packet_desc = {0, 0, 0};
+    UInt32 page_packets = ogg_page_packets(&op);
+
+    ogg_stream_pagein(&mO_st, &op);
+    while ((oret = ogg_stream_packetout(&mO_st, &opk)) != 0) {
+        if (oret < 0) {
+            page_packets--;
+            continue;
+        }
+        
+        packet_count++;
+
+        vorbis_packet_desc.mDataByteSize = opk.bytes;
+
+        CAVorbisDecoder::InPacket(opk.packet, &vorbis_packet_desc);
+    }
+
+    mFramesBufferedList.push_back(packet_count);
+}
+
+
+void CAOggVorbisDecoder::InitializeCompressionSettings()
+{
+    if (mCookie != NULL) {
+        if (mCompressionInitialized)
+            ogg_stream_clear(&mO_st);
+
+        OggSerialNoAtom *atom = reinterpret_cast<OggSerialNoAtom*> (mCookie);
+    
+        if (EndianS32_BtoN(atom->type) == kCookieTypeOggSerialNo && EndianS32_BtoN(atom->size) <= mCookieSize) {
+            ogg_stream_init(&mO_st, EndianS32_BtoN(atom->serialno));
+        }
+    }
+
+    ogg_stream_reset(&mO_st);
+
+    CAVorbisDecoder::InitializeCompressionSettings();
+}


Property changes on: trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.cpp
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.h
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,69 @@
+/*
+ *  CAOggVorbisDecoder.h
+ *
+ *    CAOggVorbisDecoder class definition.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__CAOggVorbisDecoder_h__)
+#define __CAOggVorbisDecoder_h__
+
+#include <Ogg/ogg.h>
+#include <vector>
+
+#include "CAVorbisDecoder.h"
+
+#include "CAStreamBasicDescription.h"
+
+
+class CAOggVorbisDecoder :
+public CAVorbisDecoder
+{
+public:
+    CAOggVorbisDecoder();
+    virtual ~CAOggVorbisDecoder();
+
+    virtual UInt32			ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
+                                                 AudioStreamPacketDescription* outPacketDescription);
+    virtual void			SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat);
+
+protected:
+    virtual void			BDCInitialize(UInt32 inInputBufferByteSize);
+    virtual void			BDCUninitialize();
+    virtual void			BDCReset();
+    virtual void			BDCReallocate(UInt32 inInputBufferByteSize);
+
+    virtual void			InPacket(const void* inInputData, const AudioStreamPacketDescription* inPacketDescription);
+    
+    void					InitializeCompressionSettings();
+
+    ogg_stream_state		mO_st;
+    std::vector<SInt32>		mFramesBufferedList;
+};
+
+
+
+#endif /* __CAOggVorbisDecoder_h__ */


Property changes on: trunk/xiph-qt/CAVorbis/src/CAOggVorbisDecoder.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CAVorbis/src/CAVorbisCodec.exp
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisCodec.exp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisCodec.exp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,2 @@
+_CAVorbisDecoderEntry
+_CAOggVorbisDecoderEntry

Added: trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,572 @@
+/*
+ *  CAVorbisDecoder.cpp
+ *
+ *    CAVorbisDecoder class implementation; the main part of the Vorbis
+ *    codec functionality.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include <Ogg/ogg.h>
+#include <Vorbis/codec.h>
+
+#include "CAVorbisDecoder.h"
+
+#include "CABundleLocker.h"
+
+#include "vorbis_versions.h"
+#include "fccs.h"
+#include "data_types.h"
+
+//#define NDEBUG
+#include "debug.h"
+
+CAVorbisDecoder::CAVorbisDecoder(Boolean inSkipFormatsInitialization /* = false */) :
+mCookie(NULL), mCookieSize(0), mCompressionInitialized(false),
+mVorbisFPList(), mConsumedFPList(),
+mFullInPacketsZapped(0)
+{
+    if (inSkipFormatsInitialization)
+        return;
+
+    CAStreamBasicDescription theInputFormat(kAudioStreamAnyRate, kAudioFormatXiphVorbis,
+                                            kVorbisBytesPerPacket, kVorbisFramesPerPacket,
+                                            kVorbisBytesPerFrame, kVorbisChannelsPerFrame,
+                                            kVorbisBitsPerChannel, kVorbisFormatFlags);
+    AddInputFormat(theInputFormat);
+    
+    mInputFormat.mSampleRate = 44100;
+    mInputFormat.mFormatID = kAudioFormatXiphVorbis;
+    mInputFormat.mFormatFlags = kVorbisFormatFlags;
+    mInputFormat.mBytesPerPacket = kVorbisBytesPerPacket;
+    mInputFormat.mFramesPerPacket = kVorbisFramesPerPacket;
+    mInputFormat.mBytesPerFrame = kVorbisBytesPerFrame;
+    mInputFormat.mChannelsPerFrame = 2;
+    mInputFormat.mBitsPerChannel = kVorbisBitsPerChannel;
+    
+    CAStreamBasicDescription theOutputFormat1(kAudioStreamAnyRate, kAudioFormatLinearPCM, 0, 1, 0, 0, 16,
+                                              kAudioFormatFlagsNativeEndian |
+                                              kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked);
+    AddOutputFormat(theOutputFormat1);
+    CAStreamBasicDescription theOutputFormat2(kAudioStreamAnyRate, kAudioFormatLinearPCM, 0, 1, 0, 0, 32,
+                                              kAudioFormatFlagsNativeFloatPacked);
+    AddOutputFormat(theOutputFormat2);
+    
+    mOutputFormat.mSampleRate = 44100;
+	mOutputFormat.mFormatID = kAudioFormatLinearPCM;
+	mOutputFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+	mOutputFormat.mBytesPerPacket = 8;
+	mOutputFormat.mFramesPerPacket = 1;
+	mOutputFormat.mBytesPerFrame = 8;
+	mOutputFormat.mChannelsPerFrame = 2;
+	mOutputFormat.mBitsPerChannel = 32;
+}
+
+CAVorbisDecoder::~CAVorbisDecoder()
+{
+    if (mCookie != NULL)
+        delete[] mCookie;
+    
+    if (mCompressionInitialized) {
+        vorbis_block_clear(&mV_vb);
+        vorbis_dsp_clear(&mV_vd);
+        
+        vorbis_info_clear(&mV_vi);
+    }
+}
+
+void CAVorbisDecoder::Initialize(const AudioStreamBasicDescription* inInputFormat,
+                                 const AudioStreamBasicDescription* inOutputFormat,
+                                 const void* inMagicCookie, UInt32 inMagicCookieByteSize)
+{
+    dprintf(" >> [%08lx] :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
+    
+    if(inInputFormat != NULL) {
+		SetCurrentInputFormat(*inInputFormat);
+	}
+    
+	if(inOutputFormat != NULL) {
+		SetCurrentOutputFormat(*inOutputFormat);
+	}
+    
+	if ((mInputFormat.mSampleRate != mOutputFormat.mSampleRate) ||
+		(mInputFormat.mChannelsPerFrame != mOutputFormat.mChannelsPerFrame)) {
+		CODEC_THROW(kAudioCodecUnsupportedFormatError);
+	}
+	
+    BDCInitialize(kVorbisDecoderBufferSize);
+
+    //if (inMagicCookieByteSize == 0)
+    //    CODEC_THROW(kAudioCodecUnsupportedFormatError);
+    
+    if (inMagicCookieByteSize != 0) {
+        SetMagicCookie(inMagicCookie, inMagicCookieByteSize);
+    }
+    
+    //if (mCompressionInitialized)
+    //    FixFormats();
+    
+    XCACodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize);
+    dprintf("<.. [%08lx] :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
+}
+
+void CAVorbisDecoder::Uninitialize()
+{
+    dprintf(" >> [%08lx] :: Uninitialize()\n", (UInt32) this);
+    BDCUninitialize();
+
+    XCACodec::Uninitialize();
+    dprintf("<.. [%08lx] :: Uninitialize()\n", (UInt32) this);
+}
+
+void CAVorbisDecoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
+{	
+    dprintf(" >> [%08lx] :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+	switch(inPropertyID)
+	{
+        case kAudioCodecPropertyRequiresPacketDescription:
+  			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+                *reinterpret_cast<UInt32*>(outPropertyData) = 1; 
+            }
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+            break;
+        case kAudioCodecPropertyHasVariablePacketByteSizes:
+  			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+                *reinterpret_cast<UInt32*>(outPropertyData) = 1;
+            }
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+            break;
+		case kAudioCodecPropertyPacketFrameSize:
+			if(ioPropertyDataSize == sizeof(UInt32))
+			{
+                *reinterpret_cast<UInt32*>(outPropertyData) = kVorbisFramesPerPacket;
+            }
+			else
+			{
+				CODEC_THROW(kAudioCodecBadPropertySizeError);
+			}
+			break;
+            
+        //case kAudioCodecPropertyQualitySetting: ???
+#if TARGET_OS_MAC
+		case kAudioCodecPropertyNameCFString:
+		{
+			if (ioPropertyDataSize != sizeof(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
+			
+			CABundleLocker lock;
+			CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Xiph Vorbis decoder"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
+			*(CFStringRef*)outPropertyData = name;
+			break; 
+		}
+
+        //case kAudioCodecPropertyManufacturerCFString:
+#endif
+		default:
+			ACBaseCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
+	}
+    dprintf("<.. [%08lx] :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+}
+
+void CAVorbisDecoder::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable)
+{
+    dprintf(" >> [%08lx] :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+	switch(inPropertyID)
+	{
+		case kAudioCodecPropertyRequiresPacketDescription:
+			outPropertyDataSize = sizeof(UInt32);
+			outWritable = false;
+			break;
+            
+		case kAudioCodecPropertyHasVariablePacketByteSizes:
+			outPropertyDataSize = sizeof(UInt32);
+			outWritable = false;
+			break;
+            
+		case kAudioCodecPropertyPacketFrameSize:
+			outPropertyDataSize = sizeof(UInt32);
+			outWritable = false;
+			break;
+            
+		default:
+			ACBaseCodec::GetPropertyInfo(inPropertyID, outPropertyDataSize, outWritable);
+			break;
+			
+	}
+    dprintf("<.. [%08lx] :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+}
+
+void CAVorbisDecoder::Reset()
+{
+    dprintf(">> [%08lx] :: Reset()\n", (UInt32) this);
+    BDCReset();
+
+	XCACodec::Reset();
+    dprintf("<< [%08lx] :: Reset()\n", (UInt32) this);
+}
+
+UInt32 CAVorbisDecoder::GetVersion() const
+{
+	return kCAVorbis_adec_Version;
+}
+
+
+void CAVorbisDecoder::SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat)
+{
+	if (!mIsInitialized) {
+		//	check to make sure the input format is legal
+		if (inInputFormat.mFormatID != kAudioFormatXiphVorbis) {
+			dprintf("CAVorbisDecoder::SetFormats: only support Xiph Vorbis for input\n");
+			CODEC_THROW(kAudioCodecUnsupportedFormatError);
+		}
+		
+		//	tell our base class about the new format
+		XCACodec::SetCurrentInputFormat(inInputFormat);
+	} else {
+		CODEC_THROW(kAudioCodecStateError);
+	}
+}
+
+void CAVorbisDecoder::SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat)
+{
+	if (!mIsInitialized) {
+		//	check to make sure the output format is legal
+		if ((inOutputFormat.mFormatID != kAudioFormatLinearPCM) ||
+			!(((inOutputFormat.mFormatFlags == kAudioFormatFlagsNativeFloatPacked) &&
+               (inOutputFormat.mBitsPerChannel == 32)) ||
+			   ((inOutputFormat.mFormatFlags == (kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked)) &&
+                (inOutputFormat.mBitsPerChannel == 16))))
+        {
+			dprintf("CAVorbisDecoder::SetFormats: only supports either 16 bit native endian signed integer or 32 bit native endian Core Audio floats for output\n");
+			CODEC_THROW(kAudioCodecUnsupportedFormatError);
+		}
+		
+		//	tell our base class about the new format
+		XCACodec::SetCurrentOutputFormat(inOutputFormat);
+	} else {
+		CODEC_THROW(kAudioCodecStateError);
+	}
+}
+
+UInt32 CAVorbisDecoder::GetMagicCookieByteSize() const
+{
+    return mCookieSize;
+}
+
+void CAVorbisDecoder::GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const
+{
+    ioMagicCookieDataByteSize = mCookieSize;
+    
+    if (mCookie != NULL)
+        outMagicCookieData = mCookie;
+}
+
+void CAVorbisDecoder::SetMagicCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize)
+{
+    dprintf(" >> [%08lx] :: SetMagicCookie()\n", (UInt32) this);
+	if (mIsInitialized)
+		CODEC_THROW(kAudioCodecStateError);
+    
+    SetCookie(inMagicCookieData, inMagicCookieDataByteSize);
+    
+    InitializeCompressionSettings();
+    
+    if (!mCompressionInitialized)
+        CODEC_THROW(kAudioCodecUnsupportedFormatError);
+    dprintf("<.. [%08lx] :: SetMagicCookie()\n", (UInt32) this);
+}
+
+void CAVorbisDecoder::SetCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize)
+{
+    if (mCookie != NULL)
+        delete[] mCookie;
+    
+    mCookieSize = inMagicCookieDataByteSize;
+    if (inMagicCookieDataByteSize != 0) {
+        mCookie = new Byte[inMagicCookieDataByteSize];
+        BlockMoveData(inMagicCookieData, mCookie, inMagicCookieDataByteSize);
+    } else {
+        mCookie = NULL;
+    }
+}
+
+
+
+#if 0
+void CAVorbisDecoder::FixFormats()
+{
+    mInputFormat.mSampleRate = mV_vi.rate;
+    mInputFormat.mChannelsPerFrame = mV_vi.channels;
+
+    /*
+	mInputFormat.mFramesPerPacket = 64;
+	mInputFormat.mBytesPerPacket = mInputFormat.mChannelsPerFrame * 34;
+	mInputFormat.mBytesPerFrame = 0;
+    */    
+}
+#endif
+
+
+void CAVorbisDecoder::InitializeCompressionSettings()
+{
+    if (mCookie == NULL)
+        return;
+
+    if (mCompressionInitialized) {
+        vorbis_block_clear(&mV_vb);
+        vorbis_dsp_clear(&mV_vd);
+        
+        vorbis_info_clear(&mV_vi);        
+    }
+    
+    mCompressionInitialized = false;
+
+    OggSerialNoAtom *atom = reinterpret_cast<OggSerialNoAtom*> (mCookie);
+    Byte *ptrheader = mCookie + EndianU32_BtoN(atom->size);
+    CookieAtomHeader *aheader = reinterpret_cast<CookieAtomHeader*> (ptrheader);
+
+    // scan quickly through the cookie, check types and packet sizes
+    if (EndianS32_BtoN(atom->type) != kCookieTypeOggSerialNo || static_cast<UInt32> (ptrheader - mCookie) > mCookieSize)
+        return;
+    ptrheader += EndianU32_BtoN(aheader->size);
+    if (EndianS32_BtoN(aheader->type) != kCookieTypeVorbisHeader || static_cast<UInt32> (ptrheader - mCookie) > mCookieSize)
+        return;
+    aheader = reinterpret_cast<CookieAtomHeader*> (ptrheader);
+    ptrheader += EndianU32_BtoN(aheader->size);
+    if (EndianS32_BtoN(aheader->type) != kCookieTypeVorbisComments || static_cast<UInt32> (ptrheader - mCookie) > mCookieSize)
+        return;
+    aheader = reinterpret_cast<CookieAtomHeader*> (ptrheader);
+    ptrheader += EndianU32_BtoN(aheader->size);
+    if (EndianS32_BtoN(aheader->type) != kCookieTypeVorbisCodebooks || static_cast<UInt32> (ptrheader - mCookie) > mCookieSize)
+        return;
+
+    // all OK, back to the first vorbis packet
+    aheader = reinterpret_cast<CookieAtomHeader*> (mCookie + EndianU32_BtoN(atom->size));
+
+    vorbis_comment vc;
+
+    //ogg_stream_init(&mO_st, EndianS32_BtoN(atom->serialno));
+
+    vorbis_info_init(&mV_vi);
+    vorbis_comment_init(&vc);
+    ogg_packet op;
+
+    op.b_o_s = 1;
+    op.e_o_s = 0;
+    op.granulepos = 0;
+    op.packetno = 0;
+    op.bytes = EndianU32_BtoN(aheader->size) - 2 * sizeof(long); // FIXME??
+    op.packet = aheader->data;
+
+    if (vorbis_synthesis_headerin(&mV_vi, &vc, &op) < 0) {
+        //ogg_stream_clear(&mO_st);
+        
+        vorbis_comment_clear(&vc);
+        vorbis_info_clear(&mV_vi);
+        
+        return;        
+    }
+
+    op.b_o_s = 0;
+    UInt32 i=0;
+
+    while (i < 2) {
+        aheader = reinterpret_cast<CookieAtomHeader*> (reinterpret_cast<Byte*> (aheader) + EndianU32_BtoN(aheader->size));
+        op.packetno += 1;
+        op.bytes = EndianU32_BtoN(aheader->size) - 2 * sizeof(long); // FIXME??
+        op.packet = aheader->data;
+
+        vorbis_synthesis_headerin(&mV_vi, &vc, &op);
+        i++;
+    }
+    
+    vorbis_synthesis_init(&mV_vd, &mV_vi);
+    vorbis_block_init(&mV_vd, &mV_vb);
+    
+    vorbis_comment_clear(&vc);
+
+    //ogg_stream_reset(&mO_st);
+
+    mCompressionInitialized = true;
+}
+
+#pragma mark BDC handling
+
+void CAVorbisDecoder::BDCInitialize(UInt32 inInputBufferByteSize)
+{
+    XCACodec::BDCInitialize(inInputBufferByteSize);
+}
+
+void CAVorbisDecoder::BDCUninitialize()
+{
+    mVorbisFPList.clear();
+    mConsumedFPList.clear();
+    mFullInPacketsZapped = 0;
+    
+    XCACodec::BDCUninitialize();
+}
+
+void CAVorbisDecoder::BDCReset()
+{
+    mVorbisFPList.clear();
+    mConsumedFPList.clear();
+    mFullInPacketsZapped = 0;
+
+    vorbis_synthesis_restart(&mV_vd);
+    
+    //vorbis_block_clear(&globals->vb);
+    //vorbis_block_init(&globals->vd, &globals->vb);
+    
+    XCACodec::BDCReset();
+}
+
+void CAVorbisDecoder::BDCReallocate(UInt32 inInputBufferByteSize)
+{
+    mVorbisFPList.clear();
+    mConsumedFPList.clear();
+    mFullInPacketsZapped = 0;
+
+    XCACodec::BDCReallocate(inInputBufferByteSize);
+}
+
+
+void CAVorbisDecoder::InPacket(const void* inInputData, const AudioStreamPacketDescription* inPacketDescription)
+{
+    const Byte * theData = static_cast<const Byte *> (inInputData) + inPacketDescription->mStartOffset;
+    UInt32 size = inPacketDescription->mDataByteSize;
+    mBDCBuffer.In(theData, size);
+    mVorbisFPList.push_back(VorbisFramePacket(inPacketDescription->mVariableFramesInPacket, inPacketDescription->mDataByteSize));
+}
+
+
+UInt32 CAVorbisDecoder::FramesReady() const
+{
+    //return mNumFrames; // TODO: definitely probably not right!!
+    return vorbis_synthesis_pcmout(const_cast<vorbis_dsp_state*> (&mV_vd), NULL);
+}
+
+Boolean CAVorbisDecoder::GenerateFrames()
+{
+    Boolean ret = true;
+
+    mBDCStatus = kBDCStatusOK;
+    while (vorbis_synthesis_pcmout(&mV_vd, NULL) == 0 && !mVorbisFPList.empty()) {
+        ogg_packet op;
+        int vErr;
+        Boolean gaap = false;
+        VorbisFramePacket &sfp = mVorbisFPList.front();
+
+        op.b_o_s = 0;
+        op.e_o_s = 0;
+        op.granulepos = -1;
+        op.packetno = 0; // ??!
+        op.bytes = sfp.bytes; // FIXME??
+        op.packet = mBDCBuffer.GetData();
+        
+        if ((vErr = vorbis_synthesis(&mV_vb, &op)) == 0)
+            vorbis_synthesis_blockin(&mV_vd, &mV_vb);
+        else {
+            if (!gaap) {
+                mBDCStatus = kBDCStatusAbort;
+                ret = false;
+            }
+        }
+
+        mBDCBuffer.Zap(sfp.bytes);
+        sfp.left = sfp.frames = vorbis_synthesis_pcmout(&mV_vd, NULL);
+        mConsumedFPList.push_back(sfp);
+        mVorbisFPList.erase(mVorbisFPList.begin());
+
+        if (ret != true)
+            break;
+    }
+
+    return ret;
+}
+
+void CAVorbisDecoder::OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const
+{
+    float **pcm;
+    vorbis_synthesis_pcmout(const_cast<vorbis_dsp_state*> (&mV_vd), &pcm);  // ignoring the result, but should be (!!) at least inNumberFrames
+
+    if (mOutputFormat.mFormatFlags & kAudioFormatFlagsNativeFloatPacked != 0) {
+        for (SInt32 i = 0; i < mV_vi.channels; i++) {
+            float* theOutputData = static_cast<float*> (outOutputData) + i + (inFramesOffset * mV_vi.channels);
+            float* mono = pcm[i];
+            for (UInt32 j = 0; j < inNumberFrames; j++) {
+                *theOutputData = mono[j];
+                theOutputData += mV_vi.channels;
+            }
+        }
+    } else {
+        for (SInt32 i = 0; i < mV_vi.channels; i++) {
+            SInt16* theOutputData = static_cast<SInt16*> (outOutputData) + i + (inFramesOffset * mV_vi.channels);
+            float* mono = pcm[i];
+            for (UInt32 j = 0; j < inNumberFrames; j++) {
+                SInt32 val = static_cast<SInt32> (mono[j] * 32767.f);
+                
+                if (val > 32767)
+                    val = 32767;
+                if (val < -32768)
+                    val = -32768;
+                
+                *theOutputData = val;
+                theOutputData += mV_vi.channels;
+            }
+        }
+    }
+}
+
+void CAVorbisDecoder::Zap(UInt32 inFrames)
+{
+    vorbis_synthesis_read(&mV_vd, inFrames);
+
+    mFullInPacketsZapped = 0;
+    UInt32 frames = 0;
+    VorbisFramePacketList::iterator cp = mConsumedFPList.begin();
+    while (frames < inFrames && cp != mConsumedFPList.end()) {
+        if (frames + cp->left <= inFrames) {
+            frames += cp->left;
+            mFullInPacketsZapped++;
+            cp = mConsumedFPList.erase(cp);
+        } else {
+            cp->left -= inFrames - frames;
+            break;
+        }
+    }
+}
+
+UInt32 CAVorbisDecoder::InPacketsConsumed() const
+{
+    return mFullInPacketsZapped;
+}
+


Property changes on: trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,125 @@
+/*
+ *  CAVorbisDecoder.h
+ *
+ *    CAVorbisDecoder class definition.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__CAVorbisDecoder_h__)
+#define __CAVorbisDecoder_h__
+
+
+#include "XCACodec.h"
+
+#include <Ogg/ogg.h>
+#include <Vorbis/codec.h>
+
+#include <vector>
+
+
+class CAVorbisDecoder:
+public XCACodec
+{
+public:
+    CAVorbisDecoder(Boolean inSkipFormatsInitialization = false);
+    ~CAVorbisDecoder();
+
+    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        GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable);
+    
+    virtual void		SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat);
+    virtual void		SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat);
+    virtual UInt32		GetVersion() const;
+
+	virtual UInt32		GetMagicCookieByteSize() const;
+	virtual void		GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const;
+	virtual void		SetMagicCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize);
+
+protected:
+    virtual void		BDCInitialize(UInt32 inInputBufferByteSize);
+    virtual void		BDCUninitialize();
+    virtual void		BDCReset();
+    virtual void		BDCReallocate(UInt32 inInputBufferByteSize);
+    
+    virtual void		InPacket(const void* inInputData, const AudioStreamPacketDescription* inPacketDescription);
+    
+    virtual UInt32		FramesReady() const;
+    virtual Boolean		GenerateFrames();
+    virtual void		OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const;
+    virtual void		Zap(UInt32 inFrames);
+    
+    virtual UInt32		InPacketsConsumed() const;
+
+    void				SetCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize);
+    virtual void		InitializeCompressionSettings();
+    
+    //virtual void        FixFormats();
+    
+protected:
+    Byte*				mCookie;
+    UInt32				mCookieSize;
+
+    Boolean				mCompressionInitialized;
+
+    vorbis_info			mV_vi;
+    vorbis_dsp_state	mV_vd;
+    vorbis_block		mV_vb;
+
+    struct VorbisFramePacket {
+        UInt32 frames;
+		UInt32 bytes;
+		UInt32 left;
+        
+        VorbisFramePacket() : frames(0), bytes(0), left(0) {};
+        VorbisFramePacket(UInt32 inFrames, UInt32 inBytes) : frames(inFrames), bytes(inBytes), left(inBytes) {};
+    };
+    
+    typedef std::vector<VorbisFramePacket>	VorbisFramePacketList;
+    VorbisFramePacketList					mVorbisFPList;
+    VorbisFramePacketList					mConsumedFPList;
+
+    UInt32				mFullInPacketsZapped;
+    
+
+    enum {
+        kVorbisBytesPerPacket = 0,
+        kVorbisFramesPerPacket = 0,
+        kVorbisBytesPerFrame = 0,
+        kVorbisChannelsPerFrame = 0,
+        kVorbisBitsPerChannel = 16,
+        kVorbisFormatFlags = 0,
+
+        kVorbisDecoderBufferSize = 64 * 1024
+    };
+};
+
+#endif /* __CAVorbisDecoder_h__ */
\ No newline at end of file


Property changes on: trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CAVorbis/src/CAVorbisDecoderPublic.r
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisDecoderPublic.r	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisDecoderPublic.r	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,58 @@
+/*
+ *  CAVorbisDecoderPublic.r
+ *
+ *    Information bit definitions for the 'thng' resource.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "vorbis_versions.h"
+#include "fccs.h"
+
+
+
+#define RES_ID			-17110
+#define COMP_TYPE		'adec'
+#define COMP_SUBTYPE	kAudioFormatXiphOggFramedVorbis
+#define COMP_MANUF		'Xiph'
+#define VERSION			kCAVorbis_adec_Version
+#define NAME			"Xiph Vorbis (Ogg-framed) Decoder"
+#define DESCRIPTION		"An AudioCodec that decodes Xiph Vorbis (Ogg-framed) into linear PCM data"
+#define ENTRY_POINT		"CAOggVorbisDecoderEntry"
+
+#include "AUResources.r"
+
+
+
+#define RES_ID			-17114
+#define COMP_TYPE		'adec'
+#define COMP_SUBTYPE	kAudioFormatXiphVorbis
+#define COMP_MANUF		'Xiph'
+#define VERSION			kCAVorbis_adec_Version
+#define NAME			"Xiph Vorbis Decoder"
+#define DESCRIPTION		"An AudioCodec that decodes Xiph Vorbis into linear PCM data"
+#define ENTRY_POINT		"CAVorbisDecoderEntry"
+
+#include "AUResources.r"


Property changes on: trunk/xiph-qt/CAVorbis/src/CAVorbisDecoderPublic.r
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CAVorbis/src/vorbis_entrypoints.cpp
===================================================================
--- trunk/xiph-qt/CAVorbis/src/vorbis_entrypoints.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/src/vorbis_entrypoints.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,47 @@
+/*
+ *  vorbis_entrypoints.cpp
+ *
+ *    Declaration of the entry points for the Vorbis component.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "CAVorbisDecoder.h"
+#include "CAOggVorbisDecoder.h"
+
+#include "ACCodecDispatch.h"
+
+extern "C"
+ComponentResult	CAVorbisDecoderEntry(ComponentParameters* inParameters, CAVorbisDecoder* inThis)
+{	
+	return	ACCodecDispatch(inParameters, inThis);
+}
+
+extern "C"
+ComponentResult	CAOggVorbisDecoderEntry(ComponentParameters* inParameters, CAOggVorbisDecoder* inThis)
+{	
+	return	ACCodecDispatch(inParameters, inThis);
+}
+


Property changes on: trunk/xiph-qt/CAVorbis/src/vorbis_entrypoints.cpp
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/CAVorbis/src/vorbis_versions.h
===================================================================
--- trunk/xiph-qt/CAVorbis/src/vorbis_versions.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/CAVorbis/src/vorbis_versions.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,42 @@
+/*
+ *  vorbis_versions.h
+ *
+ *    The current version of the Vorbis component.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__vorbis_versions_h__)
+#define __vorbis_versions_h__
+
+
+#ifdef DEBUG
+#define kCAVorbis_adec_Version		(0x00FF0101)
+#else
+#define kCAVorbis_adec_Version		(0x00000101)
+#endif /* DEBUG */
+
+
+#endif /* __vorbis_versions_h__ */


Property changes on: trunk/xiph-qt/CAVorbis/src/vorbis_versions.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/COPYING
===================================================================
--- trunk/xiph-qt/COPYING	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/COPYING	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+

Added: trunk/xiph-qt/OggImport/COPYING.qtcomponents
===================================================================
--- trunk/xiph-qt/OggImport/COPYING.qtcomponents	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/COPYING.qtcomponents	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,29 @@
+Copyright (c) 2001-2003, Steve Nicolai
+All Rights Reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+- Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+- Neither the name of the QuickTime Components Project nor the names
+of its contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT
+LEADERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Added: trunk/xiph-qt/OggImport/English.lproj/InfoPlist.strings
===================================================================
(Binary files differ)


Property changes on: trunk/xiph-qt/OggImport/English.lproj/InfoPlist.strings
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/xiph-qt/OggImport/Info.plist
===================================================================
--- trunk/xiph-qt/OggImport/Info.plist	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/Info.plist	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>English</string>
+	<key>CFBundleExecutable</key>
+	<string>OggImport</string>
+	<key>CFBundleIconFile</key>
+	<string></string>
+	<key>CFBundleIdentifier</key>
+	<string>net.barelyfocused.xiph.oggimport</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>0.1.1</string>
+	<key>CFBundleSignature</key>
+	<string>eat </string>
+	<key>CFBundleVersion</key>
+	<string>0.1.1</string>
+	<key>CSResourcesFileMapped</key>
+	<true/>
+</dict>
+</plist>

Added: trunk/xiph-qt/OggImport/MetaDataConfig.plist
===================================================================
--- trunk/xiph-qt/OggImport/MetaDataConfig.plist	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/MetaDataConfig.plist	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>Vorbis-to-MD</key>
+	<dict>
+		<key>ALBUM=</key>
+		<string>albm</string>
+		<key>ARTIST=</key>
+		<string>arts</string>
+		<key>COMMENT=</key>
+		<string>cmmt</string>
+		<key>DATE=</key>
+		<string>©day</string>
+		<key>TITLE=</key>
+		<string>name</string>
+		<key>YEAR=</key>
+		<string>©day</string>
+	</dict>
+	<key>Vorbis-to-UD</key>
+	<dict>
+		<key>ALBUM=</key>
+		<string>©alb</string>
+		<key>ARTIST=</key>
+		<string>©ART</string>
+		<key>COMMENT=</key>
+		<string>©cmt</string>
+		<key>DATE=</key>
+		<string>©day</string>
+		<key>GENRE=</key>
+		<string>©gen</string>
+		<key>TITLE=</key>
+		<string>©nam</string>
+		<key>TRACKNUMBER=</key>
+		<string>©trk</string>
+		<key>YEAR=</key>
+		<string>©day</string>
+	</dict>
+</dict>
+</plist>


Property changes on: trunk/xiph-qt/OggImport/OggImport.xcodeproj
___________________________________________________________________
Name: svn:ignore
   + *.mode*
*.pbxuser


Added: trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj
===================================================================
--- trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,441 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 42;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		73182D6A090AAEA700C25A13 /* OggImport.c in Sources */ = {isa = PBXBuildFile; fileRef = 73182D64090AAEA700C25A13 /* OggImport.c */; };
+		73182D6B090AAEA700C25A13 /* rb.c in Sources */ = {isa = PBXBuildFile; fileRef = 73182D67090AAEA700C25A13 /* rb.c */; };
+		73182D70090AB03900C25A13 /* MetaDataConfig.plist in Resources */ = {isa = PBXBuildFile; fileRef = 73182D6F090AB03900C25A13 /* MetaDataConfig.plist */; };
+		73182D73090AB07400C25A13 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73182D71090AB07400C25A13 /* CoreFoundation.framework */; };
+		73182D74090AB07400C25A13 /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73182D72090AB07400C25A13 /* QuickTime.framework */; };
+		73182D76090AB09000C25A13 /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73182D75090AB09000C25A13 /* Ogg.framework */; };
+		73182D82090AB53500C25A13 /* OggImport.r in Rez */ = {isa = PBXBuildFile; fileRef = 73182D6E090AAEC800C25A13 /* OggImport.r */; };
+		73182D90090AB6D500C25A13 /* PkgInfo in CopyFiles */ = {isa = PBXBuildFile; fileRef = 73182D8C090AB6B000C25A13 /* PkgInfo */; };
+		73182D9B090AB7F800C25A13 /* common.c in Sources */ = {isa = PBXBuildFile; fileRef = 73182D62090AAEA700C25A13 /* common.c */; };
+		73182D9F090AB83F00C25A13 /* Vorbis.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73182D9E090AB83F00C25A13 /* Vorbis.framework */; };
+		73182E37090AD49700C25A13 /* stream_vorbis.c in Sources */ = {isa = PBXBuildFile; fileRef = 73182E35090AD49700C25A13 /* stream_vorbis.c */; };
+		73E8B16D090BE13600686EE5 /* stream_speex.c in Sources */ = {isa = PBXBuildFile; fileRef = 73E8B16A090BE13600686EE5 /* stream_speex.c */; };
+		8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
+		8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXBuildStyle section */
+		4F9091AC011F3BD104CA0E50 /* Development */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		4F9091AD011F3BD104CA0E50 /* Deployment */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+/* End PBXBuildStyle section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		73182D8E090AB6BE00C25A13 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = Contents;
+			dstSubfolderSpec = 1;
+			files = (
+				73182D90090AB6D500C25A13 /* PkgInfo in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+		32BAE0B30371A71500C91783 /* OggImport_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OggImport_Prefix.pch; sourceTree = "<group>"; };
+		73182D62090AAEA700C25A13 /* common.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = common.c; path = src/common.c; sourceTree = "<group>"; };
+		73182D63090AAEA700C25A13 /* common.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = common.h; path = src/common.h; sourceTree = "<group>"; };
+		73182D64090AAEA700C25A13 /* OggImport.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = OggImport.c; path = src/OggImport.c; sourceTree = "<group>"; };
+		73182D65090AAEA700C25A13 /* OggImport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = OggImport.h; path = src/OggImport.h; sourceTree = "<group>"; };
+		73182D66090AAEA700C25A13 /* OggImportDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = OggImportDispatch.h; path = src/OggImportDispatch.h; sourceTree = "<group>"; };
+		73182D67090AAEA700C25A13 /* rb.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = rb.c; path = src/rb.c; sourceTree = "<group>"; };
+		73182D68090AAEA700C25A13 /* rb.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = rb.h; path = src/rb.h; sourceTree = "<group>"; };
+		73182D6E090AAEC800C25A13 /* OggImport.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = OggImport.r; path = src/OggImport.r; sourceTree = "<group>"; };
+		73182D6F090AB03900C25A13 /* MetaDataConfig.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = MetaDataConfig.plist; sourceTree = "<group>"; };
+		73182D71090AB07400C25A13 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+		73182D72090AB07400C25A13 /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; };
+		73182D75090AB09000C25A13 /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = /Library/Frameworks/Ogg.framework; sourceTree = "<absolute>"; };
+		73182D79090AB4CE00C25A13 /* OggImport.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; name = OggImport.exp; path = src/OggImport.exp; sourceTree = "<group>"; };
+		73182D7A090AB4CE00C25A13 /* versions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = versions.h; path = src/versions.h; sourceTree = "<group>"; };
+		73182D8C090AB6B000C25A13 /* PkgInfo */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = PkgInfo; sourceTree = "<group>"; };
+		73182D9E090AB83F00C25A13 /* Vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Vorbis.framework; path = /Library/Frameworks/Vorbis.framework; sourceTree = "<absolute>"; };
+		73182DEC090AC8E900C25A13 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = debug.h; path = ../utils/debug.h; sourceTree = SOURCE_ROOT; };
+		73182DF1090ACA0D00C25A13 /* importer_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = importer_types.h; path = src/importer_types.h; sourceTree = "<group>"; };
+		73182E34090AD49700C25A13 /* stream_vorbis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stream_vorbis.h; path = src/stream_vorbis.h; sourceTree = "<group>"; };
+		73182E35090AD49700C25A13 /* stream_vorbis.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stream_vorbis.c; path = src/stream_vorbis.c; sourceTree = "<group>"; };
+		73182E4C090AE29000C25A13 /* stream_types_vorbis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stream_types_vorbis.h; path = src/stream_types_vorbis.h; sourceTree = "<group>"; };
+		737C5A6D0912A05200700B79 /* fccs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = fccs.h; path = ../common/fccs.h; sourceTree = SOURCE_ROOT; };
+		738602C50915732900CB8105 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = icon.icns; path = ../resources/icon.icns; sourceTree = SOURCE_ROOT; };
+		738602C60915732900CB8105 /* icon.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = icon.r; path = ../resources/icon.r; sourceTree = SOURCE_ROOT; };
+		73E8B10F090BCB6100686EE5 /* data_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = data_types.h; path = ../common/data_types.h; sourceTree = SOURCE_ROOT; };
+		73E8B16A090BE13600686EE5 /* stream_speex.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = stream_speex.c; path = src/stream_speex.c; sourceTree = "<group>"; };
+		73E8B16B090BE13600686EE5 /* stream_speex.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stream_speex.h; path = src/stream_speex.h; sourceTree = "<group>"; };
+		73E8B16C090BE13600686EE5 /* stream_types_speex.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stream_types_speex.h; path = src/stream_types_speex.h; sourceTree = "<group>"; };
+		8D01CCD10486CAD60068D4B7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+		8D01CCD20486CAD60068D4B7 /* OggImport.component */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OggImport.component; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		8D01CCCD0486CAD60068D4B7 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */,
+				73182D73090AB07400C25A13 /* CoreFoundation.framework in Frameworks */,
+				73182D74090AB07400C25A13 /* QuickTime.framework in Frameworks */,
+				73182D76090AB09000C25A13 /* Ogg.framework in Frameworks */,
+				73182D9F090AB83F00C25A13 /* Vorbis.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		089C166AFE841209C02AAC07 /* OggImport */ = {
+			isa = PBXGroup;
+			children = (
+				08FB77ADFE841716C02AAC07 /* Source */,
+				089C167CFE841241C02AAC07 /* Resources */,
+				089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
+				19C28FB4FE9D528D11CA2CBB /* Products */,
+			);
+			name = OggImport;
+			sourceTree = "<group>";
+		};
+		089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				73182D9E090AB83F00C25A13 /* Vorbis.framework */,
+				73182D75090AB09000C25A13 /* Ogg.framework */,
+				73182D71090AB07400C25A13 /* CoreFoundation.framework */,
+				73182D72090AB07400C25A13 /* QuickTime.framework */,
+				08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */,
+			);
+			name = "External Frameworks and Libraries";
+			sourceTree = "<group>";
+		};
+		089C167CFE841241C02AAC07 /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+				738602C50915732900CB8105 /* icon.icns */,
+				738602C60915732900CB8105 /* icon.r */,
+				73182D8C090AB6B000C25A13 /* PkgInfo */,
+				73182D6F090AB03900C25A13 /* MetaDataConfig.plist */,
+				73182D6E090AAEC800C25A13 /* OggImport.r */,
+				8D01CCD10486CAD60068D4B7 /* Info.plist */,
+				089C167DFE841241C02AAC07 /* InfoPlist.strings */,
+			);
+			name = Resources;
+			sourceTree = "<group>";
+		};
+		08FB77ADFE841716C02AAC07 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				73E8B169090BE11D00686EE5 /* speex */,
+				73E8B162090BDE5D00686EE5 /* vorbis */,
+				73182DEC090AC8E900C25A13 /* debug.h */,
+				73182D79090AB4CE00C25A13 /* OggImport.exp */,
+				73182D7A090AB4CE00C25A13 /* versions.h */,
+				73182D62090AAEA700C25A13 /* common.c */,
+				73182D63090AAEA700C25A13 /* common.h */,
+				73182D64090AAEA700C25A13 /* OggImport.c */,
+				73182D65090AAEA700C25A13 /* OggImport.h */,
+				73182D66090AAEA700C25A13 /* OggImportDispatch.h */,
+				73182D67090AAEA700C25A13 /* rb.c */,
+				73182D68090AAEA700C25A13 /* rb.h */,
+				32BAE0B30371A71500C91783 /* OggImport_Prefix.pch */,
+				73182DF1090ACA0D00C25A13 /* importer_types.h */,
+				73E8B10F090BCB6100686EE5 /* data_types.h */,
+				737C5A6D0912A05200700B79 /* fccs.h */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		19C28FB4FE9D528D11CA2CBB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				8D01CCD20486CAD60068D4B7 /* OggImport.component */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		73E8B162090BDE5D00686EE5 /* vorbis */ = {
+			isa = PBXGroup;
+			children = (
+				73182E4C090AE29000C25A13 /* stream_types_vorbis.h */,
+				73182E34090AD49700C25A13 /* stream_vorbis.h */,
+				73182E35090AD49700C25A13 /* stream_vorbis.c */,
+			);
+			name = vorbis;
+			sourceTree = "<group>";
+		};
+		73E8B169090BE11D00686EE5 /* speex */ = {
+			isa = PBXGroup;
+			children = (
+				73E8B16A090BE13600686EE5 /* stream_speex.c */,
+				73E8B16B090BE13600686EE5 /* stream_speex.h */,
+				73E8B16C090BE13600686EE5 /* stream_types_speex.h */,
+			);
+			name = speex;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		8D01CCC60486CAD60068D4B7 /* OggImport */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 73182D56090AAD7600C25A13 /* Build configuration list for PBXNativeTarget "OggImport" */;
+			buildPhases = (
+				8D01CCC90486CAD60068D4B7 /* Resources */,
+				8D01CCCB0486CAD60068D4B7 /* Sources */,
+				8D01CCCD0486CAD60068D4B7 /* Frameworks */,
+				73182D7E090AB52600C25A13 /* Rez */,
+				73182D8E090AB6BE00C25A13 /* CopyFiles */,
+				738602C30915730E00CB8105 /* ShellScript */,
+			);
+			buildRules = (
+			);
+			buildSettings = {
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = OggImport_Prefix.pch;
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/Bundles";
+				PRODUCT_NAME = OggImport;
+				WRAPPER_EXTENSION = bundle;
+			};
+			dependencies = (
+			);
+			name = OggImport;
+			productInstallPath = "$(HOME)/Library/Bundles";
+			productName = OggImport;
+			productReference = 8D01CCD20486CAD60068D4B7 /* OggImport.component */;
+			productType = "com.apple.product-type.bundle";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		089C1669FE841209C02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 73182D5A090AAD7600C25A13 /* Build configuration list for PBXProject "OggImport" */;
+			buildSettings = {
+			};
+			buildStyles = (
+				4F9091AC011F3BD104CA0E50 /* Development */,
+				4F9091AD011F3BD104CA0E50 /* Deployment */,
+			);
+			hasScannedForEncodings = 1;
+			mainGroup = 089C166AFE841209C02AAC07 /* OggImport */;
+			projectDirPath = "";
+			targets = (
+				8D01CCC60486CAD60068D4B7 /* OggImport */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		8D01CCC90486CAD60068D4B7 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */,
+				73182D70090AB03900C25A13 /* MetaDataConfig.plist in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+		73182D7E090AB52600C25A13 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				73182D82090AB53500C25A13 /* OggImport.r in Rez */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		738602C30915730E00CB8105 /* ShellScript */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+				../resources/icon.r,
+				../resources/icon.icns,
+			);
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "cd ../resources\n${SYSTEM_DEVELOPER_TOOLS}/Rez -o \"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\"/$'Icon\\x0D' icon.r\n${SYSTEM_DEVELOPER_TOOLS}/SetFile -a CE \"${TARGET_BUILD_DIR}/${FULL_PRODUCT_NAME}\"";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		8D01CCCB0486CAD60068D4B7 /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				73182D6A090AAEA700C25A13 /* OggImport.c in Sources */,
+				73182D6B090AAEA700C25A13 /* rb.c in Sources */,
+				73182D9B090AB7F800C25A13 /* common.c in Sources */,
+				73182E37090AD49700C25A13 /* stream_vorbis.c in Sources */,
+				73E8B16D090BE13600686EE5 /* stream_speex.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+		089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
+			isa = PBXVariantGroup;
+			children = (
+				089C167EFE841241C02AAC07 /* English */,
+			);
+			name = InfoPlist.strings;
+			sourceTree = "<group>";
+		};
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+		73182D57090AAD7600C25A13 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				EXPORTED_SYMBOLS_FILE = src/OggImport.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = OggImport_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					__MACOSX__,
+					"TARGET_REZ_CARBON_MACHO=1",
+					TARGET_OS_MAC,
+					TARGET_API_MAC_CARBON,
+				);
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/QuickTime";
+				PRODUCT_NAME = OggImport;
+				WRAPPER_EXTENSION = component;
+				ZERO_LINK = YES;
+			};
+			name = Development;
+		};
+		73182D58090AAD7600C25A13 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				EXPORTED_SYMBOLS_FILE = src/OggImport.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = OggImport_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					__MACOSX__,
+					"TARGET_REZ_CARBON_MACHO=1",
+					TARGET_OS_MAC,
+					TARGET_API_MAC_CARBON,
+					NDEBUG,
+				);
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/QuickTime";
+				PRODUCT_NAME = OggImport;
+				WRAPPER_EXTENSION = component;
+				ZERO_LINK = NO;
+			};
+			name = Deployment;
+		};
+		73182D59090AAD7600C25A13 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXPORTED_SYMBOLS_FILE = src/OggImport.exp;
+				FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../Library/Frameworks\"";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = OggImport_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					__MACOSX__,
+					"TARGET_REZ_CARBON_MACHO=1",
+					TARGET_OS_MAC,
+					TARGET_API_MAC_CARBON,
+				);
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/QuickTime";
+				PRODUCT_NAME = OggImport;
+				WRAPPER_EXTENSION = component;
+			};
+			name = Default;
+		};
+		73182D5B090AAD7600C25A13 /* Development */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = Development;
+		};
+		73182D5C090AAD7600C25A13 /* Deployment */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = Deployment;
+		};
+		73182D5D090AAD7600C25A13 /* Default */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = Default;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		73182D56090AAD7600C25A13 /* Build configuration list for PBXNativeTarget "OggImport" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				73182D57090AAD7600C25A13 /* Development */,
+				73182D58090AAD7600C25A13 /* Deployment */,
+				73182D59090AAD7600C25A13 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+		73182D5A090AAD7600C25A13 /* Build configuration list for PBXProject "OggImport" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				73182D5B090AAD7600C25A13 /* Development */,
+				73182D5C090AAD7600C25A13 /* Deployment */,
+				73182D5D090AAD7600C25A13 /* Default */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Default;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 089C1669FE841209C02AAC07 /* Project object */;
+}

Added: trunk/xiph-qt/OggImport/OggImport_Prefix.pch
===================================================================
--- trunk/xiph-qt/OggImport/OggImport_Prefix.pch	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/OggImport_Prefix.pch	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,5 @@
+//
+// Prefix header for all source files of the 'OggImport' target in the 'OggImport' project.
+//
+
+#include <Carbon/Carbon.h>

Added: trunk/xiph-qt/OggImport/PkgInfo
===================================================================
--- trunk/xiph-qt/OggImport/PkgInfo	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/PkgInfo	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1 @@
+thngeat 
\ No newline at end of file


Property changes on: trunk/xiph-qt/OggImport/build
___________________________________________________________________
Name: svn:ignore
   + *


Added: trunk/xiph-qt/OggImport/src/OggImport.c
===================================================================
--- trunk/xiph-qt/OggImport/src/OggImport.c	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/OggImport.c	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,1598 @@
+/*
+ *  OggImport.c
+ *
+ *    The main part of the OggImport component.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+/*
+ *  This file is based on the original importer code
+ *  written by Steve Nicolai.
+ *
+ */
+
+#include <QuickTime/QuickTime.h>
+
+#include <Ogg/ogg.h>
+//#include <Vorbis/codec.h>
+
+#include "OggImport.h"
+
+//#define NDEBUG
+
+#import "debug.h"
+
+
+#include "importer_types.h"
+
+#include "common.h"
+#include "rb.h"
+
+//stream-type support functions
+#include "stream_vorbis.h"
+#include "stream_speex.h"
+
+static stream_format_handle_funcs s_formats[] = {
+#if defined(_HAVE__VORBIS_SUPPORT)
+    HANDLE_FUNCTIONS__VORBIS,
+#endif
+#if defined(_HAVE__SPEEX_SUPPORT)
+    HANDLE_FUNCTIONS__SPEEX,
+#endif
+    
+    HANDLE_FUNCTIONS__NULL
+};
+
+
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//			Constants
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+enum {
+	kDataBufferSize = 64 * 1024,
+	kDataAsyncBufferSize = 16 * 1024,
+    
+    kDefaultChunkSize = 11000
+};
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//			prototypes
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+/* sometimes I wonder if using ComponentDispatch.h is worth it.  This is
+   one of those times.  MacOS functions are declared pascal, win32 are not.
+ */
+#if TARGET_OS_MAC
+#define COMPONENTFUNC static pascal ComponentResult
+#else
+#define COMPONENTFUNC static ComponentResult
+#endif
+
+COMPONENTFUNC OggImportOpen(OggImportGlobalsPtr globals, ComponentInstance self);
+COMPONENTFUNC OggImportClose(OggImportGlobalsPtr globals, ComponentInstance self);
+COMPONENTFUNC OggImportVersion(OggImportGlobalsPtr globals);
+
+COMPONENTFUNC OggImportSetOffsetAndLimit64(OggImportGlobalsPtr globals, const wide *offset,
+										   const wide *limit);
+COMPONENTFUNC OggImportSetOffsetAndLimit(OggImportGlobalsPtr globals, unsigned long offset,
+										 unsigned long limit);
+
+COMPONENTFUNC OggImportValidate(OggImportGlobalsPtr globals, 
+								const FSSpec *         theFile,
+								Handle                 theData,
+								Boolean *              valid);
+COMPONENTFUNC OggImportValidateDataRef(OggImportGlobalsPtr globals, 
+									   Handle                 dataRef,
+									   OSType                 dataRefType,
+									   UInt8 *                valid);
+
+COMPONENTFUNC OggImportSetChunkSize(OggImportGlobalsPtr globals, long chunkSize);
+
+COMPONENTFUNC OggImportIdle(OggImportGlobalsPtr globals,
+							long                   inFlags,
+							long *                 outFlags);
+
+COMPONENTFUNC OggImportFile(OggImportGlobalsPtr globals, const FSSpec *theFile,
+							Movie theMovie, Track targetTrack, Track *usedTrack,
+							TimeValue atTime, TimeValue *durationAdded, long inFlags, long *outFlags);
+COMPONENTFUNC OggImportGetMIMETypeList(OggImportGlobalsPtr globals, QTAtomContainer *retMimeInfo);
+COMPONENTFUNC OggImportDataRef(OggImportGlobalsPtr globals, Handle dataRef,
+							   OSType dataRefType, Movie theMovie,
+							   Track targetTrack, Track *usedTrack,
+							   TimeValue atTime, TimeValue *durationAdded,
+							   long inFlags, long *outFlags);
+COMPONENTFUNC OggImportGetFileType(OggImportGlobalsPtr globals, OSType *fileType);
+COMPONENTFUNC OggImportGetLoadState(OggImportGlobalsPtr globals, long *loadState);
+COMPONENTFUNC OggImportGetMaxLoadedTime(OggImportGlobalsPtr globals, TimeValue *time);
+COMPONENTFUNC OggImportEstimateCompletionTime(OggImportGlobalsPtr globals, TimeRecord *time);
+COMPONENTFUNC OggImportSetDontBlock(OggImportGlobalsPtr globals, Boolean  dontBlock);
+COMPONENTFUNC OggImportGetDontBlock(OggImportGlobalsPtr globals, Boolean  *willBlock);
+COMPONENTFUNC OggImportSetIdleManager(OggImportGlobalsPtr globals, IdleManager im);
+COMPONENTFUNC OggImportSetNewMovieFlags(OggImportGlobalsPtr globals, long flags);
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//			Component Dispatcher
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+#define CALLCOMPONENT_BASENAME() 		OggImport
+#define CALLCOMPONENT_GLOBALS() 		OggImportGlobalsPtr storage
+
+#define MOVIEIMPORT_BASENAME() 			CALLCOMPONENT_BASENAME()
+#define MOVIEIMPORT_GLOBALS() 			CALLCOMPONENT_GLOBALS()
+
+#define COMPONENT_UPP_SELECT_ROOT()		MovieImport
+#define COMPONENT_DISPATCH_FILE			"OggImportDispatch.h"
+
+#include <CoreServices/Components.k.h>
+#include <QuickTime/QuickTimeComponents.k.h>
+#include <QuickTime/ComponentDispatchHelper.c>
+
+
+static ComponentResult DoRead(OggImportGlobalsPtr globals, Ptr buffer, SInt64 offset, long size)
+{
+    ComponentResult 	err;
+    
+	dprintf("---- DoRead() called\n");
+    const wide wideOffset = SInt64ToWide(offset);
+    
+	dprintf("--->> READING: %lld [%ld] --> %lld\n", offset, size, offset + size);
+	dprintf("----> READING: usingIdle: %d, dataCanDoAsyncRead: %d, canDoGetFileSizeAsync: %d, canDoGetFileSize64: %d\n",
+			globals->usingIdle, globals->dataCanDoAsyncRead, globals->dataCanDoGetFileSizeAsync, globals->dataCanDoGetFileSize64);
+
+    if (globals->usingIdle && globals->dataCanDoAsyncRead)
+    {
+		globals->dataRequested = true;
+        err = DataHReadAsync(globals->dataReader, buffer, size, &wideOffset, 
+							 globals->dataReadCompletion, (long) globals);
+		dprintf("----: READ: %ld\n", err);
+		err = QTIdleManagerSetNextIdleTimeNever(globals->idleManager);
+		dprintf("----: Disabling Idles: %ld\n", err);
+    }
+    else
+    {
+		err = DataHScheduleData64(globals->dataReader, buffer, &wideOffset,
+								  size, 0, NULL, NULL);
+		if (err == noErr)
+			rb_sync_reserved(&globals->dataRB);
+    }
+    globals->readError = err;
+	
+    return err;
+}
+
+static ComponentResult FillBuffer(OggImportGlobalsPtr globals)
+{
+    int	   dataLeft;
+    SInt64 readDataOffset;
+
+	dprintf("---- FillBuffer() called\n");
+	dprintf("   - dataOffset: %lld, dataEndOffset: %lld\n", globals->dataOffset, globals->dataEndOffset);
+	dprintf("   - dataOffset != -1: %d, dataOffset >= dataEndOffset: %d\n",
+		   S64Compare(globals->dataOffset, S64Set(-1)) != 0,
+		   S64Compare(globals->dataOffset, globals->dataEndOffset) >= 0);
+
+    /* have we hit the end of file or our upper limit? */
+	if (globals->sizeInitialised && S64Compare(globals->dataEndOffset, S64Set(-1)) != 0) {
+		if (S64Compare(globals->dataOffset, S64Set(-1)) != 0 &&
+			S64Compare(globals->dataOffset, globals->dataEndOffset) >= 0)
+			return eofErr;
+	}
+        
+	dprintf("--1- FillBuffer() called\n");
+    /* can another page from the disk fit in the buffer? */
+    if (globals->dataReadChunkSize > rb_space_available(&globals->dataRB))
+        return -50;  ///@@@ page won't fit in buffer, they always should
+
+	dprintf("--2- FillBuffer() called\n");
+    readDataOffset = S64Add(globals->dataOffset, S64Set(rb_data_available(&globals->dataRB)));
+    
+    /* figure out how much data is left, and read either a chunk or what's left */
+	if (globals->sizeInitialised && S64Compare(globals->dataEndOffset, S64Set(-1)) != 0) {
+		dataLeft = S32Set(S64Subtract(globals->dataEndOffset, readDataOffset));
+	} else {
+        dataLeft = globals->dataReadChunkSize;
+	}
+
+    if (dataLeft > globals->dataReadChunkSize)
+        dataLeft = globals->dataReadChunkSize;
+    
+    if (dataLeft == 0)
+		return eofErr;
+
+    return DoRead(globals, (Ptr) rb_reserve(&globals->dataRB, dataLeft), readDataOffset, dataLeft);
+}
+
+static OSErr CheckVorbisHeader(ogg_page *opg)
+{
+    OSErr			 err = noErr;
+
+	ogg_stream_state os;
+	ogg_packet       op;
+
+	vorbis_info      vi;
+	vorbis_comment   vc;
+
+	ogg_stream_init(&os, ogg_page_serialno(opg));
+
+    vorbis_info_init(&vi);
+    vorbis_comment_init(&vc);
+
+	if (ogg_stream_pagein(&os, opg) < 0)
+		err = invalidMedia;
+	else if (ogg_stream_packetout(&os, &op) != 1)
+		err = invalidMedia;
+	else if (vorbis_synthesis_headerin(&vi, &vc, &op) < 0)
+		err = noSoundTrackInMovieErr;
+	
+	ogg_stream_clear(&os);
+
+    vorbis_comment_clear(&vc);
+    vorbis_info_clear(&vi);
+
+    return err;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+static ComponentResult OpenStream(OggImportGlobalsPtr globals, long serialno, ogg_page *opg, stream_format_handle_funcs *ff)
+{
+    ComponentResult err;
+    
+	if (globals->streamInfoHandle)
+	{
+		globals->streamCount++;
+		SetHandleSize((Handle)globals->streamInfoHandle, sizeof(StreamInfo) * globals->streamCount);
+	}
+	else
+	{
+		globals->streamInfoHandle = (StreamInfo **)NewHandle(sizeof(StreamInfo));
+		globals->streamCount = 1;
+	}
+	err = MemError();
+    
+	if (err == noErr)
+	{
+		StreamInfo *si = &(*globals->streamInfoHandle)[globals->streamCount - 1];
+		si->serialno = serialno;
+		si->timeLoaded = 0;
+
+		ogg_stream_init(&si->os,serialno);
+
+        si->sfhf = ff;
+
+        if (ff->initialize != NULL)
+            (*ff->initialize)(si); // check for error here and clean-up if not OK
+		
+		si->startTime = globals->startTime;
+		si->soundDescExtension = NewHandle(0);
+		
+		si->MDmapping = NULL;
+		si->UDmapping = NULL;
+
+		globals->numTracksStarted++;
+	}
+	
+    return err;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+static StreamInfoPtr FindStream(OggImportGlobalsPtr globals, long serialno)
+{
+    int i;
+    
+    for (i = 0; i < globals->streamCount; i++)
+    {
+        if ((*globals->streamInfoHandle)[i].serialno == serialno)
+        {
+            return &(*globals->streamInfoHandle)[i];
+        }
+    }
+    
+    return NULL;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+static void CloseStream(OggImportGlobalsPtr globals, StreamInfoPtr si)
+{
+	ogg_stream_clear(&si->os);
+
+    if (si->sfhf->clear != NULL)
+        (*si->sfhf->clear)(si);
+
+	if (si->MDmapping != NULL)
+		CFRelease(si->MDmapping);
+	if (si->UDmapping != NULL)
+		CFRelease(si->UDmapping);
+	
+	DisposeHandle(si->soundDescExtension);
+	DisposeHandle((Handle)si->sampleDesc);
+	
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+static void CloseAllStreams(OggImportGlobalsPtr globals)
+{
+    int i;
+    
+    for (i = 0; i < globals->streamCount; i++)
+    {
+		StreamInfoPtr si = &(*globals->streamInfoHandle)[i];
+		CloseStream(globals, si);
+    }
+	globals->streamCount = 0;
+	SetHandleSize((Handle) globals->streamInfoHandle, 0);
+}
+
+
+static int InitialiseMetaDataMappings(StreamInfoPtr si) {
+	CFBundleRef bundle;
+	CFURLRef mdmurl;
+	CFDataRef data;
+	SInt32 ret = 0;
+	CFStringRef errorString;
+	SInt32 error = 0;
+	CFDictionaryRef props;
+
+	dprintf("--= IMDM()\n");
+	if (si->MDmapping != NULL && si->UDmapping != NULL) {
+		return 1;
+	}
+	
+	//else? let's assume for now that they are both intialised or both are not initialised
+
+	bundle = CFBundleGetBundleWithIdentifier(CFSTR(kOggVorbisBundleID));
+	
+	if (bundle == NULL)
+		return 0;
+
+	mdmurl = CFBundleCopyResourceURL(bundle, CFSTR("MetaDataConfig"), CFSTR("plist"), NULL);
+	if (mdmurl != NULL) {
+		if (CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, mdmurl, &data, 
+													 NULL, NULL, &error)) {
+			props = (CFDictionaryRef) CFPropertyListCreateFromXMLData(kCFAllocatorDefault, data,
+																	  kCFPropertyListImmutable, &errorString);
+			if (props != NULL) {
+				if (CFGetTypeID(props) == CFDictionaryGetTypeID()) {
+					si->MDmapping = (CFDictionaryRef) CFDictionaryGetValue(props, CFSTR("Vorbis-to-MD"));
+					if (si->MDmapping != NULL) {
+						dprintf("----: MDmapping found\n");
+						CFRetain(si->MDmapping);
+						ret = 1;
+					}
+					si->UDmapping = (CFDictionaryRef) CFDictionaryGetValue(props, CFSTR("Vorbis-to-UD"));
+					if (si->UDmapping != NULL) {
+						dprintf("----: UDmapping found\n");
+						CFRetain(si->UDmapping);
+					} else
+						ret = 0;
+				}
+				CFRelease(props);
+			}
+			CFRelease(data);
+		}
+		CFRelease(mdmurl);
+	}
+
+	return ret;
+}
+
+static int LookupTagUD(StreamInfoPtr si, const char *str, long *osType) {
+	int ret = -1;
+	long len;
+
+	if (si->UDmapping == NULL)
+    {
+		if (!InitialiseMetaDataMappings(si))
+			return -1;
+    }
+    
+	len = strcspn(str, "=");
+
+	if (len > 0) {
+		CFStringRef tmpkstr = CFStringCreateWithBytes(NULL, str, len + 1, kCFStringEncodingUTF8, true);
+		if (tmpkstr != NULL) {
+			CFMutableStringRef keystr = CFStringCreateMutableCopy(NULL, len + 1, tmpkstr);
+			if (keystr != NULL) {
+				CFLocaleRef loc = CFLocaleCopyCurrent();
+				CFStringUppercase(keystr, loc);
+				CFRelease(loc);
+				dprintf("--- luTud: %s [%s]\n", (char *)str, (char *)CFStringGetCStringPtr(keystr,kCFStringEncodingUTF8));
+				if (CFDictionaryContainsKey(si->UDmapping, keystr)) {
+					CFStringRef udkey = (CFStringRef) CFDictionaryGetValue(si->UDmapping, keystr);
+
+					*osType = (CFStringGetCharacterAtIndex(udkey, 0) & 0xff) << 24 |
+						(CFStringGetCharacterAtIndex(udkey, 1) & 0xff) << 16 |
+						(CFStringGetCharacterAtIndex(udkey, 2) & 0xff) << 8 |
+						(CFStringGetCharacterAtIndex(udkey, 3) & 0xff);
+
+					dprintf("--- luTud: %s [%s]\n", (char *)str, (char *)keystr);
+					ret = len + 1;
+				}
+				CFRelease(keystr);
+			}
+			CFRelease(tmpkstr);
+		}
+	}
+
+	return ret;
+}
+
+static int LookupTagMD(StreamInfoPtr si, const char *str, long *osType) {
+	int ret = -1;
+	long len;
+
+	if (si->MDmapping == NULL)
+    {
+		if (!InitialiseMetaDataMappings(si))
+			return -1;
+    }
+    
+	len = strcspn(str, "=");
+
+	if (len > 0) {
+		CFStringRef tmpkstr = CFStringCreateWithBytes(NULL, str, len + 1, kCFStringEncodingUTF8, true);
+		if (tmpkstr != NULL) {
+			CFMutableStringRef keystr = CFStringCreateMutableCopy(NULL, len + 1, tmpkstr);
+			if (keystr != NULL) {
+				CFLocaleRef loc = CFLocaleCopyCurrent();
+				CFStringUppercase(keystr, loc);
+				CFRelease(loc);
+				dprintf("--- luTmd: %s [%s]\n", (char *)str, (char *)CFStringGetCStringPtr(keystr,kCFStringEncodingUTF8));
+				if (CFDictionaryContainsKey(si->MDmapping, keystr)) {
+					CFStringRef mdkey = (CFStringRef) CFDictionaryGetValue(si->MDmapping, keystr);
+
+					*osType = (CFStringGetCharacterAtIndex(mdkey, 0) & 0xff) << 24 |
+						(CFStringGetCharacterAtIndex(mdkey, 1) & 0xff) << 16 |
+						(CFStringGetCharacterAtIndex(mdkey, 2) & 0xff) << 8 |
+						(CFStringGetCharacterAtIndex(mdkey, 3) & 0xff);
+
+					dprintf("--- luTmd: %s [%s]\n", (char *)str, (char *)keystr);
+					ret = len + 1;
+				}
+				CFRelease(keystr);
+			}
+			CFRelease(tmpkstr);
+		}
+	}
+
+	return ret;
+}
+
+static ComponentResult ConvertUTF8toScriptCode(const char *str, Handle *h, ScriptCode *script)
+{
+	TextEncoding    sourceEncoding = CreateTextEncoding(kTextEncodingUnicodeV3_0, kUnicodeNoSubset, kUnicodeUTF8Format);
+	TextEncoding    destEncoding = CreateTextEncoding(kTextEncodingMacRoman, kTextEncodingDefaultVariant, kTextEncodingDefaultFormat);
+	TECObjectRef	converter;
+    Handle          temp;
+    int             length = strlen(str);
+    int             tempLen = length * 2;
+    
+    OSErr err = TECCreateConverter(&converter, sourceEncoding, destEncoding);
+    if (err != noErr)
+        return err;
+
+    *script = 0;
+    *h = NULL;
+
+	temp = NewHandle(tempLen);
+	if (temp == NULL)
+		return memFullErr;
+
+	while (1)
+	{
+        ByteCount actualIn, actualOut, flushOut;
+
+		HLock(temp);
+		actualIn = 0;
+        flushOut = 0;
+		
+		err = TECConvertText(converter, (ConstTextPtr)str, length, &actualIn, (TextPtr)*temp, tempLen, &actualOut);
+		if (length == actualIn || actualOut < tempLen - 20)
+		{
+            if (err == noErr)
+                err = TECFlushText(converter, (TextPtr) ((*temp) + actualOut), tempLen - actualOut, &flushOut);
+			HUnlock(temp);
+            SetHandleSize(temp, actualOut + flushOut);
+            *h = temp;
+            temp = NULL;
+            err = noErr;    // ignore and supress conversion errors
+			break;
+		}
+		else
+		{
+			HUnlock(temp);
+			tempLen += length;
+			SetHandleSize(temp, tempLen);
+			err = MemError();
+			if (err != noErr)
+				break;	
+		}
+	}
+	
+	if (temp != NULL)
+		DisposeHandle(temp);
+
+    TECDisposeConverter(converter);
+
+    return err;
+}
+
+static ComponentResult AddCommentToMetaData(StreamInfoPtr si, const char *str, int len, QTMetaDataRef md) {
+	ComponentResult ret = noErr;
+	long tag;
+
+    int	tagLen = LookupTagMD(si, str, &tag);
+	Handle h;
+	ScriptCode script;
+        
+	
+    if (tagLen != -1 && str[tagLen] != '\0') {
+		dprintf("-- TAG: %08lx\n", tag);
+
+		ret = QTMetaDataAddItem(md, kQTMetaDataStorageFormatQuickTime, kQTMetaDataKeyFormatCommon,
+								&tag, sizeof(tag), str + tagLen, len - tagLen, kQTMetaDataTypeUTF8, NULL);
+		dprintf("-- TAG: %4.4s :: QT    = %ld\n", (char *)&tag, (long)ret);
+	}
+	
+    tagLen = LookupTagUD(si, str, &tag);
+	
+    if (tagLen != -1 && str[tagLen] != '\0') {
+		QTMetaDataItem mdi;
+		char * localestr = "en";
+		Handle localeh = NewEmptyHandle();
+		
+		PtrAndHand(&localestr, localeh, strlen(localestr));
+
+		dprintf("-- TAG: %08lx\n", tag);
+
+		ret = ConvertUTF8toScriptCode(str + tagLen, &h, &script);
+		if (ret == noErr) {
+			HLock(h);
+			ret = QTMetaDataAddItem(md, kQTMetaDataStorageFormatUserData, kQTMetaDataKeyFormatUserData,
+									&tag, sizeof(tag), *h, GetHandleSize(h), kQTMetaDataTypeMacEncodedText, &mdi);
+			dprintf("-- TAG: %4.4s :: QT[X] = %ld\n", (char *)&tag, (long)ret);
+			HUnlock(h);
+			if (ret == noErr) {
+				ret = QTMetaDataSetItemProperty(md, mdi, kPropertyClass_MetaDataItem, kQTMetaDataItemPropertyID_Locale,
+												GetHandleSize(localeh), *h);
+				dprintf("-- TAG: %4.4s :: QT[X] locale (%5.5s)= %ld\n", (char *)&tag, *h, (long)ret);
+			}
+			DisposeHandle(h);
+		}
+	}
+
+	return ret;
+}
+
+ComponentResult DecodeCommentsQT(OggImportGlobalsPtr globals, StreamInfoPtr si, vorbis_comment *vc)
+{
+    ComponentResult ret = noErr;
+    int				i;
+    QTMetaDataRef	md;
+	
+	//ret = QTCopyTrackMetaData(si->theTrack, &md);
+	ret = QTCopyMovieMetaData(globals->theMovie, &md);
+
+	if (ret != noErr)
+		return ret;
+	
+    for (i = 0; i < vc->comments; i++)
+    {
+        ret = AddCommentToMetaData(si, vc->user_comments[i], vc->comment_lengths[i], md);
+        if (ret != noErr) {
+            //break;
+			dprintf("AddCommentToMetaData() failed? = %d\n", ret);
+		}
+    }
+    
+	QTMetaDataRelease(md);
+
+	ret = QTCopyTrackMetaData(si->theTrack, &md);
+	//ret = QTCopyMovieMetaData(globals->theMovie, &md);
+
+	if (ret != noErr)
+		return ret;
+	
+    for (i = 0; i < vc->comments; i++)
+    {
+        ret = AddCommentToMetaData(si, vc->user_comments[i], vc->comment_lengths[i], md);
+        if (ret != noErr) {
+            //break;
+			dprintf("AddCommentToMetaData() failed? = %d\n", ret);
+		}
+    }
+    
+	QTMetaDataRelease(md);
+
+    return ret;
+}
+
+static ComponentResult CreateSampleDescription(StreamInfoPtr si)
+{
+    ComponentResult err = noErr;
+    if (si->sfhf->sample_description != NULL)
+        err = (*si->sfhf->sample_description)(si);
+    else
+        err = invalidMedia; // ??!
+	
+    return err;
+}
+
+ComponentResult CreateTrackAndMedia(OggImportGlobalsPtr globals, StreamInfoPtr si, ogg_page *opg)
+{
+    ComponentResult err = noErr;
+
+    if (err == noErr)
+    {
+        // build the sample description
+        err = CreateSampleDescription(si);
+        if (err == noErr)
+        {
+            dprintf("! -- SampleDescription created OK\n");
+            si->theTrack = NewMovieTrack(globals->theMovie, 0, 0, kFullVolume);
+            if (si->theTrack)
+            {
+                dprintf("! -- MovieTrack created OK\n");
+                dprintf("! -- calling => NewTrackMedia(%lx)\n", si->rate);
+                si->theMedia = NewTrackMedia(si->theTrack, SoundMediaType,
+                        si->rate, globals->dataRef, globals->dataRefType);
+                if (si->theMedia)
+                {
+                    dprintf("! -- TrackMedia created OK\n");
+                    SetTrackEnabled(si->theTrack, true);
+        
+                    si->lastGranulePos = 0;
+                }
+                else
+                {
+                    err = GetMoviesError();
+                    DisposeMovieTrack(si->theTrack);
+                }
+            } else
+                err = GetMoviesError();
+        }
+    }
+    
+    return err;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ComponentResult NotifyMovieChanged(OggImportGlobalsPtr globals)
+{
+    //Notify the movie it's changed (from email from Chris Flick)
+    QTAtomContainer container = NULL;
+    OSErr err = QTNewAtomContainer (&container);
+
+    if (err == noErr)
+    {
+        QTAtom anAction;
+        OSType whichAction = EndianU32_NtoB (kActionMovieChanged);
+    
+        err = QTInsertChild (container, kParentAtomIsContainer, kAction, 1, 0, 0, NULL, &anAction);
+        if (err == noErr) 
+            err = QTInsertChild (container, anAction, kWhichAction, 1, 0, sizeof (whichAction), &whichAction, NULL);
+        if (err == noErr) 
+            err = MovieExecuteWiredActions (globals->theMovie, 0, container);
+    
+        err = QTDisposeAtomContainer (container);
+    }
+    return err;
+}
+
+#ifndef NDEBUG
+int logg_page_last_packet_incomplete(ogg_page *op)
+{
+    unsigned char *header = op->header;
+    return (header[26 + header[26]] == 255);
+}
+#endif /* NDEBUG */
+
+static ComponentResult ProcessStreamPage(OggImportGlobalsPtr globals, StreamInfoPtr si, ogg_page *opg) {
+	ComponentResult ret = noErr;
+
+    if (si->sfhf->process_page != NULL)
+        ret = (*si->sfhf->process_page)(globals, si, opg);
+    else {
+        // shouldn't happen, but just skip a page here
+        ogg_packet op;
+        ogg_stream_pagein(&si->os, opg);
+        while (ogg_stream_packetout(&si->os, &op) > 0)
+            ; // do nothing, just loop
+    }
+
+	return ret;
+}
+
+static stream_format_handle_funcs* find_stream_support(ogg_page *op) {
+
+    stream_format_handle_funcs *ff = &s_formats[0];
+    int i = 0;
+
+    while(ff->recognize != NULL) {
+        if ((*ff->recognize)(op) == 0 && (ff->verify == NULL || (*ff->verify)(op) == 0))
+            break;
+        i += 1;
+        ff = &s_formats[i];
+    }
+
+    if (ff->recognize == NULL)
+        return NULL;
+
+    return ff;
+}
+
+static ComponentResult ProcessPage(OggImportGlobalsPtr globals, ogg_page *op) {
+	ComponentResult ret = noErr;
+	long serialno;
+	StreamInfoPtr si;
+
+	serialno = ogg_page_serialno(op);
+
+	dprintf("   - = page found, nr: %08lx\n", ogg_page_pageno(op));
+	if (ogg_page_bos(op)) {
+		dprintf("   - = new stream found: %lx\n" , serialno);
+		stream_format_handle_funcs *ff = find_stream_support(op);
+		if (ff != NULL) {
+			dprintf("   - == And a supported one!\n");
+			ret = OpenStream(globals, serialno, op, ff);
+			
+			if (ret == noErr) {
+				ogg_packet       opckt;
+				StreamInfoPtr si = FindStream(globals, serialno);
+
+				if (si != NULL) {
+					ogg_stream_pagein(&si->os, op); //check errors?
+					ogg_stream_packetout(&si->os, &opckt); //check errors?
+
+                    if (si->sfhf->first_packet != NULL)
+                        (*si->sfhf->first_packet)(si, op, &opckt); //check errors?
+                }
+			}
+		}
+	} else {
+		si = FindStream(globals, serialno);
+		
+		if (si != NULL) {
+			ret = ProcessStreamPage(globals, si, op);
+		}
+	}
+
+	globals->dataOffset = S64Add(globals->dataOffset, S64Set(globals->currentData - globals->dataRB.b_start));
+	rb_zap(&globals->dataRB, globals->currentData - globals->dataRB.b_start);
+
+	globals->currentData = rb_data(&globals->dataRB);
+	globals->validDataEnd = globals->currentData + rb_data_available(&globals->dataRB);
+
+	return ret;
+}
+
+static ComponentResult GetFileSize(OggImportGlobalsPtr globals);
+
+static ComponentResult StateProcess(OggImportGlobalsPtr globals) {
+    ComponentResult result = noErr;
+    ogg_page og;
+	Boolean process = true;
+
+	dprintf("-----= StateProcess() called\n");
+	while (process) {
+		switch (globals->state) {
+			case kStateInitial:
+				dprintf("   - (:kStateInitial:)\n");
+				globals->dataOffset = globals->dataStartOffset;
+				globals->numTracksSeen = 0;
+				globals->timeLoaded = 0;
+				globals->dataRequested = false;
+				globals->startTickCount = TickCount();
+				
+				if (S64Compare(globals->dataEndOffset, S64Set(-1)) == 0) {
+					globals->sizeInitialised = false;
+					globals->state = kStateGettingSize;
+					result = GetFileSize(globals);
+					if (!globals->sizeInitialised)
+						process = false;
+				} else
+					globals->state = kStateReadingPages;
+				
+				break;
+				
+			case kStateGettingSize:
+				dprintf("   - (:kStateGettingSize:)\n");
+				if (!globals->sizeInitialised) {
+					process = false;
+					break;
+				}
+				
+				globals->state = kStateReadingPages;
+				break;
+				
+			case kStateReadingPages:
+				dprintf("   - (:kStateReadingPages:)\n");
+				if (globals->dataRequested) {
+					DataHTask(globals->dataReader);
+					process = false;
+					break;
+				}
+				globals->currentData = rb_data(&globals->dataRB);
+				globals->validDataEnd = globals->currentData + rb_data_available(&globals->dataRB);
+				
+				while (result == noErr && FindPage(&globals->currentData, globals->validDataEnd, &og)) {
+					result = ProcessPage(globals, &og);
+				}
+				
+				if (result != noErr)
+					break;
+
+				result = FillBuffer(globals);
+				if (result == eofErr)
+					globals->state = kStateReadingLastPages;
+
+				break;
+				
+			case kStateReadingLastPages:
+				dprintf("   - (:kStateReadingLastPages:)\n");
+				globals->currentData = rb_data(&globals->dataRB);
+				globals->validDataEnd = globals->currentData + rb_data_available(&globals->dataRB);
+				
+				dprintf("   + (:kStateReadingLastPages:)\n");
+				while (FindPage(&globals->currentData, globals->validDataEnd, &og)) {
+					result = ProcessPage(globals, &og);
+					dprintf("  <- (:kStateReadingLastPages:) = %ld\n", (long)result);
+				}
+					
+					globals->state = kStateImportComplete;
+				break;
+				
+			case kStateImportComplete:
+				dprintf("   - (:kStateImportComplete:)\n");
+				process = false;
+				break;
+		}
+	}
+	
+	return result;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+static void ReadCompletion(Ptr request, long refcon, OSErr readErr)
+{
+    OggImportGlobalsPtr globals = (OggImportGlobalsPtr) refcon;
+    ComponentResult		 result = readErr;
+    
+	dprintf("---> ReadCompletion() called\n");
+    if (readErr == noErr)
+    {
+		dprintf("--1- ReadCompletion() :: noErr\n");
+
+		rb_sync_reserved(&globals->dataRB);
+		globals->dataRequested = false;
+
+		if (globals->idleManager != NULL) {
+			dprintf("--2- ReadCompletion() :: requesting Idle\n");
+			QTIdleManagerSetNextIdleTimeNow(globals->idleManager);
+		}
+	}
+    
+    if (result != noErr)
+    {
+		dprintf("--3- ReadCompletion() :: !noErr - %ld (%lx), eofErr: %d\n", result, result, result == eofErr);
+
+        if (result == eofErr) {
+            result = noErr;
+			globals->dataRequested = false;
+			globals->state = kStateImportComplete;
+		}
+
+        globals->errEncountered = result;
+        
+        /* close off every open stream */
+		if (globals->streamCount > 0)
+			CloseAllStreams(globals);
+    }
+
+	dprintf("---< ReadCompletion()\n");
+}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+static void FileSizeCompletion(Ptr request, long refcon, OSErr readErr)
+{
+    OggImportGlobalsPtr globals = (OggImportGlobalsPtr) refcon;
+
+	dprintf("----- FileSizeCompletion() called = %ld\n", (long) readErr);
+    if (readErr == noErr)
+    {
+        globals->dataEndOffset = WideToSInt64(globals->wideTempforFileSize);
+		globals->sizeInitialised = true;
+		QTIdleManagerSetNextIdleTimeNow(globals->idleManager);
+    }
+}
+
+static ComponentResult GetFileSize(OggImportGlobalsPtr globals)
+{
+    ComponentResult 	err = badComponentSelector;
+    wide                size;
+    
+	dprintf("---> GetFileSize() called\n");
+	if (globals->usingIdle && globals->dataCanDoGetFileSizeAsync && false) {
+        err = DataHGetFileSizeAsync(globals->dataReader, &globals->wideTempforFileSize, 
+                        globals->fileSizeCompletion, (long) globals);
+		dprintf("---- :: async size, err: %ld (%lx)\n", (long)err, (long)err);		
+
+    } else if (globals->dataCanDoGetFileSize64) {
+        err = DataHGetFileSize64(globals->dataReader, &size);
+		dprintf("---- :: size: %ld%ld, err: %ld (%lx)\n", size.hi, size.lo, (long)err, (long)err);
+        globals->readError = err;
+        if (err == noErr) {
+            globals->dataEndOffset = WideToSInt64(size);
+			globals->sizeInitialised = true;
+		}
+    } else {
+		globals->dataEndOffset = S64Set(-1);
+		globals->sizeInitialised = true;
+		err = noErr;
+	}
+    
+	dprintf("---< GetFileSize() = %ld (%lx)\n", (long) err, (long) err);
+    return err;
+}
+
+static ComponentResult StartImport(OggImportGlobalsPtr globals, Handle dataRef, OSType dataRefType)
+{
+    ComponentResult err = noErr;
+    
+    globals->state = kStateInitial;
+    
+    return err;
+}
+
+static ComponentResult JustImport(OggImportGlobalsPtr globals, Handle dataRef, OSType dataRefType) {
+    ComponentResult	ret = noErr;
+	Boolean	do_read = true;
+    
+    globals->state = kStateInitial;
+    
+    /* if limits have not been set, then try to get the size of the file. */
+    if (S64Compare(globals->dataEndOffset, S64Set(-1)) == 0) {
+        ret = GetFileSize(globals);
+    }
+
+	if (ret != noErr)
+		return ret;
+
+	while (do_read) {
+		ret = StateProcess(globals);
+		if ((ret != noErr && ret != eofErr) || globals->state == kStateImportComplete)
+			do_read = false;
+	}
+
+	if (ret == eofErr)
+		ret = noErr;
+
+	dprintf("-<<- JustImport(): %ld\n", (long)ret);
+    return ret;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+static ComponentResult SetupDataHandler(OggImportGlobalsPtr globals, Handle dataRef, OSType dataRefType)
+{
+    ComponentResult err = noErr;
+    
+	dprintf("---> SetupDataHandler(type: '%4.4s') called\n", &dataRefType);
+    if (globals->dataReader == NULL)
+    {
+		Component dataHComponent = NULL;
+
+#if 0
+		if (dataRefType == URLDataHandlerSubType)
+		{
+			ComponentDescription cdesc, cd;
+			int count;
+			Handle cname = NewHandle(0);
+			
+			cdesc.componentType = DataHandlerType;
+			cdesc.componentSubType = URLDataHandlerSubType;
+			cdesc.componentManufacturer = kAnyComponentManufacturer;
+			cdesc.componentFlags = kAnyComponentFlagsMask;
+			cdesc.componentFlagsMask = kAnyComponentFlagsMask;
+			
+			dprintf("---- >> CountComponents(urlDataHandlers): %ld\n", CountComponents(&cdesc));
+			count = 6;
+			while (count-- > 0) {
+				dataHComponent = FindNextComponent(dataHComponent, &cdesc);
+				GetComponentInfo(dataHComponent, &cd, cname, NULL, NULL);
+				dprintf("---- ->-> component desc: %s, manu: %4.4s\n", *cname, &cd.componentManufacturer);
+			}
+			
+		} else {
+#endif
+			dataHComponent = GetDataHandler(dataRef, dataRefType, kDataHCanRead);
+#if 0
+		}
+#endif
+
+        err = OpenAComponent(dataHComponent, &globals->dataReader);
+    
+		dprintf("---- >> OpenAComponent() = %ld\n", (long)err);
+        if (err == noErr)
+        {
+            err = DataHSetDataRef(globals->dataReader, dataRef);
+			dprintf("---- >> DataHSetDataRef() = %ld\n", (long)err);
+            if (err == noErr)
+                err = DataHOpenForRead(globals->dataReader);
+#if 0
+			else {
+				Boolean wc;
+				err = DataHResolveDataRef(globals->dataReader, dataRef, &wc, false);
+				dprintf("---- >> DataHResolveDataRef() = %ld\n", (long)err);
+				err = noErr;
+			}
+#endif
+			DataHPlaybackHints(globals->dataReader, 0, 0, -1, 49152);  // Don't care if it fails
+            
+            if (err == noErr)
+            {
+                long	blockSize = 1024;
+                
+                globals->dataOffset = S64Set(0);
+                
+                globals->dataRef = dataRef;
+                globals->dataRefType = dataRefType;
+    
+                globals->dataCanDoAsyncRead = (CallComponentCanDo(globals->dataReader, kDataHReadAsyncSelect) == true);
+                globals->dataCanDoGetFileSizeAsync = (CallComponentCanDo(globals->dataReader, kDataHGetFileSizeAsyncSelect) == true);
+                globals->dataCanDoGetFileSize64 = (CallComponentCanDo(globals->dataReader, kDataHGetFileSize64Select) == true);
+    
+                globals->dataReadChunkSize = kDataBufferSize;
+				if ((globals->newMovieFlags & newMovieAsyncOK) != 0 && globals->dataCanDoGetFileSizeAsync)
+					globals->dataReadChunkSize = kDataAsyncBufferSize;
+                err = DataHGetPreferredBlockSize(globals->dataReader, &blockSize);
+                if (err == noErr && blockSize < globals->dataReadChunkSize && blockSize > 1024)
+                    globals->dataReadChunkSize = blockSize;
+				dprintf("     - allocating buffer, size: %d (prefBlockSize: %ld); ret = %ld\n",
+						globals->dataReadChunkSize, blockSize, (long)err);
+                err = noErr;	/* ignore any error and use our default read block size */
+    
+				err = rb_init(&globals->dataRB, 2 * globals->dataReadChunkSize); //hmm why was it x2 ?
+
+                globals->currentData = (unsigned char *)globals->dataRB.buffer;
+                globals->validDataEnd = (unsigned char *)globals->dataRB.buffer;
+            }
+            
+            if (err == noErr)
+            {
+                globals->dataReadCompletion = NewDataHCompletionUPP(ReadCompletion);
+            }
+            
+            if (err == noErr && globals->dataCanDoGetFileSizeAsync)
+            {
+                globals->fileSizeCompletion = NewDataHCompletionUPP(FileSizeCompletion);
+            }
+
+            if (err == noErr && globals->idleManager)
+            {
+            // purposely ignore the error message here, i.e. set it if the data handler supports it
+                OggImportSetIdleManager(globals, globals->idleManager);
+            }
+
+            if (err == noErr)
+            {
+            // This logic is similar to the MP3 importer
+                UInt32  flags = 0;
+                
+                globals->dataIsStream = globals->dataCanDoGetFileSizeAsync;
+
+                err = DataHGetInfoFlags(globals->dataReader, &flags);
+                if (err == noErr && (flags & kDataHInfoFlagNeverStreams))
+                    globals->dataIsStream = false;
+                err = noErr;
+				dprintf("---- -:: InfoFlags: NeverStreams: %d, CanUpdate...: %d, NeedsNet: %d\n",
+						(flags & kDataHInfoFlagNeverStreams) != 0,
+						(flags & kDataHInfoFlagCanUpdateDataRefs) != 0,
+						(flags & kDataHInfoFlagNeedsNetworkBandwidth) != 0);
+            }
+        }
+    }
+    
+	dprintf("---< SetupDataHandler() = %ld\n", (long)err);
+	return err;
+}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//			Component Routines
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportOpen(OggImportGlobalsPtr globals, ComponentInstance self)
+{
+    OSErr						result;
+    
+	dprintf("-- Open() called\n");
+    globals = (OggImportGlobalsPtr)NewPtrClear(sizeof(OggImportGlobals));
+    if (globals != nil)
+    {	
+        // set our storage pointer to our globals
+        SetComponentInstanceStorage(self, (Handle) globals);
+        globals->self = self;
+        
+        globals->dataEndOffset = S64Set(-1);
+		globals->idleManager = NULL;
+		globals->dataIdleManager = NULL;
+    
+        result = noErr;
+    }
+    else
+        result = MemError();
+    
+    return (result);
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportClose(OggImportGlobalsPtr globals, ComponentInstance self)
+{
+    ComponentResult		result;
+    (void)self;
+    
+	dprintf("-- Close() called\n");
+    if (globals != nil)											// we have some globals
+    {
+        if (globals->streamInfoHandle)
+        {
+			if (globals->streamCount > 0)
+				CloseAllStreams(globals);
+            DisposeHandle((Handle)globals->streamInfoHandle);
+        }
+        
+        if (globals->dataReader)
+        {
+            result = CloseComponent(globals->dataReader);
+            //FailMessage(result != noErr);		//@@@
+            globals->dataReader = NULL;
+        }
+        
+        if (globals->dataBuffer)
+        {
+            DisposePtr(globals->dataBuffer);
+            globals->dataBuffer = NULL;
+        }
+		
+		if (globals->dataRB.buffer) {
+			rb_free(&globals->dataRB);
+		}
+        
+        if (globals->dataReadCompletion)
+            DisposeDataHCompletionUPP(globals->dataReadCompletion);
+        
+        if (globals->fileSizeCompletion)
+            DisposeDataHCompletionUPP(globals->fileSizeCompletion);
+        
+        if (globals->aliasHandle)
+            DisposeHandle((Handle)globals->aliasHandle);
+            
+		if (globals->dataIdleManager != NULL)
+			QTIdleManagerClose(globals->dataIdleManager);
+        
+        DisposePtr((Ptr)globals);
+    }
+    
+    return noErr;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportVersion(OggImportGlobalsPtr globals)
+{
+	dprintf("-- Version() called\n");
+    return kOgg_eat__Version;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportSetOffsetAndLimit64(OggImportGlobalsPtr globals, const wide *offset,
+		const wide *limit)
+{
+	dprintf("-- SetOffsetAndLimit64(%ld%ld, %ld%ld) called\n", offset->hi, offset->lo, limit->hi, limit->lo);
+    globals->dataStartOffset = WideToSInt64(*offset);
+    globals->dataEndOffset  = WideToSInt64(*limit);
+    
+    return noErr;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportSetOffsetAndLimit(OggImportGlobalsPtr globals, unsigned long offset,
+		unsigned long limit)
+{
+	dprintf("-- SetOffsetAndLimit(%ld, %ld) called\n", offset, limit);
+    globals->dataStartOffset = S64SetU(offset);	
+    globals->dataEndOffset = S64SetU(limit);
+    
+    return noErr;
+}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportValidate(OggImportGlobalsPtr globals, 
+  const FSSpec *         theFile,
+  Handle                 theData,
+  Boolean *              valid)
+{
+    ComponentResult err = noErr;
+	UInt8 extvalid = 0;
+
+	dprintf("-- Validate() called\n");
+    if (theFile == NULL)
+    {
+        Handle	dataHandle = NewHandle(sizeof(HandleDataRefRecord));
+        if (dataHandle != NULL)
+        {
+            (*(HandleDataRefRecord **)dataHandle)->dataHndl = theData;
+            err = MovieImportValidateDataRef(globals->self,
+                                        dataHandle,
+                                        HandleDataHandlerSubType,
+                                        &extvalid);
+            DisposeHandle(dataHandle);
+        }
+    }
+    else
+    {
+        AliasHandle alias = NULL;
+    
+        err = NewAliasMinimal(theFile, &alias);
+        if (err == noErr)
+        {
+            err = MovieImportValidateDataRef(globals->self,
+                                    (Handle)alias,
+                                    rAliasType,
+                                    &extvalid);
+    
+            DisposeHandle((Handle)alias);
+        }
+    }
+    
+	if (extvalid > 0)
+		*valid = true;
+	else
+		*valid = false;
+
+    return err;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportValidateDataRef(OggImportGlobalsPtr globals, 
+  Handle                 dataRef,
+  OSType                 dataRefType,
+  UInt8 *                valid)
+{
+    ComponentResult err = noErr;
+	dprintf("-- ValidateDataRef() called\n");
+    
+	*valid = 128;
+
+    return err;
+}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportFile(OggImportGlobalsPtr globals, const FSSpec *theFile,
+                                Movie theMovie, Track targetTrack, Track *usedTrack,
+                                TimeValue atTime, TimeValue *durationAdded,
+                                long inFlags, long *outFlags)
+{
+    ComponentResult err = noErr;
+    AliasHandle alias = NULL;
+
+	dprintf("-- File() called\n");
+    
+    *outFlags = 0;
+    
+    err = NewAliasMinimal(theFile, &alias);
+    if (err == noErr)
+    {
+        err = MovieImportDataRef(globals->self,
+                                (Handle)alias,
+                                rAliasType,
+                                theMovie,
+                                targetTrack,
+                                usedTrack,
+                                atTime,
+                                durationAdded,
+                                inFlags,
+                                outFlags);
+    
+        if (!(*outFlags & movieImportResultNeedIdles))
+            DisposeHandle((Handle) alias);
+        else
+            globals->aliasHandle = alias;
+    }
+    
+    return err;
+}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportGetMIMETypeList(OggImportGlobalsPtr globals, QTAtomContainer *retMimeInfo)
+{
+	dprintf("-- GetMIMETypeList() called\n");
+    return GetComponentResource((Component)globals->self, FOUR_CHAR_CODE('mime'), kImporterResID, (Handle *)retMimeInfo);
+}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportGetFileType(OggImportGlobalsPtr globals, OSType *fileType)
+{
+	dprintf("-- GetFileType() called\n");
+    *fileType = kCodecFormat;
+    return noErr;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportSetChunkSize(OggImportGlobalsPtr globals, long chunkSize)
+{
+    ComponentResult err = noErr;
+    
+	dprintf("-- ImportSetChunkSize(%ld) called\n", chunkSize);
+    if (chunkSize > 2048 && chunkSize < 204800)
+        globals->chunkSize = chunkSize;
+    else
+        err = paramErr;
+    
+    return err;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportIdle(OggImportGlobalsPtr globals,
+                                long  inFlags,
+                                long *outFlags)
+{
+    ComponentResult err = noErr;
+	dprintf("-> Idle() called    [%08lx]\n", (long)globals);
+
+	if (globals->state == kStateImportComplete) {
+		*outFlags |= movieImportResultComplete;
+		return err;
+	}
+
+	err = StateProcess(globals);
+
+#if 0
+	if (true) {
+		Boolean needs = false;
+		TimeRecord ni;
+
+		if (globals->idleManager != NULL) {
+			QTIdleManagerNeedsAnIdle(globals->idleManager, &needs);
+			if (needs) {
+				QTIdleManagerGetNextIdleTime(globals->idleManager, &ni);
+				dprintf("-- -- IdleManager :: requested: base: %ld, scale: %ld, value: %ld %ld\n", (long)ni.base, ni.scale,
+						ni.value.hi, ni.value.lo);
+			} else {
+				dprintf("-- -- IdleManager :: not needed\n");
+			}
+		}
+
+		if (globals->dataIdleManager != NULL) {
+			QTIdleManagerNeedsAnIdle(globals->dataIdleManager, &needs);
+			if (needs) {
+				QTIdleManagerGetNextIdleTime(globals->dataIdleManager, &ni);
+				dprintf("-- -- DataIdleManager :: requested: base: %ld, scale: %ld, value: %ld %ld\n", (long)ni.base, ni.scale,
+						ni.value.hi, ni.value.lo);
+			} else {
+				dprintf("-- -- DataIdleManager :: not needed\n");
+			}
+		}
+	}
+#endif
+
+	dprintf("-< Idle: %ld        [%08lx]\n", (long)err, (long)globals);
+    return err;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportDataRef(OggImportGlobalsPtr globals, Handle dataRef,
+                                OSType dataRefType, Movie theMovie,
+                                Track targetTrack, Track *usedTrack,
+                                TimeValue atTime, TimeValue *durationAdded,
+                                long inFlags, long *outFlags)
+{
+    ComponentResult err = noErr;
+	
+	*outFlags = 0;
+	
+	globals->theMovie = theMovie;
+	globals->startTime = atTime;
+
+	dprintf("-- DataRef(at:%ld) called\n", atTime);
+	if (GetHandleSize(dataRef) < 256) {
+		dprintf("-- - DataRef: \"%s\"\n", *dataRef);
+	} else {
+		dprintf("-- - DataRef: '%c'\n", *dataRef[0]);
+	}
+
+	dprintf("    theMovie: %lx,  targetTrack: %lx\n", theMovie, targetTrack);
+	dprintf("    track count: %ld\n", GetMovieTrackCount(theMovie));
+	dprintf("    flags:\n\tmovieImportCreateTrack:%d\n\tmovieImportInParallel:%d\n"
+			"\tmovieImportMustUseTrack:%d\n\tmovieImportWithIdle:%d\n",
+		   (inFlags & movieImportCreateTrack)  != 0,
+		   (inFlags & movieImportInParallel)   != 0,
+		   (inFlags & movieImportMustUseTrack) != 0,
+		   (inFlags & movieImportWithIdle)     != 0);
+	dprintf("     : importing at: %ld, added: %ld\n", atTime, *durationAdded);
+    err = SetupDataHandler(globals, dataRef, dataRefType);
+	if (err == noErr)
+		dprintf("    SetupDataHandler() succeeded\n");
+
+	globals->usingIdle = ((globals->dataIsStream || globals->dataCanDoAsyncRead)
+						  //&& globals->dataCanDoGetFileSizeAsync
+						  && (inFlags & movieImportWithIdle) != 0);
+
+    if (dataRefType != URLDataHandlerSubType)
+        globals->usingIdle = false;
+	dprintf("--> 2: globals->usingIdle: %d\n", globals->usingIdle);
+
+	if (globals->usingIdle) {
+		err = StartImport(globals, dataRef, dataRefType);
+		*outFlags |= movieImportResultNeedIdles;
+		*durationAdded = 0;
+	} else {
+		err = JustImport(globals, dataRef, dataRefType);
+		*outFlags &= !movieImportResultNeedIdles;
+		if (err == noErr) {
+			*outFlags |= movieImportResultComplete;
+			*durationAdded = globals->timeLoaded;
+			if (globals->numTracksSeen == 1)
+				*usedTrack = globals->firstTrack;
+		}
+	}
+	
+	//globals->usingIdle = true;
+	//*outFlags |= movieImportResultNeedIdles;
+	
+	dprintf("-< DataRef(at:%ld)\n", atTime);
+    return err;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportGetLoadState(OggImportGlobalsPtr globals, long *loadState)
+{
+	dprintf("-- GetLoadState() called\n");
+    switch (globals->state)
+    {
+	case kStateInitial:
+    case kStateGettingSize:
+        *loadState = kMovieLoadStateLoading;
+        break;
+    
+    case kStateReadingPages:
+		if (globals->timeLoaded > 0)
+			if (globals->sizeInitialised && S64Compare(globals->dataEndOffset, S64Set(-1)) == 0)
+				*loadState = kMovieLoadStatePlaythroughOK;
+			else
+				*loadState = kMovieLoadStatePlayable;
+		else
+			*loadState = kMovieLoadStateLoading;
+
+		break;
+
+    case kStateReadingLastPages:
+            *loadState = kMovieLoadStatePlaythroughOK;
+        break;
+        
+    case kStateImportComplete:
+        *loadState = kMovieLoadStateComplete;
+        break;	
+    }
+    
+	dprintf("-- GetLoadState returning %ld\n", *loadState);
+
+    return noErr;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportGetMaxLoadedTime(OggImportGlobalsPtr globals, TimeValue *time)
+{
+	dprintf("-- GetMaxLoadedTime() called: %8ld (at: %ld)\n", globals->timeLoaded, TickCount());
+
+	*time = globals->timeLoaded;
+
+	return noErr;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportEstimateCompletionTime(OggImportGlobalsPtr globals, TimeRecord *time)
+{
+    unsigned long timeUsed = TickCount() - globals->startTickCount;
+    SInt64        dataUsed = S64Subtract(globals->dataOffset, globals->dataStartOffset);
+    SInt64        dataLeft = S64Subtract(globals->dataEndOffset, globals->dataOffset);
+    SInt64        ratio    = S64Div(S64Multiply(S64Set(timeUsed), dataLeft), dataUsed);
+
+	dprintf("-- EstimateCompletionTime() called: ratio = %lld\n", ratio);
+
+    time->value = SInt64ToWide(ratio);
+    time->scale = 60;
+    time->base  = NULL;   // this time record is a duration
+
+	return noErr;
+}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportSetDontBlock(OggImportGlobalsPtr globals, Boolean  dontBlock)
+{
+	dprintf("-- SetDontBlock(%d) called\n", dontBlock);
+    globals->blocking = dontBlock;
+    return noErr;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportGetDontBlock(OggImportGlobalsPtr globals, Boolean  *willBlock)
+{
+	dprintf("-- GetDontBlock() called\n");
+    *willBlock = globals->blocking;
+    return noErr;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportSetIdleManager(OggImportGlobalsPtr globals, IdleManager im)
+{
+    ComponentResult err = noErr;
+
+	dprintf("-- SetIdleManager() called\n");
+    globals->idleManager = im;
+
+    if (globals->dataReader)
+    {
+        if (CallComponentCanDo(globals->dataReader, kDataHSetIdleManagerSelect) == true)
+        {
+			globals->dataIdleManager = QTIdleManagerOpen();
+			if (globals->dataIdleManager != NULL) {
+				err = DataHSetIdleManager(globals->dataReader, im);
+				dprintf("--  -- SetIdleManager(dataReader) = %ld\n", (long)err);
+				if (err != noErr) {
+					QTIdleManagerClose(globals->dataIdleManager);
+					err = noErr;
+				} else {
+					err = QTIdleManagerSetParent(globals->dataIdleManager, globals->idleManager);
+					dprintf("--  -- SetParentIdleManager() = %ld\n", (long)err);
+					err = noErr;
+				}
+			}
+        } else {
+			dprintf("--  -- SetIdleManager(dataReader) = DOESN'T SUPPORT IDLE!!\n");
+		}
+    }
+	
+	QTIdleManagerSetNextIdleTimeNow(globals->idleManager);
+    return err;
+}
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMPONENTFUNC OggImportSetNewMovieFlags(OggImportGlobalsPtr globals, long flags)
+{
+	dprintf("-- SetNewMovieFlags() called: %08lx\n", flags);
+
+    globals->newMovieFlags = flags;
+    return noErr;
+}


Property changes on: trunk/xiph-qt/OggImport/src/OggImport.c
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/OggImport.exp
===================================================================
--- trunk/xiph-qt/OggImport/src/OggImport.exp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/OggImport.exp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1 @@
+_OggImportComponentDispatch

Added: trunk/xiph-qt/OggImport/src/OggImport.h
===================================================================
--- trunk/xiph-qt/OggImport/src/OggImport.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/OggImport.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,52 @@
+/*
+ *  OggImport.h
+ *
+ *    OggImport.h - some constants definitions.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#ifndef __OGGIMPORT_H__
+#define __OGGIMPORT_H__ 1
+
+#include "versions.h"
+
+#define kOggVorbisBundleID "net.barelyfocused.xiph.oggimport"
+
+#define kImporterResID                  4000
+#define kImporterNameStringResID        4000
+#define kImporterInfoStringResID        4001
+
+#define kSoundComponentManufacturer     'Xiph'	// your company's OSType
+#define kCodecFormat                    'OggS'
+
+
+#ifdef _DEBUG
+#define OggImporterName        "Ogg Vorbis Importer"
+#else
+#define OggImporterName        ""
+#endif
+
+#endif /* __OGGIMPORT_H__ */


Property changes on: trunk/xiph-qt/OggImport/src/OggImport.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/OggImport.r
===================================================================
--- trunk/xiph-qt/OggImport/src/OggImport.r	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/OggImport.r	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,260 @@
+/*
+ *  OggImport.r
+ *
+ *    Information bit definitions for the 'thng' and other OggImport
+ *    resources.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#define TARGET_REZ_CARBON_MACHO 1
+
+#define thng_RezTemplateVersion 2
+
+#define cfrg_RezTemplateVersion 1
+
+#include <Carbon/Carbon.r>
+#include <QuickTime/QuickTime.r>
+
+#include "OggImport.h"
+
+#define kImporterComponentType 'eat '
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Ogg Importer
+
+#define kImporterFlags canMovieImportFiles | canMovieImportValidateFile | \
+		canMovieImportPartial | canMovieImportInPlace | hasMovieImportMIMEList | \
+		canMovieImportDataReferences | canMovieImportWithIdle | \
+		canMovieImportAvoidBlocking | canMovieImportValidateDataReferences | \
+                cmpThreadSafe
+
+
+resource 'thng' (kImporterResID, OggImporterName, purgeable) {
+    kImporterComponentType, kCodecFormat, 'soun', 
+    0, 0, 0, 0,
+    'STR ', kImporterNameStringResID,
+    'STR ', kImporterInfoStringResID,
+    0, 0,		// no icon
+    kOgg_eat__Version,
+    componentDoAutoVersion|componentHasMultiplePlatforms, 0,
+    {
+#if TARGET_OS_MAC	       // COMPONENT PLATFORM INFORMATION ----------------------
+        kImporterFlags, 
+        'dlle',                                 // Code Resource type - Entry point found by symbol name 'dlle' resource
+        kImporterResID,                         // ID of 'dlle' resource
+        platformPowerPCNativeEntryPoint,
+#endif
+#if TARGET_OS_WIN32
+    kImporterFlags, 
+    'dlle',
+    kImporterResID,
+    platformWin32,
+#endif
+    },
+    'thnr', kImporterResID
+};
+
+// Component Alias
+resource 'thga' (kImporterResID, OggImporterName, purgeable) {
+    kImporterComponentType,             // Type
+    'OGG ',                             // Subtype - this must be in uppercase. It will match an ".ogg" suffix case-insensitively.
+    'soun',                             // Manufacturer
+    kImporterFlags | movieImportSubTypeIsFileExtension,	// The subtype is a file name suffix
+    0,                                  // Component Flags Mask
+    0,                                  // Code Type
+    0,                                  // Code ID
+    'STR ',                             // Name Type
+    kImporterNameStringResID,           // Name ID
+    'STR ',                             // Info Type
+    kImporterInfoStringResID,           // Info ID 
+    0,                                  // Icon Type 
+    0,                                  // Icon ID
+                // TARGET COMPONENT ---------------
+    kImporterComponentType,             // Type
+    kCodecFormat,                       // SubType
+    'soun',                             // Manufaturer
+    kImporterFlags,                     // Component Flags
+    0,                                  // Component Flags Mask
+    'thnr', kImporterResID, 0
+};
+
+// Component Alias
+resource 'thga' (kImporterResID + 1, OggImporterName, purgeable) {
+    kImporterComponentType,             // Type
+    'OGM ',                             // Subtype - this must be in uppercase. It will match an ".ogm" suffix case-insensitively.
+    'soun',                             // Manufacturer
+    kImporterFlags | movieImportSubTypeIsFileExtension,	// The subtype is a file name suffix
+    0,                                  // Component Flags Mask
+    0,                                  // Code Type
+    0,                                  // Code ID
+    'STR ',                             // Name Type
+    kImporterNameStringResID,           // Name ID
+    'STR ',                             // Info Type
+    kImporterInfoStringResID,           // Info ID 
+    0,                                  // Icon Type 
+    0,                                  // Icon ID
+                // TARGET COMPONENT ---------------
+    kImporterComponentType,             // Type
+    kCodecFormat,                       // SubType
+    'soun',                             // Manufaturer
+    kImporterFlags,                     // Component Flags
+    0,                                  // Component Flags Mask
+    'thnr', kImporterResID, 0
+};
+
+// Component Alias
+resource 'thga' (kImporterResID + 2, OggImporterName, purgeable) {
+    kImporterComponentType,             // Type
+    'SPX ',                             // Subtype - this must be in uppercase. It will match an ".ogm" suffix case-insensitively.
+    'soun',                             // Manufacturer
+//    kImporterFlags /*| movieImportSubTypeIsFileExtension */,	// The .spx extension is used by System Profiler
+    kImporterFlags | movieImportSubTypeIsFileExtension,	// The subtype is a file name suffix
+    0,                                  // Component Flags Mask
+    0,                                  // Code Type
+    0,                                  // Code ID
+    'STR ',                             // Name Type
+    kImporterNameStringResID,           // Name ID
+    'STR ',                             // Info Type
+    kImporterInfoStringResID,           // Info ID 
+    0,                                  // Icon Type 
+    0,                                  // Icon ID
+                                        // TARGET COMPONENT ---------------
+    kImporterComponentType,             // Type
+    kCodecFormat,                       // SubType
+    'soun',                             // Manufaturer
+    kImporterFlags,                     // Component Flags
+    0,                                  // Component Flags Mask
+    'thnr', kImporterResID, 0
+};
+
+resource 'thnr' (kImporterResID, OggImporterName, purgeable) {
+    {
+        'mime', 1, 0, 'mime', kImporterResID, cmpResourceNoFlags,
+        'mcfg', 1, 0, 'mcfg', kImporterResID, cmpResourceNoFlags,
+    };
+};
+
+
+#if TARGET_REZ_CARBON_MACHO /* || TARGET_REZ_WIN32 */
+resource 'dlle' (kImporterResID, OggImporterName) {
+    "OggImportComponentDispatch"
+};
+#endif
+
+// name and info string are shared by the compressor and decompressor
+resource 'STR ' (kImporterNameStringResID, OggImporterName, purgeable) {
+    "Ogg Importer"
+};
+
+resource 'STR ' (kImporterInfoStringResID, OggImporterName, purgeable) {
+    "Ogg " "0.1.1" " (See http://www.xiph.org)."
+};
+
+
+/* 
+    This is an example of how to build an atom container resource to hold mime types.
+    This component's GetMIMETypeList implementation simply loads this resource and returns it.
+    Please note that atoms of the same type MUST be grouped together within an atom container.
+*/
+resource 'mime' (kImporterResID, OggImporterName, purgeable) {
+    {
+        kMimeInfoMimeTypeTag,      1, "application/x-ogg";
+        kMimeInfoMimeTypeTag,      2, "application/ogg";
+        kMimeInfoMimeTypeTag,      3, "audio/x-speex";
+        kMimeInfoMimeTypeTag,      4, "audio/speex";
+        kMimeInfoFileExtensionTag, 1, "ogg";
+        kMimeInfoFileExtensionTag, 2, "ogg";
+        kMimeInfoFileExtensionTag, 3, "spx";
+        kMimeInfoFileExtensionTag, 4, "spx";
+        kMimeInfoDescriptionTag,   1, "Ogg Vorbis";
+        kMimeInfoDescriptionTag,   2, "Ogg Vorbis";
+        kMimeInfoDescriptionTag,   3, "Ogg Speex";
+        kMimeInfoDescriptionTag,   4, "Ogg Speex";
+    };
+};
+
+resource 'mcfg' (kImporterResID, OggImporterName, purgeable) {
+    kVersionDoesntMatter,
+    {
+        kQTMediaConfigAudioGroupID,
+        kQTMediaConfigBinaryFile | kQTMediaConfigCanUseApp,
+        'OggS',
+        'TVOD',	/* we don't have a creator code for our files, hijack QT player */
+	kImporterComponentType, kCodecFormat, kSoundComponentManufacturer,
+        0, 0,
+        'OGG ',
+        kQTMediaInfoNetGroup,
+        
+        /* no synonyms */
+        {
+        },
+        
+        {
+        "Ogg Vorbis sound file",
+        "ogg",
+        "QuickTime Player",
+        "Ogg Vorbis file importer",
+        "",
+        },
+        
+        /* mime types array */
+        {
+            "application/x-ogg";
+            "application/ogg";
+        };
+//    };
+//    {
+        kQTMediaConfigAudioGroupID,
+        kQTMediaConfigBinaryFile | kQTMediaConfigCanUseApp,
+        'OggS',
+        'TVOD',	/* we don't have a creator code for our files, hijack QT player */
+        kImporterComponentType, kCodecFormat, kSoundComponentManufacturer,
+        0, 0,
+        'SPX ',
+        kQTMediaInfoNetGroup,
+        
+        /* no synonyms */
+        {
+        },
+        
+        {
+            "Ogg Speex sound file",
+            "spx",
+            "QuickTime Player",
+            "Ogg Speex file importer",
+            "",
+        },
+        
+        /* mime types array */
+        {
+            "audio/x-speex";
+            "audio/speex";
+        };
+    };
+};
+
+


Property changes on: trunk/xiph-qt/OggImport/src/OggImport.r
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/OggImportDispatch.h
===================================================================
--- trunk/xiph-qt/OggImport/src/OggImportDispatch.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/OggImportDispatch.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,79 @@
+/*
+ *  OggImport.h
+ *
+ *    OggImport component dispatch helper header.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+        ComponentSelectorOffset (6)
+	
+	ComponentRangeCount (1)
+	ComponentRangeShift (7)
+	ComponentRangeMask  (7F)
+	
+	ComponentRangeBegin (0)
+		ComponentError (Target)
+		ComponentError (Register)
+		StdComponentCall (Version)
+		StdComponentCall (CanDo)
+		StdComponentCall (Close)
+		StdComponentCall (Open)
+	ComponentRangeEnd (0)
+	
+	ComponentRangeBegin (1)
+		ComponentError (0)
+		ComponentError (Handle)
+		ComponentCall (File)
+		ComponentError (SetSampleDuration)
+		ComponentError (SetSampleDescription)
+		ComponentError (SetMediaFile)
+		ComponentError (SetDimensions)
+		ComponentCall (SetChunkSize)
+		ComponentError (SetProgressProc)
+		ComponentError (SetAuxiliaryData)
+		ComponentError (SetFromScrap)
+		ComponentError (DoUserDialog)
+		ComponentError (SetDuration)
+		ComponentError (GetAuxiliaryDataType)
+		ComponentCall (Validate)
+		ComponentCall (GetFileType)
+		ComponentCall (DataRef)
+		ComponentError (GetSampleDescription)
+		ComponentCall (GetMIMETypeList)
+		ComponentCall (SetOffsetAndLimit)
+		ComponentError (GetSettingsAsAtomContainer)
+		ComponentError (SetSettingsFromAtomContainer)
+		ComponentCall (SetOffsetAndLimit64)
+		ComponentCall (Idle)
+		ComponentCall (ValidateDataRef)
+		ComponentCall (GetLoadState)
+		ComponentCall (GetMaxLoadedTime)
+		ComponentCall (EstimateCompletionTime)
+		ComponentCall (SetDontBlock)
+		ComponentCall (GetDontBlock)
+		ComponentCall (SetIdleManager)
+                ComponentCall (SetNewMovieFlags)
+	ComponentRangeEnd (1)


Property changes on: trunk/xiph-qt/OggImport/src/OggImportDispatch.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/common.c
===================================================================
--- trunk/xiph-qt/OggImport/src/common.c	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/common.c	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,189 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE QuickTime Components SOURCE CODE.       *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE QuickTime Components SOURCE CODE IS (C) COPYRIGHT 2001       *
+ * by Steve Nicolai http://qtcomponents.sourceforge.net/            *
+ *                                                                  *
+ ********************************************************************
+
+ function: Common Ogg/Vorbis functions across import/decompress
+ last mod: $$
+
+ ********************************************************************/
+
+
+#include "common.h"
+
+#include <string.h>
+
+
+/* returns false for not enough data, true for found a page
+   the page checksum isn't checked here, it's checked in the
+   next layer up, FindPage.  Advances the data pointer past
+   data as it returns it.
+ */
+static Boolean InternalFindPage(unsigned char **data, const unsigned char *end, ogg_page *op)
+{
+    unsigned char *p = *data;
+    int headerBytes, i, bodyBytes = 0;
+    
+    if (end - p < 27)
+        return false;
+
+    /* look for the page start marker */
+    while (p != NULL && p < end && (memcmp(p, "OggS", 4)))
+    {
+        *data = p;
+        p = (unsigned char *)memchr(p + 1, 'O', (end - p) - 1);
+    }
+    
+    if (p == NULL || end - p < 27)
+        return false;
+
+    headerBytes = p[26] + 27;
+    
+    if (end - p < headerBytes)
+        return false;
+    
+    for (i = 0; i < p[26]; i++)
+      bodyBytes += p[27 + i];
+    
+    if (p + headerBytes + bodyBytes > end)
+        return false;
+    
+    op->header = p;
+    op->header_len = headerBytes;
+    op->body = p + headerBytes;
+    op->body_len = bodyBytes;
+    
+    *data = p + headerBytes + bodyBytes;
+
+    return true;
+}
+
+static Boolean CheckChecksum(ogg_page *og)
+{
+    /* Grab the checksum bytes, set the header field to zero */
+    char chksum[4];
+    
+    memcpy(chksum,og->header+22,4);
+    memset(og->header+22,0,4);
+    
+    ogg_page_checksum_set(og);
+    
+    /* Compare */
+    if(memcmp(chksum,og->header+22,4))
+    {
+        /* replace the computed checksum with the one actually read in */
+        memcpy(og->header+22,chksum,4);
+        return false;
+    }
+    return true;
+}
+
+
+Boolean FindPage(unsigned char **data, const unsigned char *end, ogg_page *og)
+{
+    Boolean	foundPage;
+    do {
+        foundPage = InternalFindPage(data, end, og);
+        
+        if (!foundPage)
+            break;	/* didn't find a page, indicate more data needed */
+
+        if (CheckChecksum(og)) /* everything checks out, start next search after this page */
+            break;
+        else
+        { /* checksum is wrong, look for next page start */
+            unsigned char *t = memchr(*data + 1, 'O', (end - *data) - 1);
+            if (t == NULL)
+            { /* no candidate found, indicate more data needed */
+                foundPage = false;
+                break;
+            }
+            *data = t;
+        }
+    } while (1);
+    
+    return foundPage;
+}
+
+
+Boolean inline FindPageNoCRC(unsigned char **data, const unsigned char *end, ogg_page *og)
+{
+	return InternalFindPage(data, end, og);
+}
+
+
+OSErr LoadVorbisHeaders(Ptr header, int size, int findPackets, long *serialno, vorbis_info *vi, vorbis_comment *vc)
+{
+    OSErr	     err = noErr;
+    ogg_stream_state os; /* take physical pages, weld into a logical stream of packets */
+    ogg_page         og; /* one Ogg bitstream page.  Vorbis packets are inside */
+    ogg_packet       op; /* one raw packet of data for decode */
+
+    int				 numPackets = 0;
+    unsigned char *	 page = (unsigned char *)header;
+    const unsigned char *    end = page + size;
+
+    /* Get the first page. */
+    if (!InternalFindPage(&page, end, &og))
+    {
+        /* have we simply run out of data?  If so, we're done. */
+        return endOfDataReached;
+    }
+    
+    /* Get the serial number and set up the rest of decode. */
+    /* serialno first; use it to set up a logical stream */
+    *serialno = ogg_page_serialno(&og);
+    ogg_stream_init(&os, *serialno);
+    
+    /* extract the initial header from the first page and verify that the
+       Ogg bitstream is in fact Vorbis data */
+    
+    /* I handle the initial header first instead of just having the code
+       read all three Vorbis headers at once because reading the initial
+       header is an easy way to identify a Vorbis bitstream and it's
+       useful to see that functionality seperated out. */
+    
+    vorbis_info_clear(vi);
+    vorbis_info_init(vi);
+    vorbis_comment_init(vc);
+    do {
+        if (ogg_stream_pagein(&os, &og) < 0)
+        { 
+            err = invalidMedia;			/* error; stream version mismatch perhaps */
+            break;
+        }
+        
+        while (numPackets < findPackets)
+        {
+            if (ogg_stream_packetout(&os, &op) != 1)
+                break;
+            
+            numPackets++;
+            if (vorbis_synthesis_headerin(vi, vc, &op) < 0)
+            { 
+                err = noSoundTrackInMovieErr;	/* This Ogg bitstream does not contain Vorbis audio data */
+                break;
+            }
+        }
+        if (numPackets < findPackets) {
+            if (!InternalFindPage(&page, end, &og))
+            {
+                err = endOfDataReached;	/* have we simply run out of data?  If so, we're done. */
+                break;
+            }
+        }
+    } while (numPackets < findPackets);
+
+    ogg_stream_clear(&os);
+    
+    return err;
+}
+
+

Added: trunk/xiph-qt/OggImport/src/common.h
===================================================================
--- trunk/xiph-qt/OggImport/src/common.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/common.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,39 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE QuickTime Components SOURCE CODE.       *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE QuickTime Components SOURCE CODE IS (C) COPYRIGHT 2001       *
+ * by Steve Nicolai http://qtcomponents.sourceforge.net/            *
+ *                                                                  *
+ ********************************************************************
+
+ function: Common Ogg/Vorbis functions across import/decompress
+ last mod: $$
+
+ ********************************************************************/
+
+#if __APPLE_CC__
+    #include <QuickTime/QuickTime.h>
+#else
+    #include <MacTypes.h>
+    #include <MacErrors.h>
+    #include <Endian.h>
+    #include <MacMemory.h>
+    #include <Components.h>
+    #include <Sound.h>
+    #include <QuickTimeComponents.h>
+    #include <FixMath.h>
+    #include <Math64.h>
+#endif
+
+#include "vorbis/codec.h"
+
+
+Boolean FindPage(unsigned char **data, const unsigned char *end, ogg_page *og);
+
+Boolean FindPageNoCRC(unsigned char **data, const unsigned char *end, ogg_page *og);
+
+OSErr LoadVorbisHeaders(Ptr header, int size, int findPackets, long *serialno, vorbis_info *vi, vorbis_comment *vc);

Added: trunk/xiph-qt/OggImport/src/importer_types.h
===================================================================
--- trunk/xiph-qt/OggImport/src/importer_types.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/importer_types.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,194 @@
+/*
+ *  importer_types.h
+ *
+ *    Definitions of OggImporter data structures.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__importer_types_h__)
+#define __importer_types_h__
+
+#include <QuickTime/QuickTime.h>
+#include <Ogg/ogg.h>
+
+#include "rb.h"
+
+
+#include "stream_types_vorbis.h"
+#include "stream_types_speex.h"
+
+
+typedef enum ImportStates {
+	kStateInitial,
+	kStateGettingSize,
+	kStateReadingPages,
+	kStateReadingLastPages,
+	kStateImportComplete
+} ImportStates;
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//			types
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+// Keep your data long word aligned for best performance
+
+struct stream_format_handle_funcs; //forward declaration
+
+typedef struct {
+    long                serialno;
+    TimeValue           timeLoaded;
+	
+	ogg_stream_state	os;
+	
+    int                 numChannels;
+    int                 rate;
+    Handle              soundDescExtension;
+	
+    Track               theTrack;
+    Media               theMedia;
+    SampleDescriptionHandle sampleDesc;
+    
+    ogg_int64_t         lastGranulePos;
+    SInt64              prevPageOffset;
+    
+    ogg_int64_t         lastSeenGranulePos;
+    SInt64              lastSeenEndOffset;
+    
+    TimeValue           startTime;
+    
+	CFDictionaryRef		MDmapping;
+	CFDictionaryRef		UDmapping;
+    
+    struct stream_format_handle_funcs *sfhf;
+
+    union {
+#if defined(_HAVE__VORBIS_SUPPORT)
+        StreamInfo__vorbis si_vorbis;
+#endif
+#if defined(_HAVE__SPEEX_SUPPORT)
+        StreamInfo__speex si_speex;
+#endif
+    };
+
+} StreamInfo, *StreamInfoPtr;
+
+
+typedef struct {
+    ComponentInstance	    self;
+    
+    Movie               theMovie;
+    Handle              dataRef;
+    long                dataRefType;
+    Boolean             dataIsStream;
+    Boolean             usingIdle;
+    int                 chunkSize;
+    TimeValue           startTime;
+    
+    ImportStates            state;
+    ComponentResult         errEncountered;
+    
+    SInt64                  dataStartOffset;
+    SInt64                  dataEndOffset;
+    
+    IdleManager             idleManager;
+    IdleManager             dataIdleManager;
+    
+    long                    newMovieFlags;
+    
+    ComponentInstance	    dataReader;
+    
+    DataHCompletionUPP	    dataReadCompletion;
+    DataHCompletionUPP	    fileSizeCompletion;
+    
+    wide                    wideTempforFileSize;
+    
+    int	                    dataReadChunkSize;
+    
+    Boolean                 dataCanDoAsyncRead;
+    Boolean                 dataCanDoGetFileSizeAsync;
+    Boolean                 dataCanDoGetFileSize64;
+    
+    Boolean                 blocking;
+    AliasHandle             aliasHandle;
+    
+    ComponentResult         readError;
+    
+    /* information about the data buffer */
+    Ptr                     dataBuffer;
+    int                     maxDataBufferSize;
+    SInt64                  dataOffset;
+    unsigned char           *validDataEnd;
+    unsigned char           *currentData;
+    
+	ring_buffer				dataRB;
+    
+    int                     numTracksStarted;
+    int                     numTracksSeen;		// completed tracks
+    Track                   firstTrack;
+    
+    TimeValue               timeLoaded;
+    
+	unsigned long           startTickCount;
+    
+    //    Track                   ghostTrack;
+    
+    int                     streamCount;
+    StreamInfo              **streamInfoHandle;
+    
+	Boolean					dataRequested;
+	Boolean					sizeInitialised;
+
+} OggImportGlobals, *OggImportGlobalsPtr;
+
+
+typedef int (*recognize_header) (ogg_page *op);
+typedef int (*verify_header) (ogg_page *op);
+
+typedef int (*initialize_stream) (StreamInfo *si);
+typedef void (*clear_stream) (StreamInfo *si);
+typedef ComponentResult (*create_sample_description) (StreamInfo *si);
+
+typedef int (*process_first_packet) (StreamInfo *si, ogg_page *op, ogg_packet *opckt);
+typedef ComponentResult (*process_stream_page) (OggImportGlobals *globals, StreamInfo *si, ogg_page *opg);
+
+
+typedef struct stream_format_handle_funcs {
+    process_stream_page			process_page;
+
+    recognize_header			recognize;
+    verify_header				verify;
+    
+    process_first_packet		first_packet;
+    create_sample_description	sample_description;
+
+    initialize_stream			initialize;
+    clear_stream				clear;
+} stream_format_handle_funcs;
+
+#define HANDLE_FUNCTIONS__NULL { NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+
+#endif /* __importer_types_h__ */
\ No newline at end of file


Property changes on: trunk/xiph-qt/OggImport/src/importer_types.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/rb.c
===================================================================
--- trunk/xiph-qt/OggImport/src/rb.c	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/rb.c	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,173 @@
+/*
+ *  rb.c
+ *
+ *    Simple, boring ring buffer implementation.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include <Carbon/Carbon.h>
+#include "rb.h"
+
+
+OSErr rb_init(ring_buffer *rb, long size) {
+	OSErr ret = noErr;
+	
+	if (!rb->buffer) {
+		rb->buffer = (unsigned char *) NewPtr(2 * size);
+		ret = MemError();
+		
+		if (ret == noErr) {
+			rb->b_start = rb->buffer;
+			rb->b_end = rb->buffer;
+			rb->b_reserved = rb->buffer;
+			rb->b_size = size;
+			rb->b_real_size = 2 * size;
+		}
+	}
+	
+	return ret;
+}
+
+void rb_free(ring_buffer *rb) {
+	DisposePtr((Ptr) rb->buffer);
+	rb->buffer = NULL;
+	
+	rb->b_size = 0;
+	rb->b_real_size = 0;
+	rb->b_start = NULL;
+	rb->b_end = NULL;
+	rb->b_reserved = NULL;
+}
+
+void rb_reset(ring_buffer *rb) {
+	rb->b_start = rb->buffer;
+	rb->b_end = rb->buffer;
+	rb->b_reserved = rb->buffer;
+}
+
+long rb_data_available(ring_buffer *rb) {
+	long ret = 0;
+	
+	if (rb->b_start < rb->b_end)
+		ret = (long) (rb->b_end - rb->b_start);
+	else if (rb->b_end < rb->b_start)
+		ret = (long) (rb->b_end) + rb->b_size - (long) (rb->b_start);
+
+	return ret;
+}
+
+long rb_space_available(ring_buffer *rb) {
+	long ret = rb->b_size;
+	
+	if (rb->b_end < rb->b_start)
+		ret = (long) (rb->b_start - rb->b_end);
+	else if (rb->b_start < rb->b_end)
+		ret = (long) (rb->b_start) + rb->b_size - (long) (rb->b_end);
+	
+	return ret;
+}
+
+int rb_in(ring_buffer *rb, unsigned char *src, long size) {
+	if (size > rb->b_size - rb_data_available(rb))
+		return 0;
+	
+	if ((long) rb->b_end - (long) rb->buffer + size <= rb->b_size) {
+		BlockMoveData(src, rb->b_end, size);
+		rb->b_end += size;
+	} else {
+		long wrapped_size = rb->b_size - ((long) rb->b_end - (long) rb->buffer);
+		BlockMoveData(src, rb->b_end, wrapped_size);
+		
+		BlockMoveData(src + wrapped_size, rb->buffer, size - wrapped_size);
+		rb->b_end = rb->buffer + (size - wrapped_size);		
+	}
+	
+	rb->b_reserved = rb->b_end;
+	return 1;
+}
+
+void rb_zap(ring_buffer *rb, long size) {
+	if (size >= rb_data_available(rb))
+		//rb_reset(rb);
+		rb->b_start = rb->b_end;
+	else {
+		if (rb->b_start < rb->b_end || rb->b_start + size < rb->buffer + rb->b_size)
+			rb->b_start = rb->b_start + size;
+		else
+			rb->b_start = rb->b_start + size - rb->b_size;
+	}
+}
+
+void* rb_data(ring_buffer *rb) {
+	long available = rb_data_available(rb);
+	
+	if (available == 0)
+		return rb->buffer;
+	else {
+		if (rb->b_start > rb->b_end) {
+			// OK, here we're taking advange of the facts that the real buffer size
+			// is twice as long as the official size; so we can copy wrapped tail of
+			// the buffer at the end of the (official size) buffer, and return pointer
+			// to a continuous block of data... is that OK?
+			BlockMoveData(rb->buffer, rb->buffer + rb->b_size, (long) (rb->b_end - rb->buffer));
+		}
+		return rb->b_start;
+	}
+	
+}
+
+void* rb_reserve(ring_buffer *rb, long size) {
+	long available = rb_space_available(rb);
+	
+	if (size == 0) {
+		rb->b_reserved = rb->b_end;
+		return NULL;
+	}
+
+	if (available == 0 || size > available)
+		return NULL;
+
+	if (rb->b_end <= rb->b_start) {
+		// size is smaller then available space, so reserved end should be still before the start
+		rb->b_reserved = rb->b_end + size;
+		return rb->b_end;
+	} else if (rb->b_end + size <= rb->buffer + rb->b_size) {
+		rb->b_reserved = rb->b_end + size;
+		return rb->b_end;
+	} else {
+		rb->b_reserved = rb->b_end + size;
+		return rb->b_end; // :D
+	}
+}
+
+void rb_sync_reserved(ring_buffer *rb) {
+	if (rb->b_reserved > rb->buffer + rb->b_size) {
+		BlockMoveData(rb->buffer + rb->b_size, rb->buffer, rb->b_reserved - rb->buffer - rb->b_size);
+		rb->b_reserved = rb->b_reserved - rb->b_size;
+	}
+
+	rb->b_end = rb->b_reserved;
+}


Property changes on: trunk/xiph-qt/OggImport/src/rb.c
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/rb.h
===================================================================
--- trunk/xiph-qt/OggImport/src/rb.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/rb.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,69 @@
+/*
+ *  rb.h
+ *
+ *    Simple ring buffer implementation - header file.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__rb_h__)
+#define __rb_h__
+
+
+#include <Carbon/Carbon.h>
+
+typedef struct {
+	unsigned char	*buffer;
+	unsigned char	*b_start;
+	unsigned char	*b_end;
+	unsigned char   *b_reserved;
+	
+	long			b_size;
+	long			b_real_size;
+} ring_buffer;
+
+
+extern OSErr rb_init(ring_buffer *rb, long size);
+
+extern void  rb_free(ring_buffer *rb);
+
+extern void  rb_reset(ring_buffer *rb);
+
+extern long  rb_data_available(ring_buffer *rb);
+
+extern long  rb_space_available(ring_buffer *rb);
+
+extern int   rb_in(ring_buffer *rb, unsigned char *src, long size);
+
+extern void  rb_zap(ring_buffer *rb, long size);
+
+extern void* rb_data(ring_buffer *rb);
+
+extern void* rb_reserve(ring_buffer *rb, long size);
+
+extern void rb_sync_reserved(ring_buffer *rb);
+
+
+#endif /* __rb_h__ */


Property changes on: trunk/xiph-qt/OggImport/src/rb.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/stream_speex.c
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_speex.c	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/stream_speex.c	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,293 @@
+/*
+ *  stream_speex.c
+ *
+ *    Speex format related part of OggImporter.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include <Ogg/ogg.h>
+
+#include "stream_speex.h"
+
+#include "debug.h"
+
+#include "OggImport.h"
+
+#include "fccs.h"
+#include "data_types.h"
+
+
+int recognize_header__speex(ogg_page *op)
+{
+    if (!strncmp("Speex   ", (char *)op->body, 8))
+        return 0;
+
+    return 1;
+};
+
+int verify_header__speex(ogg_page *op) //?
+{
+    return 0;
+};
+
+int initialize_stream__speex(StreamInfo *si)
+{
+    memset(&si->si_speex.header, 0, sizeof(SpeexHeader));
+    vorbis_comment_init(&si->si_speex.vc);
+    
+    si->si_speex.skipped_headers = 0;
+    si->si_speex.state = kSStateInitial;
+
+    return 0;
+};
+
+void clear_stream__speex(StreamInfo *si)
+{
+	vorbis_comment_clear(&si->si_speex.vc);
+};
+
+ComponentResult create_sample_description__speex(StreamInfo *si)
+{
+    ComponentResult err = noErr;
+    Handle	desc = NewHandleClear(sizeof(SoundDescriptionV1));
+	
+    if (desc != NULL)
+    {
+        SoundDescriptionV1Ptr	snd = (SoundDescriptionV1Ptr)*desc;
+        
+        snd->desc.descSize = sizeof(SoundDescriptionV1);
+        snd->desc.dataFormat = kAudioFormatXiphOggFramedSpeex;
+        snd->desc.dataRefIndex = 1;
+        snd->desc.version = 1;   //@@@@ use the version from the stream????
+        snd->desc.revlevel = 0;
+        snd->desc.vendor = kSoundComponentManufacturer;
+        snd->desc.numChannels = si->numChannels;
+        snd->desc.compressionID = variableCompression;
+        snd->desc.sampleSize = 16;
+        snd->desc.sampleRate = ((unsigned)si->rate) << 16;
+		
+		snd->samplesPerPacket = 0;
+		snd->bytesPerSample = 2;
+		snd->bytesPerFrame = 0;
+		snd->bytesPerPacket = 0;
+        
+		si->sampleDesc = (SampleDescriptionHandle)desc;
+    } else
+        err = MemError();
+	
+    return err;
+};
+
+int process_first_packet__speex(StreamInfo *si, ogg_page *op, ogg_packet *opckt)
+{
+    unsigned long serialnoatom[3] = { EndianU32_NtoB(sizeof(serialnoatom)), EndianU32_NtoB(kCookieTypeOggSerialNo),
+        EndianS32_NtoB(ogg_page_serialno(op)) };
+    unsigned long atomhead[2] = { EndianU32_NtoB(opckt->bytes + sizeof(atomhead)), EndianU32_NtoB(kCookieTypeSpeexHeader) };
+    SpeexHeader *inheader = (SpeexHeader *) opckt->packet;
+    //vorbis_synthesis_headerin(&si->si_vorbis.vi, &si->si_vorbis.vc, opckt); //check errors?
+    
+    si->si_speex.header.bitrate					= EndianS32_LtoN(inheader->bitrate);
+    si->si_speex.header.extra_headers			= EndianS32_LtoN(inheader->extra_headers);
+    si->si_speex.header.frame_size				= EndianS32_LtoN(inheader->frame_size);
+    si->si_speex.header.frames_per_packet		= EndianS32_LtoN(inheader->frames_per_packet);
+    si->si_speex.header.header_size				= EndianS32_LtoN(inheader->header_size);
+    si->si_speex.header.mode					= EndianS32_LtoN(inheader->mode);
+    si->si_speex.header.mode_bitstream_version	= EndianS32_LtoN(inheader->mode_bitstream_version);
+    si->si_speex.header.nb_channels				= EndianS32_LtoN(inheader->nb_channels);
+    si->si_speex.header.rate					= EndianS32_LtoN(inheader->rate);
+    si->si_speex.header.reserved1				= EndianS32_LtoN(inheader->reserved1);
+    si->si_speex.header.reserved2				= EndianS32_LtoN(inheader->reserved2);
+    si->si_speex.header.speex_version_id		= EndianS32_LtoN(inheader->speex_version_id);
+    si->si_speex.header.vbr						= EndianS32_LtoN(inheader->vbr);
+    //si->si_speex.header. = EndianS32_LtoN(inheader->);
+
+    dprintf("! -- - speex_first_packet: ch: %d, rate: %ld\n", si->si_speex.header.nb_channels, si->si_speex.header.rate);
+    si->numChannels = si->si_speex.header.nb_channels;
+    si->rate = si->si_speex.header.rate;
+
+    PtrAndHand(serialnoatom, si->soundDescExtension, sizeof(serialnoatom)); //check errors?
+    PtrAndHand(atomhead, si->soundDescExtension, sizeof(atomhead)); //check errors?
+    PtrAndHand(opckt->packet, si->soundDescExtension, opckt->bytes); //check errors?
+
+    si->si_speex.state = kSStateReadingComments;
+
+    return 0;
+};
+
+ComponentResult process_stream_page__speex(OggImportGlobals *globals, StreamInfo *si, ogg_page *opg)
+{
+	ComponentResult ret = noErr;
+	int ovret = 0;
+	Boolean loop = true;
+	Boolean movie_changed = false;
+    
+	ogg_packet op;
+	
+	switch(si->si_speex.state) {
+		case kSStateReadingComments:
+		case kSStateReadingAdditionalHeaders:
+			ogg_stream_pagein(&si->os, opg);
+			break;
+		default:
+			break;
+	}
+    
+	do {
+		switch(si->si_speex.state) {
+			case kSStateReadingComments:
+				ovret = ogg_stream_packetout(&si->os, &op);
+				if (ovret < 0) {
+					loop = false;
+					ret = invalidMedia;
+				} else if (ovret < 1) {
+					loop = false;
+				} else {
+                    unsigned long atomhead[2] = { EndianU32_NtoB(op.bytes + sizeof(atomhead)), EndianU32_NtoB(kCookieTypeSpeexComments) };
+
+                    PtrAndHand(atomhead, si->soundDescExtension, sizeof(atomhead));
+					PtrAndHand(op.packet, si->soundDescExtension, op.bytes);
+                    //vorbis_synthesis_headerin(&si->si_vorbis.vi, &si->si_vorbis.vc, &op);
+                    
+					ret = CreateTrackAndMedia(globals, si, opg);
+					if (ret != noErr) {
+						dprintf("??? -- CreateTrackAndMedia failed?: %ld\n", (long)ret);
+					}
+                    
+					// /*err =*/ DecodeCommentsQT(globals, si, &si->si_vorbis.vc);
+					//NotifyMovieChanged(globals);
+                    
+					si->si_speex.state = kSStateReadingAdditionalHeaders;
+				}
+
+                break;
+
+            case kSStateReadingAdditionalHeaders:
+                if (si->si_speex.skipped_headers >= si->si_speex.header.extra_headers) {
+                    unsigned long endAtom[2] = { EndianU32_NtoB(sizeof(endAtom)), EndianU32_NtoB(kAudioTerminatorAtomType) };
+                    
+                    ret = PtrAndHand(endAtom, si->soundDescExtension, sizeof(endAtom));
+                    if (ret == noErr) {
+                        ret = AddSoundDescriptionExtension((SoundDescriptionHandle) si->sampleDesc,
+                                                           si->soundDescExtension, siDecompressionParams);
+                        //dprintf("??? -- Adding extension: %ld\n", ret);
+                    } else {
+                        //dprintf("??? -- Hmm, something went wrong: %ld\n", ret);
+                    }
+                    
+					si->startTime = 0;
+					si->prevPageOffset = S64Add(globals->dataOffset, opg->header_len + opg->body_len);
+
+                    si->si_speex.state = kSStateReadingFirstPacket;
+
+                    loop = false; // ??!
+                    break;
+                }
+
+                ovret = ogg_stream_packetout(&si->os, &op);
+                if (ovret < 0) {
+                    loop = false;
+                    ret = invalidMedia;
+                } else if (ovret < 1) {
+                    loop = false;
+                } else {
+                    // not much here so far, basically just skip the extra header packet
+                    unsigned long atomhead[2] = { EndianU32_NtoB(op.bytes + sizeof(atomhead)), EndianU32_NtoB(kCookieTypeSpeexExtraHeader) };
+                    PtrAndHand(atomhead, si->soundDescExtension, sizeof(atomhead));
+					PtrAndHand(op.packet, si->soundDescExtension, op.bytes);
+                    
+                    si->si_speex.skipped_headers += 1;
+                }
+
+                break;
+
+			case kSStateReadingFirstPacket:
+				if (ogg_page_pageno(opg) > 2) {
+					si->lastGranulePos = ogg_page_granulepos(opg);
+					si->prevPageOffset = S64Add(globals->dataOffset, opg->header_len + opg->body_len);
+					dprintf("----==< skipping: %llx, %lx\n", si->lastGranulePos, ogg_page_pageno(opg));
+					loop = false;
+                    
+					if (si->lastGranulePos < 0)
+						si->lastGranulePos = 0;
+				}
+				si->si_speex.state = kSStateReadingPackets;
+				break;
+                
+			case kVStateReadingPackets:
+			    {
+                    ogg_int64_t	pos 	  = ogg_page_granulepos(opg);
+                    SInt64      endOffset = S64Add(globals->dataOffset, opg->header_len + opg->body_len);
+                    int         len 	  = S64Subtract(endOffset, si->prevPageOffset);
+                    int         duration  = pos - si->lastGranulePos;
+                    TimeValue	inserted  = 0;
+				
+                    if (pos < 0) {
+                        //dprintf("   -   :XX: not added page %ld (single, looooong packet)\n", ogg_page_pageno(opg));
+                    } else {
+                        dprintf("   -   :++: adding sampleRef: %lld, len: %d, dur: %d\n", si->prevPageOffset, len, duration);
+                        ret = AddMediaSampleReference(si->theMedia, si->prevPageOffset,
+                                                      len, duration, si->sampleDesc, 1, 0, &inserted); //@@@@ 64-bit enable
+                        if (ret == noErr) {
+                            dprintf("   -   :><: added page %04ld at %14ld (size: %5ld, tsize: %6d), f: %d\n",
+                                    ogg_page_pageno(opg), inserted,
+                                    opg->header_len + opg->body_len, len, !logg_page_last_packet_incomplete(opg));
+                            dprintf("   -   :/>: inserting media: %ld, mt: %lld, dur: %d\n", si->startTime, si->lastGranulePos, duration);
+                            ret = InsertMediaIntoTrack(si->theTrack, si->startTime /*inserted*/, /* si->lastGranulePos */ inserted, 
+                                                       duration, fixed1);
+                            si->startTime = -1;
+                            si->timeLoaded = GetTrackOffset(si->theTrack) + GetTrackDuration(si->theTrack);
+                            //if (globals->dataIsStream)
+                            //	si->timeLoaded = (duration + inserted) * GetMovieTimeScale(globals->theMovie) / GetMediaTimeScale(si->theMedia);
+                            
+                            dprintf("   -   :><: added page %04ld at %14ld; offset: %ld, duration: %ld (%ld, %ld), mediats: %ld; moviets: %ld, ret = %ld\n",
+                                    ogg_page_pageno(opg), inserted,
+                                    GetTrackOffset(si->theTrack), GetTrackDuration(si->theTrack), si->timeLoaded,
+                                    (duration * GetMovieTimeScale(globals->theMovie)) / GetMediaTimeScale(si->theMedia),
+                                    GetMediaTimeScale(si->theMedia), GetMovieTimeScale(globals->theMovie), ret);
+                            if (globals->timeLoaded < si->timeLoaded)
+                                globals->timeLoaded = si->timeLoaded;
+                            
+                            movie_changed = true;
+                        }
+                        
+                        si->prevPageOffset = endOffset;
+                        si->lastGranulePos = pos;
+                    }
+                }
+				loop = false;
+				break;
+                
+			default:
+				loop = false;
+		}
+	} while(loop);
+    
+	if (movie_changed)
+		NotifyMovieChanged(globals);
+    
+	return ret;
+};
+


Property changes on: trunk/xiph-qt/OggImport/src/stream_speex.c
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/stream_speex.h
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_speex.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/stream_speex.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,54 @@
+/*
+ *  stream_speex.h
+ *
+ *    Declaration of Speex format related functions of OggImporter.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__stream_speex_h__)
+#define __stream_speex_h__
+
+#include <Ogg/ogg.h>
+#include <Speex/speex.h>
+
+#include "importer_types.h"
+
+extern int recognize_header__speex(ogg_page *op);
+extern int verify_header__speex(ogg_page *op);
+
+extern int initialize_stream__speex(StreamInfo *si);
+extern void clear_stream__speex(StreamInfo *si);
+extern ComponentResult create_sample_description__speex(StreamInfo *si);
+
+extern int process_first_packet__speex(StreamInfo *si, ogg_page *op, ogg_packet *opckt);
+extern ComponentResult process_stream_page__speex(OggImportGlobals *globals, StreamInfo *si, ogg_page *opg);
+
+#define HANDLE_FUNCTIONS__SPEEX { &process_stream_page__speex, &recognize_header__speex, \
+    &verify_header__speex, &process_first_packet__speex, &create_sample_description__speex, \
+    &initialize_stream__speex, &clear_stream__speex }
+
+
+#endif /* __stream_vorbis_h__ */


Property changes on: trunk/xiph-qt/OggImport/src/stream_speex.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/stream_types_speex.h
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_types_speex.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/stream_types_speex.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,59 @@
+/*
+ *  stream_types_speex.h
+ *
+ *    Definition of Speex specific data structures.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__stream_types_speex_h__)
+#define __stream_types_speex_h__
+
+
+#include <Speex/speex.h>
+#include <Speex/speex_header.h>
+
+typedef enum SpeexImportStates {
+	kSStateInitial,
+	kSStateReadingComments,
+	kSStateReadingAdditionalHeaders,
+	kSStateReadingFirstPacket,
+    kSStateReadingPackets
+} SpeexImportStates;
+
+typedef struct {
+	SpeexImportStates	state;
+    
+    UInt32				skipped_headers;
+	SpeexHeader			header;
+	vorbis_comment		vc;
+} StreamInfo__speex;
+
+
+
+
+#define _HAVE__SPEEX_SUPPORT 1
+
+#endif /* __stream_types_speex_h__ */
\ No newline at end of file


Property changes on: trunk/xiph-qt/OggImport/src/stream_types_speex.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/stream_types_vorbis.h
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_types_vorbis.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/stream_types_vorbis.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,58 @@
+/*
+ *  stream_types_vorbis.h
+ *
+ *    Definition of Vorbis specific data structures.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__stream_types_vorbis_h__)
+#define __stream_types_vorbis_h__
+
+
+#include <Vorbis/codec.h>
+
+typedef enum VorbisImportStates {
+	kVStateInitial,
+	kVStateReadingComments,
+	kVStateReadingCodebooks,
+	kVStateReadingFirstPacket,
+	//kVStateSeekingLastPacket,
+    kVStateReadingPackets
+} VorbisImportStates;
+
+typedef struct {
+	VorbisImportStates	state;
+    
+	vorbis_info			vi;
+	vorbis_comment		vc;
+} StreamInfo__vorbis;
+
+
+
+
+#define _HAVE__VORBIS_SUPPORT 1
+
+#endif /* __stream_types_vorbis_h__ */
\ No newline at end of file


Property changes on: trunk/xiph-qt/OggImport/src/stream_types_vorbis.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/stream_vorbis.c
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_vorbis.c	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/stream_vorbis.c	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,295 @@
+/*
+ *  stream_vorbis.c
+ *
+ *    Vorbis format related part of OggImporter.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "stream_vorbis.h"
+
+#include "debug.h"
+
+#include "OggImport.h"
+
+#include "fccs.h"
+#include "data_types.h"
+
+
+int recognize_header__vorbis(ogg_page *op)
+{
+    if (!strncmp("\1vorbis", (char *)op->body, 7))
+        return 0;
+
+    return 1;
+};
+
+int verify_header__vorbis(ogg_page *op) //?
+{
+    OSErr			 err = noErr;
+    
+	ogg_stream_state os;
+	ogg_packet       opk;
+    
+	vorbis_info      vi;
+	vorbis_comment   vc;
+    
+	ogg_stream_init(&os, ogg_page_serialno(op));
+    
+    vorbis_info_init(&vi);
+    vorbis_comment_init(&vc);
+    
+	if (ogg_stream_pagein(&os, op) < 0)
+		err = invalidMedia;
+	else if (ogg_stream_packetout(&os, &opk) != 1)
+		err = invalidMedia;
+	else if (vorbis_synthesis_headerin(&vi, &vc, &opk) < 0)
+		err = noSoundTrackInMovieErr;
+	
+	ogg_stream_clear(&os);
+    
+    vorbis_comment_clear(&vc);
+    vorbis_info_clear(&vi);
+    
+    return err;
+};
+
+int initialize_stream__vorbis(StreamInfo *si)
+{
+    vorbis_info_init(&si->si_vorbis.vi);
+    vorbis_comment_init(&si->si_vorbis.vc);
+    
+    si->si_vorbis.state = kVStateInitial;
+
+    return 0;
+};
+
+void clear_stream__vorbis(StreamInfo *si)
+{
+	vorbis_info_clear(&si->si_vorbis.vi);
+	vorbis_comment_clear(&si->si_vorbis.vc);
+};
+
+ComponentResult create_sample_description__vorbis(StreamInfo *si)
+{
+    ComponentResult err = noErr;
+    Handle	desc = NewHandleClear(sizeof(SoundDescriptionV1));
+	
+    if (desc != NULL)
+    {
+        SoundDescriptionV1Ptr	snd = (SoundDescriptionV1Ptr)*desc;
+        
+        snd->desc.descSize = sizeof(SoundDescriptionV1);
+        snd->desc.dataFormat = kAudioFormatXiphOggFramedVorbis;
+        snd->desc.dataRefIndex = 1;
+        snd->desc.version = 1;   //@@@@ use the version from the stream????
+        snd->desc.revlevel = 0;
+        snd->desc.vendor = kSoundComponentManufacturer;
+        snd->desc.numChannels = si->numChannels;
+        snd->desc.compressionID = variableCompression;
+        snd->desc.sampleSize = 16;
+        snd->desc.sampleRate = ((unsigned)si->rate) << 16;
+		
+		snd->samplesPerPacket = 0;
+		snd->bytesPerSample = 2;
+		snd->bytesPerFrame = 0;
+		snd->bytesPerPacket = 0;
+        
+		si->sampleDesc = (SampleDescriptionHandle)desc;
+    } else
+        err = MemError();
+	
+    return err;
+};
+
+int process_first_packet__vorbis(StreamInfo *si, ogg_page *op, ogg_packet *opckt)
+{
+    unsigned long serialnoatom[3] = { EndianU32_NtoB(sizeof(serialnoatom)), EndianU32_NtoB(kCookieTypeOggSerialNo),
+        EndianS32_NtoB(ogg_page_serialno(op)) };
+    unsigned long atomhead[2] = { EndianU32_NtoB(opckt->bytes + sizeof(atomhead)), EndianU32_NtoB(kCookieTypeVorbisHeader) };
+
+    vorbis_synthesis_headerin(&si->si_vorbis.vi, &si->si_vorbis.vc, opckt); //check errors?
+    
+    si->numChannels = si->si_vorbis.vi.channels;
+    si->rate = si->si_vorbis.vi.rate;
+
+    PtrAndHand(serialnoatom, si->soundDescExtension, sizeof(serialnoatom)); //check errors?
+    PtrAndHand(atomhead, si->soundDescExtension, sizeof(atomhead)); //check errors?
+    PtrAndHand(opckt->packet, si->soundDescExtension, opckt->bytes); //check errors?
+
+    si->si_vorbis.state = kVStateReadingComments;
+
+    return 0;
+};
+
+ComponentResult process_stream_page__vorbis(OggImportGlobals *globals, StreamInfo *si, ogg_page *opg)
+{
+	ComponentResult ret = noErr;
+	int ovret = 0;
+	Boolean loop = true;
+	Boolean movie_changed = false;
+    
+	ogg_packet op;
+	
+	switch(si->si_vorbis.state) {
+		case kVStateReadingComments:
+		case kVStateReadingCodebooks:
+			ogg_stream_pagein(&si->os, opg);
+			break;
+		default:
+			break;
+	}
+    
+	do {
+		switch(si->si_vorbis.state) {
+			case kVStateReadingComments:
+				ovret = ogg_stream_packetout(&si->os, &op);
+				if (ovret < 0) {
+					loop = false;
+					ret = invalidMedia;
+				} else if (ovret < 1) {
+					loop = false;
+				} else {
+                    unsigned long atomhead[2] = { EndianU32_NtoB(op.bytes + sizeof(atomhead)), EndianU32_NtoB(kCookieTypeVorbisComments) };
+
+                    PtrAndHand(atomhead, si->soundDescExtension, sizeof(atomhead));
+					PtrAndHand(op.packet, si->soundDescExtension, op.bytes);
+					vorbis_synthesis_headerin(&si->si_vorbis.vi, &si->si_vorbis.vc, &op);
+                    
+					ret = CreateTrackAndMedia(globals, si, opg);
+					if (ret != noErr) {
+						dprintf("??? -- CreateTrackAndMedia failed?: %ld\n", (long)ret);
+					}
+                    
+					/*err =*/ DecodeCommentsQT(globals, si, &si->si_vorbis.vc);
+					//NotifyMovieChanged(globals);
+                    
+					si->si_vorbis.state = kVStateReadingCodebooks;
+				}
+                    break;
+                
+			case kVStateReadingCodebooks:
+				ovret = ogg_stream_packetout(&si->os, &op);
+				if (ovret < 0) {
+					loop = false;
+					ret = invalidMedia;
+				} else if (ovret < 1) {
+					loop = false;
+				} else {
+                    unsigned long atomhead[2] = { EndianU32_NtoB(op.bytes + sizeof(atomhead)), EndianU32_NtoB(kCookieTypeVorbisCodebooks) };
+                    PtrAndHand(atomhead, si->soundDescExtension, sizeof(atomhead));
+					PtrAndHand(op.packet, si->soundDescExtension, op.bytes);
+                    
+					vorbis_synthesis_headerin(&si->si_vorbis.vi, &si->si_vorbis.vc, &op);
+					{
+						unsigned long endAtom[2] = { EndianU32_NtoB(sizeof(endAtom)), EndianU32_NtoB(kAudioTerminatorAtomType) };
+                        
+						ret = PtrAndHand(endAtom, si->soundDescExtension, sizeof(endAtom));
+						if (ret == noErr) {
+							ret = AddSoundDescriptionExtension((SoundDescriptionHandle) si->sampleDesc,
+															   si->soundDescExtension, siDecompressionParams);
+							//dprintf("??? -- Adding extension: %ld\n", ret);
+						} else {
+							//dprintf("??? -- Hmm, something went wrong: %ld\n", ret);
+						}
+					}
+                    
+					si->si_vorbis.state = kVStateReadingFirstPacket;
+					si->startTime = 0;
+					si->prevPageOffset = S64Add(globals->dataOffset, opg->header_len + opg->body_len);
+					loop = false; //there should be an end of page here according to specs...
+				}
+                    break;
+                
+			case kVStateReadingFirstPacket:
+				if (ogg_page_pageno(opg) > 3) {
+					si->lastGranulePos = ogg_page_granulepos(opg);
+					si->prevPageOffset = S64Add(globals->dataOffset, opg->header_len + opg->body_len);
+					dprintf("----==< skipping: %llx, %lx\n", si->lastGranulePos, ogg_page_pageno(opg));
+					loop = false;
+                    
+					if (si->lastGranulePos < 0)
+						si->lastGranulePos = 0;
+				}
+				si->si_vorbis.state = kVStateReadingPackets;
+				break;
+                
+			case kVStateReadingPackets:
+			{
+				ogg_int64_t	pos 	  = ogg_page_granulepos(opg);
+				SInt64      endOffset = S64Add(globals->dataOffset, opg->header_len + opg->body_len);
+				int         len 	  = S64Subtract(endOffset, si->prevPageOffset);
+				int         duration  = pos - si->lastGranulePos;
+				TimeValue	inserted  = 0;
+				
+				if (pos < 0) {
+					//dprintf("   -   :XX: not added page %ld (single, looooong packet)\n", ogg_page_pageno(opg));
+				} else {
+					dprintf("   -   :++: adding sampleRef: %lld, len: %d, dur: %d\n", si->prevPageOffset, len, duration);
+					ret = AddMediaSampleReference(si->theMedia, si->prevPageOffset,
+                                                  len, duration, si->sampleDesc, 1, 0, &inserted); //@@@@ 64-bit enable
+					if (ret == noErr)
+					{
+						dprintf("   -   :><: added page %04ld at %14ld (size: %5ld, tsize: %6d), f: %d\n",
+								ogg_page_pageno(opg), inserted,
+								opg->header_len + opg->body_len, len, !logg_page_last_packet_incomplete(opg));
+						dprintf("   -   :/>: inserting media: %ld, mt: %lld, dur: %d\n", si->startTime, si->lastGranulePos, duration);
+						ret = InsertMediaIntoTrack(si->theTrack, si->startTime /*inserted*/, /* si->lastGranulePos */ inserted, 
+                                                   duration, fixed1);
+						si->startTime = -1;
+						si->timeLoaded = GetTrackOffset(si->theTrack) + GetTrackDuration(si->theTrack);
+						//if (globals->dataIsStream)
+						//	si->timeLoaded = (duration + inserted) * GetMovieTimeScale(globals->theMovie) / GetMediaTimeScale(si->theMedia);
+						
+						dprintf("   -   :><: added page %04ld at %14ld; offset: %ld, duration: %ld (%ld, %ld), mediats: %ld; moviets: %ld, ret = %ld\n",
+								ogg_page_pageno(opg), inserted,
+								GetTrackOffset(si->theTrack), GetTrackDuration(si->theTrack), si->timeLoaded,
+								(duration * GetMovieTimeScale(globals->theMovie)) / GetMediaTimeScale(si->theMedia),
+								GetMediaTimeScale(si->theMedia), GetMovieTimeScale(globals->theMovie), ret);
+						if (globals->timeLoaded < si->timeLoaded)
+							globals->timeLoaded = si->timeLoaded;
+                        
+						movie_changed = true;
+                        
+					}
+					
+					si->prevPageOffset = endOffset;
+					si->lastGranulePos = pos;
+				}
+			}
+				loop = false;
+				break;
+                
+			default:
+				loop = false;
+		}
+	} while(loop);
+    
+	if (movie_changed)
+		NotifyMovieChanged(globals);
+    
+	return ret;
+};
+


Property changes on: trunk/xiph-qt/OggImport/src/stream_vorbis.c
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/stream_vorbis.h
===================================================================
--- trunk/xiph-qt/OggImport/src/stream_vorbis.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/stream_vorbis.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,54 @@
+/*
+ *  stream_vorbis.h
+ *
+ *    Declaration of Vorbis format related functions of OggImporter.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__stream_vorbis_h__)
+#define __stream_vorbis_h__
+
+#include <Ogg/ogg.h>
+#include <Vorbis/codec.h>
+
+#include "importer_types.h"
+
+extern int recognize_header__vorbis(ogg_page *op);
+extern int verify_header__vorbis(ogg_page *op); //?
+
+extern int initialize_stream__vorbis(StreamInfo *si);
+extern void clear_stream__vorbis(StreamInfo *si);
+extern ComponentResult create_sample_description__vorbis(StreamInfo *si);
+
+extern int process_first_packet__vorbis(StreamInfo *si, ogg_page *op, ogg_packet *opckt);
+extern ComponentResult process_stream_page__vorbis(OggImportGlobals *globals, StreamInfo *si, ogg_page *opg);
+
+#define HANDLE_FUNCTIONS__VORBIS { &process_stream_page__vorbis, &recognize_header__vorbis, \
+    &verify_header__vorbis, &process_first_packet__vorbis, &create_sample_description__vorbis, \
+    &initialize_stream__vorbis, &clear_stream__vorbis }
+
+
+#endif /* __stream_vorbis_h__ */


Property changes on: trunk/xiph-qt/OggImport/src/stream_vorbis.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/OggImport/src/versions.h
===================================================================
--- trunk/xiph-qt/OggImport/src/versions.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/OggImport/src/versions.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,40 @@
+/*
+ *  versions.h
+ *
+ *    The current version of the OggImport component.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__versions_h__)
+#define __versions_h__
+
+#ifdef DEBUG
+#define kOgg_eat__Version		(0x00FF0101)
+#else
+#define kOgg_eat__Version		(0x00000101)
+#endif /* DEBUG */
+
+#endif /* __versions_h__ */


Property changes on: trunk/xiph-qt/OggImport/src/versions.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/README
===================================================================
--- trunk/xiph-qt/README	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/README	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,81 @@
+XiphQT
+======
+
+XiphQT, the Xiph QuickTime Components, is a collection of QuickTime
+and MacOS X 'plug-ins' providing support for the Xiph.Org Foundation's
+(http://www.xiph.org/) multimedia compression formats.
+
+
+Building
+========
+
+The XiphQT source code is accompanied by a set of Xcode project files,
+and can be built easily using Xcode GUI or 'xcodebuild' command line tool.
+The only additional requirement besides the developer tools, is set of
+Xiph frameworks for particular compression formats, installed where Xcode
+can find them (preferably - /Library/Frameworks).
+
+
+Installing
+==========
+
+The binary component bundles need to be installed in specific locations
+on your hard drive. Bundles with names starting with 'CA' go to
+/Library/Components (or ~/Library/Components) and all other go to
+/Library/QuickTime (or ~/Library/QuickTime).
+You will also need to install Xiph library frameworks in either
+/Library/Frameworks (or ~/Library/Frameworks). 
+
+The lastest version of XiphQT makes use of the following frameworks:
+Ogg.framework, Vorbis.framework, FLAC.framework, FLAC++.framework and
+Speex.framework. Those can be build from the corresponding Xiph format
+libraries, or the binary versions can be obtained from ???.
+
+
+Source code organisation
+========================
+
+./AppleSDK
+	contains selected files from the CoreAudio SDK; these files are the
+	base of the AudioCodec API
+
+./CAFLAC
+	FLAC AudioCodec files
+
+./CASpeex
+	Speex AudioCodec files
+
+./CAVorbis
+	Vorbis AudioCodec files
+
+./OggImport
+	Ogg QuickTime MovieImporter component files
+
+./common, ./utils and ./resources
+	Functions, definition and resources shared between several components
+
+
+Copying
+======= 
+
+    XiphQT is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    XiphQT is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See file COPYING
+    for the details.
+
+
+    ---
+    The part of the CoreAudio SDK, included under the ./AppleSDK directory,
+    is redistributed according to the terms specified in the files. See
+    the file headers for more details. 
+
+
+    ---
+    Part of the OggImport component source code, written by Steve Nicolai,
+    is distributed under the terms of BSD-style License. See file
+    COPYING.qtcomponents in the OggImport directory for the details. 

Added: trunk/xiph-qt/common/XCACodec.cpp
===================================================================
--- trunk/xiph-qt/common/XCACodec.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/common/XCACodec.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,204 @@
+/*
+ *  XCACodec.cpp
+ *
+ *    XCACodec class implementation; shared packet i/o functionality.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "XCACodec.h"
+
+//#define NDEBUG
+#include "debug.h"
+
+
+XCACodec::XCACodec() :
+mBDCBuffer(),
+mBDCStatus(kBDCStatusOK)
+{
+}
+
+XCACodec::~XCACodec()
+{
+}
+
+#pragma mark The Core Functions
+
+void XCACodec::AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets,
+                                const AudioStreamPacketDescription* inPacketDescription)
+{
+    dprintf(" >> [%08lx] XCACodec :: AppendInputData(%ld [%ld])\n", (UInt32) this, ioNumberPackets, ioInputDataByteSize);
+	if(!mIsInitialized) CODEC_THROW(kAudioCodecStateError);
+	
+    UInt32 bytesToCopy = BufferGetAvailableBytesSize();
+    if (bytesToCopy > 0) {
+        UInt32 packet = 0;
+        UInt32 bytes = 0;
+        while (packet < ioNumberPackets) {
+            if (bytes + inPacketDescription[packet].mDataByteSize > bytesToCopy)
+                break;
+            dprintf("     ----  :: %ld: %ld [%ld]\n", packet, inPacketDescription[packet].mDataByteSize,
+                   inPacketDescription[packet].mVariableFramesInPacket);
+            InPacket(inInputData, &inPacketDescription[packet]);
+            
+            bytes += inPacketDescription[packet].mDataByteSize;
+            packet++;
+        }
+        
+        if (bytes == 0)
+            CODEC_THROW(kAudioCodecNotEnoughBufferSpaceError);
+        else {
+            ioInputDataByteSize = bytes;
+            ioNumberPackets = packet;
+        }
+    } else {
+        CODEC_THROW(kAudioCodecNotEnoughBufferSpaceError);
+    }
+    dprintf("<.. [%08lx] XCACodec :: AppendInputData()\n", (UInt32) this);
+}
+
+UInt32 XCACodec::ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
+                                     AudioStreamPacketDescription* outPacketDescription)
+{
+    dprintf(" >> [%08lx] XCACodec :: ProduceOutputPackets(%ld [%ld])\n", (UInt32) this, ioNumberPackets, ioOutputDataByteSize);
+
+	UInt32 theAnswer = kAudioCodecProduceOutputPacketSuccess;
+	
+	if(!mIsInitialized)
+		CODEC_THROW(kAudioCodecStateError);
+    
+    UInt32 frames = 0;
+    UInt32 fout = 0; //frames produced
+    UInt32 pout = 0; //full (input) packets processed
+    UInt32 requested_space_as_frames = ioOutputDataByteSize / mOutputFormat.mBytesPerFrame;
+    
+    // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+    
+    //TODO: zamienic fout/pout z ioOutputDataByteSize/ioNumberPackets:
+    //      zainicjowac na poczatku, a potem bezposrednio modyfikowac io*, nie [pf]out ...
+    while (fout < requested_space_as_frames && pout < ioNumberPackets) {
+        while ((frames = FramesReady()) == 0) {
+            if (BufferIsEmpty()) {
+                ioNumberPackets = pout;
+                ioOutputDataByteSize = mOutputFormat.mBytesPerFrame * fout;
+                theAnswer = kAudioCodecProduceOutputPacketNeedsMoreInputData;
+                dprintf("<.! [%08lx] XCACodec :: ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n", (UInt32) this,
+                       ioNumberPackets, ioOutputDataByteSize, theAnswer, FramesReady());
+                return theAnswer;
+            }
+            
+            if (GenerateFrames() != true) {
+                if (BDCGetStatus() == kBDCStatusAbort) {
+                    ioNumberPackets = pout;
+                    ioOutputDataByteSize = mOutputFormat.mBytesPerFrame * fout;
+                    theAnswer = kAudioCodecProduceOutputPacketFailure;
+                    dprintf("<!! [%08lx] XCACodec :: ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n", (UInt32) this,
+                           ioNumberPackets, ioOutputDataByteSize, theAnswer, FramesReady());
+                    return theAnswer;
+                }
+            }
+        }
+        
+        if (frames == 0)
+            continue;
+        
+        if ((fout + frames) * mOutputFormat.mBytesPerFrame > ioOutputDataByteSize)
+            frames = requested_space_as_frames - fout;
+        
+        OutputFrames(outOutputData, frames, fout);
+
+        fout += frames;
+        
+        Zap(frames);
+    
+        pout += InPacketsConsumed();
+    }
+    
+    // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+    
+    ioOutputDataByteSize = mOutputFormat.mBytesPerFrame * fout; //???
+    ioNumberPackets = pout;
+    
+    theAnswer = (FramesReady() > 0 || !BufferIsEmpty()) ? kAudioCodecProduceOutputPacketSuccessHasMore
+                                                            : kAudioCodecProduceOutputPacketSuccess;
+    
+    dprintf("<.. [%08lx] XCACodec :: ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n",
+           (UInt32) this, ioNumberPackets, ioOutputDataByteSize, theAnswer, FramesReady());
+    return theAnswer;
+}
+
+UInt32 XCACodec::InPacketsConsumed() const
+{
+    // the simplest case, works properly only if _every_ 'in' packet
+    // generates positive number of samples (so it won't work with Vorbis)
+    return (FramesReady() == 0);
+}
+
+
+#pragma mark Buffer/Decode/Convert interface
+
+void XCACodec::BDCInitialize(UInt32 inInputBufferByteSize)
+{
+    mBDCBuffer.Initialize(inInputBufferByteSize);
+    mBDCStatus = kBDCStatusOK;
+}
+
+void XCACodec::BDCUninitialize()
+{
+    mBDCBuffer.Uninitialize();
+}
+
+void XCACodec::BDCReset()
+{
+    mBDCBuffer.Reset();
+}
+
+void XCACodec::BDCReallocate(UInt32 inInputBufferByteSize)
+{
+    mBDCBuffer.Uninitialize();
+    mBDCBuffer.Initialize(inInputBufferByteSize);
+}
+
+
+UInt32 XCACodec::BufferGetBytesSize() const
+{
+    return mBDCBuffer.GetBufferByteSize();
+}
+
+UInt32 XCACodec::BufferGetUsedBytesSize() const
+{
+    return mBDCBuffer.GetDataAvailable();
+}
+
+UInt32 XCACodec::BufferGetAvailableBytesSize() const
+{
+    return mBDCBuffer.GetSpaceAvailable();
+}
+
+Boolean XCACodec::BufferIsEmpty() const
+{
+    return (mBDCBuffer.GetDataAvailable() == 0);
+}
+


Property changes on: trunk/xiph-qt/common/XCACodec.cpp
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/common/XCACodec.h
===================================================================
--- trunk/xiph-qt/common/XCACodec.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/common/XCACodec.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,96 @@
+/*
+ *  XCACodec.h
+ *
+ *    XCACodec class definition; abstract interface for shared packet i/o
+ *    functionality.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__XCACodec_h__)
+#define __XCACodec_h__
+
+#include "ACBaseCodec.h"
+
+#include "ringbuffer.h"
+
+#include "CAStreamBasicDescription.h"
+
+
+typedef enum BDCStatus {
+    kBDCStatusOK,
+    kBDCStatusNeedMoreData,
+    kBDCStatusAbort
+} BDCStatus;
+
+
+class XCACodec : public ACBaseCodec
+{
+public:
+    XCACodec();
+    virtual ~XCACodec();
+    
+    // AudioCodec interface
+    virtual void	ReallocateInputBuffer(UInt32 inInputBufferByteSize) { BDCReallocate(inInputBufferByteSize); };
+    virtual UInt32	GetInputBufferByteSize() const { return BufferGetBytesSize(); };
+    virtual UInt32	GetUsedInputBufferByteSize() const { return BufferGetUsedBytesSize(); };
+
+    virtual void	AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets,
+                                    const AudioStreamPacketDescription* inPacketDescription);
+	virtual UInt32	ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
+                                         AudioStreamPacketDescription* outPacketDescription);
+
+
+#pragma mark Buffer/Decode/Convert interface
+
+protected:
+    RingBuffer			mBDCBuffer;
+    BDCStatus			mBDCStatus;
+
+
+    virtual void		BDCInitialize(UInt32 inInputBufferByteSize);
+    virtual void		BDCUninitialize();
+    virtual void		BDCReset();
+    virtual void		BDCReallocate(UInt32 inInputBufferByteSize);
+
+    virtual BDCStatus	BDCGetStatus() const { return mBDCStatus; };
+
+    virtual UInt32		BufferGetBytesSize() const;
+    virtual UInt32		BufferGetUsedBytesSize() const;
+    virtual UInt32		BufferGetAvailableBytesSize() const;
+    virtual Boolean		BufferIsEmpty() const;
+
+    virtual void		InPacket(const void* inInputData, const AudioStreamPacketDescription* inPacketDescription) = 0;
+
+    virtual UInt32		FramesReady() const = 0;
+    virtual Boolean		GenerateFrames() = 0;
+    virtual void		OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const = 0;
+    virtual void		Zap(UInt32 inFrames) = 0;
+
+    virtual UInt32		InPacketsConsumed() const;
+};
+
+
+#endif /* __XCACodec_h__ */


Property changes on: trunk/xiph-qt/common/XCACodec.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/common/data_types.h
===================================================================
--- trunk/xiph-qt/common/data_types.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/common/data_types.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,70 @@
+/*
+ *  data_types.h
+ *
+ *    Definitions of common data structures shared between different
+ *    components.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__data_types_h__)
+#define __data_types_h__
+
+
+enum {
+    kCookieTypeOggSerialNo = 'oCtN'
+};
+
+// format specific cookie types
+
+enum {
+    kCookieTypeVorbisHeader		= 'vCtH',
+    kCookieTypeVorbisComments	= 'vCt#',
+    kCookieTypeVorbisCodebooks	= 'vCtC'
+};
+
+enum {
+    kCookieTypeSpeexHeader		= 'sCtH',
+    kCookieTypeSpeexComments	= 'sCt#',
+    kCookieTypeSpeexExtraHeader	= 'sCtX'
+};
+
+
+struct OggSerialNoAtom {
+    long	size;			// = sizeof(OggSerialNoAtom)
+    long	type;			// = kOggCookieSerialNoType
+    long	serialno;
+};
+typedef struct OggSerialNoAtom OggSerialNoAtom;
+
+struct CookieAtomHeader {
+    long			size;
+    long			type;
+    unsigned char	data[1];
+};
+typedef struct CookieAtomHeader CookieAtomHeader;
+
+
+#endif /* __data_types_h__ */
\ No newline at end of file


Property changes on: trunk/xiph-qt/common/data_types.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/common/fccs.h
===================================================================
--- trunk/xiph-qt/common/fccs.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/common/fccs.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,47 @@
+/*
+ *  fccs.h
+ *
+ *    Four Character Code identifiers for Xiph formats, used by
+ *    XiphQT for internal identification and identification when
+ *    exported in QT movie container.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+
+#if !defined(__fccs_h__)
+#define __fccs_h__
+
+
+enum {
+    kAudioFormatXiphVorbis				= 'XiVs',
+    kAudioFormatXiphOggFramedVorbis		= 'XoVs',
+
+    kAudioFormatXiphSpeex				= 'XiSp',
+    kAudioFormatXiphOggFramedSpeex		= 'XoSp'
+};
+
+
+#endif /* __fccs_h__ */


Property changes on: trunk/xiph-qt/common/fccs.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/resources/icon.icns
===================================================================
(Binary files differ)


Property changes on: trunk/xiph-qt/resources/icon.icns
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/xiph-qt/resources/icon.r
===================================================================
--- trunk/xiph-qt/resources/icon.r	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/resources/icon.r	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1 @@
+read 'icns' (-16455) "icon.icns";

Added: trunk/xiph-qt/utils/debug.h
===================================================================
--- trunk/xiph-qt/utils/debug.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/utils/debug.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,42 @@
+/*
+ *  debug.h
+ *
+ *    Debugging support.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__debug_h__)
+#define __debug_h__
+
+
+#if defined(NDEBUG)
+#define dprintf(...) {}
+#else
+#define dprintf printf
+#endif
+
+
+#endif /* __debug_h__ */


Property changes on: trunk/xiph-qt/utils/debug.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/utils/ringbuffer.cpp
===================================================================
--- trunk/xiph-qt/utils/ringbuffer.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/utils/ringbuffer.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,167 @@
+/*
+ *  ringbuffer.cpp
+ *
+ *    RingBuffer class implementation. Simple ring buffer functionality
+ *    expressed as a c++ class.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "ringbuffer.h"
+
+RingBuffer::RingBuffer() :
+mBuffer(NULL),
+mBStart(0),
+mBEnd(0),
+mBSize(0),
+mNeedsWrapping(false)
+{
+}
+
+RingBuffer::~RingBuffer() {
+    delete[] mBuffer;
+}
+
+
+void RingBuffer::Initialize(UInt32 inBufferByteSize) {
+    mBSize = inBufferByteSize;
+
+    if (mBuffer)
+        delete[] mBuffer;
+
+    mBuffer = new Byte[mBSize * 2];
+
+    mBStart = 0;
+    mBEnd = 0;
+    mNeedsWrapping = false;
+}
+
+void RingBuffer::Uninitialize() {
+    mBSize = 0;
+
+    if (mBuffer) {
+        delete[] mBuffer;
+        mBuffer = NULL;
+    }
+    
+    Reset();
+
+}
+
+void RingBuffer::Reset() {
+    mBStart = 0;
+    mBEnd = 0;
+    mNeedsWrapping = false;
+}
+
+UInt32 RingBuffer::GetBufferByteSize() const {
+    return mBSize;
+}
+
+UInt32 RingBuffer::GetDataAvailable() const {
+    UInt32 ret = 0;
+
+    if (mBStart < mBEnd)
+        ret = mBEnd - mBStart;
+    else if (mBEnd < mBStart)
+        ret = mBSize + mBEnd - mBStart;
+
+    return ret;
+}
+
+UInt32 RingBuffer::GetSpaceAvailable() const {
+    UInt32 ret = mBSize;
+    
+    if (mBStart > mBEnd)
+        ret =  mBStart - mBEnd;
+    else if (mBEnd > mBStart)
+        ret = mBSize - mBEnd + mBStart;
+    
+    return ret;
+    
+}
+
+
+void RingBuffer::In(const void* data, UInt32& ioBytes) {
+    UInt32 copiedBytes = GetSpaceAvailable();
+    if (copiedBytes > ioBytes)
+        copiedBytes = ioBytes;
+
+    if (mBEnd + copiedBytes <= mBSize) {
+        BlockMoveData(data, mBuffer + mBEnd, copiedBytes);
+        mBEnd += copiedBytes;
+        if (mBEnd < mBStart)
+            mNeedsWrapping = true;
+    } else {
+        UInt32 wrappedBytes = mBSize - mBEnd;
+        const Byte* dataSplit = static_cast<const Byte*>(data) + wrappedBytes;
+        mBEnd = copiedBytes - wrappedBytes;
+
+        BlockMoveData(data, mBuffer + mBEnd, wrappedBytes);
+        BlockMoveData(dataSplit, mBuffer, mBEnd);
+        
+        mNeedsWrapping = true;
+    }
+
+    ioBytes -= copiedBytes;
+}
+
+void RingBuffer::Zap(UInt32 inBytes) {
+    if (inBytes >= GetDataAvailable()) {
+        mBStart = 0;
+        mBEnd = 0;
+        mNeedsWrapping = false;
+    } else if (mBStart < mBEnd || mBStart + inBytes < mBSize) {
+        mBStart += inBytes;
+    } else {
+        mBStart += inBytes - mBSize;
+        mNeedsWrapping = false;
+    }
+}
+
+Byte* RingBuffer::GetData() {
+    if (GetDataAvailable() == 0)
+        return mBuffer;
+    else {
+        if (mNeedsWrapping) {
+            BlockMoveData(mBuffer, mBuffer + mBSize, mBEnd);
+            mNeedsWrapping = false;
+        }
+        return mBuffer + mBStart;
+    }
+}
+
+Byte* RingBuffer::GetDataEnd() {
+    UInt32 available = GetDataAvailable();
+    if (available == 0)
+        return mBuffer;
+    else {
+        if (mNeedsWrapping) {
+            BlockMoveData(mBuffer, mBuffer + mBSize, mBEnd);
+            mNeedsWrapping = false;
+        }
+        return mBuffer + mBStart + available;
+    }
+}


Property changes on: trunk/xiph-qt/utils/ringbuffer.cpp
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/utils/ringbuffer.h
===================================================================
--- trunk/xiph-qt/utils/ringbuffer.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/utils/ringbuffer.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,68 @@
+/*
+ *  ringbuffer.h
+ *
+ *    RingBuffer class definition. Simple ring buffer implementation.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__ringbuffer_h__)
+#define __ringbuffer_h__
+
+
+class RingBuffer
+{
+public:
+    RingBuffer();
+    virtual ~RingBuffer();
+
+public:
+    virtual void		Initialize(UInt32 inBufferByteSize);
+    virtual void		Uninitialize();
+    virtual void		Reset();
+
+    virtual UInt32		GetBufferByteSize() const;
+    virtual UInt32		GetDataAvailable() const;
+    virtual UInt32		GetSpaceAvailable() const;
+
+    virtual void		In(const void* data, UInt32& ioBytes);
+    virtual void		Zap(UInt32 inBytes);
+
+    virtual Byte *		GetData();
+    virtual Byte *		GetDataEnd();
+    
+protected:
+    Byte *		mBuffer;
+
+    UInt32		mBStart;
+    UInt32		mBEnd;
+    
+    UInt32		mBSize;
+    
+    Boolean		mNeedsWrapping;
+};
+
+
+#endif /* __ringbuffer_h__ */


Property changes on: trunk/xiph-qt/utils/ringbuffer.h
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/utils/wrap_ogg.cpp
===================================================================
--- trunk/xiph-qt/utils/wrap_ogg.cpp	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/utils/wrap_ogg.cpp	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,65 @@
+/*
+ *  wrap_ogg.cpp
+ *
+ *    WrapOggPage helper function - constructs an ogg_page 'around'
+ *    a block of memory.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#include "wrap_ogg.h"
+
+Boolean WrapOggPage(ogg_page* outOggPage, const void* inRawData, UInt32 inDataByteSize, UInt32 inDataStartOffset)
+{
+    if (inDataByteSize - inDataStartOffset < 27)
+        return false;
+    
+    const Byte* data = static_cast<const Byte*> (inRawData) + inDataStartOffset;
+    
+    if (memcmp(data, "OggS", 4) != 0)
+        return false;
+    
+    UInt32 headerBytes = data[26] + 27;
+    
+    if (inDataByteSize - inDataStartOffset < headerBytes)
+        return false;
+    
+    UInt32 bodyBytes = 0;
+    UInt32 i;
+    
+    /* just checking... */
+    for (i = 0; i < data[26]; i++) {
+        bodyBytes += data[27 + i];
+    }
+    if (bodyBytes > inDataByteSize - inDataStartOffset)
+        return false;
+    
+    outOggPage->header = const_cast<unsigned char*> (data);
+    outOggPage->header_len = headerBytes;
+    outOggPage->body = const_cast<unsigned char*> (data + headerBytes);
+    outOggPage->body_len = bodyBytes;
+    
+    return true;
+}


Property changes on: trunk/xiph-qt/utils/wrap_ogg.cpp
___________________________________________________________________
Name: svn:keywords
   + Id

Added: trunk/xiph-qt/utils/wrap_ogg.h
===================================================================
--- trunk/xiph-qt/utils/wrap_ogg.h	2005-11-02 10:06:05 UTC (rev 10321)
+++ trunk/xiph-qt/utils/wrap_ogg.h	2005-11-02 11:22:05 UTC (rev 10322)
@@ -0,0 +1,42 @@
+/*
+ *  wrap_ogg.h
+ *
+ *    WrapOggPage helper function - constructs an ogg_page 'around'
+ *    a block of memory.
+ *
+ *
+ *  Copyright (c) 2005  Arek Korbik
+ *
+ *  This file is part of XiphQT, the Xiph QuickTime Components.
+ *
+ *  XiphQT is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  XiphQT is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with XiphQT; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  Last modified: $Id$
+ *
+ */
+
+
+#if !defined(__wrap_ogg_h__)
+#define __wrap_ogg_h__
+
+
+#include <Ogg/ogg.h>
+
+extern Boolean WrapOggPage(ogg_page* outOggPage, const void* inRawData,
+                           UInt32 inDataByteSize, UInt32 inDataStartOffset);
+
+
+#endif /* __wrap_ogg_h__ */


Property changes on: trunk/xiph-qt/utils/wrap_ogg.h
___________________________________________________________________
Name: svn:keywords
   + Id



More information about the commits mailing list