📄 mosaic_tree.c
字号:
/*
* File: msdatatree.c
* Contains:
* the file of mosaic application for mosaic data tree.
*
* Author:
* stone
*
* CVS control words:
*
* $Id: mosaic_tree.c,v 1.3 2006/03/08 06:41:39 jli Exp $
*
* Last checked in:
* $Date: 2006/03/08 06:41:39 $
*
* History:
* $Log: mosaic_tree.c,v $
* Revision 1.3 2006/03/08 06:41:39 jli
* add ca error display
*
* Revision 1.2 2005/07/04 07:03:09 hwxiao
* no message
*
* Revision 1.1.1.1 2005/06/28 08:52:23 wjbai
* no message
*
* Revision 1.22 2005/03/23 06:46:51 syan
* no message
*
* Revision 1.21 2005/03/17 01:46:16 syan
* no message
*
* Revision 1.20 2005/02/02 01:52:10 syan
* add play video audio and still picture when no PMT.
*
* Revision 1.19 2005/01/12 01:36:54 syan
* no message
*
* Revision 1.18 2004/10/28 08:29:03 syan
* use new pallette(177 nums) and delete cache data when enter browser.
*
* Revision 1.17 2004/10/26 13:22:25 syan
* modify about when background pis is NULL, delete audio,vol rect,
* get PMT...
*
* Revision 1.16 2004/10/20 05:12:06 syan
* modify a new palette.
*
* Revision 1.15 2004/10/11 02:33:28 syan
* modify the del offers data of the cell.
*
* Revision 1.14 2004/07/09 11:16:05 syan
* modify the cell navigation , geo mask.
*
* Revision 1.13 2004/07/01 08:52:26 syan
* CA mask and modify some color.
*
* Revision 1.12 2004/06/21 02:26:21 syan
* support multilingual in page area display.
*
* Revision 1.11 2004/06/18 05:31:47 syan
* support multilingual info area display in a page.
*
* Revision 1.10 2004/06/16 11:40:09 syan
* modify multilingual text display in mask and page.
*
* Revision 1.9 2004/06/16 05:52:54 syan
* modify multilingual text display in page.
*
* Revision 1.8 2004/06/03 01:41:07 syan
* modify some data structure and VK in MOSAIC.
*
* Revision 1.7 2004/05/25 01:00:34 syan
* modify page display function to display the test page correctly.
*
* Revision 1.6 2004/05/11 08:17:23 syan
* add mask and color_index from the stream.
*
* Revision 1.5 2004/04/27 09:41:35 syan
* no message
*
* Revision 1.4 2004/03/29 09:47:36 syan
* no message
*
* Revision 1.3 2004/03/12 05:33:51 syan
* provide other application linking
*
* Revision 1.2 2004/02/04 08:54:01 dsqu
* no message
*
* Revision 1.1 2004/01/07 12:46:51 dsqu
* Initial creation
*
* Revision 1.1.1.1 2003/12/13 16:18:01 stone
* no message
*
*
*/
#include <stdio.h>
#include <string.h>
#include "stddefs.h"
#include "stcommon.h"
#include "modules.h"
#include "mosaic.h"
#include "vid.h"
void mosaic_ss_callback(uint32_t event, void *context);
extern mosaic_node_t *mosaic_tree_data_t;
extern mosaic_data_t *mosaic_node_data;
extern component_t ms_audio_component;
extern service_t ms_service;
extern semaphore_t *connect_ok;
extern db_mosaic_service_list_t ms_list;
#if 0
extern ui_logical_palette_t *g_mosaic_palette;
#endif
/*extern ms_dbg_info_t ms_dbg_info[500];
extern int16_t ms_app_index, ms_total_num;*/
error_t mosaic_find_page_node( mosaic_node_t *mosaic_bitree,
page_node_ident_t page_node_identify,
page_node_t **tag_page_node )
{
page_node_t *page_node;
if(mosaic_tree_data_t == NULL)
{
return FAILURE;
}
DBG_ASSERT(mosaic_bitree != NULL);
page_node = mosaic_bitree -> page_list;
/*if(page_node == NULL)
return NO_PAGE_NODE;*/
if(page_node -> page_data -> page_id == page_node_identify.page_id)
{
(*tag_page_node) = page_node;
}
else
{
while(TRUE)
{
page_node = page_node -> next;
if(page_node -> page_data -> page_id == page_node_identify.page_id)
break;
if(page_node ->next == NULL)
break;
}/*end of while-loop*/
(*tag_page_node) = page_node;
}
return SUCCESS;
}
error_t mosaic_find_cell_node( mosaic_node_t *mosaic_bitree,
cell_node_ident_t cell_node_identify,
cell_node_t **tag_cell_node )
{
page_node_t *page_node;
cell_node_t *cell_node;
page_node_ident_t parent_page;
error_t error;
if(mosaic_tree_data_t == NULL)
{
return FAILURE;
}
DBG_ASSERT( mosaic_bitree != NULL );
page_node = mosaic_bitree -> page_list;
if( page_node -> page_data -> page_id != cell_node_identify.page_id )
{
parent_page.page_id = cell_node_identify.page_id;
error = mosaic_find_page_node( mosaic_bitree,
parent_page,
&page_node );
}
cell_node = page_node -> cell_list;
/*if( cell_node == NULL )
return NO_CELL_NODE;*/
if( cell_node -> cell_data -> cell_id == cell_node_identify.cell_id )
{
( *tag_cell_node ) = cell_node;
}
else
{
while( TRUE )
{
cell_node = cell_node -> next;
if( cell_node -> cell_data -> cell_id == cell_node_identify.cell_id )
break;
if(cell_node ->next == NULL)
break;
}/*end of while-loop*/
( *tag_cell_node ) = cell_node;
}
return SUCCESS;
}
/*
*this function will init the mosaic data tree,allocate memory fo it.
*/
mosaic_node_t* mosaic_init_data_tree()
{
mosaic_node_t *mosaic_root_node;
mosaic_root_node = app_mem_allocate ( sizeof( mosaic_node_t ) );
mosaic_root_node -> mosaic_data = NULL;
mosaic_root_node -> page_list = NULL;
ms_audio_component.component_type = SS_INVALID_COMPONENT;
return mosaic_root_node;
}
error_t mosaic_add_page_node ( mosaic_node_t *mosaic_bitree,
page_data_t *current_page_data )
{
page_node_t *page_node;
DBG_ASSERT( mosaic_bitree != NULL );
DBG_ASSERT( current_page_data != NULL );
if( mosaic_bitree -> page_list ==NULL )
{
mosaic_bitree -> page_list = app_mem_allocate ( sizeof( page_node_t ) );
mosaic_bitree -> page_list -> page_data = current_page_data;
mosaic_bitree -> page_list -> cell_list = NULL;
mosaic_bitree -> page_list -> next = NULL;
mosaic_bitree -> page_list -> prev = NULL;
}
else
{
page_node = mosaic_bitree -> page_list;
while( TRUE )
{
if( page_node -> next == NULL )
break;
else
page_node = page_node->next;
}/*end of while-loop*/
page_node -> next = app_mem_allocate ( sizeof( page_node_t ) );
page_node -> next -> page_data = current_page_data ;
page_node -> next -> cell_list = NULL;
page_node -> next -> next = NULL;
page_node -> next -> prev = NULL;
}
}
error_t mosaic_add_cell_node ( mosaic_node_t *mosaic_bitree,
cell_data_t *current_cell_data,
page_node_ident_t page_node_identify )
{
cell_node_t *cell_node;
page_node_t *page_node;
error_t error;
DBG_ASSERT( mosaic_bitree != NULL );
DBG_ASSERT( current_cell_data != NULL );
error = mosaic_find_page_node( mosaic_bitree,
page_node_identify,
&page_node );
if( error != SUCCESS )
return error;
else
{
if( page_node -> cell_list == NULL )
{
page_node -> cell_list = app_mem_allocate ( sizeof( cell_node_t ) );
page_node -> cell_list -> cell_data = current_cell_data;
page_node -> cell_list -> next = NULL;
page_node -> cell_list -> prev = NULL;
}
else
{
cell_node = page_node -> cell_list;
while( TRUE )
{
if( cell_node -> next == NULL )
break;
else
cell_node = cell_node -> next;
}/*end of while-loop*/
cell_node -> next = app_mem_allocate ( sizeof( cell_node_t ) );
cell_node -> next -> cell_data = current_cell_data ;
cell_node -> next -> next = NULL;
cell_node -> prev = NULL;
}
return SUCCESS/*ADD_PAGE_NODE*/;
}
}
/*
*delete the authorized offers data in the cell node
*/
error_t ms_del_authorized_offers(authorized_offers_t *authorized_data)
{
ms_offers_t *offers;
if(authorized_data != NULL)
{
while(1)
{
if(authorized_data->offers_list == NULL)
{
app_mem_deallocate(authorized_data);
authorized_data = NULL;
break;
}
else
{
offers = authorized_data->offers_list;
while(1)
{
if(offers->next == NULL)
{
app_mem_deallocate(offers);
offers = NULL;
break;
}
else
{
app_mem_deallocate(offers);
offers = offers->next;
}
}/*end of the while-loop*/
authorized_data->offers_list = NULL;
}
}/*end of the while-loop*/
}
return SUCCESS;
}
/*
*
*/
error_t ms_del_geo_zones(geo_zones_t *geo_zones_data)
{
geo_zones_t *geo_zones_data1;
#if 0
if(geo_zones_data != NULL)
{
app_mem_deallocate(geo_zones_data);
geo_zones_data = NULL;
}
#else
if(geo_zones_data != NULL)
{
while(1)
{
if(geo_zones_data->next == NULL)
{
app_mem_deallocate(geo_zones_data);
geo_zones_data = NULL;
break;
}
else
{
geo_zones_data1 = geo_zones_data->next;
while(1)
{
if(geo_zones_data1->next == NULL)
{
app_mem_deallocate(geo_zones_data1);
geo_zones_data1 = NULL;
break;
}
else
{
app_mem_deallocate(geo_zones_data1);
geo_zones_data1 = geo_zones_data1->next;
}
}/*end of the while-loop*/
geo_zones_data->next = NULL;
}
}/*end of the while-loop*/
}
#endif
return SUCCESS;
}
/*
*
*/
error_t ms_del_country_data(country_data_t *country_data)
{
country_code_t *country_code;
if(country_data != NULL)
{
while(1)
{
if(country_data->country_code_list == NULL)
{
app_mem_deallocate(country_data);
country_data = NULL;
break;
}
else
{
country_code = country_data->country_code_list;
while(1)
{
if(country_code->next == NULL)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -