Exemplo n.º 1
0
void cti_chnchg_function()
{
	UINT16 chn_idx=0xffff;
	date_time local_time;
	CTI_CHN_CHG_CONTENT chnchg_data;
	UINT8 save;
	BOOL need_change = TRUE,info_changed = FALSE;
	win_popup_choice_t sel;
	UINT16 string[CHANNEL_JUMP_STR_LEN_MAX/2+1];

	INT sec = 0;
	if(pre_channel_index!=sys_data_get_cur_group_cur_mode_channel())//换台了
	{
		cti_chnchg_para_reset();
	}

	if(!get_cti_chnchg_flg())
	{
		return;
	}

	MEMSET(&local_time,0,sizeof(date_time));
	get_local_time(&local_time);

	MEMSET(&chnchg_data,0,sizeof(CTI_CHN_CHG_CONTENT));
	get_cti_chnchg_data(&chnchg_data);

	//显示内容有没有变化
	if(MEMCMP(pre_info,chnchg_data.pString,sizeof(chnchg_data.pString))==0)
	{
		info_changed = FALSE;
	}
	else
	{
		info_changed = TRUE;
	}

	chn_idx=GetPlayChannelID(chnchg_data.bType,chnchg_data.wPart1,
							chnchg_data.wPart2,chnchg_data.wPart3,chnchg_data.wPart4);

	if((chnchg_data.bStatus==0)
		||(chnchg_data.bStatus==2))//立即跳转
	{
		set_cti_chnchg_flg(FALSE);
	}
	else//时间跳转
	{
		if(api_compare_day_time_ext(&(chnchg_data.stStartTime),&local_time)>=0)	//跳转时间没有到
		{
			need_change = FALSE;
		}
		else if(api_compare_day_time_ext(&(chnchg_data.stEndTime),&local_time)>=0)	//正常跳转
		{
			sec = cti_mktime(&(chnchg_data.stEndTime),&local_time);
		}
		else//控制时间已过
		{
			need_change = FALSE;
			set_cti_chnchg_flg(FALSE);
			return;
		}
	}

	if((chn_idx!=0xffff)
		&&(chn_idx!=sys_data_get_cur_group_cur_mode_channel())
		&&need_change)
	{

		if(chnchg_data.bStatus==0)//强制立即跳转
		{
			BackToFullScrPlay();
			win_compopup_init ( WIN_POPUP_TYPE_SMSG );
			win_compopup_set_frame ( 100, 140, 400, 120);
			//win_compopup_set_frame(100, 180, 400, 80);
			win_compopup_set_msg_ext(NULL,NULL, RS_CTI_CHANNEL_JUMP);
			win_compopup_open_ext ( &save );
			osal_task_sleep(3000);
			win_compopup_close();
		}
		else if(chnchg_data.bStatus==1)//强制时间跳转
		{
			if(!info_showed)
			{
				BackToFullScrPlay();
				win_compopup_init ( WIN_POPUP_TYPE_SMSG );
				win_compopup_set_frame ( 100, 140, 400, 120);
				//win_compopup_set_frame(100, 180, 400, 80);
				win_compopup_set_msg_ext(NULL,NULL, RS_CTI_CHANNEL_JUMP);
				win_compopup_open_ext ( &save );
				osal_task_sleep(3000);
				win_compopup_close();
				info_showed = TRUE;
			}
		}
		else if(chnchg_data.bStatus==2)//用户选择立即跳转
		{
			if((sys_data_get_cur_group_cur_mode_channel()==chn_idx_sel_no)
				&&(!info_changed))
			{
				return;
			}
			else
			{
				BackToFullScrPlay();

				MEMSET(string,0,sizeof(string));
				MEMSET(pre_info,0,sizeof(pre_info));
#ifdef GB2312_SUPPORT
				convert_gb2312_to_unicode(chnchg_data.pString, 
				sizeof(chnchg_data.pString),string, CHANNEL_JUMP_STR_LEN_MAX/2);
#else
				dvb_to_unicode(chnchg_data.pString, 
				sizeof(chnchg_data.pString),string, CHANNEL_JUMP_STR_LEN_MAX/2, 0);
#endif
				MEMCPY(pre_info,chnchg_data.pString,sizeof(chnchg_data.pString));
				win_compopup_init ( WIN_POPUP_TYPE_OKNO);				
				//win_compopup_set_frame ( 100, 120, 400, 160);
				win_compopup_set_frame ( 100, 100, 400, 160);
				win_compopup_set_msg_ext(NULL, string, 0);
				win_compopup_set_default_choice(WIN_POP_CHOICE_YES);
				sel = win_compopup_open_ext_timeout(&save, 5);
				if (sel == WIN_POP_CHOICE_NO)
				{
					chn_idx_sel_no = sys_data_get_cur_group_cur_mode_channel();
					return;//do not change
				}	
				//choice yes,so change channel
			}
		}
		else if(chnchg_data.bStatus==3)//用户选择按时间跳转
		{
			if((!info_showed)||info_changed)//没有显示过或者字符变化了
			{
				BackToFullScrPlay();

				MEMSET(string,0,sizeof(string));
				MEMSET(pre_info,0,sizeof(pre_info));
#ifdef GB2312_SUPPORT				
				convert_gb2312_to_unicode(chnchg_data.pString, 
				sizeof(chnchg_data.pString),string, CHANNEL_JUMP_STR_LEN_MAX/2);
#else
				dvb_to_unicode(chnchg_data.pString, 
				sizeof(chnchg_data.pString),string, CHANNEL_JUMP_STR_LEN_MAX/2, 0);
#endif
				MEMCPY(pre_info,chnchg_data.pString,sizeof(chnchg_data.pString));
				win_compopup_init ( WIN_POPUP_TYPE_OKNO);
				win_compopup_set_frame ( 100, 100, 400, 160);
				win_compopup_set_msg_ext(NULL, string, 0);
				win_compopup_set_default_choice(WIN_POP_CHOICE_YES);
				sel = win_compopup_open_ext_timeout(&save, sec);
				choiced_yes = FALSE;
				info_showed = TRUE;
				if ((sel == WIN_POP_CHOICE_NO) || (sel == WIN_POP_CHOICE_TIMEOUT))
				{
					return;//do not change
				}	
				choiced_yes = TRUE;
			}
			else if(choiced_yes==TRUE)//用户选择yes,则继续判断是否需要跳转
			{

			}
			else
			{
				return;//提示过,不再提醒,也不换台
			}

		}

		api_play_channel(chn_idx, TRUE, TRUE, FALSE);
	}
}
Exemplo n.º 2
0
static PRESULT  hdmi_factest_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	struct hdmi_device *hdmi_dev = (struct hdmi_device *)dev_get_by_type(NULL,HLD_DEV_TYPE_HDMI);	
	PRESULT ret = PROC_PASS;
	UINT8 bID;
	POBJECT_HEAD nxtObj;
    POBJECT_HEAD topmenu;
	bID = OSD_GetObjID(pObj);
	extern sys_state_t      system_state; 
	UINT8 buf[512];
	UINT32 v_key, i;
	FILE *fp;
	MULTISEL *pMsel;
	static BOOL log_edid_info = FALSE, log_dbg_info = FALSE,  ignore_hotplug = FALSE;

	switch(event)
	{
    case EVN_PRE_OPEN:
        
        //ap_enable_key_task_get_key(TRUE);
		//key_set_upgrade_check_flag(0);
		last_system_state = system_state;
        //system_state = SYS_STATE_UPGRAGE_HOST;
		memset(hdmi_info_name_str,0x00,sizeof(hdmi_info_name_str));
        memset(hdmi_info1_str,0x00,sizeof(hdmi_info1_str));
        memset(hdmi_info2_str,0x00,sizeof(hdmi_info2_str));
        memset(hdmi_info3_str,0x00,sizeof(hdmi_info3_str));
        memset(hdmi_info4_str,0x00,sizeof(hdmi_info4_str));		
        wincom_close_title();
		if(menu_stack_get(0) == (POBJECT_HEAD)&g_win_mainmenu)
		{
			OSD_ClearObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL);
			topmenu = menu_stack_get_top();
			if(topmenu)
				OSD_ClearObject( topmenu, C_UPDATE_ALL);
		}
        break;
    case EVN_POST_OPEN:
	    hdmi_dev->io_control(hdmi_dev,HDMI_CMD_REG_CALLBACK, HDMI_CB_DBG_MSG, (UINT32)hdmi_debug_message_callback);        
        hdmi_display_info_set();
        break;
    case EVN_POST_CLOSE:
        if(menu_stack_get(0) == (POBJECT_HEAD)&g_win_mainmenu)
		    OSD_TrackObject( (POBJECT_HEAD) &g_win_mainmenu, C_UPDATE_ALL);	
        system_state = last_system_state;
        break;
	case EVN_UNKNOWN_ACTION:
		break;
	case EVN_UNKNOWNKEY_GOT:
		ap_hk_to_vk(0, param1, &v_key); 
		switch(v_key)
		{		
			case V_KEY_RED: 	// Red Button : Log EDID Information //old IR Red key is 65
				if(log_edid_info == FALSE)
				{
					log_edid_info = TRUE;						
					
					// Check log file exist or not, if exist delete it.
					edid_log_file= fs_open("/c/hdmi_edid_log.txt", O_RDONLY, 0666);
//						if(edid_log_file >= 0)	 /*always is true ,clean the warning */
					{
						fs_close(edid_log_file);
						fs_remove("/c/hdmi_edid_log.txt");
					}

						edid_log_file = fs_open("/c/hdmi_edid_log.txt", O_RDWR | O_CREAT, S_IFREG | S_IRWXU);							
					hdmi_log_edid_start();						
					win_com_popup_open(WIN_POPUP_TYPE_SMSG,"Start to Log EDID Information", 0); 												
				}
				else
				{
					log_edid_info = FALSE;	
					fs_close( edid_log_file );
					fs_sync("/c/"); 		
					hdmi_log_edid_stop();
					win_com_popup_open(WIN_POPUP_TYPE_SMSG,"Stop to Log EDID Information", 0);					
				}
				osal_task_sleep(2000);
				win_compopup_close();					
				hdmi_display_info_set();
				break;	
			case V_KEY_GREEN:		// Green Button : Log debug Information
				if(log_dbg_info == FALSE)
				{
					log_dbg_info = TRUE;						
					
					// Check log file exist or not, if exist delete it.
					debug_log_file= fs_open("/c/hdmi_debug_log.txt", O_RDONLY, 0666);
//						if(debug_log_file >= 0) 	/*always is true ,clean the warning */
					{
						fs_close(debug_log_file);
						fs_remove("/c/hdmi_debug_log.txt");
					}

						debug_log_file = fs_open("/c/hdmi_debug_log.txt", O_RDWR | O_CREAT, S_IFREG | S_IRWXU); 						
					hdmi_log_debug_start(); 					
					win_com_popup_open(WIN_POPUP_TYPE_SMSG,"Start to Log Debug Information", 0);													
				}
				else
				{
					log_dbg_info = FALSE;	
					fs_close( debug_log_file );
					fs_sync("/c/"); 					
					hdmi_log_debug_stop();
					win_com_popup_open(WIN_POPUP_TYPE_SMSG,"Stop to Log Debug Information", 0); 				
				}
				osal_task_sleep(2000);
				win_compopup_close();					
				hdmi_display_info_set();				
				break;
			case V_KEY_YELLOW:		// Yellow Button : Switch on/off HDCP
				if(api_get_hdmi_hdcp_onoff() == TRUE)
				{
					api_set_hdmi_hdcp_onoff(FALSE);
					win_com_popup_open(WIN_POPUP_TYPE_SMSG,"Turn HDCP Off", 0); 
				}
				else
				{
					api_set_hdmi_hdcp_onoff(TRUE);
					win_com_popup_open(WIN_POPUP_TYPE_SMSG,"Turn HDCP On", 0);						
				}										
				osal_task_sleep(2000);
				win_compopup_close();					
				hdmi_display_info_set();						
				break;	
				
			default:
				break;
		}			

	    break;
	}

	return ret;		
}
Exemplo n.º 3
0
static PRESULT subtitle_con_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	SYSTEM_DATA * sys;
	struct nim_device* nim_dev;	
	UINT8 i,lock;
	UINT8 unact;
	
	if(cur_tuner_idx == 0)
		nim_dev = g_nim_dev;
	else
		nim_dev = g_nim_dev2;
    	nim_get_lock(nim_dev,&lock);

	switch(event)
	{
	case EVN_PRE_OPEN:
        api_set_deo_layer(0);
        api_inc_wnd_count();

		for(i=0;i<SUBTITLE_ITEM_NUMBER;i++)
		{
			p_subtitle_track_str[i]=Subtitle_track_str[i];
			p_subtitle_track_idx[i]=Subtitle_track_idx[i];
		}
		win_subtitle_init_data();
		if(((0 == g_win_subtitle_count ) && (0 == g_win_ttx_subtitle_count)) || (!lock))
#if (DVR_PVR_SUPPORT_SUBTITLE)//temp disable
		if(((0 == g_win_subtitle_count ) && (0 == g_win_ttx_subtitle_count)) 
#ifdef DVR_PVR_SUPPORT
			|| ((!lock) && !api_pvr_is_playing())
#else
			|| (!lock)
#endif
			)
#endif
		{
			win_com_popup_open(WIN_POPUP_TYPE_SMSG,NULL, RS_DISPLAY_NO_DATA);			
			osal_task_sleep(1000);
			win_compopup_close();
            api_dec_wnd_count();
			return PROC_LEAVE;
		}
		break;		
	case EVN_UNKNOWN_ACTION:
		unact = (VACTION)(param1>>16);
		if(VACT_ENTER == unact)
		{
			UINT16	cur_sel = OSD_GetListCurPoint(&g_ls_subtitle);
			sys = sys_data_get();
			if(g_win_subtitle_count + g_win_ttx_subtitle_count==cur_sel)
			{
				sys->osd_set.subtitle_display = 0;/*select off option*/
				sys->osd_set.subtitle_lang = 0xFF;
			}
			else if(cur_sel < g_win_ttx_subtitle_count)
			{
				sys->osd_set.subtitle_display = 1;/*subtitle on*/
				sys->osd_set.subtitle_lang = cur_sel;/*set_sub_lang_idx is used in api_osd_mode_change function*/
			}
			else if(cur_sel < g_win_subtitle_count + g_win_ttx_subtitle_count)
			{/*ttx_subtitle on the top then normal subtitle*/
				sys->osd_set.subtitle_display = 1;
				sys->osd_set.subtitle_lang = cur_sel;/*set_sub_lang_idx is used in api_osd_mode_change function*/
			}
			ret = PROC_LEAVE;
			api_osd_mode_change(OSD_NO_SHOW);
			//api_osd_mode_change(OSD_SUBTITLE);
		}
		break;
	case EVN_PRE_CLOSE:
		unact = (VACTION)(param1>>16);
		ret = PROC_PASS;
        break;

	case EVN_POST_CLOSE:
        api_set_deo_layer(1);
        api_dec_wnd_count();
        break;
	default:
		break;
	}

	return ret;
}
Exemplo n.º 4
0
static PRESULT subtitle_con_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2)
{
	PRESULT ret = PROC_PASS;
	SYSTEM_DATA * sys;
	struct nim_device* nim_dev;	
	UINT8 i,lock;
	UINT8 unact;
	
	if(cur_tuner_idx == 0)
		nim_dev = g_nim_dev;
	else
		nim_dev = g_nim_dev2;
    	nim_get_lock(nim_dev,&lock);

	switch(event)
	{
	case EVN_PRE_OPEN:
        #ifdef SUPPORT_CAS9
			if(0==get_mmi_showed())
				ShowSignalStatusOSDOnOff(0);
        #endif
        api_set_deo_layer(0);
        api_inc_wnd_count();

		for(i=0;i<SUBTITLE_ITEM_NUMBER;i++)
		{
			p_subtitle_track_str[i]=Subtitle_track_str[i];
			p_subtitle_track_idx[i]=Subtitle_track_idx[i];
		}

		if(system_state != SYS_STATE_USB_MP)//vic100507#1	
		{
			win_subtitle_init_data();
			if(((0 == g_win_subtitle_count ) && (0 == g_win_ttx_subtitle_count)) || (!lock))
			#if (DVR_PVR_SUPPORT_SUBTITLE)//temp disable
			if(((0 == g_win_subtitle_count ) && (0 == g_win_ttx_subtitle_count)) 
			#ifdef DVR_PVR_SUPPORT
				|| ((!lock) && !api_pvr_is_playing())
			#else
				|| (!lock)
			#endif
				)
			#endif
			{
				win_com_popup_open(WIN_POPUP_TYPE_SMSG,NULL, RS_DISPLAY_NO_DATA);			
				osal_task_sleep(1000);
				win_compopup_close();
	            api_dec_wnd_count();
				return PROC_LEAVE;
			}
		}
		else
		{
		#ifdef MP_SUBTITLE_SUPPORT	//vic100507#1			
			//TODO:
			//such like win_subtitle_init_data
			long resut;
			resut = win_mp_subtitle_init_data();
			if (resut < 0)
			{						
				return PROC_LEAVE;				
			}
			
		#endif				
		}
		break;		
	case EVN_UNKNOWN_ACTION:
		unact = (VACTION)(param1>>16);

		if(system_state != SYS_STATE_USB_MP)//vic100507#1 
		{

			if(VACT_ENTER == unact)
			{
				UINT16	cur_sel = OSD_GetListCurPoint(&g_ls_subtitle);
				sys = sys_data_get();
				if(g_win_subtitle_count + g_win_ttx_subtitle_count==cur_sel)
				{
					sys->osd_set.subtitle_display = 0;/*select off option*/
					sys->osd_set.subtitle_lang = 0xFF;
				}
				else if(cur_sel < g_win_ttx_subtitle_count)
				{
					sys->osd_set.subtitle_display = 1;/*subtitle on*/
					sys->osd_set.subtitle_lang = cur_sel;/*set_sub_lang_idx is used in api_osd_mode_change function*/
				}
				else if(cur_sel < g_win_subtitle_count + g_win_ttx_subtitle_count)
				{/*ttx_subtitle on the top then normal subtitle*/
					sys->osd_set.subtitle_display = 1;
					sys->osd_set.subtitle_lang = cur_sel;/*set_sub_lang_idx is used in api_osd_mode_change function*/
				}
				ret = PROC_LEAVE;
				api_osd_mode_change(OSD_NO_SHOW);
				//api_osd_mode_change(OSD_SUBTITLE);
			}
		}
		else if(VACT_ENTER == unact)
		{
		//vic100507#1 begin
		#ifdef MP_SUBTITLE_SUPPORT	
			//TODO:
			//select language index
			if (!subtitle_handle)
			{
				return PROC_LEAVE;
			}
			long resut;
			UINT16	cur_sel = OSD_GetListCurPoint(&g_ls_subtitle);

			if(g_ext_subtitle_plugin)
				g_ext_subtitle_plugin->mps_change_language(subtitle_handle,cur_sel);
			
			OSD_ObjClose(pObj,C_CLOSE_CLRBACK_FLG);
			//if (resut < 0)
			{
				return PROC_LEAVE;
			}			
		#endif					
		//vic100507#1 end
		}
		break;
	case EVN_PRE_CLOSE:
		unact = (VACTION)(param1>>16);
		ret = PROC_PASS;
        break;

	case EVN_POST_CLOSE:
        #ifdef SUPPORT_CAS9
            restore_ca_msg_when_exit_win();
        #endif
        api_set_deo_layer(1);
        api_dec_wnd_count();
        break;
	default:
		break;
	}

	return ret;
}