static PRESULT palntsc_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; VACTION unact; SYSTEM_DATA* sys_data; UINT8 tv_out; TEXT_FIELD *txt; UINT16 str_id; txt = &g_win_PALNTSC; sys_data = sys_data_get(); switch(event) { case EVN_PRE_OPEN: tv_out = api_video_get_tvout(); if(tv_out != TV_MODE_PAL && tv_out != TV_MODE_NTSC358) { tv_out = TV_MODE_PAL; api_video_set_tvout(sys_data->avset.tv_mode = tv_out); } str_id = (tv_out == TV_MODE_PAL)? RS_SYSTEM_TV_SYSTEM_PAL : RS_SYSTEM_TV_SYSTEM_NTSC; OSD_SetTextFieldContent(txt, STRING_ID, (UINT32)str_id); break; case EVN_POST_OPEN: api_stop_timer(&tvmode_UI_timer_id); tvmode_UI_timer_id = api_start_timer(TVMODE_UI_TIMER_NAME, TVMODE_UI_TIMER_TIME, win_tvmode_UI_handler); break; case EVN_PRE_CLOSE: break; case EVN_POST_CLOSE: break; case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); if(unact == VACT_ENTER) { tv_out = api_video_get_tvout(); tv_out = (tv_out == TV_MODE_PAL)? TV_MODE_NTSC358 : TV_MODE_PAL; str_id = (tv_out == TV_MODE_PAL)? RS_SYSTEM_TV_SYSTEM_PAL : RS_SYSTEM_TV_SYSTEM_NTSC; OSD_SetTextFieldContent(txt, STRING_ID, (UINT32)str_id); api_video_set_tvout(sys_data->avset.tv_mode = tv_out); OSD_TrackObject( (POBJECT_HEAD)txt, C_UPDATE_ALL); ret = PROC_LOOP; api_stop_timer(&tvmode_UI_timer_id); tvmode_UI_timer_id = api_start_timer(TVMODE_UI_TIMER_NAME, TVMODE_UI_TIMER_TIME, win_tvmode_UI_handler); } break; } return ret; }
static PRESULT otaset_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT32 sat_cnt; switch(event) { case EVN_PRE_OPEN: ota_presat_id = 0xFFFF; //wincom_open_title(pObj,RS_UPGRADE_MODE_SAT, 0); wincom_open_title(pObj,RS_TOOLS_SW_UPGRADE_BY_OTA, 0); #ifdef _BUILD_OTA_E_ ota_load_parameter(); #else win_otaset_load_default_setting(0); #endif win_otaset_load_FreqSymbPid_display(); break; case EVN_POST_DRAW: //win_signal_open(pObj); win_signal_open_ex(pObj,pObj->frame.uLeft,pObj->frame.uTop + LIST_ITEMCNT*(CON_H + CON_GAP) +20); win_otaset_turn_frntend(); api_stop_timer(&ota_turn_timer_id); ota_turn_timer_id = api_start_timer(OTA_TURN_TIMER_NAME, OTA_TURN_TIMER_TIME, win_ota_tpturn_handler); //win_signal_refresh(); //win_signal_update(); break; case EVN_PRE_CLOSE: /* Make OSD not flickering */ *((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG; break; case EVN_POST_CLOSE: //dm_set_onoff(DM_NIMCHECK_ON); api_stop_timer(&ota_turn_timer_id); break; case EVN_MSG_GOT: if(param1 == CTRL_MSG_SUBTYPE_STATUS_SIGNAL) { win_signal_refresh(); //win_signal_update(); } else if(param1 == CTRL_MSG_SUBTYPE_CMD_TP_TURN) { win_otaset_turn_frntend(); } break; } return ret; }
static void PlayProc() { RET_CODE ret; char name[FULL_PATH_SIZE]; FileInfo file_node; int ret_val; if (MPEGInfo.PlayState >= MPEG_PAUSE && MPEGInfo.PlayState <= MPEG_STEP) { mpg_cmd_play_proc(); MPEGInfo.PlayState = MPEG_PLAY; MPEGInfo.PlaySpeed = 0; StartRefreshTimer(); } else if (MPEGInfo.PlayState == MPEG_STOP) { api_stop_timer(&mpeg_refresh_id); mpeg_refresh_id = api_start_cycletimer("MPEGRFS", 200, mpeg_refresh_handler); ret = get_file_from_file_list(win_file_list[VIDEO_FILE_LIST], mpeglist_idx, &file_node); if(ret == RET_FAILURE) { //return FALSE; } win_get_fullname(name, file_node.path, file_node.name); ret_val = video_dec_file(name, 0); if(ret < 0) { //return FALSE; } MPEGInfo.PlayState = MPEG_PLAY; MPEGInfo.PlaySpeed = 0; StartRefreshTimer(); } }
static void StartRefreshTimer(void) { if (mpegYT_prompt_on_screen) mpegYT_file_prompt(NULL, 0); api_stop_timer(&mpegYT_refresh_id); mpegYT_refresh_id = api_start_cycletimer("MPEGYTRFS", 200, mpegYT_refresh_handler); }
void mpvolume_timer_func(UINT unused) { UINT32 msg_code; // construct virtual operation api_stop_timer(&mpvolume_timer); ap_vk_to_hk(0, V_KEY_EXIT, &msg_code); ap_send_msg(CTRL_MSG_SUBTYPE_KEY, msg_code, FALSE); }
static PRESULT tplst_list_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; VACTION unact; switch(event) { case EVN_PRE_DRAW: win_tplist_set_display(); break; case EVN_POST_DRAW: break; case EVN_ITEM_PRE_CHANGE: api_stop_timer(&tpturn_timer_id); break; case EVN_ITEM_POST_CHANGE: tpturn_timer_id = api_start_timer(TPTURN_TIMER_NAME, TPTURN_TIMER_TIME, win_tplist_tpturn_handler); break; case EVN_PRE_CHANGE: break; case EVN_POST_CHANGE: break; case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); ret = win_tplist_list_unkown_act_proc(unact); break; default: break; } return ret; }
static PRESULT win_volume_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; SYSTEM_DATA* sys_data; PROGRESS_BAR* bar; char timestr[50]; bar = &vol_bar; sys_data = sys_data_get(); switch(event) { case EVN_PRE_OPEN: win_volume_switch_clrstyle(); api_inc_wnd_count(); VOLUME_TIMER_TIME = sys_data->osd_set.time_out; if(VOLUME_TIMER_TIME == 0 || VOLUME_TIMER_TIME>10) VOLUME_TIMER_TIME = 5; VOLUME_TIMER_TIME *= 1000; OSD_SetProgressBarPos(bar, sys_data->volume); sprintf(timestr,"vol %d",sys_data->volume); OSD_SetTextFieldContent(&vol_Proc_txt, STRING_ANSI,timestr); break; case EVN_POST_OPEN: volume_timer = api_start_timer(VOLUME_TIMER_NAME,VOLUME_TIMER_TIME,volume_timer_func); break; case EVN_UNKNOWNKEY_GOT: ap_send_msg(CTRL_MSG_SUBTYPE_KEY, param1,FALSE); ret = PROC_LEAVE; break; case EVN_MSG_GOT: if(param1 == CTRL_MSG_SUBTYPE_CMD_EXIT) { ret = PROC_LEAVE; } #ifdef USB_MP_SUPPORT else if(param1 == CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER) { ret = PROC_LEAVE; ap_send_msg(CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER,0,TRUE); } #endif break; case EVN_PRE_CLOSE: break; case EVN_POST_CLOSE: api_stop_timer(&volume_timer); sys_data_save(1); api_dec_wnd_count(); key_cnt=0; i=0; break; default: ; } return ret; }
static PRESULT sleep_set_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; TEXT_FIELD* txt = (TEXT_FIELD*)pObj; UINT32 time; switch(event) { case EVN_PRE_DRAW: OSD_SetTextFieldContent(txt,STRING_ANSI, (UINT32)sleeptimer_item[sleep_timer_states]); break; case EVN_UNKNOWN_ACTION: api_stop_timer(&sleep_UI_timer_id); sleep_timer_states++; sleep_timer_states %= MAX_SLEEP_STEP; OSD_TrackObject(pObj, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); sleep_UI_timer_id = api_start_timer(SLEEP_UI_TIMER_NAME, SLEEP_UI_TIMER_TIME, win_sleeptimer_UI_handler); time = sleeptimer_time[sleep_timer_states]; if(time == 0) time = TMO_FEVR; else time *= 60000; win_sleep_stop(); win_sleep_start(time); ret = PROC_LOOP; break; } return ret; }
static void mpegYT_timeout_handler(UINT32 nouse) { api_stop_timer(&mpegYT_timeout_id); if(MPEGYTInfo.PlayState == MPEG_PLAY) { ap_send_msg(CTRL_MSG_SUBTYPE_STATUS_TIMEOUT, 0, FALSE); } }
void screen_saver_timer_func_one(UINT unused) { api_stop_timer(&f_screen_saver_timer); ap_send_msg(CTRL_MSG_SUBTYPE_CMD_LEAVE_SAVER, 1, TRUE); return; }
void volume_timer_func(UINT unused) { UINT32 hkey; api_stop_timer(&volume_timer); ap_vk_to_hk(0, V_KEY_EXIT, &hkey); ap_send_msg(CTRL_MSG_SUBTYPE_KEY, hkey, TRUE); // send key instead of sending message //ap_send_msg(CTRL_MSG_SUBTYPE_CMD_EXIT, 1, TRUE); }
static void win_imageslide_handler(UINT32 nouse) { if(imageslide_timer_id != OSAL_INVALID_ID) { api_stop_timer(&imageslide_timer_id); imageslide_timer_id = OSAL_INVALID_ID; ap_send_msg(CTRL_MSG_SUBTYPE_STATUS_IMGTOOVER, 0, TRUE); } }
static PRESULT otaset_item_edf_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT8 bID; UINT8 status; EDIT_FIELD* edf; bID = OSD_GetObjID(pObj); edf = (EDIT_FIELD*)pObj; switch(event) { case EVN_POST_CHANGE: status = OSD_GetEditFieldStatus(edf); if(status == SELECT_STATUS) { if(bID == EDIT_TP_FREQ_ID || bID == EDIT_TP_SYMB_ID) { api_stop_timer(&ota_turn_timer_id); ota_turn_timer_id = api_start_timer(OTA_TURN_TIMER_NAME, OTA_TURN_TIMER_TIME, win_ota_tpturn_handler); //win_otaset_turn_frntend(); } } break; case EVN_PARENT_FOCUS_POST_LOSE: if(bID == EDIT_TP_FREQ_ID || bID == EDIT_TP_SYMB_ID) { if(win_otaset_get_FreqSymbPid_display() != 0) { api_stop_timer(&ota_turn_timer_id); ota_turn_timer_id = api_start_timer(OTA_TURN_TIMER_NAME, OTA_TURN_TIMER_TIME, win_ota_tpturn_handler); //win_otaset_turn_frntend(); } } break; } return ret; }
static void StopProc() { if (MPEGYTInfo.PlayState != MPEG_STOP) { api_stop_timer(&mpegYT_refresh_id); mpg_cmd_stop_proc(); MPEGYTInfo.PlayState = MPEG_STOP; MPEGYTInfo.PlaySpeed = 0; MPEGYTInfo.PlayTime = 0; BarState.nPos = 0; BarState.nCursor = 0; } }
static PRESULT win_volume_bar_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; PROGRESS_BAR* bar; SYSTEM_DATA* sys_data; UINT32 vkey; bar = (PROGRESS_BAR*)pObj; sys_data = sys_data_get(); switch(event) { case EVN_PRE_CHANGE: break; case EVN_POST_CHANGE: sys_data->volume = OSD_GetProgressBarPos(bar); if(sys_data->volume > 0 && GetMuteState() ) { SetMuteOnOff(TRUE); //added by Sharon to resolve mute clear display bug restore_mute_bg(); } api_audio_set_volume(sys_data->volume); api_stop_timer(&volume_timer); volume_timer = api_start_timer(VOLUME_TIMER_NAME,VOLUME_TIMER_TIME,volume_timer_func); ret = PROC_LOOP; break; case EVN_UNKNOWNKEY_GOT: ap_hk_to_vk(0, param1, &vkey); if(vkey == V_KEY_NULL) { ret = PROC_LOOP; } break; default: break; } return ret; }
static void PauseProc() { api_stop_timer(&mpegYT_refresh_id); if ((MPEG_PAUSE == MPEGYTInfo.PlayState) || (MPEGYTInfo.PlayState == MPEG_STEP)) { mpg_cmd_resume_proc(); //mpg_cmd_play_proc(); //MPEGYTInfo.PlayState = MPEG_PAUSE; MPEGYTInfo.PlayState = MPEG_STEP; } else if (MPEGYTInfo.PlayState != MPEG_STOP) { mpg_cmd_pause_proc(); MPEGYTInfo.PlayState = MPEG_PAUSE; } MPEGYTInfo.PlaySpeed = 0; MPEGYTInfo.PlayTime = (UINT32)MPGFileDecoderGetPlayTime() + s_ytvideo_seektime; BarState.nPos = MPEGYTInfo.PlayTime; if (NORMAL_MOVING == BarState.State) { BarState.nCursor = BarState.nPos; } }
static PRESULT sleep_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; switch(event) { case EVN_PRE_OPEN: api_inc_wnd_count(); break; case EVN_POST_OPEN: sleep_UI_timer_id = api_start_timer(SLEEP_UI_TIMER_NAME, SLEEP_UI_TIMER_TIME, win_sleeptimer_UI_handler); break; case EVN_PRE_CLOSE: break; case EVN_POST_CLOSE: api_stop_timer(&sleep_UI_timer_id); api_dec_wnd_count(); #ifdef SUPPORT_CAS9 restore_ca_msg_when_exit_win(); #endif break; } return ret; }
static PRESULT win_volume_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; SYSTEM_DATA* sys_data; PROGRESS_BAR* bar; bar = &vol_bar; sys_data = sys_data_get(); switch(event) { case EVN_PRE_OPEN: win_volume_switch_clrstyle(); api_inc_wnd_count(); VOLUME_TIMER_TIME = sys_data->osd_set.time_out; if(VOLUME_TIMER_TIME == 0 || VOLUME_TIMER_TIME>10) VOLUME_TIMER_TIME = 5; VOLUME_TIMER_TIME *= 1000; OSD_SetProgressBarPos(bar, sys_data->volume); break; case EVN_POST_OPEN: volume_timer = api_start_timer(VOLUME_TIMER_NAME,VOLUME_TIMER_TIME,volume_timer_func); break; case EVN_UNKNOWNKEY_GOT: ap_send_msg(CTRL_MSG_SUBTYPE_KEY, param1,FALSE); ret = PROC_LEAVE; break; case EVN_MSG_GOT: if(param1 == CTRL_MSG_SUBTYPE_CMD_EXIT) { ret = PROC_LEAVE; } #ifdef USB_MP_SUPPORT else if(param1 == CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER) { ret = PROC_LEAVE; ap_send_msg(CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER,0,TRUE); } #endif break; case EVN_PRE_CLOSE: // if open volume window by popup window, not clear OSD. if(menu_stack_get_top() != (POBJECT_HEAD)&g_win_volume) { /* Make OSD not flickering */ *((UINT32*)param2) &= ~C_CLOSE_CLRBACK_FLG; } break; case EVN_POST_CLOSE: api_stop_timer(&volume_timer); sys_data_save(1); api_dec_wnd_count(); break; default: ; } return ret; }
static PRESULT win_imageslide_unkown_act_proc(VACTION act) { PRESULT ret = PROC_PASS; UINT8 rotate_mode, display_mode; POBJECT_HEAD win,mplayer_menu; int next_image; UINT16 slide_interval; FileInfo file_node; char image_name[FULL_PATH_SIZE]; switch(act) { case VACT_ROTATEL: case VACT_ROTATER: if(FALSE == decode_finish_flag) break; if(imageslide_pause_state == IMG_UNPAUSE_STATE) { api_stop_timer(&imageslide_timer_id); imageslide_pause_state = IMG_PAUSE_STATE; } if(act == VACT_ROTATER) { image_rot_ang = (image_rot_ang + 1)%IMAGE_ANGLE_CNT; } else { image_rot_ang = (image_rot_ang+IMAGE_ANGLE_CNT - 1)%IMAGE_ANGLE_CNT; } image_rotate(image_rot_ang); if(image_rot_ang == ANG_ORI) { win_imageslide_showrotate(FALSE); win_imageslide_showpause(); } else { OSD_ClearObject((POBJECT_HEAD)&imageslide_pause, 0); win_imageslide_showrotate(TRUE); } slideidx_display(TRUE); break; case VACT_INCREASE: case VACT_DECREASE: if(imageslide_pause_state == IMG_UNPAUSE_STATE) { api_stop_timer(&imageslide_timer_id); imageslide_pause_state = IMG_PAUSE_STATE; win_imageslide_showpause(); } if(act == VACT_INCREASE) { next_image = get_next_index_from_play_list(cur_playlist_image); } else { next_image = get_previous_index_from_play_list(cur_playlist_image); } if(next_image != -1) { cur_image_idx = next_image; api_stop_timer(&imageslide_timer_id); image_abort(); if(image_rot_ang!= ANG_ORI) { image_rot_ang = ANG_ORI; win_imageslide_showrotate(FALSE); win_imageslide_showpause(); } osal_task_sleep(20); set_play_list_info(cur_playlist_image,&cur_image_idx,NULL); get_file_from_play_list(cur_playlist_image, cur_image_idx, &file_node); win_get_fullname(image_name, file_node.path, file_node.name); win_image_file_play(image_name, image_rot_ang); decode_finish_flag = FALSE; osal_task_sleep(20); slideidx_display(TRUE); } break; case VACT_PAUSE: if(imageslide_pause_state == IMG_UNPAUSE_STATE) { imageslide_pause_state = IMG_PAUSE_STATE; win_imageslide_showpause(); api_stop_timer(&imageslide_timer_id); } else { if(image_rot_ang == ANG_ORI) { imageslide_pause_state = IMG_UNPAUSE_STATE; slide_interval = (image_slide_setting.uTime_gap * 1000); win_imageslide_showpause(); if(0 != image_slide_setting.uTime_gap) imageslide_timer_id = api_start_timer("IMAGESLIDE",slide_interval,win_imageslide_handler); } } ret = PROC_LOOP; break; case VACT_PLAY: if(IMG_PAUSE_STATE == imageslide_pause_state) { if(image_rot_ang == ANG_ORI) { imageslide_pause_state = IMG_UNPAUSE_STATE; win_imageslide_showpause(); slide_interval = (image_slide_setting.uTime_gap * 1000); if(0 != image_slide_setting.uTime_gap) imageslide_timer_id = api_start_timer("IMAGESLIDE",slide_interval,win_imageslide_handler); } } ret = PROC_LOOP; break; case VACT_ZOOM: if(decode_finish_flag) { if(imageslide_pause_state == IMG_UNPAUSE_STATE) { imageslide_pause_state = IMG_PAUSE_STATE; win_imageslide_showpause(); api_stop_timer(&imageslide_timer_id); } win_mpzoom_open(); if(image_rot_ang == ANG_ORI) { imageslide_pause_state = IMG_UNPAUSE_STATE; slide_interval = (image_slide_setting.uTime_gap * 1000); win_imageslide_showpause(); imageslide_timer_id = api_start_timer("IMAGESLIDE",slide_interval,win_imageslide_handler); } } break; case VACT_MP: win = (POBJECT_HEAD)(&g_win_imageslide); OSD_ObjClose(win,C_CLOSE_CLRBACK_FLG); while((POBJECT_HEAD)&g_win_usb_filelist != menu_stack_get_top()) { menu_stack_pop(); } image_abort(); win_set_image_multiview_firstidx(); mplayer_menu = (POBJECT_HEAD)(&g_win_imagepreview); if(OSD_ObjOpen(mplayer_menu,(UINT32)(~0)) != PROC_LEAVE) menu_stack_push(mplayer_menu); break; default: break; } return ret; }
static PRESULT slide_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT16 slide_interval; PlayListLoopType loop_type; VACTION unact; FileInfo file_node; char image_name[FULL_PATH_SIZE]; int next_image; static UINT8 timer_start_flag = 0; UINT32 file_idx; switch(event) { case EVN_PRE_OPEN: imageslide_timer_id = OSAL_INVALID_ID; imageslide_proc_id = OSAL_INVALID_ID; if(from_imagepreview == TRUE) { imageslide_pause_state = IMG_PAUSE_STATE; } else { imageslide_pause_state = IMG_UNPAUSE_STATE; } win_imageslide_showpause(); api_set_preview_vpo_color(FALSE); break; case EVN_POST_OPEN: image_rot_ang = ANG_ORI; loop_type = image_slide_setting.bRepeat ? PLAY_LIST_REPEAT : PlAY_LIST_SEQUENCE; set_play_list_info(cur_playlist_image,&cur_image_idx,&loop_type); get_file_from_play_list(cur_playlist_image, cur_image_idx, &file_node); win_get_fullname(image_name, file_node.path, file_node.name); win_image_file_play(image_name, image_rot_ang); slideidx_display(TRUE); decode_finish_flag = FALSE; break; case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); ret = win_imageslide_unkown_act_proc(unact); break; case EVN_PRE_CLOSE: g_from_imageslide = TRUE; imagedec_ioctl(1, IMAGEDEC_IO_CMD_CLEAN_FRM, TRUE); //when quit win_slide, clean 2 frm buffer if(image_folderloop_flag == 1)//filelist { get_file_from_play_list(cur_playlist_image, cur_image_idx, &file_node); win_get_fullname(image_name, file_node.path, file_node.name); usblist_set_filelist_param(image_name); } image_abort(); api_stop_timer(&imageslide_timer_id); api_stop_timer(&imageslide_proc_id); timer_start_flag = 0; imageslide_timer_id = OSAL_INVALID_ID; imageslide_proc_id = OSAL_INVALID_ID; win_set_image_multiview_firstidx(); OSD_ClearObject((POBJECT_HEAD)&imageslide_idx,C_UPDATE_ALL); OSD_ClearObject((POBJECT_HEAD)&imageslide_pause,C_UPDATE_ALL); OSD_ClearObject((POBJECT_HEAD)&decode_txt_progress,C_UPDATE_ALL); OSD_ClearObject((POBJECT_HEAD)&decode_bmp_progress,C_UPDATE_ALL); break; case EVN_POST_CLOSE: image_restore_vpo_rect();//TODO break; case EVN_MSG_GOT: if(param1 == CTRL_MSG_SUBTYPE_CMD_STO && param2 == USB_STATUS_OVER) { //storage_dev_mount_hint(1); file_list_check_storage_device(FALSE, FALSE); } else if(param1 == CTRL_MSG_SUBTYPE_STATUS_IMAGEOVER) { image_abort(); decode_finish_flag = TRUE; if(imageslide_pause_state == IMG_UNPAUSE_STATE) { slide_interval = (image_slide_setting.uTime_gap * 1000); if(0 != slide_interval) imageslide_timer_id = api_start_timer("IMAGESLIDE",slide_interval,win_imageslide_handler); else { imageslide_pause_state = IMG_PAUSE_STATE; win_imageslide_showpause(); } } } else if (param1 == CTRL_MSG_SUBTYPE_STATUS_IMGTOOVER) // timer timeouts { //TODO: play next next_image = get_next_index_from_play_list(cur_playlist_image); if (next_image != -1) { cur_image_idx = next_image; set_play_list_info(cur_playlist_image,&cur_image_idx,NULL); get_file_from_play_list(cur_playlist_image, cur_image_idx, &file_node); win_get_fullname(image_name, file_node.path, file_node.name); win_image_file_play(image_name, image_rot_ang); decode_finish_flag = FALSE; ap_send_msg(CTRL_MSG_SUBTYPE_CMD_UPDATE_VIEW, 0, TRUE); } else { ap_send_msg(CTRL_MSG_SUBTYPE_CMD_EXIT, 0,TRUE); } } else if(param1 == CTRL_MSG_SUBTYPE_CMD_EXIT) { if(from_imagepreview == TRUE) back_to_filelist = TRUE; ret = PROC_LEAVE; } else if(param1 == CTRL_MSG_SUBTYPE_CMD_UPDATE_VIEW) { slideidx_display(TRUE); ret = PROC_LOOP; } else if(param1 == CTRL_MSG_SUBTYPE_STATUS_MP3OVER) { win_play_next_music_ex(); } else if(param1 == CTRL_MSG_SUBTYPE_STATUS_PROC_UPDATE) { OSD_SetBitmapContent(&decode_bmp_progress, loading_bmp_ids[proc_cnt]); OSD_DrawObject((POBJECT_HEAD)&decode_bmp_progress,C_UPDATE_ALL); proc_cnt ++; if(proc_cnt >= LOADING_MAX) proc_cnt = 0; } if ((param1 == CTRL_MSG_SUBTYPE_STATUS_JPEG_DEC_PROCESS) || (param1 == CTRL_MSG_SUBTYPE_STATUS_IMAGEOVER)) { if ((param2 < 100) && (param1 == CTRL_MSG_SUBTYPE_STATUS_JPEG_DEC_PROCESS)) { loading_progress = (param2 * LOADING_MAX)/100; if (loading_progress > LOADING_MAX - 1) loading_progress = LOADING_MAX - 1; if(0 == timer_start_flag) { imageslide_proc_id = OSAL_INVALID_ID; imageslide_proc_id = api_start_cycletimer("SLIDE_PROC", 200, win_imageslide_proc_handler); timer_start_flag = 1; } // OSD_SetBitmapContent(&decode_bmp_progress, loading_bmp_ids[loading_progress]); // OSD_DrawObject((POBJECT_HEAD)&decode_bmp_progress,C_UPDATE_ALL); } else if((param2 >= 100) || (param1 == CTRL_MSG_SUBTYPE_STATUS_IMAGEOVER)) { OSD_ClearObject((POBJECT_HEAD)&decode_bmp_progress,C_UPDATE_ALL); api_stop_timer(&imageslide_proc_id); imageslide_proc_id = OSAL_INVALID_ID; timer_start_flag = 0; proc_cnt = 0; // imageslide_proc_id = OSAL_INVALID_ID; } } break; default: break; } return ret; }
static PRESULT win_mpeg_player_key_proc(POBJECT_HEAD pObj, UINT32 key, UINT32 param) { PRESULT ret = PROC_LOOP; int wait_time = 0; if((key == V_KEY_PAUSE)&&(MPEGInfo.PlayState != MPEG_PLAY)) { key = V_KEY_PLAY; } switch (key) { case V_KEY_EXIT: case V_KEY_MENU: if (m_HideWindow) { if (m_bSetVol) { //ShowVolumeBar(FALSE);//Close volume bar win_mpegplayer_close_video_vol(); m_bSetVol = FALSE; } else { ret = PROC_LEAVE;//exit video player } } else { if (MPEGInfo.PlayState == MPEG_STOP) { ret = PROC_LEAVE;//exit video player } else { api_stop_timer(&mpeg_timeout_id); win_mpeg_player_draw(FALSE);//Hide the information window if (BarState.State == CURSOR_MOVING) { SyncBarPosAndCursor(POS_TO_CUR); } } } break; case V_KEY_PLAY: case V_KEY_1: if(MPEGInfo.PlayState != MPEG_PLAY) { PivotalKeyProc(); PlayProc(); } break; case V_KEY_PAUSE: case V_KEY_2: case V_KEY_STEP: PivotalKeyProc(); PauseProc(); break; case V_KEY_STOP: case V_KEY_0: PivotalKeyProc(); StopProc(); ret = PROC_LEAVE; break; case V_KEY_PREV: case V_KEY_NEXT: break; case V_KEY_FF: if (MPEGInfo.PlayState == MPEG_STOP) { return PROC_LOOP; } else { PivotalKeyProc(); FastForwardProc(); } break; case V_KEY_FB: if (MPEGInfo.PlayState == MPEG_STOP) { return PROC_LOOP; } else { PivotalKeyProc(); FastBackwardProc(); } break; case V_KEY_SLOW: if (MPEGInfo.PlayState == MPEG_STOP) { return PROC_LOOP; } else { PivotalKeyProc(); SlowForwardProc(); } break; case V_KEY_LEFT: if (m_HideWindow) { win_mpeg_player_draw(FALSE); win_mpegplayer_set_video_vol(V_KEY_LEFT); return PROC_LOOP; } if (MPEGInfo.PlayState != MPEG_STOP) { if (BarState.State != CURSOR_MOVING) { BarState.State = CURSOR_MOVING; BarState.nCursor = BarState.nPos; } if (BarState.nCursor > SLIDE_BAR_STEP) { BarState.nCursor -= SLIDE_BAR_STEP; } else if (0 == BarState.nCursor ) { if(BarState.nRange > SLIDE_BAR_STEP) BarState.nCursor = BarState.nRange-SLIDE_BAR_STEP; else BarState.nCursor = BarState.nRange; } else { BarState.nCursor = 0; } } win_mpeg_player_draw(TRUE); break; case V_KEY_RIGHT: if (m_HideWindow) { win_mpeg_player_draw(FALSE); win_mpegplayer_set_video_vol(V_KEY_RIGHT); return PROC_LOOP; } if (MPEGInfo.PlayState != MPEG_STOP) { if (BarState.State != CURSOR_MOVING) { BarState.State = CURSOR_MOVING; BarState.nCursor = BarState.nPos; } if (BarState.nCursor + SLIDE_BAR_STEP < BarState.nRange) { BarState.nCursor += SLIDE_BAR_STEP; } else { if(BarState.nRange > SLIDE_BAR_STEP) BarState.nCursor = SLIDE_BAR_STEP; else BarState.nCursor = BarState.nRange - VIDEO_SEARCH_DLYS; } } win_mpeg_player_draw(TRUE); break; case V_KEY_ENTER: if (MPEGInfo.PlayState != MPEG_STOP) { if (BarState.State == CURSOR_MOVING) { if (BarState.nPos < BarState.nCursor)//forward { BarState.CursorDir = 1; } else if (BarState.nPos > BarState.nCursor)//backward { BarState.CursorDir = 2; } else { BarState.CursorDir = 0; } SyncBarPosAndCursor(CUR_TO_POS); MPEGInfo.PlayTime = BarState.nPos; if (BarState.CursorDir == 1)//forward { mpg_cmd_search_proc(MPEGInfo.PlayTime); while ((MPEGInfo.PlayTime > (UINT32)MPGFileDecoderGetPlayTime()) && (wait_time < 555)) { osal_task_sleep(2); wait_time++; } } else if (BarState.CursorDir == 2)//backward { mpg_cmd_search_proc(MPEGInfo.PlayTime); while ((MPEGInfo.PlayTime + VIDEO_SEARCH_DLYS < (UINT32)MPGFileDecoderGetPlayTime()) && (wait_time < 555)) { osal_task_sleep(2); wait_time++; } } PlayProc(); } } break; case V_KEY_INFOR: case V_KEY_PVR_INFO: m_HideWindow = !m_HideWindow; if (!m_HideWindow) { if (m_bSetVol)//if volume window is open, close it. { //ShowVolumeBar(FALSE); } win_mpeg_player_draw(TRUE); } else { win_mpeg_player_draw(FALSE); if (BarState.State == CURSOR_MOVING) { SyncBarPosAndCursor(POS_TO_CUR); } } break; case V_KEY_MUTE: break; } return ret; }
static PRESULT win_progname_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT32 i; VACTION unact; static UINT16 recall_channel = P_INVALID_ID; SYSTEM_DATA* sys_data; sys_data = sys_data_get(); switch(event) { case EVN_PRE_OPEN: if(screen_back_state == SCREEN_BACK_MENU) { ap_clear_all_menus(); } b_popdetail = FALSE; PROGNAME_TIMER_TIME = sys_data->osd_set.time_out; if(PROGNAME_TIMER_TIME == 0 || PROGNAME_TIMER_TIME>10) PROGNAME_TIMER_TIME = 5; PROGNAME_TIMER_TIME *= 1000; recall_channel = P_INVALID_ID; if( (param2 & MENU_OPEN_TYPE_MASK) == MENU_OPEN_TYPE_KEY) { if( (param2 & MENU_OPEN_PARAM_MASK ) == V_KEY_RECALL) { recall_channel = recall_play_channel(0); if(recall_channel == P_INVALID_ID) return PROC_LEAVE; } } api_inc_wnd_count(); break; case EVN_POST_OPEN: if(show_and_playchannel) { UINT16 channel; show_and_playchannel = 0; channel = sys_data_get_cur_group_cur_mode_channel(); api_play_channel(channel, TRUE, TRUE,FALSE); } if(recall_channel != P_INVALID_ID) { api_play_channel(recall_channel, TRUE, TRUE,FALSE); OSD_TrackObject(pObj, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); } progname_timer = api_start_timer(PROGNAME_TIMER_NAME,PROGNAME_TIMER_TIME,progname_timer_func); ShowMuteOnOff(); ShowPauseOnOff(); #ifdef DVR_PVR_SUPPORT ShowRecHintOSDOnOff(GetRecHintState()); #endif break; case EVN_PRE_CLOSE: break; case EVN_POST_CLOSE: api_stop_timer(&progname_timer); sys_data_save(1); api_dec_wnd_count(); if(b_popdetail) { #if 0//def DVR_PVR_SUPPORT if(pvr_info.hdd_valid && (ap_pvr_set_state() != PVR_STATE_IDEL)) ap_send_msg(CTRL_MSG_SUBTYPE_CMD_ENTER_ROOT, (UINT32)&g_win_pvr_ctrl, TRUE); else ap_send_msg(CTRL_MSG_SUBTYPE_CMD_ENTER_ROOT, (UINT32)&g_win_progdetail, TRUE); #else ap_send_msg(CTRL_MSG_SUBTYPE_CMD_ENTER_ROOT, (UINT32)&g_win_progdetail, TRUE); #endif } break; case EVN_PRE_DRAW: break; case EVN_POST_DRAW: #ifdef MODIFY_FOR_EGYPT_CUSTOMER win_progname_draw_bmp(); #endif win_progname_draw_infor(); break; case EVN_UNKNOWNKEY_GOT: ap_send_msg(CTRL_MSG_SUBTYPE_KEY, param1, FALSE); ret = PROC_LEAVE; break; case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16) ; ret = win_progname_unkown_act_proc(unact); break; case EVN_MSG_GOT: ret = win_progname_message_proc(param1,param2); break; default: break; } return ret; }
static PRESULT win_progname_unkown_act_proc(VACTION act) { PRESULT ret = PROC_LOOP; INT32 shift; UINT8 av_mode,back_saved; UINT16 channel; UINT16 strID; #ifdef DVR_PVR_SUPPORT if(api_pvr_is_recording()) { if( act != VACT_CH_UP && act != VACT_CH_DOWN) { return ret; } } #endif api_stop_timer(&progname_timer); shift = -1; switch(act) { case VACT_CH_UP: shift = 1; case VACT_CH_DOWN: change_channel(shift); break; case VACT_GRP_UP: shift = 1; case VACT_GRP_DOWN: change_group(shift); break; case VACT_FCH_UP: shift = 1; case VACT_FCH_DOWN: change_fav_channel(shift); break; case VACT_TV_RADIO_SW: av_mode = sys_data_get_cur_chan_mode(); av_mode = (av_mode==TV_CHAN)? RADIO_CHAN : TV_CHAN; sys_data_get_cur_group_channel(&channel, av_mode); if(channel==P_INVALID_ID) /* If the opposite mode has no channel */ { if(av_mode==RADIO_CHAN) strID = RS_MSG_NO_RADIO_CHANNEL; else strID = RS_MSG_NO_TV_CHANNEL; win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL, NULL,strID); win_compopup_open_ext(&back_saved); osal_task_sleep(500); win_compopup_smsg_restoreback(); } else { #ifndef NEW_DEMO_FRAME UIChChgStopProg(TRUE); #endif sys_data_set_cur_chan_mode(av_mode); change_group(0); } break; case VACT_RECALL: channel = recall_play_channel(0); if(channel != P_INVALID_ID) api_play_channel(channel, TRUE, TRUE,FALSE); break; case VACT_POP_DETAIL: b_popdetail = TRUE; ret = PROC_LEAVE; break; default: break; } win_progname_redraw(); progname_timer = api_start_timer(PROGNAME_TIMER_NAME,PROGNAME_TIMER_TIME,progname_timer_func); return ret; }
static PRESULT factoryset_sel_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; VACTION unact; UINT32 sel; UINT8 bID; char str[10]; UINT16 * Uni_str; UINT8* pstr; UINT16 cur_idx; COM_POP_LIST_TYPE_T list_type; OSD_RECT rect; COM_POP_LIST_PARAM_T param; UINT16 i,n = 0; S_NODE s_node; UINT32 flag; bID = OSD_GetObjID(pObj); switch(event) { case EVN_PRE_CHANGE: sel = *((UINT32*)param1); break; case EVN_POST_CHANGE: sel = param1; if(bID == IDC_CON5) { get_sat_at(sel,SET_SELECTED,&s_node); #if 0 #ifdef SUPPORT_TWO_TUNER //guop modify #ifdef SUPPORT_SELECT_SAME_SAT OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, ((s_node.reserve_1 == 0) ? RS_LNB1 : RS_LNB2)); #else OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, (s_node.tuner1_valid ? RS_LNB1 : RS_LNB2)); #endif OSD_DrawObject((POBJECT_HEAD)&satsrch_txt6_note, C_UPDATE_ALL); #endif #endif } break; case EVN_REQUEST_STRING: sel = param1; Uni_str= (UINT16*)param2; if(bID == IDC_CON5) { get_sat_name_factory(2,sel,Uni_str); sys_data_set_cur_satidx(sel); } break; #if 0 case EVN_UNKNOWN_ACTION: unact = (VACTION)(param1>>16); if(unact == VACT_POP_UP) { OSD_SetRect2(&rect,&pObj->frame); switch(bID) { case SAT_ID: rect.uLeft -= 80; rect.uWidth += 80; list_type = POP_LIST_TYPE_SAT; rect.uHeight = 300; param.id = TUNER_EITHER; param.cur = SATSRCH_SAT_IDX; if(single_multi_srch_flag == 0) param.selecttype = POP_LIST_SINGLESELECT; else { MEMSET(sat_select,0,sizeof(sat_select)); n = get_tuner_sat_cnt(TUNER_EITHER); if(n == 0) { list_type = 0xFF; break; } for(i=0;i<n;i++) { get_tuner_sat(TUNER_EITHER,i,&s_node); if(s_node.selected_flag) sat_select[i] = 1; } #if (defined(SUPPORT_TWO_TUNER) || !defined(SELECT_SAT_ONLY)) param.selecttype = POP_LIST_MULTISELECT; #else param.selecttype = POP_LIST_SINGLESELECT; #endif param.select_array = sat_select; } break; default: list_type = 0xFF; } if(list_type == 0xFF) break; cur_idx = win_com_open_sub_list(list_type,&rect,¶m); if(single_multi_srch_flag == 0) { if(cur_idx == LIST_INVALID_SEL_IDX || cur_idx == param.cur) break; } else { /* Check the select satellite */ #if (defined(SUPPORT_TWO_TUNER) || !defined(SELECT_SAT_ONLY)) for(i=0;i<n;i++) { if(win_comlist_ext_check_item_sel(i)) flag = 1; else flag = 0; get_tuner_sat(TUNER_EITHER,i,&s_node); if(s_node.selected_flag != flag) { s_node.selected_flag = flag; modify_sat(s_node.sat_id, &s_node); } } update_data(TYPE_SAT_NODE); #endif } if(single_multi_srch_flag == 0) SATSRCH_SAT_IDX = cur_idx; get_sat_at(cur_idx,SET_SELECTED,&s_node); #ifdef SUPPORT_SELECT_SAME_SAT OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, ((s_node.reserve_1 == 0) ? RS_LNB1 : RS_LNB2)); #else OSD_SetTextFieldContent(&satsrch_txt6_note , STRING_ID, (s_node.tuner1_valid ? RS_LNB1 : RS_LNB2)); #endif OSD_DrawObject((POBJECT_HEAD)&satsrch_txt6_note, C_UPDATE_ALL); OSD_TrackObject((POBJECT_HEAD)&satsrch_item1, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); if(single_multi_srch_flag) { /* TODO : Draw the select satellites name */ //win_satsrch_set_drawselectsats(); UINT16 sat_cnt = get_tuner_sat_cnt(TUNER_EITHER_SELECT); if(sat_cnt <=(SELSAT_ROW_CNT*2)) win_satsrch_set_fix_drawselectsats(); else { start_scroll_sat_id=0; api_stop_timer(&sat_display_scroll); sat_display_scroll = api_start_timer("SATDISP",500,(OSAL_T_TIMER_FUNC_PTR)sat_search_scroll_disp_handler); } } } break; #endif } return ret; }
void progname_timer_func(UINT unused) { api_stop_timer(&progname_timer); ap_send_msg(CTRL_MSG_SUBTYPE_CMD_EXIT, 1, TRUE); }
static PRESULT win_mpeg_player_message_proc(POBJECT_HEAD pObj, UINT32 msg_type, UINT32 msg_code) { PRESULT ret = PROC_LOOP; struct VDec_StatusInfo vdec_status; switch (msg_type) { case CTRL_MSG_SUBTYPE_CMD_STO: if(msg_code == USB_STATUS_OVER) { storage_dev_mount_hint(1); file_list_check_storage_device(FALSE, FALSE); } break; case CTRL_MSG_SUBTYPE_CMD_TIMEDISPLAYUPDATE: MPEGInfo.PlayTime = (UINT32)MPGFileDecoderGetPlayTime(); if(MPEGInfo.PlayTime >= MPEGInfo.TotalTime) { BarState.nPos = MPEGInfo.TotalTime - 1; } else BarState.nPos = MPEGInfo.PlayTime; if (!m_HideWindow) { win_mpeg_player_draw(TRUE); } break; case CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER: //video over #if 0 vdec_io_control(dev_get_by_id(HLD_DEV_TYPE_DECV, 0), VDEC_IO_GET_STATUS, (UINT32)(&vdec_status)); if(MPEG_FB != MPEGInfo.PlayState && MPEG_SB != MPEGInfo.PlayState && vdec_status.api_play_direction == VDEC_FORWARD) { if((filelist_get_current_classifiedfile_count(MP_VIDEO)+1)<mpeglist_cnt) { mpeglist_idx = filelist_get_next_classifiedfile_index(MP_VIDEO, mpeglist_idx); } else { mpeglist_idx = (UINT16)(~0); } } if(mpeglist_idx != (UINT16)(~0)) { if(vdec_status.api_play_direction == VDEC_FORWARD) mpg_cmd_stop_proc(); MPEGInfo.PlayState = MPEG_STOP; api_stop_timer(&mpeg_refresh_id); m_mpeg_player_working = FALSE; MPEG_player_init(); m_mpeg_player_working = TRUE; } else ret = PROC_LEAVE; #else if(MPEGInfo.PlayState == MPEG_FB) { MPEGInfo.PlayState = MPEG_STOP; PlayProc(); } else { ret = PROC_LEAVE; } #endif break; case CTRL_MSG_SUBTYPE_STATUS_TIMEOUT: //mpeg player display timer out if (!m_HideWindow) { win_mpeg_player_draw(FALSE); if (BarState.State == CURSOR_MOVING) { SyncBarPosAndCursor(POS_TO_CUR); } } else { if (m_bSetVol)//if the volume bar is showing { //ShowVolumeBar(FALSE);//Close the volume bar } } break; } return ret; }
static PRESULT win_mpegYT_player_message_proc(POBJECT_HEAD pObj, UINT32 msg_type, UINT32 msg_code) { PRESULT ret = PROC_LOOP; struct VDec_StatusInfo vdec_status; switch (msg_type) { case CTRL_MSG_SUBTYPE_CMD_STO: if(msg_code == USB_STATUS_OVER) do{}while(0); break; case CTRL_MSG_SUBTYPE_CMD_TIMEDISPLAYUPDATE: //add on 2011-09-28 fixBUG42869 //if(!b_vdec_support && !b_audio_yt_support) //{ // StopProc(); // break; //} MPEGYTInfo.PlayTime = (UINT32)MPGFileDecoderGetPlayTime() + s_ytvideo_seektime; if(MPEGYTInfo.PlayTime >= MPEGYTInfo.TotalTime) { BarState.nPos = MPEGYTInfo.TotalTime - 1; } else BarState.nPos = MPEGYTInfo.PlayTime; if (!m_HideWindow) { win_mpegYT_player_draw(TRUE); } break; case CTRL_MSG_SUBTYPE_STATUS_VIDEO_OVER: //video over #if 0 vdec_io_control(dev_get_by_id(HLD_DEV_TYPE_DECV, 0), VDEC_IO_GET_STATUS, (UINT32)(&vdec_status)); if(MPEG_FB != MPEGYTInfo.PlayState && MPEG_SB != MPEGYTInfo.PlayState && vdec_status.api_play_direction == VDEC_FORWARD) { if((filelist_get_current_classifiedfile_count(MP_VIDEO)+1)<mpegYTlist_cnt) { mpegYTlist_idx = filelist_get_next_classifiedfile_index(MP_VIDEO, mpegYTlist_idx); } else { mpegYTlist_idx = (UINT16)(~0); } } if(mpegYTlist_idx != (UINT16)(~0)) { if(vdec_status.api_play_direction == VDEC_FORWARD) { libnet_download_abort(g_strf_cur_dl_rsrc); mpg_cmd_stop_proc(); } MPEGYTInfo.PlayState = MPEG_STOP; api_stop_timer(&mpegYT_refresh_id); m_mpegYT_player_working = FALSE; MPEGYT_player_init(); m_mpegYT_player_working = TRUE; } else ret = PROC_LEAVE; #else if(MPEGYTInfo.PlayState == MPEG_FB) { MPEGYTInfo.PlayState = MPEG_STOP; PlayProc_yt(); } else { ret = PROC_LEAVE; } #endif break; case CTRL_MSG_SUBTYPE_STATUS_TIMEOUT: //mpegYT player display timer out if (!m_HideWindow) { win_mpegYT_player_draw(FALSE); if (BarState.State == CURSOR_MOVING) { SyncBarPosAndCursor(POS_TO_CUR); } } else { if (m_bSetVol_YT)//if the volume bar is showing { //ShowVolumeBar(FALSE);//Close the volume bar } } break; case CTRL_MSG_SUBTYPE_STATUS_VIDEO_DEC_ERR: case CTRL_MSG_SUBTYPE_STATUS_PARSE_END: s_is_in_parsing = 0; // mpegYT_refresh_cnt = 0; MPEGYTInfo.TotalTime = get_video_total_time() + s_ytvideo_seektime; BarState.nRange = MPEGYTInfo.TotalTime; mpegYT_file_prompt(NULL, FALSE); //mpegYT_unsupport_detect(msg_code); #ifdef AV_DELAY_SUPPORT if(b_vdec_support && b_audio_yt_support) { SYSTEM_DATA *psys_data = sys_data_get(); if(psys_data->avset.avdelay_value > 500) MpgSetAVSyncDelay(1, psys_data->avset.avdelay_value-500); //0:video; 1:audio. else if(psys_data->avset.avdelay_value > 0 && psys_data->avset.avdelay_value < 500) MpgSetAVSyncDelay(0, psys_data->avset.avdelay_value); //0:video; 1:audio. } #endif break; } return ret; }
static PRESULT win_mpegYT_player_key_proc(POBJECT_HEAD pObj, UINT32 key, UINT32 param) { PRESULT ret = PROC_LOOP; int wait_time = 0; if((key == V_KEY_PAUSE)&&(MPEGYTInfo.PlayState != MPEG_PLAY)) { key = V_KEY_PLAY; } switch (key) { case V_KEY_EXIT: case V_KEY_MENU: if (m_HideWindow) { if (m_bSetVol_YT) { //ShowVolumeBar(FALSE);//Close volume bar win_mpegYTplayer_close_video_vol(); m_bSetVol_YT = FALSE; } else { ret = PROC_LEAVE;//exit video player } } else { if (MPEGYTInfo.PlayState == MPEG_STOP) { ret = PROC_LEAVE;//exit video player } else { api_stop_timer(&mpegYT_timeout_id); win_mpegYT_player_draw(FALSE);//Hide the information window if (BarState.State == CURSOR_MOVING) { SyncBarPosAndCursor(POS_TO_CUR); } } } break; case V_KEY_PLAY: case V_KEY_1: if(MPEGYTInfo.PlayState != MPEG_PLAY) { PivotalKeyProc(); PlayProc_yt(); } break; case V_KEY_PAUSE: case V_KEY_2: case V_KEY_STEP: PivotalKeyProc(); PauseProc(); break; case V_KEY_STOP: case V_KEY_0: PivotalKeyProc(); StopProc(); ret = PROC_LEAVE; break; case V_KEY_LEFT: if (m_HideWindow) { win_mpegYT_player_draw(FALSE); win_mpegYTplayer_set_video_vol(V_KEY_LEFT); return PROC_LOOP; } if(s_is_in_parsing) { break; } if (MPEGYTInfo.PlayState != MPEG_STOP) { if (BarState.State != CURSOR_MOVING) { BarState.State = CURSOR_MOVING; BarState.nCursor = BarState.nPos; } if (BarState.nCursor > SLIDE_BAR_STEP) { BarState.nCursor -= SLIDE_BAR_STEP; } else if (0 == BarState.nCursor ) { if(BarState.nRange > SLIDE_BAR_STEP) BarState.nCursor = BarState.nRange-SLIDE_BAR_STEP; else BarState.nCursor = BarState.nRange; }else { BarState.nCursor = 0; } } win_mpegYT_player_draw(TRUE); break; case V_KEY_RIGHT: if (m_HideWindow) { win_mpegYT_player_draw(FALSE); win_mpegYTplayer_set_video_vol(V_KEY_RIGHT); return PROC_LOOP; } if(s_is_in_parsing) { break; } if (MPEGYTInfo.PlayState != MPEG_STOP) { if (BarState.State != CURSOR_MOVING) { BarState.State = CURSOR_MOVING; BarState.nCursor = BarState.nPos; } if (BarState.nCursor + SLIDE_BAR_STEP < BarState.nRange) { BarState.nCursor += SLIDE_BAR_STEP; } else { if(BarState.nRange > SLIDE_BAR_STEP) BarState.nCursor = SLIDE_BAR_STEP; else BarState.nCursor = BarState.nRange - VIDEO_SEARCH_DLYS; } } win_mpegYT_player_draw(TRUE); break; case V_KEY_ENTER: if (MPEGYTInfo.PlayState != MPEG_STOP) { if (BarState.State == CURSOR_MOVING) { if (BarState.nPos < BarState.nCursor)//forward { BarState.CursorDir = 1; } else if (BarState.nPos > BarState.nCursor)//backward { BarState.CursorDir = 2; } else { BarState.CursorDir = 0; } SyncBarPosAndCursor(CUR_TO_POS); MPEGYTInfo.PlayTime = BarState.nPos; if (BarState.CursorDir) { s_ytvideo_seektime = MPEGYTInfo.PlayTime; api_stop_timer(&mpegYT_refresh_id); libnet_download_abort(g_strf_cur_dl_rsrc); mpg_cmd_stop_proc(); mpegYT_file_prompt("Loading, please wait...", TRUE); osal_task_sleep(1000); UINT8 tmpurl[1024]; UINT8* tmppos; tmppos = strstr(url_youtube, "&begin="); if(NULL == tmppos) { sprintf(tmpurl, "&begin=%d", s_ytvideo_seektime * 1000); strcat(url_youtube, tmpurl); }else { sprintf(tmppos, "&begin=%d", s_ytvideo_seektime * 1000); } httpstrfile_url_gen(tmpurl, url_youtube, "mp4"); video_dec_file(tmpurl, 0); s_is_in_parsing = 1; MPEGYTInfo.PlaySpeed = 0; StartRefreshTimer(); } PlayProc_yt(); } } break; default: break; } return ret; }
static PRESULT mpegYT_player_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; VACTION unact; SYSTEM_DATA* sys_data; sys_data = sys_data_get(); switch (event) { case EVN_PRE_OPEN: MPEGYTBAR_TIMER_TIME = sys_data->osd_set.time_out; if(MPEGYTBAR_TIMER_TIME == 0 || MPEGYTBAR_TIMER_TIME>10) MPEGYTBAR_TIMER_TIME = 5; MPEGYTBAR_TIMER_TIME *= 1000; if (!m_mpegYT_player_working) { entry_youtube = ((yt_player_param*)param2)->ytentry_handle; url_youtube = ((yt_player_param*)param2)->url; MPEGYT_player_init(); } else { ret = PROC_LOOP; } m_mpegYT_player_working = TRUE; break; case EVN_POST_OPEN: mpegYT_timeout_id = api_start_timer(MPEGYTBAR_TIMER_NAME, MPEGYTBAR_TIMER_TIME, mpegYT_timeout_handler); break; case EVN_POST_DRAW: win_mpegYT_player_draw_infor(); break; case EVN_PRE_CLOSE: libnet_download_abort(g_strf_cur_dl_rsrc); mpg_cmd_stop_proc(); api_stop_timer(&mpegYT_refresh_id); api_stop_timer(&mpegYT_timeout_id); m_mpegYT_player_working = FALSE; g_from_mpegYTplayer = TRUE; s_ytvideo_seektime = 0; break; case EVN_UNKNOWN_ACTION: api_stop_timer(&mpegYT_timeout_id); unact = (VACTION)(param1>>16); //add on 2011-09-28 for BUG42869 //if(!b_vdec_support && !b_audio_yt_support) // MPEGYTInfo.TotalTime = 0; //else // MPEGYTInfo.TotalTime = MPGGetTotalPlayTime() + s_ytvideo_seektime; MPEGYTInfo.TotalTime = entry_youtube->info->duration; switch (unact) { case VACT_MUTE: { SetMuteOnOff(TRUE); ret = PROC_LOOP; break; } default : { ret = win_mpegYT_player_key_proc(pObj, (param1 & 0xFFFF), param2); if (ret != PROC_LEAVE) { if( ((param1 & 0xFFFF) != V_KEY_EXIT) && ((param1 & 0xFFFF) != V_KEY_MENU) && ((param1 & 0xFFFF) != V_KEY_PVR_INFO) && ((param1 & 0xFFFF) != V_KEY_LEFT) && ((param1 & 0xFFFF) != V_KEY_RIGHT)) { win_mpegYT_player_draw(TRUE); } } break; } } mpegYT_timeout_id = api_start_timer(MPEGYTBAR_TIMER_NAME, MPEGYTBAR_TIMER_TIME, mpegYT_timeout_handler); break; case EVN_UNKNOWNKEY_GOT: break; case EVN_MSG_GOT: ret = win_mpegYT_player_message_proc(pObj, param1, param2); break; } return ret; }
static void StartRefreshTimer(void) { api_stop_timer(&mpeg_refresh_id); mpeg_refresh_id = api_start_cycletimer("MPEGRFS", 200, mpeg_refresh_handler); }