#ifndef XMMS_CHARSET_H
#define XMMS_CHARSET_H

#include "charset_defines.h"


/*
typedef char *(*recode_function)(char *buf, int len, int *rlen);

struct plugin_options_t {
    recode_function fs;
    recode_function tag;
    recode_function after;    
};

typedef struct plugin_options_t PluginOptions;
*/

struct language_alias_t {
    char *alias;
    char *lang;
};

typedef char *charset_t;
typedef charset_t charset_list_t[CHARSET_MAX_ENCODINGS];

typedef struct {
    char *title;
    int (*func)(char *buf, int len);
    charset_list_t encodings;
} autocharset_t;

typedef autocharset_t autocharset_list_t[CHARSET_MAX_AUTOENCODINGS];

typedef struct {
    char *sn;
    char *name;
    charset_list_t enc;
    unsigned int n_autoenc;
    autocharset_list_t autoenc;
} language_t;

extern charset_t *charset_list;
extern int autocharset_list_ni;
extern autocharset_t *autocharset_list;
extern language_t languages[];

/* Data Support functions */
const char *charset_get_output_charset();
const charset_t *get_charset_list(int csl);
const autocharset_t *get_autocharset_list(int csl, int *ni);

/*
void *charset_set_current_options(PluginOptions *cpo);
PluginOptions *charset_get_current_options();
*/

/* Initialization functions */

void xmms_charset_init(char *lng, char *id3, char *output, char *fs, char *pl, int am, int afm, int afs);
void xmms_charset_free();
void xmms_charset_new_language(int scl);
void xmms_charset_new_charsets(int id3, int output, int fs, int pl);
void xmms_autocharset_new_mode(int m, int fs, int fm);

/* Recoding functions */
char *xmms_charset_recode_ct2out(char *buf, int len, int *rlen);
char *xmms_charset_recode_id3(char *buf, int len, int *rlen);
char *xmms_charset_recode_output(char *buf, int len, int *rlen);
char *xmms_charset_recode_fs(char *buf, int len, int *rlen);
char *xmms_charset_recode_fsout(char *buf, int len, int *rlen);
char *xmms_charset_recode_id2utf(char *buf, int len, int *rlen);
char *xmms_charset_recode_fs2utf(char *buf, int len, int *rlen);
char *xmms_charset_recode_fs2pl(char *buf, int len, int *rlen);
char *xmms_charset_recode_pl2fs(char *buf, int len, int *rlen);
char *xmms_charset_recode_fs2fs(char *path, char *buf);

#endif /* XMMS_CHARSET_H */
