diff --git a/test/DumpDecoderClient.cxx b/test/DumpDecoderClient.cxx index 3e85b09b8..809af22c0 100644 --- a/test/DumpDecoderClient.cxx +++ b/test/DumpDecoderClient.cxx @@ -2,6 +2,7 @@ // Copyright The Music Player Daemon Project #include "DumpDecoderClient.hxx" +#include "lib/fmt/AudioFormatFormatter.hxx" #include "decoder/DecoderAPI.hxx" #include "input/InputStream.hxx" #include "tag/Names.hxx" @@ -18,9 +19,8 @@ DumpDecoderClient::Ready(const AudioFormat audio_format, assert(!initialized); assert(audio_format.IsValid()); - fprintf(stderr, "audio_format=%s duration=%f seekable=%d\n", - ToString(audio_format).c_str(), - duration.ToDoubleS(), seekable); + fmt::print(stderr, "audio_format={} duration={} seekable={}\n", + audio_format, duration.ToDoubleS(), seekable); initialized = true; } @@ -81,7 +81,7 @@ DumpDecoderClient::SubmitAudio([[maybe_unused]] InputStream *is, { if (kbit_rate != prev_kbit_rate) { prev_kbit_rate = kbit_rate; - fprintf(stderr, "%u kbit/s\n", kbit_rate); + fmt::print(stderr, "{} kbit/s\n", kbit_rate); } [[maybe_unused]] ssize_t nbytes = write(STDOUT_FILENO, @@ -93,10 +93,10 @@ DecoderCommand DumpDecoderClient::SubmitTag([[maybe_unused]] InputStream *is, Tag &&tag) noexcept { - fprintf(stderr, "TAG: duration=%f\n", tag.duration.ToDoubleS()); + fmt::print(stderr, "TAG: duration={}\n", tag.duration.ToDoubleS()); for (const auto &i : tag) - fprintf(stderr, " %s=%s\n", tag_item_names[i.type], i.value); + fmt::print(stderr, " {}={}\n", tag_item_names[i.type], i.value); return GetCommand(); } @@ -105,8 +105,8 @@ static void DumpReplayGainTuple(const char *name, const ReplayGainTuple &tuple) noexcept { if (tuple.IsDefined()) - fprintf(stderr, "replay_gain[%s]: gain=%f peak=%f\n", - name, (double)tuple.gain, (double)tuple.peak); + fmt::print(stderr, "replay_gain[{}]: gain={} peak={}\n", + name, tuple.gain, tuple.peak); } static void @@ -126,6 +126,6 @@ DumpDecoderClient::SubmitReplayGain(const ReplayGainInfo *rgi) noexcept void DumpDecoderClient::SubmitMixRamp([[maybe_unused]] MixRampInfo &&mix_ramp) noexcept { - fprintf(stderr, "MixRamp: start='%s' end='%s'\n", - mix_ramp.GetStart(), mix_ramp.GetEnd()); + fmt::print(stderr, "MixRamp: start={:?} end={:?}\n", + mix_ramp.GetStart(), mix_ramp.GetEnd()); } diff --git a/test/run_filter.cxx b/test/run_filter.cxx index 7d11f4569..eab1dd692 100644 --- a/test/run_filter.cxx +++ b/test/run_filter.cxx @@ -5,6 +5,7 @@ #include "ReadFrames.hxx" #include "cmdline/OptionDef.hxx" #include "cmdline/OptionParser.hxx" +#include "lib/fmt/AudioFormatFormatter.hxx" #include "lib/fmt/RuntimeError.hxx" #include "fs/Path.hxx" #include "fs/NarrowPath.hxx" @@ -27,7 +28,6 @@ #include #include -#include struct CommandLine { FromNarrowPath config_path; @@ -107,9 +107,7 @@ try { auto filter = prepared_filter->Open(audio_format); const AudioFormat out_audio_format = filter->GetOutAudioFormat(); - - fprintf(stderr, "audio_format=%s\n", - ToString(out_audio_format).c_str()); + fmt::print(stderr, "audio_format={}\n", out_audio_format); /* play */ diff --git a/test/run_output.cxx b/test/run_output.cxx index 4a918f811..d8e2fb605 100644 --- a/test/run_output.cxx +++ b/test/run_output.cxx @@ -5,6 +5,7 @@ #include "output/Registry.hxx" #include "output/OutputPlugin.hxx" #include "ConfigGlue.hxx" +#include "lib/fmt/AudioFormatFormatter.hxx" #include "lib/fmt/RuntimeError.hxx" #include "event/Thread.hxx" #include "fs/Path.hxx" @@ -26,7 +27,6 @@ #include #include #include -#include struct CommandLine { FromNarrowPath config_path; @@ -110,8 +110,7 @@ RunOutput(AudioOutput &ao, AudioFormat audio_format, ao.Open(audio_format); AtScopeExit(&ao) { ao.Close(); }; - fprintf(stderr, "audio_format=%s\n", - ToString(audio_format).c_str()); + fmt::print(stderr, "audio_format={}\n", audio_format); const size_t in_frame_size = audio_format.GetFrameSize();