Index: Slim/Player/Client.pm =================================================================== RCS file: /cvsroot/slim/server/Slim/Player/Client.pm,v retrieving revision 1.43 diff -u -r1.43 Client.pm --- Slim/Player/Client.pm 9 Feb 2004 19:00:08 -0000 1.43 +++ Slim/Player/Client.pm 19 Feb 2004 20:28:30 -0000 @@ -733,6 +733,7 @@ $client->[85] = 0; # pauseTime $client->[86] = 1; # songblockalign $client->[87] = 0; # bytesReceivedOffset + $client->[88] = undef; # streamendformat $::d_protocol && msg("New client connected: $id\n"); $client->lastirtime(0); @@ -1325,4 +1326,8 @@ @_ ? ($r->[87] = shift) : $r->[87]; } +sub streamendformat { + my $r = shift; + @_ ? ($r->[88] = shift) : $r->[88]; +} 1; Index: Slim/Player/Source.pm =================================================================== RCS file: /cvsroot/slim/server/Slim/Player/Source.pm,v retrieving revision 1.62 diff -u -r1.62 Source.pm --- Slim/Player/Source.pm 18 Feb 2004 18:36:59 -0000 1.62 +++ Slim/Player/Source.pm 19 Feb 2004 20:28:31 -0000 @@ -741,6 +741,12 @@ $::d_source && msg(" file type: $type format: $format\n"); $::d_source && msg(" command: $command\n"); + # If the target isn't a squeezebox and this isn't an mp3 stream, stream the complete file for now + if (defined($command) && $client && $client->isPlayer() && $client->model() ne 'squeezebox' && $format ne 'mp3') { + $size= ( -s $filepath ); + $offset=0; + } + if (defined($command)) { # this case is when we play the file through as-is @@ -853,15 +859,24 @@ my @supportedformats; my @playergroup = ($client, Slim::Player::Sync::syncedWith($client)); my %formatcounter; - - # make sure we only test formats that are supported. + + my @targformat; + + + # make sure that we only test formats that are supported. + if ($client->streamendformat && $client->streamendformat ne "") { @targformat = ($client->streamendformat); } + else { @targformat=$client->formats(); } + + if ( $::d_source ) { foreach my $check1 (@targformat) { msg("Added Target $check1 format for: ".$client->id()."\n"); } } + + foreach my $everyclient (@playergroup) { foreach my $supported ($everyclient->formats()) { $formatcounter{$supported}++; } } - foreach my $testformat ($client->formats()) { + foreach my $testformat (@targformat) { if ($formatcounter{$testformat} == scalar(@playergroup)) { push @supportedformats, $testformat; } Index: Slim/Player/Squeezebox.pm =================================================================== RCS file: /cvsroot/slim/server/Slim/Player/Squeezebox.pm,v retrieving revision 1.30 diff -u -r1.30 Squeezebox.pm --- Slim/Player/Squeezebox.pm 4 Feb 2004 21:16:52 -0000 1.30 +++ Slim/Player/Squeezebox.pm 19 Feb 2004 20:28:31 -0000 @@ -306,7 +306,7 @@ assert(length($frame) == 4+16); - my $path = '/stream.mp3?player='.$client->id; + my $path = '/stream?player='.$client->id; my $request_string = "GET $path HTTP/1.0\n"; Index: Slim/Web/HTTP.pm =================================================================== RCS file: /cvsroot/slim/server/Slim/Web/HTTP.pm,v retrieving revision 1.70 diff -u -r1.70 HTTP.pm --- Slim/Web/HTTP.pm 17 Feb 2004 18:56:43 -0000 1.70 +++ Slim/Web/HTTP.pm 19 Feb 2004 20:28:32 -0000 @@ -379,7 +379,7 @@ } # is this an HTTP stream? - if (!defined($client) && ($path =~ /(?:stream\.mp3|stream)$/)) { + if (!defined($client) && ($path =~ /(?:stream\.\w*|stream)$/)) { my $address = $peeraddr{$httpclientsock}; @@ -1050,7 +1050,34 @@ my $coderef = $pageFunctions{$path}; if (ref($coderef) eq 'CODE') { $body = &$coderef($client, $paramsref, \&generateResponse_Done, $httpclientsock, \$result, \%headers, \%paramheaders); - } elsif ($path =~ /(?:stream\.mp3|stream)$/) { + } elsif ($path =~ /(stream\.(\w*)|stream)$/) { + my $format=$2; + if (!defined($format) || $format eq "") { + $format=undef; + $::d_http && msg("Setting streamendformat to undef\n"); + } + else { + $format=Slim::Music::Info::typeFromSuffix(".".$format); + $::d_http && msg("Setting streamendformat to $format\n"); + } + $client->streamendformat($format); + + if (defined($format) && $format eq 'unk') { + $::d_http && msg("Unsupported filetype $2 requested\n"); + $result="HTTP/1.0 400 Bad Request"; + return generateResponse_Done($client, $paramsref, filltemplatefile('html/errors/400.html',$paramsref) , $httpclientsock, \$result , \%headers, \%paramheaders); + } + if (defined($format)) { + + my ($command1, $type1, $format1) = Slim::Player::Source::getCommand ($client, Slim::Player::Playlist::song($client)); + + if (!defined($command1)) { + $::d_http && msg("Could not find a command to covert file to requested type $format\n"); + $result="HTTP/1.0 400 Bad Request"; + return generateResponse_Done($client, $paramsref, filltemplatefile('html/errors/400.html',$paramsref) , $httpclientsock, \$result, \%headers, \%paramheaders); + } + } + %headers = statusHeaders($client); $headers{"x-audiocast-name"} = string('SLIMSERVER'); if ($sendMetaData{$httpclientsock}) {