[Flac-dev] reading vorbis comments with FLAC++?

Josh Coalson xflac at yahoo.com
Wed Nov 12 12:09:27 PST 2003


--- Joshua Kwan <joshk at triplehelix.org> wrote:
> OK. Well, I found the C interface a little bit easier to understand,
> so
> I ended up using that instead of continuing to try to figure out the
> C++
> interface.
> 
> The one problem I have is that the values in block->data.
> vorbis_comment.comments tend to have trailing junk. For example:

that's correct; vorbis comments are not c strings and the API
does not expose them as such (you could argue that it should I
guess).  they are a length plus a buffer in UTF-8.  if you want
a C string in a specific charset you must convert it (see the
xmms plugin for examples of how to do that).

if you just want to pretend that it's ascii, you have to

char str[entry->length+1];
memcpy(str, entry->entry);
str[entry->length] = '\0';

Josh



__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree




More information about the Flac-dev mailing list