📄 player.h
字号:
uint8 song_file_type; uint32 song_start_address; //unusable since filename can be shortened! #if 0 uint8 song_name[RESUME_NAME_LENGTH];#endif uint32 device_identifier; } t_player_resume_info;/* JS fix 9.7.2006 - include also CRC in resume info size */#define RESUME_INFO_SIZE sizeof(hostifStoredDataType) // wrong size was ((DEV_SLOTS) * sizeof (t_player_resume_info)) /*!\brief direction of playback */ typedef enum { FORWARD = 0, BACKWARD = 1, DIR_SUBDIR = 2, DIR_PARENT = 3, DIR_NEXT = 4, DIR_PREVIOUS = 5, INDEX_IN_DIR = 6 } t_direction;/*!\brief range of playback */typedef enum { RANGE_ALL_VOLUMES, RANGE_TRACK, RANGE_DIRECTORY, RANGE_SUBDIRS, RANGE_VOLUME, RANGE_DEVICE, RANGE_PLAYLIST } t_range;/*!\brief repetition of range */typedef enum { REPEAT_OFF = 0, REPEAT_ON = 1} t_repeat;/*!\brief shuffle setting */typedef enum { SHUFFLE_OFF = 0, SHUFFLE_ON = 1} t_shuffle;/*!\brief directories numbering */typedef enum { PATH_TABLE = 0, //sequential (win dir tree) PARENT_CHILD = 1 //by levels like iso9660 (old style)} t_dir_num_style;/*!\brief player general params (devices info, play mode params) */typedef struct { //devices info uint8 DevicesReady; //Bits set singalling prepared device (CD=1,USB=2,SD=4) t_duid device; //currently selected device uint8 CD_disc_type; //playback mode t_range range; t_repeat repeat; t_shuffle shuffle; //additional playback params t_XItem parent_index; //used for subdir mode t_XItem range_from; //used for shuffle t_XItem range_num; //used for shuffle int16 shuffle_index; //used for shuffle int16 index_in_dir; //jump relative in actual directory t_bool last_in_dir; //set/reset in relevant mode t_bool last_on_disc; //set/reset in relevant mode t_bool audio_tracks_first; t_bool repeat_one; t_bool pause_at_eos; } t_player_params;typedef struct { uint8 time; t_direction direction; int32 min_abs_time; int32 max_abs_time;} t_player_scan_params;typedef struct {t_bool enabled; t_direction direction; uint8 speed; uint32 playback_duration; /* var is in units of 1/44100 samples (possible values set are in range 300ms - 3 sec ) */ /* used for checking, if command (seek current position) wouldn't be sent with same params as previously used */uint8 last_used_speed; uint32 last_used_playback_duration; } t_player_seek;typedef enum { BEGIN_OF_RANGE, INSIDE_RANGE, END_OF_RANGE, BEGIN_OF_SCAN_WIN, END_OF_SCAN_WIN, END_OF_RANGE_SCAN, BEGIN_OF_PLAY_WIN, END_OF_PLAY_WIN} t_range_margin;typedef struct { uint8 current_position; uint8 data_tracks; uint16 trackNr; uint16 Minute; uint8 Second; uint32 Position; } t_player_command_params; //used for flash_operation#define FLASH_DATA_NO_OPERATION 0#define FLASH_DATA_READ 1#define FLASH_DATA_WRITTEN 2typedef struct { uint8 command; uint8 cmd_params[MAX_CMD_PARAMS_LENGTH]; uint8 flash_operation;} t_player_cmd_event;typedef enum { UPSTREAM_DATA, UPSTREAM_ABORT} t_player_command_status;/* struct similar to USB upstream data, shortened by status params */typedef struct tag_player_upstream_status_event_params{ uint8* pData; uint16 DataLength; uint8 bEndFlag; } t_player_upstream_status_event_params;typedef union { t_player_upstream_status_event_params upstream_params; /* other status params are possible */ } t_player_command_status_params;typedef struct tag_player_status_event_params{ t_player_command_status status; t_player_command_status_params status_params; } t_player_status_event;typedef struct { char NowMounting; uint8 DevicesWaitingForMount; uint8 player_mode; uint8 player_transition_state; t_bool CD_error_during_preparation; //in case of error during CD preparation,eject CD after all media prapered int16 error_during_preparation; //any device error // [RB] was uint8, but is initialized with RETVAL which are 16bit signed uint32 VID; /* USB */ uint32 PID; /* USB */} t_player_mount_fsm_params; typedef struct { t_bool delayed_playback; /* If pause_at command is used, play_FSM runs too. It grabs preEOS, BOS event, but doesn't apply (no change in transition) After pause is released, all events are applied then */ t_bool forced_command; /* to be able to differ PLR_PLAY_FSM_NO_NEXT_SONG_UNFORCED/PLR_PLAY_FSM_NO_NEXT_SONG */ t_bool keep_running; /* for case that preEOS comes before BOS, then FSM restarted. If no song selected, keep FSM running, up to BOS event, then report no next song (otherwise pause is set) */ t_bool use_advanced_mode_settings; /* used only in case of PLR_PLAY_FSM_SELECT_NEW_SONG_FORCED use/don't use setting of rpt1/shuffle/scan direction */ t_bool song_being_prepared; /* flag set in interval (forced command to controller ~ playback starts) used for handling CDDA tracks in situation, when playback is ongoing, host sends fast way command for playback next/prev(f=1); at the end of range, pause is issued(due to wrap off). When releasing pause (play at current pos, f=0), playback starts from last played position, not from last asked song! */ int32 error_type; } t_player_player_play_fsm_params;typedef struct { t_XItem xfile; uint32 start_offset; //seek params t_direction direction; uint32 play_offset; uint32 jump_offset;} t_player_pause_fsm_params;typedef struct { t_XItem xfile; } t_player_parse_playlist_fsm_params;typedef struct { //file info t_XItem xfile; uint32 filesize; //local vars uint32 start_file_offset; uint32 stop_file_offset; uint32 start_buffer_offset; uint8 * buffer_ptr; uint32 available_data; } t_player_read_file_fsm_params;#define PROCESS_START 0x00#define PROCESS_EJECT 0x01#define PROCESS_EJECT_CHECK 0x02#define PROCESS_EJECT_RECOVER 0x03#define PROCESS_INSERT 0x04#define PROCESS_INSERT_CHECK 0x05#define PROCESS_INSERT_RECOVER 0x06#define LDTS_START_TRANSITION 0x00#define LDTS_WAIT_LOADER_INIT 0x01//#define LDTS_INITIAL_LOAD 0x02#define LDTS_INIT_FOR_NEW_DISC 0x03#define LDTS_EJECT 0x04#define LDTS_INSERT 0x05#define LDTS_WAIT_FOR_PLAYER_STOP 0x06#define LDTS_STOP_DISC 0x07#define LDTS_STOP_DISC_CHECK 0x08#define LDTS_INIT_FOR_NEW_DISC_CHECK 0x09#define PLTS_START_TRANSITION 0x00#define PLTS_INITIAL_PLAY 0x01#define PLTS_WAIT_CONTROLLER_INIT 0x02#define PLTS_INIT_FOR_NEW_DISC 0x03//#define PLTS_START_DISC 0x04 //JS define unused//#define PLTS_READ_TOC 0x05 //JS define unused//#define PLTS_SET_SPEED 0x06 //JS define unused#define PLTS_MOUNT_FS 0x07#define PLTS_STOP_DISC 0x08#define PLTS_PLAY 0x09#define PLTS_PAUSE 0x0A#define PLTS_PAUSE_AT 0x18#define PLTS_SEEK 0x0B#define PLTS_IDLE 0x0C#define PLTS_INIT_FOR_NEW_DISC_CHECK 0x0D#define PLTS_READ_TOC_CHECK 0x0E#define PLTS_MOUNT_FS_CHECK 0x0F#define PLTS_PLAY_CHECK 0x10#define PLTS_PAUSE_CHECK 0x11#define PLTS_STOP_PLAYBACK 0x12#define PLTS_STOP_DEVICE 0x13#define PLTS_STOP_CHECK 0x14#define PLTS_SELECT_NEW_SONG_TRANSITION 0x15#define PLTS_SELECT_NEW_SONG_TRANSITION_AT_EOS 0x16 //#define PLTS_SEARCH_CHECK 0x17 //JS define unused//#define PLTS_CHECK_NEXT_DEVICE 0x18 //JS define unused#define PLTS_PLAYLIST 0x19#define PLTS_UPDATE_START 0x1A#define PLTS_UPDATE_NEXT_PACKET 0x1B#define PLTS_UPDATE_DATA_CHECK 0x1C//#define PLTS_UPDATE_DATA_PROCESSED 0x1D //JS commented unused#define PLTR_UPDATE_DATA_WAIT_NEXT_COMMAND 0x1E#define PLTS_UPDATE_ABORT 0x1F#define PLTS_UDATE_IDLE 0x20#define PLTS_UPDATE_FLASH 0x21#define PLTS_RUNNING 0xFF //used just for messaging in hostif//player substate machines affecting start of subsequent ones #define PLR_TRANSITION_INIT 0x0001#define PLR_TRANSITION_STOP 0x0002#define PLR_TRANSITION_STARTUP 0x0004 #define PLR_TRANSITION_MOUNT 0x0008 #define PLR_TRANSITION_PAUSE 0x0010 //#define PLR_TRANSITION_ACCESSING_TO_PLAY 0x0020 //#define PLR_TRANSITION_ACCESSING_TO_STOP 0x0040 #define PLR_TRANSITION_PLAY 0x0080 #define PLR_TRANSITION_SEARCH 0x0100 #if (0 != HAVE_UPDATE)#define PLR_TRANSITION_UPDATE 0x100000#endif /* HAVE_UPDATE */ #define PWR_TRANSITION_POWER_MODE_INIT 0x0200 #define PWR_TRANSITION_POWER_MODE_INITIALIZING 0x0400#define PWR_TRANSITION_POWER_MODE_POWER_OFF 0x0800 #define PWR_TRANSITION_POWER_MODE_POWER_ON 0x1000 #define PWR_TRANSITION_POWER_MODE_GOING_TO_POWER_OFF 0x2000 #define LDR_TRANSITION_LOADER_MODE_INIT 0x4000 #define LDR_TRANSITION_LOADER_MODE_NO_DISC 0x8000 #define LDR_TRANSITION_LOADER_MODE_EJECT 0x10000 #define LDR_TRANSITION_LOADER_MODE_EJECTING 0x20000 #define LDR_TRANSITION_LOADER_MODE_INSERTING 0x40000 #define LDR_TRANSITION_LOADER_MODE_STOP 0x80000 #define LDR_TRANSITION_LOADER_MODE_DISC_BLOCKED 0x100000/******************************//* Player interface functions *//******************************/void player_fsm(void);void player_init(void);void player_set_cmd(const uint8 *new_cmd_params, uint8 new_cmd_id);void update_player_parameters(void);void set_and_report_disc_type(uint8 type);void set_power_mode(uint8 mode);void set_and_report_power_mode(uint8 mode);void set_loader_mode(uint8 mode, uint8 attribute);void set_and_report_loader_mode(uint8 mode, uint8 attribute);uint32 recalc_time_to_position(uint16 minute, uint8 second, uint8 frame);void player_store_resume_info(t_XItem current_song, t_player_song_time song_time, t_player_params * player_params);RETVAL player_cmd(t_player_cmd_event *cmd_event);void player_status(t_player_status_event * player_status);#if ((0!=IPOD_PASSTHROUGH) && (0 != IPOD_AP))void player_downstream_command(t_usb_downstream_cmd_event * player_downstream_cmd);void player_downstream_status(t_usb_downstream_status_event * player_downstream_status);void player_upstream_command(t_usb_upstream_cmd_event * player_upstream_cmd);void player_upstream_status(t_usb_upstream_status_event * player_upstream_status);#endif /* ((0!=IPOD_PASSTHROUGH) && (0 != IPOD_AP)) */extern uint8 power_mode;extern uint8 loader_mode;extern uint8 loader_mode_attribute;extern uint8 player_mode;extern uint8 player_transition_state;extern t_player_mount_fsm_params player_mount_params;extern t_player_params player_params;//extern t_player_resume_info player_resume_info[];extern t_bool player_current_resume_info_available;extern t_XItem player_song;extern uint8 loader_transition_state;extern t_dir_num_style player_dir_numbering;#if (0 != HAVE_POSITION) || (0 != HAVE_UPDATE)extern uint32 update_status;#endif /* HAVE_UPDATE */#endif // _PLAYER_INCLUDED_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -