Commit a71e68db authored by Max Kellermann's avatar Max Kellermann

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
parent 1417578b
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "TagPrint.hxx" #include "TagPrint.hxx"
#include "client/Response.hxx" #include "client/Response.hxx"
#include "fs/Traits.hxx" #include "fs/Traits.hxx"
#include "lib/fmt/AudioFormatFormatter.hxx"
#include "time/ChronoUtil.hxx" #include "time/ChronoUtil.hxx"
#include "util/StringBuffer.hxx" #include "util/StringBuffer.hxx"
#include "util/UriUtil.hxx" #include "util/UriUtil.hxx"
...@@ -93,7 +94,7 @@ song_print_info(Response &r, const LightSong &song, bool base) noexcept ...@@ -93,7 +94,7 @@ song_print_info(Response &r, const LightSong &song, bool base) noexcept
time_print(r, "Last-Modified", song.mtime); time_print(r, "Last-Modified", song.mtime);
if (song.audio_format.IsDefined()) 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); tag_print_values(r, song.tag);
...@@ -116,7 +117,7 @@ song_print_info(Response &r, const DetachedSong &song, bool base) noexcept ...@@ -116,7 +117,7 @@ song_print_info(Response &r, const DetachedSong &song, bool base) noexcept
time_print(r, "Last-Modified", song.GetLastModified()); time_print(r, "Last-Modified", song.GetLastModified());
if (const auto &f = song.GetAudioFormat(); f.IsDefined()) 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()); tag_print_values(r, song.GetTag());
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "Partition.hxx" #include "Partition.hxx"
#include "Instance.hxx" #include "Instance.hxx"
#include "IdleFlags.hxx" #include "IdleFlags.hxx"
#include "lib/fmt/AudioFormatFormatter.hxx"
#include "util/StringBuffer.hxx" #include "util/StringBuffer.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
#include "util/Exception.hxx" #include "util/Exception.hxx"
...@@ -185,7 +186,7 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r) ...@@ -185,7 +186,7 @@ handle_status(Client &client, [[maybe_unused]] Request args, Response &r)
if (player_status.audio_format.IsDefined()) if (player_status.audio_format.IsDefined())
r.Fmt(FMT_STRING(COMMAND_STATUS_AUDIO ": {}\n"), r.Fmt(FMT_STRING(COMMAND_STATUS_AUDIO ": {}\n"),
ToString(player_status.audio_format)); player_status.audio_format);
} }
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment