diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2005-01-05 10:48:22 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2005-01-05 10:48:22 +0100 |
commit | 42ab8c87973f2d7549ac939fc991138ed1ec537c (patch) | |
tree | 1cc2ae3fa97d84e6e5b02fc08b3557bfde610403 /device.c | |
parent | da59a45f6177a2c16993a6b19890255e4a6e9219 (diff) | |
download | vdr-42ab8c87973f2d7549ac939fc991138ed1ec537c.tar.gz vdr-42ab8c87973f2d7549ac939fc991138ed1ec537c.tar.bz2 |
Implemented preferred audio languages
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -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 |