About Taglib for Symbian (Qt development)
Антон Сергунов
setosha at gmail.com
Mon Nov 14 11:43:33 UTC 2011
#ifdef Q_WS_WIN
TagLib::FileRef fref(to.toLocalFile().toStdWString().c_str());
#else defined(Q_WS_MACX)
TagLib::FileRef fref(to.toLocalFile().toUtf8());
#endif
...
TagLib::MPEG::File *fileMPEG = dynamic_cast<TagLib::MPEG::File *>(fref.file());
if(fileMPEG)
fileMPEG->save(MPEG::File::AllTags, true, 3); // Many programs
can't read id3v2.4 tags
else
fref.save();
TagLib::String toTString(const QString* str)
{
return TagLib::String(reinterpret_cast<const wchar_t
*>(str.toStdWString().data()));
}
\\ To fix id3v1 encoding bug
QString toQString(const TagLib::String& str)
{
if(str.isLatin1())
return QString::fromLocal8Bit(str.to8Bit().c_str());
return QString::fromStdWString(str.toWString());
}
2011/11/14 Hoài Linh Nguyễn <mrsherlock88 at gmail.com>
> I use : Qt Creator in Window 7 x86. Visual Studio 9 2008, CMake 2.8.6,
> latest taglib in Git.
> I Generate in Cmake 2.8.6 like image attached, another hidden varialble
> are default.
> I build from Visual studio 9, first, I get tag.lib file and size is 520KB.
> code I use:
> QString filepath = fileInfo.absoluteFilePath();
>
> int fnLen = filepath.length();
>
> wchar_t* fnWs = new wchar_t[fnLen + 1];
>
> fnWs[fnLen] = 0;
>
> filepath.toWCharArray(fnWs);
>
> TagLib::FileRef f(filepath.constData());
>
> TagLib::FileName filename(fnWs);
>
> // TagLib::FileRef f(filename);
>
> delete [] fnWs;
>
> if(!f.isNull() && f.tag())
>
> {
>
> TagLib::Tag *tag = f.tag();
>
> this->artist = TStringToQString(tag->artist());
>
> this->album = TStringToQString(tag->album());
>
> this->title = TStringToQString(tag->title());
>
> }
>
> With tag.lib in 520KB, only one error occurs is "cannot convert parameter from QChar * to Taglib::FileName, no constructor found". When change to:
>
> // TagLib::FileRef f(filepath.constData());
>
> TagLib::FileName filename(fnWs);
>
> TagLib::FileRef f(filename);
>
> I get "unresolved external symbol".
>
>
> After that, I re-generate with cmake, and re-build (try clean, or delete all file, re-extract from *.tar.gz file). But I get tag.lib with ~6MB, alway.
>
> I try re-install CMake.
>
>
> Is there other way to construct FileName from QString ? Or fix that with new Constructor? Or I must generate with other config? Please help, I rather to use Taglib.
>
>
> Sorry for my bad English.
>
>
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20111114/d68a24c8/attachment.html>
More information about the taglib-devel
mailing list