Code

screen_song: show "dsd64" etc. shortcuts
authorMax Kellermann <max.kellermann@gmail.com>
Fri, 10 Mar 2017 20:50:20 +0000 (21:50 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Fri, 10 Mar 2017 20:50:20 +0000 (21:50 +0100)
src/screen_song.c

index 8250f1623d6949389b40df3cecc3ceab203fce84..6814dcddbaa7e38aa489068396a540d2a73b4513 100644 (file)
@@ -378,6 +378,16 @@ audio_format_to_string(char *buffer, size_t size,
        }
 
        if (format->bits == MPD_SAMPLE_FORMAT_DSD) {
+               if (format->sample_rate > 0 &&
+                   format->sample_rate % 44100 == 0) {
+                       /* use shortcuts such as "dsd64" which implies the
+                          sample rate */
+                       g_snprintf(buffer, size, _("dsd%u:%u"),
+                                  format->sample_rate * 8 / 44100,
+                                  format->channels);
+                       return;
+               }
+
                g_snprintf(buffer, size, _("%u:dsd:%u"),
                           format->sample_rate,
                           format->channels);