vdr-plugin-skindesigner/displayreplay.c

111 lines
2.8 KiB
C
Raw Permalink Normal View History

2014-09-27 09:25:14 +02:00
#define __STL_CONFIG_H
#include <vdr/player.h>
2014-09-27 09:25:14 +02:00
#include "displayreplay.h"
cSDDisplayReplay::cSDDisplayReplay(cTemplate *replayTemplate, bool ModeOnly) {
doOutput = true;
initial = true;
modeOnly = ModeOnly;
replayView = NULL;
2014-09-27 09:25:14 +02:00
if (!replayTemplate) {
doOutput = false;
esyslog("skindesigner: displayReplay no valid template - aborting");
return;
}
replayView = new cDisplayReplayView(replayTemplate->GetRootView());
if (!replayView->createOsd()) {
doOutput = false;
return;
}
}
cSDDisplayReplay::~cSDDisplayReplay() {
if (replayView)
delete replayView;
2014-09-27 09:25:14 +02:00
}
void cSDDisplayReplay::SetRecording(const cRecording *Recording) {
2015-02-01 14:45:33 +01:00
if (!doOutput || !Recording)
2014-09-27 09:25:14 +02:00
return;
if (initial)
replayView->SetRecordingLength(Recording->LengthInSeconds());
2014-09-27 09:25:14 +02:00
replayView->DrawTitle(Recording);
replayView->DrawRecordingInformation(Recording);
replayView->DrawScraperContent(Recording);
}
2015-02-01 14:45:33 +01:00
void cSDDisplayReplay::SetTitle(const char *Title) {
if (!doOutput || !Title)
return;
replayView->DrawTitle(Title);
}
2014-09-27 09:25:14 +02:00
void cSDDisplayReplay::SetMode(bool Play, bool Forward, int Speed) {
if (!doOutput)
return;
if (!Play && Speed < 0) {
string recFileName = "";
cControl *control = cControl::Control();
if (control) {
const cRecording *recording = control->GetRecording();
if (recording && recording->FileName())
recFileName = recording->FileName();
}
replayView->DrawOnPause(recFileName, modeOnly);
} else {
replayView->ClearOnPause();
}
2014-09-27 09:25:14 +02:00
replayView->DrawControlIcons(Play, Forward, Speed, modeOnly);
}
void cSDDisplayReplay::SetProgress(int Current, int Total) {
if (!doOutput)
return;
replayView->DelayOnPause();
2014-09-27 09:25:14 +02:00
replayView->DrawProgressBar(Current, Total);
2014-10-28 18:09:10 +01:00
replayView->DrawMarks(marks, Current, Total);
replayView->DrawEndTime(Current, Total);
2014-09-27 09:25:14 +02:00
}
void cSDDisplayReplay::SetCurrent(const char *Current) {
if (!doOutput)
return;
replayView->DrawCurrent(Current);
}
void cSDDisplayReplay::SetTotal(const char *Total) {
if (!doOutput)
return;
replayView->DrawTotal(Total);
}
void cSDDisplayReplay::SetJump(const char *Jump) {
if (!doOutput)
return;
replayView->DrawJump(Jump);
}
void cSDDisplayReplay::SetMessage(eMessageType Type, const char *Text) {
if (!doOutput)
return;
replayView->DrawMessage(Type, Text);
}
void cSDDisplayReplay::Flush(void) {
if (!doOutput)
return;
2015-01-06 06:07:48 +01:00
if (!modeOnly) {
replayView->DrawDate();
replayView->DrawTime();
}
2014-09-27 09:25:14 +02:00
if (initial) {
replayView->DrawBackground(modeOnly);
replayView->DrawCustomTokens();
2014-09-27 09:25:14 +02:00
replayView->DoFadeIn();
initial = false;
} else {
replayView->Flush();
}
}