[Flac-dev] getting framesize in client

Miroslav Lichvar lichvarm at phoenix.inf.upol.cz
Thu Nov 14 09:12:04 PST 2002


On Wed, Nov 13, 2002 at 09:03:43PM -0800, Josh Coalson wrote:
> --- Miroslav Lichvar <lichvarm at phoenix.inf.upol.cz> wrote:
> > On Sat, Nov 09, 2002 at 06:02:33PM +0100, Miroslav Lichvar wrote:
> > > On Fri, Nov 08, 2002 at 07:12:35PM -0800, Josh Coalson wrote:
> > > > Yeah, it's useful, so now there is a
> > > > FLAC__seekable_stream_decoder_get_decode_position() and
> > > > FLAC__file_decoder_get_decode_position().  I haven't documented
> > > > them yet but you can see an example in
> > > > src/metaflac/operations_shorthand_seektable.c where I use it
> > > > during seektable creation.
> > > 
> > > Ok, here is patch for "current bitrate" displaying in xmms plugin
> > and
> > 
> > It doesn't display correctly near end of files, here is better one.
> > I'm sorry.
> 
> Cool, I checked in the patch.  Also checked in the Makefile.am
> stuff.

Another problem. When output plugin without buffer (e.g. disk writter
plugin) is selected, it will display nonsense.

Please apply attached patch. Thanks,

-- 
Miroslav Lichvar
-------------- next part --------------
--- src/plugin_xmms/plugin.c.orig	2002-11-14 08:59:20.000000000 +0100
+++ src/plugin_xmms/plugin.c	2002-11-14 14:33:38.000000000 +0100
@@ -404,7 +404,7 @@
 			unsigned target_sample = (unsigned)(distance * (double)file_info_.total_samples);
 			if(FLAC__file_decoder_seek_absolute(decoder_, (FLAC__uint64)target_sample)) {
 				flac_ip.output->flush(file_info_.seek_to_in_sec * 1000);
-				bh_index_last_w = bh_index_last_o = file_info_.seek_to_in_sec * 1000 / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE;
+				bh_index_last_w = bh_index_last_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE;
 				file_info_.seek_to_in_sec = -1;
 				file_info_.eof = false;
 				wide_samples_in_reservoir_ = 0;
@@ -413,7 +413,7 @@
 		else {
 			/* display the right bitrate from history */
 			unsigned bh_index_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE;
-			if(bh_index_o != bh_index_last_o && bh_index_last_w != bh_index_o) {
+			if(bh_index_o != bh_index_last_o && bh_index_o != bh_index_last_w && bh_index_o != (bh_index_last_w + 1) % BITRATE_HIST_SIZE) {
 				bh_index_last_o = bh_index_o;
 				flac_ip.set_info(file_info_.title, file_info_.length_in_msec, bitrate_history_[bh_index_o], file_info_.sample_rate, file_info_.channels);
 			}


More information about the Flac-dev mailing list