mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
				synced 2023-10-19 15:58:31 +00:00 
			
		
		
		
	added timeshift support in displayreplay
This commit is contained in:
		
							
								
								
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							@@ -331,6 +331,7 @@ Version 0.4.6
 | 
				
			|||||||
- added token {startsin} in displaymenuschedules
 | 
					- added token {startsin} in displaymenuschedules
 | 
				
			||||||
- added viewelement <vdrstatistics> in main menu
 | 
					- added viewelement <vdrstatistics> in main menu
 | 
				
			||||||
- added permashift support in displaychannel
 | 
					- added permashift support in displaychannel
 | 
				
			||||||
 | 
					- added timeshift support in displayreplay
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,8 +29,10 @@ cSDDisplayReplay::~cSDDisplayReplay() {
 | 
				
			|||||||
void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
 | 
					void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
 | 
				
			||||||
    if (!doOutput || !Recording)
 | 
					    if (!doOutput || !Recording)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    if (initial)
 | 
					    if (initial) {
 | 
				
			||||||
        replayView->SetRecordingLength(Recording->LengthInSeconds());
 | 
					        replayView->SetRecordingLength(Recording->LengthInSeconds());
 | 
				
			||||||
 | 
					        SetTimeShiftValues(Recording);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    replayView->DrawTitle(Recording);
 | 
					    replayView->DrawTitle(Recording);
 | 
				
			||||||
    replayView->DrawRecordingInformation(Recording);
 | 
					    replayView->DrawRecordingInformation(Recording);
 | 
				
			||||||
    replayView->DrawScraperContent(Recording);
 | 
					    replayView->DrawScraperContent(Recording);
 | 
				
			||||||
@@ -111,3 +113,22 @@ void cSDDisplayReplay::Flush(void) {
 | 
				
			|||||||
        replayView->Flush();
 | 
					        replayView->Flush();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void cSDDisplayReplay::SetTimeShiftValues(const cRecording *recording) {
 | 
				
			||||||
 | 
					    int usage = recording->IsInUse();
 | 
				
			||||||
 | 
					    if (!(usage & ruTimer))
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const cRecordingInfo *recInfo = recording->Info();
 | 
				
			||||||
 | 
					    if (!recInfo)
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    const cEvent *event = recInfo->GetEvent();
 | 
				
			||||||
 | 
					    if (!event)
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    double fps = recording->FramesPerSecond();
 | 
				
			||||||
 | 
					    time_t liveEventStop = event->EndTime();
 | 
				
			||||||
 | 
					    time_t recordingStart = recording->Start();
 | 
				
			||||||
 | 
					    int framesTotal = (liveEventStop - recordingStart)*fps;
 | 
				
			||||||
 | 
					    int recLength = liveEventStop - recordingStart;
 | 
				
			||||||
 | 
					    replayView->SetTimeShift(framesTotal, recLength);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,6 +14,7 @@ private:
 | 
				
			|||||||
    bool initialModeSet;
 | 
					    bool initialModeSet;
 | 
				
			||||||
    bool doOutput;
 | 
					    bool doOutput;
 | 
				
			||||||
    bool modeOnly;
 | 
					    bool modeOnly;
 | 
				
			||||||
 | 
					    void SetTimeShiftValues(const cRecording *recording);
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly);
 | 
					    cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly);
 | 
				
			||||||
    virtual ~cSDDisplayReplay();
 | 
					    virtual ~cSDDisplayReplay();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -112,10 +112,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    <!-- Available Variables totaltime:
 | 
					    <!-- Available Variables totaltime:
 | 
				
			||||||
    {rectotal}                   Total Time in hh:mm:ss
 | 
					    {rectotal}                   Total Time in hh:mm:ss
 | 
				
			||||||
 | 
					    {timeshift}                  true if a timeshifted recording is displayed
 | 
				
			||||||
 | 
					    {timeshifttotal}             Total Time of timeshift event in hh:mm
 | 
				
			||||||
    -->
 | 
					    -->
 | 
				
			||||||
    <totaltime>
 | 
					    <totaltime>
 | 
				
			||||||
        <area x="69%" y="92%" width="30%" height="7%" layer="2">
 | 
					        <area x="69%" y="92%" width="30%" height="7%" layer="2">
 | 
				
			||||||
            <drawtext align="right" valign="center" font="{light}" fontsize="100%" color="{clrWhite}" text="{rectotal}" />
 | 
					            <drawtext condition="not{timeshift}" align="right" valign="center" font="{light}" fontsize="100%" color="{clrWhite}" text="{rectotal}" />
 | 
				
			||||||
 | 
					            <drawtext condition="{timeshift}" align="right" valign="center" font="{light}" fontsize="100%" color="{clrWhite}" text="{timeshifttotal} ({rectotal})" />
 | 
				
			||||||
        </area>
 | 
					        </area>
 | 
				
			||||||
    </totaltime>
 | 
					    </totaltime>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -130,12 +133,19 @@
 | 
				
			|||||||
    <!-- Available Variables progressbar:
 | 
					    <!-- Available Variables progressbar:
 | 
				
			||||||
    {current}                   current frame of recording
 | 
					    {current}                   current frame of recording
 | 
				
			||||||
    {total}                     total frames of recording
 | 
					    {total}                     total frames of recording
 | 
				
			||||||
 | 
					    {timeshift}                 true if a timeshifted recording is displayed
 | 
				
			||||||
 | 
					    {timeshifttotal}            total number of frames of timeshift event
 | 
				
			||||||
    -->
 | 
					    -->
 | 
				
			||||||
    <progressbar>
 | 
					    <progressbar>
 | 
				
			||||||
        <area x="5%" y="89%" width="90%" height="3%" layer="2">
 | 
					        <area condition="not{timeshift}" x="5%" y="89%" width="90%" height="3%" layer="2">
 | 
				
			||||||
            <fill color="{clrDarkGray}" />
 | 
					            <fill color="{clrDarkGray}" />
 | 
				
			||||||
            <drawrectangle x="0" y="0" width="{current}/{total}*{areawidth}" height="100%" color="{clrTransBlueLight}" />
 | 
					            <drawrectangle x="0" y="0" width="{current}/{total}*{areawidth}" height="100%" color="{clrTransBlueLight}" />
 | 
				
			||||||
        </area>
 | 
					        </area>
 | 
				
			||||||
 | 
					        <area condition="{timeshift}" x="5%" y="89%" width="90%" height="3%" layer="2">
 | 
				
			||||||
 | 
					            <fill color="{clrDarkGray}" />
 | 
				
			||||||
 | 
					            <drawrectangle x="0" y="0" width="{total}/{timeshifttotal}*{areawidth}" height="100%" color="{clrTransWhite}" />
 | 
				
			||||||
 | 
					            <drawrectangle x="0" y="0" width="{current}/{timeshifttotal}*{areawidth}" height="100%" color="{clrTransBlueLight}" />
 | 
				
			||||||
 | 
					        </area>
 | 
				
			||||||
    </progressbar>
 | 
					    </progressbar>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- Available Variables cutmarks:
 | 
					    <!-- Available Variables cutmarks:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,6 +6,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView) {
 | 
					cDisplayReplayView::cDisplayReplayView(cTemplateView *tmplView) : cView(tmplView) {
 | 
				
			||||||
    length = 0;
 | 
					    length = 0;
 | 
				
			||||||
 | 
					    timeShiftActive = false;
 | 
				
			||||||
 | 
					    timeShiftFramesTotal = 0;
 | 
				
			||||||
 | 
					    timeShiftLength = 1;
 | 
				
			||||||
 | 
					    timeShiftDuration = "";
 | 
				
			||||||
    endLast = "";
 | 
					    endLast = "";
 | 
				
			||||||
    onPauseView = NULL;
 | 
					    onPauseView = NULL;
 | 
				
			||||||
    numMarksLast = 0;
 | 
					    numMarksLast = 0;
 | 
				
			||||||
@@ -32,6 +36,15 @@ bool cDisplayReplayView::createOsd(void) {
 | 
				
			|||||||
    return ok;
 | 
					    return ok;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void cDisplayReplayView::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 cDisplayReplayView::DrawBackground(bool modeOnly) {
 | 
					void cDisplayReplayView::DrawBackground(bool modeOnly) {
 | 
				
			||||||
    map < string, string > stringTokens;
 | 
					    map < string, string > stringTokens;
 | 
				
			||||||
    map < string, int > intTokens;
 | 
					    map < string, int > intTokens;
 | 
				
			||||||
@@ -218,7 +231,9 @@ void cDisplayReplayView::DrawCurrent(const char *current) {
 | 
				
			|||||||
void cDisplayReplayView::DrawTotal(const char *total) {
 | 
					void cDisplayReplayView::DrawTotal(const char *total) {
 | 
				
			||||||
    map < string, string > stringTokens;
 | 
					    map < string, string > stringTokens;
 | 
				
			||||||
    map < string, int > intTokens;
 | 
					    map < string, int > intTokens;
 | 
				
			||||||
 | 
					    intTokens.insert(pair<string,int>("timeshift", timeShiftActive));
 | 
				
			||||||
    stringTokens.insert(pair<string,string>("rectotal", total));
 | 
					    stringTokens.insert(pair<string,string>("rectotal", total));
 | 
				
			||||||
 | 
					    stringTokens.insert(pair<string,string>("timeshifttotal", timeShiftDuration));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ClearViewElement(veRecTotal);
 | 
					    ClearViewElement(veRecTotal);
 | 
				
			||||||
    DrawViewElement(veRecTotal, &stringTokens, &intTokens);
 | 
					    DrawViewElement(veRecTotal, &stringTokens, &intTokens);
 | 
				
			||||||
@@ -227,8 +242,14 @@ void cDisplayReplayView::DrawTotal(const char *total) {
 | 
				
			|||||||
void cDisplayReplayView::DrawEndTime(int current, int total) {
 | 
					void cDisplayReplayView::DrawEndTime(int current, int total) {
 | 
				
			||||||
    if (!current)
 | 
					    if (!current)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    double rest = (double)(total - current) / (double)total;
 | 
					    int totalLength = total;
 | 
				
			||||||
    time_t end = time(0) + rest*length;
 | 
					    int recordingLength = length;
 | 
				
			||||||
 | 
					    if (timeShiftActive && timeShiftFramesTotal > 0) {
 | 
				
			||||||
 | 
					        totalLength = timeShiftFramesTotal;
 | 
				
			||||||
 | 
					        recordingLength = timeShiftLength;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    double rest = (double)(totalLength - current) / (double)totalLength;
 | 
				
			||||||
 | 
					    time_t end = time(0) + rest*recordingLength;
 | 
				
			||||||
    string endTime = *TimeString(end);
 | 
					    string endTime = *TimeString(end);
 | 
				
			||||||
    if (!endTime.compare(endLast)) {
 | 
					    if (!endTime.compare(endLast)) {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
@@ -246,9 +267,15 @@ void cDisplayReplayView::DrawEndTime(int current, int total) {
 | 
				
			|||||||
void cDisplayReplayView::DrawProgressBar(int current, int total) {
 | 
					void cDisplayReplayView::DrawProgressBar(int current, int total) {
 | 
				
			||||||
    map < string, string > stringTokens;
 | 
					    map < string, string > stringTokens;
 | 
				
			||||||
    map < string, int > intTokens;
 | 
					    map < string, int > intTokens;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    intTokens.insert(pair<string,int>("current", current));
 | 
					    intTokens.insert(pair<string,int>("current", current));
 | 
				
			||||||
    intTokens.insert(pair<string,int>("total", total));
 | 
					    intTokens.insert(pair<string,int>("total", total));
 | 
				
			||||||
    stringTokens.insert(pair<string,string>("dummy", ""));
 | 
					    intTokens.insert(pair<string,int>("timeshift", timeShiftActive));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (timeShiftActive) {
 | 
				
			||||||
 | 
					        intTokens.insert(pair<string,int>("timeshifttotal", timeShiftFramesTotal));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ClearViewElement(veRecProgressBar);
 | 
					    ClearViewElement(veRecProgressBar);
 | 
				
			||||||
    DrawViewElement(veRecProgressBar, &stringTokens, &intTokens);    
 | 
					    DrawViewElement(veRecProgressBar, &stringTokens, &intTokens);    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -264,7 +291,10 @@ void cDisplayReplayView::DrawMarks(const cMarks *marks, int current, int total)
 | 
				
			|||||||
    map < string, vector< map< string, string > > > loopTokens;
 | 
					    map < string, vector< map< string, string > > > loopTokens;
 | 
				
			||||||
    vector< map< string, string > > markTokens;
 | 
					    vector< map< string, string > > markTokens;
 | 
				
			||||||
    stringstream tot;
 | 
					    stringstream tot;
 | 
				
			||||||
    tot << total;
 | 
					    if (!timeShiftActive)
 | 
				
			||||||
 | 
					        tot << total;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        tot << timeShiftFramesTotal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bool isStartMark = true;
 | 
					    bool isStartMark = true;
 | 
				
			||||||
    for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
 | 
					    for (const cMark *m = marks->First(); m; m = marks->Next(m)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,10 @@
 | 
				
			|||||||
class cDisplayReplayView : public cView, public cViewHelpers {
 | 
					class cDisplayReplayView : public cView, public cViewHelpers {
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    int length;
 | 
					    int length;
 | 
				
			||||||
 | 
					    bool timeShiftActive;
 | 
				
			||||||
 | 
					    int timeShiftFramesTotal;
 | 
				
			||||||
 | 
					    int timeShiftLength;
 | 
				
			||||||
 | 
					    string timeShiftDuration;
 | 
				
			||||||
    string endLast;
 | 
					    string endLast;
 | 
				
			||||||
    cDisplayReplayOnPauseView *onPauseView;
 | 
					    cDisplayReplayOnPauseView *onPauseView;
 | 
				
			||||||
    int numMarksLast;
 | 
					    int numMarksLast;
 | 
				
			||||||
@@ -20,6 +24,7 @@ public:
 | 
				
			|||||||
    virtual ~cDisplayReplayView();
 | 
					    virtual ~cDisplayReplayView();
 | 
				
			||||||
    bool createOsd(void);
 | 
					    bool createOsd(void);
 | 
				
			||||||
    void SetRecordingLength(int length) { this->length = length; };
 | 
					    void SetRecordingLength(int length) { this->length = length; };
 | 
				
			||||||
 | 
					    void SetTimeShift(int framesTotal, int timeShiftLength);
 | 
				
			||||||
    void DrawBackground(bool modeOnly);
 | 
					    void DrawBackground(bool modeOnly);
 | 
				
			||||||
    void DrawDate(void);
 | 
					    void DrawDate(void);
 | 
				
			||||||
    void DrawTime(void);
 | 
					    void DrawTime(void);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user