Discussion:
[PATCH 1/2] modplug: return codec names
Johannes Weißl
2011-04-06 06:49:46 UTC
Permalink
---
modplug.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/modplug.c b/modplug.c
index a520d01..cadad5e 100644
--- a/modplug.c
+++ b/modplug.c
@@ -158,11 +158,49 @@ static long mod_bitrate(struct input_plugin_data *ip_data)
return -IP_ERROR_FUNCTION_NOT_SUPPORTED;
}

-static char *mod_codec(struct input_plugin_data *ip_data)
+static const char *mod_type_to_string(int type)
{
+ /* from <libmodplug/sndfile.h>, which is C++ */
+ switch (type) {
+ case 0x01: return "mod";
+ case 0x02: return "s3m";
+ case 0x04: return "xm";
+ case 0x08: return "med";
+ case 0x10: return "mtm";
+ case 0x20: return "it";
+ case 0x40: return "699";
+ case 0x80: return "ult";
+ case 0x100: return "stm";
+ case 0x200: return "far";
+ case 0x800: return "amf";
+ case 0x1000: return "ams";
+ case 0x2000: return "dsm";
+ case 0x4000: return "mdl";
+ case 0x8000: return "okt";
+ case 0x10000: return "midi";
+ case 0x20000: return "dmf";
+ case 0x40000: return "ptm";
+ case 0x80000: return "dbm";
+ case 0x100000: return "mt2";
+ case 0x200000: return "amf0";
+ case 0x400000: return "psm";
+ case 0x80000000:return "umx";
+ }
return NULL;
}

+static char *mod_codec(struct input_plugin_data *ip_data)
+{
+ struct mod_private *priv = ip_data->private;
+ const char *codec;
+ int type;
+
+ type = ModPlug_GetModuleType(priv->file);
+ codec = mod_type_to_string(type);
+
+ return codec ? xstrdup(codec) : NULL;
+}
+
const struct input_plugin_ops ip_ops = {
.open = mod_open,
.close = mod_close,
--
1.7.4.1
Johannes Weißl
2011-04-06 06:49:47 UTC
Permalink
cmus doesn't support compressed types, so remove extensions!
---
modplug.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/modplug.c b/modplug.c
index cadad5e..b1df3aa 100644
--- a/modplug.c
+++ b/modplug.c
@@ -216,7 +216,6 @@ const int ip_priority = 50;
const char * const ip_extensions[] = {
"mod", "s3m", "xm", "it", "669", "amf", "ams", "dbm", "dmf", "dsm",
"far", "mdl", "med", "mtm", "okt", "ptm", "stm", "ult", "umx", "mt2",
- "psm", "mdz", "s3z", "xmz", "itz", "mdr", "s3r", "xmr", "itr", "mdgz",
- "s3gz", "xmgz", "itgz", NULL
+ "psm", NULL
};
const char * const ip_mime_types[] = { NULL };
--
1.7.4.1
Gregory Petrosyan
2011-04-06 07:14:18 UTC
Permalink
Post by Johannes Weißl
- "psm", "mdz", "s3z", "xmz", "itz", "mdr", "s3r", "xmr", "itr", "mdgz",
- "s3gz", "xmgz", "itgz", NULL
+ "psm", NULL
Merged to both maint and master, thanks!

Gregory

Gregory Petrosyan
2011-04-06 07:13:33 UTC
Permalink
Post by Johannes Weißl
---
modplug.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)
Merged to master, thanks!

Gregory
Loading...