Mercurial > audlegacy
changeset 3009:9976e065e2f5 trunk
Mimetype system.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Mon, 09 Jul 2007 03:18:00 -0500 |
parents | 7cea5ada1956 |
children | 2897d744d87a |
files | src/audacious/Makefile src/audacious/mime.c src/audacious/mime.h src/audacious/plugin.h |
diffstat | 4 files changed, 78 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/Makefile Mon Jul 09 01:02:03 2007 -0500 +++ b/src/audacious/Makefile Mon Jul 09 03:18:00 2007 -0500 @@ -44,6 +44,7 @@ input.h \ hook.h \ main.h \ + mime.h \ output.h \ playlist.h \ playlist_container.h \ @@ -79,6 +80,7 @@ logger.c \ main.c \ memorypool.c \ + mime.c \ output.c \ pixbuf_effects.c \ playback.c \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/mime.c Mon Jul 09 03:18:00 2007 -0500 @@ -0,0 +1,40 @@ +/* + * Audacious + * Copyright (c) 2007 William Pitcock + * + * 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; under version 2 of the License. + * + * 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. + */ + +#include "mime.h" + +mowgli_dictionary_t *mime_type_dict = NULL; + +void mime_set_plugin(const gchar *mimetype, InputPlugin *ip) +{ + g_return_if_fail(mimetype != NULL); + g_return_if_fail(ip != NULL); + + if (mime_type_dict == NULL) + mime_type_dict = mowgli_dictionary_create(strcasecmp); + + mowgli_dictionary_add(mime_type_dict, mimetype, ip); +} + +InputPlugin *mime_get_plugin(const gchar *mimetype) +{ + if (mime_type_dict == NULL) + return NULL; + + return mowgli_dictionary_retrieve(mime_type_dict, mimetype); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audacious/mime.h Mon Jul 09 03:18:00 2007 -0500 @@ -0,0 +1,34 @@ +/* + * Audacious + * Copyright (c) 2007 William Pitcock + * + * 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; under version 2 of the License. + * + * 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. + */ + +#include <glib.h> +#include <mowgli.h> + +#include <audacious/plugin.h> + +#ifndef __AUDACIOUS_MIME_H__ +#define __AUDACIOUS_MIME_H__ + +G_BEGIN_DECLS + +InputPlugin *mime_get_plugin(const gchar *mimetype); +void mime_set_plugin(const gchar *mimetype, InputPlugin *ip); + +G_END_DECLS + +#endif