[Flac-dev] xmms-plugin problems
Miroslav Lichvar
mirator at upcase.inf.upol.cz
Tue Apr 17 00:41:05 PDT 2001
Hi,
i'm using xmms-plugin from flac-0.9, i found following problems.
Back-seeking cause, that .flac is not played all. It's caused by
StreamDecoderPrivate variable samples_decoded and function
stream_decoder_frame_sync_, which compare it against whole length of stream.
I don't know what is meaning of this varible (samples decoded from last reset
or for whole life of decoder). So i samples_decoded set to 0 in
stream_decoder_reset. Against stream_decoder.c
205a206,207
> if (decoder->guts)
> decoder->guts->samples_decoded = 0;
Second problem: Visual plugins are slow. It's caused by flac_ip.add_vis_pcm,
it gets too many samples (4.5Ksamples) at one call. Solution is in calling
this with only 512samples. Against plugin.c
301,305c301,312
< flac_ip.add_vis_pcm(flac_ip.output->written_time(), file_info_.sample_format, file_info_.channels, bytes, reservoir_);
< while(flac_ip.output->buffer_free() < (int)bytes && file_info_.is_playing && file_info_.seek_to_in_sec == -1)
< xmms_usleep(10000);
< if(file_info_.is_playing && file_info_.seek_to_in_sec == -1)
< flac_ip.output->write_audio(reservoir_, bytes);
---
> unsigned written_bytes = 0, bytes_ = 512 * ((file_info_.bits_per_sample+7)/8) * file_info_.channels;
>
> while (written_bytes < bytes) {
> if (written_bytes + bytes_ > bytes)
> bytes_ = bytes - written_bytes;
> flac_ip.add_vis_pcm(flac_ip.output->written_time(), file_info_.sample_format, file_info_.channels, bytes_, reservoir_ + written_bytes);
> while(flac_ip.output->buffer_free() < (int)bytes_ && file_info_.is_playing && file_info_.seek_to_in_sec == -1)
> xmms_usleep(10000);
> if(file_info_.is_playing && file_info_.seek_to_in_sec == -1)
> flac_ip.output->write_audio(reservoir_ + written_bytes, bytes_);
> written_bytes += bytes_;
> }
--
Miroslav Lichvar
mirator at upcase.inf.upol.cz
More information about the Flac-dev
mailing list