aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-07 15:57:22 +0100
committerMax Kellermann <max@duempel.org>2009-11-07 15:57:22 +0100
commit2f1bd39be8d0373c34c38fbe4e1249732c3f745b (patch)
treeaca0711369fec52d21029a66eb63beaf09f6f294
parent4624dfcb3077f9f45d49c4ce7a4ee1c98f7f8921 (diff)
downloadmpd-2f1bd39be8d0373c34c38fbe4e1249732c3f745b.tar.gz
mpd-2f1bd39be8d0373c34c38fbe4e1249732c3f745b.tar.xz
mpd-2f1bd39be8d0373c34c38fbe4e1249732c3f745b.zip
command: added command "decoders"
This command prints a list of decoder plugins and their suffixes / MIME types.
-rw-r--r--Makefile.am2
-rw-r--r--doc/protocol.xml19
-rw-r--r--src/command.c10
3 files changed, 31 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 112b143ca..3ba6613f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -81,6 +81,7 @@ mpd_headers = \
src/dirvec.h \
src/gcc.h \
src/decoder_list.h \
+ src/decoder_print.h \
src/decoder/_flac_common.h \
src/decoder/_ogg_common.h \
src/input_plugin.h \
@@ -212,6 +213,7 @@ src_mpd_SOURCES = \
src/decoder_control.c \
src/decoder_api.c \
src/decoder_internal.c \
+ src/decoder_print.c \
src/directory.c \
src/directory_save.c \
src/directory_print.c \
diff --git a/doc/protocol.xml b/doc/protocol.xml
index b6271403a..1f053acaa 100644
--- a/doc/protocol.xml
+++ b/doc/protocol.xml
@@ -1589,6 +1589,25 @@ OK
</para>
</listitem>
</varlistentry>
+ <varlistentry id="command_decoders">
+ <term>
+ <cmdsynopsis>
+ <command>decoders</command>
+ </cmdsynopsis>
+ </term>
+ <listitem>
+ <para>
+ Print a list of decoder plugins, followed by their
+ supported suffixes and MIME types. Example response:
+ </para>
+ <programlisting>plugin: mad
+suffix: mp3
+suffix: mp2
+mime_type: audio/mpeg
+plugin: mpcdec
+suffix: mpc</programlisting>
+ </listitem>
+ </varlistentry>
</variablelist>
</section>
</chapter>
diff --git a/src/command.c b/src/command.c
index ba087dc45..2bd84d3a3 100644
--- a/src/command.c
+++ b/src/command.c
@@ -26,6 +26,7 @@
#include "queue_print.h"
#include "ls.h"
#include "uri.h"
+#include "decoder_print.h"
#include "directory.h"
#include "directory_print.h"
#include "database.h"
@@ -389,6 +390,14 @@ handle_urlhandlers(struct client *client,
}
static enum command_return
+handle_decoders(struct client *client,
+ G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
+{
+ decoder_list_print(client);
+ return COMMAND_RETURN_OK;
+}
+
+static enum command_return
handle_tagtypes(struct client *client,
G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[])
{
@@ -1755,6 +1764,7 @@ static const struct command commands[] = {
{ "count", PERMISSION_READ, 2, -1, handle_count },
{ "crossfade", PERMISSION_CONTROL, 1, 1, handle_crossfade },
{ "currentsong", PERMISSION_READ, 0, 0, handle_currentsong },
+ { "decoders", PERMISSION_READ, 0, 0, handle_decoders },
{ "delete", PERMISSION_CONTROL, 1, 1, handle_delete },
{ "deleteid", PERMISSION_CONTROL, 1, 1, handle_deleteid },
{ "disableoutput", PERMISSION_ADMIN, 1, 1, handle_disableoutput },