Esempio n. 1
0
int SoundSourceFLAC::parseHeader() {
    setType("flac");
#ifdef __WINDOWS__
    /* From Tobias: A Utf-8 string did not work on my Windows XP (German edition)
     * If you try this conversion, f.isValid() will return false in many cases
     * and processTaglibFile() will fail
     *
     * The method toLocal8Bit() returns the local 8-bit representation of the string as a QByteArray.
     * The returned byte array is undefined if the string contains characters not supported
     * by the local 8-bit encoding.
     */
    QByteArray qBAFilename = m_qFilename.toLocal8Bit();
#else
    QByteArray qBAFilename = m_qFilename.toUtf8();
#endif
    TagLib::FLAC::File f(qBAFilename.constData());
    bool result = processTaglibFile(f);
    TagLib::ID3v2::Tag *id3v2(f.ID3v2Tag());
    TagLib::Ogg::XiphComment *xiph(f.xiphComment());
    if (id3v2) {
        processID3v2Tag(id3v2);
    }
    if (xiph) {
        processXiphComment(xiph);
    }
    return result ? OK : ERR;
}
Esempio n. 2
0
Result SoundSourceFLAC::parseHeader() {
    setType("flac");
    QByteArray qBAFilename = m_qFilename.toLocal8Bit();
    TagLib::FLAC::File f(qBAFilename.constData());
    bool result = processTaglibFile(f);
    TagLib::ID3v2::Tag *id3v2(f.ID3v2Tag());
    TagLib::Ogg::XiphComment *xiph(f.xiphComment());
    if (id3v2) {
        processID3v2Tag(id3v2);
    }
    if (xiph) {
        processXiphComment(xiph);
    }

    return result ? OK : ERR;
}