mpegtsparse: support more character set encodings

Support UTF-16BE, EUC-KR (KSX1001), GB2312 and ISO-10646/UTF8 text
encoding and fixed new line for multibyte encoding

https://bugzilla.gnome.org/show_bug.cgi?id=664257
This commit is contained in:
Sebastian Pölsterl 2011-11-17 11:33:56 +01:00 committed by Tim-Philipp Müller
parent aa4b5b3bf5
commit 9759d66407

View file

@ -2390,13 +2390,22 @@ get_encoding (const gchar * text, guint * start_text, gboolean * is_multibyte)
*start_text = 1;
*is_multibyte = TRUE;
} else if (firstbyte == 0x12) {
/* That's korean encoding.
* The spec says it's encoded in KSC 5601, but iconv only knows KSC 5636.
* Couldn't find any information about either of them.
*/
encoding = NULL;
/* EUC-KR implements KSX1001 */
encoding = g_strdup ("EUC-KR");
*start_text = 1;
*is_multibyte = TRUE;
} else if (firstbyte == 0x13) {
encoding = g_strdup ("GB2312");
*start_text = 1;
*is_multibyte = FALSE;
} else if (firstbyte == 0x14) {
encoding = g_strdup ("UTF-16BE");
*start_text = 1;
*is_multibyte = TRUE;
} else if (firstbyte == 0x15) {
encoding = g_strdup ("ISO-10646/UTF8");
*start_text = 1;
*is_multibyte = FALSE;
} else {
/* reserved */
encoding = NULL;
@ -2448,7 +2457,7 @@ convert_to_utf8 (const gchar * text, gint length, guint start,
/* skip it */
break;
case 0xE08A:{
guint8 nl[] = { 0x0A, 0x00 }; /* new line */
guint8 nl[] = { 0x00, 0x0A }; /* new line */
g_byte_array_append (sb, nl, 2);
break;
}
@ -2469,7 +2478,7 @@ convert_to_utf8 (const gchar * text, gint length, guint start,
/* skip it */
break;
case 0xE08A:{
guint8 nl[] = { 0x0A, 0x00 }; /* new line */
guint8 nl[] = { 0x00, 0x0A }; /* new line */
g_byte_array_append (sb, nl, 2);
break;
}