mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-12-27 07:11:05 +01:00
Fixed switching into time shift mode when pausing live video
This commit is contained in:
18
dvbplayer.c
18
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.22 2012/02/17 15:36:41 kls Exp $
|
||||
* $Id: dvbplayer.c 2.23 2012/02/19 10:48:02 kls Exp $
|
||||
*/
|
||||
|
||||
#include "dvbplayer.h"
|
||||
@@ -216,6 +216,7 @@ private:
|
||||
cUnbufferedFile *replayFile;
|
||||
double framesPerSecond;
|
||||
bool isPesRecording;
|
||||
bool pauseLive;
|
||||
bool eof;
|
||||
bool firstPacket;
|
||||
ePlayModes playMode;
|
||||
@@ -235,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);
|
||||
@@ -256,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;
|
||||
@@ -265,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;
|
||||
@@ -282,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()) {
|
||||
@@ -407,6 +409,8 @@ void cDvbPlayer::Action(void)
|
||||
int LastReadIFrame = -1;
|
||||
int SwitchToPlayFrame = 0;
|
||||
|
||||
if (pauseLive)
|
||||
Goto(0, true);
|
||||
while (Running()) {
|
||||
if (WaitingForData)
|
||||
nonBlockingFileReader->WaitForDataMs(10); // this keeps the CPU load low, but reacts immediately on new data
|
||||
@@ -414,7 +418,7 @@ void cDvbPlayer::Action(void)
|
||||
cPoller Poller;
|
||||
DevicePoll(Poller, 10);
|
||||
Sleep = false;
|
||||
if (playMode == pmStill || playMode==pmPause)
|
||||
if (playMode == pmStill || playMode == pmPause)
|
||||
cCondWait::SleepMs(10);
|
||||
}
|
||||
{
|
||||
@@ -836,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))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user