libcdio-devel
[Top][All Lists]
Advanced

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

Re: [Libcdio-devel] How tolerant to be towards CD-TEXT character set mis


From: Serge Pouliquen
Subject: Re: [Libcdio-devel] How tolerant to be towards CD-TEXT character set mislabeling ?
Date: Mon, 29 Apr 2019 15:05:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

Hi,

As proposed I tried :
diff --git a/lib/driver/cdtext.c b/lib/driver/cdtext.c
index 868cef5..01f3149 100644
--- a/lib/driver/cdtext.c
+++ b/lib/driver/cdtext.c
@@ -713,16 +713,28 @@ cdtext_data_init(cdtext_t *p_cdtext, uint8_t *wdata, size_t i_data)
         /* determine encoding */
         switch (blocksize.charcode){
           case CDTEXT_CHARCODE_ISO_8859_1:
-            /* default */
             charset = (char *) "ISO-8859-1";
             break;
           case CDTEXT_CHARCODE_ASCII:
-            charset = (char *) "ASCII";
+            charset = (char *) "ISO-8859-1";
             break;
           case CDTEXT_CHARCODE_SHIFT_JIS:
             charset = (char *) "SHIFT_JIS";
             break;
+          default:
+            /* Do not let charset pass here as NULL */
+            cdio_warn("CD-TEXT: Unknown character set code %u.\n",
+                      (unsigned int) blocksize.charcode);
+           charset = (char *) "ISO-8859-1";
         }
+       cdio_debug("CD-TEXT character set: code=%u , name=%s , chosen=%s\n",
+                  (unsigned int) blocksize.charcode,
+                  blocksize.charcode == 0 ? "ISO-8859-1" :
+                  blocksize.charcode == 1 ? "ASCII" :
+                  blocksize.charcode == 0x80 ? "SHIFT_JIS" :
+                  "",
+                  charset);
+

I got these lines :
--DEBUG: CD-TEXT character set: code=1 , name=ASCII , chosen=ISO-8859-1
--DEBUG: CD-TEXT character set: code=0 , name=ISO-8859-1 , chosen=ISO-8859-1

> A solid solution would be to give cd-info.c access to this property.

It was only a suggestion, I don't know if it's worth

> I wonder how popular music players display the text.

Those I know, often use cddb to override cd-text (which is too often absent)

Let me know if you commit something to master branch.

Regards,
Serge



reply via email to

[Prev in Thread] Current Thread [Next in Thread]