test/run_{filter,output}: use fmt
This commit is contained in:
parent
0676ab7f47
commit
76562fc093
|
@ -2,6 +2,7 @@
|
||||||
// Copyright The Music Player Daemon Project
|
// Copyright The Music Player Daemon Project
|
||||||
|
|
||||||
#include "DumpDecoderClient.hxx"
|
#include "DumpDecoderClient.hxx"
|
||||||
|
#include "lib/fmt/AudioFormatFormatter.hxx"
|
||||||
#include "decoder/DecoderAPI.hxx"
|
#include "decoder/DecoderAPI.hxx"
|
||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
#include "tag/Names.hxx"
|
#include "tag/Names.hxx"
|
||||||
|
@ -18,9 +19,8 @@ DumpDecoderClient::Ready(const AudioFormat audio_format,
|
||||||
assert(!initialized);
|
assert(!initialized);
|
||||||
assert(audio_format.IsValid());
|
assert(audio_format.IsValid());
|
||||||
|
|
||||||
fprintf(stderr, "audio_format=%s duration=%f seekable=%d\n",
|
fmt::print(stderr, "audio_format={} duration={} seekable={}\n",
|
||||||
ToString(audio_format).c_str(),
|
audio_format, duration.ToDoubleS(), seekable);
|
||||||
duration.ToDoubleS(), seekable);
|
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ DumpDecoderClient::SubmitAudio([[maybe_unused]] InputStream *is,
|
||||||
{
|
{
|
||||||
if (kbit_rate != prev_kbit_rate) {
|
if (kbit_rate != prev_kbit_rate) {
|
||||||
prev_kbit_rate = 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,
|
[[maybe_unused]] ssize_t nbytes = write(STDOUT_FILENO,
|
||||||
|
@ -93,10 +93,10 @@ DecoderCommand
|
||||||
DumpDecoderClient::SubmitTag([[maybe_unused]] InputStream *is,
|
DumpDecoderClient::SubmitTag([[maybe_unused]] InputStream *is,
|
||||||
Tag &&tag) noexcept
|
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)
|
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();
|
return GetCommand();
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,8 @@ static void
|
||||||
DumpReplayGainTuple(const char *name, const ReplayGainTuple &tuple) noexcept
|
DumpReplayGainTuple(const char *name, const ReplayGainTuple &tuple) noexcept
|
||||||
{
|
{
|
||||||
if (tuple.IsDefined())
|
if (tuple.IsDefined())
|
||||||
fprintf(stderr, "replay_gain[%s]: gain=%f peak=%f\n",
|
fmt::print(stderr, "replay_gain[{}]: gain={} peak={}\n",
|
||||||
name, (double)tuple.gain, (double)tuple.peak);
|
name, tuple.gain, tuple.peak);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -126,6 +126,6 @@ DumpDecoderClient::SubmitReplayGain(const ReplayGainInfo *rgi) noexcept
|
||||||
void
|
void
|
||||||
DumpDecoderClient::SubmitMixRamp([[maybe_unused]] MixRampInfo &&mix_ramp) noexcept
|
DumpDecoderClient::SubmitMixRamp([[maybe_unused]] MixRampInfo &&mix_ramp) noexcept
|
||||||
{
|
{
|
||||||
fprintf(stderr, "MixRamp: start='%s' end='%s'\n",
|
fmt::print(stderr, "MixRamp: start={:?} end={:?}\n",
|
||||||
mix_ramp.GetStart(), mix_ramp.GetEnd());
|
mix_ramp.GetStart(), mix_ramp.GetEnd());
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "ReadFrames.hxx"
|
#include "ReadFrames.hxx"
|
||||||
#include "cmdline/OptionDef.hxx"
|
#include "cmdline/OptionDef.hxx"
|
||||||
#include "cmdline/OptionParser.hxx"
|
#include "cmdline/OptionParser.hxx"
|
||||||
|
#include "lib/fmt/AudioFormatFormatter.hxx"
|
||||||
#include "lib/fmt/RuntimeError.hxx"
|
#include "lib/fmt/RuntimeError.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "fs/NarrowPath.hxx"
|
#include "fs/NarrowPath.hxx"
|
||||||
|
@ -27,7 +28,6 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
struct CommandLine {
|
struct CommandLine {
|
||||||
FromNarrowPath config_path;
|
FromNarrowPath config_path;
|
||||||
|
@ -107,9 +107,7 @@ try {
|
||||||
auto filter = prepared_filter->Open(audio_format);
|
auto filter = prepared_filter->Open(audio_format);
|
||||||
|
|
||||||
const AudioFormat out_audio_format = filter->GetOutAudioFormat();
|
const AudioFormat out_audio_format = filter->GetOutAudioFormat();
|
||||||
|
fmt::print(stderr, "audio_format={}\n", out_audio_format);
|
||||||
fprintf(stderr, "audio_format=%s\n",
|
|
||||||
ToString(out_audio_format).c_str());
|
|
||||||
|
|
||||||
/* play */
|
/* play */
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "output/Registry.hxx"
|
#include "output/Registry.hxx"
|
||||||
#include "output/OutputPlugin.hxx"
|
#include "output/OutputPlugin.hxx"
|
||||||
#include "ConfigGlue.hxx"
|
#include "ConfigGlue.hxx"
|
||||||
|
#include "lib/fmt/AudioFormatFormatter.hxx"
|
||||||
#include "lib/fmt/RuntimeError.hxx"
|
#include "lib/fmt/RuntimeError.hxx"
|
||||||
#include "event/Thread.hxx"
|
#include "event/Thread.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
|
@ -26,7 +27,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
struct CommandLine {
|
struct CommandLine {
|
||||||
FromNarrowPath config_path;
|
FromNarrowPath config_path;
|
||||||
|
@ -110,8 +110,7 @@ RunOutput(AudioOutput &ao, AudioFormat audio_format,
|
||||||
ao.Open(audio_format);
|
ao.Open(audio_format);
|
||||||
AtScopeExit(&ao) { ao.Close(); };
|
AtScopeExit(&ao) { ao.Close(); };
|
||||||
|
|
||||||
fprintf(stderr, "audio_format=%s\n",
|
fmt::print(stderr, "audio_format={}\n", audio_format);
|
||||||
ToString(audio_format).c_str());
|
|
||||||
|
|
||||||
const size_t in_frame_size = audio_format.GetFrameSize();
|
const size_t in_frame_size = audio_format.GetFrameSize();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue