Index: types.conf =================================================================== --- types.conf (revision 33764) +++ types.conf (working copy) @@ -36,6 +36,7 @@ mp3 mp2,mp3 audio/mpeg,audio/mp3,audio/mp3s,audio/x-mpeg,audio/mpeg3,audio/mpg audio mpc mpc,mp+ audio/x-musepack audio ogg ogg,oga audio/x-ogg,application/ogg,audio/ogg,application/x-ogg audio +ogf - - audio pcm pcm audio/L16,audio/x-pcm audio pdf pdf application/pdf - pls pls audio/scpls,audio/x-scpls playlist Index: Slim/Utils/Scanner/Remote.pm =================================================================== --- Slim/Utils/Scanner/Remote.pm (revision 33764) +++ Slim/Utils/Scanner/Remote.pm (working copy) @@ -460,6 +460,17 @@ passthrough => [ $track, $args ], } ); } + elsif ( !main::SLIM_SERVICE && $type eq 'ogg' ) { + + # Read the header to allow support for oggflac as it requires different decode path + main::DEBUGLOG && $log->is_debug && $log->debug('Reading Ogg header'); + + $http->read_body( { + readLimit => 128, + onBody => \&parseOggHeader, + passthrough => [ $track, $args ], + } ); + } else { # If URL was mms but content-type is not wma, change URL if ( $track->url =~ /^mms/i ) { @@ -718,6 +729,29 @@ $cb->( $track, undef, @{$pt} ); } +sub parseOggHeader { + my ( $http, $track, $args ) = @_; + + my $client = $args->{client}; + my $cb = $args->{cb} || sub {}; + my $pt = $args->{pt} || []; + + my $header = $http->response->content; + my $data = substr($header, 28); + + # search for Ogg FLAC headers within the data - if so change the content type to ogf for OggFlac + # OggFlac header defined: http://flac.sourceforge.net/ogg_mapping.html + if (substr($data, 0, 5) eq "\x7fFLAC" && substr($data, 9,4) eq 'fLaC') { + main::DEBUGLOG && $log->is_debug && $log->debug("Ogg stream is OggFlac - setting content type [ogf]"); + Slim::Schema->clearContentTypeCache( $track->url ); + Slim::Music::Info::setContentType( $track->url, 'ogf' ); + $track->content_type('ogf'); + } + + # All done + $cb->( $track, undef, @{$pt} ); +} + sub streamAudioData { my ( $http, $dataref, $track, $args, $url ) = @_; Index: Slim/Schema.pm =================================================================== --- Slim/Schema.pm (revision 33764) +++ Slim/Schema.pm (working copy) @@ -728,6 +728,12 @@ return $contentType; } +# The contentTypeCache can used above can erroneously be set to type inferred from url path - allow it to be cleared +sub clearContentTypeCache { + my ($self, $urlOrObj) = @_; + delete $contentTypeCache{$urlOrObj}; +} + =head2 objectForUrl( $args ) The workhorse for getting L or L Index: convert.conf =================================================================== --- convert.conf (revision 33764) +++ convert.conf (working copy) @@ -156,6 +156,9 @@ ogg pcm * * [sox] -q -t ogg $FILE$ -t raw -r 44100 -c 2 -2 -s - +ogf aif * * + [flac] -dcsF --ogg --force-aiff-format -- $FILE$ + wma pcm * * # F:{PATH=%f}R:{PATH=%F} [wmadec] -r 44100 -b 16 -n 2 $PATH$