简体   繁体   中英

Mp3 file is null using taglib(c++)

I am using taglib in c++ to change metadata from mp3 files. I have written a code that works great. But I found a MP3 file that cannot open with taglib.

The MP3 file has tags. I can see them with Vlc media player and MediaInfo and with explorer.exe.

I try this minimum codes but it say that the file is not valid.

TagLib::FileRef filer("file.mp3");
        if(filer.isNull())
            cout <<"null";

or this code:

TagLib::MPEG::File fileMpeg("file.mp3");
if(!fileMpeg.isValid())
{
   cout << "file not valid";
}

other files work but not that one. Thanks for your help.

I found the problem, The problem was not from the files but, from the files name or directory. To fix the problem I sand cont wchar_t* rather than const char* because the files that I tried to open contain french characters from ISO or unicode encoding but not from ASCII.

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