summaryrefslogtreecommitdiff
path: root/device.c
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 /device.c
parentda59a45f6177a2c16993a6b19890255e4a6e9219 (diff)
downloadvdr-42ab8c87973f2d7549ac939fc991138ed1ec537c.tar.gz
vdr-42ab8c87973f2d7549ac939fc991138ed1ec537c.tar.bz2
Implemented preferred audio languages
Diffstat (limited to 'device.c')
-rw-r--r--device.c15
1 files changed, 14 insertions, 1 deletions
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