Getting the musical data of an iPod-track [closed]

耗尽温柔 提交于 2019-12-17 23:13:49

问题


How can I get the content (raw/sample data) of an iPod-track? I've seen apps like "Ringtone Designer" and iMovie which can do it, but I have no idea which api they use or what they do. I could imagine that iMovie uses private apis, but "Ringtone Designer" is a third-party app, so it must be possible with the public api-functions.


回答1:


I haven't done this myself but according to the documentation these are the steps (roughly):

  1. Create an MPMediaQuery to retrieve one or more MPMediaItem objects from the iPod library.
  2. Ask those media items for their URL with -[MPMediaItem valueForProperty: MPMediaItemPropertyAssetURL].
  3. Create an AVURLAsset from the URL.
  4. Create an instance of AVAssetReader for the asset.
  5. Create one or more instances of AVAssetReaderTrackOutput (one for each track of the asset) and add them to the asset reader with -[AVAssetReader addOutput:].
  6. Call -[AVAssetReader startReading].
  7. Call -copyNextSampleBuffer for each of your AVAssetReaderTrackOutput objects until you have read all the data.

See the documentation to all these classes for details.



来源:https://stackoverflow.com/questions/3905240/getting-the-musical-data-of-an-ipod-track

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!