From cdc5109b3642ee06b94d0dd70f7929107e9035f9 Mon Sep 17 00:00:00 2001 From: Mariusz Bialonczyk Date: Fri, 12 Oct 2012 08:37:15 +0200 Subject: [PATCH] [PR-153] Further fixes for Polish EPG encoding It seems from my debugging that we cannot force the encoding to specific type as the only one, because the providers are sometimes encoding the current/next events differently then the rest. As the result the part of events could have wrong encoding. There are also situations, where firstly loaded event is OK, but further update is screwing the encoding on it. My solution is adding special encoding type: PL_AUTO which cover all Polish EPG. This way the encoding is correct for both current/next and further events. Side effect is that the encoding list for Polish channels is smaller (don't need to check if channel is encoded in ISO8859-2 or in ISO6937, it just works if it is set to PL_AUTO). The is still a place to force encoding to specified one for a whole transponder or specific services, but it is not applicable to Polish providers. --- data/conf/charset | 263 +++++++----------------------------------- src/dvb/dvb_support.c | 18 ++- 2 files changed, 59 insertions(+), 222 deletions(-) diff --git a/data/conf/charset b/data/conf/charset index 0824f489..f51a50b1 100644 --- a/data/conf/charset +++ b/data/conf/charset @@ -2,413 +2,238 @@ { "tsid": 200, "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 13878, "description": "ESP2 NE Polish" }, { "tsid": 200, "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", + "sid": 13864, + "description": "EUROSPORT2 PL" + }, + { + "tsid": 200, + "onid": 318, + "charset": "PL_AUTO", "sid": 13865, "description": "Hotbird Eutelsat (Eurosport)" }, { "tsid": 300, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 15206, "description": "Animal Planet HD" }, { "tsid": 400, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 13020, "description": "Hotbird 13.0 Cyfra+ Canal+ HD Polska" }, { "tsid": 400, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 13022, "description": "Hotbird 13.0 Cyfra+ Canal+ Sport HD Polska" }, { "tsid": 400, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 13023, "description": "Hotbird 13.0 Cyfra+ National Geographic HD Polska" }, { "tsid": 400, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 13025, "description": "Hotbird 13.0 Cyfra+ Filmbox HD" }, { "tsid": 400, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 13026, "description": "Hotbird 13.0 Cyfra+ AXN Spin HD" }, { "tsid": 400, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 13027, "description": "Hotbird 13.0 Cyfra+ TVN 7 HD" }, { "tsid": 400, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 13070, "description": "Hotbird 13.0 Cyfra+ ESP HD PL" }, { "tsid": 400, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 13081, "description": "EUROSPORT HD" }, { "tsid": 400, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 13082, "description": "EUROSPORT HD" }, { "tsid": 1000, "onid": 318, - "charset": "ISO8859-2", - "sid": 4314, - "description": "nSport" - }, - { - "tsid": 1000, - "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Grupa ITI" }, { "tsid": 1100, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Cyfra+" }, { "tsid": 1500, "onid": 318, - "charset": "ISO8859-2", - "sid": 5110, - "description": "TV Info" - }, - { - "tsid": 1500, - "onid": 318, - "charset": "ISO8859-2", - "sid": 5108, - "description": "Fox Polska" - }, - { - "tsid": 1500, - "onid": 318, - "charset": "ISO8859-2", - "sid": 5102, - "description": "TVS" - }, - { - "tsid": 1500, - "onid": 318, - "charset": "ISO8859-2", - "sid": 5122, - "description": "Animal Planet Poland" - }, - { - "tsid": 1500, - "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Cyfra+" }, { "tsid": 1600, "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 EskaTV, TVN" }, { "tsid": 1800, "onid": 200, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 3623, "description": "Hotbird 13.0 Polo TV" }, { "tsid": 7400, "onid": 113, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Cyfrowy Polsat" }, { "tsid": 7800, "onid": 113, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Cyfrowy Polsat" }, { "tsid": 7900, "onid": 113, - "charset": "ISO6937", - "sid": 10510, - "description": "TV6 Polska" - }, - { - "tsid": 7900, - "onid": 113, - "charset": "ISO6937", - "sid": 10508, - "description": "Hotbird 13.0 Cyfrowy Polsat Jim Jam" - }, - { - "tsid": 7900, - "onid": 113, - "charset": "ISO6937", - "sid": 10521, - "description": "SuperStacja" - }, - { - "tsid": 7900, - "onid": 113, - "charset": "ISO6937", - "sid": 10520, - "description": "Travel Channel" - }, - { - "tsid": 7900, - "onid": 113, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Cyfrowy Polsat" }, { "tsid": 8100, "onid": 318, - "charset": "ISO6937", - "sid": 14911, - "description": "UNIVERSAL POL" - }, - { - "tsid": 8100, - "onid": 318, - "charset": "ISO6937", - "sid": 14910, - "description": "Sport Klub POL" - }, - { - "tsid": 8100, - "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Eutelsat (Universal)" }, { "tsid": 11000, "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Cyfra+" }, { "tsid": 11400, "onid": 318, - "charset": "ISO8859-2", - "sid": 15716, - "description": "Discovery Channel Polska" - }, - { - "tsid": 11400, - "onid": 318, - "charset": "ISO8859-2", - "sid": 15701, - "description": "Discovery Science Polska" - }, - { - "tsid": 11400, - "onid": 318, - "charset": "ISO8859-2", - "sid": 15703, - "description": "Discovery World Polska" - }, - { - "tsid": 11400, - "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Cyfra+" }, { "tsid": 11600, "onid": 318, - "charset": "ISO6937", - "sid": 3514, - "description": "Disney XD Polska" - }, - { - "tsid": 11600, - "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 BBC HD, ITI" }, { "tsid": 11900, "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Cyfra+" }, { "tsid": 12200, "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Disney Channel Polska, TCM and other" }, { "tsid": 12800, "onid": 318, - "charset": "ISO6937", - "sid": 24, - "description": "CC Family." - }, - { - "tsid": 12800, - "onid": 318, - "charset": "ISO6937", - "sid": 6, - "description": "Viacom Blink!" - }, - { - "tsid": 12800, - "onid": 318, - "charset": "ISO6937", - "sid": 22, - "description": "MTV Polska." - }, - { - "tsid": 12800, - "onid": 318, - "charset": "ISO6937", - "sid": 30, - "description": "Comedy Central Polska." - }, - { - "tsid": 12800, - "onid": 318, - "charset": "ISO6937", - "sid": 25, - "description": "VIVA Polska." - }, - { - "tsid": 12800, - "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Viacom ... MTV / VH1 Polska" }, { "tsid": 13000, "onid": 318, - "charset": "ISO6937", - "sid": 14612, - "description": "Investigation Discovery Polska" - }, - { - "tsid": 13000, - "onid": 318, - "charset": "ISO6937", - "sid": 14613, - "description": "TLC Polska" - }, - { - "tsid": 13000, - "onid": 318, - "charset": "ISO6937", - "sid": 14602, - "description": "BBC Entertainment Poland" - }, - { - "tsid": 13000, - "onid": 318, - "charset": "ISO6937", - "sid": 14603, - "description": "BBC Knowledge Poland" - }, - { - "tsid": 13000, - "onid": 318, - "charset": "ISO8859-2", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 BBC Polska, TLC and other" }, { "tsid": 13100, "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 7322, "description": "TV5 Monde Europe" }, { "tsid": 13100, "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 7324, "description": "Hotbird 13.0 Crime and Investigation" }, { - "tsid": 13200, - "onid": 113, - "charset": "ISO88959-2", - "sid": 13104, - "description": "Polsat Sport" + "tsid": 13100, + "onid": 318, + "charset": "PL_AUTO", + "sid": 7325, + "description": "Hotbird 13.0 Crime + Investigation" }, { "tsid": 13200, "onid": 113, - "charset": "ISO88959-2", - "sid": 13105, - "description": "Polsat Sport Extra" - }, - { - "tsid": 13200, - "onid": 113, - "charset": "ISO88959-2", - "sid": 13107, - "description": "TV Biznes" - }, - { - "tsid": 13200, - "onid": 113, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 0, "description": "Hotbird 13.0 Cyfrowy Polsat" }, { "tsid": 15700, "onid": 318, - "charset": "ISO6937", + "charset": "PL_AUTO", "sid": 10626, "description": "Hotbird 13.0 Disco TV" } diff --git a/src/dvb/dvb_support.c b/src/dvb/dvb_support.c index dae632a3..64b35b2a 100644 --- a/src/dvb/dvb_support.c +++ b/src/dvb/dvb_support.c @@ -206,7 +206,7 @@ dvb_get_string(char *dst, size_t dstlen, const uint8_t *src, size_t srclen, cons { int ic; size_t len, outlen; - int i; + int i, auto_pl_charset = 0; if(srclen < 1) { *dst = 0; @@ -220,13 +220,22 @@ dvb_get_string(char *dst, size_t dstlen, const uint8_t *src, size_t srclen, cons conv++; } + // check for automatic polish charset detection + if (dvb_charset && strcmp("PL_AUTO", dvb_charset) == 0) { + auto_pl_charset = 1; + dvb_charset = NULL; + } + // automatic charset detection switch(src[0]) { case 0: return -1; case 0x01 ... 0x0b: - ic = convert_iso_8859[src[0] + 4]; + if (auto_pl_charset && (src[0] + 4) == 5) + ic = convert_iso6937; + else + ic = convert_iso_8859[src[0] + 4]; src++; srclen--; break; @@ -251,7 +260,10 @@ dvb_get_string(char *dst, size_t dstlen, const uint8_t *src, size_t srclen, cons return -1; default: - ic = convert_iso6937; + if (auto_pl_charset) + ic = convert_iso_8859[2]; + else + ic = convert_iso6937; break; }