<br><br><div class="gmail_quote">2010/3/17 Lukáš Lalinský <span dir="ltr">&lt;<a href="mailto:lalinsky@gmail.com">lalinsky@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Wed, Mar 17, 2010 at 7:03 AM, Anthony Liu &lt;<a href="mailto:quadamage@gmail.com">quadamage@gmail.com</a>&gt; wrote:<br>
&gt; Hi, I edited the modified wma files with Mp3Tag, these attributes were<br>
&gt; existing and empty.<br>
&gt; After I used Mp3Tag to remove the asf tag, these attributes were no longer<br>
&gt; existing.<br>
&gt;<br>
&gt; It is not a problem, I am just curious about it.<br>
<br>
</div>Now I&#39;m curious too. I&#39;m really not sure what Mp3tag does.<br></blockquote><div> </div><div>Some code like: <br></div><div>    ASF::File file(  &quot;I:\\test.wma&quot; );<br>    ASF::Tag *asfTag = file.tag();<br>
    asfTag-&gt;setAlbum( &quot;album&quot; );<br>    file.save();<br>will generate the above five empty attributes.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im"><br>
&gt; BTW, as someone mentioned a few days ago, I can not use Taglib to write<br>
&gt; cover art attribute whose size is over 65536.<br>
&gt;<br>
&gt; Recently, I used Taglib to do some tests to read/write the cover art fields<br>
&gt; of various audio tags,<br>
&gt; it worked well with the id3v2, mp4 and ape tags and have some problems with<br>
&gt; the &quot;WM/Picture&quot; attribute.<br>
<br>
</div>Correct, this is not implemented yet. Can you please file a bug report<br>
on <a href="http://bugs.kde.org" target="_blank">bugs.kde.org</a> about it?<br>
<div class="im"><br></div></blockquote><div> <br>The following code is to write the cover art:<br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///I:%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///I:%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///I:%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;
        mso-font-alt:SimSun;
        mso-font-charset:134;
        mso-generic-font-family:auto;
        mso-font-pitch:variable;
        mso-font-signature:3 680460288 22 0 262145 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1107304683 0 0 415 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-520092929 1073786111 9 0 415 0;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1593833729 1073750107 16 0 415 0;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;
        mso-font-charset:134;
        mso-generic-font-family:auto;
        mso-font-pitch:variable;
        mso-font-signature:3 680460288 22 0 262145 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        mso-pagination:none;
        font-size:10.5pt;
        mso-bidi-font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-ascii-font-family:Calibri;
        mso-ascii-theme-font:minor-latin;
        mso-fareast-font-family:宋体;
        mso-fareast-theme-font:minor-fareast;
        mso-hansi-font-family:Calibri;
        mso-hansi-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;
        mso-font-kerning:1.0pt;}
span.apple-style-span
        {mso-style-name:apple-style-span;
        mso-style-unhide:no;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;}
 /* Page Definitions */
 @page
        {mso-page-border-surround-header:no;
        mso-page-border-surround-footer:no;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        mso-header-margin:42.55pt;
        mso-footer-margin:49.6pt;
        mso-paper-source:0;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
-->
</style>

<p class="MsoNormal" style="text-align: left; text-indent: 20pt;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">ASF::File file(  &quot;I:\\test.wma&quot;
);<br>
    <span style=""> </span><span style=""> </span>ASF::Tag *</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"> Tag</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"> =
file.tag();</span></p><p class="MsoNormal" style="text-align: left; text-indent: 20pt;" align="left"><br><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"></span></p>




<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">      </span>ByteVector picdata; // binary data from a
picture jpg file</span></p>

<p class="MsoNormal" style="text-align: left; text-indent: 20pt;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">ByteVector data;<span style="">  </span>// the cover attribute data</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0x03 ); // front
cover</span></p>

<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>DWORD size = </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">picdata</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">.size();</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( ByteVector::fromUInt(
size, false ) ); // picture binary data size</span></p>

<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;i&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;m&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;a&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;g&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;e&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;/&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">      </span><span style="">      </span>data.append(
(char)0 );</span></p>

<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;j&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;p&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;e&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( &#39;g&#39; );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );<span style="">   </span>// mime type, </span><span class="apple-style-span"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">wide-character null-terminated string</span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"></span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">      </span></span></p>

<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );</span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append( (char)0 );<span style="">  </span>// null description, </span><span class="apple-style-span"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">wide-character null-terminated string</span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"></span></p>


<p class="MsoNormal" style="text-align: left;" align="left"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style=""> </span></span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"><span style="">           </span>data.append(
picdata );  // the actual picture data</span></p><p class="MsoNormal"><br><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"></span></p>

<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US">           Tag.addAttribute(
String(&quot;WM/Picture&quot;),<span style=""> 
</span>ASF::Attribute(data) );</span></p><p class="MsoNormal">                   file.save();<br><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;" lang="EN-US"></span></p>


<br>I have no problem with the above code to write cover attribute whose size is less than 65536, if the size is over 64kb, it will corrupt the wma file. BTW, Taglib have no problem in reading the WM/Picture attribute.<br>
<br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">List&lt;ByteVector&gt; pics = new List&lt;ByteVector&gt; ();<br><br>bool big_pics = false;<br>
<br>foreach (IPicture pic in value) {<br>    ByteVector data = PictureToData (pic);<br>    pics.Add (data);<br>    if (data.Count &gt; 0xFFFF)<br>            big_pics = true;<br>    }<br>    <br>if (big_pics) {<br>        DescriptionRecord [] records =<br>
        new DescriptionRecord [pics.Count];<br>    for (int i = 0; i &lt; pics.Count; i ++)<br>            records [i] = new DescriptionRecord (<br>                0, 0, &quot;WM/Picture&quot;, pics [i]);<br>        RemoveDescriptors (&quot;WM/Picture&quot;);<br>
        metadata_library.SetRecords (0, 0,<br>            &quot;WM/Picture&quot;, records);<br>    } else {<br>    ContentDescriptor [] descs =<br>            new ContentDescriptor [pics.Count];<br>        for (int i = 0; i &lt; pics.Count; i ++)<br>
            descs [i] = new ContentDescriptor (<br>                &quot;WM/Picture&quot;, pics [i]);<br>        metadata_library.RemoveRecords (0, 0,<br>            &quot;WM/Picture&quot;);<br>        SetDescriptors (&quot;WM/Picture&quot;, descs);<br>
}<br></blockquote><div> </div><div>These lines are from Taglib Sharp project, I know little C#, however, I can see some special work should be done if the size is over 0xFFFF, you can see <a href="http://gitorious.org/%7Esde/taglib-sharp/sdes-clone/commit/7eb12f96a809259db58b3d5fba1646803694ca0b">http://gitorious.org/~sde/taglib-sharp/sdes-clone/commit/7eb12f96a809259db58b3d5fba1646803694ca0b</a><br>
Hope it will be useful to you.<br><br><br></div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
&gt; It is likely that Taglib does not support to read/write the<br>
&gt; METADATA_BLOCK_PICTURE  of the flac and vorbis files,<br>
&gt; do you have a plan to add these features?<br>
<br>
</div>Note that this is only an issue for FLAC. Cover art in FLAC files is<br>
stored in a separate block type METADATA_BLOCK_PICTURE. On the other<br>
hand, Vorbis Comments store cover art in a vorbis comment named<br>
&quot;METADATA_BLOCK_PICTURE&quot; (according to the latest recommendation),<br>
which is something you already can do.<br>
<font color="#888888"><br>
--<br>
</font><div><div></div><div class="h5">Lukas Lalinsky<br>
<a href="mailto:lalinsky@gmail.com">lalinsky@gmail.com</a><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></div></div></blockquote><div><br>Following the vorbis comment specification, I should use the XiphComment::addField function, the first parameter is <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: &#39;Times New Roman&#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13px; line-height: 17px;">METADATA_BLOCK_PICTURE, the second parameter should be the </span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: &#39;Times New Roman&#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13px; line-height: 19px;">Base64 encoded picture binary block. If the </span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: &#39;Times New Roman&#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13px; line-height: 19px;">picture
 binary block contains some null characters, when calling the addField function, the binary data will be converted to the TagLib::String,  </span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: &#39;Times New Roman&#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13px; line-height: 19px;">will
 </span></span><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: &#39;Times New Roman&#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 13px; line-height: 19px;">the conversion result in truncating the binary data?<br>
<br>I hope you will add the flac cover support, thank you!<br></span></span> </div></div><br clear="all"><br>-- <br>Best Regards<br>