⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mosaic_ui.c

📁 c语言编的
💻 C
📖 第 1 页 / 共 5 页
字号:
		picture_id = tag_page_node->page_data->possible_background_type.picture_tag.possible_protocol_type.private_data.picture_id;	
		APP_TRACE("\ncurrent picture id is[%d]",picture_id);
		error = si_cache_request_picture_table(picture_id,
											   &table,
											   &size,
											   &picture_format,
											   10000);
		
		if(error != SUCCESS)
		{
			APP_TRACE("\n### request picture error is [%d]",error);
		}
		else
		{
			if((tag_cell_node->cell_data->activation_mask & 0x02) == 0x02)
			{
				if(tag_cell_node->cell_data->link_audio_data.remote_flag == 1)
				{
					mosaic_table_service.transport_stream_id = tag_cell_node->cell_data->link_audio_data.ts_id;
					mosaic_table_service.service_id = tag_cell_node->cell_data->link_audio_data.service_id;
				}
				if(tag_cell_node->cell_data->link_audio_data.remote_flag == 2)
				{
					mosaic_table_service.service_id = tag_cell_node->cell_data->link_audio_data.service_id;
				}
				
				ss_connect_service(&mosaic_table_service);
			}
			else
				ss_connect_service(&mosaic_table_service);
			
			wait_time = time_plus(time_now(), ST_GetClocksPerSecond()*5);
			error = semaphore_wait_timeout(connect_ok, &wait_time);
			
			if(error == SUCCESS)
			{
				ms_pmt_flag = TRUE;
				APP_TRACE("component added\n");
				
				/* add component */
				component.component_type = SS_BACKGROUND_COMPONENT;
				component.data.background.address = table;
				component.data.background.size = size;
				ss_add_component(&mosaic_table_service, &component);
				si_cache_release_table(table);
			}
			else
			{
				ms_pmt_flag = FALSE;
				APP_TRACE("wait picture timeout\n");
				
				load_iframe(table, size);
				si_cache_release_table(table);
			}
		}
	}
	/* the target page background is a video service */	
	if(tag_page_node -> page_data -> background_type ==0x02)
	{
		/*the target page is in other ts*/
		if(tag_page_node->page_data->possible_background_type.service_tag.remote_flag == 1)
		{
			service.network_index = db_get_current_network_index();
			service.original_network_id = tag_page_node->page_data->possible_background_type.service_tag.on_id;
			service.transport_stream_id = tag_page_node->page_data->possible_background_type.service_tag.ts_id;
			service.service_id = tag_page_node->page_data->possible_background_type.service_tag.service_id;
		}
		else
		{
			service.network_index = db_get_current_network_index();
			service.original_network_id = ms_network_data.on_id/*0x4080*/;
			service.transport_stream_id = ms_network_data.ts_id/*0xa*/;
			service.service_id = tag_page_node->page_data->possible_background_type.service_tag.service_id;
		}
		
		ss_connect_service(&service);
		
		wait_time = time_plus(time_now(), ST_GetClocksPerSecond()*5);
		error = semaphore_wait_timeout(connect_ok, &wait_time);
		if(error == SUCCESS)
		{
			APP_TRACE("connected\n");
			
			component.component_type = SS_STREAM_COMPONENT;
			component.data.stream.stream_type = MP2_VIDEO_STREAM;
			component.data.stream.elementary_pid = mosaic_get_component_pid(mosaic_pmt, 
				tag_page_node->page_data->possible_background_type.service_tag.component_tag);
			
			if(component.data.stream.elementary_pid == 8191)
			{
				if(tag_page_node->page_data->page_id == 11)
					component.data.stream.elementary_pid = 4510;
			}
			ss_add_component(&service, &component);
		}
		else
		{
			uint16_t original_network_id;
		    uint16_t transport_stream_id;
		    uint16_t service_id;
			
		    uint16_t video_pid;
		    uint16_t audio_pid;
		    uint16_t pcr_pid;
			
			original_network_id = service.original_network_id;
			transport_stream_id = service.transport_stream_id;
			service_id = service.service_id;
			
			error = db_query_mosaic_service_pids_ex(&ms_list,
													original_network_id, transport_stream_id, service_id, 
													tag_page_node->page_data->possible_background_type.service_tag.component_tag,
													&video_pid, &audio_pid, &pcr_pid);
			
			install_video_pid(video_pid);
			video_start();
		}
	}
	
	/*ui_clear_full_area();*/
	mosaic_ui_clear_screen();
	
	/*check and mask the limited cell*/
	error = mosaic_check_page_mask(tag_page_node);
	if(error != SUCCESS)
	{
		APP_TRACE("\n ***can not check the mask success### \n");
	}
	
	/* display the info in every area */
	error = ms_display_current_page_info(tag_page_node);
	
	/* display all text in every area */
	error = ms_multi_texts_list_dis(tag_page_node);	
	
	return SUCCESS;
}

error_t ms_cell_nav(cell_data_t *current_active_cell_info, 
                  	uint8_t tag_page_id, 
                  	uint8_t tag_cell_id,
                    cell_data_t **new_active_cell_info)
{
	cell_data_t *pre_cell_data;
	cell_node_ident_t cell_node_identify;
	page_node_ident_t page_node_identify;
	cell_node_t *tag_cell_node;
	page_node_t *tag_page_node;
	error_t error;
	
	if(mosaic_tree_data_t == NULL)
	{
		return FALSE;
    }
	
	cell_node_identify.page_id = current_active_cell_info->page_id;
	cell_node_identify.cell_id = current_active_cell_info->cell_id;
	pre_cell_data = current_active_cell_info;
		
	if(current_active_cell_info->page_id != tag_page_id)
	{	
		/*APP_TRACE("target page id !!== current page id\n");*/
		/*delete the focus on the current cell*/
		ms_delete_focus(current_active_cell_info->x, current_active_cell_info->y,
           			    current_active_cell_info->w, current_active_cell_info->h);
        
        error = ms_del_cell_audio(current_active_cell_info);
        
		page_node_identify.page_id = tag_page_id;					
		error = mosaic_find_page_node(mosaic_tree_data_t,
                   					  page_node_identify,
                                      &tag_page_node);
		
		cell_node_identify.page_id = tag_page_id;
		cell_node_identify.cell_id = tag_cell_id;
		mosaic_find_cell_node(mosaic_tree_data_t,
    		               	  cell_node_identify,
            		          &tag_cell_node);
        
        /* turn the new page */
		error = ms_enter_new_page(tag_page_node, tag_cell_node);
		    		          
        current_active_cell_info = tag_cell_node->cell_data;        
        /*play the audio of current cell*/
        error = ms_play_cell_audio(current_active_cell_info);
        /* display the service name of the current cell on the screen "not complete"*/
        error = ms_display_current_cell_info(current_active_cell_info);
                          	                  			                                                                                                            
        /*focus the new cell*/
        ms_draw_focus(current_active_cell_info->x, current_active_cell_info->y,
        			 current_active_cell_info->w, current_active_cell_info->h); 
        			                   	                  			                                                                                                            
	}
	else
	{
		/*APP_TRACE("target page id = current page id\n");*/
		
		ms_delete_focus(current_active_cell_info->x, current_active_cell_info->y,
        			   current_active_cell_info->w, current_active_cell_info->h);
        			   
        error = ms_del_cell_audio_ex(pre_cell_data, current_active_cell_info);
        			   
		cell_node_identify.page_id = tag_page_id;
		cell_node_identify.cell_id = tag_cell_id;
		mosaic_find_cell_node(mosaic_tree_data_t,
    		               	  cell_node_identify,
            		          &tag_cell_node);
         
        current_active_cell_info = tag_cell_node->cell_data;
        			 
        /*play the audio of current cell*/
        error = ms_play_cell_audio_ex(pre_cell_data, current_active_cell_info);
        /* display the service name of the current cell on the screen "not complete"*/
        error = ms_display_current_cell_info(current_active_cell_info);                 			                     	                    			                     
        
        ms_draw_focus(current_active_cell_info->x, current_active_cell_info->y,
          			  current_active_cell_info->w, current_active_cell_info->h);
        			 
	}
	(*new_active_cell_info) = current_active_cell_info;
	return SUCCESS;
}		    	

error_t ms_cell_nav_link(cell_data_t *current_active_cell_info, 
		      			 uint8_t tag_page_id, 
		      			 uint8_t tag_cell_id,	
		      			 uint8_t vk_tag,
		        		 cell_data_t **new_active_cell_info)
{
	cell_node_ident_t cell_node_identify;
	page_node_ident_t page_node_identify;
	cell_node_t *tag_cell_node;
	page_node_t *tag_page_node;
	error_t error;
	uint8_t i;
	
	if(mosaic_tree_data_t == NULL)
	{
		return 3;/* FALSE==0,so here use 3 */
    }
	
	error = mosaic_check_cell_status(current_active_cell_info);
	if((error != SUCCESS)&&(vk_tag == VK_OK)&&(error != ERROR_MOSAIC_LOCKED_CELL))
		return error;
	
	cell_node_identify.page_id = current_active_cell_info->page_id;
	cell_node_identify.cell_id = current_active_cell_info->cell_id;
			
	for(i=0;i<5;i++)
	{
		if((current_active_cell_info->nav_data.nav_link_data[i].possible_key_code == 606)&&( vk_tag == VK_RETURN ))
			break;
		if((current_active_cell_info->nav_data.nav_link_data[i].possible_key_code == 610)&&( vk_tag == VK_PROGRAM_NEXT ))
			break;
		if((current_active_cell_info->nav_data.nav_link_data[i].possible_key_code == 611)&&( vk_tag == VK_PROGRAM_PREV ))
			break;
		if((current_active_cell_info->nav_data.nav_link_data[i].possible_key_code == 604)&&( vk_tag == VK_OK ))
			break;					
	}
	if((current_active_cell_info->nav_data.nav_link_data[i].possible_key_code == 606)||
	   (current_active_cell_info->nav_data.nav_link_data[i].possible_key_code == 610)||
	   (current_active_cell_info->nav_data.nav_link_data[i].possible_key_code == 611)||
	   (current_active_cell_info->nav_data.nav_link_data[i].possible_key_code == 604))
	{
		if(current_active_cell_info->page_id != current_active_cell_info->nav_data.nav_link_data[i].tag_page_id)
		{
			ms_delete_focus(current_active_cell_info->x, current_active_cell_info->y,
        			   current_active_cell_info->w, current_active_cell_info->h);
        			   
        	error = ms_del_cell_audio(current_active_cell_info);
        			   
			page_node_identify.page_id = current_active_cell_info->nav_data.nav_link_data[i].tag_page_id;					
			error = mosaic_find_page_node(mosaic_tree_data_t,
            	       					  page_node_identify,
                	                      &tag_page_node);
                                                    
			cell_node_identify.page_id = current_active_cell_info->nav_data.nav_link_data[i].tag_page_id;
			cell_node_identify.cell_id = current_active_cell_info->nav_data.nav_link_data[i].tag_cell_id;
			mosaic_find_cell_node(mosaic_tree_data_t,
    			               	  cell_node_identify,
            			          &tag_cell_node);
           	
           	/*turn the new page */	      
			error = ms_enter_new_page(tag_page_node, tag_cell_node);
           	
        	current_active_cell_info = tag_cell_node->cell_data;
        	
        	/*play the audio of current cell*/
        	error = ms_play_cell_audio(current_active_cell_info);
        	
        	/* display the service name of the current cell on the screen "not complete"*/
            error = ms_display_current_cell_info(current_active_cell_info);
            
        	/*focus the current cell*/
        	ms_draw_focus(current_active_cell_info->x, current_active_cell_info->y,
        				 current_active_cell_info->w, current_active_cell_info->h);
		}
		else
		{
			ms_delete_focus(current_active_cell_info->x, current_active_cell_info->y,
        			   current_active_cell_info->w, current_active_cell_info->h);
        	
        	error = ms_del_cell_audio(current_active_cell_info);
        	
			cell_node_identify.page_id = current_active_cell_info->nav_data.nav_link_data[i].tag_page_id;
			cell_node_identify.cell_id = current_active_cell_info->nav_data.nav_link_data[i].tag_cell_id;
			mosaic_find_cell_node(mosaic_tree_data_t,
    			               	  cell_node_identify,
        	    		          &tag_cell_node);
        	    		          
        	current_active_cell_info = tag_cell_node->cell_data;
        	
        	/*play the audio of current cell*/
        	error = ms_play_cell_audio(current_active_cell_info);
        	
        	/* display the service name of the current cell on the screen "not complete"*/
        	error = ms_display_current_cell_info(current_active_cell_info);	
        	
        	ms_draw_focus(current_active_cell_info->x, current_active_cell_info->y,
        				 current_active_cell_info->w, current_active_cell_info->h);
        	
		}
		(*new_active_cell_info) = current_active_cell_info;
		return 1;	
	}	
	else
	{	
		APP_TRACE("this cell has no cell navigation link\n");
		(*new_active_cell_info) = current_active_cell_info;
		return 0;		
	}
}


error_t ms_enter_cell_possible_link(cell_data_t *current_active_cell_info)
{
	uint16_t on_id;
	uint16_t ts_id;
	uint16_t service_id;
	char buffer[64];
	uint16_t network_index;
	uint16_t app_id;
	uint32_t org_id;
	uint8_t service_type;
	error_t error;		
	app_message_t message;
	ait_t ait_info;
	db_service_t db_service;
	int32_t message_box_id;
	
	
	if((current_active_cell_info->activation_mask & 0x01) != 0x01)
		return -1;
	
	error = mosaic_check_cell_status(current_active_cell_info);
	if(error != SUCCESS)
	{
		if(error == ERROR_MOSAIC_LOCKED_CELL)
		{
			while( true )
			{
				error = ms_locked_window();
				if( error == ERROR_DTV_PROG_UNLOCKED )
				{
					/*ms_add_fake_component(current_active_cell_info);*/
					break;
				}
				else if( error == ERROR_DTV_ERROR_PASSWARD )
				{
					message_box_id = ms_locked_message();
					if( message_box_id == UI_IDCANCEL )
						continue;
					else
						return ERROR_DTV_PROG_LOCKED;
				}
				else if(error == ERROR_DTV_PROG_LOCKED)
					return error;
				else
					break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -