Hearing-impaired DVB subtitles

Message ID 47D1628F.5040600@cadsoft.de
State New
Headers

Commit Message

Klaus Schmidinger March 7, 2008, 3:43 p.m. UTC
  On 03/07/08 12:26, Rolf Ahrenberg wrote:
> On Thu, 6 Mar 2008, Klaus Schmidinger wrote:
> 
>> None of these two is specified as "for the hard of hearing".
> 
> Well, as Jouni already told, the Dutch is used here on YLE channels for 
> hard of hearing purposes. :)
> 
>> Maybe this is what's causing the problems here. While this makes sense for
>> audio, it might not be that useful for subtitles. I guess some change in
>> cDevice::EnsureSubtitleTrack() needs to be done to fix this.
> 
> I guess this kind of small change would be enough. IMO, the subtitles 
> should be shown only if a preferred language matches.
> 
> --- device.c.orig       2008-03-07 13:18:09.000000000 +0200
> +++ device.c    2008-03-07 13:18:49.000000000 +0200
> @@ -1096,7 +1096,7 @@
>   void cDevice::EnsureSubtitleTrack(void)
>   {
>     if (Setup.DisplaySubtitles) {
> -     eTrackType PreferredTrack = ttSubtitleFirst;
> +     eTrackType PreferredTrack = ttNone;
>        int LanguagePreference = -1;
>        for (int i = ttSubtitleFirst; i <= ttSubtitleLast; i++) {
>            const tTrackId *TrackId = GetTrack(eTrackType(i));

Actually I believe we also need to initialize LanguagePreference to a "high value".
The full patch I'll add for version 1.6.0 is this:


With this, if I set the preferred subtitle language to Finnish (suomi),
Petri's example works as expected: the narrator is not subtitled, while the
woman is.

Please verify and let me know if this works for you, too - and doesn't
break anything else.

Klaus
  

Patch

--- device.c    2008/02/23 13:09:01     1.155
+++ device.c    2008/03/07 15:26:23
@@ -1096,8 +1096,8 @@ 
 void cDevice::EnsureSubtitleTrack(void)
 {
   if (Setup.DisplaySubtitles) {
-     eTrackType PreferredTrack = ttSubtitleFirst;
-     int LanguagePreference = -1;
+     eTrackType PreferredTrack = ttNone;
+     int LanguagePreference = INT_MAX; // higher than the maximum possible value
      for (int i = ttSubtitleFirst; i <= ttSubtitleLast; i++) {
          const tTrackId *TrackId = GetTrack(eTrackType(i));
          if (TrackId && TrackId->id && I18nIsPreferredLanguage(Setup.SubtitleLanguages, TrackId->language, LanguagePreference))