How to read XingHeaders and VBRIHeaders from MP3 files using TagLib-Sharp

自作多情 提交于 2019-12-02 13:23:19

问题


I need to extract the information stored in the Xing and Fraunhofer VBRI headers of MP3 files using TagLib-Sharp.

I've searched around the web for an example, looked at the source code, but it's not obvious how to use the XingHeader and VBRIHeader classes. They don't look to be part of the File/AudioFile properties for MPEG.

The constructor needs a ByteVector class which is defined in the TagLib namespace.

Can anybody provide an example of using the XingHeader and VBRIHeader classes? Any help would be greatly appreciated.


回答1:


Something like the following should work:

foreach(ICodec codec in file.Properties.Codecs) {
    Mpeg.AudioHeader header = (Mpeg.AudioHeader) codec;
    if(header == null)
        return;

    if(header.XingHeader != Mpeg.XingHeader.Unknown) {
        /* CODE HERE */
    }

    if(header.VBRIHeader != VBRIHeader.Unknown) {
        /* CODE HERE */
    }
}


来源:https://stackoverflow.com/questions/6196011/how-to-read-xingheaders-and-vbriheaders-from-mp3-files-using-taglib-sharp

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