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

📄 play.old

📁 一个两碟控制的VCD的代码,两碟之间的转动及连续播放,已大量生产的CODE.
💻 OLD
📖 第 1 页 / 共 5 页
字号:
    User defined data structures
------------------------------------------------------------------------*/
short      	           list_previous_list_offset=0;
short  		           list_next_list_offset=0;
static short               list_return_list_offset=0;
static short               play_list_playing_time=0;
static short               play_list_play_item_number=0;
static unsigned char       play_list_number_of_items=0;
static unsigned char       play_list_play_item_wait_time=0;
static unsigned char       play_list_auto_pause_wait_time=0;
static int		   play_still_retry;
#ifdef NGAME
static unsigned char       game_list_local_cpu_type=0;
static short               game_list_misc_def=0;
static short               game_list_buffer_size=0;
#endif

static int                 selection_list_loop_count;
static short               selection_list_default_list_offset=0;
static short               selection_list_time_out_list_offset=0;
static short               selection_list_play_item_number=0;
static unsigned char       selection_list_jump_time=0;
static unsigned char       selection_list_number_of_selections=0;
static unsigned char       selection_list_base_of_selection_number=0;
static unsigned char       selection_list_wait_time_for_timeout=0;
static unsigned char       selection_list_loop_count_and_jump_timing=0;

static int play_item_begin_time;   /* mmssff : the begining mmssff */
static int play_item_real_end_time;/* mmssff : the real end time of the item */
static int play_item_start_time;   /* mmssff : the start playing mmssff */
static int play_item_end_time;     /* mmssff : the play end time of the item */
static unsigned char play_item_mode=0; /* record stop or play mode. */
static unsigned char play_item_type=0; /* AUDIO or DATA track */

char wait_pause=0;
static int initCD_done;		/* the initCD() successfully complete. */
/*------------------------------------------------------------------------
  Global Variables
------------------------------------------------------------------------*/
unsigned char   track_list[99]; /* the track play list */
unsigned int    track_list_max; /* max track used in track_list */
unsigned char   track_map[13];      /* track map for motion picture */

int current_key = NO_KEY;       /* The key received from users          */
static int assign_key = NO_KEY;	/* Key assigned from play machine.      */
int play_state;                 /* The state of play state machine      */
static int play_state_before_auto_pause;
static int auto_pause_reset_time;
int trigger_event;              /* Store why the state changed          */

static unsigned char vocal_assist_on=0;
static unsigned char audio_mode = 0;
static unsigned char repeat_mode = 0;
                                /* Store the repeat mode data.          */
static unsigned char program_on = 0;
static unsigned char shuffle_on = 0;
                                /* Store the shuffle mode data.         */
unsigned char cur_list_state=0;
                                /* Record whether we are playing track  */
                                /* list, selection list or play list.   */

char  cur_track_index=0;  /* index to the track play list */
static int pre_psd_offset;	/* store the previous psd offset, so we
				   can come back if the new psd offset
				   is not valid. */

static int cur_psd_offset;      /* current psd offset number            */
static unsigned int timeout_begin_time; /* the time in 1/64 second unit */
                                /* when the timer is set. */
int set_abort_ltoc;             /* 1 -> allow abort_ltoc_flag to be set */

static unsigned char fast_frame_index=0; /* FF/FR index of fast_rame_ary to */
                                /* control FF/FR speed.                */
static unsigned char slow_motion_index=0;
                                /* Indicate the speed of slow motion.  */
int repeat_a2b_start_time;      /* MMSSFF format of the start time in
                                   in repeata2b mode.                   */

unsigned char cd_opened = 0;	/* 1 -> CD is opened.               */
static unsigned char cd_opened2 = 0;    /* 1 -> CD is opened.               */
static unsigned char disk_exist=0;        /* 1 -> CD is not empty.       */

unsigned char repeat_a2b=0;

/*add*/

static int    continuetime1;
static int    continuetime;
static unsigned char    continue_min;
static unsigned char    continue_sec;
unsigned char    continue_play;
unsigned char    disc_ltoc;

int vfdled = 0xff;
static unsigned char    karaoke_flag = 0 ;
static unsigned char    xuechang_flag = 0 ;
static unsigned char    stopresume_flag = 0;

#ifdef MEIXINDA_REMOTE
unsigned char    mode_state = 0;
#endif




#ifdef  TWO_CDS
static void write_disc_ltoc(int);
int process_change_disc(int);
unsigned char    opening = 0;
unsigned char    closing = 0;
static unsigned char    closing2 = 0;
static int              rotate_change = 0;
#endif

int              rotate_timer = 0;
static unsigned char    rotate_flag = 0;





#ifdef ALLONE
#define VOCAL_MIC_HIGH            (EAUX5_HIGH)
#define VOCAL_MIC_LOW             (!VOCAL_MIC_HIGH)
#else
#define VOCAL_MIC_HIGH            (EAUX12_HIGH)
#define VOCAL_MIC_LOW             (!VOCAL_MIC_HIGH)
#endif

static int      start_timer;
static unsigned char screen_flag = 1 ;
unsigned char    screen_display = 0 ;
static int     panel_osd_timer;


#ifdef USE_SLEEP
static  int sleep_timer;
static  int sleep_limit_timer;
static unsigned char sleep_flag = 0 ;
#endif


static unsigned char intro_mode=0; /* 1 -> we are in intro mode          */
static unsigned char goto_absolute=0; /* 1 -> in the absolute goto mode */
unsigned char   cd_stop = 1;

/* variables store some data in info.vcd. */
int PSD_size;                   /* The size of PSD in bytes. */
unsigned char offset_mul=0;       /* offset_mul byte. */

/* variable relative to auto pause */
static unsigned char auto_pause=0;  /* 1 -> pause is caused by trigger bit.*/

/* variables relative to goto function */
static unsigned char goto_digit=0;        /* 1 -> 1st digit of min,
                                           2 -> 2nd digit of min,
                                           3 -> 1st digit of sec,
                                           4 -> 2nd digit of sec.
                                           */
static unsigned char goto_min=0, goto_sec=0; /* user inputs time */
static unsigned char got_goto_time=0;     /* 1 -> got go to time */
static unsigned char keep_goto_key=0;
unsigned int  goto_time; /* time to go relative to item start time */

/* variables relative to index+ and index- functions */
unsigned int track_entry_beg;   /* 1 base from the beginning of CD */
unsigned int track_entry_end;
unsigned int track_current_entry;
unsigned int track_entry_number;
int next_entry_time;  /* used to update index number on lcd */


/* variables to keep the valid selection numbers */
short upper_selection_limit;    /* the good selection upper bound */
short lower_selection_limit;    /* the good selection lower bound */

/* variables for program mode */
unsigned int ProgramedTrack;    /* keep the track ids in program mode */

static int TotalProgramTime;	/* In mm:ss:ff (CD format, i.e. BCD)	*/
int TotalRemainTime;		/* In mm:ss:ff (CD format, i.e. BCD)	*/
int CurrentTrackTime;		/* In mm:ss:ff (CD format, i.e. BCD)	*/


static osd_time_key_index;	/* indicates what is on the screen */
int cd_disc_slot;
unsigned char cd_tray_just_closed = 0;
static unsigned char in_digest_mode = 0;	/* Is it in digest mode ? */
static unsigned char VCD_11_or_20=0;
static unsigned char cddigest_start_track=0;
static unsigned char set_mode_key=0;	/* flag to indicates that we need
					   to assign MODE_KEY to current_key
					   if the disc is vcd1.1 */

static unsigned char ResumeMinute=0, ResumeSecond=0, ResumeTrack=0;
static int ResumeVertSz, ResumeHorizSz;
static int just_init_CD;

#ifdef VOLUME_CONTROL
/* variables regarding to audio volume control */
PRIVATE unsigned short vcxVolume[] = {
    0x0000,	/*  0    */
    0x0101,	/*  1/16 */
    0x0202,	/*  2/16 */
    0x0303,	/*  3/16 */
    0x0404,	/*  4/16 */
    0x0505,	/*  5/16 */
    0x0606,	/*  6/16 */
    0x0707,	/*  7/16 */
    0x0808,	/*  8/16 */
    0x0909,	/*  9/16 */
    0x0a0a,	/* 10/16 */
    0x0b0b,	/* 11/16 */
    0x0c0c,	/* 12/16 */
    0x0d0d,	/* 13/16 */
    0x0e0e,	/* 14/16 */
    0x0f0f,	/* 15/16 */
    0x1010,	/* 16/16 */
};

#define AUDIO_MAX_LEVEL	16
#define AUDIO_MIN_LEVEL 0
#define	AUDIO_BUFSZ	(((AUDIO_MAX_LEVEL-1)/2) + 5) /*<level><space><digits>*/

int is_audio_mute;
int audio_level = 16;

void process_mute_key();
void process_volume_key(int level);
static void    osdVolumeBar(int, int);

/*------------------------------------------------------------------------
  Function:

  Parameters:

  Description:
------------------------------------------------------------------------*/
void reset_audio()
{
    is_audio_mute = 0;
    audio_level = AUDIO_MAX_LEVEL;
}

void process_mute_key()
{
    unsigned char *msg, *c_msg;

    is_audio_mute ^= 1;
    if (is_audio_mute) {    /* Set to 0 */
	assign_osd_msg(msg, MSG_mute, c_msg, MSG_c_mute);
        vcx_audio_volume = 0;
    } else {    /* Restore */
	assign_osd_msg(msg, clear_msg, c_msg, clear_msg);
        vcx_audio_volume =  (unsigned int) vcxVolume[audio_level];
    }

    /* Display indefinitely while MUTING */
#ifdef KANGHUI
    OUTOSD(OSD_FUNCTION_STATUS_REGION, msg, c_msg, 0);
#else
    OUTOSD(OSD_AUDFX_REGION, msg, c_msg, 0);
#endif
}

void process_volume_key(int change_level)
{
    /* Turn off mute mode if we are in mute mode. */
    if (is_audio_mute) {
	process_mute_key();
    }

    audio_level += change_level;
    if (audio_level > AUDIO_MAX_LEVEL)
	audio_level = AUDIO_MAX_LEVEL;
    else if (audio_level < AUDIO_MIN_LEVEL)
	audio_level = AUDIO_MIN_LEVEL;

    vcx_audio_volume = (unsigned int) vcxVolume[audio_level];

    /* show osd */
    osdVolumeBar(audio_level, DISPLAY_TIME_OUT);
}

/*(This function is taken from po4tact.c)
 * Display the volume bar.
 *
 * Input:
 *	level:	an integer between AUDIO_MIN_LEVEL (0) and
 *		AUDIO_MAX_LEVEL (16).
 *	osdlen:	number of seconds to show this OSD
 */
PRIVATE unsigned char	volumebarbuf[AUDIO_BUFSZ] = "           ";
PRIVATE void osdVolumeBar(level, osdlen)
int level;
int osdlen;
{
    int i, tmp = 0;

    if (level > AUDIO_MIN_LEVEL) tmp = (level - 1) >> 1;

    for (i = tmp; i <= ((AUDIO_MAX_LEVEL - 1) >> 1); i++) {
	asm("nop");
	volumebarbuf[i] = FONT_SS;
    }

    for (i = 0; i < tmp; i++) {
	asm("nop");
	volumebarbuf[i] = FONT_LL;
    }

    if (level > 0) volumebarbuf[tmp] = ((level - 1) & 1) ? FONT_LL : FONT_LS;

    if (level <= 9) {
	volumebarbuf[AUDIO_BUFSZ - 3] = ' ';
    } else {
	level -= 10;
	volumebarbuf[AUDIO_BUFSZ - 3] = '1';
    }

    volumebarbuf[AUDIO_BUFSZ - 2] = '0' + level;
    OUTOSD(OSD_KARAOKE_REGION, volumebarbuf, volumebarbuf, osdlen);
}

#endif

/*------------------------------------------------------------------------
  Function:

  Parameters:

  Description:
------------------------------------------------------------------------*/
void reset_play_machine()
{
    current_key = STOP_KEY;
    play_state = ENTRY_STATE;

#ifdef NEW_THREE_CDS
    if (continue_play == 3)
       continue_play = 0;
#endif

#ifdef TWO_CDS
    if (continue_play == 2)
       continue_play = 0;
#endif
}

/*------------------------------------------------------------------------
  Function: play_item
  Parameters:
      playitem_number: The playitem_number is from play_item in
                       selection list or play list.
  Description:
      This function will call proper function to play motion picture,
      segment item or entry item depending on the value of
      playitem_number.
------------------------------------------------------------------------*/
static void play_item(int playitem_number)
{
    /* reset entry variables. The values are chosen to no index at init */
    picture_type = 0xe0;
    track_entry_beg = 1000;
    track_entry_end = 0;
    track_entry_number = 1;
    next_entry_time = x00999999;/* set it a very big number, so we want
                                   update the lcd index number if we are
                                   not in play entry in track mode. */

    /* reset a2b if a2b flag is on */
    if (repeat_a2b) {/* REPEAT_AB_START or REPEAT_AB_END */
	repeat_a2b = REPEAT_AB_OFF;
	panel_repeat_ab(REPEAT_AB_OFF);
    }

    /* remember the play item */
    cur_vcd_playitem = playitem_number;

    /* 2..99 -> play track */
    if ((playitem_number > 1) && (playitem_number < 100)) {
        play_track(playitem_number - 1); /* convert to 1 base */

        cur_track_number = playitem_number - 1; /* for display purpose */
    } else if ((playitem_number > 99) && (playitem_number < 600)) {
        play_entry(playitem_number - 99); /* 100..599 -> play entry */
    } else if ((playitem_number > 999) && (playitem_number < 2980)) {
        play_segment(playitem_number - 999); /* 1000..2979 -> play segment */
    } else {
        /* wrong item number. We go to the PLAY_WAIT_TIME_STATE and
	   hopefully, we will get good play item next time after
	   time expired or user inputs.*/
	play_state = PLAY_WAIT_TIME_STATE;
    }
}

/*------------------------------------------------------------------------
  Function:

  Parameters:

  Description: This function checks if we need to adjust the
               play_item_end_time.
------------------------------------------------------------------------*/
void check_playing_time()
{
    int mmssff;

    /* if we are playing item from play list, we need to check the */
    /* playing time.                                               */
    if ((cur_list_state ==  PLAY_LIST_STATE) &&
        (play_list_playing_time > 0)) {
        mmssff = logical2physical(5*(play_list_playing_time));
        play_item_end_time =
            adjCDtime(play_item_start_time, mmssff, 1);
    }
}

/*------------------------------------------------------------------------
  Function: play_track
  Parameters:
      track_number: The track number to be played. The track number is
          1 base. For VideoCD, the mpeg track number starts at 2 is
          converted to 1 base. Fox example: If we want to play track 2
          on video CD, the track_number should be 1.
  Description:
      It plays an MPEG audio/video track.
------------------------------------------------------------------------*/
static void play_track(int track_number)
{
    int mmssff;

    /* reset bad audio frame counter to zero at the beginning */
       bad_track_len = 0;

    /* reset picture_type to normal */
    picture_type = 0xe0;
    /* update panel */
    panel_play_track(track_number);

    /* 15-08-96 Alger */
    getTrackTime(track_number, &CurrentTrackTime);
    dsa_reset();

⌨️ 快捷键说明

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