diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2003-01-19 15:43:58 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2003-01-19 15:43:58 +0100 |
commit | cdcf28b051c71a84632384346bb7a2a481a95373 (patch) | |
tree | 81fff0617b64c3aeb98f99c71d875075536669ae /ringbuffer.c | |
parent | 413b22dc636dbd78f7acd0dd816cde933fe6a78d (diff) | |
download | vdr-cdcf28b051c71a84632384346bb7a2a481a95373.tar.gz vdr-cdcf28b051c71a84632384346bb7a2a481a95373.tar.bz2 |
Implemented non blocking file reader for cDvbPlayer
Diffstat (limited to 'ringbuffer.c')
-rw-r--r-- | ringbuffer.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ringbuffer.c b/ringbuffer.c index b57b23e2..ed92be59 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -7,7 +7,7 @@ * Parts of this file were inspired by the 'ringbuffy.c' from the * LinuxDVB driver (see linuxtv.org). * - * $Id: ringbuffer.c 1.10 2002/07/28 12:47:32 kls Exp $ + * $Id: ringbuffer.c 1.11 2003/01/19 15:03:00 kls Exp $ */ #include "ringbuffer.h" @@ -174,14 +174,18 @@ int cRingBufferLinear::Get(uchar *Data, int Count) cFrame::cFrame(const uchar *Data, int Count, eFrameType Type, int Index) { - count = Count; + count = abs(Count); type = Type; index = Index; - data = new uchar[count]; - if (data) - memcpy(data, Data, count); - else - esyslog("ERROR: can't allocate frame buffer (count=%d)", count); + if (Count < 0) + data = (uchar *)Data; + else { + data = new uchar[count]; + if (data) + memcpy(data, Data, count); + else + esyslog("ERROR: can't allocate frame buffer (count=%d)", count); + } next = NULL; } |