summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-01-05 10:48:22 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2005-01-05 10:48:22 +0100
commit42ab8c87973f2d7549ac939fc991138ed1ec537c (patch)
tree1cc2ae3fa97d84e6e5b02fc08b3557bfde610403
parentda59a45f6177a2c16993a6b19890255e4a6e9219 (diff)
downloadvdr-42ab8c87973f2d7549ac939fc991138ed1ec537c.tar.gz
vdr-42ab8c87973f2d7549ac939fc991138ed1ec537c.tar.bz2
Implemented preferred audio languages
-rw-r--r--HISTORY3
-rw-r--r--MANUAL9
-rw-r--r--config.c5
-rw-r--r--config.h3
-rw-r--r--device.c15
-rw-r--r--menu.c54
6 files changed, 80 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index 94c5dbf7..b3a3d6da 100644
--- a/HISTORY
+++ b/HISTORY
@@ -3266,3 +3266,6 @@ Video Disk Recorder Revision History
- Skins need to implement the new cSkinDisplayTrack class to display the audio
track menu.
- Fixed reusing OSD in cDvbSpuDecoder (thanks to Reinhard Nissl).
+- The new setup option "DVB/Audio languages" can be used to control which audio
+ language shall be selected in case a channel broadcasts in different languages
+ (see MANUAL for details).
diff --git a/MANUAL b/MANUAL
index 4125fe70..51780880 100644
--- a/MANUAL
+++ b/MANUAL
@@ -580,6 +580,15 @@ Version 1.2
updates and also add newly found channels, and '4' will
also add newly found transponders.
+ Audio languages = 0 Some tv stations broadcast various audio tracks in different
+ languages. This option allows you to define which language(s)
+ you prefer in such cases. By default, or if none of the
+ preferred languages is broadcast, the first audio track will
+ be selected when switching to such a channel. If this option
+ is set to a non-zero value, the menu page will contain that
+ many "Audio language" options which allow you to select the
+ individual preferred languages.
+
LNB:
SLOF = 11700 The switching frequency (in MHz) between low and
diff --git a/config.c b/config.c
index 36ecb126..eb182154 100644
--- a/config.c
+++ b/config.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.128 2004/10/31 16:17:39 kls Exp $
+ * $Id: config.c 1.129 2005/01/04 13:48:49 kls Exp $
*/
#include "config.h"
@@ -262,6 +262,7 @@ cSetup::cSetup(void)
TimeTransponder = 0;
MarginStart = 2;
MarginStop = 10;
+ AudioLanguages[0] = -1;
EPGLanguages[0] = -1;
EPGScanTimeout = 5;
EPGBugfixLevel = 2;
@@ -415,6 +416,7 @@ bool cSetup::Parse(const char *Name, const char *Value)
else if (!strcasecmp(Name, "TimeTransponder")) TimeTransponder = atoi(Value);
else if (!strcasecmp(Name, "MarginStart")) MarginStart = atoi(Value);
else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value);
+ else if (!strcasecmp(Name, "AudioLanguages")) return ParseLanguages(Value, AudioLanguages);
else if (!strcasecmp(Name, "EPGLanguages")) return ParseLanguages(Value, EPGLanguages);
else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value);
else if (!strcasecmp(Name, "EPGBugfixLevel")) EPGBugfixLevel = atoi(Value);
@@ -475,6 +477,7 @@ bool cSetup::Save(void)
Store("TimeTransponder", TimeTransponder);
Store("MarginStart", MarginStart);
Store("MarginStop", MarginStop);
+ StoreLanguages("AudioLanguages", AudioLanguages);
StoreLanguages("EPGLanguages", EPGLanguages);
Store("EPGScanTimeout", EPGScanTimeout);
Store("EPGBugfixLevel", EPGBugfixLevel);
diff --git a/config.h b/config.h
index d13ed2fc..4c7b4947 100644
--- a/config.h
+++ b/config.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.h 1.206 2004/11/22 16:49:39 kls Exp $
+ * $Id: config.h 1.207 2005/01/04 13:47:38 kls Exp $
*/
#ifndef __CONFIG_H
@@ -222,6 +222,7 @@ public:
int TimeSource;
int TimeTransponder;
int MarginStart, MarginStop;
+ int AudioLanguages[I18nNumLanguages + 1];
int EPGLanguages[I18nNumLanguages + 1];
int EPGScanTimeout;
int EPGBugfixLevel;
diff --git a/device.c b/device.c
index 3faefab3..a709a4c6 100644
--- a/device.c
+++ b/device.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: device.c 1.66 2005/01/04 13:13:24 kls Exp $
+ * $Id: device.c 1.67 2005/01/04 15:38:46 kls Exp $
*/
#include "device.h"
@@ -541,11 +541,24 @@ eSetChannelResult cDevice::SetChannel(const cChannel *Channel, bool LiveView)
if (Result == scrOk) {
if (LiveView && IsPrimaryDevice()) {
+ // Set the available audio tracks:
ClrAvailableTracks();
for (int i = 0; i < MAXAPIDS; i++) {
SetAvailableTrack(ttAudio, i, Channel->Apid(i), Channel->Alang(i));
SetAvailableTrack(ttDolby, i, Channel->Dpid(i), Channel->Dlang(i));
}
+ // Select the preferred audio track:
+ eTrackType PreferredTrack = ttAudioFirst;
+ int LanguagePreference = -1;
+ for (int i = ttAudioFirst; i <= ttDolbyLast; i++) {
+ const tTrackId *TrackId = GetTrack(eTrackType(i));
+ if (TrackId && TrackId->id && I18nIsPreferredLanguage(Setup.AudioLanguages, I18nLanguageIndex(TrackId->language), LanguagePreference))
+ PreferredTrack = eTrackType(i);
+ }
+ // Make sure we're set to an available audio track:
+ const tTrackId *Track = GetTrack(GetCurrentAudioTrack());
+ if (!Track || !Track->id || PreferredTrack != GetCurrentAudioTrack())
+ SetCurrentAudioTrack(PreferredTrack);
currentChannel = Channel->Number();
}
cStatus::MsgChannelSwitch(this, Channel->Number()); // only report status if channel switch successfull
diff --git a/menu.c b/menu.c
index 8582c47b..82fa59b4 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 1.327 2005/01/04 13:40:38 kls Exp $
+ * $Id: menu.c 1.328 2005/01/05 10:26:59 kls Exp $
*/
#include "menu.h"
@@ -1911,6 +1911,9 @@ eOSState cMenuSetupEPG::ProcessKey(eKeys Key)
class cMenuSetupDVB : public cMenuSetupBase {
private:
+ int originalNumAudioLanguages;
+ int numAudioLanguages;
+ void Setup(void);
const char *updateChannelsTexts[5];
public:
cMenuSetupDVB(void);
@@ -1919,6 +1922,9 @@ public:
cMenuSetupDVB::cMenuSetupDVB(void)
{
+ for (numAudioLanguages = 0; numAudioLanguages < I18nNumLanguages && data.AudioLanguages[numAudioLanguages] >= 0; numAudioLanguages++)
+ ;
+ originalNumAudioLanguages = numAudioLanguages;
updateChannelsTexts[0] = tr("no");
updateChannelsTexts[1] = tr("names only");
updateChannelsTexts[2] = tr("names and PIDs");
@@ -1926,22 +1932,58 @@ cMenuSetupDVB::cMenuSetupDVB(void)
updateChannelsTexts[4] = tr("add new transponders");
SetSection(tr("DVB"));
+ Setup();
+}
+
+void cMenuSetupDVB::Setup(void)
+{
+ int current = Current();
+
+ Clear();
+
Add(new cMenuEditIntItem( tr("Setup.DVB$Primary DVB interface"), &data.PrimaryDVB, 1, cDevice::NumDevices()));
Add(new cMenuEditBoolItem(tr("Setup.DVB$Video format"), &data.VideoFormat, "4:3", "16:9"));
Add(new cMenuEditStraItem(tr("Setup.DVB$Update channels"), &data.UpdateChannels, 5, updateChannelsTexts));
+ Add(new cMenuEditIntItem( tr("Setup.DVB$Audio languages"), &numAudioLanguages, 0, I18nNumLanguages));
+ for (int i = 0; i < numAudioLanguages; i++)
+ Add(new cMenuEditStraItem(tr("Setup.EPG$Audio language"), &data.AudioLanguages[i], I18nNumLanguages, I18nLanguages()));
+
+ SetCurrent(Get(current));
+ Display();
}
eOSState cMenuSetupDVB::ProcessKey(eKeys Key)
{
- int oldPrimaryDVB = Setup.PrimaryDVB;
- bool oldVideoFormat = Setup.VideoFormat;
+ int oldPrimaryDVB = ::Setup.PrimaryDVB;
+ bool oldVideoFormat = ::Setup.VideoFormat;
+ int oldnumAudioLanguages = numAudioLanguages;
eOSState state = cMenuSetupBase::ProcessKey(Key);
+ if (Key != kNone) {
+ if (numAudioLanguages != oldnumAudioLanguages) {
+ for (int i = oldnumAudioLanguages; i < numAudioLanguages; i++) {
+ data.AudioLanguages[i] = 0;
+ for (int l = 0; l < I18nNumLanguages; l++) {
+ int k;
+ for (k = 0; k < oldnumAudioLanguages; k++) {
+ if (data.AudioLanguages[k] == l)
+ break;
+ }
+ if (k >= oldnumAudioLanguages) {
+ data.AudioLanguages[i] = l;
+ break;
+ }
+ }
+ }
+ data.AudioLanguages[numAudioLanguages] = -1;
+ Setup();
+ }
+ }
if (state == osBack && Key == kOk) {
- if (Setup.PrimaryDVB != oldPrimaryDVB)
+ if (::Setup.PrimaryDVB != oldPrimaryDVB)
state = osSwitchDvb;
- if (Setup.VideoFormat != oldVideoFormat)
- cDevice::PrimaryDevice()->SetVideoFormat(Setup.VideoFormat);
+ if (::Setup.VideoFormat != oldVideoFormat)
+ cDevice::PrimaryDevice()->SetVideoFormat(::Setup.VideoFormat);
}
return state;
}