gpt4 book ai didi

ios - ExtAudioFileGetProperty 返回帧大小为零的 AudioStreamDescription

转载 作者:行者123 更新时间:2023-11-29 10:45:54 25 4
gpt4 key购买 nike

我想按如下方式从音频文件中读取AudioStreamBasicDescription

AudioStreamBasicDescription asdb;
UInt32 propSize = sizeof(asdb);

OSStat stat = ExtAudioFileGetProperty(_audioFile,
kExtAudioFileProperty_FileDataFormat,
&propSize,
&asdb);

工作正常,除了所有字段,mBytesPerFramemBitsPerChannelmBytesPerPacket 都设置正确。

为什么不设置这些字段?

这就是 AudioStreamBasicDescription 字段的样子

TotalFrames: 2628360
BitsPerChannel: 0
BytesPerFrame: 0
BytesPerPacket: 0
ChannelsPerFrame: 2
FormatFlags: 0
FormatID: aac
FramesPerPacket: 1024
SampleRate: 44100

最佳答案

查看 CoreAudioTypes.h 中 AudioStreamBasicDescription 上方的注释。它解释了如何根据格式,某些字段可能未填写。由于 AAC 是一种压缩格式,因此并非所有字段都可以计算,因此返回为 0。

关于ios - ExtAudioFileGetProperty 返回帧大小为零的 AudioStreamDescription,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22401442/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com