简体   繁体   中英

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

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.

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 */
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM