为 AVAssetReaderAudioMixOutput 指定基于软件的编解码器?
在 iOS 设备上,是否可以告诉 AVAssetReaderOutput
仅使用基于软件的解码器(即 kAppleSoftwareAudioCodecManufacturer
而不是 kAppleHardwareAudioCodecManufacturer
)?
我发现使用 AudioToolbox 中的音频格式服务可以实现这一点,但我不知道如何将其转移到 AVFoundation。
原因是我想在 iPodMusicPlayer 播放时解码 itunes 库中的压缩音频 - 由于硬件辅助解码不支持同时解码多首歌曲,我的应用程序将需要使用软件解码(对吗?
)不想将软件解码作为两步过程(即将压缩文件导出到应用程序沙箱,然后使用 AudioToolbox 打开它)。
On an ios device, can AVAssetReaderOutput
be told to only use software-based decoders (i.e. kAppleSoftwareAudioCodecManufacturer
rather than kAppleHardwareAudioCodecManufacturer
)?
I see that this is possible using Audio Format Services in AudioToolbox, but I don't see how to carry this over to AVFoundation.
The reason for this is that I'd like to decode compressed audio from the itunes library while iPodMusicPlayer is playing - since hardware-assisted decoding does not support simultaneous decoding of multiple songs, my app will need to use software decoding (right?)
I'd rather not do the software decoding as a 2-step process (i.e. export compressed file to app sandbox, then open that using AudioToolbox).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,虽然我还没有找到在 AVFoundation 中指定软件解码器的方法,但我最终通过使用 AVAssetReaderTrackOutput 读取压缩歌曲文件的每个轨道,然后将压缩缓冲区传递给 AudioConverterRef 来解决这个问题。
Well, although I haven't found a way to specify the software decoder in AVFoundation, I ended up working around this by reading each track of the compressed song file with an AVAssetReaderTrackOutput, then passing the compressed buffers to an AudioConverterRef.