[Slim-Checkins] r10228 - /branches/6.5/server/Slim/Utils/Scanner.pm

andy at svn.slimdevices.com andy at svn.slimdevices.com
Thu Oct 5 19:21:33 PDT 2006


Author: andy
Date: Thu Oct  5 19:21:32 2006
New Revision: 10228

URL: http://svn.slimdevices.com?rev=10228&view=rev
Log:
Use references for IO::String objects when parsing WMA

Modified:
    branches/6.5/server/Slim/Utils/Scanner.pm

Modified: branches/6.5/server/Slim/Utils/Scanner.pm
URL: http://svn.slimdevices.com/branches/6.5/server/Slim/Utils/Scanner.pm?rev=10228&r1=10227&r2=10228&view=diff
==============================================================================
--- branches/6.5/server/Slim/Utils/Scanner.pm (original)
+++ branches/6.5/server/Slim/Utils/Scanner.pm Thu Oct  5 19:21:32 2006
@@ -974,16 +974,16 @@
 	}
 	
 	# parse the ASF header data
-	my $header = $http->response->content;
 	
 	# The header may be at the front of the file, if the remote
 	# WMA file is not a live stream
-	my $io  = IO::String->new($header);
+	my $io  = IO::String->new( $http->response->content_ref );
 	my $wma = Audio::WMA->new($io);
 	
 	if ( !$wma || !ref $wma->stream ) {
 		
 		# it's probably a live stream, the WMA header is offset
+		my $header = $http->response->content;
 		my $chunkType = unpack 'v', substr($header, 0, 2);
 		if ( $chunkType != 0x4824 ) {
 			return scanWMAStreamError( $http, 'ASF_UNABLE_TO_PARSE', $args );
@@ -992,7 +992,8 @@
 		my $chunkLength = unpack 'v', substr($header, 2, 2);
 	
 		# skip to the body data
-		$io  = IO::String->new( substr($header, 12, $chunkLength) );
+		my $body = substr($header, 12, $chunkLength);
+		$io->open(\$body);
 		$wma = Audio::WMA->new($io);
 	
 		if ( !$wma ) {



More information about the checkins mailing list