📄 play.cc
字号:
/* Copyright 1996, ESS Technology, Inc. */
/* SCCSID @(#)play.c 1.340 11/13/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 USE_CLEAR_KEY
#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"
#include "custom.h"
#ifdef ECHO
#include "echo.h"
#endif
#ifdef REAL_CLOCK
#include "realclk.h"
#endif
#ifdef MDC_GAME
#include "chf.h"
#endif
#ifdef DVD_VCD
#include "talk.h"
#endif
#ifdef VCDROM
#include "vcd30.h"
#endif
#ifdef MZOOM
#include "mzoom.h"
#endif
#ifdef SGAME
#include "sgame.h"
#endif
#define STOP_TIMER_DEFINE
#ifdef ONE
#define NO_AUTO_PLAY
#els
#ifdef DONGPENG_REMOTE
#define NO_AUTO_PLAY
#else
#undef NO_AUTO_PLAY
#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. */
#define FAST_SPEED_LIMIT 5
#ifdef JINRE_REMOTE
#define SLOW_MOTION_LIMIT 5
#else
#define SLOW_MOTION_LIMIT 4
#endif
/* Fast forward/backward interval */
static int fast_fram_amount_ary[FAST_SPEED_LIMIT]
= {0x000200, 0x000500, 0x001000, 0x002000};;
#ifdef JINRE_REMOTE
static unsigned char slow_motion_ary[SLOW_MOTION_LIMIT]
= {4, 8, 12, 16}; /* 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. */
#else
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. */
#endif
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
#ifdef VCDROM
char *ROOT_DIR = "/DATA/VCD_DATA\0";
int VCD30_DISC;
#endif
static unsigned char xuechang_flag = 0 ;
int vfdled = 0xff;
/*add */
#ifdef SUOJIA_AVGAME_SW
static unsigned char av_sw_flag = 0 ;
static int avinto_flag = 0 ;
#endif
#ifdef STOP_TIMER_DEFINE
static int continuetime1;
static int continuetime;
static unsigned char continue_min;
static unsigned char continue_sec;
#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 int zoom_key_timer = 0;
#ifdef TWO_CDS
static unsigned char rotate_flag = 0;
int rotate_timer = 0;
unsigned char continue_play;
unsigned char disc_ltoc;
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
#ifdef SONY84412_ERR110
int error_flag = 1;
int dsa_stop_timer = 0;
#define CLEAR_FOK CLEAR_EAUX0
#define TRISTATE_FOK TRISTATE_EAUX0
#endif
/* ======================= END customer section =========================*/
/*-------------------------------------------------------------
Function Prototypes
-------------------------------------------------------------*/
#ifdef JINRE_USE_ECHO
static unsigned char audio_mode1 = 0;
void echo_control();
PRIVATE int vcx_echo1 = -1;
unsigned char echo_vocal_flag =0;
unsigned char echo_off_flag =0;
unsigned char echo_time =0;
#endif
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 MDC_GAME
static void play_mdc_game(int playitem_number);
static void stopgame_echo();
#endif
/* utilities functions */
static void assign_selection_list(unsigned char *scratch);
static void assign_play_list(unsigned char *scratch);
#ifdef MDC_GAME
static void assign_mdc_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();
#ifdef SGAME
/* void game_dump_time(unsigned int area,unsigned int time,unsigned int ltime); */
extern int dump_game_data(unsigned int start_time,unsigned int length);
extern void dump_game_entry(unsigned int *ptr);
extern void play_game_segment( unsigned int number,unsigned int sel);
extern void sgame_init();
static void game_key_check();
void display_loading();
void game_dump_time(unsigned int area,unsigned int time,unsigned int ltime);
#endif
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();
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 AUTO_POWER_OFF_KEY 0xff2c
#define ERROR_KEY 0xff2d
#define FREEZE_KEY 0xff2e
#define STOPRETURN_KEY 0xff2f
/* 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 MDC_GAME
#define MDC_GAME_RESET_KEY PLAYKEY(_GAME_RESET_KEY)
#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 AV_SW_KEY 0xff6a
#ifdef SGAME
#define GAME_VIDEO_KEY 0x68
#define GAME_RESET_KEY 0x69
#endif
#ifdef TWO_CDS
#define DISC_1_EJECT_KEY 0xff6b
#define DISC_2_EJECT_KEY 0xff6c
#endif
#define XUECHANG_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
#ifdef SGAME
#define PLAY_KEY_EVENT 5
#endif
#define REPEAT_OFF 0
#define REPEAT_ONE 1
#define REPEAT_ALL 2
#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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -