[Approved] Fix for TV4 Science Fiction no def subtitle language (1 Viewer)

jblomb

Retired Team Member
  • Premium Supporter
  • May 17, 2007
    96
    17
    Sundsvall
    Home Country
    Sweden Sweden
    On TV4 Science Fiction I have noticed that every time I watch the channel I have to manually select subtitle page 890 to display subtitles, although I have selected swe as the default language. I finally decided to look into the problem and here are my findings:

    In the logs I noticed:

    Code:
    2010-03-09 10:00:06.290290 [Debug][(10)]: Page 90 is of type 2 and in lang swe
    2010-03-09 10:00:06.293290 [Debug][(10)]: Page 91 is of type 2 and in lang nor
    2010-03-09 10:00:06.294290 [Debug][(10)]: Page 92 is of type 2 and in lang dan

    ...but page 90-92 are not valid pages. They are supposed to be 890-892.
    Took some time to figure it out..

    in TsReader/PmtParser:
    Code:
    int teletext_magazine_number = (b3 & 0x07); // last(lsb) 3 bits
    
    int teletext_page_number = (section.Data[pointer + varBytes*j + 6]);
    
    int real_page_tens  = (teletext_page_number & 0xF0) >> 4;
    int real_page_units = teletext_page_number & 0x0F;
    
    int real_page = teletext_magazine_number*100 + real_page_tens*10 + real_page_units;

    There you can see that magazine number can be 0-7. BUT in the ETS specification it states that:
    "Magazine number 8: A packet with a magazine value of 0 is referred to as belonging to magazine 8."

    Add something like if (teletext_magazine_number == 0) teletext_magazine_number=8;
    ...and it's working again. :D

    log after patch:
    Code:
    2010-03-09 10:40:48.276963 [Debug][(10)]: Page 890 is of type 2 and in lang swe
    2010-03-09 10:40:48.278964 [Debug][(10)]: Page 891 is of type 2 and in lang nor
    2010-03-09 10:40:48.279964 [Debug][(10)]: Page 892 is of type 2 and in lang dan

    Attached is a patch for TsReader.

    :D for a great program!!
     

    Attachments

    • Fix for default subtitle page 800-899.diff
      30.7 KB

    jblomb

    Retired Team Member
  • Premium Supporter
  • May 17, 2007
    96
    17
    Sundsvall
    Home Country
    Sweden Sweden
    Another approach is to leave TsReader alone, and patch Core/Player/TeletextSubtitles/TeletextMagazine.cs instead.
    Code:
    if (page < 100) page += 800;
    To me this solution seems safer, but might not solve everything.
    It will solve all problems with subtitles mentioned in the first post though.

    Regards
    Blomman

    EDIT: New corrected patchfile
     

    Attachments

    • 800-899 subtitle core.dll v2.diff
      30.7 KB

    Mr Hipp

    Retired Team Member
  • Premium Supporter
  • April 2, 2006
    1,261
    188
    56
    Malmö
    Home Country
    Sweden Sweden
    Blomman - have you done any analysis of the impact not updating tsreader.
     

    jblomb

    Retired Team Member
  • Premium Supporter
  • May 17, 2007
    96
    17
    Sundsvall
    Home Country
    Sweden Sweden
    Nope. I had a hard time figuring out how things are connected, and I KNOW I haven't figured everything out :)
    That's why I thought it might be safer to patch TeletextMagazine.cs instead, but I doubt it would be any problem patching TsReader.
     

    Users who are viewing this thread

    Top Bottom