• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
ExtAudioFileWrapAudioFileID crashing in Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ExtAudioFileWrapAudioFileID crashing in Leopard


  • Subject: ExtAudioFileWrapAudioFileID crashing in Leopard
  • From: "Stephen F. Booth" <email@hidden>
  • Date: Sun, 28 Oct 2007 20:42:54 -0700

Hello all,

I recently upgraded to Leopard and am in the process of getting code that functions properly on 10.4 working on 10.5. I've run into a problem that I can't quite figure out, and before filing a radar I wanted to see if anyone on this last had any ideas. For some reason I am unable to create an empty AudioFileID and wrap it using ExtAudioFile. My code looks like the following:

	// Desired output
	AudioStreamBasicDescription asbd;
	bzero(&asbd, sizeof(AudioStreamBasicDescription));
	asbd.mFormatID			= kAudioFormatMPEG4AAC_HE;
	asbd.mFormatFlags		= kAudioFormatFlagsAreAllClear;
	asbd.mSampleRate		= 44100.;
	asbd.mChannelsPerFrame	= 2;

	NSString *filename = @"/tmp/foo.m4a";

// Touch the output file
NSNumber *permissions = [NSNumber numberWithUnsignedLong:S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:permissions forKey:NSFilePosixPermissions];
BOOL result = [[NSFileManager defaultManager] createFileAtPath:filename contents:nil attributes:attributes];
NSAssert(YES == result, NSLocalizedStringFromTable(@"Unable to create the output file.", @"Exceptions", @""));

// Open the output file
// There is no convenient ExtAudioFile API for wiping clean an existing file, so use AudioFile
FSRef ref;
OSStatus err = FSPathMakeRef((const UInt8 *)[filename fileSystemRepresentation], &ref, NULL);
NSAssert1(noErr == err, NSLocalizedStringFromTable(@"Unable to locate the output file.", @"Exceptions", @""), UTCreateStringForOSType(err));

AudioFileID audioFile;
err = AudioFileInitialize(&ref, kAudioFileM4AType, &asbd, 0, &audioFile);
NSAssert2(noErr == err, NSLocalizedStringFromTable(@"The call to %@ failed.", @"Exceptions", @""), @"AudioFileInitialize", UTCreateStringForOSType(err));

ExtAudioFileRef extAudioFile;
err = ExtAudioFileWrapAudioFileID(audioFile, YES, &extAudioFile);
NSAssert2(noErr == err, NSLocalizedStringFromTable(@"The call to %@ failed.", @"Exceptions", @""), @"ExtAudioFileWrapAudioFileID", UTCreateStringForOSType(err));


err = ExtAudioFileDispose(extAudioFile);
NSAssert2(noErr == err, NSLocalizedStringFromTable(@"The call to %@ failed.", @"Exceptions", @""), @"ExtAudioFileDispose", UTCreateStringForOSType(err));


err = AudioFileClose(audioFile);
NSAssert2(noErr == err, NSLocalizedStringFromTable(@"The call to %@ failed.", @"Exceptions", @""), @"AudioFileClose", UTCreateStringForOSType(err));


Running the code above results in a segmentation fault:

#0	0x91ee92a8 in MP4BoxParser_Track::GetInfoFromTrackSubBoxes
#1	0x91ee99fc in MP4BoxParser_Track::GetASBD
#2	0x91ee0410 in MP4AudioFile::GetFormatListInfo
#3	0x91e9bbf4 in AudioFileObject::GetPropertyInfo
#4	0x91e9a744 in AudioFileGetPropertyInfo
#5	0x91eaed04 in ExtAudioFile::GetExistingFileInfo
#6	0x91eb04c0 in ExtAudioFile::Wrap
#7	0x91ea4e18 in ExtAudioFileWrapAudioFileID
#8	0x00002768 in -[MyDocument action:] at MyDocument.m:102
#9	0x9380835c in -[NSApplication sendAction:to:from:]
#10	0x93808290 in -[NSControl sendAction:to:]
#11	0x938077a8 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:]
#12	0x938070e0 in -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:]
#13	0x93806a1c in -[NSControl mouseDown:]
#14	0x93805458 in -[NSWindow sendEvent:]
#15	0x937d88f4 in -[NSApplication sendEvent:]
#16	0x93745ed8 in -[NSApplication run]
#17	0x93716930 in NSApplicationMain
#18	0x00002bd8 in main at main.m:13

Is there something wrong with my code or is this a bug in ExtAudioFile?

Thanks,
Stephen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: ExtAudioFileWrapAudioFileID crashing in Leopard
      • From: William Stewart <email@hidden>
  • Prev by Date: Re: ExtAudioFileRead() + mp3 + 10.5 Crash
  • Next by Date: Firewire audio testing
  • Previous by thread: Having AudioConverter recognise custom AudioCodec components
  • Next by thread: Re: ExtAudioFileWrapAudioFileID crashing in Leopard
  • Index(es):
    • Date
    • Thread