简体   繁体   English

使用Taglib的MP3文件为空(C ++)

[英]Mp3 file is null using taglib(c++)

I am using taglib in c++ to change metadata from mp3 files. 我在c ++中使用taglib更改mp3文件中的元数据。 I have written a code that works great. 我写了一个很棒的代码。 But I found a MP3 file that cannot open with taglib. 但我发现无法使用taglib打开MP3文件。

The MP3 file has tags. MP3文件具有标签。 I can see them with Vlc media player and MediaInfo and with explorer.exe. 我可以通过Vlc媒体播放器,MediaInfo和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. 要解决此问题,我将使用cont wchar_t*而不是const char*因为我尝试打开的文件包含来自ISO或unicode编码的法语字符,但不包含来自ASCII的法语字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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