void win_timerset_timerservice_change(BOOL update) { UINT8 action; TEXT_FIELD *txt; MULTISEL *msel; UINT16 ch_idx, ch_cnt; TIMER_SET_CONTENT *settimer; P_NODE p_node; settimer = &timer_set; if (TIMER_MODE == TIMER_MODE_OFF) action = C_ATTR_INACTIVE; else { if (TIMER_SERVICE_TYPE == TIMER_SERVICE_MESSAGE) action = C_ATTR_INACTIVE; else action = C_ATTR_ACTIVE; } /* TIMER service information: message or channel */ txt = &timer_txt_serviceinfo; msel = &timer_msel_serviceinfo; if (TIMER_SERVICE_TYPE == TIMER_SERVICE_MESSAGE) { /* TIMER_SERVICE_SMG */ OSD_SetMultiselSelType(msel, STRING_ID); OSD_SetMultiselCount(msel, 3); OSD_SetMultiselSelTable(msel, (void*)WakeupMessageStr_id); if (settimer->wakeup_message >= 3) settimer->wakeup_message = 0; OSD_SetMultiselSel(msel, settimer->wakeup_message); } else { //modified by Robin if (get_prog_by_id(settimer->wakeup_channel, &p_node) == DB_SUCCES) ch_idx = get_prog_pos(settimer->wakeup_channel); else ch_idx = sys_data_get_cur_group_cur_mode_channel(); ch_cnt = get_prog_num(VIEW_ALL | settimer->wakeup_chan_mode, 0); OSD_SetMultiselSelType(msel, STRING_PROC); OSD_SetMultiselCount(msel, ch_cnt); OSD_SetMultiselSel(msel, ch_idx); } OSD_SetTextFieldContent(txt, STRING_ID, (UINT32)TimerServiceTxtStr_id[TIMER_SERVICE_TYPE]); if (update) OSD_DrawObject((POBJECT_HEAD) &timer_con_serviceinfo, C_DRAW_SIGN_EVN_FLG | C_UPDATE_ALL); set_container_active(&timer_con_duration, action); if (update) OSD_DrawObject((POBJECT_HEAD) &timer_con_duration, C_UPDATE_ALL); }
static PRESULT timerset_btn_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT8 bID; UINT8 back_save; bID = OSD_GetObjID(pObj); switch(event) { case EVN_UNKNOWN_ACTION: if(bID == TIMER_BTN_OK_ID) { if(win_timerset_check_and_save() == 0) { #if 0//def DVR_PVR_SUPPORT TIMER_SET_CONTENT* timer = &timer_set; P_NODE p_node; if(get_prog_by_id(timer->wakeup_channel,&p_node) != DB_SUCCES) return PROC_PASS; if((p_node.lock_flag) // && (timer->timer_mode != TIMER_MODE_OFF) && (timer->timer_service == TIMER_SERVICE_DVR_RECORD) ) { if(!win_pwd_open(NULL,0)) { return PROC_PASS; } } #endif timer_set_ok_cancel_flag= 1; ret = PROC_LEAVE; } else { win_compopup_init(WIN_POPUP_TYPE_OK); win_compopup_set_msg(NULL,NULL,RS_MSG_INVALID_INPUT_CONTINUE); win_compopup_open_ext(&back_save); } } else ret = PROC_LEAVE; break; } return ret; }
static struct MULTIFEED_INFO * del_invalid_info(struct MULTIFEED_INFO *info) { if( info == NULL ) return NULL; INT32 ret; P_NODE p_node; UINT32 tp_id; UINT16 service_id; T_NODE t_node; struct FEED_INFO *p ; INT8 pf = 0; tp_id = info->tp_id; service_id = info->service_id; ret = get_prog_by_id(info->prog_id, &p_node); if( ret != DB_SUCCES ) { // service not exist multifeed_service_remove( info ); multifeed_service_destroy( info ); // notify epg module retrieve eit pf table retrieve_eit_pf( tp_id, service_id ); return NULL; } p = info->feed_head; while( p != NULL ) { // check all feeds: valid or not ret = find_tp_in_db( info->sat_id, p->original_network_id, p->transport_stream_id, &t_node ); if( ret != MULTIFEED_SUCCESS ) { // del invalid feed p = del_feed_node( info, p ); pf = 1; } else { p = p->next; } } if( pf ) // notify epg module retrieve eit pf table { retrieve_eit_pf( tp_id, service_id ); } return info; }
/* * get one feed's detail information and fill to feed node * some info such as tp info, can't find in database, we have to retreive from nit */ static void fill_feed_detail_info(struct FEED_INFO *info, UINT32 sat_id, UINT32 prog_id) { INT32 ret = MULTIFEED_FAILURE, ret2 = MULTIFEED_FAILURE; T_NODE t_node; P_NODE p_node, p_node2; P_NODE *feed_pnode; DB_VIEW *last_view; UINT16 last_filter_mode, i; UINT32 last_view_param; get_prog_by_id(prog_id, &p_node); // first check db whether has the infomation ret = find_tp_in_db(sat_id, info->original_network_id, info->transport_stream_id, &t_node); if(ret != MULTIFEED_SUCCESS) { // if already got the nit, then search the buffer, and update to db ret = search_node( multifeed_table_buff, 1024, info->original_network_id, info->transport_stream_id, &t_node); if( ret!=MULTIFEED_SUCCESS ) { // not recieve nit data yet, so request nit data ret = find_tp_in_nit(info->original_network_id, info->transport_stream_id, &t_node); } if(ret == MULTIFEED_SUCCESS) { last_view = (DB_VIEW *)get_cur_view(); last_filter_mode = last_view->cur_filter_mode; last_view_param = last_view->view_param; if(last_view->cur_type==TYPE_PROG_NODE) { recreate_tp_view(VIEW_ALL ,0); ret = add_node(TYPE_TP_NODE, sat_id, (void*)&t_node); if(ret == SUCCESS) update_data(); recreate_prog_view(last_filter_mode, last_view_param); } else { ret = add_node(TYPE_TP_NODE, sat_id, (void*)&t_node); if(ret == SUCCESS) update_data(); } } } // maybe the subfeed is one of the channels, and that channel // maybe locked by parent, so we have to get this information if( p_node.prog_number != info->service_id ) { i = 0; while(SUCCESS == get_prog_at(i, &p_node2)) { if(( p_node2.tp_id == t_node.tp_id ) && ( p_node2.prog_number == info->service_id )) { mf_debug("feed: (%s, sid: %d) is Channel: %s\n", \ info->name, info->service_id, p_node2.service_name ); ret2 = MULTIFEED_SUCCESS; break; } i++; } } if(ret == SUCCESS) { info->is_known = 1; feed_pnode = &(info->p_node); MEMCPY(feed_pnode, &p_node, sizeof(P_NODE)); feed_pnode->tp_id = t_node.tp_id; feed_pnode->prog_number = info->service_id; if( ret2 != MULTIFEED_SUCCESS) { feed_pnode->pmt_pid = 0x1FFF; feed_pnode->audio_count = 1; feed_pnode->audio_pid[0]= feed_pnode->pcr_pid = feed_pnode->video_pid = 0x1FFF; } else { feed_pnode->av_flag = p_node2.av_flag; feed_pnode->ca_mode = p_node2.ca_mode; feed_pnode->video_pid = p_node2.video_pid; feed_pnode->pcr_pid = p_node2.pcr_pid; feed_pnode->h264_flag = p_node2.h264_flag; feed_pnode->pmt_pid = p_node2.pmt_pid; feed_pnode->pmt_version = p_node2.pmt_version; feed_pnode->service_type= p_node2.service_type; feed_pnode->audio_channel= p_node2.audio_channel; feed_pnode->audio_select= p_node2.audio_select; feed_pnode->lock_flag = p_node2.lock_flag;// parent lock feed_pnode->audio_count = p_node2.audio_count; MEMCPY( feed_pnode->audio_pid, p_node2.audio_pid, sizeof(UINT16)*MAX_AUDIO_CNT ); MEMCPY( feed_pnode->audio_lang, p_node2.audio_lang, sizeof(UINT16)*MAX_AUDIO_CNT ); } mf_debug("feed: tp_id: %d, frq: %d\n", feed_pnode->tp_id, t_node.frq ); } }
/************************************* function: IsValidTimer parameter: return: 0 - invalid 1 - valid **************************************/ INT32 IsValidTimer(TIMER_SET_CONTENT *timer) { INT32 ret,i; SYSTEM_DATA *sys_data; TIMER_SET_CONTENT *timer1,*timer2; UINT8 overlap_timer_num = 0; P_NODE p_node, p_node2; if(timer->timer_mode == TIMER_MODE_OFF) return 1; // new Spec, default is 2 hour, 0 is invalid!! if(timer->wakeup_duration_time == 0) return 0; sys_data = sys_data_get(); for(i=0; i<MAX_TIMER_NUM; i++) { if(i == sys_data->timer_set.common_timer_num -1) continue; if(sys_data->timer_set.TimerContent[i].timer_mode == TIMER_MODE_OFF) continue; switch(timer->timer_mode) { case TIMER_MODE_WEEKLY: switch(sys_data->timer_set.TimerContent[i].timer_mode) { case TIMER_MODE_MONTHLY: case TIMER_MODE_YEARLY: break; default: goto CHECKTIMER; } break; case TIMER_MODE_MONTHLY: case TIMER_MODE_YEARLY: switch(sys_data->timer_set.TimerContent[i].timer_mode) { case TIMER_MODE_WEEKLY: break; default: goto CHECKTIMER; } break; default: CHECKTIMER: timer2 = &sys_data->timer_set.TimerContent[i]; #ifdef DVR_PVR_SUPPORT // temp disable dual-record timer, wait for dmx finished!! if(sys_data_get_rec_num() == 2) { if((timer->timer_service == TIMER_SERVICE_DVR_RECORD) || ((timer->timer_service == TIMER_SERVICE_CHANNEL) && (timer2->timer_service == TIMER_SERVICE_DVR_RECORD))) { // only can overlap with 1 existed timer! if(internal_check(timer, timer2) == 0) { overlap_timer_num++; if(overlap_timer_num > 1) { // more than 2 timers overlap!! return 0; } if((get_prog_by_id(timer->wakeup_channel, &p_node) == DB_SUCCES) && (get_prog_by_id(timer2->wakeup_channel, &p_node2) == DB_SUCCES)) { if((p_node.prog_id == p_node2.prog_id) || ((p_node.sat_id == p_node2.sat_id) && (p_node.tp_id != p_node2.tp_id))) { // same prog OR diff TP under same tuner! return 0; } } else { return 0; } } } else if(internal_check(timer, timer2) == 0) { return 0; } } else #endif { if(internal_check(timer, timer2) == 0) return 0; } break; } } return 1; }
/* * name: api_sim_callback * in : param( Struct sim_cb_param ) * out : SUCCESS or ERR_FAILUE * function: to be registered in sim, send info "CTRL_MSG_SUBTYPE_CMD_PIDCHANGE" at runtime when the PID monitored changed */ INT32 api_sim_callback(UINT32 param) { struct sim_cb_param *sim_param = (struct sim_cb_param *)param; INT32 ret = ERR_FAILUE; UINT16 sim_pcr_pid; UINT16 sim_video_pid; UINT16 sim_audio_pid[P_MAX_AUDIO_NUM]; UINT16 sim_audio_count = P_MAX_AUDIO_NUM; static BOOL on_process = FALSE; /* while(on_process) { osal_task_sleep(10); } */ on_process = TRUE; //static var to minitor the ecm and emm pids static UINT16 ecm_pids[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static UINT16 emm_pids[16]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; static UINT16 ecm_pids_len = 0; UINT16 sie_ecm_pids[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; UINT16 sie_emm_pids[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; UINT8 max_ecm_cnt = 16; UINT8 max_emm_cnt = 16; static P_NODE p_node; // Come from get_prog_by_id INT8 sim_idx = -1, i; sim_information* info = api_get_sim_info_slot_by_sim(sim_param->dmx_idx, sim_param->sim_id); do{ if( NULL == info) { break; } if (sim_param->table == MONITE_TB_PMT) { sim_video_pid = sim_pcr_pid = 8191; MEMSET(sim_audio_pid, 8191, P_MAX_AUDIO_NUM); if (ERR_FAILUE == sim_get_video_pid(sim_param->sim_id, &sim_video_pid)) break; //sim_get_pmt(sim_param->sim_id, &sim_p_info); if (ERR_FAILUE == sim_get_audio_info(sim_param->sim_id, sim_audio_pid, NULL, &sim_audio_count)) break; if (ERR_FAILUE== sim_get_pcr_pid(sim_param->sim_id, &sim_pcr_pid)) break; if (ERR_FAILUE == sim_get_ecm_pid(sim_param->sim_id,sie_ecm_pids,&max_ecm_cnt)) break; if ((max_ecm_cnt != 0) && (MEMCMP(ecm_pids,sie_ecm_pids, sizeof(UINT16)*max_ecm_cnt)!=0)) { ecm_pids_len = max_ecm_cnt; libc_printf("ecms changed max_ecm_cnt:%d\n",max_ecm_cnt); MEMCPY(ecm_pids,sie_ecm_pids, sizeof(UINT16)*max_ecm_cnt); }else if(ecm_pids_len !=0 && max_ecm_cnt != ecm_pids_len ) { MEMCPY(ecm_pids,sie_ecm_pids, sizeof(UINT16)*(ecm_pids_len>max_ecm_cnt?ecm_pids_len:max_ecm_cnt)); ecm_pids_len = max_ecm_cnt; libc_printf("ecms changed 2 max_ecm_cnt = %d\n",max_ecm_cnt); } get_prog_by_id(info->prog_id, &p_node); if(p_node.pmt_pid != sim_param->sec_pid) { //used for debug!! libc_printf("fatal error!"); break; } //normal mode to update video pid, audio pid, ... except ecm pid & emm pid //libc_printf("dxm%d sim %d :channel %d pid [v %d, a %d, pcr %d] -> [v %d, a %d, pcr %d]\n", \ // sim_param->dmx_idx,sim_param->sim_id,info->prog_id, p_node.video_pid, p_node.audio_pid[0], p_node.pcr_pid, sim_video_pid, sim_audio_pid[0], sim_pcr_pid); if((sim_video_pid != p_node.video_pid) || (sim_pcr_pid != p_node.pcr_pid) ||(sim_audio_count != p_node.audio_count) ||(MEMCMP(p_node.audio_pid,sim_audio_pid, sizeof(UINT16)*sim_audio_count)!=0)) { if ((PROG_TV_MODE ==p_node.av_flag) &&((0 == sim_video_pid) ||(8191 == sim_video_pid) ||(0 == sim_pcr_pid) ||(8191 == sim_pcr_pid) ||(0 == sim_audio_pid[0]) ||(8191 == sim_audio_pid[0]))) break; if ((PROG_RADIO_MODE ==p_node.av_flag) &&((0 != sim_video_pid) ||(8191 != sim_video_pid) ||(0 == sim_pcr_pid) ||(8191 == sim_pcr_pid) ||(0 == sim_audio_pid[0]) ||(8191 == sim_audio_pid[0]))) break; //libc_printf("dxm%d sim %d :channel %d pid changed![v %d, a %d, pcr %d] -> [v %d, a %d, pcr %d]\n", \ // sim_param->dmx_idx,sim_param->sim_id,info->prog_id, p_node.video_pid, p_node.audio_pid[0], p_node.pcr_pid, sim_video_pid, sim_audio_pid[0], sim_pcr_pid); if(PROG_TV_MODE ==p_node.av_flag) p_node.video_pid = sim_video_pid; p_node.pcr_pid = sim_pcr_pid; p_node.audio_count = sim_audio_count; MEMCPY(p_node.audio_pid, sim_audio_pid, sizeof(UINT16)*sim_audio_count); modify_prog(p_node.prog_id, &p_node); update_data(); api_set_active_sim_info(info); ap_send_msg(CTRL_MSG_SUBTYPE_CMD_PIDCHANGE, p_node.prog_id, FALSE);//move down for sending MSG after modifed p_node } } //CA mode to update emm pid pid if ( sim_param->table == MONITE_TB_CAT ) { if (ERR_FAILUE == sim_get_emm_pid(sim_param->sim_id,sie_emm_pids,&max_emm_cnt)) break; if ((p_node.ca_mode) &&(max_emm_cnt != 0) && (MEMCMP(emm_pids,sie_ecm_pids, sizeof(UINT16)*max_emm_cnt)!=0)) { for (i=0;i<max_emm_cnt;i++) { libc_printf("emm pid changed![ %d] -> [ %d]\n",emm_pids[i],sie_emm_pids[i]); } libc_printf("Dynamic PID cause EMM changed!\n Need to update code to support it\n"); MEMCPY(emm_pids,sie_emm_pids, sizeof(UINT16)*max_emm_cnt); // TO DO: add ca interface to change the ecm_pids and emm_pids // TO DO: add pvr interface to change the ecm_pids and emm_pids } } ret = SUCCESS; }while(0); on_process = FALSE; return ret; }
void win_timerlist_loadsetting(void) { SYSTEM_DATA* sys_data; TIMER_SET_CONTENT* timer; INT32 i; CONTAINER* con; TEXT_FIELD* txt; UINT16* pstr; char str[30]; UINT16 strID; P_NODE p_node; sys_data = sys_data_get(); for(i=0;i < MAX_TIMER_NUM;i++) { LOAD_ONE_TIMER: timer = &sys_data->timer_set.TimerContent[i]; con = timers_conts[i]; pstr = display_strs[2*i]; /*Number */ txt = (TEXT_FIELD*)OSD_GetContainerNextObj(con); OSD_SetTextFieldStrPoint(txt,pstr); OSD_SetTextFieldContent(txt, STRING_NUMBER, i+1); pstr += 3; /*Mode */ txt = (TEXT_FIELD*)OSD_GetObjpNext(txt); strID = TimerModeStr_id[timer->timer_mode]; OSD_SetTextFieldContent(txt, STRING_ID,(UINT32)strID); /*Service */ txt = (TEXT_FIELD*)OSD_GetObjpNext(txt); if(timer->timer_mode!= TIMER_MODE_OFF) strID = TimerServiceStr_id[timer->timer_service]; else strID = 0; OSD_SetTextFieldContent(txt, STRING_ID,(UINT32)strID); /*Content */ strID = 0; txt = (TEXT_FIELD*)OSD_GetObjpNext(txt); if(timer->timer_mode!= TIMER_MODE_OFF) { if(timer->timer_service == TIMER_SERVICE_MESSAGE) { strID = WakeupMessageStr_id[timer->wakeup_message]; pstr = NULL; } else { if(get_prog_by_id(timer->wakeup_channel,&p_node) == DB_SUCCES) { if(p_node.ca_mode) ComAscStr2Uni("$", pstr); ComUniStrCopyChar((UINT8*)&pstr[p_node.ca_mode], p_node.service_name); } else { /* When the specified channel not exit, turn off the timer */ timer->timer_mode = TIMER_MODE_OFF; pstr = NULL; goto LOAD_ONE_TIMER; } } } else pstr = NULL; OSD_SetTextFieldStrPoint(txt,pstr); OSD_SetTextFieldContent(txt, STRING_ID,(UINT32)strID); pstr = display_strs[2*i + 1]; /*Date&Time*/ txt = (TEXT_FIELD*)OSD_GetObjpNext(txt); str[0] = '\0'; if(timer->timer_mode!= TIMER_MODE_OFF) sprintf(str,"%02d/%02d/%04d %02d:%02d", timer->wakeup_month,timer->wakeup_day,timer->wakeup_year, timer->wakeup_time/60,timer->wakeup_time%60); OSD_SetTextFieldStrPoint(txt,pstr); OSD_SetTextFieldContent(txt, STRING_ANSI,(UINT32)str); pstr += 20; /*Duration*/ txt = (TEXT_FIELD*)OSD_GetObjpNext(txt); str[0] = '\0'; if(timer->timer_mode!= TIMER_MODE_OFF && (timer->timer_service == TIMER_SERVICE_CHANNEL #ifdef DVR_PVR_SUPPORT || timer->timer_service == TIMER_SERVICE_DVR_RECORD #endif ) ) sprintf(str,"%02d:%02d",timer->wakeup_duration_time/60,timer->wakeup_duration_time%60); ComAscStr2Uni(str, pstr); OSD_SetTextFieldStrPoint(txt,pstr); OSD_SetTextFieldContent(txt, STRING_ANSI,(UINT32)str); } #if 0 sys_data_set_cur_chan_mode(cur_chan_mode); recreate_prog_view(VIEW_ALL | cur_chan_mode,0); #endif }