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

📄 poshare.c

📁 一个不错的硬盘播放器程序,包含VFD显示程序,红外线遥控程序,硬盘读写程序,及解码程序等.
💻 C
字号:
/* Copyright 1996, ESS Technology, Inc.					*//* SCCSID @(#)poshare.c	1.30 12/16/97 *//*  * This is based on version 1.47 of 3204 code. *//* * $Log$ */#include "common.h"#include "const.h"#include "digest.h"#include "display.h"#include "fsosd.h"#include "mpeg1vid.h"#include "mvd.h"#include "sysinfo.h"#include "tact.h"#include "tdm.h"#include "timedef.h"#include "util.h"#include "vcxi.h"#include "vscale.h"#include "ioport.h"#include "ir.h"#include "xport.h"#include "zoom.h"/************************************************************************ * Local variables							* ************************************************************************/PRIVATE	char	idleClearOsd = 0;	/* When we are "idle", clear	*					 * any OSD left on screen	*/PRIVATE	unsigned int	idleTimer;	/* When data stops, we start	*					 * an idleTimer.		*//************************************************************************ * Functions imported from other modules.				* ************************************************************************/IMPORT	void	InitVscale(void);#ifndef LATERPRIVATE void	digestE2(int);#endif/* * This routine ensures a clean switch to a black screen showing from * B frame. */void showDarkBframe(){    done_blank = 0;    do_blank = 1;    do {} while (!done_blank);    DISP_frame = B;    DISP_paint_screen(COLOR_BLACK, NORMAL_PAINT, FILL_B);    DISP_count = 0;    do_blank = 0;}/* * This routine sends a skip signal to the CD loader and update some * internal data structure. */void skipTrack(){    PO_ASSERT_SKIP;		/* Tell loader to skip			*/    /* Schedule to clear */    clearSkipTime = glbTimer + skipWidth;	}/* * Assert pause signal */void assertPause(){    PO_ASSERT_PAUSE;		/* Tell loader to pause			*/    clearPauseTime = glbTimer + pauseWidth;    skipPauseOsd = 1;		/* Skip the next PAUSE key (we sent it!)*/#if (P1O || P2O || P4O)    /*     * If we assert pause, then we'll disable timeout until new data     * come in.     */    ignoreTimeOut = 1;#endif}#if 0/* * Assert play signal. Play is really the same signal as pause. I * don't want to use the assertPause routine because we set skipPauseOsd * there. */void assertPlay(){    PO_ASSERT_PLAY;		/* Tell loader to play			*/    clearPauseTime = glbTimer + pauseWidth;}/* * Routine to call after a pause in digest. */void postDigestPause(){#if (P1O || P2O)    /*     * If we are pausing inside digest, then user must have just     * pressed 1) play key 2) next key.     *     * If "play" key is pressed (i.e. nextNplay == 0), then we need     * to drop the incoming data and force the load to skip to next     * track.     *     * If "next" key is pressed and it leads to play (i.e. nextNplay == 1),     * then we are already getting the right data. No need to skip     * again.     */    if (!nextNplay) {	/* If "next" key does not lead to play		*/	whenDelaySkip = glbTimer + delaySkipAmount;    }    /*     * I suspect the code should be:     *    if (!nextNplay) {     *	      whenDelaySkip = glbTimer + delaySkipAmount;     *    }     */#endif    nextNplay = 0;	/* Next key is seen and processed.		*/    digestPause = 0;	/* Done with pausing */}#endif#ifdef LATER/* * The output resolution has just changed. In order to do a smooth * transition, we need to blank the screen. * * Input: *	newtype:	The resolution of the incoming data. */void processChangeVideo(newtype)int newtype;{    if (!vcx_digest) {	if ((newtype == 0xe2) || (vcx_user_video_stream == 0xe2)) {	    /*	     * We only blank screen if we are going into or out of	     * E2 resolution.	     */	    done_blank = 0;		    do_blank = 1;		    /* Up to 1/60 of a second here! */	    do ; while (!done_blank);	    if (vcx_user_video_stream == 0xe2) {		/* Old data is in E2 format */		DISP_frame = FILL_B;		DISP_paint_screen(COLOR_BLACK, NORMAL_PAINT, DISP_frame);	    } else {		/* New data is in E2 format */		DISP_frame = FILL_E2;		DISP_paint_screen(COLOR_BLACK, NORMAL_PAINT, DISP_frame);	    }	    do_blank = 0;	}    }#ifdef VSCALE    /*     * Kill any pending scaling; otherwise, we may get half black     * half screen screen!     */    if (vcx_scn_vscale != 0x10)      VscaleReady = VscaleStart = 0;      #endif    vcx_pause = VC_EMERG_SAVE;    vcx_user_video_stream = newtype;}#endifvoid slowServices(){    unsigned int idletime = 0;    if (TDM_send_skip) {	/*	 * We may want to skip track 1 for one reason or another.	 * This decision is made inside TDM, but we don't want to	 * hog CPU inside the TDM handler, so we defer jumping	 * to here.	 */	skipTrack();	TDM_send_skip = 0;	TDM_most_recent_video = 0; 	/* For safety (avoid cont. jump)*/	TDM_skip_sent = 1;		/* Skip already sent. 		*/    }    if (osdSelect) {	/*	 * We are asked to show the "SELECT" string (probably because	 * we see a still picture.	 */	assertPause();	/* Send IR in background process */#if (P1O || P2O)	OUTOSD(1, MSG_select, MSG_c_select, 3);#else	OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_select, MSG_c_select, 0);#endif	osdSelect = 0;    }	    /*     * If we are in the "guess" mode, i.e. there is no data, then     * we start an "idle timer". Popping of logo depends on this     * timer.     *     * Don't start idleTimer if we are zooming (i.e. don't pop logo     * just because we are zooming)     */    if (!XPORT_active #ifdef ZOOM	&& !zoom_level#endif) {	if (idleTimer == 0) idleTimer = glbTimer;	else idletime = glbTimer - idleTimer;    } else idleTimer = 0;    /*     * Idle for 10 seconds while we are in digest. The loader may be     * opened or paused. Quit digest mode!     *     * One exception is when we pause inside digest waiting for     * human to make selection, we don't want to time out.     */    if (vcx_digest && (idletime > TEN_SECOND) && !digestPause) {	quitDigest();	inDigestShadow = 1;	/* Still showing digest screen! */    }    /*     * If there is data, then by definition, we are not showing     * digest screen.     */    if (XPORT_active) {	inDigestShadow = 0;	idleClearOsd = 1;	/* Not idle! Next time when we are	*				 * idle, clean up any OSD left on screen*/    }    /*      * Idle for 15 seconds, show logo screen. We'll not do this if     * we are in digest mode.     *     * We also want to ignore time out if CD is paused by us.     */    if (!vcx_digest && !ignoreTimeOut) {	if ((idletime > FIFTEEN_SECOND)#ifdef P4O	    /* Likely to be end of disc */	    || ((playMode != MODE_PAUSE) && (idletime > FIVE_SECOND))#endif	    ) {	    displayLogo = 1;	/* Normal case. Display logo */	    /* In case there is OSD, clear it! */	    if (idleClearOsd) {		CLEARALLOSD();		idleClearOsd = 0;	/* OSD, if any, is cleared */	    }	    resetMode();	/* Reset play mode to normal */	}    }	    if (foundVCDversion && !vcx_digest) {	msgVCD[ 9] = vcdVersion >> 8;	msgVCD[10] = '.';	msgVCD[11] = vcdVersion & 0xff;#ifdef BILINGUAL_OSD	c_msgVCD[ 9] = vcdVersion >> 8;	c_msgVCD[10] = '.';	c_msgVCD[11] = vcdVersion & 0xff;#endif#if (P1O || P2O)	/*	 * If it is not 2.0 VCD, just show "VIDEO CD"	 */	if (vcdVersion != 0x3230) {	    msgVCD[9] = 0;#ifdef BILINGUAL_OSD	    c_msgVCD[9] = 0;#endif	}#endif	OUTOSD(OSD_CD_TYPE_REGION, msgVCD, c_msgVCD, 8);    }    foundVCDversion = 0;#ifdef LATER    /*     * My original understanding is we don't have to do anything when     * change between E0 and E2. It seems the assumption is not completely     * ture, but I'll suspend it for the timebeing.     */    /*     * Don't use changeVideoType to make decision. It may have been     * cleared by a prior call to emergency save (this is likely     * when changing from E2->E0. If E2 is partially finished when     * we switch, it is likely to call emergency save first, whenich     * clears changeVideoType.     *     * keepVideoType is set to 0 when we exit digest mode. We don't     * want to clear screen due to exiting from digest mode.     */    if ((keepVideoType != (char) vcx_user_video_stream) &&	(keepVideoType != 0)) {	/*	 * This is a "safe" place, and we have just changed the video	 * data type. Blank the screen so we don't have garbage data	 * on screen when we change the resolution.	 */		pack_rdptr = newVideoAddr;	sys_rdptr = (unsigned char *) pack_rdptr;	/* Don't change sys_wrptr, it is alreay right */	processChangeVideo((int) (unsigned char) keepVideoType);	/* emergency_save_routine() will reset changeVideoType */    }#endif    if (displayLogo) {#if (P1O || P2O)	/*	 * For play-only machines 1 and 2, logo is shown in digest	 * only if we play CDDA. According to the new definition,	 * CDDA will automatically quit digest mode and go to	 * normal play.	 */	if (vcx_digest) quitDigest();#endif	if (showingLogo == SHOWING_NOLOGO) {	    /*	     * In digest mode, if we are playing audio only (i.e. logo	     * is already shown,) then don't show logo again.	     */#if LATER	    if (!(vcx_digest && vcx_playaudio_only)) {#else	    if (!vcx_digest) {#endif		/*		 * Paint background black so after logo, we'll not		 * see "frame swap"		 */		showDarkBframe();		show_mpeg_still(0xe1, powerupScreen, T_powerupScreen_SZ >> 2);		cleanSystemState();		/*		 * If we are showing logo, then we are naturally not		 * showing the digest screen (i.e. no longer in the		 * shadow of digest.)		 */		inDigestShadow = 0;	    }	    if (displayLogo == 2) {		/*		 * Show logo in digest when we find E2 data. This is		 * really not a true digest picture, so subDigestFinish		 * should not be set.		 */		digestE2(1);	    }	    /* 	     * Since vcx_user_video_stream is set to E0 by showLogo,	     * we need to set keepVideoType to E0 too; otherwise, if	     * we do E2->audio->E2, changeVideoType will not be	     * set (keepVideoType == pack_id), but vcx_user_video_stream	     * is E0 ==> incoming E2 will be dropped.	     */	    keepVideoType = (char) 0xe0;	    /*	     * In digest mode, each logo is shown in a small screen.	     * So we allow multiple logos.	     */	    if (!vcx_digest) showingLogo = SHOWING_POWERUPLOGO;	}	displayLogo = 0;    }    processTact();#ifdef OLDOSD    if (scheduleOsdTime < glbTimer) {	scheduledClearOsd();#else    if (OSD_scheduled_regions) {	int tmp;	unsigned short  region_mask;	for (tmp = 0; tmp < OSD_MAX_REGIONS; tmp++)	{ 	   region_mask = ptrLshift[tmp];       	   if ( (OSD_scheduled_regions & region_mask) &&		(OSD_schedule_time[tmp] < glbTimer) )	   {		OSD_clear_region(tmp+1);		OSD_scheduled_regions &= ~region_mask;	   }	}#endif#ifdef P4O	/*	 * If we are in pausing mode, show 'PAUSE' OSD.	 */	if (playMode == MODE_PAUSE)#ifdef OLDOSD	  outputOsd(0, MSG_pause, 0, OSD_NOTRACK);#endif /* OLDOSD */#endif	if (disableOsd) {	/* Delayed clearing of vcx_osd_on	*/	    vcx_osd_on = 0;	    disableOsd = 0;	}    }    /* Check if "MUTE" needs to be brought back */#ifndef BF43    if (mineomine) {	/* Checking OSD lines 2,3,4(restricted mode)..	 * for AUDIO region	 */	if (!(OSD_displayed_regions & 	      (OSD_LINE_2_MASK|OSD_LINE_3_MASK|OSD_LINE_4_MASK)) &&	    (muteAudio)) {	    OUTOSD(OSD_AUDIO_REGION, MSG_mute, MSG_c_mute, 0);	}    } else#endif /* not BF43 */    {		if (!(OSD_displayed_regions & OSD_REGION_10) && muteAudio)	    OUTOSD(OSD_AUDIO_REGION, MSG_mute, MSG_c_mute, 0);    }}/* * Cleanly reset the system state. */void cleanSystemState(){    int offset = XPORT_OFFSET_FUZZY_PLAY;    int swap = 0;    system_reset();    system_start();#if 0    if (TDM_isCDDA) {	offset = XPORT_OFFSET_PLAY_CDDA;	swap = 1;    }    XPORT_active = 1;#else    TDM_setIsCDDA = 1;    TDM_cntInterrupt = 0;    TDM_isCDDA = 0;    PO_newdata = 3;    XPORT_active = 0;#endif    XPORT_restart_at(offset, swap);    TDM_turn_on();}/* * Change the TV encoder setting (also force display of logo) */void changeTVmode(scn_height) int scn_height;{    vcx_scn_height = scn_height;    DISP_change_TV();    /*     * Even though we have done VSCALE stuff earlier, we still need to     * display logo again if we are in the middle of log displaying.     * This is because we restore vcx_VertSz after displaying logo,     * so vcx_VertSz may not be accurate. We restore vcx_VertSz     * because we want to continue proper scaling after pause.     */    if (showingLogo != SHOWING_NOLOGO) {	displayLogo = 1;	/* May need to rescale, so show logo again */	showingLogo = SHOWING_NOLOGO;    }}#ifndef LATERvoid digestE2(int n){}#endif

⌨️ 快捷键说明

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