<br>In continuation to the previous mail,<div>i forgot to mention that my code crashes in the first line itself, </div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">TagLib::MPEG::File mpegFile("\\Storage Card\\YeDooriyan.mp3");</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">i.e. it is not able to create an object of the type MPEG::File.</span></font></div>
<div><span class="Apple-style-span" style="font-size: 13px; "></span><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font><div class="gmail_quote">
On Thu, Nov 26, 2009 at 11:29 AM, pranay prateek <span dir="ltr"><<a href="mailto:pranay.iitm@gmail.com">pranay.iitm@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<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 style="white-space:pre">        </span>static const char *IdPicture = "APIC" ;</div><div><br></div><div><span style="white-space:pre">        </span>TagLib::MPEG::File mpegFile("\\Storage Card\\YeDooriyan.mp3");</div>
<div><span style="white-space:pre">        </span>TagLib::ID3v2::Tag *id3v2tag = mpegFile.ID3v2Tag();</div><div><span style="white-space:pre">        </span>TagLib::ID3v2::FrameList Frame ;</div>
<div><span style="white-space:pre">        </span>TagLib::ID3v2::AttachedPictureFrame *PicFrame ;</div><div><span style="white-space:pre">        </span>void *RetImage = NULL, *SrcImage ;</div>
<div><span style="white-space:pre">        </span>unsigned long Size ;</div><div><br></div><div><span style="white-space:pre">        </span>FILE *jpegFile;</div><div><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 style="white-space:pre">                </span>for(TagLib::ID3v2::FrameList::ConstIterator it = Frame.begin(); it !=</div><div>Frame.end(); ++it)</div><div>
{</div><div><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 style="white-space:pre">                        </span>fwrite(SrcImage,Size,1, jpegFile);</div><div><span style="white-space:pre">                        </span>fclose(jpegFile);</div>
<div> <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>
</blockquote></div><br><br clear="all"><br>-- <br>"You aren't remembered for doing what is expected of you."<br>
</div>