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

📄 mosaic_ui.c

📁 c语言编的
💻 C
📖 第 1 页 / 共 5 页
字号:
	}
	
	return SUCCESS;
}


error_t ms_delete_focus(int16_t x, int16_t y, int16_t w, int16_t h)
{
	error_t error;
	uint8_t focus_type,corner_type;
	int16_t i;
		
	y -= ADJUST_POSITIONY;/*adjust the focus position*/
    
	focus_type = mosaic_node_data->focus_data.focus_type;
	corner_type = mosaic_node_data->focus_data.corner_type;
	if(focus_type == 0x01)/*solid rectangle*/
	{
		if(corner_type == 0x01)/*square*/
		{
			ui_draw_panel(hitune_ui_draw_get_context(), x, y, w, h, UI_PANEL_RECTANGLE, ui_transparency_color.Value.PaletteEntry);
	  	}
	    if(corner_type == 0x02)/*round*/
	    {   
	    	w = 2*w/(h-2);
	    	
			hitune_ui_draw_filled_circle(hitune_ui_draw_get_context(), x + w, y + h/4, h/4 - 1, ui_transparency_color.Value.PaletteEntry);
			ui_draw_panel(hitune_ui_draw_get_context(), x + w, y + h/4 - 1, h/4 - 1, h/2 + 2, UI_PANEL_RECTANGLE, ui_transparency_color.Value.PaletteEntry);
			hitune_ui_draw_filled_circle(hitune_ui_draw_get_context(), x + w, y + h*3/4, h/4 - 1, ui_transparency_color.Value.PaletteEntry);						    		   									 
			hitune_ui_draw_filled_circle(hitune_ui_draw_get_context(), x, y + h*3/4, h/4 - 1, ui_transparency_color.Value.PaletteEntry);
			ui_draw_panel(hitune_ui_draw_get_context(), x - h/4, y + h/4, h/4 - 1, h/2, UI_PANEL_RECTANGLE, ui_transparency_color.Value.PaletteEntry);
			hitune_ui_draw_filled_circle(hitune_ui_draw_get_context(), x, y + h/4, h/4 - 1, ui_transparency_color.Value.PaletteEntry);
			ui_draw_panel(hitune_ui_draw_get_context(), x, y, w, h, UI_PANEL_RECTANGLE, ui_transparency_color.Value.PaletteEntry);
		}
	}
	else if(focus_type == 0x02)/*frame*/
	{
		if(corner_type == 0x01)
		{			
			/*display the save background*/
			i = mosaic_node_data->focus_data.focus_thickness;
			
			if(ms_focus_background_p != NULL)
			{
				hitune_ui_recover_background(ms_focus_background_p, x-i, y-i-2);
			}
		}
		else if(corner_type == 0x02)
		{
			w = 2*w/(h-2);
								
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x + w, y + h/4, h/4 - 1, ui_transparency_color.Value.PaletteEntry, 1); 
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x + w, y + h/4 - 1, h/4 - 1, h/2 + 2, ui_transparency_color);	
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x + w, y + h*3/4, h/4 - 1, ui_transparency_color.Value.PaletteEntry, 1); 
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x, y + h*3/4, h/4 - 1, ui_transparency_color.Value.PaletteEntry, 1); 
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x - h/4, y + h/4, h/4 - 1, h/2, ui_transparency_color); 
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x, y + h/4, h/4 - 1, ui_transparency_color.Value.PaletteEntry, 1);  
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x, y, w, h, ui_transparency_color);
			
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x + w, y + h/4, h/4, ui_transparency_color.Value.PaletteEntry, 1);  
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x + w-1, y + h/4 - 2, h/4 + 1, h/2 + 4, ui_transparency_color);	
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x + w, y + h*3/4, h/4, ui_transparency_color.Value.PaletteEntry, 1);  						    		   									 
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x, y + h*3/4, h/4, ui_transparency_color.Value.PaletteEntry, 1);  						    		   									 
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x - h/4-1, y + h/4-1, h/4 + 1, h/2+2, ui_transparency_color); 
			hitune_ui_draw_circle(hitune_ui_draw_get_context(), x, y + h/4, h/4, ui_transparency_color.Value.PaletteEntry, 1); 
			ms_HL_STOSD_DrawRectangle(hitune_ui_draw_get_context(), x-1, y-1, w+2, h+2, ui_transparency_color);
		}	
	}
	
	return SUCCESS; 			
}	


error_t ms_del_cell_audio(cell_data_t *current_active_cell_info)
{	
	page_node_t *tag_page_node;
	page_node_ident_t page_node_identify;
	error_t error;
	
	if((current_active_cell_info->activation_mask & 0x02) != 0x02)
		return -1;
 	
	APP_TRACE("current_active_cell_info->link_audio_data.remote_flag == [%d]***\n",
	           current_active_cell_info->link_audio_data.remote_flag);
    
    if(current_active_cell_info->link_audio_data.remote_flag == 0x00)
    {   
    	if(ms_pmt_flag == TRUE) 	
    	{
			if(ms_audio_component.component_type != SS_INVALID_COMPONENT)
				ss_delete_component(&ms_service, &ms_audio_component);
		}
		else
		{
			audio_stop();
			uninstall_audio_pid();
		}
    }	    
    if(current_active_cell_info->link_audio_data.remote_flag == 0x01)
    {
		if(ms_pmt_flag == TRUE) 	
    	{
			if(ms_audio_component.component_type != SS_INVALID_COMPONENT)
				ss_delete_component(&ms_service, &ms_audio_component);
		}
		else
		{
		audio_stop();
		uninstall_audio_pid();
    }	    
    }	    
   	if(current_active_cell_info->link_audio_data.remote_flag == 0x02) 
   	{   
   		/*current page is video background, now BGCTV 
   		  put the info in same service but also send 
   		  the service_id and the remote_flag is 0x02*/	   		 
   		page_node_identify.page_id = current_active_cell_info->page_id;
		error = mosaic_find_page_node(mosaic_tree_data_t,
	                                  page_node_identify,
	                                  &tag_page_node);    
   		
   		if((tag_page_node->page_data->background_type == 0x02)&&
   		  (tag_page_node->page_data->possible_background_type.service_tag.service_id == current_active_cell_info->link_audio_data.service_id))
   		{	   			
   			if(ms_pmt_flag == TRUE) 	
	    	{
				if(ms_audio_component.component_type != SS_INVALID_COMPONENT)
					ss_delete_component(&ms_service, &ms_audio_component);
			}
			else
			{
				audio_stop();
				uninstall_audio_pid();
			}
   		}
   		else
   		{
	   		ss_stop_running_service();
		}
		
   	}
   	return SUCCESS;
}

error_t ms_del_cell_audio_ex(cell_data_t *pre, cell_data_t *current_active_cell_info)
{	
	page_node_t *tag_page_node;
	page_node_ident_t page_node_identify;
	error_t error;
	
	if((current_active_cell_info->activation_mask & 0x02) != 0x02)
		return -1;
 	
	APP_TRACE("current_active_cell_info->link_audio_data.remote_flag == [%d]***\n",
	           current_active_cell_info->link_audio_data.remote_flag);
    
    if(current_active_cell_info->link_audio_data.remote_flag == 0x00)
    {   
    	if(ms_pmt_flag == TRUE) 	
    	{
			if(ms_audio_component.component_type != SS_INVALID_COMPONENT)
				ss_delete_component(&ms_service, &ms_audio_component);
		}
		else
		{
			audio_stop();
			uninstall_audio_pid();
		}
    }	    
    if(current_active_cell_info->link_audio_data.remote_flag == 0x01)
    {
		if(ms_pmt_flag == TRUE) 	
    	{
			if(ms_audio_component.component_type != SS_INVALID_COMPONENT)
				ss_delete_component(&ms_service, &ms_audio_component);
		}
		else
		{
			audio_stop();
			uninstall_audio_pid();
    	}	    
    }	    
   	if(current_active_cell_info->link_audio_data.remote_flag == 0x02) 
   	{   
   		/*current page is video background, now BGCTV 
   		  put the info in same service but also send 
   		  the service_id and the remote_flag is 0x02*/	   		 
   		page_node_identify.page_id = current_active_cell_info->page_id;
		error = mosaic_find_page_node(mosaic_tree_data_t,
	                                  page_node_identify,
	                                  &tag_page_node);    
   		
   		if((tag_page_node->page_data->background_type == 0x02)&&
   		  (tag_page_node->page_data->possible_background_type.service_tag.service_id == current_active_cell_info->link_audio_data.service_id))
   		{	   			
   			if(ms_pmt_flag == TRUE) 	
	    	{
				if(ms_audio_component.component_type != SS_INVALID_COMPONENT)
					ss_delete_component(&ms_service, &ms_audio_component);
			}
			else
			{
				audio_stop();
				uninstall_audio_pid();
			}
   		}
   		else if(pre->link_audio_data.service_id == current_active_cell_info->link_audio_data.service_id)
   		{
   			if(ms_pmt_flag == TRUE) 	
	    	{
				if(ms_audio_component.component_type != SS_INVALID_COMPONENT)
					ss_delete_component(&ms_service, &ms_audio_component);
			}
			else
			{
				audio_stop();
				uninstall_audio_pid();
			}
   		}
   		else
   		{
	   		ss_stop_running_service();
		}
		
   	}
   	return SUCCESS;
}		  

error_t ms_play_cell_audio(cell_data_t *current_active_cell_info)
{
	char buffer[64];
	page_node_t *tag_page_node;
	page_node_ident_t page_node_identify;
	error_t error;
	
	db_mosaic_service_t db_mosaic_service;
	
	if((current_active_cell_info->activation_mask & 0x02) != 0x02)
		return -1;
	
	error = mosaic_check_cell_status(current_active_cell_info);
	if(error != SUCCESS)
		return FAILURE;
				
	APP_TRACE("current_active_cell_info->link_audio_data.remote_flag == [%d]***\n",
	           current_active_cell_info->link_audio_data.remote_flag);   	
 	
	/* if now is the audio mosaic page, play the audio in an other way because the 
	 * audio of the cell is the true audio service 
	 */
	
    if(current_active_cell_info->link_audio_data.remote_flag == 0x00)
    {
    	ms_audio_component.component_type = SS_STREAM_COMPONENT;
	   	ms_audio_component.data.stream.stream_type = MP2_AUDIO_STREAM;
	   	
    	if(ms_pmt_flag == TRUE)
    	{
	   		ms_audio_component.data.stream.elementary_pid = mosaic_get_component_pid(mosaic_pmt, 
   		                            current_active_cell_info->link_audio_data.component_tag);
   		    ss_add_component(&ms_service, &ms_audio_component);
   		}
   		else
   		{
   			ms_audio_component.data.stream.elementary_pid = ms_get_pid(current_active_cell_info->link_audio_data.component_tag);
   			
   			install_audio_pid(ms_audio_component.data.stream.elementary_pid);
			audio_start();
   		}
    }
    
    if(current_active_cell_info->link_audio_data.remote_flag == 0x01)
    {
    	ms_audio_component.component_type = SS_STREAM_COMPONENT;
	   	ms_audio_component.data.stream.stream_type = MP2_AUDIO_STREAM;
	   	
    	if(ms_pmt_flag == TRUE)
    	{
	   		ms_audio_component.data.stream.elementary_pid = mosaic_get_component_pid(mosaic_pmt, 
   		                            current_active_cell_info->link_audio_data.component_tag);
   		    ss_add_component(&ms_service, &ms_audio_component);
   		}
   		else
   		{
   			ms_audio_component.data.stream.elementary_pid = ms_get_pid(current_active_cell_info->link_audio_data.component_tag);
   			
   			install_audio_pid(ms_audio_component.data.stream.elementary_pid);
			audio_start();
   		}
   		
    }        
    
   	if(current_active_cell_info->link_audio_data.remote_flag == 0x02) 
   	{
   		/*current page is video background, now BGCTV 
   		  put the info in same service but also send 
   		  the service_id and the remote_flag is 0x02*/
   		  
   		page_node_identify.page_id = current_active_cell_info->page_id;
		error = mosaic_find_page_node(mosaic_tree_data_t,
	                                  page_node_identify,
	                                  &tag_page_node);
   		
   		if((tag_page_node->page_data->background_type == 0x02)&&
   		  (tag_page_node->page_data->possible_background_type.service_tag.service_id == current_active_cell_info->link_audio_data.service_id))
   		{
   			ms_audio_component.component_type = SS_STREAM_COMPONENT;
		   	ms_audio_component.data.stream.stream_type = MP2_AUDIO_STREAM;
		   	
	    	if(ms_pmt_flag == TRUE)
	    	{
		   		ms_audio_component.data.stream.elementary_pid = mosaic_get_component_pid(mosaic_pmt, 
	   		                            current_active_cell_info->link_audio_data.component_tag);
	   		    
	   		    ss_add_component(&ms_service, &ms_audio_component);
	   		}
	   		else
	   		{
	   			ms_audio_component.data.stream.elementary_pid = ms_get_pid(current_active_cell_info->link_audio_data.component_tag);
	   			
	   			install_audio_pid(ms_audio_component.data.stream.elementary_pid);
				audio_start();
	   		}
   		}
   		else
   		{
   			error = db_query_mosaic_service_by_service_id(&ms_list,
														  &db_mosaic_service,
													 	  current_active_cell_info->link_audio_data.service_id);
			if(error == SUCCESS)
			{
				ms_audio_component.component_type = SS_STREAM_COMPONENT;
			   	ms_audio_component.data.stream.stream_type = MP2_AUDIO_STREAM;
			   	
		    	if(ms_pmt_flag == TRUE)
		    	{
			   		ms_audio_component.data.stream.elementary_pid = mosaic_get_component_pid(mosaic_pmt, 
		   		                            current_active_cell_info->link_audio_data.component_tag);
		   		    
		   		    ss_add_component(&ms_service, &ms_audio_component);
		   		}
		   		else
		   		{
		   			ms_audio_component.data.stream.elementary_pid = ms_get_pid(current_active_cell_info->link_audio_data.component_tag);
		   			
		   			install_audio_pid(ms_audio_component.data.stream.elementary_pid);
					audio_start();
		   		}
			}
			else
			{
		   		APP_TRACE("on_id=[%d], ts_id=[%d], service_id=[%d]\n",
				          current_active_cell_info->link_audio_data.on_id, 
				          current_active_cell_info->link_audio_data.ts_id, 
				          current_active_cell_info->link_audio_data.service_id);
	   			
	   			sprintf(buffer, 
						"net%d://%d.%d.%d",
						0, 
						ms_network_data.on_id, 
						ms_network_data.ts_id, 
						current_active_cell_info->link_audio_data.service_id);
					
				APP_TRACE(buffer);
				APP_TRACE("\n");
				ss_select_service(buffer);
				
				ms_send_pin(current_active_cell_info->link_audio_data.on_id, 
							current_active_cell_info->link_audio_data.ts_id, 
							current_active_cell_info->link_audio_data.service_id);
			}
		}		
   	}
   	return SUCCESS;
}


error_t ms_play_cell_audio_ex(cell_data_t *pre, cell_data_t *current_active_cell_info)
{

⌨️ 快捷键说明

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