Re: set kAudioFilePropertyAlbumArtwork: fail
Re: set kAudioFilePropertyAlbumArtwork: fail
- Subject: Re: set kAudioFilePropertyAlbumArtwork: fail
- From: Kyle Sluder <email@hidden>
- Date: Mon, 05 Aug 2013 10:30:56 -0700
On Mon, Aug 5, 2013, at 01:37 AM, Alex _ wrote:
> Unfortunately, as soon as I try to set the artwork, the
> AudioFileSetProperty doesn't fail, but AudioFileClose does.
> Specifically I get: +[NSConcreteData bytes]: unrecognized selector sent
> to class
>
> ...
> NSData *image = [NSData dataWithContentsOfFile:@"/tmp/test.jpg"];
> if (image != NULL)
> {
> checkError("AudioFileSetProperty",
> AudioFileSetProperty(audioID,
> kAudioFilePropertyAlbumArtwork,
> (UInt32)[image length],
> CFBridgingRetain(image)));
You're assigning a pointer to the NSData object as a property value, but
telling AudioFileSetData that you're actually assigning a value of the
size of the bytes held by that NSData. At some point this corrupts your
heap, and -data (an instance method) winds up getting sent to
NSConcreteData (the class).
You want to do:
AudioFileSetProperty(audioID, kAudioFilePropertyAlbumArtwork,
(UInt32)[image length], [image bytes]);
--Kyle Sluder
_______________________________________________
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