[xiph-commits] r16152 - in trunk/xiph-qt: . OggExport/src
arek at svn.xiph.org
arek at svn.xiph.org
Sun Jun 21 10:16:36 PDT 2009
Author: arek
Date: 2009-06-21 10:16:36 -0700 (Sun, 21 Jun 2009)
New Revision: 16152
Modified:
trunk/xiph-qt/ChangeLog
trunk/xiph-qt/OggExport/src/OggExport.c
Log:
* OggExport/src/OggExport.c:
Don't expect the StdAudio compression component to do double
conversion - initialize it with LPCM as input instead.
Fixes #1305.
Modified: trunk/xiph-qt/ChangeLog
===================================================================
--- trunk/xiph-qt/ChangeLog 2009-06-21 16:43:42 UTC (rev 16151)
+++ trunk/xiph-qt/ChangeLog 2009-06-21 17:16:36 UTC (rev 16152)
@@ -1,3 +1,10 @@
+2009-06-21 Arek Korbik <arkadini at gmail.com>
+
+ * OggExport/src/OggExport.c:
+ Don't expect the StdAudio compression component to do double
+ conversion - initialize it with LPCM as input instead.
+ Fixes #1305.
+
=== release 0.1.9 ===
2009-06-14 Arek Korbik <arkadini at gmail.com>
Modified: trunk/xiph-qt/OggExport/src/OggExport.c
===================================================================
--- trunk/xiph-qt/OggExport/src/OggExport.c 2009-06-21 16:43:42 UTC (rev 16151)
+++ trunk/xiph-qt/OggExport/src/OggExport.c 2009-06-21 17:16:36 UTC (rev 16152)
@@ -170,6 +170,10 @@
#endif
+#define DBG_SOUNDDESC_FMT "[SD: fmt='%4.4s', ch=%d, sr=%lf, bps=%d]"
+#define DBG_SOUNDDESC_FILL(x) ((char *) (&(x)->dataFormat)), (x)->numChannels, ((x)->sampleRate / 65536.0), (x)->sampleSize
+
+
pascal ComponentResult OggExportOpen(OggExportGlobalsPtr globals, ComponentInstance self) {
ComponentDescription cd;
ComponentResult err;
@@ -712,15 +716,42 @@
if (track != NULL)
media = GetTrackMedia(track);
- if (media != NULL)
+ if (media != NULL) {
GetMediaSampleDescription(media, 1, (SampleDescriptionHandle) sdh);
+ dbg_printf("[ OE] !sd [%08lx] :: ConfigAndShowStdAudioDlg() :: " DBG_SOUNDDESC_FMT "\n", (UInt32) globals, DBG_SOUNDDESC_FILL(*sdh));
+ }
if (GetHandleSize((Handle) sdh) > 0) {
- err = QTSetComponentProperty(stdAudio, kQTPropertyClass_SCAudio,
- kQTSCAudioPropertyID_InputSoundDescription,
- sizeof(SoundDescriptionHandle), &sdh);
- dbg_printf("[ OE] sd [%08lx] :: ConfigAndShowStdAudioDlg() = %ld\n", (UInt32) globals, err);
+ SoundDescriptionHandle sdh_v2;
+ SoundDescriptionV2Ptr sd;
+ err = QTSoundDescriptionConvert(kQTSoundDescriptionKind_Movie_AnyVersion,
+ sdh, kQTSoundDescriptionKind_Movie_Version2, &sdh_v2);
+ if (!err) {
+ AudioStreamBasicDescription asbd;
+ sd = (SoundDescriptionV2Ptr) *sdh_v2;
+
+ // here we're "pretending" that the input is uncompressed floats - the actually important bits are sample rate and number of channels;
+ // eventually, we'll be extracting uncompressed PCM samples from the source movie, anyway...
+ asbd.mSampleRate = sd->audioSampleRate;
+ asbd.mChannelsPerFrame = sd->numAudioChannels;
+ asbd.mFormatID = kAudioFormatLinearPCM;
+ asbd.mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+ asbd.mFramesPerPacket = 1;
+ asbd.mBitsPerChannel = 32;
+ asbd.mBytesPerFrame = sd->numAudioChannels * 4;
+ asbd.mBytesPerPacket = sd->numAudioChannels * 4;
+
+ // channel layout shouldn't matter here... right? :/
+
+ err = QTSetComponentProperty(stdAudio, kQTPropertyClass_SCAudio,
+ kQTSCAudioPropertyID_InputBasicDescription,
+ sizeof(asbd), &asbd);
+ dbg_printf("[ OE] =bd [%08lx] :: ConfigAndShowStdAudioDlg() = %ld\n", (UInt32) globals, err);
+ }
+
+ DisposeHandle((Handle) sdh_v2);
}
+
DisposeHandle((Handle) sdh);
} else {
err = _preconfig_stdaudio(stdAudio);
More information about the commits
mailing list