Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I got it to work for mp3 files. See if you can adapt it for ogg</p> <p>Good luck.<br> PS::This tagging stuff is way harder than it should be. We need to find another lib.</p> <pre><code>/********************************************************************************************************************************* *Description: A simple program using taglib to extract pictures attached to mp3 id3v2 tags *Author: Dr Deo [at] stackoverflow *dot* com *AOB: I hope you will find this useful and are free to use it for anything, but there is no waranty and use at your own risk :) ********************************************************************************************************************************* */ #include&lt;iostream&gt; #include&lt;stdio.h&gt; /*taglib specific includes*/ #include&lt;tbytevector.h&gt;//ByteVector #include&lt;mpegfile.h&gt;//mp3 file #include&lt;id3v2tag.h&gt;//tag #include&lt;id3v2frame.h&gt;//frame #include &lt;attachedPictureFrame.h&gt;//attachedPictureFrame using namespace std ; using namespace TagLib::ID3v2 ; int main(int argc, char * argv[]) { if(argc !=2) { cout&lt;&lt;"usage: drag an mp3 file on to the program and it will extract the attached image"&lt;&lt;endl&lt;&lt;endl; system("pause");//on linux you can replace this with cin.get() exit(1); } TagLib::MPEG::File mp3File(argv[1]); Tag * mp3Tag; FrameList listOfMp3Frames; AttachedPictureFrame * pictureFrame; mp3Tag= mp3File.ID3v2Tag(); if(mp3Tag) { listOfMp3Frames = mp3Tag-&gt;frameListMap()["APIC"];//look for picture frames only if(!listOfMp3Frames.isEmpty()) { FrameList::ConstIterator it= listOfMp3Frames.begin(); for(; it != listOfMp3Frames.end() ; it++) { pictureFrame = static_cast&lt;AttachedPictureFrame *&gt; (*it);//cast Frame * to AttachedPictureFrame* //Warning. format of picture assumed to be jpg. This may be false, for example it may be png. FILE * fout; fopen_s(&amp;fout, "outputFile.jpg", "wb"); cout&lt;&lt;"processing the file "&lt;&lt; argv[1] &lt;&lt;endl&lt;&lt;endl; fwrite(pictureFrame-&gt;picture().data(), pictureFrame-&gt;picture().size(), 1, fout); fclose(fout); cout&lt;&lt;" The picture has been written to \t outputFile.jpg \nRemember that the file type .jpg is just assumed for simplicity"&lt;&lt;endl&lt;&lt;endl; } } else cerr&lt;&lt;"there seem to be no picture frames (APIC) frames in this file"&lt;&lt;endl&lt;&lt;endl; } else cerr&lt;&lt;"the file "&lt;&lt;argv[1]&lt;&lt;"does not appear to have any mp3 tags"&lt;&lt;endl&lt;&lt;endl; system("pause");//on linux you can replace this with cin.get() return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload