예제 #1
0
파일: epg_db.c 프로젝트: alkap007/ali3606
INT32 add_event_ext(struct DB_NODE *event_node)
{
	INT32 retcode ,i;
	date_time start_dt, end_dt;
	get_event_start_time(event_node, &start_dt);
	get_event_end_time(event_node, &end_dt);
	//retcode = epg_check_event_block(&start_dt, &end_dt);
	retcode = check_event_block(&start_dt, &end_dt);
	if(EPG_EVENT_BLOCK!=retcode && ERR_FAILED!=retcode)
	{
		if(EPG_EVENT_BLOCK_EXTEND==retcode)
		{
			for(i=0; i<MAX_EPG_LANGUAGE_COUNT;i++)
			{
				event_node->lang[i].ext_text_char = NULL;
				event_node->lang[i].ext_text_length = 0;
			}
		}
		del_view_event(event_node); // delete old version event from epgdb
		retcode = add_event(event_node);
		if ( (SUCCESS != retcode) && (SUCCESS== epg_release_db_mem(retcode) ))
			retcode = add_event(event_node);
	}
	return retcode;
}
예제 #2
0
파일: epg_db.c 프로젝트: alkap007/ali3606
INT32 data_release_event()
{
	INT32 ret,i;
	date_time start_dt, end_dt;
	ret = ERR_FAILED;

	epg_enter_mutex();

	do
	{
		for(i=0; i<db_block.index; i++)
		{
			get_event_start_time(&db_block.node[i], &start_dt);
			get_event_end_time(&db_block.node[i], &end_dt);
			if(eit_compare_time(&tw1.t_min,&end_dt)<=0 ||eit_compare_time(&tw1.t_max, &start_dt)>=0 )
			{// release event data
				if(db_block.node[i].status==NODE_ACTIVE)
					MTP_PRINT("%d-%d\n", start_dt.month, start_dt.day);
				if(db_block.node[i].status==NODE_ACTIVE && SUCCESS==__del_node(&db_block.node[i]))
				{
					MTP_PRINT("cnt:%d\n",db_block.count);
					ret = SUCCESS;
				}
			}
		}
	}while(ret!=SUCCESS && update_time_window(&tw0, &tw1, EVN_DATA)==SUCCESS);
	
	epg_leave_mutex();
	return ret;
}
예제 #3
0
INT32 epg_get_event_end_time(eit_event_info_t *ep,UINT8* str)
{
	date_time dt;

	if (ep==NULL)
		return 0;

	get_event_end_time(ep, &dt);
	
	return ConvertDateTimeToString(&dt, str);
}
예제 #4
0
파일: epg_db.c 프로젝트: alkap007/ali3606
// release one day event's extend data:tw0
INT32 data_release_extend()
{
	INT32 ret,i,j;
	date_time start_dt, end_dt;
	UINT8 *tmpbuf = 0; // use to avoid memory fragment
	ret = ERR_FAILED;
	
	epg_enter_mutex();
	
	MTP_PRINT("%s\n", __FUNCTION__);

	tmpbuf = (UINT8*)MALLOC(300);
	do
	{
		for(i=0; i<db_block.index; i++)
		{
			get_event_start_time(&db_block.node[i], &start_dt);
			get_event_end_time(&db_block.node[i], &end_dt);
			if(eit_compare_time(&tw0.t_min,&end_dt)<=0 ||eit_compare_time(&tw0.t_max, &start_dt)>=0 )
			{// release extend data
				for(j=0; j<MAX_EPG_LANGUAGE_COUNT; j++)
				{
					if(db_block.node[i].status==NODE_ACTIVE && db_block.node[i].lang[j].ext_text_length!=0)
					{
						if(tmpbuf!=NULL && db_block.node[i].status==NODE_ACTIVE && db_block.node[i].lang[j].text_length!=0)
						{// avoid memory fragment
							MEMCPY(tmpbuf, db_block.node[i].lang[j].text_char, db_block.node[i].lang[j].text_length);
							DB_FREE(db_block.node[i].lang[j].text_char);
							db_block.node[i].lang[j].text_char = NULL;
						}
						
						MTP_PRINT("%d-%d\n", start_dt.month, start_dt.day);
						DB_FREE(db_block.node[i].lang[j].ext_text_char);
						db_block.node[i].lang[j].ext_text_char = NULL;
						db_block.node[i].lang[j].ext_text_length = 0;
						
						if(tmpbuf!=NULL && db_block.node[i].status==NODE_ACTIVE && db_block.node[i].lang[j].text_length!=0)
						{// avoid memory fragment
							db_block.node[i].lang[j].text_char = (UINT8*)DB_MALLOC(db_block.node[i].lang[j].text_length);
							MEMCPY(db_block.node[i].lang[j].text_char, tmpbuf, db_block.node[i].lang[j].text_length);
						}
						ret = SUCCESS;
					}
				}
			}
		}
	}while(ret!=SUCCESS && update_time_window(&tw0, &tw1, EXT_DATA)==SUCCESS);
	if(tmpbuf!=0)
		FREE(tmpbuf);
	
	epg_leave_mutex();
	return ret;
}
예제 #5
0
static void win_prog_event_display(BOOL update)
{
    TEXT_FIELD*name = &txt_event;
    TEXT_FIELD*time = &txt_time;
    UINT16 curitem;
    UINT16 unistr[30];
    INT8 str[30],str2[30];
    INT32 len;
    eit_event_info_t* sch_event = NULL;
    UINT16* s;
    UINT16 play_per =0;
    date_time curtime,starttime,endtime;
    INT32  time_cur,time_start,time_end,time_ab,time_ab_cur;
    time_cur=time_start=time_end=time_ab=time_ab_cur=0;


    get_stream_UTC_time(&curtime);
    time_cur=curtime.hour*60+curtime.min;

    curitem = sys_data_get_cur_group_cur_mode_channel();

    if(current_hl_item.event_idx == INVALID_ID)
    {
        STRCPY(str,"");
        OSD_SetTextFieldContent(name, STRING_ANSI, (UINT32)str);
        OSD_SetTextFieldContent(time, STRING_ANSI, (UINT32)str);
        return;
    }
    sch_event=epg_get_cur_service_event(curitem, PRESENT_EVENT, NULL, NULL, NULL, TRUE);

    if(sch_event!=NULL)
    {
        //if(sch_event->event_id==current_hl_item.event_idx)
        s=epg_get_event_name(sch_event,&len);
        if (s == NULL)
        {
            STRCPY(str,"");
            OSD_SetTextFieldContent(name, STRING_ANSI, (UINT32)str);
            OSD_SetTextFieldContent(time, STRING_ANSI, (UINT32)str);
        }
        else
        {
            OSD_SetTextFieldContent(name,STRING_UNICODE,(UINT32)s);
            get_event_start_time(sch_event, &starttime);
            time_start=starttime.hour*60+starttime.min;
            epg_get_event_start_time(sch_event, str);
            len = STRLEN(str);

            STRCPY(&str[len],"~");
            len = STRLEN(str);

            get_event_end_time(sch_event, &endtime);
            time_end=endtime.hour*60+endtime.min;
            epg_get_event_end_time(sch_event, str2);

            STRCPY(&str[len],str2);

            OSD_SetTextFieldContent(time, STRING_ANSI, (UINT32)str);
            if(starttime.hour<=endtime.hour)
            {
                time_ab = time_end-time_start;
                time_ab_cur=time_cur -time_start;
            }
            else
            {
                time_ab =(24-starttime.hour +endtime.hour)*60+endtime.min-starttime.min;
                if(starttime.hour<=curtime.hour)
                {
                    time_ab_cur = (curtime.hour-starttime.hour)*60 +curtime.min-starttime.min;
                }
                else
                {

                    time_ab_cur = (24-starttime.hour +curtime.hour)*60 +curtime.min-starttime.min;
                }
            }
            if(time_ab==0)
                play_per=100;
            else
                play_per =time_ab_cur*100/time_ab;

            win_play_process_update(play_per);
        }
    }
    else
    {
        STRCPY(str,"");
        OSD_SetTextFieldContent(name, STRING_ANSI, (UINT32)str);
        OSD_SetTextFieldContent(time, STRING_ANSI, (UINT32)str);
    }
    if(update)
    {
        OSD_DrawObject((POBJECT_HEAD)&txt_event, C_UPDATE_ALL);
        OSD_DrawObject((POBJECT_HEAD)&txt_time, C_UPDATE_ALL);
    }
}
예제 #6
0
INT32 win_progname_set_info(void)
{
	UINT16 group_name[MAX_SERVICE_NAME_LENGTH + 1+10];
	UINT8 group_type, av_mode;

	UINT16 cur_channel;
	P_NODE p_node;
	S_NODE s_node;
	char string[100];
	char prog_name[MAX_SERVICE_NAME_LENGTH + 1];
	INT32 ret, len;
	UINT32 i, j;
	UINT16 icon;
	date_time dt;
	eit_event_info_t *pe = NULL,  *fe = NULL;
	UINT8 *s1 = NULL,  *s2 = NULL;
	INT32 strlen;
	struct ACTIVE_SERVICE_INFO service;
	UINT8 *src;
    UINT8 *src8;
	date_time start_time, end_time, local_time;
	INT32 day, h, m, sec, timeLen, timePassed, progProcessLen;

	UINT32 fav_mask;

	struct t_ttx_lang *ttx_lang_list;
	UINT8 ttx_lang_num;
	struct t_subt_lang* sub_lang_list;
	UINT8 sub_lang_num;
	fav_mask = 0;
	for (i = 0; i < MAX_FAVGROUP_NUM; i++)
		fav_mask |= (0x01 << i);

	get_STC_offset(&h, &m, &sec);

	av_mode = sys_data_get_cur_chan_mode();
	cur_channel = sys_data_get_cur_group_cur_mode_channel();
	ret = get_prog_at(cur_channel, &p_node);
	if(ret != SUCCESS)
		return -1;
	get_sat_by_id(p_node.sat_id, &s_node);
	get_cur_group_name((char*)group_name, &group_type);
	get_local_time(&dt);
	service.tp_id = p_node.tp_id;
	service.service_id = p_node.prog_number;
	epg_set_active_service(&service, 1);

	/* Get current next epg info */
	pe = epg_get_cur_service_event((INT32)cur_channel, PRESENT_EVENT, NULL, NULL, NULL, event_update);
	fe = epg_get_cur_service_event((INT32)cur_channel, FOLLOWING_EVENT, NULL, NULL, NULL, FALSE);
	s1 = (UINT8*)epg_get_event_name(pe, present_name, 32);
	s2 = (UINT8*)epg_get_event_name(fe, following_name, 32);

	#ifdef TTX_ON
	TTXEng_GetInitLang(&ttx_lang_list, &ttx_lang_num);
	#endif
	#ifdef SUBTITLE_ON
	subt_get_language(&sub_lang_list ,&sub_lang_num);
	#endif
	#ifdef TTX_ON
	if(sub_lang_num == 0)
		TTXEng_GetSubtLang(&ttx_lang_list,&sub_lang_num);
	#endif
	/* Set bmp content */
	if (av_mode == TV_CHAN)
		icon = IM_PAY;
	else
		icon = IM_INFORMATION_RADIO;
	OSD_SetBitmapContent(&prog_bmp, icon);
	#ifdef TTX_ON
	if(ttx_lang_num>0)
		icon = IM_INFORMATION_ICON_TTX;
	else
		icon = INVALID_ID; 
	//soc_printf("ttx icon id:%x, ", icon);
	OSD_SetBitmapContent(&prog_name_ttx, icon);
	//OSD_SetRect(&bmp->head.frame, p_prog_bmp->left, p_prog_bmp->top, p_prog_bmp->width,p_prog_bmp->height);
	OSD_DrawObject( (OBJECT_HEAD*) (&prog_name_ttx), C_UPDATE_ALL);
	#endif
	

	#ifdef SUBTITLE_ON
	if(sub_lang_num>0)
		icon = IM_INFORMATION_ICON_SUBTITLE;
	else 
		icon = INVALID_ID;
	//soc_printf("subt icon id:%x\n", icon);
	OSD_SetBitmapContent(&prog_name_subt, icon);
	OSD_DrawObject( (OBJECT_HEAD*) (&prog_name_subt), C_UPDATE_ALL);
	#endif

	/* Init display strings */
	for (i=0; i<7; i++)
		MEMSET(display_strs[20+i], 0, 2*MAX_DISP_STR_LEN);

	/* Set prog_name content */
	MEMSET(string, 0, sizeof(string));
	if (p_node.ca_mode == 0)
		STRCPY(string, "");
	else
		STRCPY(string, "$");

	ComAscStr2Uni(string, display_strs[20]);
	strlen = ComUniStrLen(display_strs[20]);
	ComUniStrCopyChar((UINT8*) &display_strs[20][strlen], p_node.service_name);

	/* Set prog_time content */
	MEMSET(string, 0, sizeof(string));
	sprintf(string, "%4d.%02d.%02d ", dt.year, dt.month, dt.day);
	ComAscStr2Uni(string, display_strs[21]);
	strlen = ComUniStrLen(display_strs[21]);
	src = OSD_GetUnicodeString(weekday_id[dt.weekday%7]);
	ComUniStrCopyChar((UINT8*) &display_strs[21][strlen], src);

	/* Set prog_num content */
	MEMSET(string, 0, sizeof(string));
	sprintf(string, "%03d", cur_channel + 1);
	ComAscStr2Uni(string, display_strs[22]);

	/* Set epg_time_now, epg_now, prog_process content */
	if (s1)
	{
		MEMSET(string, 0, sizeof(string));
		get_STC_offset(&h, &m, &sec);
		get_event_start_time(pe, &start_time);
		get_event_end_time(pe, &end_time);

		convert_time_by_offset(&start_time, &start_time, h, m);
		convert_time_by_offset(&end_time, &end_time, h, m);
 
		sprintf(string, "%02d:%02d~%02d:%02d ", start_time.hour, start_time.min,  \
			end_time.hour, end_time.min);
		ComAscStr2Uni(string, (UINT16*)display_strs[23]);
		ComUniStrCopyChar((UINT8*) &display_strs[24][0], s1);

		//draw prog process
		get_local_time(&local_time);
		get_time_offset(&start_time, &end_time, &day, &h, &m, &sec);
		timeLen = day * 24 * 60+h * 60+m;
		get_time_offset(&start_time, &local_time, &day, &h, &m, &sec);
		timePassed = day * 24 * 60+h * 60+m;
		if ((timeLen <= 0) || (timePassed <= 0))
			progProcessLen = 0;
		else
			progProcessLen = timePassed * PROG_PROCESS_W / timeLen;
		if (progProcessLen > PROG_PROCESS_W)
			progProcessLen = PROG_PROCESS_W;
		///prog_process.head.frame.uWidth = progProcessLen;
	}
	else
	{
		MEMSET(string, 0, sizeof(string));
        src8 = OSD_GetUnicodeString(RS_EPG_NO_INFORMATION);
		ComUniStrCopyChar((UINT8*) &display_strs[23][0], src8);
		sprintf(string, " ");
		ComAscStr2Uni(string, (UINT16*)display_strs[24]);
	}
	
	/* Set epg_time_next, epg_next content */
	if (s2)
	{
		MEMSET(string, 0, sizeof(string));
		get_STC_offset(&h, &m, &sec);
		get_event_start_time(fe, &start_time);
		get_event_end_time(fe, &end_time);


		convert_time_by_offset(&start_time, &start_time, h, m);
		convert_time_by_offset(&end_time, &end_time, h, m);

		sprintf(string, "%02d:%02d~%02d:%02d ", start_time.hour, start_time.min,  \
			end_time.hour, end_time.min);

		ComAscStr2Uni(string, display_strs[25]);
		ComUniStrCopyChar((UINT8*) &display_strs[26][0], s2);
	}
	else
	{
		MEMSET(string, 0, sizeof(string));
		sprintf(string, " ");
		ComAscStr2Uni(string, (UINT16*)display_strs[25]);
		ComAscStr2Uni(string, (UINT16*)display_strs[26]);
	}
	return 0;
}