From cdcf28b051c71a84632384346bb7a2a481a95373 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 19 Jan 2003 15:43:58 +0100 Subject: Implemented non blocking file reader for cDvbPlayer --- ringbuffer.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'ringbuffer.c') 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; } -- cgit v1.2.3