📄 play.c
字号:
/* Copyright 1996, ESS Technology, Inc. *//* SCCSID @(#)play.c 4.171 03/16/05 *//* * For Philips DSA and CD7 servo. */#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include "vcxi.h"#include "buffer.h"#include "cd.h"#include "memmap.h"#include "const.h"#include "audio.h"#include "debug.h"#include "display.h"#include "mpeg1vid.h"#include "util.h"#include "low.h"#include "dsa.h"#include "ir.h"#include "tdm.h"#include "timedef.h"#include "keydef.h"#include "vcd.h"#include "micro.h"#include "play.h"#include "digest.h"#include "av_play.h"#include "kara.h"#include "panel.h"#include "xport.h"#include "zoom.h"#include "filesys.h"#include "nav_menu.h"#ifdef DSC#include "dsc.h"#endif#ifdef IO3898#include "eaux.h"#endif#if defined(ABNORMAL_VCD) || defined(ANTI_SHOCK)#include "pts.h"#endif#ifdef TWO_FIELDS_OSD#include "cg.h"#else#include "fsosd.h"#endif#ifdef EQUALIZER#include "eq.h"#endif#ifdef ECHO#include "echo.h"#endif#ifdef REAL_CLOCK#include "realclk.h"#endif#ifdef MZOOM#include "mzoom.h"#endif#ifdef CD_TEXT#include "cd_text.h"#endif#ifdef CDG#include "cdg.h"#endif#if (defined INES_CD || defined VGB_CD)#include "game.h"#endif#ifdef FLESHTONE#include "fshtone.h"#endif#ifdef DATA_CD#ifdef ID3#include "id3.h"#endif#include "vp.h"#include "mp3.h"#include "mpgaudio.h"#endif#if (defined(MIC_RECORD) || defined(ANTI_SHOCK))#include "recorder.h"#include "vp.h"#endif#ifdef CD7II#include "servo.h"#endif/************************************************************************ * Debugging ************************************************************************/#if 0int bpt;#define BREAKPOINT(x) {bpt=x;while(bpt) VCX_service();}#else#define BREAKPOINT(x)#endif#undef PRINTF#if 0#define PRINTF(s) printf s#else#define PRINTF(s)#endifDEBUGVAR(play_deadlock, 0);DEBUGVAR(selection_deadlock, 0);#ifdef IO3898#define DSC_powerup DVE_powerup#define DSC_powerdown DVE_powerdown#endif/************************************************************************ * PLAY related options * ************************************************************************/#if 0 /* NOT_USED */#define NO_AUTO_PLAY#define START_IN_PBC_OFF /* always start in PBC-off mode */#define CLEAR_JPEG /* clear jpeg when stopped */ #define ABS_GOTO_OVERRIDES_PROGRAM /* abs. goto will cancel program mode */#define LOGO4CDDA /* display logo when playing CDDA */#endif#define VOLUME_CONTROL#define ZOOM_IN_OUT_SAME_KEY#define SCREEN_ON_TIME_SAME_KEY#define SHOW_LOGO_AT_STOP#define STOP_RETURN_SAME_KEY#ifdef STOP_RETURN_SAME_KEY#undef RETURN_KEY#define RETURN_KEY STOP_KEY#endif/* ======================= BEGIN customer section =========================*//*------------------------------------------------------------------------ Fastforwar and Fastreverse variables and difinitions.------------------------------------------------------------------------*//* Definition of Fastforwar and fastrewind speed. */#define FAST_SPEED_LIMIT 4#define SLOW_MOTION_LIMIT 3/* Fast forward/backward interval in secs (BCD) */static char fast_fram_amount_ary[FAST_SPEED_LIMIT]= {0x02, 0x05, 0x10, 0x20};static unsigned char slow_motion_ary[SLOW_MOTION_LIMIT]= {6, 10, 14}; /* num of displaying field time. For example, if the number is 4, the each picture will be displayed 4 field time. Normal field time for NTSC pictures is 2. */extern int bad_track_len; /* bad audio frame counter defined in mpgaudio.c *//*------------------------------------------------------------------------ Define the intro interval.------------------------------------------------------------------------*/#define INTRO_TIME_MMSSFF 0x001000 /* 10 seconds *//* Define number of entries in PLAY_MENU_STATE */#define SELECT_INTRO 1#define SELECT_DISC 2#define SELECT_TRACK 3#define SELECT_GAME 4#define NUM_OF_ENTRY 4#define SELECT_EXIT 4/* ======================= END customer section =========================*//*------------------------------------------------------------- Function Prototypes-------------------------------------------------------------*/void time_display_reset(void);static int PLAY_track_at_time(int track, int rel_time);static void play_item(int playitem_number);static void play_track(int track_number);static void play_entry(int entry_number);static void play_segment(int segment_number);static void play_entry_in_track(int entry_number);static int change_to_trick_mode(int key);#ifdef GAMEBOYstatic void play_game(int playitem_number);#endif#ifdef ABSOLUTE_GOTO_TIMEstatic int PLAY_absolute(int);#endif/* utilities functions */static void assign_selection_list(unsigned char *scratch);static void assign_play_list(unsigned char *scratch);#ifdef GAMEBOYstatic void assign_game_list(unsigned char *scratch);#endifstatic void compute_cd_total_remain(void);static int find_track_number(int track_number);static int get_next_track();static int peek_next_track();static int get_previous_track();static int get_track_time(int, int *, int *);static int is_time_expired(unsigned int begin_time, short expire_time);static int processVCD();static void programRemoveTrack(void);static void programAddTrack(int track);static void init_PBC_on();static void change_sequence_mode(int mode);static void disp_stop_LCD(void);static void disp_cd_info_LCD(void);static void display_cddigest_osd(int track);static void check_entry_number(int track_number, int starttime);/* process key functions */static void process_close_key();static void post_process_close_tray();static void process_open_key();static void process_PBC_key();void process_power_off_key(void);static int process_resume_key(void);static void process_stop_key();static int process_zoom_key();/* play state machine functions */static int change_play_state();static int play_state_machine();static void goto_digest_track_segment(int selection_num);static void PLAY_update_osd(void);static void save_resume_time(void);static void save_resume_info(void);static void restore_resume_track_time(void); static void initCD_finished();static int Data_File_end_of_play();#ifdef ZOOMvoid set_zoom(void);#endifstatic void PLAY_fill_volumebarbuf(int);#ifdef EQUALIZERstatic int process_EQ_key(int);#endif#ifdef DATA_CDstatic int Is_DATA_CD(void);static void get_next_data_track(void);static void get_prev_data_track(void);#ifdef JPEG_DGSTstatic int get_jpeg_track(int);#endif /* JPEG_DGST */#endif#ifdef SCENEstatic int process_scene_key(void);static void update_scene_number(void);#endif /*SCENE*/#ifdef ABNORMAL_VCDEXPORT int calc_bitrate(int, int);#endif#ifdef CDGstatic void Is_CDG_Disc(void);#endif#ifdef REVERBstatic void RVB_turn_on(int);#endif/*------------------------------------------------------------- Definitions-------------------------------------------------------------*/#define TurnOffTDM system_reset#define PANEL_PLAY_INDEX(a)/* definitions for play mode */#define PLAY_INFO_STOP_MODE 1#define PLAY_INFO_PLAYING_MODE 2#define PLAY_INFO_PAUSE_MODE 3/* definitions for events */#define NULL_EVENT 0#define NEW_LIST_EVENT 1#define WAIT_TIME_EXPIRED_EVENT 2#define LOOP_COUNT_EVENT 3#define PREVIOUS_KEY_EVENT 4#define REPEAT_OFF 0#define REPEAT_ONE 1#define REPEAT_ALL 2#define RESUME_EMPTY 0#define RESUME_SAVED 1#define RESUME_RESTORE 2#define RESUME_SUCCESS 3#define RESUME_FAILURE 4/* for VCD_ptr_resume_info->state */#define VOCAL_LEFT_LEFT 3#define VOCAL_RIGHT_RIGHT 4#define DIGEST_TRACK_PIC_LIMIT 9#define MAX_TRACK_NUMBER 99#define MAX_PROGRAM_TRACKS 99 /* For OSD message buffers */#define SPEED_POS 4#define SLOW_SPEED_POS 5#define SEL_NUM_POS 8#ifdef USE_CN_HEADER#define CSPEED_POS 6#define CSLOW_SPEED_POS 5#define CSEL_NUM_POS 6#else#define CSPEED_POS 4#define CSLOW_SPEED_POS 3#define CSEL_NUM_POS 4#endif /* USE_CN_HEADER *//* Play control variables */unsigned int seg_sel = 0; /* Use in segment play (select E1 (1) * * E2 (2), or E0 (0) */#ifdef FAST_MODE_CONTROLint fast_mode_ctrl=0;#endif/*------------------------------------------------------------------------ * Variables for display. If we want to save memory, we can use common * buffer for all osd display. *------------------------------------------------------------------------*/static unsigned char *osd_msg;#ifdef BILINGUAL_OSDstatic unsigned char *c_osd_msg;#endifstatic unsigned char osd_region = OSD_FUNCTION_STATUS_REGION;/*default region*/static unsigned char osd_timeout = DISPLAY_TIME_OUT;/*default timeout */static unsigned char sel_buf[] = "SELECT ";static unsigned char FF_buf[] = "FF X1 ";static unsigned char FR_buf[] = "FR X1 ";static unsigned char slow_buf[] = "SLOW ";static unsigned char clear_msg[] = {FONT_BLANK,0};static unsigned char error_msg[] = "#"; /* Show a hand */#ifdef KARASCstatic unsigned char ksc_buf[] = "KARAOKE SCORE: ";#endif KARASC#ifdef SCENEstatic unsigned char scene_buf[] = "SCENE ----";#endif#ifdef BILINGUAL_OSD#ifdef USE_CN_HEADERstatic unsigned char c_slow_buf[] = { CN_HEADER, CN_MAN4, CN_HEADER, CN_FANG4, ' ', ' ', ' ', '\0'};static unsigned char c_sel_buf[] = { CN_HEADER, CN_XUAN3, ' ', CN_HEADER, CN_ZE2, ' ', ' ', ' ', ' ', '\0'};static unsigned char c_FF_buf[] = { CN_HEADER, CN_KUAI4, CN_HEADER, CN_JIN4, ' ', 'X', '1', '\0'};static unsigned char c_FR_buf[] = { CN_HEADER, CN_KUAI4, CN_HEADER, CN_TUI4, ' ', 'X', '1', '\0'};#elsestatic unsigned char c_slow_buf[] = { CN_MAN4, CN_FANG4, ' ', ' ', ' ', '\0'};static unsigned char c_sel_buf[] = { CN_XUAN3, ' ', CN_ZE2, ' ', ' ', ' ', ' ', '\0'};static unsigned char c_FF_buf[] = { CN_KUAI4, CN_JIN4, ' ', 'X', '1', '\0'};static unsigned char c_FR_buf[] = { CN_KUAI4, CN_TUI4, ' ', 'X', '1', '\0'};#endif /* USE_CN_HEADER */#endif /* BILINGUAL_OSD *//* OSD messages used outside play.c module */unsigned char goto_buf[] = " GO TO : ";#ifdef BILINGUAL_OSD#ifdef USE_CN_HEADERunsigned char c_goto_buf[] = {' ', CN_HEADER, CN_SHI2, ' ', CN_HEADER, CN_JIAN1, ' ', ' ', ' ', ':', ' ', ' ', '\0'};#elseunsigned char c_goto_buf[] = {' ', CN_SHI2, ' ', CN_JIAN1, ' ', ' ', ' ', ':', ' ', ' ', '\0'};#endif /* USE_CN_HEADER */#ifdef EQUALIZERX /* enable after we have the required Chinese fonts */unsigned char c_music_type_buf[] = {CN_HEADER,CN_JUN1, CN_HEADER,CN_HENG2, ':',' ',' ',' ',' ',0};unsigned char c_music_env_buf[] ={CN_HEADER,CN_SHENG1, CN_HEADER,CN_CHANG3, CN_HEADER,CN_XIAO4, CN_HEADER,CN_GUO3, ':',' ',' ',' ',' ',' ',' ',0};#endif /* EQUALIZER */#endif /* BILINGUAL_OSD */#if defined(EQUALIZER) && defined(DAE_SPATIAL)#ifdef MORE_ENV_TYPESuchar DAE_mode_table[] = {0, 1, 4, 5, 0, 3, 0, 0, 2, 6};#elseuchar DAE_mode_table[] = {1, 4, 0, 5, 3, 2};#endif MORE_ENV_TYPES#endif /* EQUALIZER && DAE_SPATIAL */uchar *KEY_mode_msg[] = { "KEY ADJUST" #ifdef EQUALIZER ,"EQ INPUT" #endif#ifdef GAMMA ,"SMARTBRIGHT"#endif#ifdef FLESHTONE ,"SMARTCOLOR"#endif};/*------------------------------------------------------------------------ User defined data structures------------------------------------------------------------------------*/unsigned short list_previous_list_offset=0;unsigned short list_next_list_offset=0;static unsigned short list_return_list_offset=0;static unsigned short play_list_playing_time=0;static unsigned 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 GAMEBOYstatic unsigned char game_list_local_cpu_type=0;short game_list_misc_def=0;short game_list_buffer_size=0;int is_ess_game=0;#endifstatic int selection_list_loop_count;static unsigned short selection_list_default_list_offset=0;static unsigned short selection_list_time_out_list_offset=0;static unsigned 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;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 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -