Re: iOS audio file metadata
Re: iOS audio file metadata
- Subject: Re: iOS audio file metadata
- From: tahome izwah <email@hidden>
- Date: Wed, 30 Mar 2011 07:45:43 +0200
Check out AudioFileSetUserData/AudioFileGetUserData. We're using them
to write arbitrary data (a BEXT chunk in our case).
HTH
--th
2011/3/30 Brian Gerstle <email@hidden>:
> Hello everyone,
> I was wondering if anyone has experience reading & writing metadata to an
> audio file in iOS. So far we've tried:
>
> AudioFileGet/SetProperty
> kAudioFilePropertyInfoDictionary
>
> kAFInfoDictionary_Comments
>
> kAudioFilePropertyID3Tag
>
> I'm getting the 'pty?' error code returned when I try to write to the info
> dictionary or read the ID3 tag. Also, the only "visible" key/value pair
> when I get the dictionary is the "approximate duration." I've attached some
> code to demonstrate how I'm trying to use these functions.
> Thanks in advance!
> Brian
> P.S.
> My colleague also posted to Apple's Core Audio support forum:
> https://devforums.apple.com/message/409115#409115
> {
> NSURL* url = [ NSURL fileURLWithPath: path2 ];
> OSStatus err;
> AudioFileID fileID;
> err = AudioFileOpenURL ((CFURLRef)url, kAudioFileReadWritePermission,
> kAudioFileWAVEType,&fileID );
> if (err == noErr)
> {
> CFDictionaryRef fileDict = nil;
> UInt32 size = sizeof(fileDict);
> err = AudioFileGetProperty(fileID, kAudioFilePropertyInfoDictionary,
> &size, &fileDict);
> if (err == noErr)
> {
> NSDictionary* dict = (NSDictionary*) fileDict;
> NSLog(@"%@",dict);
> NSMutableDictionary* dict2 = [ [ NSMutableDictionary alloc ]
> init ];
> [ dict2 addEntriesFromDictionary:dict ];
> [ dict2 setObject:@"test" forKey: [ NSString
> stringWithUTF8String:kAFInfoDictionary_Comments ] ];
> err = AudioFileSetProperty(fileID,
> kAudioFilePropertyInfoDictionary, size, dict2);
> if (err == noErr)
> {
> // this point isn't reached
> NSLog(@"saved");
> }
> }
> AudioFileClose(fileID);
> }
> }
> ...
> {
> UInt32 outDataSize = 0;
> UInt32 isWritable = 0;
>
> // 'pty?' error here
> err
> = AudioFileGetPropertyInfo(fileID,kAudioFilePropertyID3Tag,&outDataSize,&isWritable);
>
>
> NSLog(@"outDataSize %d isWritable %d",outDataSize,isWritable);
>
> unsigned char* id3data = malloc(outDataSize);
>
> err = AudioFileGetProperty(fileID,
> kAudioFilePropertyID3Tag, &outDataSize, id3data);
>
> err++;
> }
>
>
>
> _______________________________________________
> 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
>
_______________________________________________
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