summaryrefslogtreecommitdiff
path: root/display.c
diff options
context:
space:
mode:
Diffstat (limited to 'display.c')
-rw-r--r--display.c201
1 files changed, 185 insertions, 16 deletions
diff --git a/display.c b/display.c
index c274080..227b41a 100644
--- a/display.c
+++ b/display.c
@@ -241,7 +241,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);
@@ -582,6 +591,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;
@@ -755,6 +790,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();
}
@@ -1049,7 +1087,76 @@ cxType cText2SkinDisplayMenu::GetTokenData(const txToken &Token)
return mEvent != NULL
? (cxType)mEvent->Description()
: (cxType)false;
-
+
+#if VDRVERSNUM >= 10318
+ 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;
+#endif
+
case tHasVPS:
case tChannelHasVPS:
return mEvent != NULL && mEvent->Vps() != 0;
@@ -1094,27 +1201,89 @@ 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:
+ return mRecording != NULL
+ ? (cxType)GetRecordingSize(mRecording->FileName())
+ : (cxType)false;
+
+ case tRecordingLength:
+ return mRecording != NULL
+ ? (cxType)GetRecordingLength(mRecording->FileName())
+ : (cxType)false;
+
+ case tRecordingCuttedLength:
+ return mRecording != NULL
+ ? (cxType)GetRecordingCuttedLength(mRecording->FileName())
+ : (cxType)false;
+
default:
return cText2SkinRender::GetTokenData(Token);
}