[Flac-dev] slow FLAC__file_decoder_seek_absolute()...
Josh Coalson
xflac at yahoo.com
Fri Jan 25 19:23:02 PST 2002
sorry about the delay... first, yes you are calling it
correctly. if your encoded files have max_framesize == 0,
then that should mean that either 1) you were using the
command-line flac to encode to stdout; or 2) you are using
libFLAC directly. if 2, you can replicate the functionality
that is in src/flac/encode.c:metadata_callback() to write
back statistics and seek table to the metadata in the flac file
because currently this is not done automatically by the library.
(eventually I will fix this the right way.) that will speed up
seeks on the file.
second, even without the seek table or knowing max_framesize,
the seek routine does adjust the approximate_bytes_per_frame
as it decodes target frames. so I don't think it would help
too much compute the framesizes of the first few frames because
the seek current implementation in this case is only really
weak when the bitrate varies widely in the stream. in that
case knowing the first few frame sizes doesn't really help
much.
on my todo list is a true binary search which should improve
things for streams with no seektable and wide bitrate swings.
Josh
P.S. be sure to keep us posted about PhatBox!
--- Brendan Dowling <crypt at phatnoise.com> wrote:
> I think I figured out where the problem is. In my metadata_callback,
>
> I added a thing to print out the max_framesize and max_framesize from
> the stream_info block. Those are both zero. The ..._seek_absolute()
>
> function of the SeekableStreamDecoder uses the max_framesize to guess
> at where to seek. It doesn't seem to handle the case when
> max_frame_size is zero very well. I'm looking at
> seekable_stream_decoder.c, by the way.
>
>
> The files I am playing were encoded using the command line 'flac'
> encoder and default options.
>
>
> Brendan Dowling
> Phatnoise, Inc.
> crypt at phatnoise.com
> http://www.phatnoise.com/
>
>
>
>
> On Thu, Jan 17, 2002 at 05:46:00PM -0800, Brendan Dowling wrote:
> > Hi,
> >
> > I checked the archives, but I didn't find anything regarding this
> > problem. FLAC__file_decoder_seek_absolute takes an incredibly long
> time
> > to seek. What can I do about this? How do I fix it?
> >
> > Here's how I'm calling the function:
> >
> >
> > if (argc > 2) {
> > secs = atoi(argv[2]);
> > seek_point = (FLAC__uint64) secs * sample_rate;
> > printf("seeking to %d:%02d\n", secs/60, secs%60);
> >
> > flac_status = FLAC__file_decoder_seek_absolute(decoder,
> seek_point);
> >
> > if (flac_status) printf("seek absolute = %d\n", flac_status);
> > }
> >
> > FLAC__file_decoder_process_remaining_frames(decoder);
> >
> >
> >
> > Thanks,
> >
> > Brendan Dowling
> >
> >
> > p.s., I am making a simple FLAC file player that runs on the
> Phatnoise
> > Car Audio System (see http://www.phatnoise.com/ for more info).
> >
> > ---
> > Brendan Dowling
> > crypt at phatnoise.com
> > Phatnoise, Inc.
> > http://www.phatnoise.com/
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
More information about the Flac-dev
mailing list