Code

screen_song: show audio format
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Mon, 9 Jun 2014 09:17:44 +0000 (11:17 +0200)
committerMax Kellermann <max@duempel.org>
Mon, 9 Jun 2014 09:17:44 +0000 (11:17 +0200)
NEWS
src/screen_song.c

diff --git a/NEWS b/NEWS
index cf73d0ae3c77650fe0c433534b3788d6217056ae..ca5cfd6d47316f820fc9b920db0bc1d121489b5b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ ncmpc 0.22 - not yet released
 * patched color line-flags
 * configuration option "search-format"
 * remove broken leoslyrics plugin
+* show audio format in song screen
 
 
 ncmpc 0.21 - (2013-04-11)
index 6d3a0342a7c592eed21b0083e05915592db900e9..2a69860ae33e9466c96ec89e02cee843d0773fd7 100644 (file)
@@ -38,6 +38,7 @@ enum {
        LABEL_LENGTH = MPD_TAG_COUNT,
        LABEL_PATH,
        LABEL_BITRATE,
+       LABEL_FORMAT,
        LABEL_POSITION,
 };
 
@@ -56,6 +57,7 @@ static const char *const tag_labels[] = {
        [MPD_TAG_COMMENT] = N_("Comment"),
        [LABEL_PATH] = N_("Path"),
        [LABEL_BITRATE] = N_("Bitrate"),
+       [LABEL_FORMAT] = N_("Format"),
 };
 
 static unsigned max_tag_label_width;
@@ -320,6 +322,16 @@ screen_song_add_song(const struct mpd_song *song, const struct mpdclient *c)
                           mpd_status_get_kbit_rate(c->status));
                screen_song_append(_(tag_labels[LABEL_BITRATE]), buf,
                                   max_tag_label_width);
+
+               const struct mpd_audio_format *format =
+                       mpd_status_get_audio_format(c->status);
+               if (format) {
+                       g_snprintf(buf, sizeof(buf), _("%u:%u:%u"),
+                                  format->sample_rate, format->bits,
+                                  format->channels);
+                       screen_song_append(_(tag_labels[LABEL_FORMAT]), buf,
+                                          max_tag_label_width);
+               }
        }
 }