Ticket #1581: pro7_encoding_fix2.patch
File pro7_encoding_fix2.patch, 5.5 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/siparser.cpp
1028 1028 #ifdef USING_DVB_EIT 1029 1029 uint bestPrioritySE = UINT_MAX; 1030 1030 uint bestPriorityEE = UINT_MAX; 1031 unsigned char enc[1] = {'0x05'}; 1031 1032 1032 1033 for (uint i = 0; i < eit->EventCount(); i++) 1033 1034 { … … 1089 1090 } 1090 1091 1091 1092 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(); 1093 1104 } 1094 1105 1095 1106 // Parse short event descriptor for the most preferred language … … 1097 1108 { 1098 1109 ShortEventDescriptor sed(bestDescriptorSE); 1099 1110 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 } 1102 1126 if (event.Event_Subtitle == event.Event_Name) 1103 1127 event.Event_Subtitle = ""; 1104 1128 } -
libs/libmythtv/mpeg/dvbdescriptors.cpp
63 63 } 64 64 65 65 // Decode a text string according to ETSI EN 300 468 Annex A 66 QString dvb_decode_text(const unsigned char *src, uint raw_length )66 QString dvb_decode_text(const unsigned char *src, uint raw_length, const unsigned char * encoding, uint enc_length) 67 67 { 68 68 if (!raw_length) 69 69 return ""; … … 77 77 } 78 78 79 79 // Strip formatting characters 80 char dst[raw_length ];80 char dst[raw_length+enc_length]; 81 81 uint length = 0; 82 for (uint i = 0; i < raw_length; i++) 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 90 for (uint i = length; i < raw_length; i++) 83 91 { 84 92 if ((src[i] < 0x80) || (src[i] > 0x9F)) 85 93 { … … 97 105 if (buf[0] >= 0x20) 98 106 { 99 107 return decode_iso6937((unsigned char*)buf, length); 108 //return QString::fromLatin1(buf, length); 100 109 } 101 110 else if ((buf[0] >= 0x01) && (buf[0] <= 0x0B)) 102 111 { -
libs/libmythtv/mpeg/dvbdescriptors.h
38 38 39 39 static QString coderate_inner(uint coderate); 40 40 41 extern QString dvb_decode_text(const unsigned char *src, uint length); 41 extern QString dvb_decode_text(const unsigned char *src, uint length, 42 const unsigned char * encoding=NULL, 43 uint enc_length=0); 42 44 43 45 #define byteBCDH2int(i) (i >> 4) 44 46 #define byteBCDL2int(i) (i & 0x0f) … … 825 827 // for (i=0; i<N; i++) { text_char 8 } 826 828 QString Text(void) const 827 829 { 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 } 828 834 QString toString() const { return QString("ExtendedEventDescriptor(stub)"); } 829 835 }; 830 836 … … 1231 1237 // for (i=0;i<event_name_length;i++) { event_name_char 8 } 1232 1238 QString EventName(void) const 1233 1239 { 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); } 1234 1242 // text_length 8 1235 1243 uint TextLength(void) const { return _data[6 + _data[5]]; } 1236 1244 // for (i=0;i<text_length;i++) { text_char 8 } 1237 1245 QString Text(void) const 1238 1246 { 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); } 1239 1249 1240 1250 QString toString() const 1241 1251 { return LanguageString() + " : " + EventName() + " : " + Text(); }