mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
Revision cViewReplay::SetTimeShiftValues()
When the timeshift recording reaches the end time of the start event, the progress bar and the end time no longer shows any useful information. From this version the current live event is used to calculate the progress bar and the end time.
This commit is contained in:
parent
538d59ca4e
commit
628a28201b
@ -162,15 +162,6 @@ void cViewReplay::ClearVariables(void) {
|
||||
globalTimers.ClearTimers();
|
||||
}
|
||||
|
||||
void cViewReplay::SetTimeShift(int framesTotal, int timeShiftLength) {
|
||||
timeShiftActive = true;
|
||||
timeShiftFramesTotal = framesTotal;
|
||||
this->timeShiftLength = timeShiftLength;
|
||||
int mins = (timeShiftLength / 60) % 60;
|
||||
int hours = (timeShiftLength / 3600) % 24;
|
||||
timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
|
||||
}
|
||||
|
||||
void cViewReplay::SetRecording(const cRecording *recording) {
|
||||
this->recording = recording;
|
||||
if (veRecTitle) {
|
||||
@ -195,31 +186,40 @@ void cViewReplay::GetGlobalTimers(void) {
|
||||
void cViewReplay::SetTimeShiftValues(void) {
|
||||
if (!recording)
|
||||
return;
|
||||
bool isTimeShift = false;
|
||||
timeShiftActive = false;
|
||||
#if APIVERSNUM >= 20101
|
||||
int usage = recording->IsInUse();
|
||||
if (usage & ruTimer)
|
||||
isTimeShift = true;
|
||||
timeShiftActive = true;
|
||||
else {
|
||||
GetGlobalTimers();
|
||||
if (globalTimers.IsRecording(recording))
|
||||
isTimeShift = true;
|
||||
timeShiftActive = true;
|
||||
}
|
||||
#endif
|
||||
if (!isTimeShift)
|
||||
if (!timeShiftActive)
|
||||
return;
|
||||
const cRecordingInfo *recInfo = recording->Info();
|
||||
if (!recInfo)
|
||||
return;
|
||||
const cEvent *event = recInfo->GetEvent();
|
||||
const cSchedule *Schedule = NULL;
|
||||
{
|
||||
LOCK_SCHEDULES_READ;
|
||||
Schedule = Schedules->GetSchedule(recInfo->ChannelID());
|
||||
}
|
||||
if (!Schedule)
|
||||
return;
|
||||
const cEvent *event = Schedule->GetEventAround(time(NULL));
|
||||
if (!event)
|
||||
return;
|
||||
double fps = recording->FramesPerSecond();
|
||||
time_t liveEventStop = event->EndTime();
|
||||
time_t recordingStart = time(0) - recording->LengthInSeconds();
|
||||
int framesTotal = (liveEventStop - recordingStart)*fps;
|
||||
int recLength = liveEventStop - recordingStart;
|
||||
SetTimeShift(framesTotal, recLength);
|
||||
timeShiftFramesTotal = (liveEventStop - recordingStart) * fps;
|
||||
timeShiftLength = liveEventStop - recordingStart;
|
||||
int mins = (timeShiftLength / 60) % 60;
|
||||
int hours = (timeShiftLength / 3600) % 24;
|
||||
timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
|
||||
}
|
||||
|
||||
void cViewReplay::SetTitle(const char *title) {
|
||||
|
@ -45,7 +45,6 @@ public:
|
||||
void PreCache(void);
|
||||
void SetModeOnly(bool modeOnly) { this->modeOnly = modeOnly; };
|
||||
void SetRecordingLength(int length) { reclength = length; };
|
||||
void SetTimeShift(int framesTotal, int timeShiftLength);
|
||||
void SetRecording(const cRecording *recording);
|
||||
void SetTitle(const char *title);
|
||||
void SetCurrent(const char *current);
|
||||
|
Loading…
Reference in New Issue
Block a user