📄 mosaic_ui.c
字号:
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)
{
if(pre->page_id == current_active_cell_info->page_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
{
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,
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);
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);
}
}
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;
}
#if 0
error_t ms_enter_new_page(page_node_t *tag_page_node)
{
uint8_t *table;
service_t mosaic_table_service, service;
int32_t size;
uint16_t picture_format;
component_t component;
uint16_t picture_id;
clock_t wait_time;
error_t error;
APP_TRACE("\n ###### the object page id is[%d]", tag_page_node -> page_data ->page_id);
STVID_DisableOutputWindow(VIDHndl);
cur_page_node_data = tag_page_node -> page_data;
/* the target page background is a M2V still picture */
if(tag_page_node -> page_data -> background_type ==0x01)
{
mosaic_table_service.network_index = db_get_current_network_index();
mosaic_table_service.original_network_id = ms_network_data.on_id/*0x4080*/;
mosaic_table_service.transport_stream_id = ms_network_data.ts_id/*0x000A*/;
mosaic_table_service.service_id = ms_network_data.service_id/*0x29*/;
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);
/*{
FILE *stream;
int16_t numwriten = 0;
APP_TRACE("\n ###### HP M2V picture is be pressed ***** \n");
if((stream = fopen("hpfile123","w")) == NULL)
{
APP_TRACE("\n can not open this file ***** \n");
}
else
{
APP_TRACE("\n ###### ***** \n");
numwriten = fwrite(table, sizeof(char), size, stream);
APP_TRACE("\n num[%d] has been write to the file\n", numwriten);
}
fclose(stream);
}*/
if(error != SUCCESS)
{
APP_TRACE("\n### request picture error is [%d]",error);
}
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);
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;
#if 0
error = db_query_mosaic_service_pids(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);
#endif
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);
/*component.component_type = SS_STREAM_COMPONENT;
component.data.stream.stream_type = MP2_VIDEO_STREAM;
component.data.stream.elementary_pid = video_pid;
ss_add_component(&service, &component);*/
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;
}
#endif
error_t ms_enter_new_page(page_node_t *tag_page_node, cell_node_t *tag_cell_node)
{
uint8_t *table;
service_t mosaic_table_service, service;
int32_t size;
uint16_t picture_format;
component_t component;
uint16_t picture_id;
clock_t wait_time;
error_t error;
APP_TRACE("\n ###### the object page id is[%d]", tag_page_node -> page_data ->page_id);
/*STVID_DisableOutputWindow(VIDHndl);*/
cur_page_node_data = tag_page_node -> page_data;
/* the target page background is a M2V still picture */
if(tag_page_node -> page_data -> background_type ==0x01)
{
mosaic_table_service.network_index = db_get_current_network_index();
mosaic_table_service.original_network_id = ms_network_data.on_id/*0x4080*/;
mosaic_table_service.transport_stream_id = ms_network_data.ts_id/*0x000A*/;
mosaic_table_service.service_id = ms_network_data.service_id/*0x29*/;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -