From 57f9c098e8f5b582c8f289d181117cec1a52e653 Mon Sep 17 00:00:00 2001 From: waker Date: Wed, 31 Aug 2011 21:23:55 +0200 Subject: fixed writing non-ascii id3v1 tags --- deadbeef.h | 2 +- junklib.c | 6 +++--- junklib.h | 2 +- plugins.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deadbeef.h b/deadbeef.h index 10f50422..8b7de00a 100644 --- a/deadbeef.h +++ b/deadbeef.h @@ -633,7 +633,7 @@ typedef struct { // junk reading/writing int (*junk_id3v1_read) (DB_playItem_t *it, DB_FILE *fp); int (*junk_id3v1_find) (DB_FILE *fp); - int (*junk_id3v1_write) (FILE *fp, DB_playItem_t *it); + int (*junk_id3v1_write) (FILE *fp, DB_playItem_t *it, const char *enc); int (*junk_id3v2_find) (DB_FILE *fp, int *psize); int (*junk_id3v2_read) (DB_playItem_t *it, DB_FILE *fp); int (*junk_id3v2_read_full) (DB_playItem_t *it, DB_id3v2_tag_t *tag, DB_FILE *fp); diff --git a/junklib.c b/junklib.c index 2ec2feb8..530fd51f 100644 --- a/junklib.c +++ b/junklib.c @@ -877,7 +877,7 @@ junk_id3v1_read (playItem_t *it, DB_FILE *fp) { } int -junk_id3v1_write (FILE *fp, playItem_t *it) { +junk_id3v1_write (FILE *fp, playItem_t *it, const char *enc) { char title[30] = ""; char artist[30] = ""; char album[30] = ""; @@ -893,7 +893,7 @@ junk_id3v1_write (FILE *fp, playItem_t *it) { meta = pl_find_meta (it, name);\ if (meta) {\ char temp[1000];\ - int l = junk_iconv (meta, strlen (meta), temp, sizeof (temp), UTF8_STR, "ASCII");\ + int l = junk_iconv (meta, strlen (meta), temp, sizeof (temp), UTF8_STR, enc);\ if (l == -1) {\ memset (store, 0, sizeof (store));\ }\ @@ -3731,7 +3731,7 @@ junk_rewrite_tags (playItem_t *it, uint32_t junk_flags, int id3v2_version, const } else if (write_id3v1) { trace ("writing new id3v1 tag\n"); - if (junk_id3v1_write (out, it) != 0) { + if (junk_id3v1_write (out, it, id3v1_encoding) != 0) { trace ("cmp3_write_metadata: failed to write id3v1 tag to %s\n", pl_find_meta (it, ":URI")) goto error; } diff --git a/junklib.h b/junklib.h index 07d99f05..1733620b 100644 --- a/junklib.h +++ b/junklib.h @@ -30,7 +30,7 @@ int junk_id3v1_find (DB_FILE *fp); int -junk_id3v1_write (FILE *fp, struct playItem_s *it); +junk_id3v1_write (FILE *fp, struct playItem_s *it, const char *enc); int junk_id3v2_find (DB_FILE *fp, int *psize); diff --git a/plugins.c b/plugins.c index 38abace1..92b740a1 100644 --- a/plugins.c +++ b/plugins.c @@ -241,7 +241,7 @@ static DB_functions_t deadbeef_api = { // junk reading .junk_id3v1_read = (int (*)(DB_playItem_t *it, DB_FILE *fp))junk_id3v1_read, .junk_id3v1_find = junk_id3v1_find, - .junk_id3v1_write = (int (*) (FILE *, DB_playItem_t *))junk_id3v1_write, + .junk_id3v1_write = (int (*) (FILE *, DB_playItem_t *, const char *))junk_id3v1_write, .junk_id3v2_find = junk_id3v2_find, .junk_id3v2_read = (int (*)(DB_playItem_t *it, DB_FILE *fp))junk_id3v2_read, .junk_id3v2_read_full = (int (*)(DB_playItem_t *, DB_id3v2_tag_t *tag, DB_FILE *fp))junk_id3v2_read_full, -- cgit v1.2.3