--- Joshua Kwan <[EMAIL PROTECTED]> wrote: > Well, I'm quite frankly stumped. I'm writing a program that recurses > into directories and reads (among others) FLAC files and should be > able > to read the vorbis comments ARTIST and TITLE from the file. > > A while back, I was popen()ing to metaflac, because I didn't want to > mess with libFLAC. But now, it's the weekend, so I can mess around > with > this. Here's the code in question: ... > When I run this code, I get a SEGV during get_comment because > object_->data.vorbis_comment.comments is junk. Must I initialize it > somewhere? Note that vc.get_num_comments returns 14, which I imagine > is > a correct number. The documentation isn't overly clear about how this > works > and it would be cooler if some basic examples could be provided. > > Thanks in advance for any help that can be provided. Excuse my > ignorance! :(
it's in the API docs; here's one link: http://flac.sourceforge.net/api/group__flac__metadata__level1.html#_details The C++ interface is a little simpler: FLAC::Metadata::SimpleIterator it; if (it.is_valid()) { if (it.init(filename, true, true)) { FLAC::Metadata::VorbisComment *vc = 0; do { if (it.get_block_type() == ::FLAC__METADATA_TYPE_VORBIS_COMMENT) { vc = dynamic_cast<FLAC::Metadata::VorbisComment*>(it.get_block()); assert(0 != vc); } } while (!vc && it.next()); //use vc delete vc; } } maybe I should add a shorthand function similar to flac__metadata_get_streaminfo() Josh __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ Flac-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/flac-dev
