Try to follow this:
When a Song is opened:
in Slim::Player::TranscodingHelper::getConvertCommand 2:Code:($transcoder, $error) = Slim::Player::TranscodingHelper::getConvertCommand2( $self, $format, \@streamFormats, [], \@wantOptions);
in Slim::Player::CapabilitiesHelper::samplerateLimitCode:my $samplerateLimit = $song ? Slim::Player::CapabilitiesHelper::samplerateLimit($song) : 0; SAMPLELIMIT: if ($samplerateLimit) { foreach (@$need) { last SAMPLELIMIT if /D/; } push @$need, 'D'; } ... $transcoder = { command => $command, profile => $profile, usedCapabilities => [@$need, @$want], streamMode => $streamMode, streamformat => (split (/-/, $profile))[1], rateLimit => $rateLimit || 320, samplerateLimit => $samplerateLimit || 44100, clientid => $clientid || 'undefined', groupid => $clientprefs ? ($clientprefs->get('syncgroupid') || 0) : 0, name => $client ? $client->name : 'undefined', player => $player || 'undefined', channels => $track->channels() || 2, outputChannels => $clientprefs ? ($clientprefs->get('outputChannels') || 2) : 2, };
So $transcoder->{samplerateLimit} is the minimum value among the track sample rate and the sample rate limit of any player in the sync group. If track is undefined, i.e remote stream, 44100.Code:sub samplerateLimit { my $song = shift; my $srate = $song->currentTrack()->samplerate; return undef if ! $srate; my $maxRate = 0; foreach ($song->master()->syncGroupActiveMembers()) { my $rate = $_->maxSupportedSamplerate(); if ($rate && ($maxRate && $maxRate > $rate || !$maxRate)) { $maxRate = $rate; } } if ($maxRate && $maxRate < $srate) { if (($maxRate % 12000) == 0 && ($srate % 11025) == 0) { $maxRate = int($maxRate * 11025 / 12000); } return $maxRate; } return undef; }
then Song::Open continues, few lines below:
that replace placeholders with actual values:Code:my $command = Slim::Player::TranscodingHelper::tokenizeConvertCommand2( $transcoder, $sock ? '-' : $track->path, $self->streamUrl(), $usepipe, $quality );
Then, if the song is not a track, Downsample option is set to 44100.Code:my ($transcoder, $filepath, $fullpath, $noPipe, $quality) = @_; ... foreach my $v (keys %vars) { my $value; if ($v eq 's') {$value = "$start";} ... elsif ($v eq 'D') {$value = $transcoder->{'samplerateLimit'} / 1000;} ... foreach (values %subs) { s/%$v/$value/ge; } } ... main::INFOLOG && $log->is_info && $log->info("Using command for conversion: ", Slim::Utils::Unicode::utf8decode_locale($command)); return $command; }
BUT if this is not the line going to be executed (as is in my case when upsampling), then you have the error.
To understand why it could happen, try to follow stream mode and capabilities rules (that's a real damn dark corner).
Results 21 to 30 of 30
-
2017-04-01, 18:35 #21
- Join Date
- Dec 2009
- Location
- Albinea (Bologna Area) Italy
- Posts
- 604
Last edited by marcoc1712; 2017-04-02 at 04:51.
__________________________________________________ ______________________
Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it
-
2017-04-02, 22:00 #22
- Join Date
- May 2008
- Location
- Canada
- Posts
- 3,710
Thanks Marco - I'll try to understand all this, but it's probably going to take a while for me ...
To your other comment on squeezelite patch, do you know when LMS is supposed to send a file with a WAV/AIFF header? I all my experiences developping bridges, I always got a raw PCM flow when pcm was the selected codec and files are wav or aiff (except with a "bug" in 7.7 where there is 8 unwanted bytes at the beginning of the stream when sending aiff). In fact, it does not seem to me that slimproto gives you any hint of what you receive, except PCM and endianness. Do you assume wav vs aiff purely based on endianness? Still, I never received a header when streaming in PCM, whatever the source format was.
For example, the convert.conf rules for flac to pcm is
flc pcm * *
# FT:{START=--skip=%t}U:{END=--until=%v}
[flac] -dcs --force-raw-format --endian=little --sign=signed $START$ $END$ -- $FILE$
Which seems to me that the --force-raw-format prevents a wav header to be added by flacLMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5
-
2017-04-03, 04:00 #23
Isn't the file just being sent if you play a file that's on the same machine as server and player?
---
learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
at penguinlovesmusic.com
New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch
-
2017-04-03, 05:03 #24
- Join Date
- Dec 2009
- Location
- Albinea (Bologna Area) Italy
- Posts
- 604
I always convert to WAV (or AIFF) viaC-3PO plugin, that is the same as using custom-convert.conf lines like:
Code:flc pcm * 00:20:00:00:00:17 # FRI [flac] -dcs --totally-silent $START$ $END$ -- $FILE$ | [sox] -q -t wav - -t wav -b 24 - gain -h rate -v -L -b 90.7 96000 wav pcm * 00:20:00:00:00:17 # FRT:{START=--skip=%t}U:{END=--until=%v} [flac] -cs --totally-silent --compression-level-0 $START$ $END$ -- $FILE$ | [sox] -q -t flac - -t wav -b 24 - gain -h rate -v -L -b 90.7 96000 aif aif * 00:20:00:00:00:17 # FR [sox] -q -t aif $FILE$ -t aif-b 24 - gain -h rate -v -L -b 90.7 96000
Note that in the profile name I use pcm instead of wav, but is just the same, becouse Transcoding helper will replace wav with pcm anyway.
N.B:
I did not test above lines, probably they needs some hack.Last edited by marcoc1712; 2017-04-03 at 08:00.
__________________________________________________ ______________________
Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it
-
2017-04-03, 05:13 #25
- Join Date
- Dec 2009
- Location
- Albinea (Bologna Area) Italy
- Posts
- 604
__________________________________________________ ______________________
Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it
-
2017-04-03, 07:23 #26
- Join Date
- May 2008
- Location
- Canada
- Posts
- 3,710
LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5
-
2017-04-03, 07:29 #27
- Join Date
- May 2008
- Location
- Canada
- Posts
- 3,710
LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5
-
2017-04-03, 07:54 #28
- Join Date
- Dec 2009
- Location
- Albinea (Bologna Area) Italy
- Posts
- 604
__________________________________________________ ______________________
Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it
-
2017-04-03, 08:29 #29
- Join Date
- May 2008
- Location
- Canada
- Posts
- 3,710
LMS 7.7, 7.8 and 7.9 - 5xRadio, 3xBoom, 4xDuet, 1xTouch, 1 SB2. Sonos PLAY:3, PLAY:5, Marantz NR1603, JBL OnBeat, XBoxOne, XBMC, Foobar2000, ShairPortW, JRiver 21, 2xChromecast Audio, Chromecast v1 and v2, , Pi B3, B2, Pi B+, 2xPi A+, Odroid-C1, Odroid-C2, Cubie2, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5
-
2017-04-03, 09:25 #30
- Join Date
- Dec 2009
- Location
- Albinea (Bologna Area) Italy
- Posts
- 604
You could feed the transcoding table in lMS (the one considered by transodingHelper when looking for the command to apply to reproduce the specific selected song) in different ways:
a. via standard convert.conf
b. via generic custom-convert.conf
c. via plugin specific convert.conf
d. via direct write into that table from code, like that:
Code:my $newProfile= "flc-pcm-*-*"; $Slim::Player::TranscodingHelper::commandTable{ $newProfile } = $myCommand; $Slim::Player::TranscodingHelper::capabilities{ $newProfile } = $myCapabilities;
$myCommand is a string and $myCapabilities an hash like this:
Code:my $capabilities = { # I => 'noArgs', # Qubuz or .cue. # I => 'FILE=-', # Is the Daphile way, needs a patch to LMS. # F => 'FILE=-f %f', # R => 'FILE=-f %F', F => 'noArgs', R => 'noArgs', # T => 'START=-s %s', # U => 'END=-w %w', D => 'RESAMPLE=-r %d' };
Slim::Player::TranscodingHelper::Conversions();
%Slim::Player::TranscodingHelper::capabilities;
to see how actual situation is.
Of corse you could also remove profiles form the table or disable them:
Code:sub _disableProfile{ my $profile = shift; my @disabled = @{ $serverPreferences->get('disabledformats') }; my $found=0; for my $format (@disabled) { if ($format eq $profile){ $found=1; last;} } if (! $found ){ push @disabled, $profile; $serverPreferences->set('disabledformats', \@disabled); $serverPreferences->writeAll(); $serverPreferences->savenow(); } }
__________________________________________________ ______________________
Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it