List Info

Thread: libflac++ reading vorbis metadata




libflac++ reading vorbis metadata
user name
2006-03-08 17:44:20
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?
_______________________________________________
Flac-dev mailing list
Flac-devxiph.org
http:
//lists.xiph.org/mailman/listinfo/flac-dev
libflac++ reading vorbis metadata
user name
2006-03-10 07:20:50
--- Emil Nowak <emil5go2.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 
_______________________________________________
Flac-dev mailing list
Flac-devxiph.org
http:
//lists.xiph.org/mailman/listinfo/flac-dev
libflac++ reading vorbis metadata
user name
2006-03-10 11:51:25
On 2006-03-09 (Thu) ,at 23:20:50 Josh Coalson wrote:

> 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
Oki, thanks it works. However I still have some questions
about all the
libflac++. If this is impossible to read vorbis info from
StreamInfo why there
is constructor for VorbisComment which takes StreamInfo as
the only argument?
And why the get_num_comments() on this object returns number
> 0, if there are
no comments?
And BTW: Documentation for libflac++ on official site is
generated from some
old sources, or wrongly generated - You don't have all
doxygened informations
that is available in headers. 
Anyway even with this improved documentation (which I have
locally) It's hard
to get all needed information, many methods are not
described, many datatypes
are not linked here. I was even using grep on headers, to
get some
information. And there are so many footnotes like
"read C documentation first"
that I decided, to do everything in C. It seems to be
impossible to use
flac++ without learning ordinary libflac.

-- 
Cheers.
_______________________________________________
Flac-dev mailing list
Flac-devxiph.org
http:
//lists.xiph.org/mailman/listinfo/flac-dev
libflac++ reading vorbis metadata
user name
2006-03-10 18:37:50
--- Emil Nowak <emil5go2.pl> wrote:
> On 2006-03-09 (Thu) ,at 23:20:50 Josh Coalson wrote:
> 
> > 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
> Oki, thanks it works. However I still have some
questions about all
> the
> libflac++. If this is impossible to read vorbis info
from StreamInfo
> why there
> is constructor for VorbisComment which takes StreamInfo
as the only
> argument?

c++ constructors cannot return values so the only thing it
could do is throw an exception or make you have to call an
invariant checker method after construction, neither of
which I like.

the path that allowed a vorbiscomment into a streaminfo at
compile
time was implicit conversion to ::FLAC__StreamMetadata which
is
unfortunately necessary for the 'wrapper' behavior around
libFLAC
to work smoothly.

even in the beginning I would rather have written libFLAC in
C++
but went with C for maximum portability.

> And why the get_num_comments() on this object returns
number > 0, if
> there are no comments?

it was reading into bogus memory.

> And BTW: Documentation for libflac++ on official site
is generated
> from some
> old sources, or wrongly generated - You don't have all
doxygened
> informations
> that is available in headers. 
> Anyway even with this improved documentation (which I
have locally)
> It's hard
> to get all needed information, many methods are not
described, many
> datatypes
> are not linked here. I was even using grep on headers,
to get some
> information. And there are so many footnotes like
"read C
> documentation first"
> that I decided, to do everything in C. It seems to be
impossible to
> use
> flac++ without learning ordinary libflac.

yeah, I need to fill in more of the libFLAC++ docs.  but it
really does work as a trivial wrapper around libFLAC and
it's
not practical to duplicate all the docs, that's why there
are
pointers into the underlying libFLAC docs for explanation.

Josh


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection
around 
http://mail.yahoo.com 
_______________________________________________
Flac-dev mailing list
Flac-devxiph.org
http:
//lists.xiph.org/mailman/listinfo/flac-dev
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )