Record TV over USB

Here for general support for B series TVs, request and problem solve area.

nbd
Posts: 160
Joined: Wed Jan 13, 2010 12:02 pm

Re: Record TV over USB

Post by nbd »

\o/ Timeshifting!

Since the TV has only one tuner, is it presumable that watching another channel, while recording the other, is not possible?
User avatar
erdem_ua
SamyGO Admin
Posts: 3125
Joined: Thu Oct 01, 2009 6:02 am
Location: Istanbul, Turkey
Contact:

Re: Record TV over USB

Post by erdem_ua »

doodlecz, I think you don't needed to implement unicode support. Please filter that names from 0-9,a-z,A-Z ascii chars and use it. :)
doodlecz
Official SamyGO Developer
Posts: 98
Joined: Wed Mar 17, 2010 9:12 am

Re: Record TV over USB

Post by doodlecz »

erdem_ua wrote:doodlecz, I think you don't needed to implement unicode support. Please filter that names from 0-9,a-z,A-Z ascii chars and use it. :)
Yeah, that would be easy, but sometimes (in cz) I wouldn't understand, what the name of program is - sometimes so many special characters..;)
But the fact is, we could filter unknown special characters to prevent these stupid bugs..
geo650
Official SamyGO Developer
Posts: 303
Joined: Wed Oct 07, 2009 12:03 pm

Re: Record TV over USB

Post by geo650 »

doodlecz wrote:
erdem_ua wrote:doodlecz, I think you don't needed to implement unicode support. Please filter that names from 0-9,a-z,A-Z ascii chars and use it. :)
Yeah, that would be easy, but sometimes (in cz) I wouldn't understand, what the name of program is - sometimes so many special characters..;)
But the fact is, we could filter unknown special characters to prevent these stupid bugs..

Maybe you should do something like that:

Code: Select all

// UNICODE to ASCII conversion table for national characters removal
const static struct _U2A { unsigned short unicode; char *ascii; } unicode2ascii[] = {
// Polish
{0x0501, "a"},{0x0401, "A"},{0x0701, "c"},{0x0601, "C"},{0x1901, "e"},{0x1801, "E"},{0x4201, "l"},{0x4101, "L"},
{0x4401, "n"},{0x4301, "N"},{0xF300, "o"},{0xD300, "O"},{0x5B01, "s"},{0x5A01, "S"},{0x7A01, "z"},{0x7901, "Z"},
{0x7C01, "z"},{0x7B01, "Z"},
// Hungarian
{0x5001, "OE"},{0x5101, "oe"},{0x7001, "UE"},{0x7101, "ue"},{0xD500, "OE"},{0xF500, "oe"},{0xDB00, "UE"},{0xFB00, "ue"},
// German + Swedish
{0xE400, "ae"},{0xC400, "AE"},{0xF600, "oe"},{0xD600, "OE"},{0xFC00, "ue"},{0xDC00, "UE"},{0xDF00, "ss"},
// Swedish + Danish
{0xE500, "a"},{0xC500, "A"},
// Danish
{0xE600, "ae"},{0xC600, "AE"},{0xF800, "0"},{0xD800, "0"},
// ??? (????????)
{0x1B01, "e"},{0x1A01, "E"},{0x1501, "e"},{0x1401, "E"},{0xE900, "e"},{0xC900, "E"},
// ??? (????)
{0xE100, "a"},{0xC100, "A"},
// ??? (????????)
{0x6F01, "u"},{0x6E01, "U"},{0xFA00, "u"},{0xDA00, "U"},
// ??? (????????????)
{0x6501, "t"},{0x6401, "T"},{0x0F01, "d"},{0x0E01, "D"},{0x4801, "n"},{0x4701, "N"},
// ??? (????????????????????)
{0x9A00, "s"},{0x8A00, "S"},{0x6101, "s"},{0x6001, "S"},{0x0D01, "c"},{0x0C01, "C"},{0x5901, "r"},{0x5801, "R"},
{0x9E00, "z"},{0x8E00, "Z"},{0x7E01, "z"},{0x7D01, "Z"},{0xFD00, "y"},{0xDD00, "Y"},{0xED00, "i"},{0xCD00, "I"},
{0x0000, ""} // end of table
};

// UNICODE to ASCII conversion function with national and special characters removal
static int pvr_unicode2ascii( unsigned short *buffer, char *szbuffer ) __attribute__ ((noinline));
static int pvr_unicode2ascii( unsigned short *buffer, char *szbuffer )
{
	unsigned short *psrc;
	char *pdst, *pconv;
	int i, found;

	psrc = buffer;
	pdst = szbuffer;

	// stage 1: national characters conversion
	while (*psrc)	// until not end of source string (i.e. until zero)...
	{
		i=0; found=0;
		while ((unicode2ascii[i].unicode != 0x000) && !found)
		{
			if (*psrc == unicode2ascii[i].unicode)
			{
				pconv = unicode2ascii[i].ascii;
				while (*pconv) *(pdst++) = *(pconv++);	// copy ASCII from table to the destination string
									// TODO: check for destination buffer length (protect for memorty leak)
				found = 1;				// code found in the conversion table (might be null as well)
			}
			i++;	// next unicode to test (table index)
		}
		if (!found) *(pdst++) = *psrc >> 8;		// all other codes: remove high byte
		psrc++;	// next source character
	}
	*pdst = 0;	// set ASCIIZ zero to destination string

	// stage 2: special (not-allowed) characters removing
	while(--pdst >= szbuffer)
	{
		if (!(  ((*pdst>='0') && (*pdst<='9')) ||
			((*pdst>='a') && (*pdst<='z')) ||
			((*pdst>='A') && (*pdst<='Z')) ||
			 (*pdst=='-') || (*pdst=='!') || (*pdst=='$') || (*pdst=='@') ||
			 (*pdst=='&') || (*pdst=='(') || (*pdst==')')
		)) *pdst='_';	// other characters are converted to this
	}

	return 0;	// end of conversion
}

Post Reply

Return to “[B] Support”