<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div>Hi all</div><div>I am trying to use TagLib to extract album art from audio files. I am building this app for WINCE 6.0 using c++ and Visual Studio 2005 IDE.</div>
<div>As of now, i am just trying to test it on mp3 files. If i include all the files from mpeg, toolkit and ape folders, i am able to compile my project.</div><div>But, at runtime it gives an unhandled exception error for some mp3 files, while it runs fine for other mp3 files.</div>
<div><br></div><div>The unhandled exception occurs at </div><div><br></div><div>ref() function in RefCounter class</div><div><br></div><div>called by</div><div><br></div><div><div>ByteVector::ByteVector(const ByteVector &v) : d(v.d)</div>
<div>{</div><div> d->ref();</div><div>}</div><div><br></div><div>It seems the <b><i>this</i></b> pointer in the ref function called is NULL which is seemingly causing the problem.</div><div><br></div><div>My main issue is how is this working for some MP3 files while not working for others? Does it depend upon some parameter present in MP3 </div>
<div>files which may not be present in other MP3 files? </div><div>Also, i searched the documentation but couldn't find out what actually is the RefCounter class doing. Why is it being called so many times?</div><div>
<br></div><div>Can somebody give me pointers on how this issue could be resolved?</div><div>Thanks.</div><div><br></div><div>Regards</div><div>Pranay</div><div><br></div><div><br></div></div><div><br></div><div>My code is something like this:</div>
<div><br></div><div><div>int main()</div><div>{</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>static const char *IdPicture = "APIC" ;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>TagLib::MPEG::File mpegFile("\\Storage Card\\YeDooriyan.mp3");</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>TagLib::ID3v2::Tag *id3v2tag = mpegFile.ID3v2Tag();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>TagLib::ID3v2::FrameList Frame ;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>TagLib::ID3v2::AttachedPictureFrame *PicFrame ;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>void *RetImage = NULL, *SrcImage ;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>unsigned long Size ;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>FILE *jpegFile;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>fopen_s(&jpegFile,"FromId3.jpg","wb");</div>
<div><br></div><div><br></div><div> if ( id3v2tag )</div><div> {</div><div> // picture frame</div><div> Frame = id3v2tag->frameListMap()[IdPicture] ;</div><div><br></div><div> if (!Frame.isEmpty() )</div><div>
{</div><div> // find cover art</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>for(TagLib::ID3v2::FrameList::ConstIterator it = Frame.begin(); it !=</div><div>Frame.end(); ++it)</div><div>
{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> PicFrame = (TagLib::ID3v2::AttachedPictureFrame *)(*it) ;</div><div> if ( PicFrame->type() == TagLib::ID3v2::AttachedPictureFrame::FrontCover)</div>
<div> {</div><div> // extract image (in it's compressed form)</div><div> Size = PicFrame->picture().size() ;</div><div> SrcImage = malloc ( Size ) ;</div><div> if ( SrcImage )</div>
<div> {</div><div> memcpy ( SrcImage, PicFrame->picture().data(), Size ) ;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>fwrite(SrcImage,Size,1, jpegFile);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>fclose(jpegFile);</div>
<div> <span class="Apple-tab-span" style="white-space:pre">                        </span></div><div> free( SrcImage ) ;</div><div> }</div><div> if ( RetImage )</div><div> break ;</div><div> }</div>
<div> }</div><div> }</div><div> }</div><div>return(0);</div><div><br></div><div>}</div></div><div><br></div></span>