Code

screen_song: move code to audio_format_to_string()
authorMax Kellermann <max.kellermann@gmail.com>
Fri, 10 Mar 2017 20:44:53 +0000 (21:44 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Fri, 10 Mar 2017 20:44:53 +0000 (21:44 +0100)
src/screen_song.c

index 973812b4e53d393db8d531e575ad044cf7b63ef6..03dc43d5ef178ff93c78709867fed5508d1cf17c 100644 (file)
@@ -365,6 +365,15 @@ screen_song_add_stats(struct mpd_connection *connection)
        return true;
 }
 
+static void
+audio_format_to_string(char *buffer, size_t size,
+                      const struct mpd_audio_format *format)
+{
+       g_snprintf(buffer, size, _("%u:%u:%u"),
+                  format->sample_rate, format->bits,
+                  format->channels);
+}
+
 static void
 screen_song_update(struct mpdclient *c)
 {
@@ -410,9 +419,7 @@ screen_song_update(struct mpdclient *c)
                        mpd_status_get_audio_format(c->status);
                if (format) {
                        char buf[32];
-                       g_snprintf(buf, sizeof(buf), _("%u:%u:%u"),
-                                  format->sample_rate, format->bits,
-                                  format->channels);
+                       audio_format_to_string(buf, sizeof(buf), format);
                        screen_song_append(_(tag_labels[LABEL_FORMAT]), buf,
                                           max_tag_label_width);
                }