Audio Toolbox should support ipod-library:// style URLs

Originator:invalidname
Number:rdar://8207541 Date Originated:7/19/10
Status:Duplicate Resolved:20-Jul-2010 12:22 PM
Product:iPhone SDK Product Version:4.0.1
Classification:Enhancement Reproducible:N/A
 
Summary:
iOS 4 allows third-party apps limited access to the actual audio from songs, podcasts, and audio books in the user's music library.  This is implemented in the form of a new MPMediaItem property, MPMediaItemPropertyAssetURL.  The URL is of a special form, ipod-library://item/item.m4a?id=12345, and is documented as only being supported by AV Foundation.  And indeed, if you try to open such a URL with an Core Audio / Audio Toolbox API, it doesn't work.

I think it should. The idea of allowing Core Audio to access the media library has many interesting uses.  CA apps could provide visualizations of song data, perform various forms of analysis, mix the audio with other sources (such as mic input), etc.  However, since CA cannot open these URLs directly, an app would instead need to use AV Foundation to export the audio into a file that Core Audio could read (an expensive operation if the source file is not encoded in AAC).  To get at raw samples, it would then need to use Audio Converter Services or Extended Audio File Services to convert the .m4a file to PCM (in a .caf, .aif, or .wav).  I've written a blog about this process here <http://www.subfurther.com/blog/?p=1103>, with sample code <http://www.subfurther.com/blog/wp-content/uploads/2010/07/MediaLibraryExportThrowaway1.zip>

Steps to Reproduce:
1. Get an MPMediaItem from the MediaLibrary.framework
2. Get its library URL with the MPMediaItemPropertyAssetURL:
        	NSURL *assetURL = [song valueForProperty:MPMediaItemPropertyAssetURL];
3. Attempt to use this URL with a Core Audio URL-based API, such as AudioFileOpenURL():
	AudioFileID audioFile = NULL;
	openErr = AudioFileOpenURL((CFURLRef) assetURL,
							   kAudioFileReadPermission ,
							   0,
							   &audioFile);

Expected Results:
In a perfect world, this call to AudioFileOpenURL() would succeed, at least for file types and formats that Core Audio supports (AAC, MP3, ALAC, etc.)

Actual Results:
The above call to AudioFileOpenURL() returns -43 ("fnfErr" in MacErrors.h)

Regression:

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!