• 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
iOS audio file metadata
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iOS audio file metadata


  • Subject: iOS audio file metadata
  • From: Brian Gerstle <email@hidden>
  • Date: Tue, 29 Mar 2011 18:34:37 -0400

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

  • Follow-Ups:
    • Re: iOS audio file metadata
      • From: tahome izwah <email@hidden>
    • Re: iOS audio file metadata
      • From: Wil Macaulay <email@hidden>
  • Prev by Date: Re: XCode 3.2.6 no longer supports PPC?
  • Next by Date: Re: iOS audio file metadata
  • Previous by thread: Re: XCode 3.2.6 no longer supports PPC?
  • Next by thread: Re: iOS audio file metadata
  • Index(es):
    • Date
    • Thread