[Flac] C++ Set_Metadata Problem

Josh Coalson xflac at yahoo.com
Thu Nov 16 11:45:11 PST 2006


can you try this with flac-1.1.3-beta2?
http://sourceforge.net/project/showfiles.php?group_id=13478

I think I have fixed this but it has been a while.  also the new
API docs have more detailed info about exactly why init() will
return ...INVALID_METADATA:

"The metadata input to the encoder is invalid, in one of the
following ways:
 - FLAC__stream_encoder_set_metadata() was called with a null
   pointer but a block count > 0
 - One of the metadata blocks contains an undefined type
 - It contains an illegal CUESHEET as checked by
   FLAC__format_cuesheet_is_legal()
 - It contains an illegal SEEKTABLE as checked by
   FLAC__format_seektable_is_legal()
 - It contains more than one SEEKTABLE block or more than one
   VORBIS_COMMENT block
"

PS you should not have to set the is_last flag



--- "Padfield, Nicholas" <Nicholas.Padfield at dsto.defence.gov.au> wrote:

> I refer to a problem that appeared on the flac list last August that
> was
> either solved off-list or abandoned.
> (http://lists.xiph.org/pipermail/flac/2005-August/000468.html)
> 
> The problem is with using the C++ encoder classes, particularly the
> FLAC::Encoder::File:set_metadata
> function. JC said that the developers version of how to add a simple
> metadata block looked right, but it did not work for him. I have
> tried
> the same and also can not get it to work, but with a different error.
> 
> To recap... (I've left out is-valid checks in the listing for
> brevity)
> 
> //////////
> 
> // Create an application block
> FLAC::Metadata::Application header_flac;
> FLAC__byte header_flac_id[4] = { 1, 2, 3, 4 };
> header_flac.set_id(header_flac_id);
>
header_flac.set_data((FLAC__byte*)(header_str.begin()),header_str.size()
> );
> 
> // Add the block to a metadata array and pass the array to the
> encoder
> object
> FLAC::Metadata::Prototype *meta[] = { &header_flac };
> set_metadata(meta, sizeof(meta) / sizeof(meta[0]));
> 	
> // Ready to go - initialise the encoder
> if(init() != ::FLAC__FILE_ENCODER_OK)
> 	return die("Init failed");
> 
> ///////////
> 
> And this returns the following ...
> 
> FAILED, Init failed, state = 2
> (FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR)
>       seekable stream encoder state = 1
> (FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR)
>       stream encoder state = 16
> (FLAC__STREAM_ENCODER_INVALID_METADATA)
> 
> I have invalid metadata! I have tried the same with VorbisComment and
> Padding objects, with similar results.
> 
> Do I need to set the is_last flag for the last block in my array or
> does the decoder object do that?
> 
> Any ideas about what is wrong?
> 
> Thanks
> Paddy


 
____________________________________________________________________________________
Sponsored Link

Compare mortgage rates for today. 
Get up to 5 free quotes. 
Www2.nextag.com


More information about the Flac mailing list