summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2011-09-18 11:36:38 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2011-09-18 11:36:38 +0200
commit0ecf6b00d43a2f2a372ff0b8b0abd8a75b3c0f0e (patch)
tree1d82d2f900e435776ecc018c2910208f6e21bb73 /tools.c
parentb1f6b586d4116bb46fffe9473d55da22b12563c9 (diff)
downloadvdr-0ecf6b00d43a2f2a372ff0b8b0abd8a75b3c0f0e.tar.gz
vdr-0ecf6b00d43a2f2a372ff0b8b0abd8a75b3c0f0e.tar.bz2
Fixed handling DVB subtitles and implemented decoding textual DVB subtitles
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/tools.c b/tools.c
index c9a3a44e..35693821 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 2.17 2011/08/15 13:35:23 kls Exp $
+ * $Id: tools.c 2.18 2011/09/18 11:22:21 kls Exp $
*/
#include "tools.h"
@@ -1196,6 +1196,47 @@ const char *cBase64Encoder::NextLine(void)
return NULL;
}
+// --- cBitStream ------------------------------------------------------------
+
+int cBitStream::GetBit(void)
+{
+ if (index >= length)
+ return 1;
+ int r = (data[index >> 3] >> (7 - (index & 7))) & 1;
+ ++index;
+ return r;
+}
+
+uint32_t cBitStream::GetBits(int n)
+{
+ uint32_t r = 0;
+ while (n--)
+ r |= GetBit() << n;
+ return r;
+}
+
+void cBitStream::ByteAlign(void)
+{
+ int n = index % 8;
+ if (n > 0)
+ SkipBits(8 - n);
+}
+
+void cBitStream::WordAlign(void)
+{
+ int n = index % 16;
+ if (n > 0)
+ SkipBits(16 - n);
+}
+
+bool cBitStream::SetLength(int Length)
+{
+ if (Length > length)
+ return false;
+ length = Length;
+ return true;
+}
+
// --- cReadLine -------------------------------------------------------------
cReadLine::cReadLine(void)