[Flac-dev] libflac++ reading vorbis metadata

Josh Coalson xflac at yahoo.com
Thu Mar 9 23:20:50 PST 2006


--- Emil Nowak <emil5 at go2.pl> wrote:
> I'm trying to use libFLAC++ v1.1.2, to read Song information (like
> artist,
> trackname etc..). So..
> 
> I read metadata from file 
> FLAC::Metadata::get_streaminfo("somefile.flac", infosik);
> and It's ok - no error, then I read vorbis info:
> 
> FLAC::Metadata::VorbisComment vorbis_kom(infosik);
> int number_of_comments = vorbis_kom.get_num_comments();
> 
> and after that I have number_of_comments=14
> when I try to read entry using get_comment method I got segfault
> 
> vorbis_kom.get_comment(number);
> 
> I was trying all numbers from 0, to 14 and it always segfaults
> 
> Is that a right way to read those informations? What I'm doing wrong?

the vorbiscomments are not in the streaminfo.  you want to do:

FLAC::Metadata::VorbisComment tags;
if (FLAC::Metadata::get_tags("somefile.flac", tags)) {
   FLAC::Metadata::VorbisComment::Entry entry =
      tags->get_comment(tags->get_num_comments-1); //e.g. last tag
   // do something with it...
}  	

Josh


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Flac-dev mailing list