Commit a25aa2c0 authored by Rafaël Carré's avatar Rafaël Carré

DVB: strip character emphasis control codes

Fix display of BSkyB program names as 0x86Foobar0x87
parent 9ef8db17
...@@ -94,6 +94,7 @@ static char *vlc_from_EIT (const void *buf, size_t length) ...@@ -94,6 +94,7 @@ static char *vlc_from_EIT (const void *buf, size_t length)
EnsureUTF8 (out); EnsureUTF8 (out);
} }
length = strlen(out);
/* Convert control codes */ /* Convert control codes */
for (char *p = strchr (out, '\xC2'); p; p = strchr (p + 1, '\xC2')) for (char *p = strchr (out, '\xC2'); p; p = strchr (p + 1, '\xC2'))
{ {
...@@ -104,6 +105,16 @@ static char *vlc_from_EIT (const void *buf, size_t length) ...@@ -104,6 +105,16 @@ static char *vlc_from_EIT (const void *buf, size_t length)
* 0x8B-0x9F are unspecified. */ * 0x8B-0x9F are unspecified. */
if (p[1] == '\x8A') if (p[1] == '\x8A')
memcpy (p, "\r\n", 2); memcpy (p, "\r\n", 2);
/* Strip character emphasis */
if (p[1] == '\x86' || p[1] == '\x87') {
const size_t n = p - out;
memmove (p, p+2, length - n);
length -= 2;
out[length] = '\0';
if (length == n)
break;
}
} }
/* Private use area */ /* Private use area */
...@@ -114,6 +125,16 @@ static char *vlc_from_EIT (const void *buf, size_t length) ...@@ -114,6 +125,16 @@ static char *vlc_from_EIT (const void *buf, size_t length)
continue; continue;
if (p[2] == '\x8A') if (p[2] == '\x8A')
memcpy (p, "\r\r\n", 3); /* we need three bytes, so to CRs ;) */ memcpy (p, "\r\r\n", 3); /* we need three bytes, so to CRs ;) */
/* Strip character emphasis */
if (p[2] == '\x86' || p[2] == '\x87') {
const size_t n = p - out;
memmove (p, p+3, length - n);
length -= 3;
out[length] = '\0';
if (length == n)
break;
}
} }
return out; return out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment