本帖最後由 lestari 於 2014-4-24 11:53 編輯
回覆 20# z1022
I modified 'dvb-support.c' only. As I can't find the solution from Sangood's code, so just make my own patch version. You said you also modified 'main.c', don't you mind to share it...?
I try Sangood's latest code, but it failed to scan channel in my hardware, this is also reported by ahkeung. So I can't run and debug Sangood's code, by just 'diff' Sangood's latest code with the main trunk TVheadend latest code, I see no clue how Sangood support Chinese, don't know why.
The reason found is in function dvb_get_string in file dvd_support.c, it didn't handle the source string format identifier 'src[0]', case 0x11, which is used in HK DMB-TH broadcast.
According to the DVB Broadcast specification EN 300 468. String format identifier case 0x11 use UTF-16 standard. Linux core now is UTF-32 and TVheadend use UTF-8. My modification include 2 conversion stages.
1. UTF-16 to UTF-32, from DVB standard to Linux core.
2. UTF-32 to UTF-8, using Linux core library 'wcstombs'.
String format identifier case 0x15 also revised. Below is the code, sorry my code is ugly... Please feel free to suggest and comment.
What next (hope) :
1. Support Chinese channel name.
2. Support Chinese EPG and channel name is XBMC frontend.-
- char *tmp; // declare on top of the function
- case 0x11:
- ic = convert_utf8;
- src++; srclen--;
- tmp = calloc(1, srclen*2+1);
- memset(tmp, 0, srclen*2+1);
- for (i = 0; i < (srclen / 2); i++) {
- tmp[i*4] = src[i*2+1];
- tmp[i*4+1] = src[i*2];
- }
-
- len = wcstombs(dst, (const wchar_t *) tmp, srclen*2);
- dst[len] = 0;
- return 0;
- break;
- case 0x12 ... 0x14:
- return -1;
- case 0x15:
- ic = convert_utf8;
- src++; srclen--;
- break;
複製代碼 |