summaryrefslogtreecommitdiff
path: root/display.c
diff options
context:
space:
mode:
authorAndreas Brugger <brougs78@gmx.net>2005-11-19 12:00:00 +0100
committerThomas Günther <tom@toms-cafe.de>2009-06-03 01:03:47 +0200
commit662dd62488f6f842fe5d940e986f798abe1c7691 (patch)
tree0406592c45332e6ba26ed63f3bff91ab42d30b4a /display.c
parent71023584dc849dc3705c6db303878fd27e8704c7 (diff)
downloadvdr-plugin-text2skin-662dd62488f6f842fe5d940e986f798abe1c7691.tar.gz
vdr-plugin-text2skin-662dd62488f6f842fe5d940e986f798abe1c7691.tar.bz2
2005-11-19: Version 1.1-cvs_ext-0.2 (vdr-text2skin-1.1-cvs_ext-0.2.diff)
- removed the previously introduced tokens NextTimerName, NextTimerStart, NextTimerChannel, CurrentRecordingsCount and added tokens for the next 3 timers: CurrentEventsTitle[123], CurrentEventsStartDateTime[123], CurrentEventsStopDateTime[123], CurrentEventsChannelNumber[123], CurrentEventsChannelName[123], CurrentEventsIsRecording[123] - added audio- and video-tokens: PresentLanguageCode, PresentLanguageDescription, PresentVideoAR and implemented the missing code for the Language-token - added tokens for replay: ReplayName, ReplayDateTime, ReplayShortText, ReplayDescription, ReplayLanguageCode, ReplayLanguageDescription, ReplayVideoAR (not activated yet) - additional recording-tokens: RecordingVideoAR, RecordingSize - added a reset for scrolling text (configurable) - included Text2skin.diff from the rotor-plugin
Diffstat (limited to 'display.c')
-rw-r--r--display.c222
1 files changed, 206 insertions, 16 deletions
diff --git a/display.c b/display.c
index a8fca2c..72b42cd 100644
--- a/display.c
+++ b/display.c
@@ -243,7 +243,16 @@ cxType cText2SkinDisplayChannel::GetTokenData(const txToken &Token)
case tLanguage: {
#if VDRVERSNUM >= 10318
- // TODO !!!
+ cDevice *dev = cDevice::PrimaryDevice();
+ eTrackType trackType = dev->GetCurrentAudioTrack();
+ const tTrackId *track = dev->GetTrack(trackType);
+ if (track)
+ {
+ std::string buffer(track->language);
+ if (trackType >= ttDolby) buffer.append("DD");
+ return (cxType)buffer.c_str();
+ }
+ return (cxType)false;
#else
int cur;
const char **tracks = cDevice::PrimaryDevice()->GetAudioTracks(&cur);
@@ -584,6 +593,32 @@ cxType cText2SkinDisplayReplay::GetTokenData(const txToken &Token)
}
return false;
+ case tLanguage: {
+#if VDRVERSNUM >= 10318
+ cDevice *dev = cDevice::PrimaryDevice();
+ eTrackType trackType = dev->GetCurrentAudioTrack();
+ const tTrackId *track = dev->GetTrack(trackType);
+ if (track)
+ {
+ std::string buffer(track->language);
+ if (trackType >= ttDolby) buffer.append("DD");
+ return (cxType)buffer.c_str();
+ }
+ return (cxType)false;
+#else
+ int cur;
+ const char **tracks = cDevice::PrimaryDevice()->GetAudioTracks(&cur);
+ if (tracks) {
+ int i = 0;
+ while (tracks[i] != NULL)
+ ++i;
+ if (cur < i)
+ return tracks[cur];
+ }
+#endif
+ }
+ return false;
+
case tMessage:
return mText;
@@ -757,6 +792,9 @@ void cText2SkinDisplayMenu::SetTitle(const char *Title)
UpdateLock();
if (Title == NULL) Title = "";
if (mTitle != Title) {
+ mUpdate.timerConflict = true;
+ mUpdate.events = true;
+ mUpdate.resetMarquee = true;
mTitle = Title;
SetDirty();
}
@@ -1051,7 +1089,74 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token)
return mEvent != NULL
? (cxType)mEvent->Description()
: (cxType)false;
-
+
+ case tPresentLanguageCode:
+ if (mEvent)
+ {
+ const cComponents *components = mEvent->Components();
+ if (components)
+ {
+ int index = Token.Attrib.Number;
+
+ // don't return language-code for the video-stream
+ for (int i = 0; i < components->NumComponents(); i++)
+ {
+ const tComponent *c = components->Component(i);
+ if (c->stream != 2) index++; // only audio-streams
+ if (i == index)
+ {
+ std::string buffer(c->language);
+ if (c->type == 1) buffer.append("MONO");
+ if (c->type == 2) buffer.append("DUAL");
+ if (c->type == 5) buffer.append("DD");
+ return (cxType)buffer.c_str();
+ }
+ }
+ }
+ }
+ return false;
+
+ case tPresentLanguageDescription:
+ if (mEvent)
+ {
+ const cComponents *components = mEvent->Components();
+ if (components)
+ {
+ int index = Token.Attrib.Number;
+
+ // don't return language-code for the video-stream
+ for (int i = 0; i < components->NumComponents(); i++)
+ {
+ const tComponent *c = components->Component(i);
+ if (c->stream != 2) index++; // only audio-streams
+ if (i == index) return (cxType)c->description;
+ }
+ }
+ }
+ return false;
+
+ case tPresentVideoAR:
+ if (mEvent)
+ {
+ const cComponents *components = mEvent->Components();
+ if (components)
+ {
+ for (int i = 0; i < components->NumComponents(); i++)
+ {
+ const tComponent *c = components->Component(i);
+ if (c->stream == 1)
+ {
+ switch (c->type)
+ {
+ case 1: return "4:3";
+ case 3: return "16:9";
+ }
+ }
+ }
+ }
+ }
+ return false;
+
case tHasVPS:
case tChannelHasVPS:
return mEvent != NULL && mEvent->Vps() != 0;
@@ -1096,27 +1201,112 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token)
? (cxType)mRecording->Info()->Description()
: (cxType)false;
- case tRecordingLanguageCode:
- if (mRecording != NULL) {
- const tComponent *c
- = mRecording->Info()->Components()->Component(Token.Attrib.Number);
- return c != NULL
- ? (cxType)c->language
- : (cxType)false;
+ case tRecordingLanguageCode:
+ if (mRecording)
+ {
+ const cComponents *components = mRecording->Info()->Components();
+ if (components)
+ {
+ int index = Token.Attrib.Number;
+
+ // don't return language-code for the video-stream
+ for (int i = 0; i < components->NumComponents(); i++)
+ {
+ const tComponent *c = components->Component(i);
+ if (c->stream != 2) index++; // only audio-streams
+ if (i == index)
+ {
+ std::string buffer(c->language);
+ if (c->type == 1) buffer.append("MONO");
+ if (c->type == 2) buffer.append("DUAL");
+ if (c->type == 5) buffer.append("DD");
+ return (cxType)buffer.c_str();
+ }
+ }
+ }
}
return false;
-
+
case tRecordingLanguageDescription:
- if (mRecording != NULL) {
- const tComponent *c
- = mRecording->Info()->Components()->Component(Token.Attrib.Number);
- return c != NULL
- ? (cxType)c->description
- : (cxType)false;
+ if (mRecording)
+ {
+ const cComponents *components = mRecording->Info()->Components();
+ if (components)
+ {
+ int index = Token.Attrib.Number;
+
+ // don't return language-code for the video-stream
+ for (int i = 0; i < components->NumComponents(); i++)
+ {
+ const tComponent *c = components->Component(i);
+ if (c->stream != 2) index++; // only audio-streams
+ if (i == index) return (cxType)c->description;
+ }
+ }
+ }
+ return false;
+
+ case tRecordingVideoAR:
+ if (mRecording)
+ {
+ const cComponents *components = mRecording->Info()->Components();
+ if (components)
+ {
+ for (int i = 0; i < components->NumComponents(); i++)
+ {
+ const tComponent *c = components->Component(i);
+ if (c->stream == 1)
+ {
+ switch (c->type)
+ {
+ case 1: return "4:3";
+ case 3: return "16:9";
+ }
+ }
+ }
+ }
}
return false;
#endif
+ case tRecordingSize:
+ if (mRecording != NULL) {
+ bool bRet=false;
+ long long size = 0;
+ int nFiles;
+ struct stat fileinfo; // Holds file information structure
+ char *cmd = NULL;
+ cReadLine reader;
+ asprintf(&cmd, "find '%s' -follow -type f -name '*.*'|sort ", mRecording->FileName());
+
+ FILE *p = popen(cmd, "r");
+ int ret=0;
+ if (p)
+ {
+ char *s;
+
+ while ((s = reader.Read(p)) != NULL)
+ {
+ if ((ret=stat(s, &fileinfo)) != -1)
+ {
+ size += (long long)fileinfo.st_size;
+ nFiles++;
+ }
+ }
+
+ bRet=true;
+ }
+
+ pclose(p);
+ delete cmd;
+
+ return (long)(size / 1024 / 1024); // [MB]
+ }
+ else
+ {
+ return false;
+ }
+
default:
return cText2SkinRender::GetTokenData(Token);
}