[tracker] tracker-extract-mp3: Use guessed ID3v1 8-bit encoding also for ID3v2



commit b1533a5534f9afd2ee8bd45d1b75de8094f1819b
Author: JÃrg Billeter <j bitron ch>
Date:   Fri Jun 10 16:25:54 2011 +0200

    tracker-extract-mp3: Use guessed ID3v1 8-bit encoding also for ID3v2
    
    Fixes NB#259942.

 src/tracker-extract/tracker-extract-mp3.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 1cf61f7..3a01e0a 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -1019,7 +1019,8 @@ id3v2_strlen (const gchar  encoding,
 static gchar *
 id3v24_text_to_utf8 (const gchar  encoding,
                      const gchar *text,
-                     gssize       len)
+                     gssize       len,
+                     id3tag      *info)
 {
 	/* This byte describes the encoding
 	 * try to convert strings to UTF-8
@@ -1035,7 +1036,7 @@ id3v24_text_to_utf8 (const gchar  encoding,
 		return convert_to_encoding (text,
 		                            len,
 		                            "UTF-8",
-		                            "Windows-1252",
+		                            info->encoding ? info->encoding : "Windows-1252",
 		                            NULL, NULL, NULL);
 	case 0x01 :
 		return convert_to_encoding (text,
@@ -1060,7 +1061,7 @@ id3v24_text_to_utf8 (const gchar  encoding,
 		return convert_to_encoding (text,
 		                            len,
 		                            "UTF-8",
-		                            "Windows-1252",
+		                            info->encoding ? info->encoding : "Windows-1252",
 		                            NULL, NULL, NULL);
 	}
 }
@@ -1068,7 +1069,8 @@ id3v24_text_to_utf8 (const gchar  encoding,
 static gchar *
 id3v2_text_to_utf8 (const gchar  encoding,
                     const gchar *text,
-                    gssize       len)
+                    gssize       len,
+                    id3tag      *info)
 {
 	/* This byte describes the encoding
 	 * try to convert strings to UTF-8
@@ -1084,7 +1086,7 @@ id3v2_text_to_utf8 (const gchar  encoding,
 		return convert_to_encoding (text,
 		                            len,
 		                            "UTF-8",
-		                            "Windows-1252",
+		                            info->encoding ? info->encoding : "Windows-1252",
 		                            NULL, NULL, NULL);
 	case 0x01 :
 		/* return g_convert (text, */
@@ -1102,7 +1104,7 @@ id3v2_text_to_utf8 (const gchar  encoding,
 		return convert_to_encoding (text,
 		                            len,
 		                            "UTF-8",
-		                            "Windows-1252",
+		                            info->encoding ? info->encoding : "Windows-1252",
 		                            NULL, NULL, NULL);
 	}
 }
@@ -1220,7 +1222,7 @@ get_id3v24_tags (id3v24frame           frame,
 		offset        = 4 + text_desc_len + id3v2_nul_size (text_encode);
 		text          = &data[pos + offset]; /* <full text string according to encoding> */
 
-		word = id3v24_text_to_utf8 (text_encode, text, csize - offset);
+		word = id3v24_text_to_utf8 (text_encode, text, csize - offset, info);
 
 		if (!tracker_is_empty_string (word)) {
 			g_strstrip (word);
@@ -1236,7 +1238,7 @@ get_id3v24_tags (id3v24frame           frame,
 		gchar *word;
 
 		/* text frames */
-		word = id3v24_text_to_utf8 (data[pos], &data[pos + 1], csize - 1);
+		word = id3v24_text_to_utf8 (data[pos], &data[pos + 1], csize - 1, info);
 		if (!tracker_is_empty_string (word)) {
 			g_strstrip (word);
 		}
@@ -1406,7 +1408,7 @@ get_id3v23_tags (id3v24frame           frame,
 		offset        = 4 + text_desc_len + id3v2_nul_size (text_encode);
 		text          = &data[pos + offset]; /* <full text string according to encoding> */
 
-		word = id3v2_text_to_utf8 (text_encode, text, csize - offset);
+		word = id3v2_text_to_utf8 (text_encode, text, csize - offset, info);
 
 		if (!tracker_is_empty_string (word)) {
 			g_strstrip (word);
@@ -1423,7 +1425,7 @@ get_id3v23_tags (id3v24frame           frame,
 		gchar *word;
 
 		/* text frames */
-		word = id3v2_text_to_utf8 (data[pos], &data[pos + 1], csize - 1);
+		word = id3v2_text_to_utf8 (data[pos], &data[pos + 1], csize - 1, info);
 
 		if (!tracker_is_empty_string (word)) {
 			g_strstrip (word);
@@ -1569,7 +1571,7 @@ get_id3v20_tags (id3v2frame            frame,
 		/* text frames */
 		gchar *word;
 
-		word = id3v2_text_to_utf8 (data[pos], &data[pos + 1], csize - 1);
+		word = id3v2_text_to_utf8 (data[pos], &data[pos + 1], csize - 1, info);
 		if (!tracker_is_empty_string (word)) {
 			g_strstrip (word);
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]