Ticket #1420: mythtv_codec_chaching.patch
| File mythtv_codec_chaching.patch, 1.6 KB (added by , 20 years ago) |
|---|
-
libs/libmythtv/mpeg/dvbdescriptors.cpp
7 7 // Decode a text string according to ETSI EN 300 468 Annex A 8 8 QString dvb_decode_text(const unsigned char *src, uint length) 9 9 { 10 static QTextCodec * codecs[16]; 10 11 QString result; 11 12 12 13 if (!length) … … 30 31 } 31 32 else if ((buf[0] >= 0x01) && (buf[0] <= 0x0B)) 32 33 { 33 QString coding = "ISO8859-" + QString::number(4 + buf[0]); 34 QTextCodec *codec = QTextCodec::codecForName(coding); 35 result = codec->toUnicode((const char*)buf + 1, length - 1); 34 uint code = 4 + buf[0]; 35 36 if (!codecs[code-1]) { 37 QString coding = "ISO8859-" + QString::number(code); 38 codecs[code-1] = QTextCodec::codecForName(coding); 39 } 40 result = codecs[code-1]->toUnicode((const char*)buf + 1, length - 1); 36 41 } 37 42 else if (buf[0] == 0x10) 38 43 { … … 44 49 45 50 uint code = 1; 46 51 swab(buf + 1, &code, 2); 47 QString coding = "ISO8859-" + QString::number(code); 48 QTextCodec *codec = QTextCodec::codecForName(coding); 49 result = codec->toUnicode((const char*)buf + 3, length - 3); 52 if (!codecs[code-1]) { 53 QString coding = "ISO8859-" + QString::number(code); 54 codecs[code-1] = QTextCodec::codecForName(coding); 55 } 56 result = codecs[code-1]->toUnicode((const char*)buf + 3, length - 3); 50 57 } 51 58 else 52 59 {
