?? play.old
字號:
/* Copyright 1996, ESS Technology, Inc. */
/* SCCSID @(#)play.c 1.304 5/20/98 */
/*
* $Log$
*/
#define VOLUME_CONTROL
#define ZOOM_IN_OUT_SAME_KEY
#undef SCREEN_ON_TIME_SAME_KEY
#define SHOW_LOGO_AT_STOP
#undef STOP_RETURN_SAME_KEY
#define NEW_FEATURE
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "buffer.h"
#include "cd.h"
#include "common.h"
#include "const.h"
#include "constvar.h"
#include "audio.h"
#include "debug.h"
#include "dsc.h"
#include "display.h"
#include "mpeg1vid.h"
#include "util.h"
#include "mvd.h"
#include "sysinfo.h"
#include "dsa.h"
#include "ir.h"
#include "tdm.h"
#include "timedef.h"
#include "vcd.h"
#include "micro.h"
#include "fsosd.h"
#include "play.h"
#include "digest.h"
#include "av_play.h"
#include "kara.h"
#include "panelcmd.h"
#include "panel.h"
#include "vcxi.h"
#include "xport.h"
#include "zoom.h"
#ifdef ECHO
#include "echo.h"
#endif
#ifdef REAL_CLOCK
#include "realclk.h"
#endif
#ifdef NGAME
#include "ngame.h"
#endif
#ifdef DVD_VCD
#include "talk.h"
#endif
#ifdef VCDROM
#include "vcd30.h"
#endif
#ifdef MZOOM
#include "mzoom.h"
#endif
#ifdef KANGHUI
#undef NO_AUTO_PLAY
#else
#ifdef ONE
#define NO_AUTO_PLAY
#else
#ifdef YONGSHENG
#define NO_AUTO_PLAY
#else
#ifdef INTECH_1008
#define NO_AUTO_PLAY
#else
#undef NO_AUTO_PLAY
#endif
#endif
#endif
#endif
#undef PRINTF
#if 0
#define PRINTF(s) printf s
#else
#define PRINTF(s)
#endif
#ifdef NO_MICRO
#define PANEL_PLAY_INDEX(a)
#else
#define PANEL_PLAY_INDEX(a) panel_play_index(a)
#endif
DEBUGVAR(play_deadlock, 0);
DEBUGVAR(selection_deadlock, 0);
#define TurnOffTDM system_reset
/* ======================= BEGIN customer section =========================*/
/*------------------------------------------------------------------------
Fastforwar and Fastreverse variables and difinitions.
------------------------------------------------------------------------*/
/* Definition of Fastforwar and fastrewind speed. */
#ifdef FFFBPLAY
#define FAST_SPEED_LIMIT 5
#define SLOW_MOTION_LIMIT 4
#else
#define FAST_SPEED_LIMIT 4
#define SLOW_MOTION_LIMIT 3
#endif
/* Fast forward/backward interval */
static int fast_fram_amount_ary[FAST_SPEED_LIMIT]
= {0x000200, 0x000500, 0x001000, 0x002000};;
static unsigned char slow_motion_ary[SLOW_MOTION_LIMIT]
= {4, 8, 12}; /* num of displaying fidld 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
#ifdef JUMPGAME
#define NUM_OF_ENTRY 5
#define SELECT_EXIT 5
#else
#define NUM_OF_ENTRY 4
#define SELECT_EXIT 4
#endif
#ifdef VCDROM
char *ROOT_DIR = "/DATA/VCD_DATA\0";
int VCD30_DISC;
#endif
/* ======================= END customer section =========================*/
/*-------------------------------------------------------------
Function Prototypes
-------------------------------------------------------------*/
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 NGAME
static void play_game(int playitem_number);
#endif
/* utilities functions */
static void assign_selection_list(unsigned char *scratch);
static void assign_play_list(unsigned char *scratch);
#ifdef NGAME
static void assign_game_list(unsigned char *scratch);
#endif
static void compute_cd_total_remain(void);
static int find_track_number(int track_number);
static void fill_track_list(void);
static int get_next_track();
static int peek_next_track();
static int get_previous_track();
static void get_current_track_time(void);
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 getTrackTime(int track, int *time);
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);
static void save_resume_time(char, char, char);
#ifdef BOOK_MARK
static void record_resume_time();
#endif
/* process key functions */
static void process_close_key();
static void post_process_close_tray();
static void process_open_key(int);
static void process_PBC_key();
void process_power_off_key(void);
static void update_calender_after_resume(int track_index);
static void process_resume_key(void);
static void process_stop_key(int, int);
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);
#ifdef FOUR_LINE_OSD
static void PLAY_update_osd(void);
#endif
/* functions about osd */
static char *hex2string(char *str, int number);
static void load_resume_time(void);
static void show_still_pic();
#ifdef ZOOM
void set_zoom(void);
#endif
#ifdef VCDROM
static void process_vcd30_event(int event);
static void vcd30_play_clip(int);
#endif
/*-------------------------------------------------------------
Definitions
-------------------------------------------------------------*/
/* definitions for play mode */
#define PLAY_INFO_STOP_MODE 1
#define PLAY_INFO_PLAYING_MODE 2
#define PLAY_INFO_PAUSE_MODE 3
/* definitions for keys */
#define NO_KEY (-1)
/**************************************************************
* NOTE :
* 1. IF KEYS definitions are changed, the KEYS definitions
* in the vfd_tabl.c should also changed.
* 2. IF the keys are in the switch statement, the difinition
* values be small, so the jump table will be smaller.
***************************************************************/
#define KEY_PLUS 0xff0b
#define KEY_MINUS 0xff0c
#define KEY_RESUME_KEY 0xff0d
#define ECHO_PLUS 0xff0e
#define ECHO_MINUS 0xff0f
#define SURROUND_KEY 0xff10
#define VOCAL_ASSIST_KEY 0xff11
#define REPEAT_KEY 0xff12
#define PBC_KEY 0xff13
#define TIME_KEY 0xff14
#define SCREEN_ON_KEY 0xff15
#define RESUME_KEY 0xff16
#define MUTE_KEY 0xff17
#define VOLUME_UP_KEY 0xff18
#define VOLUME_DOWN_KEY 0xff19
#define CLEAR_KEY 0xff1a
#define PROGRAM_KEY 0xff1b
#define SHUFFLE_KEY 0xff1c
#define INTRO_KEY 0xff1d
#define MODE_KEY 0xff1e
#define PLAY_KEY 0xff1f
#define STOP_KEY 0xff20
#define GOTO_KEY 0xff21
#define FB_KEY 0xff22
#define FF_KEY 0xff23
#define PAUSE_KEY 0xff24
#define SLOW_KEY 0xff25
#define STEP_KEY 0xff26
#define ADVANCE_KEY 0xff27
#define INDEX_MINUS_KEY 0xff28
#define INDEX_PLUS_KEY 0xff29
#define SET_A_KEY 0xff2a
#define SET_B_KEY 0xff2b
#define XUECHANG_KEY 0xff2c
/* KEYS are not in the switch statements. */
#define DEFAULT_KEY 0xff50
#define TRACK_SCAN_KEY 0xff51
#define DISC_SCAN_KEY 0xff52
/* add Watt 971013 */
#ifdef NGAME
#define GAME_RESET_KEY 0xff51
#endif
#define ROTATE_CLOCK_KEY 0xff53
#define ROTATE_ANTI_CLOCK_KEY 0xff54
#define FIRST_DISC_KEY 0xff55
#define SECOND_DISC_KEY 0xff56
#define THIRD_DISC_KEY 0xff57
#define BOOK_MARK_KEY 0xff58
#define OSD_LANGUAGE_KEY 0xff59
#define POWER_KEY 0xff5a
#define EJECT_KEY 0xff5b
#define PREVIOUS_KEY 0xff5c
#define NEXT_KEY 0xff5d
#ifdef STOP_RETURN_SAME_KEY
#define RETURN_KEY STOP_KEY
#else
#define RETURN_KEY 0xff60
#endif
#define ZOOM_IN_KEY 0xff61
#define ZOOM_OUT_KEY 0xff62
#define ZOOM_UP_KEY 0xff63
#define ZOOM_LEFT_KEY 0xff64
#define ZOOM_RIGHT_KEY 0xff65
#define ZOOM_DOWN_KEY 0xff66
#define TV_MODE_KEY 0xff67
#define KARAOKE_KEY 0xff68
#define AUTO_POWER_OFF_KEY 0xff69
#define FREEZE_KEY 0xff6a
#define DISC_1_EJECT_KEY 0xff6b
#define DISC_2_EJECT_KEY 0xff6c
#define TURNS_KEY 0xff6d
/* 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
#ifdef NEW_THREE_CDS
#define REPEAT_3ALL 3
#endif
#ifdef TWO_CDS
#define REPEAT_3ALL 3
#endif
#define RESUME_IDLE_STATE 0
#define RESUME_GET_TIME_STATE 1
#define RESUME_WAIT_TIME_STATE 2
#define RESUME_PLAY_TIME_STATE 3
#define RESUME_PLAY_STOP_TIME_STATE 4
#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 TRACK_NUM_POS 13
#define CTRACK_NUM_POS 9
#define SPEED_POS 4
#define CSPEED_POS 4
#define SLOW_SPEED_POS 5
#define CSLOW_SPEED_POS 3
#define SEL_NUM_POS 8
#define CSEL_NUM_POS 6
/* Play control variables */
static unsigned int seg_sel = 1; /* Use in segment play (select E1 (1) *
* or E2 (2) */
static unsigned char audio_pause_timeout=0;
static unsigned int resume_flag; /* store the resume states */
#ifdef FAST_MODE_CONTROL
static int fast_mode_ctrl=0;
#endif
/*------------------------------------------------------------------------
* Variables for display. If we want to save memory, we can use common
* buffer for all osd display.
*------------------------------------------------------------------------*/
char *SPA_msg;
static unsigned char *osd_msg;
#ifdef BILINGUAL_OSD
static unsigned char *c_osd_msg;
#endif
static unsigned char osd_region = OSD_FUNCTION_STATUS_REGION;/*default region*/
static unsigned char osd_timeout = DISPLAY_TIME_OUT;/*default timeout */
static unsigned char track_buf[] = " TRACK SCAN XX ";
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[] = " ";
static unsigned char error_msg[] = "#"; /* Show a hand */
#ifdef BILINGUAL_OSD
static unsigned char c_track_buf[] = {
' ', CN_DAN1, ' ', CN_QU3, ' ', CN_LIU2, ' ' , CN_LAN3,
' ', 'X', 'X', ' ' , ' ', ' ', '\0'
};
static 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
static unsigned char disc_buf[] = "DISC ";
static unsigned char c_disc_buf[] = {CN_DIE2,FONT_SPACE,FONT_SPACE,FONT_SPACE,FONT_SPACE,FONT_SPACE,FONT_SPACE,0 };
/* OSD messages used outside play.c module */
unsigned char goto_buf[] = " GO TO : ";
#ifdef BILINGUAL_OSD
unsigned char c_goto_buf[] =
{ ' ', CN_SHI2, ' ', CN_JIAN1, ' ', ' ', ' ', ':', ' ', ' ', '\0' };
#endif
static int pre_select = 0;
static int pre_select_flag = 0;
static int pre_select_timer = 0;
/*------------------------------------------------------------------------
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -