[flac-dev] Writing seektable using libFLAC++

Bastiaan Timmer basjetimmer at yahoo.com
Sat Apr 28 00:22:18 PDT 2012


Well, I have to apologize, we can disregard the most important part of my previous mail. The code mentioned in that one does in fact work fine when compiled against current git. I had only compiled against current (but old) stable release when I wrote that, which suffered from a bug (commit 1649c4ab3c08d95fb1056d73d8809fa77d4976dc). And I can, indeed, get rid of the C API calls altogether like this:

d_md = new FLAC::Metadata::Prototype *[d_metadatasize];
d_md[d_metadatasize - 1] = new FLAC::Metadata::SeekTable;
for (int i = 0; i < numseekpoints; ++i)
  reinterpret_cast<FLAC::Metadata::Seektable *>(d_md[0])->insert_point(i, {i * spacing, 0, 0});

It would, however, still be more natural (and sometimes more efficient) to be able to call 'Seektable::resize_points()' and 'Seektable::set_point()' (as is done in FLAC__metadata_object_seektable_template_append_spaced_points_by_samples()), or even to call 'template_append_spaced_points_by_samples()' directly on the Seektable object so we can write somethign like the following:

d_md = new FLAC::Metadata::Prototype *[d_metadatasize];
d_md[d_metadatasize - 1] = new FLAC::Metadata::SeekTable;
reinterpret_cast<FLAC::Metadata::Seektable *>(d_md[0])->template_append_spaced_points_by_samples(samples, total_samples);

Which would be more or less identical to how it's done in the C API. I am still willing to create those functions in libFLAC++, but I would like to hear if there's any chance they'll make it in (assuming they are written correctly and working). Maybe there is some reason only a few functions from FLAC/metadata.h are currently reproduced in the C++ API...

thanks,
Bas Timmer


More information about the flac-dev mailing list