void ap_osd_layer2_init() { UINT8 *p_pallette; struct OSDPara tOpenPara; struct OSDRect region1, region2, rc1, rc2; cas_osd_dev = (struct osd_device*)dev_get_by_id(HLD_DEV_TYPE_OSD, 0); tOpenPara.eMode = OSD_256_COLOR; tOpenPara.uGAlphaEnable = 0; tOpenPara.uGAlpha = 0x0F; tOpenPara.uPalletteSel = 0; OSDDrv_Open((HANDLE)cas_osd_dev, &tOpenPara); osal_task_sleep(20); OSDDrv_IoCtl((HANDLE)cas_osd_dev, OSD_IO_SET_TRANS_COLOR, OSD_TRANSPARENT_COLOR); //create region for bottom osd msg region2.uLeft = 0; region2.uTop = 530; region2.uWidth = 720; region2.uHeight = 28; rc2.uLeft = 0; rc2.uTop = 0; rc2.uWidth = region2.uWidth; rc2.uHeight = region2.uHeight; OSDDrv_CreateRegion((HANDLE)cas_osd_dev, OSDMSG_REGION_BTM, ®ion2, NULL); p_pallette = OSD_GetRscPallette(0x4080 | 0); OSDDrv_SetPallette((HANDLE)cas_osd_dev, p_pallette, COLOR_N, OSDDRV_YCBCR); OSDDrv_RegionFill((HANDLE)cas_osd_dev,OSDMSG_REGION_BTM,&rc2,OSD_TRANSPARENT_COLOR); OSDDrv_ShowOnOff((HANDLE)cas_osd_dev,OSDDRV_ON); }
static void osd_output_init(void) { struct osd_device *osd_dev; UINT32 region_id =0; UINT32 trans_color; struct OSDRect region_rect; struct OSDPara OpenPara; UINT8 *p_pallette; region_rect.uLeft = 0; region_rect.uTop = 0; region_rect.uWidth = 800;//OSD_MAX_WIDTH;//608; region_rect.uHeight = 500;//OSD_MAX_HEIGHT;//430; OpenPara.eMode = OSD_256_COLOR; OpenPara.uGAlpha = 0x0f; OpenPara.uGAlphaEnable = 0; OpenPara.uPalletteSel = 0; osd_dev = (struct osd_device *)dev_get_by_id(HLD_DEV_TYPE_OSD, 0); OSDDrv_Open((HANDLE)osd_dev, &OpenPara); osal_task_sleep(20); //trans_color = OSD_GetTransColor(OpenPara.eMode,FALSE); OSDDrv_IoCtl((HANDLE)osd_dev, OSD_IO_SET_TRANS_COLOR, 0x00); OSDDrv_CreateRegion((HANDLE)osd_dev, region_id, ®ion_rect, NULL); //p_pallette = OSD_GetRscPallette(0x4080 | 0); //OSD_SetPallette(p_pallette,256); //OSDDrv_RegionFill((HANDLE)osd_dev,region_id,®ion_rect,0xff); //OSDDrv_ShowOnOff((HANDLE)osd_dev, TRUE); }
void OSD_init(struct OSD_InitInfo* pOSDInfo, UINT8* p_pallette) { OSD_SetDeviceHandle((HANDLE)pOSDInfo->p_handle); OSDDrv_Open((HANDLE)pOSDInfo->p_handle, &(pOSDInfo->tOpenPara)); OSDDrv_CreateRegion((HANDLE)pOSDInfo->p_handle, 0, &(pOSDInfo->osdrect), NULL); pOSDInfo->osdrect.uLeft = pOSDInfo->osdrect.uTop = 0; OSDDrv_SetPallette((HANDLE)pOSDInfo->p_handle, p_pallette, COLOR_N, OSDDRV_YCBCR); OSDDrv_RegionFill((HANDLE)pOSDInfo->p_handle,0,&(pOSDInfo->osdrect),OSD_TRANSPARENT_COLOR); OSDDrv_ShowOnOff((HANDLE)pOSDInfo->p_handle,OSDDRV_ON); }
/* called from keyboard/mouse/screen */ static PSD ALI_OSD_open(PSD psd) { struct OSDRect tOpenRect, osdrect; enum OSDSys eOSDSys; struct OSDPara tOpenPara; enum TVSystem tvsys; psd->xres = psd->xvirtres = OSD_MAX_WIDTH; psd->yres = psd->yvirtres = OSD_MAX_HEIGHT; psd->bpp = 8; psd->ncolors = 256; psd->linelen = (psd->xres * psd->bpp) >> 3; psd->size = psd->yres * psd->linelen; psd->planes = 1; psd->pixtype = 0; psd->flags = PSF_SCREEN; tOpenRect.uLeft = (720 - OSD_MAX_WIDTH)>>1; tOpenRect.uWidth = OSD_MAX_WIDTH; tOpenRect.uTop = ((576 - OSD_MAX_HEIGHT)>>1); tOpenRect.uHeight = OSD_MAX_HEIGHT; tOpenPara.eMode = OSD_256_COLOR; tOpenPara.uGAlphaEnable = IF_GLOBAL_ALPHA; tOpenPara.uGAlpha = 0x0F; tOpenPara.uPalletteSel = 0; osdrect.uLeft = (720-OSD_MAX_WIDTH) >> 1; osdrect.uTop = (576-OSD_MAX_HEIGHT) >> 1; osdrect.uWidth = OSD_MAX_WIDTH; osdrect.uHeight = OSD_MAX_HEIGHT; osd_dev = (struct osd_device *)dev_get_by_id(HLD_DEV_TYPE_OSD, 0); OSDDrv_Open((HANDLE)osd_dev, &tOpenPara); OSDDrv_IoCtl((HANDLE)osd_dev, OSD_IO_SET_TRANS_COLOR, OSD_TRANSPARENT_COLOR); OSDDrv_CreateRegion((HANDLE)osd_dev, 0, &(osdrect), NULL); OSDDrv_ShowOnOff((HANDLE)osd_dev,OSDDRV_ON); return &scrdev; }
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; }