[vlc-commits] DVB: strip character emphasis control codes
Rafaël Carré
git at videolan.org
Tue Sep 9 12:15:35 CEST 2014
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Sep 9 12:05:07 2014 +0200| [a25aa2c0af44512ded19fdad8fa9a7bda9462693] | committer: Rafaël Carré
DVB: strip character emphasis control codes
Fix display of BSkyB program names as 0x86Foobar0x87
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a25aa2c0af44512ded19fdad8fa9a7bda9462693
---
modules/demux/dvb-text.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/modules/demux/dvb-text.h b/modules/demux/dvb-text.h
index 6f15554..2aae51f 100644
--- a/modules/demux/dvb-text.h
+++ b/modules/demux/dvb-text.h
@@ -94,6 +94,7 @@ static char *vlc_from_EIT (const void *buf, size_t length)
EnsureUTF8 (out);
}
+ length = strlen(out);
/* Convert control codes */
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)
* 0x8B-0x9F are unspecified. */
if (p[1] == '\x8A')
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 */
@@ -114,6 +125,16 @@ static char *vlc_from_EIT (const void *buf, size_t length)
continue;
if (p[2] == '\x8A')
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;
More information about the vlc-commits
mailing list