diff options
author | Klaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de> | 2009-11-22 15:58:00 +0100 |
---|---|---|
committer | Klaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de> | 2009-11-22 15:58:00 +0100 |
commit | ea01358b3bca9d55402ba632c95cdd6458abfdb3 (patch) | |
tree | 3a92e952e0c8de3cf109748da749b2841fed0da0 /ringbuffer.c | |
parent | 06bf4c453e22a9bf03f5ec46f7b45593e2cb326c (diff) | |
download | vdr-patch-lnbsharing-ea01358b3bca9d55402ba632c95cdd6458abfdb3.tar.gz vdr-patch-lnbsharing-ea01358b3bca9d55402ba632c95cdd6458abfdb3.tar.bz2 |
Version 1.7.10vdr-1.7.10
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Fixed wrong bracketing in cChannel::SubtitlingType() etc.
(thanks to Rolf Ahrenberg).
- Fixed not logging changes for channels that have no number
(reported by Timothy D. Lenz).
- Changed the project's URLs and email to tvdr.de.
- Added Lithuanian language translations (thanks to Valdemaras Pipiras).
- Updated Chinese language texts (thanks to Nan Feng).
- Only checking DVB_API_VERSION to be >=5 in order to stay compileable in case
the DVB API version number is increased (the API claims to always be backward
compatible).
- Fixed saving terminal settings when running in background (thanks to Manuel
Reimer).
- Fixed cFrameDetector::Analyze() to handle video streams where the frame type
is not detectable from the first TS packet of a frame.
- Fixed writing the PCR pid into the PMT in cPatPmtGenerator::GeneratePmt()
(reported by Rene van den Braken).
- Added Slovakian language texts (thanks to Milan Hrala).
- Fixed EntriesOnSameFileSystem() to avoid using f_fsid, which may be 0 (thanks
to Frank Schmirler).
- Fixed starting a recording at an I-frame.
- Fixed generating the index for recordings from channels that put a whole
GOP into one payload unit.
- The index file for TS recordings is now regenerated on-the-fly if a
recording is replayed that has no index. This can also be used to
re-create a broken index file by manually deleting the index file and then
replaying the recording (at least until the index file has been generated).
- The cRingBufferLinear::Read() function now returns -1 and sets errno to
EAGAIN if the buffer is already full.
- Fixed handling DVB subtitles for PES recordings (thanks to Rolf Ahrenberg).
- Added the audio id to the call of PlayAudio() in cDevice::PlayTsAudio()
(thanks to Andreas Schaefers).
- Fixed references to old *.vdr file names in MANUAL (reported by Arthur Konovalov).
- Reverted "Removed limitation to PAL resolution from SPU handling" because it
cause nothing but trouble. Besides, the core VDR doesn't use this, anyway.
- Fixed the default value for "Pause key handling" in the MANUAL (reported by
Diego Pierotto).
Diffstat (limited to 'ringbuffer.c')
-rw-r--r-- | ringbuffer.c | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/ringbuffer.c b/ringbuffer.c index fd8123e..1bdeacc 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 2.2 2009/05/17 10:05:17 kls Exp $ + * $Id: ringbuffer.c 2.3 2009/11/22 11:14:36 kls Exp $ */ #include "ringbuffer.h" @@ -200,7 +200,7 @@ int cRingBufferLinear::Available(void) void cRingBufferLinear::Clear(void) { - tail = head; + tail = head = margin; #ifdef DEBUGRINGBUFFERS lastHead = head; lastTail = tail; @@ -217,7 +217,8 @@ int cRingBufferLinear::Read(int FileHandle, int Max) int free = (diff > 0) ? diff - 1 : Size() - head; if (Tail <= margin) free--; - int Count = 0; + int Count = -1; + errno = EAGAIN; if (free > 0) { if (0 < Max && Max < free) free = Max; @@ -247,6 +248,44 @@ int cRingBufferLinear::Read(int FileHandle, int Max) return Count; } +int cRingBufferLinear::Read(cUnbufferedFile *File, int Max) +{ + int Tail = tail; + int diff = Tail - head; + int free = (diff > 0) ? diff - 1 : Size() - head; + if (Tail <= margin) + free--; + int Count = -1; + errno = EAGAIN; + if (free > 0) { + if (0 < Max && Max < free) + free = Max; + Count = File->Read(buffer + head, free); + if (Count > 0) { + int Head = head + Count; + if (Head >= Size()) + Head = margin; + head = Head; + if (statistics) { + int fill = head - Tail; + if (fill < 0) + fill = Size() + fill; + else if (fill >= Size()) + fill = Size() - 1; + UpdatePercentage(fill); + } + } + } +#ifdef DEBUGRINGBUFFERS + lastHead = head; + lastPut = Count; +#endif + EnableGet(); + if (free == 0) + WaitForPut(); + return Count; +} + int cRingBufferLinear::Put(const uchar *Data, int Count) { if (Count > 0) { |