2009-11-07 16:28:21 +01:00
|
|
|
/*
|
2021-01-01 19:54:25 +01:00
|
|
|
* Copyright 2003-2021 The Music Player Daemon Project
|
2009-11-07 16:28:21 +01:00
|
|
|
* http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
}
|