I'm having difficulties writing a audio file's metadata:
AudioFileID fileID = nil;
AudioFileOpenURL((__bridge CFURLRef) url, kAudioFileReadWritePermission, 0, &fileID );
CFDictionaryRef piDict = nil;
UInt32 piDataSize = sizeof(piDict);
AudioFileGetProperty( fileID, kAudioFilePropertyInfoDictionary, &piDataSize, &piDict );
NSLog(@"%@", (__bridge NSDictionary *)piDict);
NSMutableDictionary *dict = (__bridge NSMutableDictionary*)piDict;
[dict setObject:@"NEW ALBUM NAME" forKey:@"album"];
piDict = (__bridge CFDictionaryRef)dict;
piDataSize = sizeof(dict);
OSStatus status = AudioFileSetProperty(fileID, kAudioFilePropertyInfoDictionary, piDataSize, &piDict);
The NSLog on line #6 gives me a nice dictionary with ID3 information.
But when I want to alter (for instance the album name, line #9) I get an OSStatus 'pty?' in return.
Anyone who can give me pointers on what I'm doing wrong.
Or maybe even a better / simpler / quicker way to edit ID3 tags / metadata for audio files.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…