diff --git a/Slim/Player/TranscodingHelper.pm b/Slim/Player/TranscodingHelper.pm index afab929d90c..837f040e117 100644 --- a/Slim/Player/TranscodingHelper.pm +++ b/Slim/Player/TranscodingHelper.pm @@ -33,6 +33,7 @@ sub init { our %commandTable = (); our %capabilities = (); our %binaries = (); +my %proxies = (); sub Conversions { return \%commandTable; @@ -85,7 +86,10 @@ sub loadConversionTables { $line =~ s/^\s*//o; $line =~ s/\s*$//o; - if ($line =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/) { + if ($line =~ /^proxy\s+(\S+)\s+(\S+)/i) { + $proxies{$1} = $2; + } + elsif ($line =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/) { my $inputtype = $1; my $outputtype = $2; @@ -361,10 +365,11 @@ sub getConvertCommand2 { } if ($prefs->get('prioritizeNative')) { - my @types = $type eq 'wav' ? ('pcm', $type) : ($type); + my $proxy = $proxies{$type} || $type; + my @types = $proxy eq 'wav' ? ('pcm', $proxy) : ($proxy); foreach my $type (@types) { my ($format) = grep /$type/, @supportedformats; - @supportedformats = ($format, grep { $_ !~ $type } @supportedformats) if $format; + @supportedformats = ($format, grep { $_ !~ $proxy } @supportedformats) if $format; } } diff --git a/convert.conf b/convert.conf index 0c8fa3b62e8..21bc42d9089 100644 --- a/convert.conf +++ b/convert.conf @@ -86,6 +86,14 @@ # %q, $QUALITY$ - quality # %Q, - quality ( fractal notation: if = '0' return '01' ) # ${FILENAME}$ - contents of {FILENAME} (may contain other $*$ substitutions ) +# +# It's also possible to define "proxies" who tell rules matcher what format a helper +# spits out. This is useful to use player's native format whenever possible. +# proxy +# For example if a plugin has created a new format named 'spt' whose helper's output +# is always 'ogg', you would use +# proxy spt ogg + # specific combinations match before wildcards