Created
January 29, 2017 08:47
-
-
Save sumikawa/48ce7fb32ee6c2e91a7a30112287d3e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: src/conf.c | |
=================================================================== | |
RCS file: /usr/home/sumikawa/.cvsroot/mpd/src/conf.c,v | |
retrieving revision 1.1.1.3 | |
retrieving revision 1.2 | |
diff -u -r1.1.1.3 -r1.2 | |
--- src/conf.c 20 Oct 2004 19:14:59 -0000 1.1.1.3 | |
+++ src/conf.c 20 Oct 2004 20:35:32 -0000 1.2 | |
@@ -37,7 +37,7 @@ | |
#define CONF_COMMENT '#' | |
-#define CONF_NUMBER_OF_PARAMS 34 | |
+#define CONF_NUMBER_OF_PARAMS 35 | |
#define CONF_NUMBER_OF_PATHS 6 | |
#define CONF_NUMBER_OF_REQUIRED 5 | |
#define CONF_NUMBER_OF_ALLOW_CATS 1 | |
@@ -130,7 +130,8 @@ | |
"http_proxy_port", | |
"http_proxy_user", | |
"http_proxy_password", | |
- "replaygain_preamp" | |
+ "replaygain_preamp", | |
+ "tag_charset" | |
}; | |
int conf_absolutePaths[CONF_NUMBER_OF_PATHS] = { | |
Index: src/conf.h | |
=================================================================== | |
RCS file: /usr/home/sumikawa/.cvsroot/mpd/src/conf.h,v | |
retrieving revision 1.1.1.3 | |
retrieving revision 1.2 | |
diff -u -r1.1.1.3 -r1.2 | |
--- src/conf.h 20 Oct 2004 19:14:59 -0000 1.1.1.3 | |
+++ src/conf.h 20 Oct 2004 20:35:32 -0000 1.2 | |
@@ -56,6 +56,8 @@ | |
#define CONF_HTTP_PROXY_PASSWORD 32 | |
#define CONF_REPLAYGAIN_PREAMP 33 | |
+#define CONF_TAG_CHARSET 34 | |
+ | |
#define CONF_CAT_CHAR "\n" | |
/* do not free the return value, it is a static variable */ | |
Index: src/directory.c | |
=================================================================== | |
RCS file: /usr/home/sumikawa/.cvsroot/mpd/src/directory.c,v | |
retrieving revision 1.1.1.3 | |
retrieving revision 1.2 | |
diff -u -r1.1.1.3 -r1.2 | |
--- src/directory.c 20 Oct 2004 19:14:59 -0000 1.1.1.3 | |
+++ src/directory.c 20 Oct 2004 20:35:32 -0000 1.2 | |
@@ -32,6 +32,7 @@ | |
#include "mpd_types.h" | |
#include "sig_handlers.h" | |
#include "player.h" | |
+#include "tag.h" | |
#include <string.h> | |
#include <sys/types.h> | |
@@ -1343,6 +1344,12 @@ | |
void initMp3Directory() { | |
struct stat st; | |
+ if(getConf()[CONF_TAG_CHARSET]) { | |
+ tag_charset = strdup(getConf()[CONF_TAG_CHARSET]); | |
+ } else { | |
+ tag_charset = "UTF-8"; | |
+ } | |
+ | |
mp3rootDirectory = newDirectory(NULL, NULL); | |
exploreDirectory(mp3rootDirectory); | |
freeAllDirectoryStats(mp3rootDirectory); | |
Index: src/tag.c | |
=================================================================== | |
RCS file: /usr/home/sumikawa/.cvsroot/mpd/src/tag.c,v | |
retrieving revision 1.1.1.3 | |
retrieving revision 1.4 | |
diff -u -r1.1.1.3 -r1.4 | |
--- src/tag.c 20 Oct 2004 19:14:59 -0000 1.1.1.3 | |
+++ src/tag.c 20 Oct 2004 20:56:58 -0000 1.4 | |
@@ -66,13 +66,17 @@ | |
fixUtf8(tag->name); | |
} | |
+char * tag_charset = NULL; | |
+ | |
#ifdef HAVE_ID3TAG | |
char * getID3Info(struct id3_tag * tag, char * id) { | |
struct id3_frame const * frame; | |
id3_ucs4_t const * ucs4; | |
id3_utf8_t * utf8; | |
+ id3_latin1_t * latin1; | |
union id3_field const * field; | |
unsigned int nstrings; | |
+ char * str; | |
frame = id3_tag_findframe(tag, id, 0); | |
if(!frame) return NULL; | |
@@ -84,10 +88,25 @@ | |
ucs4 = id3_field_getstrings(field,0); | |
assert(ucs4); | |
- utf8 = id3_ucs4_utf8duplicate(ucs4); | |
- if(!utf8) return NULL; | |
+ if (tag_charset == NULL) { | |
+ utf8 = id3_ucs4_utf8duplicate(ucs4); | |
+ if(!utf8) return NULL; | |
+ | |
+ return utf8; | |
+ } else { | |
+ latin1 = id3_ucs4_latin1duplicate(ucs4); | |
+ if(!latin1) return NULL; | |
+ | |
+ if (setCharSetConversion("UTF-8", tag_charset) == -1) { | |
+ ERROR("Charset:%s is not supported on this system\n", | |
+ tag_charset); | |
+ exit(EXIT_FAILURE); | |
+ }; | |
+ str = convStrDup((char *)latin1); | |
+ closeCharSetConversion(); | |
- return utf8; | |
+ return str; | |
+ } | |
} | |
#endif | |
Index: src/tag.h | |
=================================================================== | |
RCS file: /usr/home/sumikawa/.cvsroot/mpd/src/tag.h,v | |
retrieving revision 1.1.1.3 | |
retrieving revision 1.2 | |
diff -u -r1.1.1.3 -r1.2 | |
--- src/tag.h 20 Oct 2004 19:14:59 -0000 1.1.1.3 | |
+++ src/tag.h 20 Oct 2004 20:35:32 -0000 1.2 | |
@@ -39,6 +39,8 @@ | |
int time; | |
} MpdTag; | |
+extern char * tag_charset; | |
+ | |
#ifdef HAVE_ID3TAG | |
MpdTag * parseId3Tag(struct id3_tag *); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment