Skip to content

Commit

Permalink
Merge pull request #493 from philippe44/format-proxies-
Browse files Browse the repository at this point in the history
Add proxies for transcoding rules matcher
  • Loading branch information
mherger authored May 4, 2021
2 parents 6c66e23 + 3c4fc88 commit 65f60b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Slim/Player/TranscodingHelper.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sub init {
our %commandTable = ();
our %capabilities = ();
our %binaries = ();
my %proxies = ();

sub Conversions {
return \%commandTable;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -352,7 +356,8 @@ sub getConvertCommand2 {
}

if ($prefs->get('prioritizeNative')) {
my @types = $type eq 'wav' ? ('pcm', $type) : ($type);
my @types = split /,/, ($proxies{$type} || $type);
unshift @types, 'pcm' if grep /wav/, @types;
foreach my $type (@types) {
my ($format) = grep /$type/, @supportedformats;
@supportedformats = ($format, grep { $_ !~ $type } @supportedformats) if $format;
Expand Down
9 changes: 9 additions & 0 deletions convert.conf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@
# %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(s) a
# helper spits out. This is useful to stick to player's native format whenever
# possible. Use comma-separated list for multiple output formats, from least
# favorite to most favorite
# proxy <helper_format> <output_format>[,<output_format>]
# For example if a plugin has created a new format named 'spt' whose helper's output
# is 'ogg' or 'pcm', and you want 'ogg' to be most desired, then add
# proxy spt pcm,ogg

# specific combinations match before wildcards

Expand Down

0 comments on commit 65f60b6

Please sign in to comment.