⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string_generate.c

📁 ZORAN 962/966 SOURCE CODE,DVD chip
💻 C
📖 第 1 页 / 共 4 页
字号:
/* **************************************************************************************
*  Copyright (c) 2004 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: $Workfile$
*
* Description:
* ============
*
*
****************************************************************************************/
#include "Config.h"				// Global Configuration - do not remove!


/**************************************************************************
*	 Include files
***************************************************************************/
#include "include\sysdefs.h"
#include "Services\System\wstrings.h"
#include "Playcore\Coremain\CoreGDef.h"
#include "Library\String_generate.h"
#include "Font\fonts.h"
#include "CoreAPI\CoreAPI.h"
#include "Library\Number.h"


/**************************************************************************
* 	Constants and Macros
***************************************************************************/
#define NUM_TO_CHAR(digit)					(L'0' + (UINT8)(digit))
#define NUM_TO_FIXED_WIDTH_CHAR(digit)	(digit + PRIVATE_SYMBOL_FIXED_WIDTH_0)
#define DIGIT_TO_FIXED_WIDTH_DIGIT(digit)	(digit + PRIVATE_SYMBOL_FIXED_WIDTH_0 - '0')

// TODO: define private symbol '-' with fixed width
#define EMPTY_CHAR_FIXED_WIDTH		L'-'

#define TerminateStringGenerationFunction(_szBuffStr_, _cBuffOffset_, _cBuffSize_)	\
	_szBuffStr_[_cBuffOffset_]= L'\0';				\
	ASSERT(_cBuffOffset_ < _cBuffSize_);			\
	return _cBuffOffset_;	

#define _IsCapitialLetter(_letter_)   (((_letter_)>= 'A') &&(( _letter_)<= 'Z') )
#define _LetterCapitalToLower(_letter_) ((_letter_) + 0x20)
#define _IsDigit(_letter_)   (((_letter_)>= '0') &&(( _letter_)<= '9') )

#define MAX_LANGUAGE_NAME_ABBR (3 + 1)

typedef struct lang_code_tag {
	UINT16 mwCode;
	UINT8 mszLang[20];
} LANG_CODE;

#define MAX_LANG_CODE 141

#define DIVX6_LANGUAGE_LENGTH 			(20+1)
#define DIVX6_COUNTRY_LENGTH				(50+1)
#define DIVX6_AUDIO_FEATURE_LENGTH		(40 + 1)
#define AUDIO_TYPE_CODE_TABLE_SIZE 		17
#define SUB_TYPE_CODE_TABLE_SIZE 			17
#define DIVX6_SUBTITLE_FEATURE_LENGTH	(50+1)
typedef struct {
	CHAR aAudioFeature[DIVX6_AUDIO_FEATURE_LENGTH];
} DivX6AudioFeatureCode;

typedef struct {
	CHAR aSubtitleFeature[DIVX6_SUBTITLE_FEATURE_LENGTH];
} DivX6SubtitleFeatureCode;

typedef struct {
	CHAR aLanguage[DIVX6_LANGUAGE_LENGTH];
	CHAR aCountry[DIVX6_COUNTRY_LENGTH];
	CHAR aSubtitleFeature[DIVX6_SUBTITLE_FEATURE_LENGTH];
} DivX6SubtitleLabelDisplay;
// In English only??

typedef struct divx6_lang_code_tag {
	UINT16 mwCode;
	UINT8 mszLang[20];
} DIVX6_LANG_CODE;

// static CONST DIVX6_LANG_CODE aDivX6LanguageCode[MAX_LANG_CODE] = {
static CONST LANG_CODE aLanguageCodeArray[MAX_LANG_CODE] = {
	{MLC('a','a'),"Afar"},
	{MLC('a','b'),"Abkhazian"},
	{MLC('a','f'),"Afrikaans"},
	{MLC('a','m'),"Amharic"},
	{MLC('a','r'),"Arabic"},
	{MLC('a','s'),"Assamese"},
	{MLC('a','y'),"Aymara"},
	{MLC('a','z'),"Azerbaijani"},
	{MLC('b','a'),"Bashkir"},
	{MLC('b','e'),"Byelorussian"},
	{MLC('b','g'),"Bulgarian"},
	{MLC('b','h'),"Bihari"},
	{MLC('b','i'),"Bislama"},
	{MLC('b','n'),"Bengali"},
	{MLC('b','o'),"Tibetan"},
	{MLC('b','r'),"Breton"},
	{MLC('c','a'),"Catalan"},
	{MLC('c','o'),"Corsican"},
	{MLC('c','s'),"Czech"},
	{MLC('c','y'),"Welsh"},
	{MLC('d','a'),"Danish"},
	{MLC('d','e'),"German"},
	{MLC('d','z'),"Bhutani"},
	{MLC('e','l'),"Greek"},
	{MLC('e','n'),"English"},
	{MLC('e','o'),"Esperanto"},
	{MLC('e','s'),"Spanish"},
	{MLC('e','t'),"Estonian"},
	{MLC('e','u'),"Basque"},
	{MLC('f','a'),"Persian"},
	{MLC('f','i'),"Finnish"},
	{MLC('f','j'),"Fiji"},
	{MLC('f','o'),"Faeroese"},
	{MLC('f','r'),"French"},
	{MLC('f','y'),"Frisian"},
	{MLC('g','a'),"Irish"},
	{MLC('g','d'),"Gaelic"},
	{MLC('g','l'),"Galician"},
	{MLC('g','n'),"Guarani"},
	{MLC('g','u'),"Gujarati"},
	{MLC('h','a'),"Hausa"},
	{MLC('h','i'),"Hindi"},
	{MLC('h','r'),"Croatian"},
	{MLC('h','u'),"Hungarian"},
	{MLC('h','y'),"Armenian"},
	{MLC('i','a'),"Interlingua"},
	{MLC('i','e'),"Interlingue"},
	{MLC('i','k'),"Inupiak"},
	{MLC('i','n'),"Indonesian"},
	{MLC('i','s'),"Icelandic"},
	{MLC('i','t'),"Italian"},
	{MLC('i','w'),"Hebrew"},
	{MLC('j','a'),"Japanese"},
	{MLC('j','i'),"Yiddish"},
	{MLC('j','w'),"Javanese"},
	{MLC('k','a'),"Georgian"},
	{MLC('k','k'),"Kazakh"},
	{MLC('k','l'),"Greenlandic"},
	{MLC('k','m'),"Cambodian"},
	{MLC('k','n'),"Kannada"},
	{MLC('k','o'),"Korean"},
	{MLC('k','s'),"Kashmiri"},
	{MLC('k','u'),"Kurdish"},
	{MLC('k','y'),"Kirghiz"},
	{MLC('l','a'),"Latin"},
	{MLC('l','n'),"Lingala"},
	{MLC('l','o'),"Laothian"},
	{MLC('l','t'),"Lithuanian"},
	{MLC('l','v'),"Latvian"},
	{MLC('m','g'),"Malagasy"},
	{MLC('m','i'),"Maori"},
	{MLC('m','k'),"Macedonian"},
	{MLC('m','l'),"Malayalam"},
	{MLC('m','n'),"Mongolian"},
	{MLC('m','o'),"Moldavian"},
	{MLC('m','r'),"Marathi"},
	{MLC('m','s'),"Malay"},
	{MLC('m','t'),"Maltese"},
	{MLC('m','y'),"Burmese"},
	{MLC('n','a'),"Nauru"},
	{MLC('n','e'),"Nepali"},
	{MLC('n','l'),"Dutch"},
	{MLC('n','o'),"Norwegian"},
	{MLC('o','c'),"Occitan"},
	{MLC('o','m'),"Oromo"},
	{MLC('o','r'),"Oriya"},
	{MLC('p','a'),"Punjabi"},
	{MLC('p','l'),"Polish"},
	{MLC('p','s'),"Pashto"},
	{MLC('p','t'),"Portuguese"},
	{MLC('q','u'),"Quechua"},
	{MLC('r','m'),"Rhaeto-Romance"},
	{MLC('r','n'),"Kirundi"},
	{MLC('r','o'),"Romanian"},
	{MLC('r','u'),"Russian"},
	{MLC('r','w'),"Kinyarwanda"},
	{MLC('s','a'),"Sanskrit"},
	{MLC('s','d'),"Sindhi"},
	{MLC('s','g'),"Sangro"},
	{MLC('s','h'),"Serbo-Croatian"},
	{MLC('s','i'),"Singhalese"},
	{MLC('s','k'),"Slovak"},
	{MLC('s','l'),"Slovenian"},
	{MLC('s','m'),"Samoan"},
	{MLC('s','n'),"Shona"},
	{MLC('s','o'),"Somali"},
	{MLC('s','q'),"Albanian"},
	{MLC('s','r'),"Serbian"},
	{MLC('s','s'),"Siswati"},
	{MLC('s','t'),"Sesotho"},
	{MLC('s','u'),"Sudanese"},
	{MLC('s','v'),"Swedish"},
	{MLC('s','w'),"Swahili"},
	{MLC('t','a'),"Tamil"},
	{MLC('t','e'),"Tegulu"},
	{MLC('t','g'),"Tajik"},
	{MLC('t','h'),"Thai"},
	{MLC('t','i'),"Tigrinya"},
	{MLC('t','k'),"Turkmen"},
	{MLC('t','l'),"Tagalog"},
	{MLC('t','n'),"Setswana"},
	{MLC('t','o'),"Tonga"},
	{MLC('t','r'),"Turkish"},
	{MLC('t','s'),"Tsonga"},
	{MLC('t','t'),"Tatar"},
	{MLC('t','w'),"Twi"},
	{MLC('u','k'),"Ukrainian"},
	{MLC('u','r'),"Urdu"},
	{MLC('u','z'),"Uzbek"},
	{MLC('v','i'),"Vietnamese"},
	{MLC('v','o'),"Volapuk"},
	{MLC('w','o'),"Wolof"},
	{MLC('x','h'),"Xhosa"},
	{MLC('y','o'),"Yoruba"},
	{MLC('z','h'),"Chinese"},
	{MLC('z','u'),"Zulu"}
};

const DivX6AudioFeatureCode aDivX6AudioCode[AUDIO_TYPE_CODE_TABLE_SIZE] = {
	{"Other"						  },
	{"Primary Feature"				  },
	{"Director Commentary"			  },
	{"Writer Commentary"			  },
	{"Producer Commentary"			  },
	{"Cast Commentary"				  },
	{"Critic Commentary"			  },
	{"Score Commentary" 			  },
	{"Production Designer Commentary" },
	{"Special Effects Commentary"	  },
	{"Fan Commentary"				  },
	{"Other Commentary" 			  },
	{"Isolated Score"				  },
	{"Soundtrack"					  },
	{"Interview"					  },
	{"For Visually Impaired"		  },
	{"Alternative Director Commentary"  },
};

const DivX6SubtitleFeatureCode aDivX6SubtitleCode[SUB_TYPE_CODE_TABLE_SIZE] = {
	{"Other"									   },
	{"Normal"									   },
	{"Letterbox"								   },
	{"Wide Screen"								   },
	{"Full screen"								   },
	{"Closed Captioned"  	   },
	{"Forced"									   },
	{"Karaoke"									   },
	{"Not Specified"							   },
	{"Large"									   },
	{"Children" 								   },
	{"Director Commentary"						   },
	{"Large Director Commentary"				   },
	{"Director Commentary For Children" 		   },
	{"Normal Captions"							   },
	{"Large Captions"							   },
	{"Children's Captions"						   },
};
/**************************************************************************
*	Function	: STR_GenerateNumericValue
*
*	In		:
*
*	Out		:
*
*	Return	:
*
*	Desc 	:
 ***************************************************************************/
 #pragma argsused
UINT8 STR_GenerateNumericValue(INT32 lValue, UINT16* szBuffStr, UINT8 cBuffOffset, UINT8 cBuffSize)
{
	ASSERT(NULL != szBuffStr);

	if (lValue < 0)
	{
		szBuffStr[cBuffOffset++] = L'-';
		lValue = -lValue;
	}
	if ((UINT32)lValue > 9999)
	{
		szBuffStr[cBuffOffset++] = NUM_TO_CHAR((UINT32)lValue / 10000);
	}
	if ((UINT32)lValue > 999)
	{
		szBuffStr[cBuffOffset++] = NUM_TO_CHAR(((UINT32)lValue % 10000) / 1000);
	}
	if ((UINT32)lValue > 99)
	{
		szBuffStr[cBuffOffset++] = NUM_TO_CHAR(((UINT32)lValue % 1000) / 100);
	}
	if ((UINT32)lValue > 9)
	{
		lValue %= 100;
		szBuffStr[cBuffOffset++] = NUM_TO_CHAR((UINT32)lValue / 10);
	}

	szBuffStr[cBuffOffset++] = NUM_TO_CHAR((UINT32)lValue % 10);

	TerminateStringGenerationFunction(szBuffStr, cBuffOffset, cBuffSize);
}

#ifdef D_10P_KEY
UINT8 STR_Generate10PValue(INT32 lValue, UINT16* szBuffStr, UINT8 cBuffOffset, UINT8 cBuffSize)
{
	ASSERT(NULL != szBuffStr);

	if (lValue < 1)
	{
		szBuffStr[cBuffOffset++] = L'0';
//		lValue = -lValue;
	}
	if ((UINT32)lValue > 999)
	{
		szBuffStr[cBuffOffset++] = NUM_TO_CHAR(((UINT32)lValue % 10000) / 1000);
	}
	if ((UINT32)lValue > 99)
	{
		szBuffStr[cBuffOffset++] = NUM_TO_CHAR(((UINT32)lValue % 1000) / 100);
	}
	if ((UINT32)lValue > 9)
	{
		lValue %= 100;
		szBuffStr[cBuffOffset++] = NUM_TO_CHAR((UINT32)lValue / 10);
	}
	szBuffStr[cBuffOffset++] = L'_ ';

	TerminateStringGenerationFunction(szBuffStr, cBuffOffset, cBuffSize);
}
#endif

#ifdef D_TEST
extern BYTE cur_grid, cur_seg;

UINT8 STR_GenerateTestOsd(INT32 lValue, UINT16* szBuffStr, UINT8 cBuffOffset, UINT8 cBuffSize)
{
    WORD code = lValue;
	ASSERT(NULL != szBuffStr);

    szBuffStr[cBuffOffset++] = 'k';
    szBuffStr[cBuffOffset++] = 'e';
    szBuffStr[cBuffOffset++] = 'y';
    szBuffStr[cBuffOffset++] = ':';
    
    code >>=8;
    code &=0xf;
    szBuffStr[cBuffOffset++] = '0'+code;
    code = lValue;
    code &=0xf0;
    code >>=4;
    if ( code >= 0xa)
    {
       code -=0xa;
       szBuffStr[cBuffOffset++] = 'a'+code;
    }
    else
    {
       szBuffStr[cBuffOffset++] = '0'+code;
    }
    code = lValue;
    code &=0xf;
    if ( code >= 0xa)
    {
       code -=0xa;
       szBuffStr[cBuffOffset++] = 'a'+code;
    }
    else
    {
       szBuffStr[cBuffOffset++] = '0'+code;
    }
    szBuffStr[cBuffOffset++] = ' ';
    szBuffStr[cBuffOffset++] = 'V';
    szBuffStr[cBuffOffset++] = 'f';
    szBuffStr[cBuffOffset++] = 'd';
    szBuffStr[cBuffOffset++] = ':';
    szBuffStr[cBuffOffset++] = 'G';
    if ( cur_grid >= 10)
    {
       szBuffStr[cBuffOffset++] = '0' + cur_grid/10;
       szBuffStr[cBuffOffset++] = '0' + cur_grid%10;
    }
    else
    {
       szBuffStr[cBuffOffset++] = '0' + cur_grid;
    }
    szBuffStr[cBuffOffset++] = 'P';
    if ( cur_seg >= 10)
    {
       szBuffStr[cBuffOffset++] = '0' + cur_seg/10;
       szBuffStr[cBuffOffset++] = '0' + cur_seg%10;
    }
    else
    {
       szBuffStr[cBuffOffset++] = '0' + cur_seg;
    }
	gps->screen_saver_enable = 0;
	TerminateStringGenerationFunction(szBuffStr, cBuffOffset, cBuffSize);
}

UINT8 STR_GenerateAdjustGridOsd(INT32 lValue, UINT16* szBuffStr, UINT8 cBuffOffset, UINT8 cBuffSize)
{
	ASSERT(NULL != szBuffStr);

	szBuffStr[cBuffOffset++] = 'C';
	szBuffStr[cBuffOffset++] = 'U';
	szBuffStr[cBuffOffset++] = 'R';
	szBuffStr[cBuffOffset++] = 'R';
	szBuffStr[cBuffOffset++] = 'E';
	szBuffStr[cBuffOffset++] = 'N';
	szBuffStr[cBuffOffset++] = 'T';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -