📄 osd.c
字号:
region[4].osd_h = 8;
osd_create_region(®ion[4], 105, (170 + 3 * 14), NULL, OSD_FORMAT_4COLOR,
OSD_NONINTERLACED);
#endif
#if CONFIG==CONFIG_COMBO_SVCD
//setup region 3//220(for EQ chart display)
region[3].osd_w = 26 * 4; //21 * 4;
region[3].osd_h = 3 * 16 + 2; //2 * 28;//4 * 28 for others interlaced;2*28 for others non-interlaced
osd_create_region(®ion[3], 75, 170, ®ion[4], OSD_FORMAT_16COLOR,
OSD_NONINTERLACED);
#else
//setup region 3//220(for EQ chart display)
region[3].osd_w = 20 * 4; //21 * 4;
region[3].osd_h = 3 * 14; //2 * 28;//4 * 28 for others interlaced;2*28 for others non-interlaced
osd_create_region(®ion[3], 105, 170, ®ion[4], OSD_FORMAT_16COLOR,
OSD_NONINTERLACED);
#endif
// setup region 2
region[2].osd_w = 14 * 4; //35 * 4;////////16*
region[2].osd_h = OSD_FONT_HEIGHT;
osd_create_region(®ion[2], 32, 80, ®ion[3], OSD_FORMAT_4COLOR,
OSD_NONINTERLACED);
// setup region 1 //40
region[1].osd_w = 10 * 4; //35 * 4;
region[1].osd_h = OSD_FONT_HEIGHT;
osd_create_region(®ion[1], 32, 52, ®ion[2], OSD_FORMAT_4COLOR,
OSD_NONINTERLACED);
// setup region 0
region[0].osd_w = 8 * 4; //13*4;//BYTE PER PIXEL
region[0].osd_h = OSD_FONT_HEIGHT; //PIXEL
osd_create_region(®ion[0], 32, 24, ®ion[1], OSD_FORMAT_4COLOR,
OSD_NONINTERLACED);
#ifdef MONE_OSD_BUFFER
#if CONFIG==CONFIG_COMBO_SVCD
if((int)addr_vy(osd_free) >= (int)(MEM_AUDYA_DEF - MEM_OSDYA_DEF))
{
psprintf(linebuf,
"OSD BUFFER OVERFLOW(osd_init_realtime_eq)....%x %x(%x)\n",
addr_vx(osd_free), addr_vy(osd_free),
(MEM_AUDYA_DEF - MEM_OSDYA_DEF));
epp_write_slow(linebuf);
}
#else
if((int)addr_vy(osd_free) >= (int)OBV_H)
{
psprintf(linebuf,
"OSD BUFFER OVERFLOW(osd_init_realtime_eq).... %x(%x)\n",
addr_vy(osd_free), OBV_H);
epp_write_slow(linebuf);
}
#endif
#endif
//setup link address to region 0
ClearOsdMsg(0);
osd_enable();
}
#endif
/*
** FUNCTION
** polling_osd(diff)
**
** DESCRIPTION
** checking OSD timeout, every time 'diff' RTC ticks is subtracted
** from OSD timeout.
**
** *NOTE* if timeout value is 0 then this check is ignored.
*/
void polling_osd(int diff)
{
int i;
for(i = 0; i < REGIONS_ACTIVE; i++)
{
int TimeToLive;
if((TimeToLive = timeout_osd[i]) != 0)
{
if((TimeToLive -= diff) <= 0)
{
TimeToLive = 0;
//osd_tog_region(®ion[i], OSD_OFF);
osd_tog_region(i, OSD_OFF);
#ifdef MONE_POLLING_OSD
epp_write_wait("osd toggle off ...\n");
#endif
#ifdef IR_SCORE_ON
if((score_status != SCORE_STOP) && (i == REGION1))
{
//PrintOsdMsg(STR_OS_SCORE_START,REGION1,1,0,CH_N);//charles 2002/7/26
score_interval = SCORE_INTERVAL; //wyf 2-4-27 15:15.
}
#endif //#ifdef IR_SCORE_ON
}
timeout_osd[i] = TimeToLive;
}
}
}
/*
**
**
*/
void osd_tog_region(BYTE r, int mode)
{
int t, j;
t_osd_region *p;
RegionOnOff[r][0] = mode;
if(mode == OSD_OFF)
{
RegionOnOff[r][2] = STR_OS_SPACE;
RegionOnOff[r][1] = 0;
for(j = 0; j < MAX_SW_REGION; j++)
RegionStr[r][j][0] = 0;
}
p = ®ion[r];
for(t = 0; t < 2; t++)
{
BYTE *obase;
UINT16 h = p->osd_header[t];
UINT32 x;
/* check header-address */
if(h == LINK_NULL)
continue;
obase = get_osdbuf_baseptr() + h * 32;
x = obase[7];
switch (mode)
{
case OSD_ON:
x &= ~0x0001;
break;
case OSD_OFF:
x |= 0x0001;
break;
case OSD_TOG:
x ^= 0x0001;
break;
}
obase[7] = x;
}
#if SUPPORT_OSD
regs0->osd_en = 1;
#else /* */
regs0->osd_en = 0;
#endif /* */
}
/*
**
*/
#if 0 //not used
void osd_DrawString(BYTE xStart, BYTE yStart, BYTE * str, BYTE fontColor,
BYTE bkColor)
{
BYTE *pFont, c;
UINT32 *pTopLine, *pBtmLine;
UINT32 iDispLoc, iStrLoc;
int i, j, k;
int iFontWidth, iFontHigh;
int iRegionWidth = region[0].osd_w;
osd_tog_region(0, OSD_ON);
pFont = (BYTE *) font_table[c];
//initialize buffer start
pTopLine =
(UINT32 *) (((BYTE *) get_osdbuf_baseptr()) +
region[0].osd_header[0] * 32 +
OSD_DATA_OFFSET(region[0].osd_format));
pBtmLine =
(UINT32 *) (((BYTE *) get_osdbuf_baseptr()) +
region[0].osd_header[1] * 32 +
OSD_DATA_OFFSET(region[0].osd_format));
iStrLoc = 0;
//iDispLoc = (yStart*iRegionWidth/4*OSD_FONT_HEIGHT) + (xStart*16/8);
iDispLoc =
(yStart * iRegionWidth / 8 * OSD_FONT_HEIGHT) + (xStart * 16 / 8);
//process each charactor until string ending('\0')
while((c = ((BYTE *) str)[iStrLoc]) != '\0')
{
BYTE curByte;
UINT32 pixel8;
UINT32 pos;
iStrLoc++;
if(c == '\r')
{ //prefix characher:to use font_table2
if((c = ((BYTE *) str)[iStrLoc]) == '\0')
break;
iStrLoc++;
if((pFont = (BYTE *) font_table2[c]) == NULL)
continue;
if((pFont = (BYTE *) font_table[c]) == NULL)
continue;
}
else
{
//get current char entry
pFont = (BYTE *) font_table[c];
}
//start to process
pos = 2;
//get font information
iFontWidth = (int)pFont[0];
iFontHigh = (int)pFont[1];
//start to draw
for(j = 0; j < iFontHigh / 2; j++)
{
//draw top line
for(i = 0; i < iFontWidth / 8; i++)
{
BYTE c;
//curByte = pFont[++pos];
//c = curByte & 0x0f;
//curByte = (curByte>>4) | (c<<4);
c = pFont[++pos];
curByte =
((c & 0xc0) >> 6) | ((c & 0x30) >> 2) | ((c & 0x0c) << 2) |
((c & 0x03) << 6);
pixel8 = 0;
for(k = 0; k < 8; k++)
{
if((1 << k) & curByte)
{
pixel8 = pixel8 | (fontColor << (k * 4));
}
else
{
pixel8 = pixel8 | (bkColor << (k * 4));
}
}
pTopLine[iDispLoc + i] = pixel8;
}
//draw bottom line
for(i = 0; i < iFontWidth / 8; i++)
{
BYTE c;
//curByte = pFont[++pos];
//c = curByte & 0x0f;
//curByte = (curByte>>4) | (c<<4);
c = pFont[++pos];
curByte =
((c & 0xc0) >> 6) | ((c & 0x30) >> 2) | ((c & 0x0c) << 2) |
((c & 0x03) << 6);
pixel8 = 0;
for(k = 0; k < 8; k++)
{
if((1 << k) & curByte)
{
pixel8 = pixel8 | (fontColor << (k * 4));
}
else
{
pixel8 = pixel8 | (bkColor << (k * 4));
}
}
pBtmLine[iDispLoc + i] = pixel8;
}
//iDispLoc += (iRegionWidth/2);
iDispLoc += (iRegionWidth / 4);
} //for charactor height
//move to next character and move up to first line of this string
//iDispLoc = iDispLoc + (iFontWidth/8) - (iRegionWidth/2*iFontHigh/2);
iDispLoc =
iDispLoc + (iFontWidth / 8) - (iRegionWidth / 4 * iFontHigh / 2);
} // end of while ( (c=((BYTE *)str)[unFontLoc])!='\0' )
timeout_osd[0] = 0;
}
#endif
#if 0 //not used
void osd_draw_rect(BYTE xStart, BYTE yStart, BYTE xLen, BYTE yLen,
BYTE fontColor, BYTE bkColor)
{
BYTE buf[40];
int i, j;
//draw top-line
buf[0] = 0x17; //left-top corner
for(i = 1; i <= xLen; i++)
{
buf[i] = 0x15; //horizontal line
}
buf[xLen + 1] = 0x18; //right-top corner
buf[xLen + 2] = 0; //string ending
osd_DrawString(xStart, yStart, buf, fontColor, bkColor);
//draw not-top and not-bottom lines
for(j = 1; j <= yLen; j++)
{
buf[0] = 0x16; //vertical line
for(i = 1; i <= xLen; i++)
{
buf[i] = ' '; //space
}
buf[xLen + 1] = 0x16; //right-top corner
buf[xLen + 2] = 0; //string ending
osd_DrawString(xStart, yStart + j, buf, fontColor, bkColor);
}
//draw bottom-line
buf[0] = 0x19; //left-top corner
for(i = 1; i <= xLen; i++)
{
buf[i] = 0x15; //horizontal line
}
buf[xLen + 1] = 0x1a; //right-top corner
buf[xLen + 2] = 0; //string ending
osd_DrawString(xStart, yStart + yLen + 1, buf, fontColor, bkColor);
}
#endif
#define ONE_BYTE_POINT 4 //4 color -> 1 byte has 4 point
/*
Function : draw a string on OSD region
Action : now the font width has two size, on is 16 point for english
and one is 32 point for chinese
Notice : 1. The font width must is time of 8
2. if the font high is more then region area, program will be fail
3. the font high must be even
*/
#ifdef OSD_USE_INTERLACED
void osd_print_region_interlaced(t_osd_region * p, const char *s0)
{
int iWidth = p->osd_w;
int W = iWidth;
BYTE *pTopLine;
BYTE *pBotLine;
BYTE *pFont;
BYTE *pPattern;
UINT16 space;
UINT16 unFontLoc;
UINT16 unDispLoc;
int i, j, nibble_changed;
int iFontHigh, iFontWidth;
BYTE c;
pPattern = (BYTE *) pattern_4Normal; //pattern_4Prog;//jhang 2002/4/24 change
unDispLoc = unFontLoc = 0;
//process each charactor
while((c = ((BYTE *) s0)[unFontLoc]) != '\0')
{
unFontLoc++;
//if( (c=='\n')||((unFontLoc==1)&&(c==' ')) )
if(c == '\r')
{
//prefix characher:to use font_table2 Jeff 20010906
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -