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();
|
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) {
|
void cViewReplay::SetRecording(const cRecording *recording) {
|
||||||
this->recording = recording;
|
this->recording = recording;
|
||||||
if (veRecTitle) {
|
if (veRecTitle) {
|
||||||
@ -195,31 +186,40 @@ void cViewReplay::GetGlobalTimers(void) {
|
|||||||
void cViewReplay::SetTimeShiftValues(void) {
|
void cViewReplay::SetTimeShiftValues(void) {
|
||||||
if (!recording)
|
if (!recording)
|
||||||
return;
|
return;
|
||||||
bool isTimeShift = false;
|
timeShiftActive = false;
|
||||||
#if APIVERSNUM >= 20101
|
#if APIVERSNUM >= 20101
|
||||||
int usage = recording->IsInUse();
|
int usage = recording->IsInUse();
|
||||||
if (usage & ruTimer)
|
if (usage & ruTimer)
|
||||||
isTimeShift = true;
|
timeShiftActive = true;
|
||||||
else {
|
else {
|
||||||
GetGlobalTimers();
|
GetGlobalTimers();
|
||||||
if (globalTimers.IsRecording(recording))
|
if (globalTimers.IsRecording(recording))
|
||||||
isTimeShift = true;
|
timeShiftActive = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!isTimeShift)
|
if (!timeShiftActive)
|
||||||
return;
|
return;
|
||||||
const cRecordingInfo *recInfo = recording->Info();
|
const cRecordingInfo *recInfo = recording->Info();
|
||||||
if (!recInfo)
|
if (!recInfo)
|
||||||
return;
|
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)
|
if (!event)
|
||||||
return;
|
return;
|
||||||
double fps = recording->FramesPerSecond();
|
double fps = recording->FramesPerSecond();
|
||||||
time_t liveEventStop = event->EndTime();
|
time_t liveEventStop = event->EndTime();
|
||||||
time_t recordingStart = time(0) - recording->LengthInSeconds();
|
time_t recordingStart = time(0) - recording->LengthInSeconds();
|
||||||
int framesTotal = (liveEventStop - recordingStart)*fps;
|
timeShiftFramesTotal = (liveEventStop - recordingStart) * fps;
|
||||||
int recLength = liveEventStop - recordingStart;
|
timeShiftLength = liveEventStop - recordingStart;
|
||||||
SetTimeShift(framesTotal, recLength);
|
int mins = (timeShiftLength / 60) % 60;
|
||||||
|
int hours = (timeShiftLength / 3600) % 24;
|
||||||
|
timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cViewReplay::SetTitle(const char *title) {
|
void cViewReplay::SetTitle(const char *title) {
|
||||||
|
@ -45,7 +45,6 @@ public:
|
|||||||
void PreCache(void);
|
void PreCache(void);
|
||||||
void SetModeOnly(bool modeOnly) { this->modeOnly = modeOnly; };
|
void SetModeOnly(bool modeOnly) { this->modeOnly = modeOnly; };
|
||||||
void SetRecordingLength(int length) { reclength = length; };
|
void SetRecordingLength(int length) { reclength = length; };
|
||||||
void SetTimeShift(int framesTotal, int timeShiftLength);
|
|
||||||
void SetRecording(const cRecording *recording);
|
void SetRecording(const cRecording *recording);
|
||||||
void SetTitle(const char *title);
|
void SetTitle(const char *title);
|
||||||
void SetCurrent(const char *current);
|
void SetCurrent(const char *current);
|
||||||
|
Loading…
Reference in New Issue
Block a user