[vdr] Bug in audio track replaing

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Sun Oct 8 10:53:43 CEST 2006

Klaus Schmidinger wrote:
> Boguslaw Juza wrote:
>> On Sat, 7 Oct 2006, Klaus Schmidinger wrote:
>>> Klaus Schmidinger wrote:
>>> ...
>>> Actually here's a more elaborate patch.
>>> It also explicitly checks for the audio stream.
>>> Wouldn't make a difference right now, but if we have more
>>> streams later, it might be necessary.
>> There is no correct still, but something changes:
>> At channel:
>> CYFRA+ 
>> RADIO:10892:h:S13.0E:27500:0:116=PR1,117=PR2,118=PR3,115=BIS,123=ZET,122=
>> RAD,124=PIN,121=TOK,120=JAZ,126=ANT:0:100:4841:318:11900:0
>> after recording and replaying name of first track was replaced from 
>> "PR1" to "pol", but there was no shift - PR2 still was PR2, etc...
> The "pol" comes from the language code in the event's stream component
> descriptor, which takes precedence over the pid's language code.
>> At channel:
>> XtraMusicPop:11278:v:S13.0E:27500:0:611=A 1,612=A 2,613=A 3,614=A 
>> 4,615=A 5,616=A 6,617=A 7,618=A 8,619=A 9,620=A10:0:100:13042:318:400:0
>> is smillar, but "A " is eaten - so, while replaying, there are 
>> avaliable tracks: "pol", "2", "3", ..., "A10"
> The problem here are the blanks on the "language codes", which
> cause tComponent::FromString() to split "A 1" into a language code
> of "A" and a description of "1".

Please try the attached replacement for I18nNormalizeLanguageCode()
(this is not a patch, but the complete function).

Let me know if this works for you, so I can include it in the
next maintenance patch.

-------------- next part --------------
const char *I18nNormalizeLanguageCode(const char *Code)
  for (int i = 0; i < 3; i++) {
      if (Code[i]) {
         // ETSI EN 300 468 defines language codes as consisting of three letters
         // according to ISO 639-2. This means that they are supposed to always consist
         // of exactly three letters in the range a-z - no digits, UTF-8 or other
         // funny characters. However, some broadcasters apparently don't have a
         // copy of the DVB standard (or they do, but are perhaps unable to read it),
         // so they put all sorts of non-standard stuff into the language codes,
         // like nonsense as "2ch" or "A 1" (yes, they even go as far as using
         // blanks!). Such things should go into the description of the EPG event's
         // ComponentDescriptor.
         // So, as a workaround for this broadcaster stupidity, let's ignore
         // language codes with unprintable characters...
         if (!isprint(Code[i])) {
            //dsyslog("invalid language code: '%s'", Code);
            return "???";
         // ...and replace blanks with underlines (ok, this breaks the 'const'
         // of the Code parameter - but hey, it's them who started this):
         if (Code[i] == ' ')
            *((char *)&Code[i]) = '_';
  int n = I18nLanguageIndex(Code);
  return n >= 0 ? I18nLanguageCode(n) : Code;

More information about the vdr mailing list