From 6d5f08886f5cda18061d66d047abcf1553a9048e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 10 Mar 2017 21:44:53 +0100 Subject: [PATCH] screen_song: move code to audio_format_to_string() --- src/screen_song.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/screen_song.c b/src/screen_song.c index 973812b..03dc43d 100644 --- a/src/screen_song.c +++ b/src/screen_song.c @@ -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); } -- 2.30.2