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); }
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 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 void StartRefreshTimer(void) { api_stop_timer(&mpeg_refresh_id); mpeg_refresh_id = api_start_cycletimer("MPEGRFS", 200, mpeg_refresh_handler); }
static PRESULT slide_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT16 slide_interval; PlayListLoopType loop_type; struct osd_device *osd_dev; struct OSDRect pRect; struct OSDPara OpenPara; UINT32 region_id =0; VACTION unact; FileInfo file_node; char image_name[FULL_PATH_SIZE]; int next_image; static UINT8 timer_start_flag = 0; UINT32 file_idx; SYSTEM_DATA *sys_cfg = sys_data_get(); 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); vpo_aspect_mode((struct vpo_device *)dev_get_by_id(HLD_DEV_TYPE_DIS,0), TV_4_3, NORMAL_SCALE); #ifdef DUAL_VIDEO_OUTPUT vpo_aspect_mode((struct vpo_device *)dev_get_by_id(HLD_DEV_TYPE_DIS,1), TV_4_3, NORMAL_SCALE); #endif 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); // while(jpeg_decoder_task_not_over) // { // libc_printf("error condition!\n"); // osal_task_sleep(20); // } image_abort(); timer_slide = osal_get_tick(); 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(); ///* #ifdef DUAL_ENABLE #ifdef PNG_GIF_TEST pRect.uLeft =136; pRect.uTop = 40; pRect.uWidth = 1008;//OSD_MAX_WIDTH;//608; pRect.uHeight = 640;//OSD_MAX_HEIGHT;//430; OpenPara.eMode = OSD_HD_ARGB1555; OpenPara.uGAlpha = 0x0f; OpenPara.uGAlphaEnable = 0; OpenPara.uPalletteSel = 0; osd_dev = (struct osd_device *)dev_get_by_id(HLD_DEV_TYPE_OSD, 0); if (osd_dev != NULL) { OSDDrv_Close((HANDLE)osd_dev); //AD_GIF_PRINTF("%s() OSD_layer2 is closed!\n", __FUNCTION__); } OSDDrv_Open((HANDLE)osd_dev, &OpenPara); osal_task_sleep(20); //trans_color = OSD_GetTransColor(OpenPara.eMode,TRUE); OSDDrv_IoCtl((HANDLE)osd_dev, OSD_IO_SET_TRANS_COLOR, 0x00); OSDDrv_CreateRegion((HANDLE)osd_dev, region_id, &pRect, NULL); pRect.uLeft = pRect.uTop = 0; OSDDrv_RegionFill((HANDLE)osd_dev,region_id,&pRect,0x00); OSDDrv_ShowOnOff((HANDLE)osd_dev, TRUE); #endif #endif //*/ 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(); sys_cfg = sys_data_get(); sys_data_set_display_mode(&(sys_cfg->avset)); 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) { if(param2 > timer_slide) { image_abort(); } else { libc_printf("slide @@@@@@@@@@@@@@ es case\n"); break; } 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 // while(jpeg_decoder_task_not_over) // { // libc_printf("\n%%%%%%%%%%%%%%%%%%%%%%%%%\n"); // osal_task_sleep(20); // } image_abort(); 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; }