diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-09-18 11:36:38 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-09-18 11:36:38 +0200 |
commit | 0ecf6b00d43a2f2a372ff0b8b0abd8a75b3c0f0e (patch) | |
tree | 1d82d2f900e435776ecc018c2910208f6e21bb73 /tools.c | |
parent | b1f6b586d4116bb46fffe9473d55da22b12563c9 (diff) | |
download | vdr-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.c | 43 |
1 files changed, 42 insertions, 1 deletions
@@ -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) |