[xiph-commits] r12093 - in trunk/xiph-qt: . CAFLAC CAFLAC/src CASpeex CASpeex/src CAVorbis CAVorbis/CAVorbis.xcodeproj CAVorbis/src OggExport OggExport/English.lproj OggExport/OggExport.xcodeproj OggExport/build OggExport/src OggExport/src/OggExport.nib OggImport OggImport/OggImport.xcodeproj OggImport/src Theora/Theora.xcodeproj common external-libs

arek at svn.xiph.org arek at svn.xiph.org
Sun Nov 12 06:45:24 PST 2006


Author: arek
Date: 2006-11-12 06:44:51 -0800 (Sun, 12 Nov 2006)
New Revision: 12093

Added:
   trunk/xiph-qt/CAVorbis/src/CAVorbisEncoder.cpp
   trunk/xiph-qt/CAVorbis/src/CAVorbisEncoder.h
   trunk/xiph-qt/CAVorbis/src/CAVorbisEncoderPublic.r
   trunk/xiph-qt/OggExport/
   trunk/xiph-qt/OggExport/English.lproj/
   trunk/xiph-qt/OggExport/English.lproj/InfoPlist.strings
   trunk/xiph-qt/OggExport/Info.plist
   trunk/xiph-qt/OggExport/OggExport.xcodeproj/
   trunk/xiph-qt/OggExport/OggExport.xcodeproj/project.pbxproj
   trunk/xiph-qt/OggExport/OggExport_Prefix.pch
   trunk/xiph-qt/OggExport/PkgInfo
   trunk/xiph-qt/OggExport/build/
   trunk/xiph-qt/OggExport/src/
   trunk/xiph-qt/OggExport/src/OggExport.c
   trunk/xiph-qt/OggExport/src/OggExport.exp
   trunk/xiph-qt/OggExport/src/OggExport.h
   trunk/xiph-qt/OggExport/src/OggExport.nib/
   trunk/xiph-qt/OggExport/src/OggExport.nib/classes.nib
   trunk/xiph-qt/OggExport/src/OggExport.nib/info.nib
   trunk/xiph-qt/OggExport/src/OggExport.nib/objects.xib
   trunk/xiph-qt/OggExport/src/OggExport.r
   trunk/xiph-qt/OggExport/src/OggExportDispatch.h
   trunk/xiph-qt/OggExport/src/exporter_types.h
   trunk/xiph-qt/OggExport/src/oggexport_versions.h
   trunk/xiph-qt/OggExport/src/stream_audio.c
   trunk/xiph-qt/OggExport/src/stream_audio.h
   trunk/xiph-qt/OggExport/src/stream_types_audio.h
   trunk/xiph-qt/external-libs/
Modified:
   trunk/xiph-qt/CAFLAC/Info.plist
   trunk/xiph-qt/CAFLAC/src/CAFLACDecoder.cpp
   trunk/xiph-qt/CAFLAC/src/CAFLACDecoder.h
   trunk/xiph-qt/CAFLAC/src/flac_versions.h
   trunk/xiph-qt/CASpeex/Info.plist
   trunk/xiph-qt/CASpeex/src/CASpeexDecoder.cpp
   trunk/xiph-qt/CASpeex/src/CASpeexDecoder.h
   trunk/xiph-qt/CASpeex/src/speex_versions.h
   trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj/project.pbxproj
   trunk/xiph-qt/CAVorbis/Info.plist
   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/vorbis_entrypoints.cpp
   trunk/xiph-qt/CAVorbis/src/vorbis_versions.h
   trunk/xiph-qt/OggImport/Info.plist
   trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj
   trunk/xiph-qt/OggImport/src/OggImportDispatch.h
   trunk/xiph-qt/OggImport/src/versions.h
   trunk/xiph-qt/README
   trunk/xiph-qt/Theora/Theora.xcodeproj/project.pbxproj
   trunk/xiph-qt/common/XCACodec.cpp
   trunk/xiph-qt/common/XCACodec.h
Log:
Added OggExport and CAVorbisEncoder code; minor adaptations of the existing
components.


Modified: trunk/xiph-qt/CAFLAC/Info.plist
===================================================================
--- trunk/xiph-qt/CAFLAC/Info.plist	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAFLAC/Info.plist	2006-11-12 14:44:51 UTC (rev 12093)
@@ -7,7 +7,7 @@
 	<key>CFBundleExecutable</key>
 	<string>CAFLAC</string>
 	<key>CFBundleGetInfoString</key>
-	<string>CoreAudio FLAC Decoder Component 0.1.2, Copyright © 2005-2006 Arek Korbik</string>
+	<string>CoreAudio FLAC Decoder Component 0.1.3, Copyright © 2005-2006 Arek Korbik</string>
 	<key>CFBundleIconFile</key>
 	<string></string>
 	<key>CFBundleIdentifier</key>
@@ -19,11 +19,11 @@
 	<key>CFBundleSignature</key>
 	<string>adec</string>
 	<key>CFBundleVersion</key>
-	<string>0.1.2</string>
+	<string>0.1.3</string>
 	<key>CFBundleShortVersionString</key>
-	<string>0.1.2</string>
+	<string>0.1.3</string>
 	<key>NSHumanReadableCopyright</key>
-	<string>CoreAudio FLAC Decoder Component 0.1.2, Copyright © 2005-2006 Arek Korbik</string>
+	<string>CoreAudio FLAC Decoder Component 0.1.3, Copyright © 2005-2006 Arek Korbik</string>
 	<key>CSResourcesFileMapped</key>
 	<true/>
 </dict>

Modified: trunk/xiph-qt/CAFLAC/src/CAFLACDecoder.cpp
===================================================================
--- trunk/xiph-qt/CAFLAC/src/CAFLACDecoder.cpp	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAFLAC/src/CAFLACDecoder.cpp	2006-11-12 14:44:51 UTC (rev 12093)
@@ -330,7 +330,8 @@
 
 #pragma mark The CORE
 
-void CAFLACDecoder::OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const
+void CAFLACDecoder::OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset,
+                                 AudioStreamPacketDescription* /* outPacketDescription */) const
 {
     UInt32 i, j;
 

Modified: trunk/xiph-qt/CAFLAC/src/CAFLACDecoder.h
===================================================================
--- trunk/xiph-qt/CAFLAC/src/CAFLACDecoder.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAFLAC/src/CAFLACDecoder.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -82,7 +82,8 @@
 
     virtual UInt32      FramesReady() const;
     virtual Boolean     GenerateFrames();
-    virtual void        OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const;
+    virtual void        OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset,
+                                     AudioStreamPacketDescription* outPacketDescription) const;
     virtual void        Zap(UInt32 inFrames);
 
 //    virtual UInt32      InPacketsConsumed() const;

Modified: trunk/xiph-qt/CAFLAC/src/flac_versions.h
===================================================================
--- trunk/xiph-qt/CAFLAC/src/flac_versions.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAFLAC/src/flac_versions.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -32,9 +32,9 @@
 #define __flac_versions_h__
 
 #ifdef DEBUG
-#define kCAFLAC_adec_Version		(0x00FF0102)
+#define kCAFLAC_adec_Version		(0x00FF0103)
 #else
-#define kCAFLAC_adec_Version		(0x00000102)
+#define kCAFLAC_adec_Version		(0x00000103)
 #endif /* DEBUG */
 
 #endif /* __flac_versions_h__ */

Modified: trunk/xiph-qt/CASpeex/Info.plist
===================================================================
--- trunk/xiph-qt/CASpeex/Info.plist	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CASpeex/Info.plist	2006-11-12 14:44:51 UTC (rev 12093)
@@ -7,7 +7,7 @@
 	<key>CFBundleExecutable</key>
 	<string>CASpeex</string>
 	<key>CFBundleGetInfoString</key>
-	<string>CoreAudio Speex Decoder Component 0.1.2, Copyright © 2005-2006 Arek Korbik</string>
+	<string>CoreAudio Speex Decoder Component 0.1.3, Copyright © 2005-2006 Arek Korbik</string>
 	<key>CFBundleIconFile</key>
 	<string></string>
 	<key>CFBundleIdentifier</key>
@@ -17,13 +17,13 @@
 	<key>CFBundlePackageType</key>
 	<string>BNDL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>0.1.2</string>
+	<string>0.1.3</string>
 	<key>CFBundleSignature</key>
 	<string>adec</string>
 	<key>CFBundleVersion</key>
-	<string>0.1.2</string>
+	<string>0.1.3</string>
 	<key>NSHumanReadableCopyright</key>
-	<string>CoreAudio Speex Decoder Component 0.1.2, Copyright © 2005-2006 Arek Korbik</string>
+	<string>CoreAudio Speex Decoder Component 0.1.3, Copyright © 2005-2006 Arek Korbik</string>
 	<key>CSResourcesFileMapped</key>
 	<true/>
 </dict>

Modified: trunk/xiph-qt/CASpeex/src/CASpeexDecoder.cpp
===================================================================
--- trunk/xiph-qt/CASpeex/src/CASpeexDecoder.cpp	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CASpeex/src/CASpeexDecoder.cpp	2006-11-12 14:44:51 UTC (rev 12093)
@@ -5,7 +5,7 @@
  *    codec functionality.
  *
  *
- *  Copyright (c) 2005  Arek Korbik
+ *  Copyright (c) 2005-2006  Arek Korbik
  *
  *  This file is part of XiphQT, the Xiph QuickTime Components.
  *
@@ -544,7 +544,8 @@
     return ret;
 }
 
-void CASpeexDecoder::OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const
+void CASpeexDecoder::OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset,
+                                  AudioStreamPacketDescription* /* outPacketDescription */) const
 {
     if (mOutputFormat.mFormatFlags & kAudioFormatFlagsNativeFloatPacked != 0) {
         float* theOutputData = static_cast<float*> (outOutputData) + inFramesOffset * mSpeexHeader.nb_channels;

Modified: trunk/xiph-qt/CASpeex/src/CASpeexDecoder.h
===================================================================
--- trunk/xiph-qt/CASpeex/src/CASpeexDecoder.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CASpeex/src/CASpeexDecoder.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -82,7 +82,8 @@
 
     virtual UInt32      FramesReady() const;
     virtual Boolean     GenerateFrames();
-    virtual void        OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const;
+    virtual void        OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset,
+                                     AudioStreamPacketDescription* outPacketDescription) const;
     virtual void        Zap(UInt32 inFrames);
 
     void                SetCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize);

Modified: trunk/xiph-qt/CASpeex/src/speex_versions.h
===================================================================
--- trunk/xiph-qt/CASpeex/src/speex_versions.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CASpeex/src/speex_versions.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -4,7 +4,7 @@
  *    The current version of the Speex component.
  *
  *
- *  Copyright (c) 2005  Arek Korbik
+ *  Copyright (c) 2005-2006  Arek Korbik
  *
  *  This file is part of XiphQT, the Xiph QuickTime Components.
  *
@@ -33,9 +33,9 @@
 
 
 #ifdef DEBUG
-#define kCASpeex_adec_Version		(0x00FF0102)
+#define kCASpeex_adec_Version		(0x00FF0103)
 #else
-#define kCASpeex_adec_Version		(0x00000102)
+#define kCASpeex_adec_Version		(0x00000103)
 #endif /* DEBUG */
 
 

Modified: trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj/project.pbxproj
===================================================================
--- trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj/project.pbxproj	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAVorbis/CAVorbis.xcodeproj/project.pbxproj	2006-11-12 14:44:51 UTC (rev 12093)
@@ -7,8 +7,9 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		734252F60AECFAB8003F78A8 /* CAVorbisEncoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 734252F30AECFAB8003F78A8 /* CAVorbisEncoder.cpp */; };
+		734252F80AECFAB8003F78A8 /* CAVorbisEncoderPublic.r in Rez */ = {isa = PBXBuildFile; fileRef = 734252F50AECFAB8003F78A8 /* CAVorbisEncoderPublic.r */; };
 		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 */; };
@@ -26,33 +27,10 @@
 		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 */; };
+		73C298B30AEFAA7100EF9C25 /* XCACodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 737C589B09125C2700700B79 /* XCACodec.cpp */; };
 		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;
@@ -69,6 +47,9 @@
 /* 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>"; };
+		734252F30AECFAB8003F78A8 /* CAVorbisEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = CAVorbisEncoder.cpp; path = src/CAVorbisEncoder.cpp; sourceTree = "<group>"; };
+		734252F40AECFAB8003F78A8 /* CAVorbisEncoder.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CAVorbisEncoder.h; path = src/CAVorbisEncoder.h; sourceTree = "<group>"; };
+		734252F50AECFAB8003F78A8 /* CAVorbisEncoderPublic.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = CAVorbisEncoderPublic.r; path = src/CAVorbisEncoderPublic.r; sourceTree = "<group>"; };
 		7348BD580944D32400AC363C /* XCAResources.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = XCAResources.r; path = ../resources/XCAResources.r; sourceTree = SOURCE_ROOT; };
 		7348BD5A0944D37900AC363C /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../common/config.h; sourceTree = SOURCE_ROOT; };
 		737C589209125B5900700B79 /* vorbis_entrypoints.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = vorbis_entrypoints.cpp; path = src/vorbis_entrypoints.cpp; sourceTree = "<group>"; };
@@ -163,6 +144,7 @@
 				737C589409125B8500700B79 /* icon.icns */,
 				737C589509125B8500700B79 /* icon.r */,
 				737CA4B708F9588900DAC36C /* CAVorbisDecoderPublic.r */,
+				734252F50AECFAB8003F78A8 /* CAVorbisEncoderPublic.r */,
 				8D01CCD10486CAD60068D4B7 /* Info.plist */,
 				089C167DFE841241C02AAC07 /* InfoPlist.strings */,
 			);
@@ -172,6 +154,8 @@
 		08FB77ADFE841716C02AAC07 /* Source */ = {
 			isa = PBXGroup;
 			children = (
+				734252F30AECFAB8003F78A8 /* CAVorbisEncoder.cpp */,
+				734252F40AECFAB8003F78A8 /* CAVorbisEncoder.h */,
 				7348BD5A0944D37900AC363C /* config.h */,
 				737C59940912617B00700B79 /* CAOggVorbisDecoder.cpp */,
 				737C59950912617B00700B79 /* CAOggVorbisDecoder.h */,
@@ -317,15 +301,6 @@
 			);
 			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;
@@ -340,12 +315,6 @@
 		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 = "";
@@ -372,6 +341,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				737CA4D908F95A2C00DAC36C /* CAVorbisDecoderPublic.r in Rez */,
+				734252F80AECFAB8003F78A8 /* CAVorbisEncoderPublic.r in Rez */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -410,9 +380,10 @@
 				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 */,
+				734252F60AECFAB8003F78A8 /* CAVorbisEncoder.cpp in Sources */,
+				73C298B30AEFAA7100EF9C25 /* XCACodec.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/xiph-qt/CAVorbis/Info.plist
===================================================================
--- trunk/xiph-qt/CAVorbis/Info.plist	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAVorbis/Info.plist	2006-11-12 14:44:51 UTC (rev 12093)
@@ -7,7 +7,7 @@
 	<key>CFBundleExecutable</key>
 	<string>CAVorbis</string>
 	<key>CFBundleGetInfoString</key>
-	<string>CoreAudio Vorbis Decoder Component 0.1.5, Copyright © 2005-2006 Arek Korbik</string>
+	<string>CoreAudio Vorbis Decoder Component 0.1.7, Copyright © 2005-2006 Arek Korbik</string>
 	<key>CFBundleIconFile</key>
 	<string></string>
 	<key>CFBundleIdentifier</key>
@@ -17,13 +17,13 @@
 	<key>CFBundlePackageType</key>
 	<string>BNDL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>0.1.5</string>
+	<string>0.1.7</string>
 	<key>CFBundleSignature</key>
-	<string>adec</string>
+	<string>acdc</string>
 	<key>CFBundleVersion</key>
-	<string>0.1.5</string>
+	<string>0.1.7</string>
 	<key>NSHumanReadableCopyright</key>
-	<string>CoreAudio Vorbis Decoder Component 0.1.5, Copyright © 2005-2006 Arek Korbik</string>
+	<string>CoreAudio Vorbis Decoder Component 0.1.7, Copyright © 2005-2006 Arek Korbik</string>
 	<key>CSResourcesFileMapped</key>
 	<true/>
 </dict>

Modified: trunk/xiph-qt/CAVorbis/src/CAVorbisCodec.exp
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisCodec.exp	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisCodec.exp	2006-11-12 14:44:51 UTC (rev 12093)
@@ -1,2 +1,3 @@
 _CAVorbisDecoderEntry
 _CAOggVorbisDecoderEntry
+_CAVorbisEncoderEntry

Modified: trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp	2006-11-12 14:44:51 UTC (rev 12093)
@@ -43,6 +43,12 @@
 //#define NDEBUG
 #include "debug.h"
 
+#define DBG_STREAMDESC_FMT " [CASBD: sr=%lf, fmt=%4.4s, fl=%lx, bpp=%ld, fpp=%ld, bpf=%ld, ch=%ld, bpc=%ld]"
+#define DBG_STREAMDESC_FILL(x) (x)->mSampleRate, reinterpret_cast<const char*> (&((x)->mFormatID)), \
+        (x)->mFormatFlags, (x)->mBytesPerPacket, (x)->mFramesPerPacket, (x)->mBytesPerPacket, \
+        (x)->mChannelsPerFrame, (x)->mBitsPerChannel
+
+
 CAVorbisDecoder::CAVorbisDecoder(Boolean inSkipFormatsInitialization /* = false */) :
     mCookie(NULL), mCookieSize(0), mCompressionInitialized(false),
     mVorbisFPList(), mConsumedFPList(),
@@ -101,7 +107,11 @@
                                  const AudioStreamBasicDescription* inOutputFormat,
                                  const void* inMagicCookie, UInt32 inMagicCookieByteSize)
 {
-    dbg_printf(" >> [%08lx] :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
+    dbg_printf("[VD  ]  >> [%08lx] :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
+    if (inInputFormat)
+        dbg_printf("[VD  ]   > [%08lx] :: InputFormat :" DBG_STREAMDESC_FMT "\n", (UInt32) this, DBG_STREAMDESC_FILL(inInputFormat));
+    if (inOutputFormat)
+        dbg_printf("[VD  ]   > [%08lx] :: OutputFormat:" DBG_STREAMDESC_FMT "\n", (UInt32) this, DBG_STREAMDESC_FILL(inOutputFormat));
 
     if(inInputFormat != NULL) {
         SetCurrentInputFormat(*inInputFormat);
@@ -125,47 +135,46 @@
         SetMagicCookie(inMagicCookie, inMagicCookieByteSize);
     }
 
-    //if (mCompressionInitialized)
-    //    FixFormats();
+    if (mCompressionInitialized)
+        FixFormats();
 
-    XCACodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize);
-    dbg_printf("<.. [%08lx] :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
+    if (mCompressionInitialized)
+        XCACodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize);
+    dbg_printf("[VD  ]  <  [%08lx] :: InputFormat :" DBG_STREAMDESC_FMT "\n", (UInt32) this, DBG_STREAMDESC_FILL(&mInputFormat));
+    dbg_printf("[VD  ]  <  [%08lx] :: OutputFormat:" DBG_STREAMDESC_FMT "\n", (UInt32) this, DBG_STREAMDESC_FILL(&mOutputFormat));
+    dbg_printf("[VD  ] <.. [%08lx] :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
 }
 
 void CAVorbisDecoder::Uninitialize()
 {
-    dbg_printf(" >> [%08lx] :: Uninitialize()\n", (UInt32) this);
+    dbg_printf("[VD  ]  >> [%08lx] :: Uninitialize()\n", (UInt32) this);
     BDCUninitialize();
 
     XCACodec::Uninitialize();
-    dbg_printf("<.. [%08lx] :: Uninitialize()\n", (UInt32) this);
+    dbg_printf("[VD  ] <.. [%08lx] :: Uninitialize()\n", (UInt32) this);
 }
 
 void CAVorbisDecoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
 {
-    dbg_printf(" >> [%08lx] :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+    dbg_printf("[VD  ]  >> [%08lx] :: GetProperty('%4.4s', %ld)\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID), ioPropertyDataSize);
     switch(inPropertyID)
     {
     case kAudioCodecPropertyRequiresPacketDescription:
-        if(ioPropertyDataSize == sizeof(UInt32))
-        {
+        if(ioPropertyDataSize == sizeof(UInt32)) {
             *reinterpret_cast<UInt32*>(outPropertyData) = 1;
-        }
-        else
-        {
+        } else {
             CODEC_THROW(kAudioCodecBadPropertySizeError);
         }
         break;
+
     case kAudioCodecPropertyHasVariablePacketByteSizes:
-        if(ioPropertyDataSize == sizeof(UInt32))
-        {
+        if(ioPropertyDataSize == sizeof(UInt32)) {
             *reinterpret_cast<UInt32*>(outPropertyData) = 1;
-        }
-        else
-        {
+        } else {
             CODEC_THROW(kAudioCodecBadPropertySizeError);
         }
         break;
+
     case kAudioCodecPropertyPacketFrameSize:
         if(ioPropertyDataSize == sizeof(UInt32))
         {
@@ -177,10 +186,9 @@
                implemented according to the QT docs. (And in case this workaround stops
                working again one wonderful morning!) */
             // *reinterpret_cast<UInt32*>(outPropertyData) = kVorbisFramesPerPacket;
-            *reinterpret_cast<UInt32*>(outPropertyData) = kVorbisFramesPerPacketReported;
-        }
-        else
-        {
+            //*reinterpret_cast<UInt32*>(outPropertyData) = kVorbisFramesPerPacketReported;
+            *reinterpret_cast<UInt32*>(outPropertyData) = kVorbisFramesPerPacket;
+        } else {
             CODEC_THROW(kAudioCodecBadPropertySizeError);
         }
         break;
@@ -193,6 +201,26 @@
         }
         break;
 
+    case kAudioCodecPropertyCurrentInputSampleRate:
+        if (ioPropertyDataSize == sizeof(Float64)) {
+            *reinterpret_cast<Float64*>(outPropertyData) = mInputFormat.mSampleRate;
+        } else if (ioPropertyDataSize == sizeof(UInt32)) {
+            *reinterpret_cast<UInt32*>(outPropertyData) = mInputFormat.mSampleRate;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyCurrentOutputSampleRate:
+        if (ioPropertyDataSize == sizeof(Float64)) {
+            *reinterpret_cast<Float64*>(outPropertyData) = mOutputFormat.mSampleRate;
+        } else if (ioPropertyDataSize == sizeof(UInt32)) {
+            *reinterpret_cast<UInt32*>(outPropertyData) = mOutputFormat.mSampleRate;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
         //case kAudioCodecPropertyQualitySetting: ???
 #if TARGET_OS_MAC
     case kAudioCodecPropertyNameCFString:
@@ -210,12 +238,12 @@
     default:
         ACBaseCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
     }
-    dbg_printf("<.. [%08lx] :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+    dbg_printf("[VD  ] <.. [%08lx] :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
 }
 
 void CAVorbisDecoder::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable)
 {
-    dbg_printf(" >> [%08lx] :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+    dbg_printf("[VD  ]  >> [%08lx] :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
     switch(inPropertyID)
     {
     case kAudioCodecPropertyRequiresPacketDescription:
@@ -238,21 +266,27 @@
         outWritable = false;
         break;
 
+    case kAudioCodecPropertyCurrentInputSampleRate:
+    case kAudioCodecPropertyCurrentOutputSampleRate:
+        outPropertyDataSize = sizeof(Float64);
+        outWritable = false;
+        break;
+
     default:
         ACBaseCodec::GetPropertyInfo(inPropertyID, outPropertyDataSize, outWritable);
         break;
 
     }
-    dbg_printf("<.. [%08lx] :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+    dbg_printf("[VD  ] <.. [%08lx] :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
 }
 
 void CAVorbisDecoder::Reset()
 {
-    dbg_printf(">> [%08lx] :: Reset()\n", (UInt32) this);
+    dbg_printf("[VD  ] >> [%08lx] :: Reset()\n", (UInt32) this);
     BDCReset();
 
     XCACodec::Reset();
-    dbg_printf("<< [%08lx] :: Reset()\n", (UInt32) this);
+    dbg_printf("[VD  ] << [%08lx] :: Reset()\n", (UInt32) this);
 }
 
 UInt32 CAVorbisDecoder::GetVersion() const
@@ -305,15 +339,17 @@
 
 void CAVorbisDecoder::GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const
 {
-    ioMagicCookieDataByteSize = mCookieSize;
-
-    if (mCookie != NULL)
-        outMagicCookieData = mCookie;
+    if (mCookie != NULL) {
+        ioMagicCookieDataByteSize = mCookieSize;
+        BlockMoveData(mCookie, outMagicCookieData, ioMagicCookieDataByteSize);
+    } else {
+        ioMagicCookieDataByteSize = 0;
+    }
 }
 
 void CAVorbisDecoder::SetMagicCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize)
 {
-    dbg_printf(" >> [%08lx] :: SetMagicCookie()\n", (UInt32) this);
+    dbg_printf("[VD  ]  >> [%08lx] :: SetMagicCookie()\n", (UInt32) this);
     if (mIsInitialized)
         CODEC_THROW(kAudioCodecStateError);
 
@@ -323,7 +359,7 @@
 
     if (!mCompressionInitialized)
         CODEC_THROW(kAudioCodecUnsupportedFormatError);
-    dbg_printf("<.. [%08lx] :: SetMagicCookie()\n", (UInt32) this);
+    dbg_printf("[VD  ] <.. [%08lx] :: SetMagicCookie()\n", (UInt32) this);
 }
 
 void CAVorbisDecoder::SetCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize)
@@ -342,19 +378,25 @@
 
 
 
-#if 0
 void CAVorbisDecoder::FixFormats()
 {
+    dbg_printf("[VD  ]  >> [%08lx] :: FixFormats()\n", (UInt32) this);
     mInputFormat.mSampleRate = mV_vi.rate;
     mInputFormat.mChannelsPerFrame = mV_vi.channels;
+    mInputFormat.mBitsPerChannel = 0;
+    mInputFormat.mBytesPerPacket = 0;
+    mInputFormat.mFramesPerPacket = 0;
 
+    //long long_blocksize = (reinterpret_cast<long *>(mV_vi.codec_setup))[1];
+    //mInputFormat.mFramesPerPacket = long_blocksize;
+
     /*
       mInputFormat.mFramesPerPacket = 64;
       mInputFormat.mBytesPerPacket = mInputFormat.mChannelsPerFrame * 34;
       mInputFormat.mBytesPerFrame = 0;
     */
+    dbg_printf("[VD  ] <.. [%08lx] :: FixFormats()\n", (UInt32) this);
 }
-#endif
 
 
 void CAVorbisDecoder::InitializeCompressionSettings()
@@ -371,72 +413,74 @@
 
     mCompressionInitialized = false;
 
-    OggSerialNoAtom *atom = reinterpret_cast<OggSerialNoAtom*> (mCookie);
-    Byte *ptrheader = mCookie + EndianU32_BtoN(atom->size);
+    Byte *ptrheader = mCookie;
+    Byte *cend = mCookie + mCookieSize;
     CookieAtomHeader *aheader = reinterpret_cast<CookieAtomHeader*> (ptrheader);
+    ogg_packet header, header_vc, header_cb;
+    header.bytes = header_vc.bytes = header_cb.bytes = 0;
 
-    // scan quickly through the cookie, check types and packet sizes
-    if (EndianS32_BtoN(atom->type) != kCookieTypeOggSerialNo || static_cast<UInt32> (ptrheader - mCookie) > mCookieSize)
+    while (ptrheader < cend) {
+        aheader = reinterpret_cast<CookieAtomHeader*> (ptrheader);
+        ptrheader += EndianU32_BtoN(aheader->size);
+        if (ptrheader > cend || EndianU32_BtoN(aheader->size) <= 0)
+            break;
+
+        switch(EndianS32_BtoN(aheader->type)) {
+        case kCookieTypeVorbisHeader:
+            header.b_o_s = 1;
+            header.e_o_s = 0;
+            header.granulepos = 0;
+            header.packetno = 0;
+            header.bytes = EndianS32_BtoN(aheader->size) - 2 * sizeof(long);
+            header.packet = aheader->data;
+            break;
+
+        case kCookieTypeVorbisComments:
+            header_vc.b_o_s = 0;
+            header_vc.e_o_s = 0;
+            header_vc.granulepos = 0;
+            header_vc.packetno = 1;
+            header_vc.bytes = EndianS32_BtoN(aheader->size) - 2 * sizeof(long);
+            header_vc.packet = aheader->data;
+            break;
+
+        case kCookieTypeVorbisCodebooks:
+            header_cb.b_o_s = 0;
+            header_cb.e_o_s = 0;
+            header_cb.granulepos = 0;
+            header_cb.packetno = 2;
+            header_cb.bytes = EndianS32_BtoN(aheader->size) - 2 * sizeof(long);
+            header_cb.packet = aheader->data;
+            break;
+
+        default:
+            break;
+        }
+    }
+
+    if (header.bytes == 0 || header_vc.bytes == 0 || header_cb.bytes == 0)
         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);
-
+    if (vorbis_synthesis_headerin(&mV_vi, &vc, &header) < 0) {
         vorbis_comment_clear(&vc);
         vorbis_info_clear(&mV_vi);
 
         return;
     }
 
-    op.b_o_s = 0;
-    UInt32 i=0;
+    vorbis_synthesis_headerin(&mV_vi, &vc, &header_vc);
+    vorbis_synthesis_headerin(&mV_vi, &vc, &header_cb);
 
-    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;
 }
 
@@ -534,7 +578,8 @@
     return ret;
 }
 
-void CAVorbisDecoder::OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const
+void CAVorbisDecoder::OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset,
+                                   AudioStreamPacketDescription* /* outPacketDescription */) const
 {
     float **pcm;
     vorbis_synthesis_pcmout(const_cast<vorbis_dsp_state*> (&mV_vd), &pcm);  // ignoring the result, but should be (!!) at least inNumberFrames

Modified: trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -81,7 +81,8 @@
 
     virtual UInt32      FramesReady() const;
     virtual Boolean     GenerateFrames();
-    virtual void        OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const;
+    virtual void        OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset,
+                                     AudioStreamPacketDescription* outPacketDescription) const;
     virtual void        Zap(UInt32 inFrames);
 
     virtual UInt32      InPacketsConsumed() const;
@@ -89,7 +90,7 @@
     void                SetCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize);
     virtual void        InitializeCompressionSettings();
 
-    //virtual void        FixFormats();
+    virtual void        FixFormats();
 
  protected:
     Byte* mCookie;
@@ -123,7 +124,8 @@
         kVorbisFramesPerPacketReported = 8192,
         kVorbisBytesPerFrame = 0,
         kVorbisChannelsPerFrame = 0,
-        kVorbisBitsPerChannel = 16,
+        //kVorbisBitsPerChannel = 16,
+        kVorbisBitsPerChannel = 0,
         kVorbisFormatFlags = 0,
 
         /* Just a funny number, and only roughly valid for the 'Xiph (Ogg-Framed) Vorbis'. */

Copied: trunk/xiph-qt/CAVorbis/src/CAVorbisEncoder.cpp (from rev 11397, trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp)
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.cpp	2006-05-10 13:51:49 UTC (rev 11397)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisEncoder.cpp	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,1039 @@
+/*
+ *  CAVorbisEncoder.cpp
+ *
+ *    CAVorbisEncoder class implementation; the main part of the Vorbis
+ *    encoding functionality.
+ *
+ *
+ *  Copyright (c) 2006  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/vorbisenc.h>
+
+#include "CAVorbisEncoder.h"
+
+#include "CABundleLocker.h"
+
+#include "vorbis_versions.h"
+#include "fccs.h"
+#include "data_types.h"
+
+//#define NDEBUG
+#include "debug.h"
+
+
+#if !defined(NO_ACS)
+#define NO_ACS 1
+#endif /* defined(NO_ACS) */
+
+#if !defined(NO_ADV_PROPS)
+#define NO_ADV_PROPS 1
+#endif /* defined(NO_ADV_PROPS) */
+
+#define DBG_STREAMDESC_FMT " [CASBD: sr=%lf, fmt=%4.4s, fl=%lx, bpp=%ld, fpp=%ld, bpf=%ld, ch=%ld, bpc=%ld]"
+#define DBG_STREAMDESC_FILL(x) (x)->mSampleRate, reinterpret_cast<const char*> (&((x)->mFormatID)), \
+        (x)->mFormatFlags, (x)->mBytesPerPacket, (x)->mFramesPerPacket, (x)->mBytesPerPacket, \
+        (x)->mChannelsPerFrame, (x)->mBitsPerChannel
+
+CAVorbisEncoder::CAVorbisEncoder() :
+    mCookie(NULL), mCookieSize(0), mCompressionInitialized(false), mEOSHit(false),
+    last_granulepos(0), last_packetno(0), mVorbisFPList(), mProducedPList()
+{
+    CAStreamBasicDescription theInputFormat1(kAudioStreamAnyRate, kAudioFormatLinearPCM,
+                                             0, 1, 0, 0, 32, kAudioFormatFlagsNativeFloatPacked);
+    AddInputFormat(theInputFormat1);
+
+    CAStreamBasicDescription theInputFormat2(kAudioStreamAnyRate, kAudioFormatLinearPCM,
+                                             0, 1, 0, 0, 16,
+                                             kAudioFormatFlagsNativeEndian |
+                                             kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked);
+    AddInputFormat(theInputFormat2);
+
+    mInputFormat.mSampleRate = 44100.0;
+    mInputFormat.mFormatID = kAudioFormatLinearPCM;
+    mInputFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+    mInputFormat.mBytesPerPacket = 8;
+    mInputFormat.mFramesPerPacket = 1;
+    mInputFormat.mBytesPerFrame = 8;
+    mInputFormat.mChannelsPerFrame = 2;
+    mInputFormat.mBitsPerChannel = 32;
+
+    CAStreamBasicDescription theOutputFormat(kAudioStreamAnyRate, kAudioFormatXiphVorbis,
+                                             kVorbisBytesPerPacket, kVorbisFramesPerPacket,
+                                             kVorbisBytesPerFrame, kVorbisChannelsPerFrame,
+                                             kVorbisBitsPerChannel, kVorbisFormatFlags);
+    AddOutputFormat(theOutputFormat);
+
+    mOutputFormat.mSampleRate = 44100.0;
+    mOutputFormat.mFormatID = kAudioFormatXiphVorbis;
+    mOutputFormat.mFormatFlags = kVorbisFormatFlags;
+    mOutputFormat.mBytesPerPacket = kVorbisBytesPerPacket;
+    mOutputFormat.mFramesPerPacket = kVorbisFramesPerPacket;
+    mOutputFormat.mBytesPerFrame = kVorbisBytesPerFrame;
+    mOutputFormat.mChannelsPerFrame = 2;
+    mOutputFormat.mBitsPerChannel = kVorbisBitsPerChannel;
+}
+
+CAVorbisEncoder::~CAVorbisEncoder()
+{
+    if (mCookie != NULL)
+        delete[] mCookie;
+
+    if (mCompressionInitialized) {
+        vorbis_block_clear(&mV_vb);
+        vorbis_dsp_clear(&mV_vd);
+
+        vorbis_comment_clear(&mV_vc);
+
+        vorbis_info_clear(&mV_vi);
+    }
+}
+
+void CAVorbisEncoder::Initialize(const AudioStreamBasicDescription* inInputFormat,
+                                 const AudioStreamBasicDescription* inOutputFormat,
+                                 const void* inMagicCookie, UInt32 inMagicCookieByteSize)
+{
+    dbg_printf("[  VE]  >> [%08lx] :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
+    if (inInputFormat)
+        dbg_printf("[  VE]   > [%08lx] :: InputFormat :" DBG_STREAMDESC_FMT "\n", (UInt32) this, DBG_STREAMDESC_FILL(inInputFormat));
+    if (inOutputFormat)
+        dbg_printf("[  VE]   > [%08lx] :: OutputFormat:" DBG_STREAMDESC_FMT "\n", (UInt32) this, DBG_STREAMDESC_FILL(inOutputFormat));
+
+    if(inInputFormat != NULL) {
+        SetCurrentInputFormat(*inInputFormat);
+    }
+
+    if(inOutputFormat != NULL) {
+        SetCurrentOutputFormat(*inOutputFormat);
+    }
+
+    if ((mInputFormat.mSampleRate != mOutputFormat.mSampleRate) ||
+        (mInputFormat.mChannelsPerFrame != mOutputFormat.mChannelsPerFrame) ||
+        (mInputFormat.mSampleRate == 0.0)) {
+        CODEC_THROW(kAudioCodecUnsupportedFormatError);
+    }
+
+    BDCInitialize(kVorbisEncoderBufferSize);
+
+    InitializeCompressionSettings();
+
+    FixFormats();
+
+    XCACodec::Initialize(inInputFormat, inOutputFormat, inMagicCookie, inMagicCookieByteSize);
+
+    dbg_printf("[  VE]  <  [%08lx] :: InputFormat :" DBG_STREAMDESC_FMT "\n", (UInt32) this, DBG_STREAMDESC_FILL(&mInputFormat));
+    dbg_printf("[  VE]  <  [%08lx] :: OutputFormat:" DBG_STREAMDESC_FMT "\n", (UInt32) this, DBG_STREAMDESC_FILL(&mOutputFormat));
+    dbg_printf("[  VE] <.. [%08lx] :: Initialize(%d, %d, %d)\n", (UInt32) this, inInputFormat != NULL, inOutputFormat != NULL, inMagicCookieByteSize != 0);
+}
+
+void CAVorbisEncoder::Uninitialize()
+{
+    dbg_printf("[  VE]  >> [%08lx] :: Uninitialize()\n", (UInt32) this);
+    BDCUninitialize();
+
+    XCACodec::Uninitialize();
+    dbg_printf("[  VE] <.. [%08lx] :: Uninitialize()\n", (UInt32) this);
+}
+
+/*
+ * Property selectors TODO (?):
+ *  'gcsc' - ?
+ *  'acps' - ?
+ */
+
+
+void CAVorbisEncoder::GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData)
+{
+    dbg_printf("[  VE]  >> [%08lx] :: GetProperty('%4.4s') (%d)\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID), inPropertyID == kAudioCodecPropertyFormatCFString);
+    switch(inPropertyID)
+    {
+
+        /*
+    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 kAudioCodecPropertyAvailableNumberChannels:
+        if(ioPropertyDataSize == sizeof(UInt32) * 1) {
+            (reinterpret_cast<UInt32*>(outPropertyData))[0] = 0xffffffff;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyAvailableBitRateRange:
+        if (ioPropertyDataSize == sizeof(AudioValueRange) * 1) {
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMinimum = 1.0;
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMaximum = 480.0;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyPrimeMethod:
+        if(ioPropertyDataSize == sizeof(UInt32)) {
+            *reinterpret_cast<UInt32*>(outPropertyData) = (UInt32)kAudioCodecPrimeMethod_None;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyPrimeInfo:
+        if(ioPropertyDataSize == sizeof(AudioCodecPrimeInfo) ) {
+            (reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->leadingFrames = 0;
+            (reinterpret_cast<AudioCodecPrimeInfo*>(outPropertyData))->trailingFrames = 0;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+#if !defined(NO_ADV_PROPS) || NO_ADV_PROPS == 0
+    case kAudioCodecPropertyApplicableInputSampleRates:
+        if (ioPropertyDataSize == sizeof(AudioValueRange)) {
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMinimum = 0.0;
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMaximum = 0.0;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyApplicableOutputSampleRates:
+        if (ioPropertyDataSize == sizeof(AudioValueRange)) {
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMinimum = 0.0;
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMaximum = 0.0;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+#endif
+
+    case kAudioCodecPropertyAvailableInputSampleRates:
+        if (ioPropertyDataSize == sizeof(AudioValueRange)) {
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMinimum = 0.0;
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMaximum = 0.0;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyAvailableOutputSampleRates:
+        if (ioPropertyDataSize == sizeof(AudioValueRange)) {
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMinimum = 0.0;
+            (reinterpret_cast<AudioValueRange*>(outPropertyData))->mMaximum = 0.0;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+#if !defined(NO_ACS) || NO_ACS == 0
+    case kAudioCodecPropertySettings:
+        if (ioPropertyDataSize == sizeof(CFDictionaryRef)) {
+            
+            BuildSettings(outPropertyData);
+            
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+#endif
+
+        
+    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))
+        {
+            if (mIsInitialized) {
+                long long_blocksize = (reinterpret_cast<long *>(mV_vi.codec_setup))[1];
+                *reinterpret_cast<UInt32*>(outPropertyData) = long_blocksize;
+                //*reinterpret_cast<UInt32*>(outPropertyData) = 0;
+            } else {
+                *reinterpret_cast<UInt32*>(outPropertyData) = 0;
+            }
+        }
+        else
+        {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyMaximumPacketByteSize:
+        if(ioPropertyDataSize == sizeof(UInt32)) {
+            *reinterpret_cast<UInt32*>(outPropertyData) = mCompressionInitialized ? kVorbisFormatMaxBytesPerPacket : 0;
+            //*reinterpret_cast<UInt32*>(outPropertyData) = mCompressionInitialized ? (64 * 1024) : 0;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyCurrentInputSampleRate:
+        if (ioPropertyDataSize == sizeof(Float64)) {
+            *reinterpret_cast<Float64*>(outPropertyData) = mInputFormat.mSampleRate;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyCurrentOutputSampleRate:
+        if (ioPropertyDataSize == sizeof(Float64)) {
+            *reinterpret_cast<Float64*>(outPropertyData) = mOutputFormat.mSampleRate;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecDoesSampleRateConversion:
+        if(ioPropertyDataSize == sizeof(UInt32)) {
+            *reinterpret_cast<UInt32*>(outPropertyData) = 0;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+    case kAudioCodecPropertyQualitySetting:
+        if(ioPropertyDataSize == sizeof(UInt32)) {
+            *reinterpret_cast<UInt32*>(outPropertyData) = kAudioCodecQuality_Max;
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+
+#if TARGET_OS_MAC || 1
+    case kAudioCodecPropertyFormatCFString:
+        {
+            if (ioPropertyDataSize != sizeof(CFStringRef))
+                CODEC_THROW(kAudioCodecBadPropertySizeError);
+            CABundleLocker lock;
+            CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Xiph Vorbis"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
+            *(CFStringRef*)outPropertyData = name;
+            break;
+        }
+
+    case kAudioCodecPropertyNameCFString:
+        {
+            if (ioPropertyDataSize != sizeof(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
+            CABundleLocker lock;
+            CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Xiph Vorbis encoder"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
+            *(CFStringRef*)outPropertyData = name;
+            break;
+        }
+
+    case kAudioCodecPropertyManufacturerCFString:
+        {
+            if (ioPropertyDataSize != sizeof(CFStringRef)) CODEC_THROW(kAudioCodecBadPropertySizeError);
+            CABundleLocker lock;
+            CFStringRef name = CFCopyLocalizedStringFromTableInBundle(CFSTR("Xiph.Org Foundation"), CFSTR("CodecNames"), GetCodecBundle(), CFSTR(""));
+            *(CFStringRef*)outPropertyData = name;
+            break;
+        }
+#endif
+
+    default:
+        ACBaseCodec::GetProperty(inPropertyID, ioPropertyDataSize, outPropertyData);
+    }
+    dbg_printf("[  VE] <.. [%08lx] :: GetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+}
+
+void CAVorbisEncoder::GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable)
+{
+    dbg_printf("[  VE]  >> [%08lx] :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+    switch(inPropertyID)
+    {
+        /*
+    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 kAudioCodecPropertyAvailableNumberChannels:
+        outPropertyDataSize = sizeof(UInt32) * 1; // [0xffffffff - any number]
+        outWritable = false;
+        break;
+
+    case kAudioCodecPropertyAvailableBitRateRange:
+        outPropertyDataSize = sizeof(AudioValueRange) * 1;
+        outWritable = false;
+        break;
+
+#if !defined(NO_ADV_PROPS) || NO_ADV_PROPS == 0
+    case kAudioCodecPropertyApplicableInputSampleRates:
+    case kAudioCodecPropertyApplicableOutputSampleRates:
+#endif
+
+    case kAudioCodecPropertyAvailableInputSampleRates:
+        outPropertyDataSize = sizeof(AudioValueRange);
+        outWritable = false;
+        break;
+
+    case kAudioCodecPropertyAvailableOutputSampleRates:
+        outPropertyDataSize = sizeof(AudioValueRange);
+        outWritable = false;
+        break;
+
+#if !defined(NO_ACS) || NO_ACS == 0
+    case kAudioCodecPropertySettings:
+        outPropertyDataSize = sizeof(CFDictionaryRef);
+        outWritable = true;
+        break;
+#endif
+
+        
+    case kAudioCodecPropertyRequiresPacketDescription:
+        outPropertyDataSize = sizeof(UInt32);
+        outWritable = false;
+        break;
+
+    case kAudioCodecPropertyHasVariablePacketByteSizes:
+        outPropertyDataSize = sizeof(UInt32);
+        outWritable = false;
+        break;
+
+    case kAudioCodecPropertyPacketFrameSize:
+        outPropertyDataSize = sizeof(UInt32);
+        outWritable = false;
+        break;
+
+    case kAudioCodecPropertyMaximumPacketByteSize:
+        outPropertyDataSize = sizeof(UInt32);
+        outWritable = false;
+        break;
+
+    case kAudioCodecPropertyCurrentInputSampleRate:
+    case kAudioCodecPropertyCurrentOutputSampleRate:
+        outPropertyDataSize = sizeof(Float64);
+        outWritable = false;
+        break;
+
+    case kAudioCodecDoesSampleRateConversion:
+        outPropertyDataSize = sizeof(UInt32);
+        outWritable = false;
+        break;
+
+    case kAudioCodecPropertyQualitySetting:
+        outPropertyDataSize = sizeof(UInt32);
+        outWritable = true;
+        break;
+
+    default:
+        ACBaseCodec::GetPropertyInfo(inPropertyID, outPropertyDataSize, outWritable);
+        break;
+
+    }
+    dbg_printf("[  VE] <.. [%08lx] :: GetPropertyInfo('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+}
+
+void CAVorbisEncoder::SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData)
+{
+    dbg_printf("[  VE]  >> [%08lx] :: SetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+
+    switch(inPropertyID) {
+#if !defined(NO_ACS) || NO_ACS == 0
+    case kAudioCodecPropertySettings:
+        if (inPropertyDataSize == sizeof(CFDictionaryRef)) {
+            ApplySettings(inPropertyData);
+        } else {
+            CODEC_THROW(kAudioCodecBadPropertySizeError);
+        }
+        break;
+#endif
+
+    default:
+        ACBaseCodec::SetProperty(inPropertyID, inPropertyDataSize, inPropertyData);
+        break;
+    }
+    dbg_printf("[  VE] <.. [%08lx] :: SetProperty('%4.4s')\n", (UInt32) this, reinterpret_cast<char*> (&inPropertyID));
+}
+
+void CAVorbisEncoder::Reset()
+{
+    dbg_printf("[  VE] > > [%08lx] :: Reset()\n", (UInt32) this);
+    BDCReset();
+
+    XCACodec::Reset();
+    dbg_printf("[  VE] < < [%08lx] :: Reset()\n", (UInt32) this);
+}
+
+UInt32 CAVorbisEncoder::GetVersion() const
+{
+    return kCAVorbis_aenc_Version;
+}
+
+
+void CAVorbisEncoder::SetCurrentInputFormat(const AudioStreamBasicDescription& inInputFormat)
+{
+    if (!mIsInitialized) {
+        //	check to make sure the input format is legal
+        if ((inInputFormat.mFormatID != kAudioFormatLinearPCM) ||
+            !(((inInputFormat.mFormatFlags == kAudioFormatFlagsNativeFloatPacked) &&
+               (inInputFormat.mBitsPerChannel == 32)) ||
+              ((inInputFormat.mFormatFlags == (kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked)) &&
+               (inInputFormat.mBitsPerChannel == 16))))
+        {
+            dbg_printf("CAVorbisEncoder::SetFormats: only supports either 16 bit native endian signed integer or 32 bit native endian Core Audio floats for input\n");
+            CODEC_THROW(kAudioCodecUnsupportedFormatError);
+        }
+
+        //	tell our base class about the new format
+        XCACodec::SetCurrentInputFormat(inInputFormat);
+    } else {
+        CODEC_THROW(kAudioCodecStateError);
+    }
+}
+
+void CAVorbisEncoder::SetCurrentOutputFormat(const AudioStreamBasicDescription& inOutputFormat)
+{
+    if (!mIsInitialized) {
+        //	check to make sure the output format is legal
+        if (inOutputFormat.mFormatID != kAudioFormatXiphVorbis) {
+            dbg_printf("CAVorbisEncoder::SetFormats: only supports Xiph Vorbis for output\n");
+            CODEC_THROW(kAudioCodecUnsupportedFormatError);
+        }
+
+        //	tell our base class about the new format
+        XCACodec::SetCurrentOutputFormat(inOutputFormat);
+    } else {
+        CODEC_THROW(kAudioCodecStateError);
+    }
+}
+
+UInt32 CAVorbisEncoder::GetMagicCookieByteSize() const
+{
+    return mCookieSize;
+}
+
+void CAVorbisEncoder::GetMagicCookie(void* outMagicCookieData, UInt32& ioMagicCookieDataByteSize) const
+{
+    if (mCookie != NULL) {
+        ioMagicCookieDataByteSize = mCookieSize;
+        BlockMoveData(mCookie, outMagicCookieData, ioMagicCookieDataByteSize);
+    } else {
+        ioMagicCookieDataByteSize = 0;
+    }
+}
+
+void CAVorbisEncoder::SetMagicCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize)
+{
+    dbg_printf("[  VE]  >> [%08lx] :: SetMagicCookie()\n", (UInt32) this);
+    CODEC_THROW(kAudioCodecIllegalOperationError);
+    dbg_printf("[  VE] <.. [%08lx] :: SetMagicCookie()\n", (UInt32) this);
+}
+
+void CAVorbisEncoder::SetCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize)
+{
+#if 0
+    if (mCookie != NULL)
+        delete[] mCookie;
+
+    mCookieSize = inMagicCookieDataByteSize;
+    if (inMagicCookieDataByteSize != 0) {
+        mCookie = new Byte[inMagicCookieDataByteSize];
+        BlockMoveData(inMagicCookieData, mCookie, inMagicCookieDataByteSize);
+    } else {
+        mCookie = NULL;
+    }
+#endif /* 0 */
+}
+
+
+
+void CAVorbisEncoder::FixFormats()
+{
+    dbg_printf("[  VE]  >> [%08lx] :: FixFormats()\n", (UInt32) this);
+    mOutputFormat.mSampleRate = mInputFormat.mSampleRate;
+    mOutputFormat.mBitsPerChannel = 0;
+    mOutputFormat.mBytesPerPacket = 0;
+    mOutputFormat.mFramesPerPacket = 0;
+
+    //long long_blocksize = (reinterpret_cast<long *>(mV_vi.codec_setup))[1];
+    //mOutputFormat.mFramesPerPacket = long_blocksize;
+
+    dbg_printf("[  VE] <.. [%08lx] :: FixFormats()\n", (UInt32) this);
+}
+
+
+Boolean CAVorbisEncoder::BuildSettings(void *outSettingsDict)
+{
+    const char *buffer = "<?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>name</key>"
+        "	<string>Xiph Vorbis Encoder</string>"
+        "	<key>parameters</key>"
+        "	<array>"
+        "		<dict>"
+        "			<key>available values</key>"
+        "			<array>"
+        "				<string>Variable Bit Rate (target quality)</string>"
+        "				<string>Average Bit Rate</string>"
+        "				<string>Variable Bit Rate (target bit rate)</string>"
+        "			</array>"
+        "			<key>current value</key>"
+        "			<integer>0</integer>"
+        "			<key>hint</key>"
+        "			<integer>5</integer>"
+        "			<key>key</key>"
+        "			<string>Target Format</string>"
+        "			<key>name</key>"
+        "			<string>Bit Rate Format</string>"
+        "			<key>summary</key>"
+        "			<string>Vorbis encoding bit rate management mode</string>"
+        "			<key>value type</key>"
+        "			<integer>10</integer>"
+        "		</dict>"
+        "		<dict>"
+        "			<key>available values</key>"
+        "			<array>"
+        "				<string>16</string>"
+        "				<string>20</string>"
+        "				<string>24</string>"
+        "				<string>28</string>"
+        "				<string>32</string>"
+        "				<string>40</string>"
+        "				<string>48</string>"
+        "				<string>56</string>"
+        "				<string>64</string>"
+        "				<string>80</string>"
+        "				<string>96</string>"
+        "				<string>112</string>"
+        "				<string>128</string>"
+        "				<string>160</string>"
+        "				<string>192</string>"
+        "				<string>224</string>"
+        "				<string>256</string>"
+        "				<string>320</string>"
+        "			</array>"
+        "			<key>current value</key>"
+        "			<integer>12</integer>"
+        "			<key>hint</key>"
+        "			<integer>4</integer>"
+        "			<key>key</key>"
+        "			<string>Bit Rate</string>"
+        "			<key>limited values</key>"
+        "			<array>"
+        "				<string>16</string>"
+        "				<string>20</string>"
+        "				<string>24</string>"
+        "				<string>28</string>"
+        "				<string>32</string>"
+        "				<string>40</string>"
+        "				<string>48</string>"
+        "				<string>56</string>"
+        "				<string>64</string>"
+        "				<string>80</string>"
+        "				<string>96</string>"
+        "				<string>112</string>"
+        "				<string>128</string>"
+        "				<string>160</string>"
+        "				<string>192</string>"
+        "				<string>224</string>"
+        "				<string>256</string>"
+        "				<string>320</string>"
+        "			</array>"
+        "			<key>name</key>"
+        "			<string>Target Bit Rate</string>"
+        "			<key>summary</key>"
+        "			<string>The bit rate of the Vorbis bitstream produced by the encoder</string>"
+        "			<key>unit</key>"
+        "			<string>kbps</string>"
+        "			<key>value type</key>"
+        "			<integer>10</integer>"
+        "		</dict>"
+        "		<dict>"
+        "			<key>available values</key>"
+        "			<array>"
+        "				<string>Recommended</string>"
+        "				<string>8.000</string>"
+        "				<string>11.025</string>"
+        "				<string>12.000</string>"
+        "				<string>16.000</string>"
+        "				<string>22.050</string>"
+        "				<string>24.000</string>"
+        "				<string>32.000</string>"
+        "				<string>44.100</string>"
+        "				<string>48.000</string>"
+        "				<string>52.000</string>"
+        "			</array>"
+        "			<key>current value</key>"
+        "			<integer>8</integer>"
+        "			<key>hint</key>"
+        "			<integer>6</integer>"
+        "			<key>key</key>"
+        "			<string>Sample Rate</string>"
+        "			<key>limited values</key>"
+        "			<array>"
+        "				<string>Recommended</string>"
+        "				<string>32.000</string>"
+        "				<string>44.100</string>"
+        "			</array>"
+        "			<key>name</key>"
+        "			<string>Sample Rate</string>"
+        "			<key>summary</key>"
+        "			<string>The sample rate of the Vorbis bitstream produced by the encoder</string>"
+        "			<key>unit</key>"
+        "			<string>kHz</string>"
+        "			<key>value type</key>"
+        "			<integer>10</integer>"
+        "		</dict>"
+        "		<dict>"
+        "			<key>available values</key>"
+        "			<array>"
+        "				<string>None</string>"
+        "				<string>Bit Rate</string>"
+        "				<string>Sample Rate</string>"
+        "			</array>"
+        "			<key>current value</key>"
+        "			<integer>1</integer>"
+        "			<key>hint</key>"
+        "			<integer>13</integer>"
+        "			<key>key</key>"
+        "			<string>Precedence</string>"
+        "			<key>name</key>"
+        "			<string>Precedence</string>"
+        "			<key>summary</key>"
+        "			<string>If either the bit rate or sample rate is allowed to override the other setting</string>"
+        "			<key>value type</key>"
+        "			<integer>10</integer>"
+        "		</dict>"
+        "		<dict>"
+        "			<key>available values</key>"
+        "			<array>"
+        "				<string>Good</string>"
+        "				<string>Better</string>"
+        "				<string>Best</string>"
+        "			</array>"
+        "			<key>current value</key>"
+        "			<integer>1</integer>"
+        "			<key>hint</key>"
+        "			<integer>1</integer>"
+        "			<key>key</key>"
+        "			<string>Quality</string>"
+        "			<key>name</key>"
+        "			<string>Quality</string>"
+        "			<key>summary</key>"
+        "			<string>The quality of the encoded Vorbis bitstream</string>"
+        "			<key>value type</key>"
+        "			<integer>10</integer>"
+        "		</dict>"
+        "		<dict>"
+        "			<key>available values</key>"
+        "			<array>"
+        "				<string>Mono</string>"
+        "				<string>Stereo</string>"
+        "				<string>2.0 (2.1?!)</string>"
+        "				<string>Quadraphonic</string>"
+        "				<string>5.0</string>"
+        "				<string>5.1</string>"
+        "			</array>"
+        "			<key>current value</key>"
+        "			<integer>1</integer>"
+        "			<key>hint</key>"
+        "			<integer>5</integer>"
+        "			<key>key</key>"
+        "			<string>Channel Configuration</string>"
+        "			<key>limited values</key>"
+        "			<array>"
+        "				<string>Stereo</string>"
+        "			</array>"
+        "			<key>name</key>"
+        "			<string>Channel Configuration</string>"
+        "			<key>summary</key>"
+        "			<string>The channel layout of the Vorbis bitstream produced by the encoder</string>"
+        "			<key>value type</key>"
+        "			<integer>10</integer>"
+        "		</dict>"
+        "	</array>"
+        "</dict>"
+        "</plist>";
+    CFDataRef data = CFDataCreate(NULL, (UInt8 *) buffer, strlen(buffer));
+    CFDictionaryRef dict = (CFDictionaryRef) CFPropertyListCreateFromXMLData(NULL, data, kCFPropertyListImmutable, NULL);
+    if (dict != NULL) {
+        *reinterpret_cast<CFDictionaryRef*>(outSettingsDict) = dict;
+        return true;
+    }
+    return false;
+}
+
+void CAVorbisEncoder::InitializeCompressionSettings()
+{
+    int ret = 0;
+
+    if (mCompressionInitialized) {
+        vorbis_block_clear(&mV_vb);
+        vorbis_dsp_clear(&mV_vd);
+
+        vorbis_info_clear(&mV_vi);
+
+        if (mCookie != NULL) {
+            delete[] mCookie;
+            mCookieSize = 0;
+            mCookie = NULL;
+        }
+    }
+
+    mCompressionInitialized = false;
+
+    vorbis_info_init(&mV_vi);
+
+    ret = vorbis_encode_init_vbr(&mV_vi, mOutputFormat.mChannelsPerFrame, lround(mOutputFormat.mSampleRate), 0.4);
+
+    if (ret)
+        CODEC_THROW(kAudioCodecUnspecifiedError);
+
+    vorbis_comment_init(&mV_vc);
+    vorbis_comment_add_tag(&mV_vc, "ENCODER", "XiphQT, CAVorbisEncoder.cpp $Rev$");
+
+    vorbis_analysis_init(&mV_vd, &mV_vi);
+    vorbis_block_init(&mV_vd, &mV_vb);
+
+
+    {
+        ogg_packet header, header_vc, header_cb;
+        vorbis_analysis_headerout(&mV_vd, &mV_vc, &header, &header_vc, &header_cb);
+
+        mCookieSize = header.bytes + header_vc.bytes + header_cb.bytes + 4 * 2 * sizeof(UInt32);
+        mCookie = new Byte[mCookieSize];
+
+        unsigned long *qtatom = reinterpret_cast<unsigned long*>(mCookie); // reinterpret_cast ?!?
+        *qtatom++ = EndianU32_NtoB(header.bytes + 2 * sizeof(UInt32));
+        *qtatom++ = EndianU32_NtoB(kCookieTypeVorbisHeader);
+        BlockMoveData(header.packet, qtatom, header.bytes);
+
+        qtatom = reinterpret_cast<unsigned long*>(mCookie + 2 * sizeof(UInt32) + header.bytes);
+        *qtatom++ = EndianU32_NtoB(header_vc.bytes + 2 * sizeof(UInt32));
+        *qtatom++ = EndianU32_NtoB(kCookieTypeVorbisComments);
+        BlockMoveData(header_vc.packet, qtatom, header_vc.bytes);
+
+        qtatom = reinterpret_cast<unsigned long*>(mCookie + 4 * sizeof(UInt32) + header.bytes + header_vc.bytes);
+        *qtatom++ = EndianU32_NtoB(header_cb.bytes + 2 * sizeof(UInt32));
+        *qtatom++ = EndianU32_NtoB(kCookieTypeVorbisCodebooks);
+        BlockMoveData(header_cb.packet, qtatom, header_cb.bytes);
+
+        qtatom = reinterpret_cast<unsigned long*>(mCookie + 6 * sizeof(UInt32) + header.bytes + header_vc.bytes + header_cb.bytes);
+        *qtatom++ = EndianU32_NtoB(2 * sizeof(UInt32));
+        *qtatom++ = EndianU32_NtoB(kAudioTerminatorAtomType);
+    }
+
+    dbg_printf("[  VE] < > [%08lx] :: InitializeCompressionSettings() - bru: %ld, brn: %ld, brl: %ld, brw: %ld\n",
+               (UInt32) this, mV_vi.bitrate_upper, mV_vi.bitrate_nominal, mV_vi.bitrate_lower, mV_vi.bitrate_window);
+    mCompressionInitialized = true;
+}
+
+#pragma mark BDC handling
+
+void CAVorbisEncoder::BDCInitialize(UInt32 inInputBufferByteSize)
+{
+    XCACodec::BDCInitialize(inInputBufferByteSize);
+}
+
+void CAVorbisEncoder::BDCUninitialize()
+{
+    mVorbisFPList.clear();
+    mProducedPList.clear();
+
+    XCACodec::BDCUninitialize();
+}
+
+void CAVorbisEncoder::BDCReset()
+{
+    mVorbisFPList.clear();
+    mProducedPList.clear();
+
+    XCACodec::BDCReset();
+}
+
+void CAVorbisEncoder::BDCReallocate(UInt32 inInputBufferByteSize)
+{
+    mVorbisFPList.clear();
+    mProducedPList.clear();
+
+    XCACodec::BDCReallocate(inInputBufferByteSize);
+}
+
+
+void CAVorbisEncoder::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 CAVorbisEncoder::ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
+                                             AudioStreamPacketDescription* outPacketDescription)
+{
+    dbg_printf("[  VE]  >> [%08lx] CAVorbisEncoder :: ProduceOutputPackets(%ld [%ld] %d)\n", (UInt32) this, ioNumberPackets, ioOutputDataByteSize, outPacketDescription != NULL);
+
+    UInt32 theAnswer = kAudioCodecProduceOutputPacketSuccess;
+
+    if (!mIsInitialized)
+        CODEC_THROW(kAudioCodecStateError);
+
+    UInt32 frames = 0;
+    UInt32 fout = 0; //frames produced
+    UInt32 bout = 0; //bytes produced
+    UInt32 bspace = ioOutputDataByteSize;
+    ogg_packet op;
+
+    while (fout < ioNumberPackets && !mEOSHit) {
+        if (!mProducedPList.empty()) {
+            ogg_packet &op_left = mProducedPList.front();
+            if (op_left.bytes > bspace) {
+                ioNumberPackets = fout;
+                ioOutputDataByteSize = bout;
+                theAnswer = kAudioCodecNotEnoughBufferSpaceError;
+                dbg_printf("[  VE] <.! [%08lx] CAVorbisEncoder :: ProduceOutputPackets(%ld [%ld]) = %ld\n", (UInt32) this,
+                           ioNumberPackets, ioOutputDataByteSize, theAnswer);
+                return theAnswer;
+            }
+
+            BlockMoveData(op_left.packet, &((static_cast<Byte *>(outOutputData))[bout]), op_left.bytes);
+            outPacketDescription[fout].mStartOffset = bout;
+            outPacketDescription[fout].mVariableFramesInPacket = op_left.granulepos - last_granulepos;
+            outPacketDescription[fout].mDataByteSize = op_left.bytes;
+            last_granulepos = op_left.granulepos;
+            fout++;
+            bout += op_left.bytes;
+            bspace -= op_left.bytes;
+            if (op_left.e_o_s != 0)
+                mEOSHit = true;
+            mProducedPList.erase(mProducedPList.begin());
+            continue;
+        } else if (vorbis_bitrate_flushpacket(&mV_vd, &op)) {
+            if (op.bytes > bspace) {
+                ioNumberPackets = fout;
+                ioOutputDataByteSize = bout;
+                theAnswer = kAudioCodecNotEnoughBufferSpaceError;
+                mProducedPList.push_back(op);
+                dbg_printf("[  VE] <.! [%08lx] CAVorbisEncoder :: ProduceOutputPackets(%ld [%ld]) = %ld\n", (UInt32) this,
+                           ioNumberPackets, ioOutputDataByteSize, theAnswer);
+                return theAnswer;
+            }
+
+            BlockMoveData(op.packet, &((static_cast<Byte *>(outOutputData))[bout]), op.bytes);
+            outPacketDescription[fout].mStartOffset = bout;
+            outPacketDescription[fout].mVariableFramesInPacket = op.granulepos - last_granulepos;
+            outPacketDescription[fout].mDataByteSize = op.bytes;
+            last_granulepos = op.granulepos;
+            fout++;
+            bout += op.bytes;
+            bspace -= op.bytes;
+            if (op.e_o_s != 0)
+                mEOSHit = true;
+            continue;
+        } else if (vorbis_analysis_blockout(&mV_vd, &mV_vb) == 1) {
+            vorbis_analysis(&mV_vb, NULL);
+            vorbis_bitrate_addblock(&mV_vb);
+            continue;
+        }
+
+        // get next block
+        if (mVorbisFPList.empty()) {
+            if (fout == 0) {
+                ioNumberPackets = fout;
+                ioOutputDataByteSize = bout;
+                theAnswer = kAudioCodecProduceOutputPacketNeedsMoreInputData;
+                dbg_printf("[  VE] <!. [%08lx] CAVorbisEncoder :: ProduceOutputPackets(%ld [%ld]) = %ld\n", (UInt32) this,
+                           ioNumberPackets, ioOutputDataByteSize, theAnswer);
+                return theAnswer;
+            }
+            break;
+        }
+
+        VorbisFramePacket &sfp = mVorbisFPList.front();
+        if (sfp.frames > 0) {
+            float **buffer = vorbis_analysis_buffer(&mV_vd, sfp.frames);
+            void *inData = mBDCBuffer.GetData();
+            int j = 0, i = 0;
+
+            if (mInputFormat.mFormatFlags & kAudioFormatFlagIsSignedInteger) {
+                for (j = 0; j < mOutputFormat.mChannelsPerFrame; j++) {
+                    SInt16 *theInputData = static_cast<SInt16*> (inData) + j;
+                    float *theOutputData = buffer[j];
+                    for (i = 0; i < sfp.frames; i++) {
+                        *theOutputData++ = *theInputData / 32768.0f;
+                        theInputData += mInputFormat.mChannelsPerFrame;
+                    }
+                }
+            } else {
+                for (j = 0; j < mOutputFormat.mChannelsPerFrame; j++) {
+                    float *theInputData = static_cast<float*> (inData) + j;
+                    float *theOutputData = buffer[j];
+                    for (i = 0; i < sfp.frames; i++) {
+                        *theOutputData++ = *theInputData;
+                        theInputData += mInputFormat.mChannelsPerFrame;
+                    }
+                }
+            }
+        }
+
+        vorbis_analysis_wrote(&mV_vd, sfp.frames);
+        mBDCBuffer.Zap(sfp.bytes);
+        sfp.frames = sfp.left = 0;
+        mVorbisFPList.erase(mVorbisFPList.begin());
+    }
+
+    ioOutputDataByteSize = bout; //???
+    ioNumberPackets = fout;
+
+    //theAnswer = (!mProducedPList.empty() || !BufferIsEmpty()) ? kAudioCodecProduceOutputPacketSuccessHasMore
+    theAnswer = (!mProducedPList.empty() || !mVorbisFPList.empty()) ? kAudioCodecProduceOutputPacketSuccessHasMore
+        : kAudioCodecProduceOutputPacketSuccess; // what about possible data inside the vorbis lib (if ..._flushpacket() returns more than 1 packet) ??
+
+    if (mEOSHit)
+        theAnswer = kAudioCodecProduceOutputPacketAtEOF;
+    dbg_printf("[  VE] <.. [%08lx] CAVorbisEncoder :: ProduceOutputPackets(%ld [%ld]) = %ld\n",
+               (UInt32) this, ioNumberPackets, ioOutputDataByteSize, theAnswer);
+    return theAnswer;
+}


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

Copied: trunk/xiph-qt/CAVorbis/src/CAVorbisEncoder.h (from rev 11397, trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h)
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisDecoder.h	2006-05-10 13:51:49 UTC (rev 11397)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisEncoder.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,143 @@
+/*
+ *  CAVorbisEncoder.h
+ *
+ *    CAVorbisEncoder class definition.
+ *
+ *
+ *  Copyright (c) 2006  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(__CAVorbisEncoder_h__)
+#define __CAVorbisEncoder_h__
+
+
+#include "XCACodec.h"
+
+#include <Ogg/ogg.h>
+#include <Vorbis/codec.h>
+
+#include <vector>
+
+
+class CAVorbisEncoder:
+public XCACodec
+{
+ public:
+    CAVorbisEncoder();
+    virtual ~CAVorbisEncoder();
+
+    virtual void        Initialize(const AudioStreamBasicDescription* inInputFormat,
+                                   const AudioStreamBasicDescription* inOutputFormat,
+                                   const void* inMagicCookie, UInt32 inMagicCookieByteSize);
+    virtual void        Uninitialize();
+    virtual void        Reset();
+
+    virtual UInt32      ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
+                                             AudioStreamPacketDescription* outPacketDescription);
+
+    virtual void        GetProperty(AudioCodecPropertyID inPropertyID, UInt32& ioPropertyDataSize, void* outPropertyData);
+    virtual void        GetPropertyInfo(AudioCodecPropertyID inPropertyID, UInt32& outPropertyDataSize, bool& outWritable);
+    virtual void        SetProperty(AudioCodecPropertyID inPropertyID, UInt32 inPropertyDataSize, const void* inPropertyData);
+
+    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 { return 0; };
+    virtual Boolean     GenerateFrames() { return false; };
+    virtual void        OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset,
+                                     AudioStreamPacketDescription* outPacketDescription) const {};
+    virtual void        Zap(UInt32 inFrames) {};
+
+    virtual UInt32      InPacketsConsumed() const { return 0; };
+
+    void                SetCookie(const void* inMagicCookieData, UInt32 inMagicCookieDataByteSize);
+    virtual void        InitializeCompressionSettings();
+
+    virtual void        FixFormats();
+
+ private:
+    Boolean             BuildSettings(void *outSettingsDict);
+
+ protected:
+    Byte* mCookie;
+    UInt32 mCookieSize;
+
+    Boolean mCompressionInitialized;
+    Boolean mEOSHit;
+
+    vorbis_info mV_vi;
+    vorbis_comment mV_vc;
+    vorbis_dsp_state mV_vd;
+    vorbis_block mV_vb;
+
+    ogg_int64_t last_granulepos;
+    ogg_int64_t last_packetno; // do I need this one?
+
+    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;
+    typedef std::vector<ogg_packet> VorbisPacketList;
+    VorbisPacketList mProducedPList;
+
+    //UInt32 mFullInPacketsZapped;
+
+
+    enum {
+        kVorbisBytesPerPacket = 0,
+        kVorbisFramesPerPacket = 0,
+        kVorbisFramesPerPacketReported = 8192,
+        kVorbisBytesPerFrame = 0,
+        kVorbisChannelsPerFrame = 0,
+        kVorbisBitsPerChannel = 0,
+        kVorbisFormatFlags = 0,
+
+        /* Just a funny number, and only roughly valid for the 'Xiph (Ogg-Framed) Vorbis'. */
+        kVorbisFormatMaxBytesPerPacket = 255 * 255,
+
+        kVorbisEncoderBufferSize = 256 * 1024
+    };
+};
+
+#endif /* __CAVorbisEncoder_h__ */

Copied: trunk/xiph-qt/CAVorbis/src/CAVorbisEncoderPublic.r (from rev 11397, trunk/xiph-qt/CAVorbis/src/CAVorbisDecoderPublic.r)
===================================================================
--- trunk/xiph-qt/CAVorbis/src/CAVorbisDecoderPublic.r	2006-05-10 13:51:49 UTC (rev 11397)
+++ trunk/xiph-qt/CAVorbis/src/CAVorbisEncoderPublic.r	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,57 @@
+/*
+ *  CAVorbisEncoderPublic.r
+ *
+ *    Information bit definitions for the 'thng' resource.
+ *
+ *
+ *  Copyright (c) 2006  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			-17118
+#define COMP_TYPE		'aenc'
+#define COMP_SUBTYPE		kAudioFormatXiphVorbis
+#define COMP_MANUF		'Xiph'
+#define VERSION			kCAVorbis_aenc_Version
+#define NAME			"Xiph Vorbis Encoder"
+#define DESCRIPTION		"An AudioCodec that encodes linear PCM data into Xiph Vorbis"
+#define ENTRY_POINT		"CAVorbisEncoderEntry"
+
+#define kPrimaryResourceID               -17118
+#define kComponentType                   'aenc'
+#define kComponentSubtype                kAudioFormatXiphVorbis
+#define kComponentManufacturer           'Xiph'
+#define kComponentFlags                  0
+#define kComponentVersion                kCAVorbis_aenc_Version
+#define kComponentName                   "Xiph Vorbis"
+#define kComponentInfo                   "An AudioCodec that encodes linear PCM data into Xiph Vorbis"
+#define kComponentEntryPoint             "CAVorbisEncoderEntry"
+#define kComponentPublicResourceMapType	 0
+#define kComponentIsThreadSafe           1
+
+#include "XCAResources.r"

Modified: trunk/xiph-qt/CAVorbis/src/vorbis_entrypoints.cpp
===================================================================
--- trunk/xiph-qt/CAVorbis/src/vorbis_entrypoints.cpp	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAVorbis/src/vorbis_entrypoints.cpp	2006-11-12 14:44:51 UTC (rev 12093)
@@ -30,6 +30,7 @@
 
 #include "CAVorbisDecoder.h"
 #include "CAOggVorbisDecoder.h"
+#include "CAVorbisEncoder.h"
 
 #include "ACCodecDispatch.h"
 
@@ -44,3 +45,10 @@
 {
     return ACCodecDispatch(inParameters, inThis);
 }
+
+extern "C"
+ComponentResult	CAVorbisEncoderEntry(ComponentParameters* inParameters, CAVorbisEncoder* inThis)
+{
+    return ACCodecDispatch(inParameters, inThis);
+}
+

Modified: trunk/xiph-qt/CAVorbis/src/vorbis_versions.h
===================================================================
--- trunk/xiph-qt/CAVorbis/src/vorbis_versions.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/CAVorbis/src/vorbis_versions.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -33,9 +33,11 @@
 
 
 #ifdef DEBUG
-#define kCAVorbis_adec_Version		(0x00FF0105)
+#define kCAVorbis_adec_Version		(0x00FF0107)
+#define kCAVorbis_aenc_Version		(0x00FF0101)
 #else
-#define kCAVorbis_adec_Version		(0x00000105)
+#define kCAVorbis_adec_Version		(0x00000107)
+#define kCAVorbis_aenc_Version		(0x00000101)
 #endif /* DEBUG */
 
 

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


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

Added: trunk/xiph-qt/OggExport/Info.plist
===================================================================
--- trunk/xiph-qt/OggExport/Info.plist	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/Info.plist	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,30 @@
+<?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>OggExport</string>
+	<key>CFBundleGetInfoString</key>
+	<string>QuickTime Ogg Exporter Component 0.1.1, Copyright © 2006 Arek Korbik</string>
+	<key>CFBundleIconFile</key>
+	<string></string>
+	<key>CFBundleIdentifier</key>
+	<string>org.xiph.xiph-qt.oggexport</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleSignature</key>
+	<string>spit</string>
+	<key>CFBundleVersion</key>
+	<string>0.1.1</string>
+	<key>CFBundleShortVersionString</key>
+	<string>0.1.1</string>
+	<key>NSHumanReadableCopyright</key>
+	<string>QuickTime Ogg Exporter Component 0.1.1, Copyright © 2006 Arek Korbik</string>
+	<key>CSResourcesFileMapped</key>
+	<true/>
+</dict>
+</plist>


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


Added: trunk/xiph-qt/OggExport/OggExport.xcodeproj/project.pbxproj
===================================================================
--- trunk/xiph-qt/OggExport/OggExport.xcodeproj/project.pbxproj	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/OggExport.xcodeproj/project.pbxproj	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,372 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 42;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		739BE4490AFE641A009300B9 /* stream_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 739BE4460AFE641A009300B9 /* stream_audio.c */; };
+		73C738510AFB516A00E8ACC3 /* OggExport.c in Sources */ = {isa = PBXBuildFile; fileRef = 73C7384E0AFB516A00E8ACC3 /* OggExport.c */; };
+		73C738570AFB53A500E8ACC3 /* OggExport.r in Rez */ = {isa = PBXBuildFile; fileRef = 73C738540AFB538100E8ACC3 /* OggExport.r */; };
+		73C738670AFB597700E8ACC3 /* PkgInfo in CopyFiles */ = {isa = PBXBuildFile; fileRef = 73C738580AFB540500E8ACC3 /* PkgInfo */; };
+		73C738760AFB62F600E8ACC3 /* Ogg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73C738750AFB62F600E8ACC3 /* Ogg.framework */; };
+		73C738790AFB632200E8ACC3 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73C738770AFB632200E8ACC3 /* CoreFoundation.framework */; };
+		73C7387A0AFB632200E8ACC3 /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73C738780AFB632200E8ACC3 /* QuickTime.framework */; };
+		73C739170AFB87DE00E8ACC3 /* OggExport.nib in Resources */ = {isa = PBXBuildFile; fileRef = 73C739160AFB87DE00E8ACC3 /* OggExport.nib */; };
+		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 PBXCopyFilesBuildPhase section */
+		73C738650AFB594800E8ACC3 /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = Contents;
+			dstSubfolderSpec = 1;
+			files = (
+				73C738670AFB597700E8ACC3 /* 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 /* OggExport_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OggExport_Prefix.pch; sourceTree = "<group>"; };
+		730EBAFA0B0348DA003486CB /* stream_types_audio.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stream_types_audio.h; path = src/stream_types_audio.h; sourceTree = "<group>"; };
+		730EBB200B0377EC003486CB /* fccs.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = fccs.h; path = ../common/fccs.h; sourceTree = SOURCE_ROOT; };
+		739BE4450AFE641A009300B9 /* oggexport_versions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = oggexport_versions.h; path = src/oggexport_versions.h; sourceTree = "<group>"; };
+		739BE4460AFE641A009300B9 /* stream_audio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = stream_audio.c; path = src/stream_audio.c; sourceTree = "<group>"; };
+		739BE4470AFE641A009300B9 /* stream_audio.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = stream_audio.h; path = src/stream_audio.h; sourceTree = "<group>"; };
+		739BE4530AFE7E8D009300B9 /* data_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = data_types.h; path = ../common/data_types.h; sourceTree = SOURCE_ROOT; };
+		73C7384D0AFB516A00E8ACC3 /* exporter_types.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = exporter_types.h; path = src/exporter_types.h; sourceTree = "<group>"; };
+		73C7384E0AFB516A00E8ACC3 /* OggExport.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = OggExport.c; path = src/OggExport.c; sourceTree = "<group>"; };
+		73C7384F0AFB516A00E8ACC3 /* OggExport.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = OggExport.h; path = src/OggExport.h; sourceTree = "<group>"; };
+		73C738500AFB516A00E8ACC3 /* OggExportDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = OggExportDispatch.h; path = src/OggExportDispatch.h; sourceTree = "<group>"; };
+		73C738520AFB51CE00E8ACC3 /* OggExport.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; name = OggExport.exp; path = src/OggExport.exp; sourceTree = "<group>"; };
+		73C738540AFB538100E8ACC3 /* OggExport.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = OggExport.r; path = src/OggExport.r; sourceTree = "<group>"; };
+		73C738580AFB540500E8ACC3 /* PkgInfo */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = PkgInfo; sourceTree = "<group>"; };
+		73C738680AFB59B900E8ACC3 /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = icon.icns; path = ../resources/icon.icns; sourceTree = SOURCE_ROOT; };
+		73C738690AFB59B900E8ACC3 /* icon.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; name = icon.r; path = ../resources/icon.r; sourceTree = SOURCE_ROOT; };
+		73C738710AFB5BD500E8ACC3 /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../common/config.h; sourceTree = SOURCE_ROOT; };
+		73C738730AFB5BE900E8ACC3 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = debug.h; path = ../utils/debug.h; sourceTree = SOURCE_ROOT; };
+		73C738750AFB62F600E8ACC3 /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = /Library/Frameworks/Ogg.framework; sourceTree = "<absolute>"; };
+		73C738770AFB632200E8ACC3 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+		73C738780AFB632200E8ACC3 /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; };
+		73C739160AFB87DE00E8ACC3 /* OggExport.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = OggExport.nib; path = src/OggExport.nib; sourceTree = "<group>"; };
+		8D01CCD10486CAD60068D4B7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+		8D01CCD20486CAD60068D4B7 /* OggExport.component */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OggExport.component; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		8D01CCCD0486CAD60068D4B7 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */,
+				73C738760AFB62F600E8ACC3 /* Ogg.framework in Frameworks */,
+				73C738790AFB632200E8ACC3 /* CoreFoundation.framework in Frameworks */,
+				73C7387A0AFB632200E8ACC3 /* QuickTime.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		089C166AFE841209C02AAC07 /* OggExport */ = {
+			isa = PBXGroup;
+			children = (
+				08FB77ADFE841716C02AAC07 /* Source */,
+				089C167CFE841241C02AAC07 /* Resources */,
+				089C1671FE841209C02AAC07 /* External Frameworks and Libraries */,
+				19C28FB4FE9D528D11CA2CBB /* Products */,
+			);
+			name = OggExport;
+			sourceTree = "<group>";
+		};
+		089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = {
+			isa = PBXGroup;
+			children = (
+				73C738770AFB632200E8ACC3 /* CoreFoundation.framework */,
+				73C738780AFB632200E8ACC3 /* QuickTime.framework */,
+				73C738750AFB62F600E8ACC3 /* Ogg.framework */,
+				08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */,
+			);
+			name = "External Frameworks and Libraries";
+			sourceTree = "<group>";
+		};
+		089C167CFE841241C02AAC07 /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+				73C738680AFB59B900E8ACC3 /* icon.icns */,
+				73C738690AFB59B900E8ACC3 /* icon.r */,
+				73C738580AFB540500E8ACC3 /* PkgInfo */,
+				73C738540AFB538100E8ACC3 /* OggExport.r */,
+				8D01CCD10486CAD60068D4B7 /* Info.plist */,
+				089C167DFE841241C02AAC07 /* InfoPlist.strings */,
+			);
+			name = Resources;
+			sourceTree = "<group>";
+		};
+		08FB77ADFE841716C02AAC07 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				730EBB200B0377EC003486CB /* fccs.h */,
+				730EBAF90B0348B3003486CB /* audio */,
+				739BE4530AFE7E8D009300B9 /* data_types.h */,
+				739BE4450AFE641A009300B9 /* oggexport_versions.h */,
+				73C738730AFB5BE900E8ACC3 /* debug.h */,
+				73C738710AFB5BD500E8ACC3 /* config.h */,
+				73C738520AFB51CE00E8ACC3 /* OggExport.exp */,
+				73C7384D0AFB516A00E8ACC3 /* exporter_types.h */,
+				73C7384E0AFB516A00E8ACC3 /* OggExport.c */,
+				73C7384F0AFB516A00E8ACC3 /* OggExport.h */,
+				73C738500AFB516A00E8ACC3 /* OggExportDispatch.h */,
+				32BAE0B30371A71500C91783 /* OggExport_Prefix.pch */,
+				73C739160AFB87DE00E8ACC3 /* OggExport.nib */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		19C28FB4FE9D528D11CA2CBB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				8D01CCD20486CAD60068D4B7 /* OggExport.component */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		730EBAF90B0348B3003486CB /* audio */ = {
+			isa = PBXGroup;
+			children = (
+				730EBAFA0B0348DA003486CB /* stream_types_audio.h */,
+				739BE4460AFE641A009300B9 /* stream_audio.c */,
+				739BE4470AFE641A009300B9 /* stream_audio.h */,
+			);
+			name = audio;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		8D01CCC60486CAD60068D4B7 /* OggExport */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 4FADC23308B4156C00ABE55E /* Build configuration list for PBXNativeTarget "OggExport" */;
+			buildPhases = (
+				8D01CCC90486CAD60068D4B7 /* Resources */,
+				8D01CCCB0486CAD60068D4B7 /* Sources */,
+				8D01CCCD0486CAD60068D4B7 /* Frameworks */,
+				73C738550AFB539C00E8ACC3 /* Rez */,
+				73C738650AFB594800E8ACC3 /* CopyFiles */,
+				73C7386F0AFB5A5200E8ACC3 /* ShellScript */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = OggExport;
+			productInstallPath = "$(HOME)/Library/Bundles";
+			productName = OggExport;
+			productReference = 8D01CCD20486CAD60068D4B7 /* OggExport.component */;
+			productType = "com.apple.product-type.bundle";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		089C1669FE841209C02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 4FADC23708B4156C00ABE55E /* Build configuration list for PBXProject "OggExport" */;
+			hasScannedForEncodings = 1;
+			mainGroup = 089C166AFE841209C02AAC07 /* OggExport */;
+			projectDirPath = "";
+			targets = (
+				8D01CCC60486CAD60068D4B7 /* OggExport */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		8D01CCC90486CAD60068D4B7 /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				8D01CCCA0486CAD60068D4B7 /* InfoPlist.strings in Resources */,
+				73C739170AFB87DE00E8ACC3 /* OggExport.nib in Resources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+		73C738550AFB539C00E8ACC3 /* Rez */ = {
+			isa = PBXRezBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				73C738570AFB53A500E8ACC3 /* OggExport.r in Rez */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		73C7386F0AFB5A5200E8ACC3 /* 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 = (
+				73C738510AFB516A00E8ACC3 /* OggExport.c in Sources */,
+				739BE4490AFE641A009300B9 /* stream_audio.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 */
+		4FADC23408B4156C00ABE55E /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				EXPORTED_SYMBOLS_FILE = src/OggExport.exp;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G4;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = OggExport_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(inherited)",
+					__MACOSX__,
+					"TARGET_REZ_CARBON_MACHO=1",
+					TARGET_OS_MAC,
+					TARGET_API_MAC_CARBON,
+				);
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/QuickTime";
+				OTHER_REZFLAGS = "$(OTHER_REZFLAGS) -D TARGET_REZ_MAC_PPC=1 -D BUILD_UNIVERSAL";
+				PRODUCT_NAME = OggExport;
+				WRAPPER_EXTENSION = component;
+				ZERO_LINK = YES;
+			};
+			name = Debug;
+		};
+		4FADC23508B4156C00ABE55E /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				EXPORTED_SYMBOLS_FILE = src/OggExport.exp;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_MODEL_TUNING = G4;
+				GCC_PRECOMPILE_PREFIX_HEADER = YES;
+				GCC_PREFIX_HEADER = OggExport_Prefix.pch;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(inherited)",
+					__MACOSX__,
+					"TARGET_REZ_CARBON_MACHO=1",
+					TARGET_OS_MAC,
+					TARGET_API_MAC_CARBON,
+				);
+				INFOPLIST_FILE = Info.plist;
+				INSTALL_PATH = "$(HOME)/Library/QuickTime";
+				OTHER_REZFLAGS = "$(OTHER_REZFLAGS) -D TARGET_REZ_MAC_PPC=1 -D BUILD_UNIVERSAL";
+				PRODUCT_NAME = OggExport;
+				WRAPPER_EXTENSION = component;
+			};
+			name = Release;
+		};
+		4FADC23808B4156C00ABE55E /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(LOCAL_LIBRARY_DIR)/Frameworks",
+				);
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				PREBINDING = NO;
+				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+				WARNING_CFLAGS = (
+					"$(inherited)",
+					"-Wall",
+				);
+			};
+			name = Debug;
+		};
+		4FADC23908B4156C00ABE55E /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ARCHS = (
+					ppc,
+					i386,
+				);
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(LOCAL_LIBRARY_DIR)/Frameworks",
+				);
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.4;
+				PREBINDING = NO;
+				SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+				WARNING_CFLAGS = (
+					"$(inherited)",
+					"-Wall",
+				);
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		4FADC23308B4156C00ABE55E /* Build configuration list for PBXNativeTarget "OggExport" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4FADC23408B4156C00ABE55E /* Debug */,
+				4FADC23508B4156C00ABE55E /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		4FADC23708B4156C00ABE55E /* Build configuration list for PBXProject "OggExport" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				4FADC23808B4156C00ABE55E /* Debug */,
+				4FADC23908B4156C00ABE55E /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 089C1669FE841209C02AAC07 /* Project object */;
+}

Added: trunk/xiph-qt/OggExport/OggExport_Prefix.pch
===================================================================
--- trunk/xiph-qt/OggExport/OggExport_Prefix.pch	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/OggExport_Prefix.pch	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,5 @@
+//
+// Prefix header for all source files of the 'OggExport' target in the 'OggExport' project.
+//
+
+#include <Carbon/Carbon.h>

Added: trunk/xiph-qt/OggExport/PkgInfo
===================================================================
--- trunk/xiph-qt/OggExport/PkgInfo	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/PkgInfo	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1 @@
+thngspit
\ No newline at end of file


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



Added: trunk/xiph-qt/OggExport/src/OggExport.c
===================================================================
--- trunk/xiph-qt/OggExport/src/OggExport.c	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/OggExport.c	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,1030 @@
+/*
+ *  OggExport.c
+ *
+ *    The main part of the OggExport component.
+ *
+ *
+ *  Copyright (c) 2006  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(__APPLE_CC__)
+#include <QuickTime/QuickTime.h>
+#else
+#include <QuickTimeComponents.h>
+#endif
+
+#include <Ogg/ogg.h>
+
+#include "OggExport.h"
+#include "debug.h"
+#include "exporter_types.h"
+
+#include "stream_audio.h"
+
+// stream-type handle functions
+#include "stream_audio.h"
+//#include "stream_video.h"
+
+static stream_format_handle_funcs s_formats[] = {
+#if defined(_HAVE__OE_AUDIO)
+    HANDLE_FUNCTIONS__AUDIO,
+#endif
+#if defined(_HAVE__OE_VIDEO)
+    HANDLE_FUNCTIONS__VIDEO,
+#endif
+
+    HANDLE_FUNCTIONS__NULL
+};
+
+
+#define USE_NIB_FILE 1
+
+/* component selector methods */
+pascal ComponentResult OggExportOpen(OggExportGlobalsPtr globals, ComponentInstance self);
+pascal ComponentResult OggExportClose(OggExportGlobalsPtr globals, ComponentInstance self);
+pascal ComponentResult OggExportVersion(OggExportGlobalsPtr globals);
+pascal ComponentResult OggExportGetComponentPropertyInfo(OggExportGlobalsPtr   globals,
+                                                         ComponentPropertyClass inPropClass,
+                                                         ComponentPropertyID    inPropID,
+                                                         ComponentValueType     *outPropType,
+                                                         ByteCount              *outPropValueSize,
+                                                         UInt32                 *outPropertyFlags);
+pascal ComponentResult OggExportGetComponentProperty(OggExportGlobalsPtr  globals,
+                                                     ComponentPropertyClass inPropClass,
+                                                     ComponentPropertyID    inPropID,
+                                                     ByteCount              inPropValueSize,
+                                                     ComponentValuePtr      outPropValueAddress,
+                                                     ByteCount              *outPropValueSizeUsed);
+pascal ComponentResult OggExportSetComponentProperty(OggExportGlobalsPtr  globals,
+                                                     ComponentPropertyClass inPropClass,
+                                                     ComponentPropertyID    inPropID,
+                                                     ByteCount              inPropValueSize,
+                                                     ConstComponentValuePtr inPropValueAddress);
+pascal ComponentResult OggExportToFile(OggExportGlobalsPtr globals, const FSSpec *theFilePtr,
+                                       Movie theMovie, Track onlyThisTrack, TimeValue startTime,
+                                       TimeValue duration);
+pascal ComponentResult OggExportToDataRef(OggExportGlobalsPtr globals, Handle dataRef, OSType dataRefType,
+                                          Movie theMovie, Track onlyThisTrack, TimeValue startTime, TimeValue duration);
+pascal ComponentResult OggExportFromProceduresToDataRef(OggExportGlobalsPtr globals, Handle dataRef, OSType dataRefType);
+pascal ComponentResult OggExportAddDataSource(OggExportGlobalsPtr globals, OSType trackType, TimeScale scale,
+                                              long *trackIDPtr, MovieExportGetPropertyUPP getPropertyProc,
+                                              MovieExportGetDataUPP getDataProc, void *refCon);
+pascal ComponentResult OggExportValidate(OggExportGlobalsPtr globals, Movie theMovie, Track onlyThisTrack, Boolean *valid);
+pascal ComponentResult OggExportSetProgressProc(OggExportGlobalsPtr globals, MovieProgressUPP proc, long refcon);
+
+
+#if USE_NIB_FILE
+static pascal OSStatus SettingsWindowEventHandler(EventHandlerCallRef inHandler, EventRef inEvent, void *inUserData);
+#endif
+
+pascal ComponentResult OggExportDoUserDialog(OggExportGlobalsPtr globals, Movie theMovie, Track onlyThisTrack,
+                                             TimeValue startTime, TimeValue duration, Boolean *canceledPtr);
+
+
+pascal ComponentResult OggExportGetSettingsAsAtomContainer(OggExportGlobalsPtr globals, QTAtomContainer *settings);
+pascal ComponentResult OggExportSetSettingsFromAtomContainer(OggExportGlobalsPtr globals, QTAtomContainer settings);
+pascal ComponentResult OggExportGetFileNameExtension(OggExportGlobalsPtr globals, OSType *extension);
+pascal ComponentResult OggExportGetShortFileTypeString(OggExportGlobalsPtr globals, Str255 typeString);
+pascal ComponentResult OggExportGetSourceMediaType(OggExportGlobalsPtr globals, OSType *mediaType);
+
+
+/* utility functions */
+static stream_format_handle_funcs* find_stream_support(OSType trackType, TimeScale scale,
+                                                       MovieExportGetPropertyUPP getPropertyProc,
+                                                       void *refCon);
+static ComponentResult OpenStream(OggExportGlobalsPtr globals, OSType trackType, TimeScale scale,
+                                  long *trackIDPtr, MovieExportGetPropertyUPP getPropertyProc,
+                                  MovieExportGetDataUPP getDataProc, void *refCon,
+                                  stream_format_handle_funcs *ff, StreamInfoPtr *out_si);
+static void _close_stream(OggExportGlobalsPtr globals, StreamInfoPtr si);
+static void CloseAllStreams(OggExportGlobalsPtr globals);
+
+static OSErr ConfigureQuickTimeMovieExporter(OggExportGlobalsPtr globals);
+static ComponentResult ConfigureStdComponents(OggExportGlobalsPtr globals);
+
+static ComponentResult mux_streams(OggExportGlobalsPtr globals, DataHandler data_h);
+
+
+
+#define CALLCOMPONENT_BASENAME()        OggExport
+#define CALLCOMPONENT_GLOBALS()         OggExportGlobalsPtr storage
+
+#define MOVIEEXPORT_BASENAME()          CALLCOMPONENT_BASENAME()
+#define MOVIEEXPORT_GLOBALS() 	        CALLCOMPONENT_GLOBALS()
+
+#define COMPONENT_UPP_SELECT_ROOT()	MovieExport
+#define COMPONENT_DISPATCH_FILE		"OggExportDispatch.h"
+
+#if !TARGET_OS_WIN32
+#include <CoreServices/Components.k.h>
+#include <QuickTime/QuickTimeComponents.k.h>
+#include <QuickTime/ImageCompression.k.h>   // for ComponentProperty selectors
+#include <QuickTime/ComponentDispatchHelper.c>
+#else
+#include <Components.k.h>
+#include <QuickTimeComponents.k.h>
+#include <ImageCompression.k.h>
+#include <ComponentDispatchHelper.c>
+#endif
+
+
+pascal ComponentResult OggExportOpen(OggExportGlobalsPtr globals, ComponentInstance self) {
+    ComponentDescription cd;
+    ComponentResult err;
+
+    dbg_printf("[  OE]  >> [%08lx] :: Open()\n", (UInt32) globals);
+
+    globals = (OggExportGlobalsPtr) NewPtrClear(sizeof(OggExportGlobals));
+    err = MemError();
+    if (!err) {
+        globals->self = self;
+        globals->use_hires_audio = false;
+
+        SetComponentInstanceStorage(self, (Handle) globals);
+
+        // Get the QuickTime Movie export component
+        // Because we use the QuickTime Movie export component, search for
+        // the 'MooV' exporter using the following ComponentDescription values
+        cd.componentType = MovieExportType;
+        cd.componentSubType = kQTFileTypeMovie;
+        cd.componentManufacturer = kAppleManufacturer;
+        cd.componentFlags = canMovieExportFromProcedures | movieExportMustGetSourceMediaType;
+        cd.componentFlagsMask = cd.componentFlags;
+
+        err = OpenAComponent(FindNextComponent(NULL, &cd), &globals->quickTimeMovieExporter);
+    }
+
+    dbg_printf("[  OE] <   [%08lx] :: Open()\n", (UInt32) globals);
+    return err;
+}
+
+
+pascal ComponentResult OggExportClose(OggExportGlobalsPtr globals, ComponentInstance self) {
+    dbg_printf("[  OE]  >> [%08lx] :: Close()\n", (UInt32) globals);
+
+    if (globals) {
+        if (globals->quickTimeMovieExporter)
+            CloseComponent(globals->quickTimeMovieExporter);
+
+        if (globals->streamInfoHandle) {
+            if (globals->streamCount > 0)
+                CloseAllStreams(globals);
+            DisposeHandle((Handle) globals->streamInfoHandle);
+        }
+
+        DisposePtr((Ptr) globals);
+    }
+
+    dbg_printf("[  OE] <   [%08lx] :: Close()\n", (UInt32) globals);
+    return noErr;
+}
+
+pascal ComponentResult OggExportVersion(OggExportGlobalsPtr globals) {
+#pragma unused(globals)
+    dbg_printf("[  OE]  >> [%08lx] :: Version()\n", (UInt32) globals);
+    dbg_printf("[  OE] <   [%08lx] :: Version()\n", (UInt32) globals);
+    return kOgg_spit__Version;
+}
+
+pascal ComponentResult OggExportGetComponentPropertyInfo(OggExportGlobalsPtr   globals,
+                                                         ComponentPropertyClass inPropClass,
+                                                         ComponentPropertyID    inPropID,
+                                                         ComponentValueType     *outPropType,
+                                                         ByteCount              *outPropValueSize,
+                                                         UInt32                 *outPropertyFlags)
+{
+    ComponentResult err = noErr;
+    dbg_printf("[  OE]  >> [%08lx] :: GetComponentPropertyInfo('%4.4s', '%4.4s')\n", (UInt32) globals, (char *) &inPropClass, (char *) &inPropID);
+    dbg_printf("[  OE] <   [%08lx] :: GetComponentPropertyInfo() = %ld\n", (UInt32) globals, err);
+    return err;
+}
+
+pascal ComponentResult OggExportGetComponentProperty(OggExportGlobalsPtr  globals,
+                                                     ComponentPropertyClass inPropClass,
+                                                     ComponentPropertyID    inPropID,
+                                                     ByteCount              inPropValueSize,
+                                                     ComponentValuePtr      outPropValueAddress,
+                                                     ByteCount              *outPropValueSizeUsed)
+{
+    dbg_printf("[  OE]  >> [%08lx] :: GetComponentProperty('%4.4s', '%4.4s', %ld)\n", (UInt32) globals, (char *) &inPropClass, (char *) &inPropID, inPropValueSize);
+    dbg_printf("[  OE] <   [%08lx] :: GetComponentProperty()\n", (UInt32) globals);
+    return noErr;
+}
+
+pascal ComponentResult OggExportSetComponentProperty(OggExportGlobalsPtr  globals,
+                                                     ComponentPropertyClass inPropClass,
+                                                     ComponentPropertyID    inPropID,
+                                                     ByteCount              inPropValueSize,
+                                                     ConstComponentValuePtr inPropValueAddress)
+{
+    ComponentResult err = noErr;
+    dbg_printf("[  OE]  >> [%08lx] :: SetComponentProperty('%4.4s', '%4.4s', %ld)\n", (UInt32) globals, (char *) &inPropClass, (char *) &inPropID, inPropValueSize);
+
+    switch (inPropClass) {
+    case kQTPropertyClass_MovieExporter:
+        switch (inPropID) {
+        case kQTMovieExporterPropertyID_EnableHighResolutionAudioFeatures:
+            {
+                Boolean use_hqa = globals->use_hires_audio;
+                if (inPropValueSize == sizeof(Boolean)) {
+                    use_hqa = *(Boolean *) inPropValueAddress;
+                } else if (inPropValueSize == sizeof(UInt8)) {
+                    use_hqa = (Boolean) *(UInt8 *) inPropValueAddress;
+                } else {
+                    err = kQTPropertyBadValueSizeErr;
+                    break;
+                }
+
+                if (use_hqa && use_hqa != globals->use_hires_audio) {
+                    err = QTSetComponentProperty(globals->quickTimeMovieExporter, kQTPropertyClass_MovieExporter,
+                                                 kQTMovieExporterPropertyID_EnableHighResolutionAudioFeatures,
+                                                 inPropValueSize, inPropValueAddress);
+                    if (err)
+                        break;
+                }
+                globals->use_hires_audio = use_hqa;
+            }
+            break;
+
+        default:
+            err = kQTPropertyNotSupportedErr;
+            break;
+        }
+        break;
+
+    default:
+        err = kQTPropertyNotSupportedErr;
+        break;
+    }
+
+    dbg_printf("[  OE] <   [%08lx] :: SetComponentProperty() = %ld\n", (UInt32) globals, err);
+    return err;
+}
+
+pascal ComponentResult OggExportValidate(OggExportGlobalsPtr globals, Movie theMovie, Track onlyThisTrack, Boolean *valid) {
+    OSErr err;
+
+    dbg_printf("[  OE]  >> [%08lx] :: Validate()\n", (UInt32) globals);
+
+    // The QT movie export component must be cool with this before we can be
+    err = MovieExportValidate(globals->quickTimeMovieExporter, theMovie, onlyThisTrack, valid);
+    if (!err) {
+        if (*valid == true) {
+
+            if (onlyThisTrack == NULL) {
+                if (GetMovieIndTrackType(theMovie, 1, VisualMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly) == NULL &&
+                    GetMovieIndTrackType(theMovie, 1, AudioMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly) == NULL)
+                    *valid = false;
+            } else {
+                MediaHandler mh = GetMediaHandler(GetTrackMedia(onlyThisTrack));
+                Boolean hasIt = false;
+
+                MediaHasCharacteristic(mh, VisualMediaCharacteristic, &hasIt);
+                if (hasIt == false)
+                    MediaHasCharacteristic(mh, AudioMediaCharacteristic, &hasIt);
+                if (hasIt == false)
+                    *valid = false;
+            }
+        }
+    }
+
+    dbg_printf("[  OE] <   [%08lx] :: Validate() = %d, %d\n", (UInt32) globals, err, *valid);
+    return err;
+}
+
+
+
+pascal ComponentResult OggExportToFile(OggExportGlobalsPtr globals, const FSSpec *theFilePtr,
+                                       Movie theMovie, Track onlyThisTrack, TimeValue startTime,
+                                       TimeValue duration)
+{
+    AliasHandle alias;
+    ComponentResult err;
+
+    dbg_printf("[  OE]  >> [%08lx] :: ToFile(%d, %ld, %ld)\n", (UInt32) globals, onlyThisTrack != NULL, startTime, duration);
+
+    err = QTNewAlias(theFilePtr, &alias, true);
+    if (!err) {
+        err = MovieExportToDataRef(globals->self, (Handle) alias, rAliasType, theMovie, onlyThisTrack, startTime, duration);
+
+        DisposeHandle((Handle) alias);
+    }
+
+    dbg_printf("[  OE] <   [%08lx] :: ToFile()\n", (UInt32) globals);
+    return err;
+}
+
+pascal ComponentResult OggExportToDataRef(OggExportGlobalsPtr globals, Handle dataRef, OSType dataRefType,
+                                          Movie theMovie, Track onlyThisTrack, TimeValue startTime, TimeValue duration)
+{
+    TimeScale scale;
+    MovieExportGetPropertyUPP getSoundPropertyProc = NULL;
+    MovieExportGetDataUPP getSoundDataProc = NULL;
+    void *audioRefCon;
+    long trackID;
+    ComponentResult err;
+
+    dbg_printf("[  OE]  >> [%08lx] :: ToDataRef(%d, %ld, %ld)\n", (UInt32) globals, onlyThisTrack != NULL, startTime, duration);
+
+    // TODO: loop for all tracks
+
+    /*
+    err = MovieExportNewGetDataAndPropertiesProcs(globals->quickTimeMovieExporter, VideoMediaType, &scale, theMovie,
+                                                  onlyThisTrack, startTime, duration, &getVideoPropertyProc,
+                                                  &getVideoDataProc, &videoRefCon);
+    */
+
+    err = MovieExportNewGetDataAndPropertiesProcs(globals->quickTimeMovieExporter, SoundMediaType, &scale, theMovie,
+                                                  onlyThisTrack, startTime, duration, &getSoundPropertyProc,
+                                                  &getSoundDataProc, &audioRefCon);
+
+    dbg_printf("[  OE]   = [%08lx] :: ToDataRef() = %ld\n", (UInt32) globals, err);
+    if (!err) {
+        // ** Add the audio data source **
+        err = MovieExportAddDataSource(globals->self, SoundMediaType, scale, &trackID, getSoundPropertyProc, getSoundDataProc, audioRefCon);
+        if (!err) {
+            err = MovieExportFromProceduresToDataRef(globals->self, dataRef, dataRefType);
+        }
+    }
+
+    if (getSoundPropertyProc || getSoundDataProc)
+        MovieExportDisposeGetDataAndPropertiesProcs(globals->quickTimeMovieExporter, getSoundPropertyProc, getSoundDataProc, audioRefCon);
+
+    dbg_printf("[  OE] <   [%08lx] :: ToDataRef() = 0x%04lx, %ld\n", (UInt32) globals, err, trackID);
+    return err;
+}
+
+pascal ComponentResult OggExportFromProceduresToDataRef(OggExportGlobalsPtr globals, Handle dataRef, OSType dataRefType)
+{
+    DataHandler    dataH = NULL;
+    ComponentResult err;
+
+    dbg_printf("[  OE]  >> [%08lx] :: FromProceduresToDataRef()\n", (UInt32) globals);
+
+    if (!dataRef || !dataRefType)
+        return paramErr;
+
+    // Get and open a Data Handler Component that can write to the dataRef
+    err = OpenAComponent(GetDataHandler(dataRef, dataRefType, kDataHCanWrite), &dataH);
+    if (err)
+        goto bail;
+
+    DataHSetDataRef(dataH, dataRef);
+
+    // Create the file - ?
+    err = DataHCreateFile(dataH, FOUR_CHAR_CODE('TVOD'), false);
+    if (err)
+        goto bail;
+
+    DataHSetMacOSFileType(dataH, FOUR_CHAR_CODE('OggS'));
+
+    err = DataHOpenForWrite(dataH);
+    if (err)
+        goto bail;
+
+    if (globals->streamCount > 0) {
+        err = ConfigureQuickTimeMovieExporter(globals);
+        if (err)
+            goto bail;
+
+        err = ConfigureStdComponents(globals);
+
+        if (!err)
+            err = mux_streams(globals, dataH);
+    }
+
+ bail:
+    if (dataH)
+        CloseComponent(dataH);
+
+    dbg_printf("[  OE] <   [%08lx] :: FromProceduresToDataRef() = %ld\n", (UInt32) globals, err);
+    return err;
+}
+
+pascal ComponentResult OggExportAddDataSource(OggExportGlobalsPtr globals, OSType trackType, TimeScale scale,
+                                              long *trackIDPtr, MovieExportGetPropertyUPP getPropertyProc,
+                                              MovieExportGetDataUPP getDataProc, void *refCon)
+{
+    ComponentResult err = noErr;
+    stream_format_handle_funcs *ff = NULL;
+    StreamInfo *si = NULL;
+
+    dbg_printf("[  OE]  >> [%08lx] :: AddDataSource('%4.4s')\n", (UInt32) globals, (char *) &trackType);
+
+    if (!scale || !trackType || !getDataProc || !getPropertyProc)
+        return paramErr;
+
+    ff = find_stream_support(trackType, scale, getPropertyProc, refCon);
+
+    if (ff != NULL) {
+        err = OpenStream(globals, trackType, scale, trackIDPtr, getPropertyProc, getDataProc, refCon, ff, &si);
+    }
+
+    dbg_printf("[  OE] <   [%08lx] :: AddDataSource() = %ld\n", (UInt32) globals, err);
+    return err;
+}
+
+pascal ComponentResult OggExportSetProgressProc(OggExportGlobalsPtr globals, MovieProgressUPP proc, long refcon)
+{
+    dbg_printf("[  OE]  >> [%08lx] :: SetProgressProc()\n", (UInt32) globals);
+
+    globals->progressProc = proc;
+    globals->progressRefcon = refcon;
+
+    dbg_printf("[  OE] <   [%08lx] :: SetProgressProc()\n", (UInt32) globals);
+    return noErr;
+}
+
+
+#if USE_NIB_FILE
+static pascal OSStatus SettingsWindowEventHandler(EventHandlerCallRef inHandler, EventRef inEvent, void *inUserData)
+{
+#pragma unused (inHandler,inUserData)
+
+    WindowRef window = NULL;
+    HICommand command;
+    OSStatus result = eventNotHandledErr;
+    OggExportGlobalsPtr globals = (OggExportGlobalsPtr) inUserData;
+
+    dbg_printf("[  OE]  >> [%08lx] :: SettingsWindowEventHandler()\n", (UInt32) globals);
+
+    window = ActiveNonFloatingWindow();
+    if (window == NULL)
+        goto bail;
+
+    GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &command);
+
+    dbg_printf("[  OE]   | [%08lx] :: SettingsWindowEventHandler('%4.4s')\n", (UInt32) globals, (char *) &command.commandID);
+
+    switch (command.commandID) {
+    case kHICommandOK:
+        globals->canceled = false;
+
+        QuitAppModalLoopForWindow(window);
+        result = noErr;
+        break;
+
+    case kHICommandCancel:
+        globals->canceled = true;
+        QuitAppModalLoopForWindow(window);
+        result = noErr;
+        break;
+
+    case 'OEca':
+        {
+            SCExtendedProcs xProcs;
+            ComponentInstance stdAudio;
+
+            result = OpenADefaultComponent(StandardCompressionType, StandardCompressionSubTypeAudio, &stdAudio);
+            if (result == noErr) {
+                memset(&xProcs, 0, sizeof(xProcs));
+                strcpy((char*)xProcs.customName + 1, "Select Output Format");
+                xProcs.customName[0] = (unsigned char) strlen((char*) xProcs.customName + 1);
+                (void) QTSetComponentProperty(stdAudio, kQTPropertyClass_SCAudio,
+                                              kQTSCAudioPropertyID_ExtendedProcs,
+                                              sizeof(xProcs), &xProcs);
+
+                result = SCRequestImageSettings(stdAudio);
+                if (result == userCanceledErr)
+                    result = noErr; // User cancelling is ok.
+                CloseComponent(stdAudio);
+            }
+        }
+
+        break;
+
+    default:
+        break;
+    }
+
+ bail:
+    dbg_printf("[  OE] <   [%08lx] :: SettingsWindowEventHandler() = 0x%08lx\n", (UInt32) globals, result);
+    return result;
+}
+
+pascal ComponentResult OggExportDoUserDialog(OggExportGlobalsPtr globals, Movie theMovie, Track onlyThisTrack,
+                                             TimeValue startTime, TimeValue duration, Boolean *canceledPtr)
+{
+#pragma unused(theMovie, onlyThisTrack, startTime, duration)
+
+    CFBundleRef bundle = NULL;
+    IBNibRef    nibRef = NULL;
+    WindowRef   window = NULL;
+    Boolean     portChanged = false;
+
+    CGrafPtr    savedPort;
+    OSErr       err = resFNotFound;
+
+    EventTypeSpec eventList[] = {{kEventClassCommand, kEventCommandProcess}};
+    EventHandlerUPP settingsWindowEventHandlerUPP = NewEventHandlerUPP(SettingsWindowEventHandler);
+
+    dbg_printf("[  OE]  >> [%08lx] :: DoUserDialog()\n", (UInt32) globals);
+
+    bundle = CFBundleGetBundleWithIdentifier(CFSTR(kOggExportBundleID));
+    if (bundle == NULL)
+        goto bail;
+
+    err = CreateNibReferenceWithCFBundle(bundle, CFSTR("OggExport"), &nibRef);
+    if (err)
+        goto bail;
+
+    err = CreateWindowFromNib(nibRef, CFSTR("Settings"), &window);
+    if (err)
+        goto bail;
+
+    portChanged = QDSwapPort(GetWindowPort(window), &savedPort);
+
+    *canceledPtr = false;
+
+    InstallWindowEventHandler(window, settingsWindowEventHandlerUPP, GetEventTypeCount(eventList), eventList, globals, NULL);
+
+    ShowWindow(window);
+
+    RunAppModalLoopForWindow(window);
+
+    *canceledPtr = globals->canceled;
+
+ bail:
+    if (window) {
+        if (portChanged) {
+            QDSwapPort(savedPort, NULL);
+        }
+        DisposeWindow(window);
+    }
+
+    if (settingsWindowEventHandlerUPP)
+        DisposeEventHandlerUPP(settingsWindowEventHandlerUPP);
+
+    if (nibRef)
+        DisposeNibReference(nibRef);
+
+    dbg_printf("[  OE] <   [%08lx] :: DoUserDialog() = 0x%04x\n", (UInt32) globals, err);
+    return err;
+}
+
+#else
+#error "Non-NIB user dialog not implemented."
+
+pascal ComponentResult OggExportDoUserDialog(OggExportGlobalsPtr globals, Movie theMovie, Track onlyThisTrack,
+                                             TimeValue startTime, TimeValue duration, Boolean *canceledPtr)
+{
+    dbg_printf("[  OE]  >> [%08lx] :: DoUserDialog() [NN]\n", (UInt32) globals);
+    dbg_printf("[  OE] <   [%08lx] :: DoUserDialog() [NN]\n", (UInt32) globals);
+    return noErr;
+}
+
+#endif
+
+
+pascal ComponentResult OggExportGetSettingsAsAtomContainer(OggExportGlobalsPtr globals, QTAtomContainer *settings)
+{
+    QTAtomContainer theSettings = NULL;
+    OSErr err;
+
+    dbg_printf("[  OE]  >> [%08lx] :: GetSettingsAsAtomContainer()\n", (UInt32) globals);
+
+    if (!settings)
+        return paramErr;
+
+    err = QTNewAtomContainer(&theSettings);
+    if (err)
+        goto bail;
+
+ bail:
+    if (err && theSettings) {
+        QTDisposeAtomContainer(theSettings);
+        theSettings = NULL;
+    }
+
+    *settings = theSettings;
+
+    dbg_printf("[  OE] <   [%08lx] :: GetSettingsAsAtomContainer() = %d\n", (UInt32) globals, err);
+    return err;
+}
+
+pascal ComponentResult OggExportSetSettingsFromAtomContainer(OggExportGlobalsPtr globals, QTAtomContainer settings)
+{
+    OSErr err = noErr;
+
+    dbg_printf("[  OE]  >> [%08lx] :: SetSettingsFromAtomContainer()\n", (UInt32) globals);
+
+    if (!settings)
+        return paramErr;
+
+    dbg_printf("[  OE] <   [%08lx] :: SetSettingsFromAtomContainer() = %d\n", (UInt32) globals, err);
+    return err;
+}
+
+
+pascal ComponentResult OggExportGetFileNameExtension(OggExportGlobalsPtr globals, OSType *extension) {
+#pragma unused(globals)
+    dbg_printf("[  OE]  >> [%08lx] :: GetFileNameExtension()\n", (UInt32) globals);
+    *extension = 'ogg ';
+    dbg_printf("[  OE] <   [%08lx] :: GetFileNameExtension()\n", (UInt32) globals);
+    return noErr;
+}
+
+pascal ComponentResult OggExportGetShortFileTypeString(OggExportGlobalsPtr globals, Str255 typeString) {
+#pragma unused(globals)
+    dbg_printf("[  OE]  >> [%08lx] :: GetShortFileTypeString()\n", (UInt32) globals);
+
+    // return GetComponentIndString((Component)globals->self, typeString, kOggExportShortFileTypeNamesResID, 1);
+    typeString[0] = '\x04';
+    typeString[1] = 'O';
+    typeString[2] = 'g';
+    typeString[3] = 'g';
+    typeString[4] = 'S';
+    typeString[5] = '\x0';
+
+    dbg_printf("[  OE] <   [%08lx] :: GetShortFileTypeString()\n", (UInt32) globals);
+    return noErr;
+}
+
+pascal ComponentResult OggExportGetSourceMediaType(OggExportGlobalsPtr globals, OSType *mediaType) {
+#pragma unused(globals)
+    dbg_printf("[  OE]  >> [%08lx] :: GetSourceMediaType()\n", (UInt32) globals);
+
+
+    if (!mediaType)
+        return paramErr;
+
+    // any track type
+    *mediaType = 0;
+
+    dbg_printf("[  OE] <   [%08lx] :: GetSourceMediaType()\n", (UInt32) globals);
+    return noErr;
+}
+
+
+/* ========================================================================= */
+
+static OSErr ConfigureQuickTimeMovieExporter(OggExportGlobalsPtr globals)
+{
+    ComponentInstance  stdAudioCompression = NULL;
+    QTAtomContainer    movieExporterSettings = NULL;
+    OSErr              err;
+
+    /* TODO: make this function do something */
+
+    // Open the Standard Compression component
+    err = OpenADefaultComponent(StandardCompressionType, StandardCompressionSubTypeAudio, &stdAudioCompression);
+    if (err)
+        goto bail;
+
+    // Get the settings atom
+    err = SCGetSettingsAsAtomContainer(stdAudioCompression, &movieExporterSettings);
+    if (err)
+        goto bail;
+
+    // Set the compression settings for the QT Movie Exporter
+    //err = MovieExportSetSettingsFromAtomContainer(globals->quickTimeMovieExporter, movieExporterSettings);
+
+ bail:
+    if (stdAudioCompression)
+        CloseComponent(stdAudioCompression);
+
+    if (movieExporterSettings)
+        DisposeHandle(movieExporterSettings);
+
+    return err;
+}
+
+static ComponentResult ConfigureStdComponents(OggExportGlobalsPtr globals)
+{
+    ComponentResult err = noErr;
+    StreamInfoPtr si = NULL;
+    int i = 0;
+
+    for (i = 0; i < globals->streamCount; i++)
+    {
+        si = &(*globals->streamInfoHandle)[i];
+        if (si->sfhf->configure != NULL)
+            err = (*si->sfhf->configure)(globals, si);
+        if (err)
+            break;
+    }
+
+    return err;
+}
+
+static stream_format_handle_funcs* find_stream_support(OSType trackType, TimeScale scale,
+                                                       MovieExportGetPropertyUPP getPropertyProc,
+                                                       void *refCon)
+{
+    stream_format_handle_funcs *ff = &s_formats[0];
+    int i = 0;
+
+    while(ff->can_handle != NULL) {
+        if ((*ff->can_handle)(trackType, scale, getPropertyProc, refCon))
+            break;
+        i += 1;
+        ff = &s_formats[i];
+    }
+
+    if (ff->can_handle == NULL)
+        return NULL;
+
+    return ff;
+}
+
+static ComponentResult OpenStream(OggExportGlobalsPtr globals, OSType trackType, TimeScale scale,
+                                  long *trackIDPtr, MovieExportGetPropertyUPP getPropertyProc,
+                                  MovieExportGetDataUPP getDataProc, void *refCon,
+                                  stream_format_handle_funcs *ff, StreamInfoPtr *out_si)
+{
+    ComponentResult err = noErr;
+
+    if (globals->streamInfoHandle) {
+        globals->streamCount++;
+        SetHandleSize((Handle) globals->streamInfoHandle, sizeof(StreamInfo) * globals->streamCount);
+    } else {
+        globals->streamInfoHandle = (StreamInfo **) NewHandleClear(sizeof(StreamInfo));
+        globals->streamCount = 1;
+    }
+
+    err = MemError();
+
+    if (!err) {
+        StreamInfo *si = NULL;
+        HLock((Handle) globals->streamInfoHandle);
+        si = &(*globals->streamInfoHandle)[globals->streamCount - 1];
+
+        srandomdev();
+        si->serialno = random();
+
+        ogg_stream_init(&si->os, si->serialno);
+
+        si->packets_total = 0;
+        si->acc_packets = 0;
+        si->last_grpos = 0;
+        si->acc_duration = 0;
+
+        si->trackID = globals->streamCount;
+        si->getPropertyProc = getPropertyProc;
+        si->getDataProc = getDataProc;
+        si->refCon = refCon;
+        si->sourceTimeScale = scale;
+
+        memset(&si->gdp, 0, sizeof(MovieExportGetDataParams));
+        si->gdp.recordSize = sizeof(MovieExportGetDataParams);
+        si->gdp.trackID = si->trackID;
+        si->gdp.sourceTimeScale = scale;
+
+        si->out_buffer = NULL;
+        si->out_buffer_size = 0;
+
+        si->og_buffer_size = kOES_init_og_size;
+        si->og_buffer = calloc(1, kOES_init_og_size);
+        si->og_ready = false;
+
+        si->og_grpos = 0;
+
+        si->src_extract_complete = false;
+        si->eos = false;
+
+        err = MemError();
+
+        if (!err) {
+            //si->MDmapping = NULL;
+            //si->UDmapping = NULL;
+
+            si->sfhf = ff;
+
+            if (ff->initialize != NULL)
+                err = (*ff->initialize)(si);
+        }
+
+        HUnlock((Handle) globals->streamInfoHandle);
+
+        if (err) {
+            ogg_stream_clear(&si->os);
+
+            if (si->og_buffer)
+                free(si->og_buffer);
+
+            if (si->out_buffer)
+                free(si->out_buffer);
+
+            globals->streamCount--;
+            SetHandleSize((Handle) globals->streamInfoHandle, sizeof(StreamInfo) * globals->streamCount);
+        } else {
+            *out_si = si;
+            *trackIDPtr = si->trackID;
+        }
+    }
+
+    return err;
+}
+
+static void _close_stream(OggExportGlobalsPtr globals, StreamInfoPtr si)
+{
+    ogg_stream_clear(&si->os);
+
+    if (si->og_buffer) {
+        free(si->og_buffer);
+        si->og_buffer = NULL;
+        si->og_buffer_size = 0;
+    }
+
+    if (si->out_buffer) {
+        free(si->out_buffer);
+        si->out_buffer = NULL;
+        si->out_buffer_size = 0;
+    }
+
+    if (si->sfhf->clear != NULL)
+        (*si->sfhf->clear)(si);
+
+    /*
+    if (si->MDmapping != NULL)
+        CFRelease(si->MDmapping);
+    if (si->UDmapping != NULL)
+        CFRelease(si->UDmapping);
+    */
+}
+
+static void CloseAllStreams(OggExportGlobalsPtr globals)
+{
+    int i;
+
+    for (i = 0; i < globals->streamCount; i++)
+    {
+        StreamInfoPtr si = &(*globals->streamInfoHandle)[i];
+        _close_stream(globals, si);
+    }
+    globals->streamCount = 0;
+    SetHandleSize((Handle) globals->streamInfoHandle, 0);
+}
+
+ComponentResult mux_streams(OggExportGlobalsPtr globals, DataHandler data_h)
+{
+    ComponentResult err = noErr;
+
+    Boolean progressOpen = false;
+    wide data_h_offset = {0, 0};
+    TimeValue duration = 0;
+    Float64 max_page_duration = 0.8; /* dynamically adapt to the
+                                        bitrates of the streams? */
+    StreamInfoPtr si = &(*globals->streamInfoHandle)[0];
+    StreamInfoPtr f_si = NULL;
+    UInt32 i;
+    Boolean all_streams_done = false;
+
+    dbg_printf("[  OE]  >> [%08lx] :: mux_streams()\n", (UInt32) globals);
+
+    if (globals->progressProc) {
+        TimeRecord durationTimeRec;
+
+        // TODO: loop over all the data sources and find the max duration
+
+        // Get the track duration if it is available
+        if (InvokeMovieExportGetPropertyUPP(si->refCon, si->trackID,
+                                            movieExportDuration,
+                                            &durationTimeRec,
+                                            si->getPropertyProc) == noErr) {
+            ConvertTimeScale(&durationTimeRec, si->sourceTimeScale);
+            duration = durationTimeRec.value.lo;
+            dbg_printf("[  OE]  <> [%08lx] :: mux_streams() = %ld\n",
+                       (UInt32) globals, duration);
+
+            InvokeMovieProgressUPP(NULL, movieProgressOpen,
+                                   progressOpExportMovie, 0,
+                                   globals->progressRefcon,
+                                   globals->progressProc);
+            progressOpen = true;
+        }
+    }
+
+    HLock((Handle) globals->streamInfoHandle);
+
+    // ident headers first
+    // TODO: sort streams by type
+    for (i = 0; i < globals->streamCount; i++) {
+        si = &(*globals->streamInfoHandle)[i];
+
+        err = (*si->sfhf->write_i_header)(si, data_h, &data_h_offset);
+        if (err)
+            break;
+    }
+
+    // then, the rest of the header packets
+    for (i = 0; i < globals->streamCount; i++) {
+        si = &(*globals->streamInfoHandle)[i];
+
+        err = (*si->sfhf->write_headers)(si, data_h, &data_h_offset);
+        if (err)
+            break;
+    }
+
+
+    while (!all_streams_done) {
+        // 1. fill all the streams
+        // 2. a) find the earliest page
+        //    b) flush it to disk
+        // 3. repeat
+
+        UInt32 earliest_sec = 0xffffffff;
+        Float64 earliest_subsec = 1.0;
+
+        wide tmp;
+
+        UInt32 p_sec = 0;
+        Float64 p_subsec = 0.0;
+
+        all_streams_done = true;
+        f_si = NULL;
+
+        for (i = 0; i < globals->streamCount; i++) {
+            si = &(*globals->streamInfoHandle)[i];
+
+            if (!si->og_ready && !si->eos) {
+                err = (*si->sfhf->fill_page)(globals, si, max_page_duration,
+                                             &p_sec, &p_subsec);
+                if (err)
+                    break;
+            }
+            if (all_streams_done && si->og_ready)
+                all_streams_done = false;
+            if (si->og_ready) {
+                if (p_sec < earliest_sec ||
+                    (p_sec == earliest_sec && p_subsec < earliest_subsec)) {
+                    f_si = si;
+                    earliest_sec = p_sec;
+                    earliest_subsec = p_subsec;
+                }
+            }
+        }
+
+        if (!all_streams_done) {
+            err = DataHWrite64(data_h, f_si->og_buffer, &data_h_offset,
+                               f_si->og.header_len + f_si->og.body_len,
+                               NULL, 0);
+            dbg_printf("[  OE] vvv [%08lx] :: mux_streams() = %ld, %lld\n",
+                       (UInt32) globals, err, *(SInt64 *) &data_h_offset);
+            if (err)
+                break;
+
+            tmp.hi = 0;
+            tmp.lo = f_si->og.header_len + f_si->og.body_len;
+            WideAdd(&data_h_offset, &tmp);
+
+            f_si->og_ready = false;
+
+            /*
+            if (!f_si->eos)
+                err = (*f_si->sfhf->fill_page)(globals, f_si, max_page_duration,
+                                               &p_sec, &p_subsec);
+            if (err)
+                break;
+            */
+        }
+
+        if (progressOpen) {
+            Fixed percentDone = 0x010000;
+            if (f_si)
+                percentDone = FixDiv(f_si->time, duration);
+
+            if (percentDone > 0x010000)
+                percentDone = 0x010000;
+
+            err = InvokeMovieProgressUPP(NULL, movieProgressUpdatePercent,
+                                         progressOpExportMovie, percentDone,
+                                         globals->progressRefcon,
+                                         globals->progressProc);
+            if (err)
+                break;
+        }
+    }
+
+    HUnlock((Handle) globals->streamInfoHandle);
+
+    if (progressOpen)
+        InvokeMovieProgressUPP(NULL, movieProgressClose,
+                               progressOpExportMovie, 0,
+                               globals->progressRefcon,
+                               globals->progressProc);
+
+    dbg_printf("[  OE] <   [%08lx] :: mux_streams() = %ld\n", (UInt32) globals, err);
+    return err;
+}


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

Added: trunk/xiph-qt/OggExport/src/OggExport.exp
===================================================================
--- trunk/xiph-qt/OggExport/src/OggExport.exp	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/OggExport.exp	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1 @@
+_OggExportComponentDispatch

Added: trunk/xiph-qt/OggExport/src/OggExport.h
===================================================================
--- trunk/xiph-qt/OggExport/src/OggExport.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/OggExport.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,52 @@
+/*
+ *  OggExport.h
+ *
+ *    OggExport.h - some constants definitions.
+ *
+ *
+ *  Copyright (c) 2006  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 __OGGEXPORT_H__
+#define __OGGEXPORT_H__ 1
+
+#include "oggexport_versions.h"
+
+#define kOggExportBundleID "org.xiph.xiph-qt.oggexport"
+
+#define kExporterResID                  4040
+#define kExporterNameStringResID        4040
+#define kExporterInfoStringResID        4041
+
+#define kSoundComponentManufacturer     'Xiph'
+#define kCodecFormat                    'OggS'
+
+
+#ifdef _DEBUG
+#define OggExporterName        "Ogg Vorbis Exporter"
+#else
+#define OggExporterName        ""
+#endif
+
+#endif /* __OGGEXPORT_H__ */


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

Added: trunk/xiph-qt/OggExport/src/OggExport.nib/classes.nib
===================================================================
--- trunk/xiph-qt/OggExport/src/OggExport.nib/classes.nib	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/OggExport.nib/classes.nib	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,4 @@
+{
+IBClasses = ();
+IBVersion = 1;
+}

Added: trunk/xiph-qt/OggExport/src/OggExport.nib/info.nib
===================================================================
--- trunk/xiph-qt/OggExport/src/OggExport.nib/info.nib	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/OggExport.nib/info.nib	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,20 @@
+<?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>IBDocumentLocation</key>
+	<string>69 63 356 240 0 0 1280 832 </string>
+	<key>IBFramework Version</key>
+	<string>446.1</string>
+	<key>IBOldestOS</key>
+	<integer>4</integer>
+	<key>IBOpenObjects</key>
+	<array>
+		<integer>166</integer>
+	</array>
+	<key>IBSystem Version</key>
+	<string>8L127</string>
+	<key>targetFramework</key>
+	<string>IBCarbonFramework</string>
+</dict>
+</plist>

Added: trunk/xiph-qt/OggExport/src/OggExport.nib/objects.xib
===================================================================
--- trunk/xiph-qt/OggExport/src/OggExport.nib/objects.xib	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/OggExport.nib/objects.xib	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,75 @@
+<?xml version="1.0" standalone="yes"?>
+<object class="NSIBObjectData">
+  <string name="targetFramework">IBCarbonFramework</string>
+  <object name="rootObject" class="NSCustomObject" id="1">
+    <string name="customClass">NSApplication</string>
+  </object>
+  <array count="5" name="allObjects">
+    <object class="IBCarbonWindow" id="166">
+      <string name="windowRect">167 334 288 756 </string>
+      <string name="title">Ogg Exporter Settings</string>
+      <object name="rootControl" class="IBCarbonRootControl" id="167">
+        <string name="bounds">0 0 121 422 </string>
+        <string name="viewFrame">0 0 422 121 </string>
+        <array count="3" name="subviews">
+          <object class="IBCarbonButton" id="180">
+            <string name="bounds">81 333 101 402 </string>
+            <string name="viewFrame">333 81 69 20 </string>
+            <int name="controlID">1</int>
+            <string name="title">OK</string>
+            <ostype name="command">ok  </ostype>
+            <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+              <int name="bindingBottomKind">2</int>
+              <int name="bindingRightKind">2</int>
+            </object>
+            <int name="buttonType">1</int>
+          </object>
+          <object class="IBCarbonButton" id="181">
+            <string name="bounds">81 252 101 321 </string>
+            <string name="viewFrame">252 81 69 20 </string>
+            <int name="controlID">2</int>
+            <string name="title">Cancel</string>
+            <ostype name="command">not!</ostype>
+            <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+              <int name="bindingBottomKind">2</int>
+            </object>
+            <int name="buttonType">2</int>
+          </object>
+          <object class="IBCarbonButton" id="182">
+            <string name="bounds">20 20 40 157 </string>
+            <string name="viewFrame">20 20 137 20 </string>
+            <int name="controlID">3</int>
+            <string name="title">Configure Audio</string>
+            <ostype name="command">OEca</ostype>
+            <object name="layoutInfo" class="IBCarbonHILayoutInfo">
+              <int name="bindingLeftKind">1</int>
+              <int name="bindingRightKind">2</int>
+            </object>
+          </object>
+        </array>
+      </object>
+      <boolean name="receiveUpdates">FALSE</boolean>
+      <boolean name="compositing">TRUE</boolean>
+      <int name="carbonWindowClass">4</int>
+      <int name="windowPosition">7</int>
+    </object>
+    <reference idRef="167"/>
+    <reference idRef="180"/>
+    <reference idRef="181"/>
+    <reference idRef="182"/>
+  </array>
+  <array count="5" name="allParents">
+    <reference idRef="1"/>
+    <reference idRef="166"/>
+    <reference idRef="167"/>
+    <reference idRef="167"/>
+    <reference idRef="167"/>
+  </array>
+  <dictionary count="2" name="nameTable">
+    <string>File&apos;s Owner</string>
+    <reference idRef="1"/>
+    <string>Settings</string>
+    <reference idRef="166"/>
+  </dictionary>
+  <unsigned_int name="nextObjectID">183</unsigned_int>
+</object>

Added: trunk/xiph-qt/OggExport/src/OggExport.r
===================================================================
--- trunk/xiph-qt/OggExport/src/OggExport.r	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/OggExport.r	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,149 @@
+/*
+ *  OggExport.r
+ *
+ *    Information bit definitions for the 'thng' and other OggExport
+ *    resources.
+ *
+ *
+ *  Copyright (c) 2006  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 thng_RezTemplateVersion 2
+
+#define cfrg_RezTemplateVersion 1
+
+#ifdef TARGET_REZ_MAC_PPC
+#include <CoreServices/CoreServices.r>
+#include <QuickTime/QuickTime.r>
+#include <QuickTime/QuickTimeComponents.r>
+#else
+#include "ConditionalMacros.r"
+#include "CoreServices.r"
+#include "QuickTimeComponents.r"
+#endif /* TARGET_REZ_MAC_PPC */
+
+#include "OggExport.h"
+
+#define kExporterComponentType 'spit'
+
+
+/* How do I do this properly... anybody? */
+#if defined(BUILD_UNIVERSAL)
+  #define TARGET_CPU_PPC 1
+  #define TARGET_CPU_X86 1
+#endif
+
+
+#ifndef cmpThreadSafe
+#define cmpThreadSafe	0x10000000
+#endif
+
+#if TARGET_OS_MAC
+  #if TARGET_CPU_PPC && TARGET_CPU_X86
+    #define TARGET_REZ_FAT_COMPONENTS 1
+    #define Target_PlatformType       platformPowerPCNativeEntryPoint
+    #define Target_SecondPlatformType platformIA32NativeEntryPoint
+  #elif TARGET_CPU_X86
+    #define Target_PlatformType       platformIA32NativeEntryPoint
+  #else
+    #define Target_PlatformType       platformPowerPCNativeEntryPoint
+  #endif
+#elif TARGET_OS_WIN32
+  #define Target_PlatformType platformWin32
+#else
+  #error get a real platform type
+#endif /* TARGET_OS_MAC */
+
+#if !defined(TARGET_REZ_FAT_COMPONENTS)
+  #define TARGET_REZ_FAT_COMPONENTS 0
+#endif
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Ogg Exporter
+
+#define kExporterFlags canMovieExportFiles | canMovieExportValidateMovie | \
+    canMovieExportFromProcedures | movieExportMustGetSourceMediaType | \
+    hasMovieExportUserInterface | cmpThreadSafe
+
+
+resource 'thng' (kExporterResID, OggExporterName, purgeable) {
+    kExporterComponentType, kCodecFormat, 'Xiph',
+    0, 0, 0, 0,
+    'STR ', kExporterNameStringResID,
+    'STR ', kExporterInfoStringResID,
+    0, 0,		// no icon
+    kOgg_spit__Version,
+    componentDoAutoVersion|componentHasMultiplePlatforms, 0,
+    {
+        // COMPONENT PLATFORM INFORMATION ----------------------
+        kExporterFlags,
+        'dlle',                                 // Code Resource type - Entry point found by symbol name 'dlle' resource
+        kExporterResID,                         // ID of 'dlle' resource
+        Target_PlatformType,
+#if TARGET_REZ_FAT_COMPONENTS
+        kExporterFlags,
+        'dlle',
+        kExporterResID,
+        Target_SecondPlatformType,
+#endif
+    },
+    'thnr', kExporterResID
+};
+
+resource 'thnr' (kExporterResID, OggExporterName, purgeable) {
+    {
+        'mime', 1, 0, 'mime', kExporterResID, cmpResourceNoFlags,
+        'src#', 1, 0, 'src#', kExporterResID, cmpResourceNoFlags,
+        'src#', 2, 0, 'trk#', kExporterResID, cmpResourceNoFlags,
+    };
+};
+
+
+resource 'dlle' (kExporterResID, OggExporterName) {
+    "OggExportComponentDispatch"
+};
+
+resource 'STR ' (kExporterNameStringResID, OggExporterName, purgeable) {
+    /* "Ogg Multimedia Bitstream (OGG)" */
+    "OGG"
+};
+
+resource 'STR ' (kExporterInfoStringResID, OggExporterName, purgeable) {
+    "Ogg " "0.1.1" " (See http://www.xiph.org)."
+};
+
+
+resource 'src#' (kExporterResID, OggExporterName, purgeable) {
+    {
+        'vide', 0, 65535, isSourceType,
+        'soun', 0, 65535, isSourceType;
+    };
+};
+
+resource 'trk#' (kExporterResID, OggExporterName, purgeable) {
+    {
+        'eyes', 0, 65535, isMediaCharacteristic,
+        'ears', 0, 65535, isMediaCharacteristic;
+    };
+};


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

Added: trunk/xiph-qt/OggExport/src/OggExportDispatch.h
===================================================================
--- trunk/xiph-qt/OggExport/src/OggExportDispatch.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/OggExportDispatch.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,89 @@
+/*
+ *  OggExportDispatch.h
+ *
+ *    OggExport component dispatch helper header.
+ *
+ *
+ *  Copyright (c) 2006  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 __MACH__
+        ComponentSelectorOffset (-kQTRemoveComponentPropertyListenerSelect)
+#else
+        ComponentSelectorOffset (-kComponentVersionSelect)
+#endif
+
+        ComponentRangeCount (3)
+        ComponentRangeShift (7)
+        ComponentRangeMask	(7F)
+
+        ComponentRangeBegin (0)
+#if __MACH__
+		ComponentError (RemoveComponentPropertyListener)
+		ComponentError (AddComponentPropertyListener)
+		StdComponentCall (SetComponentProperty)
+		StdComponentCall (GetComponentProperty)
+		StdComponentCall (GetComponentPropertyInfo)
+
+		ComponentError   (GetPublicResource)
+		ComponentError   (ExecuteWiredAction)
+		ComponentError   (GetMPWorkFunction)
+		ComponentError   (Unregister)
+
+		ComponentError   (Target)
+		ComponentError   (Register)
+#endif
+		StdComponentCall (Version)
+		StdComponentCall (CanDo)
+		StdComponentCall (Close)
+		StdComponentCall (Open)
+	ComponentRangeEnd (0)
+
+	ComponentRangeUnused (1)
+
+	ComponentRangeBegin (2)
+		ComponentError (ToHandle)
+		ComponentCall  (ToFile)
+		ComponentError (130)
+		ComponentError (GetAuxiliaryData)
+		ComponentCall  (SetProgressProc)
+		ComponentError (SetSampleDescription)
+		ComponentCall  (DoUserDialog)
+		ComponentError (GetCreatorType)
+		ComponentCall  (ToDataRef)
+		ComponentCall  (FromProceduresToDataRef)
+		ComponentCall  (AddDataSource)
+		ComponentCall  (Validate)
+		ComponentCall  (GetSettingsAsAtomContainer)
+		ComponentCall  (SetSettingsFromAtomContainer)
+		ComponentCall  (GetFileNameExtension)
+		ComponentCall  (GetShortFileTypeString)
+		ComponentCall  (GetSourceMediaType)
+		ComponentError (SetGetMoviePropertyProc)
+	ComponentRangeEnd (2)
+
+	ComponentRangeBegin (3)
+		ComponentError (NewGetDataAndPropertiesProcs)
+		ComponentError (DisposeGetDataAndPropertiesProcs)
+	ComponentRangeEnd (3)


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

Added: trunk/xiph-qt/OggExport/src/exporter_types.h
===================================================================
--- trunk/xiph-qt/OggExport/src/exporter_types.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/exporter_types.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,176 @@
+/*
+ *  exporter_types.h
+ *
+ *    Definitions of OggExporter data structures.
+ *
+ *
+ *  Copyright (c) 2006  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(__exporter_types_h__)
+#define __exporter_types_h__
+
+#if defined(__APPLE_CC__)
+#include <QuickTime/QuickTime.h>
+#include <Ogg/ogg.h>
+#else
+#include <QuickTimeComponents.h>
+#include <ogg.h>
+
+#if defined(TARGET_OS_WIN32)
+#define _WINIOCTL_
+#include <windows.h>
+#endif
+
+#endif
+//#include "rb.h"
+
+
+#include "stream_types_audio.h"
+//#include "stream_types_video.h"
+
+
+enum {
+    kOES_init_og_size = 5120,
+};
+
+struct stream_format_handle_funcs; //forward declaration
+
+typedef struct {
+    long serialno;
+
+    ogg_stream_state os;
+
+    ogg_page og;
+    void * og_buffer;
+    UInt32 og_buffer_size;
+    ogg_int64_t og_grpos;
+    Boolean og_ready;
+
+    //UInt32   og_ts_sec;
+    //Float64  og_ts_subsec;
+
+    ogg_int64_t packets_total;
+    ogg_int64_t acc_packets;
+    ogg_int64_t last_grpos;
+    ogg_int64_t acc_duration;
+
+    OSType stream_type;
+
+    long trackID;
+    MovieExportGetPropertyUPP getPropertyProc;
+    MovieExportGetDataUPP getDataProc;
+    void *refCon;
+    MovieExportGetDataParams gdp;
+
+    Boolean src_extract_complete;
+    Boolean eos;
+
+    TimeScale sourceTimeScale;
+
+    TimeValue time;
+    //long numOfFrames;
+
+    //Ptr compressBuffer;
+    //Size compressBufferSize;
+
+    void * out_buffer;
+    UInt32 out_buffer_size;
+
+    long lastDescSeed;
+
+    //ComponentInstance stdAudio;
+
+    //ImageSequence decompressSequence;
+    //GWorldPtr gw;
+    //PixMapHandle hPixMap;
+
+    struct stream_format_handle_funcs *sfhf;
+
+    union {
+#if defined(_HAVE__OE_AUDIO)
+        StreamInfo__audio si_a;
+#endif
+#if defined(_HAVE__OE_VIDEO)
+        StreamInfo__video si_v;
+#endif
+    };
+
+} StreamInfo, *StreamInfoPtr;
+
+typedef struct {
+    ComponentInstance  self;
+    ComponentInstance  quickTimeMovieExporter;
+
+    int                streamCount;
+    StreamInfo         **streamInfoHandle;
+
+    MovieProgressUPP   progressProc;
+    long               progressRefcon;
+
+    Boolean            canceled;
+
+    Boolean            use_hires_audio;
+} OggExportGlobals, *OggExportGlobalsPtr;
+
+
+typedef Boolean (*can_handle_track) (OSType trackType, TimeScale scale,
+                                     MovieExportGetPropertyUPP getPropertyProc,
+                                     void *refCon);
+typedef ComponentResult (*validate_movie) (OggExportGlobals *globals,
+                                           Movie theMovie, Track onlyThisTrack,
+                                           Boolean *valid);
+typedef ComponentResult (*configure_stream) (OggExportGlobals *globals,
+                                             StreamInfo *si);
+
+typedef ComponentResult (*write_i_header) (StreamInfoPtr si, DataHandler data_h,
+                                           wide *offset);
+typedef ComponentResult (*write_headers) (StreamInfoPtr si, DataHandler data_h,
+                                          wide *offset);
+
+typedef ComponentResult (*fill_page) (OggExportGlobalsPtr globals,
+                                      StreamInfoPtr si, Float64 max_duration,
+                                      UInt32 *pos_sec, Float64 *pos_subsec);
+
+typedef ComponentResult (*initialize_stream) (StreamInfo *si);
+typedef void (*clear_stream) (StreamInfo *si);
+
+typedef struct stream_format_handle_funcs {
+    can_handle_track      can_handle;
+    validate_movie        validate;
+
+    configure_stream      configure;
+
+    write_i_header        write_i_header;
+    write_headers         write_headers;
+
+    fill_page             fill_page;
+
+    initialize_stream     initialize;
+    clear_stream          clear;
+} stream_format_handle_funcs;
+
+#define HANDLE_FUNCTIONS__NULL { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
+
+#endif /* __exporter_types_h__ */


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

Added: trunk/xiph-qt/OggExport/src/oggexport_versions.h
===================================================================
--- trunk/xiph-qt/OggExport/src/oggexport_versions.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/oggexport_versions.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,40 @@
+/*
+ *  oggexport_versions.h
+ *
+ *    The current version of the OggExport component.
+ *
+ *
+ *  Copyright (c) 2006  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(__oggexport_versions_h__)
+#define __oggexport_versions_h__
+
+#ifdef DEBUG
+#define kOgg_spit__Version		(0x00FF0101)
+#else
+#define kOgg_spit__Version		(0x00000101)
+#endif /* DEBUG */
+
+#endif /* __oggexport_versions_h__ */


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

Added: trunk/xiph-qt/OggExport/src/stream_audio.c
===================================================================
--- trunk/xiph-qt/OggExport/src/stream_audio.c	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/stream_audio.c	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,714 @@
+/*
+ *  stream_audio.c
+ *
+ *    Audio tracks related part of OggExporter.
+ *
+ *
+ *  Copyright (c) 2006  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_audio.h"
+
+#include "OggExport.h"
+
+#include "fccs.h"
+#include "data_types.h"
+
+#include "debug.h"
+
+ComponentResult
+_flush_ogg(StreamInfoPtr si, DataHandler data_h, wide *offset)
+{
+    ComponentResult err = noErr;
+    int result = 0;
+    ogg_page og;
+    Boolean have_pages = true;
+    wide tmp;
+
+    while (have_pages) {
+        result = ogg_stream_pageout(&si->os, &og);
+
+        if (!result) {
+            have_pages = false;
+            result = ogg_stream_flush(&si->os, &og);
+            if (!result)
+                break;
+        }
+
+        err = DataHWrite64(data_h, (Ptr) og.header, offset, og.header_len,
+                         NULL, 0);
+        if (!err) {
+            tmp.hi = 0;
+            tmp.lo = og.header_len;
+            WideAdd(offset, &tmp);
+            err = DataHWrite64(data_h, (Ptr) og.body, offset, og.body_len,
+                             NULL, 0);
+            if (!err) {
+                tmp.hi = 0;
+                tmp.lo = og.body_len;
+                WideAdd(offset, &tmp);
+            }
+        }
+    }
+
+    return err;
+}
+
+static void _ready_page(StreamInfoPtr si, UInt32 *pos_sec, Float64 *pos_subsec)
+{
+    UInt32 len = si->og.header_len + si->og.body_len;
+    Float64 pos;
+
+    if (si->og_buffer_size < len) {
+        si->og_buffer = realloc(si->og_buffer, len);
+        si->og_buffer_size = len;
+    }
+    BlockMoveData(si->og.header, si->og_buffer, si->og.header_len);
+    BlockMoveData(si->og.body, si->og_buffer + si->og.header_len,
+                  si->og.body_len);
+    si->og.header = si->og_buffer;
+    si->og.body = si->og_buffer + si->og.header_len;
+    si->og_ready = true;
+    si->acc_packets -= ogg_page_packets(&si->og);
+    if (ogg_page_granulepos(&si->og) != -1) {
+        si->acc_duration -= ogg_page_granulepos(&si->og) -
+            si->og_grpos;
+        si->og_grpos = ogg_page_granulepos(&si->og);
+    }
+
+    pos = si->og_grpos / si->si_a.stda_asbd.mSampleRate;
+    *pos_sec = (UInt32) pos;
+    *pos_subsec = (pos - (Float64) *pos_sec);
+
+    if (ogg_page_eos(&si->og))
+        si->eos = true;
+}
+
+ComponentResult
+_InputDataProc__audio(ComponentInstance ci, UInt32 *ioNumberDataPackets,
+                      AudioBufferList *ioData,
+                      AudioStreamPacketDescription **outDataPacketDescription,
+                      void *inRefCon)
+{
+    StreamInfoPtr si = (StreamInfoPtr) inRefCon;
+    ComponentResult err = noErr;
+
+    dbg_printf("[  OE]  >> [%08lx] :: _InputDataProc__audio(%ld)\n",
+               (UInt32) -1, *ioNumberDataPackets);
+
+    *ioNumberDataPackets = 0;
+
+    if (!si->src_extract_complete || si->gdp.actualSampleCount > 0) {
+        if (si->gdp.actualSampleCount == 0) {
+            si->gdp.recordSize = sizeof(MovieExportGetDataParams);
+            si->gdp.trackID = si->trackID;
+            si->gdp.requestedTime = si->time;
+            si->gdp.sourceTimeScale = si->sourceTimeScale;
+            si->gdp.actualTime = 0;
+            si->gdp.dataPtr = NULL;
+            si->gdp.dataSize = 0;
+            si->gdp.desc = NULL;
+            si->gdp.descType = 0;
+            si->gdp.descSeed = 0;
+            si->gdp.requestedSampleCount = *ioNumberDataPackets;
+            si->gdp.actualSampleCount = 0;
+            si->gdp.durationPerSample = 1;
+            si->gdp.sampleFlags = 0;
+
+            err = InvokeMovieExportGetDataUPP(si->refCon, &si->gdp,
+                                              si->getDataProc);
+            if (!err)
+                si->time += si->gdp.durationPerSample * si->gdp.actualSampleCount;
+
+            if (err == eofErr) {
+                err = noErr;
+                si->src_extract_complete = true;
+            }
+        }
+
+        if (!err) {
+            if (si->gdp.actualSampleCount == 0) {
+                ioData->mBuffers[0].mDataByteSize = 0;
+                ioData->mBuffers[0].mData = NULL;
+                si->src_extract_complete = true;
+            } else {
+                ioData->mBuffers[0].mDataByteSize = si->gdp.dataSize;
+                ioData->mBuffers[0].mData = si->gdp.dataPtr;
+            }
+
+            *ioNumberDataPackets = si->gdp.actualSampleCount;
+
+            si->gdp.actualSampleCount = 0;
+        }
+    } else {
+        ioData->mBuffers[0].mDataByteSize = 0;
+        ioData->mBuffers[0].mData = NULL;
+        si->gdp.dataSize = 0;
+        si->gdp.requestedTime = si->gdp.actualTime = 0;
+    }
+
+    dbg_printf("[  OE] <   [%08lx] :: _InputDataProc__audio(%ld, "
+               "%ld, %ld, %ld, %ld, %d) = %ld\n",
+               (UInt32) -1, *ioNumberDataPackets, si->gdp.dataSize,
+               si->gdp.requestedTime, si->gdp.actualTime, ioData->mNumberBuffers,
+               outDataPacketDescription != NULL, err);
+    return err;
+}
+
+
+/* ======================================================================= */
+
+Boolean can_handle_track__audio(OSType trackType, TimeScale scale,
+                                MovieExportGetPropertyUPP getPropertyProc,
+                                void *refCon)
+{
+    if (!scale || !trackType || !getPropertyProc)
+        return false;
+
+    if (trackType == SoundMediaType)
+        return true;
+
+    return false;
+}
+
+ComponentResult validate_movie__audio(OggExportGlobals *globals,
+                                      Movie theMovie, Track onlyThisTrack,
+                                      Boolean *valid)
+{
+    ComponentResult err = noErr;
+
+    return err;
+}
+
+extern ComponentResult initialize_stream__audio(StreamInfo *si)
+{
+    ComponentResult err = noErr;
+
+    memset(&si->si_a.op, 0, sizeof(si->si_a.op));
+
+    si->si_a.aspds = NULL;
+    si->si_a.abl = NULL;
+    si->si_a.op_buffer = NULL;
+
+    si->stream_type = SoundMediaType;
+
+    // allocate initial space for ogg_package
+    si->si_a.op_buffer_size = kOES_A_init_op_size;
+    si->si_a.op_buffer = calloc(1, kOES_A_init_op_size);
+
+    // allocate space for one AudioBuffer
+    si->si_a.abl_size = offsetof(AudioBufferList, mBuffers[1]);
+    si->si_a.abl = (AudioBufferList *) calloc(1, si->si_a.abl_size);
+    si->si_a.abl->mNumberBuffers = 1;
+
+    // allocate space for one AudioStreamPacketDescription
+    si->si_a.aspds_size = sizeof(AudioStreamPacketDescription);
+    si->si_a.aspds = (AudioStreamPacketDescription *)
+        calloc(1, si->si_a.aspds_size);
+
+    err = MemError();
+
+    if (!err) {
+        si->si_a.stdAudio = NULL;
+        err = OpenADefaultComponent(StandardCompressionType,
+                                    StandardCompressionSubTypeAudio,
+                                    &si->si_a.stdAudio);
+    }
+
+    if (err) {
+        if (si->si_a.aspds) {
+            free(si->si_a.aspds);
+            si->si_a.aspds = NULL;
+            si->si_a.aspds_size = 0;
+        }
+
+        if (si->si_a.abl) {
+            free(si->si_a.abl);
+            si->si_a.abl = NULL;
+            si->si_a.abl_size = 0;
+        }
+
+        if (si->si_a.op_buffer) {
+            free(si->si_a.op_buffer);
+            si->si_a.op_buffer = NULL;
+            si->si_a.op_buffer_size = 0;
+        }
+    }
+
+    return err;
+}
+
+extern void clear_stream__audio(StreamInfo *si)
+{
+    if (si->si_a.aspds) {
+        free(si->si_a.aspds);
+        si->si_a.aspds = NULL;
+        si->si_a.aspds_size = 0;
+    }
+
+    if (si->si_a.abl) {
+        free(si->si_a.abl);
+        si->si_a.abl = NULL;
+        si->si_a.abl_size = 0;
+    }
+
+    if (si->si_a.op_buffer) {
+        free(si->si_a.op_buffer);
+        si->si_a.op_buffer = NULL;
+        si->si_a.op_buffer_size = 0;
+    }
+
+    if (si->si_a.stdAudio)
+        CloseComponent(si->si_a.stdAudio);
+}
+
+ComponentResult configure_stream__audio(OggExportGlobals *globals,
+                                        StreamInfo *si)
+{
+    ComponentResult err = noErr;
+
+    AudioChannelLayout *acl = NULL;
+    UInt32 acl_size = 0;
+
+    /* invoking getDataProc once to get input SampleDescription,
+     * there seems to be no other reliable way to find out getDataProc's
+     * output sample format...
+     */
+    si->gdp.requestedTime = 0;
+    si->gdp.actualTime = 0;
+    si->gdp.dataPtr = NULL;
+    si->gdp.dataSize = 0;
+    si->gdp.desc = NULL;
+    si->gdp.descType = 0;
+    si->gdp.descSeed = 0;
+    si->gdp.requestedSampleCount = 0;
+    si->gdp.actualSampleCount = 0;
+
+    err = InvokeMovieExportGetDataUPP(si->refCon, &si->gdp, si->getDataProc);
+    if (err == eofErr) {
+        si->src_extract_complete = true;
+        err = noErr;
+    }
+
+    if (!err) {
+        SoundDescriptionHandle sdh;
+        SoundDescriptionV2Ptr sd;
+
+        si->time += si->gdp.durationPerSample * si->gdp.actualSampleCount;
+
+        if (si->gdp.descType != SoundMediaType) {
+            err = paramErr;
+        } else {
+            err = QTSoundDescriptionConvert(kQTSoundDescriptionKind_Movie_AnyVersion,
+                                            (SoundDescriptionHandle) si->gdp.desc,
+                                            kQTSoundDescriptionKind_Movie_Version2,
+                                            &sdh);
+        }
+
+        if (!err) {
+            sd = (SoundDescriptionV2Ptr) *sdh;
+            dbg_printf("[  OE]   i [%08lx] :: configure_stream__audio() = %ld, '%4.4s' ('%4.4s', %d, %d, '%4.4s', [%ld, %ld, %lf] [%ld, %ld, %ld, %ld])\n",
+                       (UInt32) globals, err, (char *) &si->gdp.descType,
+                       (char *) &sd->dataFormat, sd->version, sd->revlevel, (char *) &sd->vendor,
+                       sd->numAudioChannels, sd->constBitsPerChannel, sd->audioSampleRate,
+                       sd->constLPCMFramesPerAudioPacket, sd->constBytesPerAudioPacket, sd->formatSpecificFlags, 0l);
+
+            if (sd->dataFormat != kAudioFormatLinearPCM) {
+                // doesn't support compressed source samples a.t.m.
+                err = paramErr;
+            } else {
+                AudioStreamBasicDescription *asbd = &si->si_a.qte_out_asbd;
+                UInt32 acl_size = 0;
+                AudioChannelLayout *acl = NULL;
+
+                asbd->mFormatID = kAudioFormatLinearPCM;
+                asbd->mFormatFlags = sd->formatSpecificFlags;
+                asbd->mFramesPerPacket = sd->constLPCMFramesPerAudioPacket;
+                asbd->mBitsPerChannel = sd->constBitsPerChannel;
+                asbd->mChannelsPerFrame = sd->numAudioChannels;
+                asbd->mBytesPerFrame = sd->constBytesPerAudioPacket;
+                asbd->mBytesPerPacket = asbd->mBytesPerFrame *
+                    asbd->mFramesPerPacket;
+                asbd->mSampleRate = sd->audioSampleRate;
+
+                err = QTSoundDescriptionGetPropertyInfo(sdh, kQTPropertyClass_SoundDescription,
+                                                        kQTSoundDescriptionPropertyID_AudioChannelLayout,
+                                                        NULL, &acl_size, NULL);
+                dbg_printf("[  OE]  cl [%08lx] :: configure_stream__audio() = %ld, %ld\n",
+                           (UInt32) globals, err, acl_size);
+                if (!err) {
+                    acl = (AudioChannelLayout *) calloc(1, acl_size);
+                    err = QTSoundDescriptionGetProperty(sdh, kQTPropertyClass_SoundDescription,
+                                                        kQTSoundDescriptionPropertyID_AudioChannelLayout,
+                                                        acl_size, acl, NULL);
+                    dbg_printf("[  OE]  CL [%08lx] :: configure_stream__audio() = %ld, {0x%08lx, %ld, %ld}\n",
+                               (UInt32) globals, err, acl->mChannelLayoutTag,
+                               acl->mChannelBitmap, acl->mNumberChannelDescriptions);
+                } else {
+                    // try getting channel layout using getPropertyProc? :/
+                }
+            }
+
+            DisposeHandle((Handle) sdh);
+
+            if (!acl) {
+                acl_size = sizeof(AudioChannelLayout);
+                acl = (AudioChannelLayout *) calloc(1, acl_size);
+                acl->mChannelLayoutTag =
+                    si->si_a.qte_out_asbd.mChannelsPerFrame == 2 ?
+                    kAudioChannelLayoutTag_Stereo : kAudioChannelLayoutTag_Mono;
+                acl->mChannelBitmap = 0;
+                acl->mNumberChannelDescriptions = 0;
+            }
+
+            err = QTSetComponentProperty(si->si_a.stdAudio, kQTPropertyClass_SCAudio, kQTSCAudioPropertyID_InputBasicDescription,
+                                         sizeof(si->si_a.qte_out_asbd), &si->si_a.qte_out_asbd);
+            dbg_printf("[  OE]  iD [%08lx] :: configure_stream__audio() = %ld\n", (UInt32) globals, err);
+            {
+                AudioStreamBasicDescription *asbd = &si->si_a.qte_out_asbd;
+                dbg_printf("[  OE]  iD [%08lx] :: configure_stream__audio() = %ld, {%lf, '%4.4s', %04lx, %ld, %ld, %ld, %ld, %ld}\n", (UInt32) globals, err,
+                           asbd->mSampleRate, (char *) &asbd->mFormatID, asbd->mFormatFlags, asbd->mBytesPerPacket, asbd->mFramesPerPacket,
+                           asbd->mBytesPerFrame, asbd->mChannelsPerFrame, asbd->mBitsPerChannel);
+            }
+            if (!err) {
+                err = QTSetComponentProperty(si->si_a.stdAudio, kQTPropertyClass_SCAudio, kQTSCAudioPropertyID_InputChannelLayout,
+                                             acl_size, acl);
+                dbg_printf("[  OE]  iL [%08lx] :: configure_stream__audio() = %ld\n", (UInt32) globals, err);
+                if (err)
+                    err = noErr;
+            }
+        }
+    }
+
+    if (!err) {
+        /* TODO: this config should be taken from saved settings or user
+         * dialog (efectively, that's saved settings as well)
+         */
+        AudioStreamBasicDescription asbd = {si->si_a.qte_out_asbd.mSampleRate,
+                                            kAudioFormatXiphVorbis, 0, 0, 0, 0,
+                                            si->si_a.qte_out_asbd.mChannelsPerFrame, 0};
+        err = QTSetComponentProperty(si->si_a.stdAudio, kQTPropertyClass_SCAudio,
+                                     kQTSCAudioPropertyID_BasicDescription,
+                                     sizeof(asbd), &asbd);
+        dbg_printf("[  OE]  iO [%08lx] :: configure_stream__audio() = %ld\n", (UInt32) globals, err);
+
+        if (!err) {
+            err = QTGetComponentProperty(si->si_a.stdAudio, kQTPropertyClass_SCAudio,
+                                         kQTSCAudioPropertyID_BasicDescription,
+                                         sizeof(si->si_a.stda_asbd), &si->si_a.stda_asbd, NULL);
+        }
+
+        if (!err) {
+            if (si->si_a.stda_asbd.mBytesPerPacket) {
+                si->si_a.max_packet_size = asbd.mBytesPerPacket;
+            } else {
+                err = QTGetComponentProperty(si->si_a.stdAudio, kQTPropertyClass_SCAudio,
+                                             kQTSCAudioPropertyID_MaximumOutputPacketSize,
+                                             sizeof(si->si_a.max_packet_size),
+                                             &si->si_a.max_packet_size, NULL);
+            }
+        }
+        dbg_printf("[  OE]  xp [%08lx] :: configure_stream__audio()  (%ld)\n", (UInt32) globals, si->si_a.max_packet_size);
+    }
+
+    if (acl) {
+        free(acl);
+    }
+
+    return err;
+}
+
+
+ComponentResult
+fill_page__audio(OggExportGlobalsPtr globals, StreamInfoPtr si,
+                 Float64 max_duration, UInt32 *pos_sec, Float64 *pos_subsec)
+{
+    ComponentResult err = noErr;
+
+    AudioStreamPacketDescription * aspds = NULL;
+    AudioBufferList * abl = NULL;
+    UInt32 pullPackets = 8; /* TODO: calculate based on the asbd and
+                               the max_duration */
+    Boolean eos_hit = false;
+    Boolean do_loop = true;
+
+    UInt32 max_page_duration = (UInt32) (max_duration *
+                                         si->si_a.stda_asbd.mSampleRate);
+
+    dbg_printf("[  OE]  >> [%08lx] :: fill_page__audio(%lf)\n",
+               (UInt32) globals, max_duration);
+
+    if (ogg_stream_pageout(&si->os, &si->og) > 0) {
+        /* there was data left in the internal ogg_stream buffers */
+        _ready_page(si, pos_sec, pos_subsec);
+    } else {
+        /* otherwise, get more data */
+        if (si->si_a.aspds_size < pullPackets *
+            sizeof(AudioStreamPacketDescription)) {
+            si->si_a.aspds_size = pullPackets *
+                sizeof(AudioStreamPacketDescription);
+            si->si_a.aspds = realloc(si->si_a.aspds, si->si_a.aspds_size);
+        }
+        aspds = si->si_a.aspds;
+
+        if (si->si_a.abl_size < offsetof(AudioBufferList, mBuffers[1])) {
+            si->si_a.abl_size = offsetof(AudioBufferList, mBuffers[1]);
+            si->si_a.abl = realloc(si->si_a.abl, si->si_a.abl_size);
+        }
+        abl = si->si_a.abl;
+        abl->mNumberBuffers = 1;
+
+        if (si->out_buffer == NULL) {
+            si->out_buffer_size = si->si_a.max_packet_size * pullPackets;
+            si->out_buffer = calloc(1, si->out_buffer_size);
+        } else if (si->out_buffer_size < si->si_a.max_packet_size *
+                   pullPackets) {
+            si->out_buffer_size = si->si_a.max_packet_size * pullPackets;
+            si->out_buffer = realloc(si->out_buffer, si->out_buffer_size);
+        }
+
+        if (si->si_a.op_buffer_size < si->si_a.max_packet_size) {
+            si->si_a.op_buffer_size = si->si_a.max_packet_size;
+            si->si_a.op_buffer = realloc(si->si_a.op_buffer,
+                                         si->si_a.op_buffer_size);
+        }
+
+        while (do_loop) {
+            SInt32 i, pull_packets = pullPackets;
+            void *ptr = si->out_buffer;
+            int result = 0;
+
+            for (i = 0; i < abl->mNumberBuffers; i++) {
+                abl->mBuffers[i].mNumberChannels =
+                    si->si_a.stda_asbd.mChannelsPerFrame;
+                abl->mBuffers[i].mDataByteSize = si->out_buffer_size;
+                abl->mBuffers[i].mData = ptr;
+                ptr = (UInt8 *) ptr + si->out_buffer_size;
+            }
+
+            err = SCAudioFillBuffer(si->si_a.stdAudio, _InputDataProc__audio,
+                                    (void *) si, (UInt32 *) &pull_packets,
+                                    abl, aspds);
+            dbg_printf("[  OE]  .  [%08lx] :: fill_page__audio(): "
+                       "SCAudioFillBuffer(%ld) = %ld, eos: %d\n",
+                       (UInt32) globals, pull_packets, err,
+                       pull_packets == 0 &&
+                       abl->mBuffers[0].mDataByteSize == 0);
+
+            if (err == eofErr) {
+                /* This should never happen if we don't
+                   return eofErr from out InputDataProc! */
+                err = noErr;
+                eos_hit = true;
+            }
+
+            if (err)
+                break;
+
+            if (pull_packets == 0 && abl->mBuffers[0].mDataByteSize == 0) {
+                eos_hit = true;
+            }
+
+            if (si->si_a.op.packet != NULL) {
+                if (eos_hit)
+                    si->si_a.op.e_o_s = 1;
+                si->acc_packets++;
+                si->acc_duration += si->si_a.op_duration;
+                result = ogg_stream_packetin(&si->os, &si->si_a.op);
+                dbg_printf("[  OE] _i  [%08lx] :: fill_page__audio(): "
+                           "ogg_stream_packetin(%lld, %ld, %lld) = %d\n",
+                           (UInt32) globals, si->si_a.op.packetno,
+                           si->si_a.op.bytes, si->si_a.op.granulepos,
+                           result);
+                si->si_a.op.bytes = 0;
+                si->si_a.op.packet = NULL;
+            }
+
+            if (pull_packets > 0) {
+                pull_packets--;
+                for (i = 0; i < pull_packets; i++) {
+                    si->si_a.op.bytes = aspds[i].mDataByteSize;
+                    si->si_a.op.b_o_s = 0;
+                    si->si_a.op.e_o_s = 0;
+                    si->si_a.op.packetno = si->packets_total++;
+                    si->acc_packets++;
+                    si->last_grpos += aspds[i].mVariableFramesInPacket;
+                    si->si_a.op.granulepos = si->last_grpos;
+                    si->acc_duration += aspds[i].mVariableFramesInPacket;
+                    si->si_a.op.packet = (UInt8 *) abl->mBuffers[0].mData +
+                        aspds[i].mStartOffset;
+                    result = ogg_stream_packetin(&si->os, &si->si_a.op);
+                    dbg_printf("[  OE]  i  [%08lx] :: fill_page__audio(): "
+                               "ogg_stream_packetin(%lld, %ld, %lld) = %d\n",
+                               (UInt32) globals, si->si_a.op.packetno,
+                               si->si_a.op.bytes, si->si_a.op.granulepos,
+                               result);
+                }
+
+                si->si_a.op.bytes = aspds[i].mDataByteSize;
+                si->si_a.op.b_o_s = 0;
+                si->si_a.op.e_o_s = 0;
+                si->si_a.op.packetno = si->packets_total++;
+                si->last_grpos += aspds[i].mVariableFramesInPacket;
+                si->si_a.op.granulepos = si->last_grpos;
+                si->si_a.op_duration = aspds[i].mVariableFramesInPacket;
+                si->si_a.op.packet = (UInt8 *) abl->mBuffers[0].mData +
+                    aspds[i].mStartOffset;
+
+                if (si->si_a.op_buffer_size < si->si_a.op.bytes) {
+                    si->si_a.op_buffer_size = si->si_a.op.bytes;
+                    si->si_a.op_buffer = realloc(si->si_a.op_buffer,
+                                                 si->si_a.op_buffer_size);
+                }
+                BlockMoveData((UInt8 *) abl->mBuffers[0].mData +
+                              aspds[i].mStartOffset, si->si_a.op_buffer,
+                              aspds[i].mDataByteSize);
+                si->si_a.op.packet = si->si_a.op_buffer;
+            }
+
+            if (((eos_hit || si->acc_duration > max_page_duration) &&
+                 ogg_stream_flush(&si->os, &si->og) > 0) ||
+                (ogg_stream_pageout(&si->os, &si->og) > 0)) {
+                _ready_page(si, pos_sec, pos_subsec);
+                do_loop = false;
+            }
+        }
+    }
+
+    dbg_printf("[  OE] <   [%08lx] :: fill_page__audio() = %ld (%ld, %lf)\n",
+               (UInt32) globals, err, *pos_sec, *pos_subsec);
+    return err;
+}
+
+ComponentResult write_i_header__audio(StreamInfoPtr si, DataHandler data_h,
+                                      wide *offset)
+{
+    // TODO: handle speex and FLAC headers/cookies as well!
+
+    ComponentResult err = noErr;
+    void * magicCookie = NULL;
+    UInt32 cookieSize = 0;
+
+    err = QTGetComponentPropertyInfo(si->si_a.stdAudio,
+                                     kQTPropertyClass_SCAudio,
+                                     kQTSCAudioPropertyID_MagicCookie,
+                                     NULL, &cookieSize, NULL);
+
+    if (!err) {
+        magicCookie = calloc(1, cookieSize);
+        err = QTGetComponentProperty(si->si_a.stdAudio,
+                                     kQTPropertyClass_SCAudio,
+                                     kQTSCAudioPropertyID_MagicCookie,
+                                     cookieSize, magicCookie, NULL);
+
+    }
+
+    if (!err) {
+        UInt8 *ptrheader = (UInt8 *) magicCookie;
+        UInt8 *cend = ptrheader + cookieSize;
+        CookieAtomHeader *aheader = (CookieAtomHeader *) ptrheader;
+        ogg_packet header, header_vc, header_cb;
+        header.bytes = header_vc.bytes = header_cb.bytes = 0;
+
+        while (ptrheader < cend) {
+            aheader = (CookieAtomHeader *) ptrheader;
+            ptrheader += EndianU32_BtoN(aheader->size);
+            if (ptrheader > cend || EndianU32_BtoN(aheader->size) <= 0)
+                break;
+
+            switch (EndianS32_BtoN(aheader->type)) {
+            case kCookieTypeVorbisHeader:
+                header.b_o_s = 1;
+                header.e_o_s = 0;
+                header.granulepos = 0;
+                header.packetno = 0;
+                header.bytes = EndianS32_BtoN(aheader->size) - 2 * sizeof(long);
+                header.packet = aheader->data;
+                break;
+
+            case kCookieTypeVorbisComments:
+                header_vc.b_o_s = 0;
+                header_vc.e_o_s = 0;
+                header_vc.granulepos = 0;
+                header_vc.packetno = 1;
+                header_vc.bytes = EndianS32_BtoN(aheader->size) - 2 * sizeof(long);
+                header_vc.packet = aheader->data;
+                break;
+
+            case kCookieTypeVorbisCodebooks:
+                header_cb.b_o_s = 0;
+                header_cb.e_o_s = 0;
+                header_cb.granulepos = 0;
+                header_cb.packetno = 2;
+                header_cb.bytes = EndianS32_BtoN(aheader->size) - 2 * sizeof(long);
+                header_cb.packet = aheader->data;
+                break;
+
+            default:
+                break;
+            }
+        }
+
+        if (header.bytes == 0 || header_vc.bytes == 0 || header_cb.bytes == 0) {
+            err = paramErr;
+        } else {
+            ogg_stream_packetin(&si->os, &header);
+            _flush_ogg(si, data_h, offset);
+
+            ogg_stream_packetin(&si->os, &header_vc);
+            ogg_stream_packetin(&si->os, &header_cb);
+            //_flush_ogg(si, data_h, offset);
+
+            si->packets_total = 3;
+            si->acc_packets = 2;
+            si->acc_duration = 0;
+        }
+    }
+
+    if (magicCookie != NULL) {
+        free(magicCookie);
+        magicCookie = NULL;
+    }
+
+    return err;
+}
+
+ComponentResult write_headers__audio(StreamInfoPtr si, DataHandler data_h,
+                                     wide *offset)
+{
+    /* Simplified at the moment - packets are pulled into the stream in the
+     * initial header setup, and here we assume they are still in the stream
+     * and just flush them.
+     */
+    ComponentResult err = noErr;
+
+    err = _flush_ogg(si, data_h, offset);
+
+    if (!err) {
+        si->acc_packets = 0;
+        si->acc_duration = 0;
+    }
+
+    return err;
+}


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

Added: trunk/xiph-qt/OggExport/src/stream_audio.h
===================================================================
--- trunk/xiph-qt/OggExport/src/stream_audio.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/stream_audio.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,72 @@
+/*
+ *  stream_audio.h
+ *
+ *    Declaration of audio stream related functions of OggExporter.
+ *
+ *
+ *  Copyright (c) 2006  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_audio_h__)
+#define __stream_audio_h__
+
+#include "exporter_types.h"
+
+extern Boolean
+can_handle_track__audio(OSType trackType, TimeScale scale,
+                        MovieExportGetPropertyUPP getPropertyProc,
+                        void *refCon);
+extern ComponentResult
+validate_movie__audio(OggExportGlobals *globals, Movie theMovie,
+                      Track onlyThisTrack, Boolean *valid);
+extern ComponentResult
+configure_stream__audio(OggExportGlobals *globals, StreamInfo *si);
+
+extern ComponentResult
+write_i_header__audio(StreamInfoPtr si, DataHandler data_h,
+                      wide *offset);
+extern ComponentResult
+write_headers__audio(StreamInfoPtr si, DataHandler data_h,
+                     wide *offset);
+extern ComponentResult
+fill_page__audio(OggExportGlobalsPtr globals, StreamInfoPtr si,
+                 Float64 max_duration, UInt32 *pos_sec,
+                 Float64 *pos_subsec);
+
+extern ComponentResult initialize_stream__audio(StreamInfo *si);
+extern void clear_stream__audio(StreamInfo *si);
+
+
+#define HANDLE_FUNCTIONS__AUDIO { &can_handle_track__audio,     \
+            &validate_movie__audio, &configure_stream__audio,   \
+            &write_i_header__audio, &write_headers__audio,      \
+            &fill_page__audio,                                  \
+            &initialize_stream__audio, &clear_stream__audio }
+
+
+extern ComponentResult
+extract_audio(OggExportGlobalsPtr globals, StreamInfoPtr si,
+              DataHandler data_h);
+
+#endif /* __stream_audio_h__ */


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

Added: trunk/xiph-qt/OggExport/src/stream_types_audio.h
===================================================================
--- trunk/xiph-qt/OggExport/src/stream_types_audio.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggExport/src/stream_types_audio.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -0,0 +1,63 @@
+/*
+ *  stream_types_audio.h
+ *
+ *    Definition of audio stream data structures for OggExport.
+ *
+ *
+ *  Copyright (c) 2006  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_audio_h__)
+#define __stream_types_audio_h__
+
+enum {
+    kOES_A_init_op_size = 1024,
+};
+
+typedef struct {
+    ComponentInstance stdAudio;
+
+    // quickTimeMovieExporter output asbd
+    AudioStreamBasicDescription qte_out_asbd;
+
+    // stdAudioComponent output format asbd
+    AudioStreamBasicDescription stda_asbd;
+
+    ogg_packet op;
+    UInt32 op_duration;
+    void * op_buffer;
+    UInt32 op_buffer_size;
+
+    UInt32 max_packet_size;
+
+    AudioBufferList * abl;
+    UInt32 abl_size;
+
+    AudioStreamPacketDescription * aspds;
+    UInt32 aspds_size;
+
+} StreamInfo__audio;
+
+#define _HAVE__OE_AUDIO 1
+#endif /* __stream_types_audio_h__ */


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

Modified: trunk/xiph-qt/OggImport/Info.plist
===================================================================
--- trunk/xiph-qt/OggImport/Info.plist	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggImport/Info.plist	2006-11-12 14:44:51 UTC (rev 12093)
@@ -7,7 +7,7 @@
 	<key>CFBundleExecutable</key>
 	<string>OggImport</string>
 	<key>CFBundleGetInfoString</key>
-	<string>QuickTime Ogg Importer Component 0.1.6, Copyright © 2005-2006 Arek Korbik</string>
+	<string>QuickTime Ogg Importer Component 0.1.7, Copyright © 2005-2006 Arek Korbik</string>
 	<key>CFBundleIconFile</key>
 	<string></string>
 	<key>CFBundleIdentifier</key>
@@ -17,13 +17,13 @@
 	<key>CFBundlePackageType</key>
 	<string>BNDL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>0.1.6</string>
+	<string>0.1.7</string>
 	<key>CFBundleSignature</key>
 	<string>eat </string>
 	<key>CFBundleVersion</key>
-	<string>0.1.6</string>
+	<string>0.1.7</string>
 	<key>NSHumanReadableCopyright</key>
-	<string>QuickTime Ogg Importer Component 0.1.6, Copyright © 2005-2006 Arek Korbik</string>
+	<string>QuickTime Ogg Importer Component 0.1.7, Copyright © 2005-2006 Arek Korbik</string>
 	<key>CSResourcesFileMapped</key>
 	<true/>
 </dict>

Modified: trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj
===================================================================
--- trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggImport/OggImport.xcodeproj/project.pbxproj	2006-11-12 14:44:51 UTC (rev 12093)
@@ -27,30 +27,6 @@
 		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;
@@ -257,15 +233,6 @@
 			);
 			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;
@@ -280,12 +247,6 @@
 		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 = "";

Modified: trunk/xiph-qt/OggImport/src/OggImportDispatch.h
===================================================================
--- trunk/xiph-qt/OggImport/src/OggImportDispatch.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggImport/src/OggImportDispatch.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -1,5 +1,5 @@
 /*
- *  OggImport.h
+ *  OggImportDispatch.h
  *
  *    OggImport component dispatch helper header.
  *

Modified: trunk/xiph-qt/OggImport/src/versions.h
===================================================================
--- trunk/xiph-qt/OggImport/src/versions.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/OggImport/src/versions.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -32,9 +32,9 @@
 #define __versions_h__
 
 #ifdef DEBUG
-#define kOgg_eat__Version		(0x00FF0106)
+#define kOgg_eat__Version		(0x00FF0107)
 #else
-#define kOgg_eat__Version		(0x00000106)
+#define kOgg_eat__Version		(0x00000107)
 #endif /* DEBUG */
 
 #endif /* __versions_h__ */

Modified: trunk/xiph-qt/README
===================================================================
--- trunk/xiph-qt/README	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/README	2006-11-12 14:44:51 UTC (rev 12093)
@@ -52,6 +52,9 @@
 ./OggImport
 	Ogg QuickTime MovieImporter component files
 
+./OggExport
+	Ogg QuickTime Movie Data Export component files
+
 ./Theora
         Theora QuickTime ImageCodec component files
 

Modified: trunk/xiph-qt/Theora/Theora.xcodeproj/project.pbxproj
===================================================================
--- trunk/xiph-qt/Theora/Theora.xcodeproj/project.pbxproj	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/Theora/Theora.xcodeproj/project.pbxproj	2006-11-12 14:44:51 UTC (rev 12093)
@@ -17,21 +17,6 @@
 		8D01CCCE0486CAD60068D4B7 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08EA7FFBFE8413EDC02AAC07 /* Carbon.framework */; };
 /* End PBXBuildFile section */
 
-/* Begin PBXBuildStyle section */
-		4F9091AC011F3BD104CA0E50 /* Debug */ = {
-			isa = PBXBuildStyle;
-			buildSettings = {
-			};
-			name = Debug;
-		};
-		4F9091AD011F3BD104CA0E50 /* Release */ = {
-			isa = PBXBuildStyle;
-			buildSettings = {
-			};
-			name = Release;
-		};
-/* End PBXBuildStyle section */
-
 /* Begin PBXCopyFilesBuildPhase section */
 		736ED3770A0FF5E8005F518F /* CopyFiles */ = {
 			isa = PBXCopyFilesBuildPhase;
@@ -160,8 +145,6 @@
 			);
 			buildRules = (
 			);
-			buildSettings = {
-			};
 			dependencies = (
 			);
 			name = Theora;
@@ -176,12 +159,6 @@
 		089C1669FE841209C02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 4FADC23708B4156C00ABE55E /* Build configuration list for PBXProject "Theora" */;
-			buildSettings = {
-			};
-			buildStyles = (
-				4F9091AC011F3BD104CA0E50 /* Debug */,
-				4F9091AD011F3BD104CA0E50 /* Release */,
-			);
 			hasScannedForEncodings = 1;
 			mainGroup = 089C166AFE841209C02AAC07 /* Theora */;
 			projectDirPath = "";

Modified: trunk/xiph-qt/common/XCACodec.cpp
===================================================================
--- trunk/xiph-qt/common/XCACodec.cpp	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/common/XCACodec.cpp	2006-11-12 14:44:51 UTC (rev 12093)
@@ -49,25 +49,38 @@
 void XCACodec::AppendInputData(const void* inInputData, UInt32& ioInputDataByteSize, UInt32& ioNumberPackets,
                                const AudioStreamPacketDescription* inPacketDescription)
 {
-    dbg_printf(" >> [%08lx] XCACodec :: AppendInputData(%ld [%ld])\n", (UInt32) this, ioNumberPackets, ioInputDataByteSize);
+    dbg_printf("[ XC ]  >> [%08lx] AppendInputData(%ld [%ld] %d)\n", (UInt32) this, ioNumberPackets, ioInputDataByteSize, inPacketDescription != NULL);
     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;
-            dbg_printf("     ----  :: %ld: %ld [%ld]\n", packet, inPacketDescription[packet].mDataByteSize,
-                       inPacketDescription[packet].mVariableFramesInPacket);
-            InPacket(inInputData, &inPacketDescription[packet]);
+        UInt32 packets_added = 0;
+        if (inPacketDescription != NULL) {
+            while (packet < ioNumberPackets) {
+                if (bytes + inPacketDescription[packet].mDataByteSize > bytesToCopy)
+                    break;
+                dbg_printf("     ----  :: %ld: %ld [%ld]\n", packet, inPacketDescription[packet].mDataByteSize,
+                           inPacketDescription[packet].mVariableFramesInPacket);
+                InPacket(inInputData, &inPacketDescription[packet]);
 
-            bytes += inPacketDescription[packet].mDataByteSize;
-            packet++;
+                bytes += inPacketDescription[packet].mDataByteSize;
+                packet++;
+                packets_added++;
+            }
+        } else {
+            if (ioInputDataByteSize < bytesToCopy)
+                bytesToCopy = ioInputDataByteSize;
+            AudioStreamPacketDescription gen_pd = {0, bytesToCopy / mInputFormat.mBytesPerFrame, bytesToCopy};
+            dbg_printf("     -__-  :: %d: %ld [%ld]\n", 0, gen_pd.mDataByteSize, gen_pd.mVariableFramesInPacket);
+            InPacket(inInputData, &gen_pd);
+            bytes += bytesToCopy;
+            packets_added++;
+            packet = bytesToCopy / mInputFormat.mBytesPerFrame;
         }
 
-        if (bytes == 0)
+        if (bytes == 0 && packets_added == 0)
             CODEC_THROW(kAudioCodecNotEnoughBufferSpaceError);
         else {
             ioInputDataByteSize = bytes;
@@ -76,13 +89,13 @@
     } else {
         CODEC_THROW(kAudioCodecNotEnoughBufferSpaceError);
     }
-    dbg_printf("<.. [%08lx] XCACodec :: AppendInputData()\n", (UInt32) this);
+    dbg_printf("[ XC ] <.. [%08lx] AppendInputData()\n", (UInt32) this);
 }
 
 UInt32 XCACodec::ProduceOutputPackets(void* outOutputData, UInt32& ioOutputDataByteSize, UInt32& ioNumberPackets,
                                       AudioStreamPacketDescription* outPacketDescription)
 {
-    dbg_printf(" >> [%08lx] XCACodec :: ProduceOutputPackets(%ld [%ld])\n", (UInt32) this, ioNumberPackets, ioOutputDataByteSize);
+    dbg_printf("[ XC ]  >> [%08lx] ProduceOutputPackets(%ld [%ld] %d)\n", (UInt32) this, ioNumberPackets, ioOutputDataByteSize, outPacketDescription != NULL);
 
     UInt32 theAnswer = kAudioCodecProduceOutputPacketSuccess;
 
@@ -114,7 +127,7 @@
                     ioNumberPackets = pout;
                     ioOutputDataByteSize = mOutputFormat.mBytesPerFrame * fout;
                     theAnswer = kAudioCodecProduceOutputPacketFailure;
-                    dbg_printf("<!! [%08lx] XCACodec :: ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n", (UInt32) this,
+                    dbg_printf("[ XC ] <!! [%08lx] ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n", (UInt32) this,
                                ioNumberPackets, ioOutputDataByteSize, theAnswer, FramesReady());
                     return theAnswer;
                 }
@@ -127,7 +140,7 @@
         if ((fout + frames) * mOutputFormat.mBytesPerFrame > ioOutputDataByteSize)
             frames = requested_space_as_frames - fout;
 
-        OutputFrames(outOutputData, frames, fout);
+        OutputFrames(outOutputData, frames, fout, outPacketDescription);
 
         fout += frames;
 
@@ -144,7 +157,7 @@
     theAnswer = (FramesReady() > 0 || !BufferIsEmpty()) ? kAudioCodecProduceOutputPacketSuccessHasMore
         : kAudioCodecProduceOutputPacketSuccess;
 
-    dbg_printf("<.. [%08lx] XCACodec :: ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n",
+    dbg_printf("[ XC ] <.. [%08lx] ProduceOutputPackets(%ld [%ld]) = %ld [%ld]\n",
                (UInt32) this, ioNumberPackets, ioOutputDataByteSize, theAnswer, FramesReady());
     return theAnswer;
 }

Modified: trunk/xiph-qt/common/XCACodec.h
===================================================================
--- trunk/xiph-qt/common/XCACodec.h	2006-11-12 13:40:14 UTC (rev 12092)
+++ trunk/xiph-qt/common/XCACodec.h	2006-11-12 14:44:51 UTC (rev 12093)
@@ -86,7 +86,8 @@
 
     virtual UInt32 FramesReady() const = 0;
     virtual Boolean GenerateFrames() = 0;
-    virtual void OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset) const = 0;
+    virtual void OutputFrames(void* outOutputData, UInt32 inNumberFrames, UInt32 inFramesOffset,
+                              AudioStreamPacketDescription* outPacketDescription) const = 0;
     virtual void Zap(UInt32 inFrames) = 0;
 
     virtual UInt32 InPacketsConsumed() const;


Property changes on: trunk/xiph-qt/external-libs
___________________________________________________________________
Name: svn:externals
   + ogg                     http://svn.xiph.org/trunk/ogg
vorbis                  http://svn.xiph.org/trunk/vorbis
speex                   http://svn.xiph.org/trunk/speex
theora                  http://svn.xiph.org/trunk/theora
theora-exp              http://svn.xiph.org/trunk/theora-exp




More information about the commits mailing list