Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

playback: support non-builtin sinks in audio_guess_frequency

Change-Id: I87b1b489ffc5b9ae05c3233bc091cd7be3da406e

mojyack f87ff3a9 76d63246

+5 -21
+5 -21
apps/playback.c
··· 4236 4236 #ifdef HAVE_PLAY_FREQ 4237 4237 static unsigned long audio_guess_frequency(struct mp3entry *id3) 4238 4238 { 4239 - switch (id3->frequency) 4239 + const struct pcm_sink_caps* caps = pcm_sink_caps(pcm_current_sink()); 4240 + for (size_t i = 0; i < caps->num_samprs; i += 1) 4240 4241 { 4241 - #if HAVE_PLAY_FREQ >= 48 4242 - case 44100: 4243 - return SAMPR_44; 4244 - case 48000: 4245 - return SAMPR_48; 4246 - #endif 4247 - #if HAVE_PLAY_FREQ >= 96 4248 - case 88200: 4249 - return SAMPR_88; 4250 - case 96000: 4251 - return SAMPR_96; 4252 - #endif 4253 - #if HAVE_PLAY_FREQ >= 192 4254 - case 176400: 4255 - return SAMPR_176; 4256 - case 192000: 4257 - return SAMPR_192; 4258 - #endif 4259 - default: 4260 - return (id3->frequency % 4000) ? SAMPR_44 : SAMPR_48; 4242 + if (id3->frequency == caps->samprs[i]) 4243 + return id3->frequency; 4261 4244 } 4245 + return (id3->frequency % 4000) ? SAMPR_44 : SAMPR_48; 4262 4246 } 4263 4247 4264 4248 static bool audio_auto_change_frequency(struct mp3entry *id3, bool play)