Skip to content

Commit

Permalink
command/player, SongPrint: use AudioFormatFormatter()
Browse files Browse the repository at this point in the history
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 #1807
  • Loading branch information
MaxKellermann committed May 15, 2023
1 parent 4345a65 commit 181b96d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/SongPrint.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);

Expand All @@ -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());

Expand Down
3 changes: 2 additions & 1 deletion src/command/PlayerCommands.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 181b96d

Please sign in to comment.