[Flac-dev] Can I STOP decoding at an exact sample?

David Collett jg at webone.com.au
Sat Apr 13 04:56:04 PDT 2002


Hi guys,
Thanks Matt for your prompt response about the C++ problem, its working
great now!

Again for my "virtual cdplayer", I am wondering if its possible to stop
decoding within a large file, at the end of an exact sample?
ie. I wish to play a song in the middle of a flac'd cd. Using the file
decoder, I can seek to the start of the track(index 01 of the cds TOC),
but I then want it to stop playing when it gets to the index 00 of the
next track.

At the moment, I do the following, where length is the length of the
song in samples:

  FLAC__file_decoder_seek_absolute(flac_dec, start_sample);
  for(int i=0; i<(length/blockSize); i++) {
    FLAC__file_decoder_process_one_frame(flac_dec);
  }

This is pretty good, with the default block size of 4608 it's accurate
to around a 10th of a second. I am a fussy bastard tho, so I was just
wondering if theres a better way :)

Also, I am not sure how the SEEKTABLE works, it looks good in theory(the
"format" page) but how do you use it? Are there any methods to use it
with the file decoder?

Thanks heaps,
David Collett








More information about the Flac-dev mailing list