diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2003-05-18 18:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2003-05-18 18:00:00 +0200 |
commit | 3bd9a7ccf355e445685ff115464a4e684a8c4211 (patch) | |
tree | 8b0a44d0c40e939967c73ec6ebe18776b51c9dcb /ringbuffer.c | |
parent | c84022554aaacc9b1c3d9627501cdbb8276871f6 (diff) | |
download | vdr-patch-lnbsharing-3bd9a7ccf355e445685ff115464a4e684a8c4211.tar.gz vdr-patch-lnbsharing-3bd9a7ccf355e445685ff115464a4e684a8c4211.tar.bz2 |
Version 1.1.32vdr-1.1.32
- Removed a faulty parameter initialization in menu.c (thanks to Lauri Tischler for
reporting this one).
- Re-implemented the WaitForPut/WaitForGet stuff in cRingBuffer, since some plugins
actually need this. By default the buffer does not wait; if a plugin needs the
waiting functionality it can call the new SetTimeouts() function.
- Moved the call to cPlugin::Start() further up in vdr.c, to make sure it gets
called before trying to learn the keys (problem reported by Oliver Endriss).
- No longer starting the editing process if no marks have been set (thanks to
Matthias Raus for reporting this one).
- Added Catalanian language texts (thanks to Marc Rovira Vall and Ramon Roca).
Plugin authors may want to add the new entries to their I18N texts and contact
the translators to have their texts translated. Note that there are now 16
different OSD languages, so please make sure you have 16 versions for each of
your texts.
- Moved the detection of a broken video data stream from the cDevice into the
cRecorder to avoid problems with cReceivers that want to receive from PIDs
that are currently not transmitting (thanks to Marcel Wiesweg for reporting
this one).
- Fixed setting the locking pid after a timed wait (thanks to Andreas Schultz).
- Avoiding spurious section filter settings after a channel switch.
- Updated 'channels.conf.cable' (thanks to Stefan Hußfeldt).
- Fixed reading 'epg.data' for channels with non-zero RID (thanks to Oliver
Endriss for reporting this one).
- Fixed EPG bugfix statistics to avoid log entires for undefined channels (thanks
to Lars Bläser for reporting this one).
- No longer waiting inside cIndexFile::CatchUp() to avoid shortly blocking replay
at the end of a recording.
Diffstat (limited to 'ringbuffer.c')
-rw-r--r-- | ringbuffer.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/ringbuffer.c b/ringbuffer.c index 770b7c3..2cf9d75 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.16 2003/05/11 09:47:56 kls Exp $ + * $Id: ringbuffer.c 1.17 2003/05/12 17:38:11 kls Exp $ */ #include "ringbuffer.h" @@ -23,6 +23,7 @@ cRingBuffer::cRingBuffer(int Size, bool Statistics) statistics = Statistics; maxFill = 0; lastPercent = 0; + putTimeout = getTimeout = 0; } cRingBuffer::~cRingBuffer() @@ -31,6 +32,42 @@ cRingBuffer::~cRingBuffer() dsyslog("buffer stats: %d (%d%%) used", maxFill, maxFill * 100 / (size - 1)); } +void cRingBuffer::WaitForPut(void) +{ + if (putTimeout) { + putMutex.Lock(); + readyForPut.TimedWait(putMutex, putTimeout); + putMutex.Unlock(); + } +} + +void cRingBuffer::WaitForGet(void) +{ + if (getTimeout) { + getMutex.Lock(); + readyForGet.TimedWait(getMutex, getTimeout); + getMutex.Unlock(); + } +} + +void cRingBuffer::EnablePut(void) +{ + if (putTimeout) + readyForPut.Broadcast(); +} + +void cRingBuffer::EnableGet(void) +{ + if (getTimeout) + readyForGet.Broadcast(); +} + +void cRingBuffer::SetTimeouts(int PutTimeout, int GetTimeout) +{ + putTimeout = PutTimeout; + getTimeout = GetTimeout; +} + // --- cRingBufferLinear ----------------------------------------------------- cRingBufferLinear::cRingBufferLinear(int Size, int Margin, bool Statistics) @@ -68,6 +105,8 @@ void cRingBufferLinear::Clear(void) head = tail = margin; lastGet = -1; Unlock(); + EnablePut(); + EnableGet(); } int cRingBufferLinear::Put(const uchar *Data, int Count) @@ -109,6 +148,9 @@ int cRingBufferLinear::Put(const uchar *Data, int Count) else Count = 0; Unlock(); + EnableGet(); + if (Count == 0) + WaitForPut(); } return Count; } @@ -134,6 +176,8 @@ uchar *cRingBufferLinear::Get(int &Count) Count = lastGet = cont; } Unlock(); + if (!p) + WaitForGet(); return p; } @@ -146,6 +190,7 @@ void cRingBufferLinear::Del(int Count) if (tail >= Size()) tail = margin; Unlock(); + EnablePut(); } else esyslog("ERROR: invalid Count in cRingBufferLinear::Del: %d", Count); @@ -196,6 +241,8 @@ void cRingBufferFrame::Clear(void) while ((p = Get()) != NULL) Drop(p); Unlock(); + EnablePut(); + EnableGet(); } bool cRingBufferFrame::Put(cFrame *Frame) @@ -212,6 +259,7 @@ bool cRingBufferFrame::Put(cFrame *Frame) } currentFill += Frame->Count(); Unlock(); + EnableGet(); return true; } return false; @@ -249,6 +297,7 @@ void cRingBufferFrame::Drop(cFrame *Frame) esyslog("ERROR: attempt to drop wrong frame from ring buffer!"); } Unlock(); + EnablePut(); } int cRingBufferFrame::Available(void) |