Is “Bit rate” property fixed in index 28?

泪湿孤枕 提交于 2019-12-13 14:24:15

问题


I am trying to read "Bit rate" property of audio files. I know how to get the value but the way I am doing it I don't think is the most efficient.

Shell shell = new Shell32.Shell();
Folder objFolder = shell.NameSpace(path);
for (int i = 0; i < short.MaxValue; i++)
{
    string property = objFolder.GetDetailsOf(null, i);
    if (String.IsNullOrEmpty(property))
        break;
    if (property.Equals("Bit rate"))
    {
        index = i;
        break;
    }
}
FolderItem item = objFolder.ParseName(fileName);
string bitRateValue = objFolder.GetDetailsOf(item, index);

My concern is that for loop which I need to get the index of "Bit rate", so for all my tests returned me index 28, therefore I started to wonder if Bit rate can be found always at index 28? If not then is there any better way to find out at which index Bit rate is located?


回答1:


After a bit of research and help from other members, I got what I was looking for. This answer is for those who may land here searching for bitrate property of audio files.

First of all, if we use Shell then bitrate property will always be found at index 28. However it is upto Shell object if it contains any value for that property. as Shell's main purpose is not to read the audio files, so we should not be relying on it to read any audio file properties.

This Thread explains what we need to do to read the .wav's bitrate.



来源:https://stackoverflow.com/questions/21447706/is-bit-rate-property-fixed-in-index-28

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