mpd/src/decoder/DecoderPrint.cxx

40 lines
888 B
C++
Raw Normal View History

// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
2013-01-03 11:14:36 +01:00
#include "DecoderPrint.hxx"
2013-01-30 17:18:48 +01:00
#include "DecoderList.hxx"
2013-07-28 13:18:48 +02:00
#include "DecoderPlugin.hxx"
#include "client/Response.hxx"
#include <fmt/format.h>
#include <cassert>
#include <functional>
static void
decoder_plugin_print(Response &r,
const DecoderPlugin &plugin)
{
const char *const*p;
assert(plugin.name != nullptr);
r.Fmt(FMT_STRING("plugin: {}\n"), plugin.name);
if (plugin.suffixes != nullptr)
for (p = plugin.suffixes; *p != nullptr; ++p)
r.Fmt(FMT_STRING("suffix: {}\n"), *p);
if (plugin.mime_types != nullptr)
for (p = plugin.mime_types; *p != nullptr; ++p)
r.Fmt(FMT_STRING("mime_type: {}\n"), *p);
}
void
decoder_list_print(Response &r)
{
const auto f = [&](const auto &plugin)
{ return decoder_plugin_print(r, plugin); };
decoder_plugins_for_each_enabled(f);
}