使用 AQ 和音频文件流动态检测和流式传输 AAC
我目前正在播放 MP3 和 AAC 广播电台。 我正在读取 ICY/HTTP 标头,当检测内容类型中的音频/aac 或音频/aacp 时,我提供 kAudioFileAAC_ADTSType 作为 AudioFileStreamOpen 的线索,否则我给它 kAudioFileMP3Type。
它工作得很好,问题是当电台正在播放 AAC,但不发送音频/aacp 作为 HTTP 标头中的内容类型时。当发生这种情况时,我通常使用 mp3 线索创建音频文件流(与 0 作为线索也没有什么不同),然后音频文件流的属性回调表明该流认为它正在读取 MP3,formatList 回调也永远不会发生,并且当这时音频队列的创建失败了。
有没有办法让 AudioFileStream 与 AAC 一起工作,而无需在其构造函数中传递 AAC 提示,或者是否有人对如何检测这些电台有任何其他想法,然后以某种方式在我的电台数据库中标记它们?我也不想在每次正常失败时尝试使用 AAC 作为提示创建新的音频文件流。
I am currently streaming MP3 and AAC radio stations.
I'm reading the ICY/HTTP headers, and when detecting audio/aac or audio/aacp in the content-type, i provide kAudioFileAAC_ADTSType as the clue for AudioFileStreamOpen, otherwise i give it kAudioFileMP3Type.
It works great, the problem is when the station is playing AAC, but doesn't send audio/aacp as content-type in the HTTP headers. When that happens, i create the audiofilestream normally with an mp3 clue (nothing is different with 0 as clue either), and then the property callbacks of the audiofilestream indicate that the stream thinks it's reading MP3, the formatList callback never happens either, and when the time comes the creation of the audio queue fails.
Is there a way to make AudioFileStream work with AAC without the AAC hint being passed in it's constructor, or does anyone has any other idea about how to detect those stations other then marking them somehow in my stations databases? I'd also rather not attempt to create a new audiofilestream with AAC as a hint each time i fail normally.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经有一段时间没有查看这段代码了,但我认为它应该可以解决问题。
GetFirstPlayableAudioFormatForFile 实现:
I haven't looked at this code in a while, but I think it should do the trick.
GetFirstPlayableAudioFormatForFile impl: