summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-05-05 14:59:46 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-05-05 14:59:46 +0200
commit1c62f19c8ca1f6b5f3551f1416b5ee34b548e4ed (patch)
tree221ee59d171736f300a73fa7ef279ad3bad7eea6 /device.c
parentcfab3380c7cdedbd4dccd9ade156e0f58ec0ce30 (diff)
downloadvdr-1c62f19c8ca1f6b5f3551f1416b5ee34b548e4ed.tar.gz
vdr-1c62f19c8ca1f6b5f3551f1416b5ee34b548e4ed.tar.bz2
Fixed handling fragments of less than 3 byte in cPesAssembler
Diffstat (limited to 'device.c')
-rw-r--r--device.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/device.c b/device.c
index d6ab8911..83ce56d7 100644
--- a/device.c
+++ b/device.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.c 1.99 2005/02/27 13:55:15 kls Exp $
+ * $Id: device.c 1.100 2005/05/05 14:48:01 kls Exp $
*/
#include "device.h"
@@ -34,7 +34,7 @@ public:
int ExpectedLength(void) { return PacketSize(data); }
static int PacketSize(const uchar *data);
int Length(void) { return length; }
- const uchar *Data(void) { return data; }
+ const uchar *Data(void) { return data; } // only valid if Length() >= 4
void Reset(void);
void Put(uchar c);
void Put(const uchar *Data, int Length);
@@ -76,7 +76,7 @@ bool cPesAssembler::Realloc(int Size)
void cPesAssembler::Put(uchar c)
{
- if (!length) {
+ if (length < 4) {
tag = (tag << 8) | c;
if ((tag & 0xFFFFFF00) == 0x00000100) {
if (Realloc(4)) {
@@ -84,6 +84,8 @@ void cPesAssembler::Put(uchar c)
length = 4;
}
}
+ else if (length < 3)
+ length++;
}
else if (Realloc(length + 1))
data[length++] = c;
@@ -91,7 +93,7 @@ void cPesAssembler::Put(uchar c)
void cPesAssembler::Put(const uchar *Data, int Length)
{
- while (!length && Length > 0) {
+ while (length < 4 && Length > 0) {
Put(*Data++);
Length--;
}