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

📄 plays.c

📁 ESS3890+SL原代码(1*16内存)
💻 C
📖 第 1 页 / 共 5 页
字号:
    if (selection_list_play_item_number < 600) {
	/*
	 * HACK: We ignore the jump time for track or entry in track,
	 * since track might take a long time and user will think that
	 * the player is dead since the player is not accepting any new key.
	 */
	selection_list_jump_time = 0;
    } else {
	selection_list_jump_time =
	    selection_list_loop_count_and_jump_timing & 0x80;
    }
#ifdef SCENE
    current_list_id = *((short *)(scratch_buf+4));
#endif /*SCENE*/
}

/*------------------------------------------------------------------------
  Function:assign_play_list
  Parameters:
      scratch: Is a pointer to a play list data.
  Description:
      Assign selection data to a play_list structure.
------------------------------------------------------------------------*/
static void assign_play_list(unsigned char *scratch_buf)
{
    play_list_number_of_items = scratch_buf[1];
    list_previous_list_offset = *((short *) (scratch_buf + 4));
    list_next_list_offset = *((short *) (scratch_buf + 6));
    list_return_list_offset = *((short *) (scratch_buf + 8));
    play_list_playing_time = *((short *) (scratch_buf + 10));
    play_list_play_item_wait_time = scratch_buf[12];
    play_list_auto_pause_wait_time = scratch_buf[13];
    play_list_play_item_number =
	(VCD_ptr_resume_info->state == RESUME_RESTORE) ?
	VCD_ptr_resume_info->trk_or_item : 1/* default */;
#ifdef SCENE
    current_list_id = *((short *)(scratch_buf+2));
#endif /*SCENE*/
}

#ifdef GAMEBOY
static void assign_game_list(unsigned char *scratch_buf)
{
    play_list_number_of_items = 1;
    list_previous_list_offset = *((short *) (scratch_buf + 4));
    list_next_list_offset = *((short *) (scratch_buf + 6));
    list_return_list_offset = *((short *) (scratch_buf + 8));
    play_list_playing_time = 0;
    play_list_auto_pause_wait_time = 0;
    play_list_play_item_wait_time = 0xff;
    play_list_play_item_number = 1;	/* default play item */
    game_list_local_cpu_type = *((unsigned char *) (scratch_buf + 1));
    game_list_misc_def = *((short *) (scratch_buf + 10));
    game_list_buffer_size = *((short *) (scratch_buf + 12));
}
#endif

/*--------------------------------------------------------------------
   Parameters:
   begin_time   is the time in 1/64 unit when timer is set.
   expire_time  is the wait time in VIDEO CD represetation.

   Return value:
       Return 1 when time expired. Otherwise return 0.
----------------------------------------------------------------------*/
static int is_time_expired(unsigned int begin_time, short expire_time)
{
    int expire_seconds;
    int expire_time_period;	/* in 1/64 second unit */
    int time_pass;

    /* no wait */
    if (expire_time == 0)
	return (1);

    /* infinite */
    if (expire_time == 0xff)
	return (0);

    expire_seconds =
	(expire_time <= 60) ? expire_time : (expire_time - 60) * 10 + 60;
    expire_time_period = expire_seconds * ONE_SECOND;

    time_pass = glbTimer - begin_time;
    if (time_pass < 0)
	time_pass -= 1;

    if (time_pass >= expire_time_period) {
	return (1);
    }
    return (0);
}

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

  Description:
     This function returns a random value between 1 and mod_number
     (included) .

  NOTE: This function only works for mod_number <= 2048
------------------------------------------------------------------------*/
#define MASK    0x57
unsigned int SeedSeed = 0xbadface;
int get_random_number(unsigned short mod_number)
{
    unsigned int number;


    if (mod_number <= 0) return(1); /* for invalid mod_number */

    if (SeedSeed & x80000000)
        SeedSeed = ((SeedSeed ^ MASK) << 1) | 1;
    else
        SeedSeed <<= 1;

    number = SeedSeed >> 21; /* 0 <= number <= 2047 */

    while (number >= mod_number)
        number -= mod_number;

    number++;   /* get number from 1 to mod_number */

    return (number);
}

void fill_track_list()
{
    int track_num;
    int i, tmp;
    int adj=CDinfo.firsttrack-1; /* for 1st track not beginning at "one" */


    track_list_max = 0;	/* do not remove, since find_track_number
			 * needs it. */
    tmp = (num_of_track > MAX_TRACK_NUMBER) ?
	MAX_TRACK_NUMBER : num_of_track;
    for (i = 0; i < tmp; i++) {
	if (shuffle_on) {
	    do {
		track_num = get_random_number(num_of_track);
		track_num+=adj;
	    } while (find_track_number(track_num));
	} else {
	    track_num = i + adj + 1;
	}
	track_list_max++;
	track_list[i] = track_num;
    }

/* PV..don't want to do this when pbc on...
    cur_track_index = 0;
    cur_track_number = track_list[0];
*/
}

void show_audio_panel(int show_osd)
{
    unsigned char *msg, *c_msg;
    int region;

    region = OSD_AUDIO_REGION;	/* default */
#if defined(VCDLC) && defined(DATA_CD)
    /* for MP3, don't want to conflict with NPOSD region */
    if (STREAM_type) region = 7;
#endif

    if (audio_mode < VOCAL_LEFT_LEFT) {
	VFD_icon(VFDICON_vocal_off);
	OSD_clear_region(OSD_VOCAL_REGION);
	vocal_assist_on = 0;
    }
    vcx_audio_channel = audio_mode;
    if (audio_mode == LEFT_LEFT) {
	VFD_icon(VFDICON_mono_l);
	assign_osd_msg(msg, MSG_left, c_msg, MSG_c_left);
    } else if (vcx_audio_channel == RIGHT_RIGHT) {
	VFD_icon(VFDICON_mono_r);
	assign_osd_msg(msg, MSG_right, c_msg, MSG_c_right);
    } else if (vcx_audio_channel == LEFT_RIGHT) {
	VFD_icon(VFDICON_stereo);
	assign_osd_msg(msg, MSG_stereo, c_msg, MSG_c_stereo);
    } else {
	vocal_assist_on = 1;
	vcx_audio_channel = LEFT_RIGHT;
	VFD_icon(VFDICON_stereo);
	if (audio_mode == VOCAL_LEFT_LEFT) {
	    VFD_icon(VFDICON_vocal_l);
	    assign_osd_msg(msg, MSG_vocal_left, c_msg,
			   MSG_c_vocal_left);
	} else if (audio_mode == VOCAL_RIGHT_RIGHT) {
	    VFD_icon(VFDICON_vocal_r);
	    assign_osd_msg(msg, MSG_vocal_right, c_msg,
			   MSG_c_vocal_right);
	}
#ifdef VCDLC
	/* for MP3, don't want to conflict with NPOSD region */
	if (!STREAM_type)
#endif
	{
	    region = OSD_VOCAL_REGION;
	}
    }

    if (show_osd) {
	OUTOSD(region, msg, c_msg, DISPLAY_TIME_OUT);
    }
}

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

  Parameters:

  Description:
------------------------------------------------------------------------*/
#if (defined(JPEG_DEC) && defined(JPEG_ROTATE))
void JpgRotationKeyProc(JPEG_ROTATION)
{
    if(play_state == PLAY_NORMAL_STATE) {
	JPEG_ReDecoding = 1;
	Rotate_Proc = JPEG_ROTATION;
	cur_track_index--;
        if(cur_track_index<0) cur_track_index=0;
	cur_track_number = cur_track_index+1;
	system_reset();
	play_data_file(cur_track_number);
    } else if((play_state==PLAY_PAUSE_STATE)||
	      (play_state==PLAY_WAIT_TIME_STATE)) {
	if(Huff_state_jpg==0)
	    JPG_rotate_pic(JPEG_ROTATION);
	else {
	    Pause_JPEG_ReDecoding = 1;
	    play_state = PLAY_NORMAL_STATE;
	    jpeg_pause = 0;
	    JPEG_ReDecoding = 1;
	    Rotate_Proc = JPEG_ROTATION;
	    cur_track_index--;
            if(cur_track_index<0) cur_track_index=0;
	    cur_track_number = cur_track_index+1;
	    system_reset();
	    play_data_file(cur_track_number);
	}
    }
}
#endif

extern int SystemStatus;
int process_non_play_keys()
{
    int min, sec;
    int key_processed = 1;
    int save_key;

    /* check if we are in power off key */
#ifdef DSC
    if (IS_POWER_DOWN
#ifdef POWER_NOISE_MUTE
	|| power_down_flag
#endif
	) {
	if (current_key != POWER_KEY) {
	    current_key = NO_KEY;
	    return (1);
	}
    }
#endif

    save_key = current_key;
    current_key = NO_KEY;

#ifdef SCREEN_ON_TIME_SAME_KEY
#define SCREEN_KEY_INDEX_LIMIT	2

#ifdef HOST_SLAVE
   #define TIME_KEY_INDEX_LIMIT	5
#else
   #define TIME_KEY_INDEX_LIMIT	4
#endif

    /* Convert the osd and  time key. */
    if (!cd_stop && (save_key == SCREEN_ON_KEY)
	&& ((!(DiscMode & DISC_PBC_ON) || (SystemStatus != SYSTEM_PLAYING)))
#ifdef DATA_CD
        && (!STREAM_type)
#endif
	) {
#ifdef HOST_SLAVE
        if (codeOperand != 0){
	    save_key=TIME_KEY;
	} else
#endif
	{

	    /* Sync with OSD & TimeMode */
	    if (!osd_time_key_index && (DiscMode & DISC_OSD_ON))
		osd_time_key_index = SCREEN_KEY_INDEX_LIMIT - 1;

	    osd_time_key_index++;
	    if (osd_time_key_index < SCREEN_KEY_INDEX_LIMIT) {
		save_key = SCREEN_ON_KEY;
	    } else if (osd_time_key_index == TIME_KEY_INDEX_LIMIT) {
		save_key = SCREEN_ON_KEY;
		osd_time_key_index = 0;
	    } else {
		save_key = TIME_KEY;
	    }
	}
    }
#endif /* SCREEN_ON_TIME_SAME_KEY */

#ifdef ZOOM
    if (zoom_level) {
	/* reset zoom level if the key is not good for zoom mode. */
	if ((save_key < ZOOM_IN_KEY) || (save_key > ZOOM_DOWN_KEY)) {
	    zoom_reset();
	}
    }
#endif

#ifdef EQUALIZER
    if ((KEY_RESUME_mode == EQ_KEY_INPUT) &&
	(save_key == EQ_ON_OFF_KEY)) {
	EQ_mode ^= 1; /* toggle on/off */
	if (EQ_mode) MIX_init();
	return (1);
    }

    if (((KEY_RESUME_mode == EQ_KEY_INPUT) && (save_key == EQ_KEY))
	|| (OSD_eq_mode>0) || (OSD_eq_mode_previous>0)) {
	key_processed = process_EQ_key(save_key);
	if (key_processed) return (1);
    }
#endif EQUALIZER

    if (save_key == TV_MODE_KEY) {
	if (!tv_changed) {
#ifndef LTOC_TV_CHANGE
	    play_change_tv_mode();
#endif
	} else {
	    /* ignore if currently in TV mode change..next time */
	    assign_key = TV_MODE_KEY;
	}
	return (1);
    }
    if ((save_key == NEXT_KEY) || (save_key == PREVIOUS_KEY)
#ifdef POWER_NOISE_MUTE
	|| (save_key == POWER_KEY)
#endif
	)
	forceDSAabort = 0;

#ifdef POWER_NOISE_MUTE
    if (save_key == POWER_KEY) {
	forceDSAabort = 0;
        CLEARALLOSD();
	save_key = NO_KEY;
	play_state = ENTRY_STATE;
#ifdef CD_TEXT
        if(CDT_data_ready) CD_text_reset();
#endif
        power_down_flag ^= 1;

        if (power_down_flag)
        {
            int i;
    	    DSC_encoder_off();
            dsa_stop();
 	    process_open_key(); //I call this just for clear flags and buffer
            if (cd_opened)
               	SERVO_close();
            cd_opened = 0;
            VFD_blank_all();
            for (i=0;i<250;i++)
              	 microEngine();
        }
	else
       {
            show_mpeg_still(0xe1, powerupScreen, T_powerupScreen_SZ>>2);
	    DSC_encoder_on();
            power_up = 1;
	}
        return(1);
    }
#endif

    if (save_key == EJECT_KEY) {
	forceDSAabort = 0;
#ifdef SONY3D
	int_eject = 0;
#endif

#ifdef HOST_SLAVE
	if (codeOperand == 0x01) {
	    cd_opened = 0; /* Force tray to open */
	} else if (codeOperand == 0x02) {
	    cd_opened = 1;
	    no_toc = 1;
	} else if (codeOperand == 0x03) {
	    cd_opened = 1;
	    CDinited = 0; /* Force to read TOC */
	}
#endif

	if (cd_opened) {
	    OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_close, MSG_c_close,
		   DISPLAY_TIME_OUT);

	    process_close_key();
	} else {
#ifndef SONY3D
	    CLEARALLOSD();
#endif				/* SONY3D */
	    OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_open, MSG_c_open,
		   DISPLAY_TIME_OUT);
	    process_open_key();
#ifdef CD_TEXT
           if(CDT_data_ready) CD_text_reset();
#endif
	}

	save_key = NO_KEY;
#ifndef SONY3D
	play_state = ENTRY_STATE;
#endif				/* SONY3D */
	return (1);
    }
    /* check rotation key */
#ifdef SONY3D			/* Liang Weihua */
    if (save_key == ROTATE_ANTI_CLOCK_KEY) {
	CLEARALLOSD();
	OUTOSD(1, MSG_change_disc, MSG_c_change_disc, 3);
    }
    if (save_key == FIRST_DISC_KEY) {
	CLEARALLOSD();
	disc_buf[4] = '0' + 1;
#ifdef BILINGUAL_OSD
	c_disc_buf[2] = '0' + 1;
#endif
	OUTOSD(1, disc_buf, c_disc_buf, 3);
	if (cd_disc_slot == 2)
	    save_key = ROTATE_CLOCK_KEY;
	else if (cd_disc_slot == 3)
	    save_key = ROTATE_ANTI_CLOCK_KEY;
	else
	    return (1);
    }
    if (save_key == SECOND_DISC_KEY) {
	CLEARALLOSD();
	disc_buf[4] = '0' + 2;
#ifdef BILINGUAL_OSD
	c_disc_buf[2] = '0' + 2;
#endif
	OUTOSD(1, disc_buf, c_disc_buf, 3);
	if (cd_disc_slot == 3)
	    save_key = RO

⌨️ 快捷键说明

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