diff options
author | Klaus Schmidinger <Klaus (dot) Schmidinger (at) tvdr (dot) de> | 2012-02-19 14:54:00 +0100 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2012-02-19 16:36:45 +0100 |
commit | c2d9577b3dd7557b7a9c702d5c1fd3b1bbe0e5e7 (patch) | |
tree | a59a457cc3975f5835e7b307dccc5fd0f0e1b1be /dvbplayer.c | |
parent | 59f0138a7d03fed4fc33e1083928bf5b28e0e4ff (diff) | |
download | vdr-patches-c2d9577b3dd7557b7a9c702d5c1fd3b1bbe0e5e7.tar.gz vdr-patches-c2d9577b3dd7557b7a9c702d5c1fd3b1bbe0e5e7.tar.bz2 |
Version 1.7.24
Original announce message:
VDR developer version 1.7.24 is now available at
ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.24.tar.bz2
A 'diff' against the previous version is available at
ftp://ftp.tvdr.de/vdr/Developer/vdr-1.7.23-1.7.24.diff
MD5 checksums:
a034c5e399417dfc583483f650d003ee vdr-1.7.24.tar.bz2
aa1a2b202da92e65945ff39470b26618 vdr-1.7.23-1.7.24.diff
WARNING:
========
This is a developer version. Even though I use it in my productive
environment. I strongly recommend that you only use it under controlled
conditions and for testing and debugging.
From the HISTORY file:
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Fixed a high load in case a transponder can't be received.
- Improved the way DVB_API_VERSION is checked.
- Updated the Finnish OSD texts (thanks to Rolf Ahrenberg).
- Fixed asserting there is a live programme if the primary device is bonded with
a device that starts a recording on a different band.
- Fixed the return type of cMyDeviceHook::DeviceProvidesTransponder() in PLUGINS.html.
- Fixed a crash in a plugin using cDeviceHook when VDR ends (reported by Oliver Endriss).
- Some improvements to the Makefiles (thanks to Christian Ruppert).
- Fixed cRecording::LengthInSeconds(), which wrongfully rounded the result to full
minutes (thanks to Christoph Haubrich).
- Symbolic links are no longer resolved in cRecordings::ScanVideoDir() (thanks to
Sundararaj Reel).
- The epg.data file is now read in a separate thread to make the startup process
faster in case the file is very large (suggested by Helmut Auer).
- Fixed selecting the primary device for receiving the live viewing channel in
case it is bonded with an other device and has no receiver attached to it.
- Fixed a possible crash when canceling VDR while displaying subtitles, and the
primary device is no longer available.
- Improved handling subtitles of BBC channels.
- No longer using tabs as delimiter in the EPG bugfix log (they were garbled in the
log file).
- Added a missing '.' after the month in VPS strings.
- Added some missing 'const' to cDevice (thanks to Joachim Wilke).
- Fixed handling the PrimaryLimit when requesting a device for live viewing
(reported by Uwe Scheffler).
- Removed superfluous calls to SetVideoFormat() from device constructors. This
function is called in cDevice::SetPrimaryDevice(), anyway.
- An ongoing editing process is now canceled if either the original or the edited
version of the recording is deleted from the Recordings menu.
- The SVDRP command DELR now won't delete a recording that is currently being edited.
- Removed code stub for obsolete SVDRP command MOVT.
- The DVB device adapters/frontends are now probed by scanning the /dev/dvb directory
instead of looping through adapter/frontend numbers. This allows for "holes" in the
device numbering.
- cReadDir::Next() now skips directory entries "." and "..".
- Fixed a possible deadlock in time shift mode.
- Fixed switching into time shift mode when pausing live video (thanks to Reinhard
Nissl for helping to debug this one).
Diffstat (limited to 'dvbplayer.c')
-rw-r--r-- | dvbplayer.c | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/dvbplayer.c b/dvbplayer.c index 017df6d..b0adac4 100644 --- a/dvbplayer.c +++ b/dvbplayer.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbplayer.c 2.21 2010/03/07 14:24:26 kls Exp $ + * $Id: dvbplayer.c 2.23 2012/02/19 10:48:02 kls Exp $ */ #include "dvbplayer.h" @@ -87,6 +87,7 @@ class cNonBlockingFileReader : public cThread { private: cUnbufferedFile *f; uchar *buffer; + uchar *result; int wanted; int length; cCondWait newSet; @@ -100,7 +101,7 @@ public: void Clear(void); void Request(cUnbufferedFile *File, int Length); int Result(uchar **Buffer); - bool Reading(void) { return buffer; } + bool Reading(void) { return result; } bool WaitForDataMs(int msToWait); }; @@ -109,6 +110,7 @@ cNonBlockingFileReader::cNonBlockingFileReader(void) { f = NULL; buffer = NULL; + result = NULL; wanted = length = 0; Start(); } @@ -118,6 +120,7 @@ cNonBlockingFileReader::~cNonBlockingFileReader() newSet.Signal(); Cancel(3); free(buffer); + free(result); } void cNonBlockingFileReader::Clear(void) @@ -126,6 +129,8 @@ void cNonBlockingFileReader::Clear(void) f = NULL; free(buffer); buffer = NULL; + free(result); + result = NULL; wanted = length = 0; Unlock(); } @@ -137,18 +142,18 @@ void cNonBlockingFileReader::Request(cUnbufferedFile *File, int Length) wanted = Length; buffer = MALLOC(uchar, wanted); f = File; - Unlock(); newSet.Signal(); + Unlock(); } int cNonBlockingFileReader::Result(uchar **Buffer) { LOCK_THREAD; - if (buffer && length == wanted) { - *Buffer = buffer; - buffer = NULL; + if (result && length == wanted) { + *Buffer = result; + result = NULL; return wanted; - } + } errno = EAGAIN; return -1; } @@ -172,6 +177,8 @@ void cNonBlockingFileReader::Action(void) length = wanted = r; // this will forward the error status to the caller } if (length == wanted) { + result = buffer; + buffer = NULL; cMutexLock NewDataLock(&newDataMutex); newDataCond.Broadcast(); } @@ -183,9 +190,9 @@ void cNonBlockingFileReader::Action(void) bool cNonBlockingFileReader::WaitForDataMs(int msToWait) { - cMutexLock NewDataLock(&newDataMutex); - if (buffer && length == wanted) + if (result && length == wanted) return true; + cMutexLock NewDataLock(&newDataMutex); return newDataCond.TimedWait(newDataMutex, msToWait); } @@ -209,6 +216,7 @@ private: cUnbufferedFile *replayFile; double framesPerSecond; bool isPesRecording; + bool pauseLive; bool eof; bool firstPacket; ePlayModes playMode; @@ -228,7 +236,7 @@ protected: virtual void Activate(bool On); virtual void Action(void); public: - cDvbPlayer(const char *FileName); + cDvbPlayer(const char *FileName, bool PauseLive); virtual ~cDvbPlayer(); bool Active(void) { return cThread::Running(); } void Pause(void); @@ -249,7 +257,7 @@ public: #define SPEED_MULT 12 // the speed multiplier int cDvbPlayer::Speeds[] = { 0, -2, -4, -8, 1, 2, 4, 12, 0 }; -cDvbPlayer::cDvbPlayer(const char *FileName) +cDvbPlayer::cDvbPlayer(const char *FileName, bool PauseLive) :cThread("dvbplayer") { nonBlockingFileReader = NULL; @@ -258,6 +266,7 @@ cDvbPlayer::cDvbPlayer(const char *FileName) cRecording Recording(FileName); framesPerSecond = Recording.FramesPerSecond(); isPesRecording = Recording.IsPesRecording(); + pauseLive = PauseLive; eof = false; firstPacket = true; playMode = pmPlay; @@ -275,7 +284,7 @@ cDvbPlayer::cDvbPlayer(const char *FileName) return; ringBuffer = new cRingBufferFrame(PLAYERBUFSIZE); // Create the index file: - index = new cIndexFile(FileName, false, isPesRecording); + index = new cIndexFile(FileName, false, isPesRecording, pauseLive); if (!index) esyslog("ERROR: can't allocate index"); else if (!index->Ok()) { @@ -400,15 +409,17 @@ void cDvbPlayer::Action(void) int LastReadIFrame = -1; int SwitchToPlayFrame = 0; + if (pauseLive) + Goto(0, true); while (Running()) { if (WaitingForData) - nonBlockingFileReader->WaitForDataMs(3); // this keeps the CPU load low, but reacts immediately on new data + nonBlockingFileReader->WaitForDataMs(10); // this keeps the CPU load low, but reacts immediately on new data else if (Sleep) { cPoller Poller; DevicePoll(Poller, 10); Sleep = false; - if (playMode == pmStill || playMode==pmPause) - cCondWait::SleepMs(3); + if (playMode == pmStill || playMode == pmPause) + cCondWait::SleepMs(10); } { LOCK_THREAD; @@ -470,7 +481,15 @@ void cDvbPlayer::Action(void) } if (!eof) { uchar *b = NULL; - int r = nonBlockingFileReader->Result(&b); + int Retries = 5; + int r; + while (true) { + r = nonBlockingFileReader->Result(&b); + if (r == -1 && errno == EAGAIN && --Retries) + nonBlockingFileReader->WaitForDataMs(10); + else + break; + } if (r > 0) { WaitingForData = false; uint32_t Pts = 0; @@ -821,8 +840,8 @@ bool cDvbPlayer::GetReplayMode(bool &Play, bool &Forward, int &Speed) // --- cDvbPlayerControl ----------------------------------------------------- -cDvbPlayerControl::cDvbPlayerControl(const char *FileName) -:cControl(player = new cDvbPlayer(FileName)) +cDvbPlayerControl::cDvbPlayerControl(const char *FileName, bool PauseLive) +:cControl(player = new cDvbPlayer(FileName, PauseLive)) { } |