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

📄 fsosd.c

📁 一个两碟控制的VCD的代码,两碟之间的转动及连续播放,已大量生产的CODE.
💻 C
📖 第 1 页 / 共 3 页
字号:
/* Copyright 1996, ESS Technology, Inc.                 */
/* SCCSID @(#)fsosd.c	1.99 7/7/98 */

/*
 * $Log$
 */

#include "common.h"
#include "display.h"
#include "util.h"
#include "mvd.h"
#include "fsosd.h"
#include "timedef.h"
#include "vcxi.h"
#include "dsa.h"
#include "const.h"
#include "panel.h"
#include "echo.h"
#include "play.h"

/************************************************************************
 * Local OSD definitions						*
 ************************************************************************/
#define EPRINTF(a) 
#define PRIVATE    static

/************************************************************************
 * Global variables declared in this module				*
 ************************************************************************/
unsigned char   OSD_lines[OSD_MAX_LINES][OSD_MAX_CHAR];
OSD_Region  OSD_regions[OSD_MAX_REGIONS]; 
unsigned short  OSD_displayed_regions=0;  /* bits indicate region(s) with */
                                    /* message actively displayed   */
unsigned short  OSD_scheduled_regions=0;  /* bits indicate region(s) */
                                    /* scheduled for clearing  */
unsigned short  OSD_suppressed_regions=0; /* bits indicate region(s) whose */
                                        /* display(s) are suppressed     */
unsigned short  OSD_update_regions=0;     /* regions to be updated in dram */
int             OSD_schedule_time[OSD_MAX_REGIONS];
unsigned char   OSD_new_time[OSD_TIME_SIZE], 
                OSD_new_track[OSD_TRACK_SIZE],
                OSD_new[OSD_MAX_CHAR];  /* "+1" in case of long string */ 


#ifdef BILINGUAL_OSD
#ifdef USE_ENGLISH
unsigned char   OSD_language = 0;       /* 0 : English, 1 : other(Chinese) */
#else
unsigned char   OSD_language = 1;       /* 0 : English, 1 : other(Chinese) */
#endif

static unsigned char 	*english_ptr[OSD_MAX_REGIONS],
			*chinese_ptr[OSD_MAX_REGIONS];
static unsigned short	OSD_display_backup=0;
static unsigned short	OSD_update_backup=0;
static unsigned short	OSD_schedule_backup;
#endif

#ifdef CUST4
unsigned char	OSD_blink_msg[OSD_BLINK_SIZE]; /* save blinking msg here */
unsigned char	OSD_msg_override;  /* enable display in time/track regions */
char		OSD_blink_region = 0; /* specifies blinking region */
int		OSD_blink_time ;

unsigned char	OSD_line_index[OSD_MAX_REGIONS + 1] = {0/*unused*/, 
							0, 0, 0, 0, 0,
							1, 1, 1, 1, 1};
#else
unsigned char	OSD_line_index[16] = {0/*unused*/, 0, 0, 0,
                                             	   1, 1, 1,
                                             	   2, 2, 2,
                                             	   3, 3, 3,
                                             	   4, 4, 4};
#endif /* CUST4 */

#if 0	/* For moving OSD area2 on the fly */
/* Set initial Area2 OSD display positions - NTSC & PAL	*/
int	Ntsc_osd_vert_pos2 = OSD_NTSC_VERT_POS2;    
int	Pal_osd_vert_pos2 = OSD_NTSC_VERT_POS2;
int	Ntsc_osd_vert_end2 = OSD_NTSC_VERT_END2;    
int	Pal_osd_vert_end2 = OSD_NTSC_VERT_END2;
#endif

#ifdef PLAY20
unsigned char	OSD_time_minute=0;	/* BCD time for minute		*/
unsigned char	OSD_time_second=0;	/* BCD time for second		*/
unsigned char	OSD_last_bcd_num_of_track = -1;
unsigned int	OSD_last_servo_info = 0xffff;/* Last servo_info, so we 	*
				     	 * know when something changes	*/
#endif

/************************************************************************
 * Variables imported from other modules.				*
 ************************************************************************/
IMPORT	int	cur_track_number;
IMPORT	char	disableOsd;

 
/************************************************************************
 * Private variables							*
 ************************************************************************/
#if 0 /* NO one uses this right now */
PRIVATE	struct {			/* Pitch/volume bar		*/
    unsigned char pair[2];
}  posbar_array[4] = {
    {FONT_LS, FONT_SS},	/* 0	*/    {FONT_LL, FONT_SS},	/* 1	*/
    {FONT_LL, FONT_LS},	/* 2	*/    {FONT_LL, FONT_LL},	/* 3	*/
}, negbar_array[4] = {
    {FONT_LL, FONT_LL},	/* -3	*/    {FONT_SL, FONT_LL},	/* -2	*/
    {FONT_SS, FONT_LL},	/* -1	*/    {FONT_SS, FONT_SL},	/* 0	*/
};
#endif


/************************************************************************
 * Private functions							*
 ************************************************************************/
#ifdef CUST4
PRIVATE void OSD_cfgline2 (char, char, char, char, char, char, char);
#else
PRIVATE void OSD_cfgline (char, char, char, char, char);
#endif

/* PV FSOSD
 *
 *  Example Full Screen OSD Configuration:
 *  
 *        AREA 1______________________________
 *        |           |           |           |
 *        | REGION 1  | REGION 2  | REGION 3  |  LINE 1 (AREA 1)
 *         -----------------------------------
 *        | REGION 4  | REGION 5  | REGION 6  |  LINE 2
 *         -----------------------------------
 *        | REGION 7  | REGION 8  | REGION 9  |  LINE 3
 *        -------------------------------------
 *              .           .           .
 *              .           .           .
 *              .           .           .
 *        AREA 2______________________________
 *        |           |           |           |
 *        | REGION 10 | REGION 11 | REGION 12 |  LINE 1 (AREA 2)
 *         -----------------------------------
 *        | REGION 13 | REGION 14 | REGION 15 |  LINE 2
 *        -------------------------------------
 *
 *
 *
 *  NOTE: When reconfiguring OSD Areas, verify that the following defines are
 *        correct for your intended layout.
 *      1. OSD_TOTAL_AREAS
 *      2. OSD_LINES_IN_AREA_1 and OSD_LINES_IN_AREA_2 
 *      3. OSD_TIME_REGION & OSD_TIME_REGION_MASK
 *      4. OSD_TRACK_REGION & OSD_TRACK_REGION_MASK   
 *  
 * * * * * * * * * * * * * * * * * *
 * Initialize OSD parameters.
 */
void OSD_init()
{
    int i;

    EPRINTF(("&Lines: 0x%x, &Regions: 0x%x\n", OSD_lines[0], OSD_regions));

    /*  Example: line divided into three regions
     *   OSD_cfgline (OSD_LINE_#, OSD_AREA_#, 0, 7, 14);
     *
     *   [ 0 to 6 | 7 to 13 | 14 to 19 ]
     *
     *  NOTE: 
     *	1) Maximum of five lines (total) allowed
     *	2) No longer limited to even "start" values.
     */
#ifdef P4O

#ifdef FOUR_LINE_OSD
    OSD_cfgline (OSD_LINE_1, OSD_AREA_1, 0, 8, 14);  
    OSD_cfgline (OSD_LINE_2, OSD_AREA_1, 0, 8, 10);
    OSD_cfgline (OSD_LINE_3, OSD_AREA_1, 0, 4, 12);

    OSD_cfgline (OSD_LINE_1, OSD_AREA_2, 0, 2, 16);
#else
    OSD_cfgline (OSD_LINE_1, OSD_AREA_1, 0, 8, 14);  
    OSD_cfgline (OSD_LINE_2, OSD_AREA_1, 0, 8, 10);
    OSD_cfgline (OSD_LINE_3, OSD_AREA_1, 0, 8, 14);

    OSD_cfgline (OSD_LINE_1, OSD_AREA_2, 0, 4, 12);
    OSD_cfgline (OSD_LINE_2, OSD_AREA_2, 0, 2, 16);
#endif /* FOUR_LINE_OSD */

#else /* not P4O */
#ifdef CUST4
    OSD_cfgline2 (OSD_LINE_1, OSD_AREA_1, 0, 4, 12, 18, 22);  
    OSD_cfgline2 (OSD_LINE_2, OSD_AREA_1, 0, 4, 12, 18, 22);
#else /* not CUST4 */
#ifdef FOUR_LINE_OSD
    OSD_cfgline (OSD_LINE_1, OSD_AREA_1, 0, 7, 14);  
    OSD_cfgline (OSD_LINE_2, OSD_AREA_1, 0, 8, 16);
    OSD_cfgline (OSD_LINE_3, OSD_AREA_1, 0, 6, 14);

    OSD_cfgline (OSD_LINE_1, OSD_AREA_2, 0, 2, 16);
#else
    OSD_cfgline (OSD_LINE_1, OSD_AREA_1, 0, 8, 14);  
    OSD_cfgline (OSD_LINE_2, OSD_AREA_1, 0, 8, 14);
    OSD_cfgline (OSD_LINE_3, OSD_AREA_1, 0, 8, 14);

    OSD_cfgline (OSD_LINE_1, OSD_AREA_2, 0, 2, 12);
    OSD_cfgline (OSD_LINE_2, OSD_AREA_2, 0, 2, 16);
#endif /* FOUR_LINE_OSD */
#endif /* CUST4 */
#endif /* P4O */


    /* Initializing text, track and time */
    for (i = 0; i < OSD_MAX_CHAR; i++) {
        OSD_new[i] = ' ';
        if (i < OSD_MAX_REGIONS)
            OSD_schedule_time[i] = 0;
        if (i < OSD_TIME_SIZE) {
            OSD_new_time[i] = ' ';
        }
        if (i < OSD_TRACK_SIZE) {
            OSD_new_track[i] = ' ';
        }
    } 
    OSD_init_display();
}

void OSD_init_display(void)
{
    mvd[vid_scn_osd_hstart]	= OSD_HORZ_POS;
    mvd[vid_scn_osd_hend]	= OSD_HORZ_POS + OSD_HORIZ_END;

    mvd[vid_scn_osd_startstop]	= 0x5560; /* cr = 5, b = 21, e = 32 */
    mvd[vid_scn_osd_misc]	= 0x4;	    /* Load palette */
    mvd[vid_scn_osd_palette+ 0] = OSD_CLEAR;            /* 7000,Background   */
    mvd[vid_scn_osd_palette+ 1]	= (OSD_BLACK | 0xb);    /* e00b,Edge  */
    mvd[vid_scn_osd_palette+ 2] = (OSD_GREEN | 0xf);    /* 399f,Extra color  */
    mvd[vid_scn_osd_palette+ 3] = (OSD_WHITE | 0xf);    /* 700f,Foreground  */

    mvd[vid_scn_osd_misc]	= 0x40;  /* Reset mode */
}

#if 0
/*
 *  OSD_cfgVpos2():
 *  Function to adjust vertical position of the 2nd OSD area (Area2).
 *
 *  Inputs: 
 *      ntsc_pos -  Vertical position of Area2 in NTSC mode.
 */
void
OSD_cfgVpos2 (int ntsc_pos)
{
    Ntsc_osd_vert_pos2 = ntsc_pos;
    Pal_osd_vert_pos2 = 6*ntsc_pos/5 + 4; /* keep v.pos from shifting between PAL & NTSC */
    Ntsc_osd_vert_end2 = Ntsc_osd_vert_pos2 + OSD_LINES_IN_AREA_2*OSD_CHAR_HEIGHT/2 -1;    
    Pal_osd_vert_end2 = Pal_osd_vert_pos2 + OSD_LINES_IN_AREA_2*OSD_CHAR_HEIGHT/2 -1;
}
#endif

/*
 *  OSD_cfgline():
 *  Function to configure regions in a particular OSD line.
 *
 *  Inputs:
 *      line_num -  Index into the OSD 'line' structure.    
 *      area_num -  Index into the OSD 'area' structure.
 *      start1  -   Defines the starting index of region_1 in the line.
 *      start2  -   Defines the starting index of region_2 in the line.
 *      start3  -   Defines the starting index of region_3 in the line.
 *
 *  NOTE: 'start#' values are restricted to even numbers! 
 *  (using odd values may result in incomplete clearing of suppressed regions)
 */
#ifndef CUST4
void
OSD_cfgline (char line_num, char area_num, char start1, 
		char start2, char start3)
{
    int i;
    OSD_Region *osd_region_ptr = 
        &(OSD_regions[(area_num * OSD_REGIONS_PER_LINE * OSD_LINES_IN_AREA_1) + 
		      (OSD_REGIONS_PER_LINE * line_num)]);

    osd_region_ptr->start = start1;   
    (osd_region_ptr + 1)->start = start2;   
    (osd_region_ptr + 2)->start = start3;   

    /* NOTE: "end" holds the region's last character index position + 1, 
     * so that handling of message size is simpler,i.e. "size = end-start".
     */
    osd_region_ptr->end = start2;   
    (osd_region_ptr + 1)->end = start3;   
    (osd_region_ptr + 2)->end = OSD_MAX_CHAR;   

    for (i = 0; i < OSD_MAX_CHAR; i++)
        OSD_lines[line_num + area_num * OSD_LINES_IN_AREA_1][i] = 0xff;
}
#else /*CUST4*/
void
OSD_cfgline2 (char line_num, char area_num, char start1, char start2, 
		char start3, char start4, char start5)
{
    int i;
    OSD_Region *osd_region_ptr = 
        &(OSD_regions[(area_num * OSD_REGIONS_PER_LINE * OSD_LINES_IN_AREA_1) + 
		      (OSD_REGIONS_PER_LINE * line_num)]);

    osd_region_ptr->start = start1;   
    (osd_region_ptr + 1)->start = start2;   
    (osd_region_ptr + 2)->start = start3;   
    (osd_region_ptr + 3)->start = start4;   
    (osd_region_ptr + 4)->start = start5;   

    osd_region_ptr->end = start2 - 1;
    (osd_region_ptr + 1)->end = start3 - 1;   
    (osd_region_ptr + 2)->end = start4 - 1;
    (osd_region_ptr + 3)->end = start5 - 1;
    (osd_region_ptr + 4)->end = OSD_MAX_CHAR - 1;

    for (i = 0; i < OSD_MAX_CHAR; i++)
        OSD_lines[line_num + area_num * OSD_LINES_IN_AREA_1][i] = 0xff;
}
#endif /* CUST4 */


/*
 * OSD_output():
 * On screen display a given message at a given region for a given
 * duration. If this message is too long, the next region(s) will be
 * "suppressed" automatically.
 *
 * Inputs:
 *	region:		One of fifteen predefined OSD regions
 *	msg:		Message to display
 *	duration:	Number of seconds to display before disappearing.
 *			If duration is 0, then the message will be
 *			displayed until changed explicitly.
 *
 * Additional parameters for customized OSD_output
 *
 *      c_msg:		Chinese OSD string
 */
#ifdef BILINGUAL_OSD
void OSD_output(int region, unsigned char *e_msg, unsigned char *c_msg,
                int duration)
#else
void OSD_output(int region, unsigned char *osd_msg, int duration)
#endif
{
    int  new_count, curr_end, msg_count;
    unsigned short  tmp_mask;
    unsigned short region_mask = ptrLshift[region-1];
    OSD_Region  *osd_region_ptr;
    unsigned char *msg;


#ifdef BILINGUAL_OSD
    msg = (OSD_language == CHINESE_OSD) ? c_msg : e_msg; /* chinese first */
    chinese_ptr[region-1] = c_msg;
    english_ptr[region-1] = e_msg;
#else
    msg = osd_msg;
#endif

    if ((OSD_suppressed_regions & region_mask)
#ifdef CUST4
	&& !OSD_msg_override
#endif 
       )
        return; /* region is suppressed */


#if (P1O || P2O || P3O || P4O)
    if (disableOsd) return;
#endif

#ifdef CUST4
    if (!vcx_osd_on) return;
#endif

#ifndef BF43
    if (mineomine &&
	region_mask & (OSD_LINE_2_MASK|OSD_LINE_3_MASK|OSD_LINE_4_MASK|OSD_LINE_5_MASK)) {
	if (!(region_mask & OSD_LINE_2_MASK) &&
	    OSD_displayed_regions & OSD_LINE_2_MASK) {
	    OSD_clear_line(OSD_LINE_2, OSD_LINE_2_MASK);
	} else if (!(region_mask & OSD_LINE_3_MASK) &&
	    OSD_displayed_regions & OSD_LINE_3_MASK) {
	    OSD_clear_line(OSD_LINE_3, OSD_LINE_3_MASK);
	} else if (!(region_mask & OSD_LINE_4_MASK) &&
	    OSD_displayed_regions & OSD_LINE_4_MASK) {
	    OSD_clear_line(OSD_LINE_4, OSD_LINE_4_MASK);
	} else if (!(region_mask & OSD_LINE_5_MASK) &&
	    OSD_displayed_regions & OSD_LINE_5_MASK) {
	    OSD_clear_line(OSD_LINE_5, OSD_LINE_5_MASK);

⌨️ 快捷键说明

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