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

📄 play.c

📁 ESS3890+SL原代码(1*16内存)
💻 C
📖 第 1 页 / 共 5 页
字号:
	    play_item_start_time = adjCDtime(play_item_begin_time,					     logical2physical(tmp), 1);	}    }#endif ID3    if (VCD_ptr_resume_info->state == RESUME_RESTORE) {	restore_resume_track_time();	cur_track_index = cur_track_number-1; /* update cur_track_index */    } else VCD_ptr_resume_info->state = RESUME_EMPTY;    play_item_mode = PLAY_INFO_STOP_MODE;     /* go to play */    play_state = PLAY_NORMAL_STATE;    return;}#endif /* MP3 || JPEG_DEC *//*------------------------------------------------------------------------  Function: play_entry  Parameters:      entry_number: The entry number that this function will play.  Description:      Play an entry in VIDEO CD.------------------------------------------------------------------------*/static void play_entry(int entry_number){    unsigned char track_number;    /* get entry info */    get_entry_info(entry_number, &track_number,                   &play_item_start_time,  /* entry start time */                   &play_item_real_end_time);    /* update panel & OSD */    cur_track_number = track_number - 1;    panel_play_track(cur_track_number);    /* get track info, since we play entry until track end */    get_track_info(track_number - 1, /* logical track starts at 1 */		   &play_item_begin_time,  /* starting time of track */                   &play_item_real_end_time,                   &play_item_type);    play_item_end_time = play_item_real_end_time;    PRINTF(("entry %d, start time %x, end time %x\n", entry_number,       play_item_start_time, play_item_end_time));    /* if we are playing item from play list, we need to check the */    /* playing time.                                               */    check_playing_time();    if (VCD_ptr_resume_info->state == RESUME_RESTORE) {	restore_resume_track_time();    }    play_item_mode = PLAY_INFO_STOP_MODE;    play_item_type = DATA_TRACK;    /* go to play */    PRINTF(("Play Entry %d\n", entry_number));    play_state = PLAY_NORMAL_STATE;    return;}/*------------------------------------------------------------------------  Function:play_entry_in_track  Parameters:  Description:------------------------------------------------------------------------*/static void play_entry_in_track(int entry_number){    int mmssff;    int dummy2;    unsigned char dummy1;    PANEL_PLAY_INDEX((entry_number - track_entry_beg + 1));    /* get the next entry time for updating lcd in the future */    if (!get_entry_info(entry_number + 1, &dummy1, &next_entry_time,                   &dummy2)) {        next_entry_time = xMAX_CDTIME;    /* no next entry */    }    /* since the beg_time will be modified to entry beg_time by       play_entry function, we have to store it. */    mmssff = play_item_begin_time;    /* play entry */    play_entry(entry_number);    play_item_begin_time = mmssff;}/*------------------------------------------------------------------------  Function: play_segment  Parameters:      segment_number  Description:------------------------------------------------------------------------*/static void play_segment(int segment_number){    unsigned char content;    int           len;  /* # of segment */    int           seconds;    int		video_type;#ifdef MZOOM     if (vcx_mzoom) MZM_out();#endif    /* get segment content and play length */    get_segment_info(segment_number, &content, &len);    /* compute the start and end time */    if (first_seg_ad == 0)      /* in case we do not have value. */        first_seg_ad = 0x0500;    seconds = bcd2hex[((first_seg_ad >> 16) & 0xff)] * 60; /* min -> sec */    seconds += bcd2hex[(first_seg_ad >> 8) & 0xff] + (segment_number -1) * 2;    play_item_begin_time =        logical2physical(seconds * 75); /* Sec->Frm */    play_item_start_time = play_item_begin_time;    play_item_end_time =        logical2physical((seconds + len * 2) * 75);    play_item_real_end_time = play_item_end_time;    play_item_type = DATA_TRACK;    /* if we are playing item from play list, we need to check the */    /* playing time.                                               */    check_playing_time();    play_item_mode = PLAY_INFO_STOP_MODE;    PRINTF(("seg %d, start 0x%x, end 0x%x\n",            segment_number,            play_item_start_time,            play_item_end_time));    /* check play type */    video_type = content & 0xC;        /* bit 2..3 */    play_still_retry = 3;		/* Retry still 3 times if error	*/    play_state = PLAY_STILL_STATE;	/* Assume it is still		*/    is_slide_show = 0;		/* determine in video_state_machine() */#ifdef KARASC    KSC_mode = 0;#endif        if (video_type == 4) {        seg_sel = 1;        PRINTF(("E1\n"));    } else    if (video_type == 8) {        seg_sel = 2;        PRINTF(("E2\n"));    } else {    /* if the zoom level != 1, reset it */#ifdef ZOOM	if (zoom_level) {	    zoom_reset(); 	}#endif        seg_sel = 0;	play_still_retry = 0;        play_state = PLAY_NORMAL_STATE;        PRINTF((" Motion\n"));    }    if (VCD_ptr_resume_info->state == RESUME_RESTORE) {	len = VCD_ptr_resume_info->mmssff;	if (len != xMAX_CDTIME) {	    play_item_start_time = len;	    	    is_slide_show = seg_sel; /* slide-show? */	}		VCD_ptr_resume_info->state = RESUME_SUCCESS;    }        picture_type = 0xe0 | seg_sel;    panel_play_track(0);    cur_track_number = 0; /* Set for OSD */    return;}#ifdef GAMEBOYstatic void play_game(int segment_number){    int           seconds;    uchar *game_data_ptr;     /* compute the start time */    if (first_seg_ad == 0)      /* in case we do not have value. */        first_seg_ad = 0x0500;  /* assume set to 00:05:00 */ #ifdef INES    if (is_ess_game >= 3) {/*It is for Sunplus game DISC*/        play_item_begin_time = logical2physical(play_list_playing_time+150);        gmby_sect_sum = play_list_play_item_wait_time;    } else #endif    {        seconds = bcd2hex[((first_seg_ad >> 16) & 0xff)] * 60; /* min -> sec */        seconds += bcd2hex[(first_seg_ad >> 8) & 0xff] + (segment_number -1000) * 2;       play_item_begin_time =            logical2physical(seconds * 75); /* Sec->Frm */    }    play_item_start_time = play_item_begin_time;    gmby_start_time = play_item_start_time;    if(is_ess_game < 3 ) { /*Not Sunplus Game Disc*/        if(is_ess_game == 1){ /*ESS GVCD Disc */           gmby_sect_sum=(((game_list_buffer_size>>8)&0xff)<<14)+((game_list_buffer_size&0xff)<<13);        } else {           getSectors(play_item_start_time, 1, 2048);           game_data_ptr = (uchar *)dram(VBV_start);           gmby_sect_sum = 16+(*(game_data_ptr+4) << 14)+(*(game_data_ptr+5) << 13);        }        gmby_sect_sum = (gmby_sect_sum+2047)>>11;    }       gmby_name_id = GAME_INES;    panel_play_track(0);    cur_track_number = 0;       /* Set for OSD */    play_state = PLAY_GMBY_STATE;    return;}#endif/*------------------------------------------------------------------------  Function:assign_selection_list  Parameters:      scratch: Is a pointer to the selection list data.  Description:      Assign selection data to a selection_list structure.------------------------------------------------------------------------*/static void assign_selection_list(unsigned char *scratch_buf){    selection_list_number_of_selections = scratch_buf[2];    selection_list_base_of_selection_number = scratch_buf[3];    list_previous_list_offset = *((short *)(scratch_buf+6));    list_next_list_offset = *((short *)(scratch_buf+8));    selection_list_default_list_offset = *((short *)(scratch_buf+12));    list_return_list_offset = *((short *)(scratch_buf+10));    selection_list_time_out_list_offset = *((short *)(scratch_buf+14));    selection_list_wait_time_for_timeout = scratch_buf[16];    selection_list_loop_count_and_jump_timing = scratch_buf[17];    selection_list_play_item_number = *((short *)(scratch_buf+18));    selection_list_loop_count =        (selection_list_loop_count_and_jump_timing & 0x7f); /* bit 0-6 */    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 GAMEBOYstatic 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    0x57unsigned 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);    }}

⌨️ 快捷键说明

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