Ticket #1581: pro7_encoding_fix3.patch

File pro7_encoding_fix3.patch, 5.5 KB (added by Janne <janne-mythtv@…>, 20 years ago)

attached wrong file while creating the ticket

  • libs/libmythtv/siparser.cpp

     
    10281028#ifdef USING_DVB_EIT
    10291029    uint bestPrioritySE   = UINT_MAX;
    10301030    uint bestPriorityEE   = UINT_MAX;
     1031    unsigned char enc[1] = {0x05};
    10311032
    10321033    for (uint i = 0; i < eit->EventCount(); i++)
    10331034    {
     
    10891090            }
    10901091
    10911092            ExtendedEventDescriptor eed(bestDescriptorsEE[j]);
    1092             event.Description += eed.Text();
     1093            // just hardcoded values for fixing Pro7Sat.1 EPG
     1094            if ((event.NetworkID == 8468) && (event.TransportID == 769))
     1095            {
     1096                event.Description += eed.TextByEncoding(enc, 1);
     1097                VERBOSE(VB_EIT, "SIParser: Fixing wrong character encoding for event on " +
     1098                        QString("ServiceID: %1 TransportID: %2 NetworkID: %3")
     1099                        .arg(event.ServiceID).arg(event.TransportID)
     1100                        .arg(event.NetworkID));
     1101            }
     1102            else
     1103                event.Description += eed.Text();
    10931104        }
    10941105
    10951106        // Parse short event descriptor for the most preferred language
     
    10971108        {
    10981109            ShortEventDescriptor sed(bestDescriptorSE);
    10991110            event.LanguageCode    = sed.CanonicalLanguageString();
    1100             event.Event_Name      = sed.EventName();
    1101             event.Event_Subtitle  = sed.Text();
     1111            // just hardcoded values for fixing Pro7Sat.1 EPG
     1112            if ((event.NetworkID == 8468) && (event.TransportID == 769))
     1113            {
     1114                event.Event_Name      = sed.EventNameByEncoding(enc, 1);
     1115                event.Event_Subtitle  = sed.TextByEncoding(enc, 1);
     1116                VERBOSE(VB_EIT, "SIParser: Fixing wrong character encoding for event on " +
     1117                        QString("ServiceID: %1 TransportID: %2 NetworkID: %3")
     1118                        .arg(event.ServiceID).arg(event.TransportID)
     1119                        .arg(event.NetworkID));
     1120            }
     1121            else
     1122            {
     1123                event.Event_Name      = sed.EventName();
     1124                event.Event_Subtitle  = sed.Text();
     1125            }
    11021126            if (event.Event_Subtitle == event.Event_Name)
    11031127                event.Event_Subtitle = "";
    11041128        }
  • libs/libmythtv/mpeg/dvbdescriptors.cpp

     
    6363}
    6464
    6565// Decode a text string according to ETSI EN 300 468 Annex A
    66 QString dvb_decode_text(const unsigned char *src, uint raw_length)
     66QString dvb_decode_text(const unsigned char *src, uint raw_length, const unsigned char * encoding, uint enc_length)
    6767{
    6868    if (!raw_length)
    6969        return "";
     
    7777    }
    7878
    7979    // Strip formatting characters
    80     char dst[raw_length];
     80    char dst[raw_length+enc_length];
    8181    uint length = 0;
     82    // if a override encoding is specified copy it in front of the text
     83    if (encoding)
     84        for (uint i = 0; i < enc_length; i++)
     85        {
     86            dst[length] = encoding[i];
     87            length++;
     88        }
     89   
    8290    for (uint i = 0; i < raw_length; i++)
    8391    {
    8492        if ((src[i] < 0x80) || (src[i] > 0x9F))
     
    97105    if (buf[0] >= 0x20)
    98106    {
    99107        return decode_iso6937((unsigned char*)buf, length);
     108        //return QString::fromLatin1(buf, length);
    100109    }
    101110    else if ((buf[0] >= 0x01) && (buf[0] <= 0x0B))
    102111    {
  • libs/libmythtv/mpeg/dvbdescriptors.h

     
    3838
    3939static QString coderate_inner(uint coderate);
    4040
    41 extern QString dvb_decode_text(const unsigned char *src, uint length);
     41extern QString dvb_decode_text(const unsigned char *src, uint length,
     42                               const unsigned char * encoding=NULL,
     43                               uint enc_length=0);
    4244
    4345#define byteBCDH2int(i) (i >> 4)
    4446#define byteBCDL2int(i) (i & 0x0f)
     
    825827    // for (i=0; i<N; i++) { text_char 8 }
    826828    QString Text(void) const
    827829        { return dvb_decode_text(&_data[8 + _data[6]], TextLength()); }
     830    QString TextByEncoding(const unsigned char * encoding, uint length) const
     831        { return dvb_decode_text(&_data[8 + _data[6]], TextLength(), encoding,
     832                                 length);
     833        }
    828834    QString toString() const { return QString("ExtendedEventDescriptor(stub)"); }
    829835};
    830836
     
    12311237    // for (i=0;i<event_name_length;i++) { event_name_char 8 }
    12321238    QString EventName(void) const
    12331239        { return dvb_decode_text(&_data[6], _data[5]); }
     1240    QString EventNameByEncoding(const unsigned char * encoding, uint length) const
     1241        { return dvb_decode_text(&_data[6], _data[5], encoding, length); }
    12341242    // text_length              8
    12351243    uint TextLength(void) const { return _data[6 + _data[5]]; }
    12361244    // for (i=0;i<text_length;i++) { text_char 8 }
    12371245    QString Text(void) const
    12381246        { return dvb_decode_text(&_data[7 + _data[5]], TextLength()); }
     1247    QString TextByEncoding(const unsigned char * encoding, uint length) const
     1248        { return dvb_decode_text(&_data[7 + _data[5]], TextLength(), encoding, length); }
    12391249
    12401250    QString toString() const
    12411251        { return LanguageString() + " : " + EventName() + " : " + Text(); }