[Slim-Checkins] r11117 - /branches/6.5/server/Slim/Player/Player.pm

andy at svn.slimdevices.com andy at svn.slimdevices.com
Fri Jan 5 13:49:39 PST 2007


Author: andy
Date: Fri Jan  5 13:49:39 2007
New Revision: 11117

URL: http://svn.slimdevices.com?rev=11117&view=rev
Log:
Sync up the Buffer Fullness display to what I have on SN

Modified:
    branches/6.5/server/Slim/Player/Player.pm

Modified: branches/6.5/server/Slim/Player/Player.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Player/Player.pm?rev=11117&r1=11116&r2=11117&view=diff
==============================================================================
--- branches/6.5/server/Slim/Player/Player.pm (original)
+++ branches/6.5/server/Slim/Player/Player.pm Fri Jan  5 13:49:39 2007
@@ -669,12 +669,20 @@
 		# show the number of seconds of audio in the buffer instead of a percentage
 		my $url = Slim::Player::Playlist::url($client);
 		if ( Slim::Music::Info::isRemoteURL($url) ) {
-			if ( my $bitrate = Slim::Music::Info::getBitrate($url) ) {
-				my $decodeBuffer = $client->bufferFullness() / ( int($bitrate / 8) );
-				my $outputBuffer = $client->outputBufferFullness() / (44100 * 8);
-				$songtime  = ' ' . sprintf "%.1f / %.1f", $decodeBuffer, $outputBuffer;
-				$songtime .= ' ' . $client->string('SECONDS');
-			}
+			my $decodeBuffer;
+			
+			# Display decode buffer as seconds if we know the bitrate, otherwise show KB
+			my $bitrate = Slim::Music::Info::getBitrate($url);
+			if ( $bitrate > 0 ) {
+				$decodeBuffer = sprintf( "%.1f", $client->bufferFullness() / ( int($bitrate / 8) ) );
+			}
+			else {
+				$decodeBuffer = sprintf( "%d KB", $client->bufferFullness() / 1024 );
+			}
+			
+			my $outputBuffer = $client->outputBufferFullness() / (44100 * 8);
+			$songtime  = ' ' . sprintf "%s / %.1f", $decodeBuffer, $outputBuffer;
+			$songtime .= ' ' . $client->string('SECONDS');
 		}
 	} elsif ($showTime) { 
 		$songtime = ' ' . $client->textSongTime($showTime < 0);



More information about the checkins mailing list