--- David Collett <jg@webone.com.au> wrote:> 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 :)
no, the only way is in your write_callback, to know when you're
in the last block that you want, and know which sample in that
block is the last one you want, and just output that much. but
that's probably what you're already doing :)
> 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?
just the one you mentioned:
> FLAC__file_decoder_seek_absolute(flac_dec, start_sample);
this will also work without a seektable but the seektable will
make seeking faster. is there something else you want to do
with it?
Josh
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/