2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2009-11-07 16:28:21 +01:00
|
|
|
|
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"
|
2015-08-06 22:10:25 +02:00
|
|
|
#include "client/Response.hxx"
|
2009-11-07 16:28:21 +01:00
|
|
|
|
2021-05-21 20:35:29 +02:00
|
|
|
#include <fmt/format.h>
|
|
|
|
|
2020-03-12 23:20:59 +01:00
|
|
|
#include <cassert>
|
2013-10-21 22:02:19 +02:00
|
|
|
#include <functional>
|
|
|
|
|
2009-11-07 16:28:21 +01:00
|
|
|
static void
|
2015-08-06 22:10:25 +02:00
|
|
|
decoder_plugin_print(Response &r,
|
2013-10-21 22:02:19 +02:00
|
|
|
const DecoderPlugin &plugin)
|
2009-11-07 16:28:21 +01:00
|
|
|
{
|
|
|
|
const char *const*p;
|
|
|
|
|
2013-10-21 22:02:19 +02:00
|
|
|
assert(plugin.name != nullptr);
|
2009-11-07 16:28:21 +01:00
|
|
|
|
2021-05-21 20:35:29 +02:00
|
|
|
r.Fmt(FMT_STRING("plugin: {}\n"), plugin.name);
|
2009-11-07 16:28:21 +01:00
|
|
|
|
2013-10-21 22:02:19 +02:00
|
|
|
if (plugin.suffixes != nullptr)
|
|
|
|
for (p = plugin.suffixes; *p != nullptr; ++p)
|
2021-05-21 20:35:29 +02:00
|
|
|
r.Fmt(FMT_STRING("suffix: {}\n"), *p);
|
2009-11-07 16:28:21 +01:00
|
|
|
|
2013-10-21 22:02:19 +02:00
|
|
|
if (plugin.mime_types != nullptr)
|
|
|
|
for (p = plugin.mime_types; *p != nullptr; ++p)
|
2021-05-21 20:35:29 +02:00
|
|
|
r.Fmt(FMT_STRING("mime_type: {}\n"), *p);
|
2009-11-07 16:28:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-08-06 22:10:25 +02:00
|
|
|
decoder_list_print(Response &r)
|
2009-11-07 16:28:21 +01:00
|
|
|
{
|
2020-05-04 23:27:04 +02:00
|
|
|
const auto f = [&](const auto &plugin)
|
|
|
|
{ return decoder_plugin_print(r, plugin); };
|
2013-10-21 22:02:19 +02:00
|
|
|
decoder_plugins_for_each_enabled(f);
|
2009-11-07 16:28:21 +01:00
|
|
|
}
|