[Slim-Checkins] r10229 - /trunk/server/Slim/Utils/Scanner.pm

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


Author: andy
Date: Thu Oct  5 19:21:57 2006
New Revision: 10229

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

Modified:
    trunk/server/Slim/Utils/Scanner.pm

Modified: trunk/server/Slim/Utils/Scanner.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Utils/Scanner.pm?rev=10229&r1=10228&r2=10229&view=diff
==============================================================================
--- trunk/server/Slim/Utils/Scanner.pm (original)
+++ trunk/server/Slim/Utils/Scanner.pm Thu Oct  5 19:21:57 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