summaryrefslogtreecommitdiff
path: root/ringbuffer.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2003-01-26 09:59:35 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2003-01-26 09:59:35 +0100
commit28d1affa3165b96cb6c7915f11b982786da6de5d (patch)
tree81234a1b0d184f9f5201b5d7f36f0265592ab6ac /ringbuffer.h
parent54eb58e1eb93db102400902a5330567be7b4f5e0 (diff)
downloadvdr-28d1affa3165b96cb6c7915f11b982786da6de5d.tar.gz
vdr-28d1affa3165b96cb6c7915f11b982786da6de5d.tar.bz2
Modified cRingBufferLinear to avoid excessive memmove() calls in 'Transfer Mode' and during recordings
Diffstat (limited to 'ringbuffer.h')
-rw-r--r--ringbuffer.h28
1 files changed, 19 insertions, 9 deletions
diff --git a/ringbuffer.h b/ringbuffer.h
index f96143c9..9205df7f 100644
--- a/ringbuffer.h
+++ b/ringbuffer.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: ringbuffer.h 1.8 2003/01/19 15:03:00 kls Exp $
+ * $Id: ringbuffer.h 1.9 2003/01/26 09:47:39 kls Exp $
*/
#ifndef __RINGBUFFER_H
@@ -40,21 +40,31 @@ public:
class cRingBufferLinear : public cRingBuffer {
private:
- int head, tail;
+ int margin, head, tail;
+ int lastGet;
uchar *buffer;
pid_t getThreadPid;
public:
- cRingBufferLinear(int Size, bool Statistics = false);
+ cRingBufferLinear(int Size, int Margin = 0, bool Statistics = false);
+ ///< Creates a linear ring buffer.
+ ///< The buffer will be able to hold at most Size bytes of data, and will
+ ///< be guaranteed to return at least Margin bytes in one consecutive block.
virtual ~cRingBufferLinear();
virtual int Available(void);
virtual void Clear(void);
- // Immediately clears the ring buffer.
+ ///< Immediately clears the ring buffer.
int Put(const uchar *Data, int Count);
- // Puts at most Count bytes of Data into the ring buffer.
- // Returns the number of bytes actually stored.
- int Get(uchar *Data, int Count);
- // Gets at most Count bytes of Data from the ring buffer.
- // Returns the number of bytes actually retrieved.
+ ///< Puts at most Count bytes of Data into the ring buffer.
+ ///< \return Returns the number of bytes actually stored.
+ const uchar *Get(int &Count);
+ ///< Gets data from the ring buffer.
+ ///< The data will remain in the buffer until a call to Del() deletes it.
+ ///< \return Returns a pointer to the data, and stores the number of bytes
+ ///< actually retrieved in Count. If the returned pointer is NULL, Count has no meaning.
+ void Del(int Count);
+ ///< Deletes at most Count bytes from the ring buffer.
+ ///< Count must be less or equal to the number that was returned by a previous
+ ///< call to Get().
};
enum eFrameType { ftUnknown, ftVideo, ftAudio, ftDolby };