1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
Upstream-Status: Backport [https://github.com/MusicPlayerDaemon/MPD/commit/181b96dd2d71bc8f2668776719d344466f258b5d]
Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
From 181b96dd2d71bc8f2668776719d344466f258b5d Mon Sep 17 00:00:00 2001
From: Max Kellermann <max.kellermann@gmail.com>
Date: Mon, 15 May 2023 20:52:21 +0200
Subject: [PATCH] command/player, SongPrint: use AudioFormatFormatter()
libfmt version 10 apparently doesn't know how to format a
`StringBuffer`, failing the MPD build. Since we have a formatter
specialization for `AudioFormat`, let's use that - it's better and
easier to use.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1807
---
src/SongPrint.cxx | 5 +++--
src/command/PlayerCommands.cxx | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/SongPrint.cxx b/src/SongPrint.cxx
index 98d544cc38..835669d276 100644
--- a/src/SongPrint.cxx
+++ b/src/SongPrint.cxx
@@ -8,6 +8,7 @@
#include "TagPrint.hxx"
#include "client/Response.hxx"
#include "fs/Traits.hxx"
+#include "lib/fmt/AudioFormatFormatter.hxx"
#include "time/ChronoUtil.hxx"
#include "util/StringBuffer.hxx"
#include "util/UriUtil.hxx"
@@ -77,7 +78,7 @@ song_print_info(Response &r, const LightSong &song, bool base) noexcept
time_print(r, "Last-Modified", song.mtime);
if (song.audio_format.IsDefined())
- r.Fmt(FMT_STRING("Format: {}\n"), ToString(song.audio_format));
+ r.Fmt(FMT_STRING("Format: {}\n"), song.audio_format);
tag_print_values(r, song.tag);
@@ -100,7 +101,7 @@ song_print_info(Response &r, const DetachedSong &song, bool base) noexcept
time_print(r, "Last-Modified", song.GetLastModified());
if (const auto &f = song.GetAudioFormat(); f.IsDefined())
- r.Fmt(FMT_STRING("Format: {}\n"), ToString(f));
+ r.Fmt(FMT_STRING("Format: {}\n"), f);
tag_print_values(r, song.GetTag());
diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx
index 5108b9d3c4..0b5a917020 100644
--- a/src/command/PlayerCommands.cxx
+++ b/src/command/PlayerCommands.cxx
@@ -13,6 +13,7 @@
#include "Partition.hxx"
#include "Instance.hxx"
#include "IdleFlags.hxx"
+#include "lib/fmt/AudioFormatFormatter.hxx"
#include "util/StringBuffer.hxx"
#include "util/ScopeExit.hxx"
#include "util/Exception.hxx"
@@ -170,7 +171,7 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)
if (player_status.audio_format.IsDefined())
r.Fmt(FMT_STRING(COMMAND_STATUS_AUDIO ": {}\n"),
- ToString(player_status.audio_format));
+ player_status.audio_format);
}
#ifdef ENABLE_DATABASE
|