mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
In timeshift mode, the title of the actual playback position is displayed
If the timeshift mode is activated during playback, the title of the program that was active when the time shift started is displayed by pressing OK. The behavior has now been changed so that the title of the program is displayed in the actual playback position when you press OK.
This commit is contained in:
parent
628a28201b
commit
64599db339
@ -143,6 +143,7 @@ void cViewReplay::PreCache(void) {
|
|||||||
void cViewReplay::ClearVariables(void) {
|
void cViewReplay::ClearVariables(void) {
|
||||||
cView::ClearVariables();
|
cView::ClearVariables();
|
||||||
recording = NULL;
|
recording = NULL;
|
||||||
|
lastEvent = NULL;
|
||||||
modeOnly = false;
|
modeOnly = false;
|
||||||
lastFlush = 0;
|
lastFlush = 0;
|
||||||
lastFlushModeOnly = 0;
|
lastFlushModeOnly = 0;
|
||||||
@ -162,20 +163,6 @@ void cViewReplay::ClearVariables(void) {
|
|||||||
globalTimers.ClearTimers();
|
globalTimers.ClearTimers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cViewReplay::SetRecording(const cRecording *recording) {
|
|
||||||
this->recording = recording;
|
|
||||||
if (veRecTitle) {
|
|
||||||
veRecTitle->Set(recording);
|
|
||||||
}
|
|
||||||
if (veRecInfo) {
|
|
||||||
veRecInfo->Set(recording);
|
|
||||||
}
|
|
||||||
if (veScraperContent) {
|
|
||||||
veScraperContent->Set(recording);
|
|
||||||
}
|
|
||||||
SetTimeShiftValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cViewReplay::GetGlobalTimers(void) {
|
void cViewReplay::GetGlobalTimers(void) {
|
||||||
if (!timersLoaded) {
|
if (!timersLoaded) {
|
||||||
timersLoaded = true;
|
timersLoaded = true;
|
||||||
@ -183,7 +170,7 @@ void cViewReplay::GetGlobalTimers(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cViewReplay::SetTimeShiftValues(void) {
|
void cViewReplay::SetTimeShiftValues(int current, int total) {
|
||||||
if (!recording)
|
if (!recording)
|
||||||
return;
|
return;
|
||||||
timeShiftActive = false;
|
timeShiftActive = false;
|
||||||
@ -209,21 +196,43 @@ void cViewReplay::SetTimeShiftValues(void) {
|
|||||||
}
|
}
|
||||||
if (!Schedule)
|
if (!Schedule)
|
||||||
return;
|
return;
|
||||||
const cEvent *event = Schedule->GetEventAround(time(NULL));
|
// Get event at actual recording position
|
||||||
if (!event)
|
const cEvent *eventEnde = Schedule->GetEventAround(time(NULL));
|
||||||
|
if (!eventEnde)
|
||||||
return;
|
return;
|
||||||
double fps = recording->FramesPerSecond();
|
double fps = recording->FramesPerSecond();
|
||||||
time_t liveEventStop = event->EndTime();
|
time_t liveEventStop = eventEnde->EndTime();
|
||||||
time_t recordingStart = time(0) - recording->LengthInSeconds();
|
time_t recordingStart = time(0) - recording->LengthInSeconds();
|
||||||
timeShiftFramesTotal = (liveEventStop - recordingStart) * fps;
|
timeShiftFramesTotal = (liveEventStop - recordingStart) * fps;
|
||||||
timeShiftLength = liveEventStop - recordingStart;
|
timeShiftLength = liveEventStop - recordingStart;
|
||||||
|
// Get event at actual replay position
|
||||||
|
int secondsafter = (int)(recording->LengthInSeconds() * (1.0 - (double)current / (double)total));
|
||||||
|
const cEvent *eventReplay = Schedule->GetEventAround(time(NULL) - secondsafter);
|
||||||
|
// Display title at replay position
|
||||||
|
if (eventReplay && eventReplay != lastEvent && veRecTitle) {
|
||||||
|
veRecTitle->Set(recording, eventReplay);
|
||||||
|
veRecTitle->Parse();
|
||||||
|
lastEvent = eventReplay;
|
||||||
|
}
|
||||||
int mins = (timeShiftLength / 60) % 60;
|
int mins = (timeShiftLength / 60) % 60;
|
||||||
int hours = (timeShiftLength / 3600) % 24;
|
int hours = (timeShiftLength / 3600) % 24;
|
||||||
timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
|
timeShiftDuration = cString::sprintf("%d:%02d", hours, mins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cViewReplay::SetRecording(const cRecording *recording) {
|
||||||
|
this->recording = recording;
|
||||||
|
if (veRecTitle) {
|
||||||
|
veRecTitle->Set(recording);
|
||||||
|
}
|
||||||
|
if (veRecInfo) {
|
||||||
|
veRecInfo->Set(recording);
|
||||||
|
}
|
||||||
|
if (veScraperContent) {
|
||||||
|
veScraperContent->Set(recording);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cViewReplay::SetTitle(const char *title) {
|
void cViewReplay::SetTitle(const char *title) {
|
||||||
recording = NULL;
|
|
||||||
if (veRecTitle) {
|
if (veRecTitle) {
|
||||||
veRecTitle->Set(title);
|
veRecTitle->Set(title);
|
||||||
}
|
}
|
||||||
@ -263,7 +272,7 @@ void cViewReplay::SetEndTime(int current, int total) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cViewReplay::SetProgressbar(int current, int total) {
|
void cViewReplay::SetProgressbar(int current, int total) {
|
||||||
SetTimeShiftValues();
|
SetTimeShiftValues(current, total);
|
||||||
if (veProgressbar)
|
if (veProgressbar)
|
||||||
veProgressbar->Set(current, total, timeShiftActive, timeShiftFramesTotal);
|
veProgressbar->Set(current, total, timeShiftActive, timeShiftFramesTotal);
|
||||||
Render((int)eVeDisplayReplay::progressbar);
|
Render((int)eVeDisplayReplay::progressbar);
|
||||||
|
@ -22,6 +22,7 @@ private:
|
|||||||
cVeDrOnPause *veOnPause;
|
cVeDrOnPause *veOnPause;
|
||||||
cVeDrOnPause *veOnPauseModeOnly;
|
cVeDrOnPause *veOnPauseModeOnly;
|
||||||
const cRecording *recording;
|
const cRecording *recording;
|
||||||
|
const cEvent *lastEvent;
|
||||||
bool modeOnly;
|
bool modeOnly;
|
||||||
time_t lastFlush;
|
time_t lastFlush;
|
||||||
time_t lastFlushModeOnly;
|
time_t lastFlushModeOnly;
|
||||||
@ -34,7 +35,7 @@ private:
|
|||||||
bool timersLoaded;
|
bool timersLoaded;
|
||||||
cGlobalTimers globalTimers;
|
cGlobalTimers globalTimers;
|
||||||
void GetGlobalTimers(void);
|
void GetGlobalTimers(void);
|
||||||
void SetTimeShiftValues(void);
|
void SetTimeShiftValues(int current, int total);
|
||||||
void SetViewElements(void);
|
void SetViewElements(void);
|
||||||
void ClearVariables(void);
|
void ClearVariables(void);
|
||||||
void SetViewElementObjects(void);
|
void SetViewElementObjects(void);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
******************************************************************/
|
******************************************************************/
|
||||||
cVeDrRecTitle::cVeDrRecTitle(void) {
|
cVeDrRecTitle::cVeDrRecTitle(void) {
|
||||||
recording = NULL;
|
recording = NULL;
|
||||||
|
event = NULL;
|
||||||
title = NULL;
|
title = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,16 +25,20 @@ void cVeDrRecTitle::SetTokenContainer(void) {
|
|||||||
InheritTokenContainer();
|
InheritTokenContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cVeDrRecTitle::Set(const cRecording *recording) {
|
void cVeDrRecTitle::Set(const cRecording *recording, const cEvent *event) {
|
||||||
if (this->title) {
|
if (this->title) {
|
||||||
free(this->title);
|
free(this->title);
|
||||||
this->title = NULL;
|
this->title = NULL;
|
||||||
}
|
}
|
||||||
if (this->recording)
|
if (this->recording)
|
||||||
this->recording = NULL;
|
this->recording = NULL;
|
||||||
|
if (this->event)
|
||||||
|
this->event = NULL;
|
||||||
if (!recording)
|
if (!recording)
|
||||||
return;
|
return;
|
||||||
this->recording = recording;
|
this->recording = recording;
|
||||||
|
if (event)
|
||||||
|
this->event = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cVeDrRecTitle::Set(const char *title) {
|
void cVeDrRecTitle::Set(const char *title) {
|
||||||
@ -43,6 +48,8 @@ void cVeDrRecTitle::Set(const char *title) {
|
|||||||
}
|
}
|
||||||
if (this->recording)
|
if (this->recording)
|
||||||
this->recording = NULL;
|
this->recording = NULL;
|
||||||
|
if (this->event)
|
||||||
|
this->event = NULL;
|
||||||
if (!title)
|
if (!title)
|
||||||
return;
|
return;
|
||||||
free(this->title);
|
free(this->title);
|
||||||
@ -58,13 +65,22 @@ bool cVeDrRecTitle::Parse(bool force) {
|
|||||||
tokenContainer->Clear();
|
tokenContainer->Clear();
|
||||||
if (recording) {
|
if (recording) {
|
||||||
const char *recName = NULL;
|
const char *recName = NULL;
|
||||||
|
const char *recShortText = NULL;
|
||||||
const cRecordingInfo *recInfo = recording->Info();
|
const cRecordingInfo *recInfo = recording->Info();
|
||||||
if (recInfo)
|
if (event) {
|
||||||
|
recName = event->Title();
|
||||||
|
recShortText = event->ShortText();
|
||||||
|
} else if (recInfo) {
|
||||||
recName = recInfo->Title();
|
recName = recInfo->Title();
|
||||||
if (!recName)
|
recShortText = recInfo->ShortText();
|
||||||
|
}
|
||||||
|
if (!recName) {
|
||||||
recName = recording->Name();
|
recName = recording->Name();
|
||||||
|
recShortText = "";
|
||||||
|
}
|
||||||
|
|
||||||
tokenContainer->AddStringToken((int)eDRRecTitleST::rectitle, recName);
|
tokenContainer->AddStringToken((int)eDRRecTitleST::rectitle, recName);
|
||||||
tokenContainer->AddStringToken((int)eDRRecTitleST::recsubtitle, recInfo ? recInfo->ShortText() : "");
|
tokenContainer->AddStringToken((int)eDRRecTitleST::recsubtitle, recShortText);
|
||||||
tokenContainer->AddStringToken((int)eDRRecTitleST::recdate, *ShortDateString(recording->Start()));
|
tokenContainer->AddStringToken((int)eDRRecTitleST::recdate, *ShortDateString(recording->Start()));
|
||||||
tokenContainer->AddStringToken((int)eDRRecTitleST::rectime, *TimeString(recording->Start()));
|
tokenContainer->AddStringToken((int)eDRRecTitleST::rectime, *TimeString(recording->Start()));
|
||||||
} else if (title) {
|
} else if (title) {
|
||||||
|
@ -10,13 +10,14 @@
|
|||||||
class cVeDrRecTitle : public cViewElement {
|
class cVeDrRecTitle : public cViewElement {
|
||||||
private:
|
private:
|
||||||
const cRecording *recording;
|
const cRecording *recording;
|
||||||
|
const cEvent *event;
|
||||||
char *title;
|
char *title;
|
||||||
public:
|
public:
|
||||||
cVeDrRecTitle(void);
|
cVeDrRecTitle(void);
|
||||||
virtual ~cVeDrRecTitle(void);
|
virtual ~cVeDrRecTitle(void);
|
||||||
void SetTokenContainer(void);
|
void SetTokenContainer(void);
|
||||||
void Set(const cRecording *recording);
|
void Set(const cRecording *recording = NULL, const cEvent *event = NULL);
|
||||||
void Set(const char *title);
|
void Set(const char *title = NULL);
|
||||||
bool Parse(bool forced = false);
|
bool Parse(bool forced = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user