[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglib-devel
Subject:    Re: About Taglib for Symbian (Qt development)
From:       Антон Сергунов <setosha () gmail ! com>
Date:       2011-11-14 11:43:33
Message-ID: CAPdia6sdzwdseME5twXKXcs0H0i_V-ZDBu+CLZdSfY82okW4Nw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


#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@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@kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
> 
> 


[Attachment #5 (text/html)]

<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" \
color:#000080;">#ifdef</span><span style=" color:#c0c0c0;"> </span><span style=" \
color:#800080;">Q_WS_WIN</span></pre> <pre style="margin-top: 0px; margin-bottom: \
0px; "><span style=" color:#c0c0c0;">    </span><span style=" \
color:#800080;">TagLib</span>::<span style=" color:#800080;">FileRef</span><span \
style=" color:#c0c0c0;"> </span>fref(to.toLocalFile().toStdWString().c_str());</pre>


<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" \
color:#000080;">#else</span><span style=" color:#c0c0c0;"> </span>defined(<span \
style=" color:#800080;">Q_WS_MACX</span>)</pre> <pre style="margin-top: 0px; \
margin-bottom: 0px; "><span style=" color:#c0c0c0;">    </span>TagLib::FileRef<span \
style=" color:#c0c0c0;"> </span>fref(to.toLocalFile().toUtf8());</pre><pre \
style="margin-top: 0px; margin-bottom: 0px; ">

<span style=" color:#000080;">#endif</span></pre><pre style="margin-top: 0px; \
margin-bottom: 0px; "><span style=" color:#000080;"><br></span></pre><pre \
style="margin-top: 0px; margin-bottom: 0px; "><span style=" \
color:#000080;">...</span></pre>

<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" \
color:#000080;"><br></span></pre><pre style="margin-top: 0px; margin-bottom: 0px; \
"><span style=" color:#800080;">TagLib</span>::<span style=" \
color:#800080;">MPEG</span>::<span style=" color:#800080;">File</span><span style=" \
color:#c0c0c0;"> </span>*fileMPEG<span style=" color:#c0c0c0;"> </span>=<span style=" \
color:#c0c0c0;"> </span><span style=" color:#808000;">dynamic_cast</span>&lt;<span \
style=" color:#800080;">TagLib</span>::<span style=" \
color:#800080;">MPEG</span>::<span style=" color:#800080;">File</span><span style=" \
color:#c0c0c0;"> </span>*&gt;(fref.file());</pre>

<pre style="margin-top: 0px; margin-bottom: 0px; "><pre style="margin-top: 0px; \
margin-bottom: 0px; "><span style=" color:#808000;">if</span>(fileMPEG)</pre><pre \
style="margin-top: 0px; margin-bottom: 0px; "><font color="#c0c0c0">    \
</font>fileMPEG-&gt;save(<span style=" color:#800080;">MPEG</span>::<span style=" \
color:#800080;">File</span>::<span style=" color:#800080;">AllTags</span>,<span \
style=" color:#c0c0c0;"> </span><span style=" color:#808000;">true</span>,<span \
style=" color:#c0c0c0;"> </span><span style=" color:#000080;">3</span>); // Many \
programs can&#39;t read id3v2.4 tags </pre>

<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" \
color:#808000;">else</span></pre><pre style="margin-top: 0px; margin-bottom: 0px; \
"><font color="#c0c0c0">    </font>fref.save();</pre></pre><pre style="margin-top: \
0px; margin-bottom: 0px; ">

<span style=" color:#000080;"><br></span></pre><pre style="margin-top: 0px; \
margin-bottom: 0px; "><pre style="margin-top: 0px; margin-bottom: 0px; "><span \
style=" color:#800080;">TagLib</span>::<span style=" \
color:#800080;">String</span><span style=" color:#c0c0c0;"> </span>toTString(const \
<span style=" color:#800080;">QString*</span><span style=" color:#c0c0c0;"> \
</span>str)</pre>

<pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre><pre style="margin-top: \
0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;">    </span><span style=" \
color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" \
color:#800080;">TagLib</span>::<span style=" color:#800080;">String</span>(<span \
style=" color:#808000;">reinterpret_cast</span>&lt;<span style=" \
color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" \
color:#808000;">wchar_t</span><span style=" color:#c0c0c0;"> \
</span>*&gt;(str.toStdWString().data()));</pre>

<pre style="margin-top: 0px; margin-bottom: 0px; ">}</pre><pre style="margin-top: \
0px; margin-bottom: 0px; "><br></pre><pre style="margin-top: 0px; margin-bottom: 0px; \
">\\ To fix id3v1 encoding bug</pre><pre style="margin-top: 0px; margin-bottom: 0px; \
">

<pre style="margin-top: 0px; margin-bottom: 0px; "><span style=" \
color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>toQString(<span \
style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span \
style=" color:#800080;">TagLib</span>::<span style=" \
color:#800080;">String</span>&amp;<span style=" color:#c0c0c0;"> </span>str)</pre>

<pre style="margin-top: 0px; margin-bottom: 0px; ">{</pre><pre style="margin-top: \
0px; margin-bottom: 0px; "><span style=" color:#c0c0c0;">    </span><span style=" \
color:#808000;">if</span>(str.isLatin1())</pre><pre style="margin-top: 0px; \
margin-bottom: 0px; ">

<span style=" color:#c0c0c0;">        </span><span style=" \
color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" \
color:#800080;">QString</span>::fromLocal8Bit(str.to8Bit().c_str());</pre><pre \
style="margin-top: 0px; margin-bottom: 0px; ">

<span style=" color:#c0c0c0;">    </span><span style=" \
color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" \
color:#800080;">QString</span>::fromStdWString(str.toWString());</pre><pre \
style="margin-top: 0px; margin-bottom: 0px; ">

}</pre></pre></pre><br><div class="gmail_quote">2011/11/14 Ho i Linh Nguyễn <span \
dir="ltr">&lt;<a href="mailto:mrsherlock88@gmail.com">mrsherlock88@gmail.com</a>&gt;</span><br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex;">

I use : Qt Creator in Window 7 x86. Visual Studio 9 2008, CMake 2.8.6, latest taglib \
in Git.<div>I Generate in Cmake 2.8.6 like image attached, another hidden varialble \
are default.</div><div>I build from Visual studio 9, first, I get tag.lib file and \
size is 520KB. code I use:</div>


<div><span style="color:#c0c0c0">	</span><span \
style="color:#800080">QString</span><span style="color:#c0c0c0"> </span>filepath<span \
style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> \
</span>fileInfo.absoluteFilePath(); <pre \
style="margin-top:0px;margin-bottom:0px"></pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span><span style="color:#808000">int</span><span style="color:#c0c0c0"> \
</span>fnLen<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> \
</span>filepath.length();</pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span><span style="color:#808000">wchar_t</span>*<span style="color:#c0c0c0"> \
</span>fnWs<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> \
</span><span style="color:#808000">new</span><span style="color:#c0c0c0"> \
</span><span style="color:#808000">wchar_t</span>[fnLen<span style="color:#c0c0c0"> \
</span>+<span style="color:#c0c0c0"> </span><span \
style="color:#000080">1</span>];</pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span>fnWs[fnLen]<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> \
</span><span style="color:#000080">0</span>;</pre>

<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span>filepath.toWCharArray(fnWs);</pre> <pre \
style="margin-top:0px;margin-bottom:0px"></pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span><span style="color:#800080">TagLib</span>::<span \
style="color:#800080">FileRef</span><span style="color:#c0c0c0"> \
</span>f(filepath.constData());</pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span><span style="color:#800080">TagLib</span>::<span \
style="color:#800080">FileName</span><span style="color:#c0c0c0"> \
</span>filename(fnWs);</pre>



<pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#008000">//</span><span style="color:#c0c0c0">        </span><span \
style="color:#008000">TagLib::FileRef</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">f(filename);</span></pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span><span style="color:#808000">delete</span><span style="color:#c0c0c0"> \
</span>[]<span style="color:#c0c0c0"> </span>fnWs;</pre>

<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span><span style="color:#808000">if</span>(!f.isNull()<span style="color:#c0c0c0"> \
</span>&amp;&amp;<span style="color:#c0c0c0"> </span>f.tag())</pre>



<pre style="margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0">	</span>{</pre> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">                \
</span><span style="color:#800080">TagLib</span>::<span \
style="color:#800080">Tag</span><span style="color:#c0c0c0"> </span>*tag<span \
style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>f.tag();</pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">            \
</span><span style="color:#808000">this</span>-&gt;<span \
style="color:#800000">artist</span><span style="color:#c0c0c0">	</span>=<span \
style="color:#c0c0c0"> </span>TStringToQString(tag-&gt;<span \
style="font-style:italic">artist</span>());</pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">            \
</span><span style="color:#808000">this</span>-&gt;<span \
style="color:#800000">album</span><span style="color:#c0c0c0">	</span>=<span \
style="color:#c0c0c0"> </span>TStringToQString(tag-&gt;<span \
style="font-style:italic">album</span>());</pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">            \
</span><span style="color:#808000">this</span>-&gt;<span \
style="color:#800000">title</span><span style="color:#c0c0c0">	</span>=<span \
style="color:#c0c0c0"> </span>TStringToQString(tag-&gt;<span \
style="font-style:italic">title</span>());</pre>



<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> \
</span>}</pre><pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span \
style="white-space:normal">With tag.lib in 520KB, only one error occurs is \
&quot;cannot convert parameter from QChar * to Taglib::FileName, no constructor \
found&quot;. When change to:</span></font></pre>


<pre style="margin-top:0px;margin-bottom:0px"><pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#008000">//</span><span \
style="color:#c0c0c0">        </span><span \
style="color:#008000">TagLib::FileRef</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">f(filepath.constData());</span> <pre \
style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span><span style="color:#800080">TagLib</span>::<span \
style="color:#800080">FileName</span><span style="color:#c0c0c0"> \
</span>filename(fnWs);</pre>


<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0">        \
</span><span style="color:#800080">TagLib</span>::<span \
style="color:#800080">FileRef</span><span style="color:#c0c0c0"> \
</span>f(filename);</pre>


<pre style="margin-top:0px;margin-bottom:0px"><pre \
style="margin-top:0px;margin-bottom:0px"><font face="arial"><span \
style="white-space:normal">I get &quot;unresolved external \
symbol&quot;.</span></font></pre> <pre style="margin-top:0px;margin-bottom:0px"><font \
face="arial"><span style="white-space:normal"><br></span></font></pre><pre \
style="margin-top:0px;margin-bottom:0px"><font face="arial"><span \
style="white-space:normal">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.</span></font></pre>


<pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span \
style="white-space:normal">I try re-install CMake.</span></font></pre><pre \
style="margin-top:0px;margin-bottom:0px"><font face="arial"><span \
style="white-space:normal"><br>

</span></font></pre><pre style="margin-top:0px;margin-bottom:0px"><font \
face="arial"><span style="white-space:normal">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.</span></font></pre>


<pre style="margin-top:0px;margin-bottom:0px"><font face="arial"><span \
style="white-space:normal"><br></span></font></pre><pre \
style="margin-top:0px;margin-bottom:0px"><font face="arial"><span \
style="white-space:normal">Sorry for my bad English.</span></font></pre>

</pre></pre></pre></div>
<br>_______________________________________________<br>
taglib-devel mailing list<br>
<a href="mailto:taglib-devel@kde.org">taglib-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/taglib-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/taglib-devel</a><br> \
<br></blockquote></div><br>



_______________________________________________
taglib-devel mailing list
taglib-devel@kde.org
https://mail.kde.org/mailman/listinfo/taglib-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic