60 #define NID_PRIVATE_BOUNDARY 0xFF01 61 #define ONID_PRIVATE_BOUNDARY 0xFF00 63 #ifdef COUNTRY_FINLAND 64 #define FINLAND_ONID 0x20F6 67 #ifdef COUNTRY_IRELAND 68 #define IRELAND_ONID 0x2174 71 #define PRIVATE_NETWORK_ID0 0xff01 73 #define TIMER_HANDLE_BASE INVALID_TIMER_HANDLE + 1 74 #define LAST_TIMER_HANDLE 0xffffffff 76 #define PRIV_DATA_SPEC_DTAG 0x5f 78 #define UK_DTT_PRIVATE_DATA_CODE 0x0000233a 79 #define FREESAT_PRIVATE_DATA_CODE 0x46534154 84 #define DBG_DBDEF(X) STB_SPDebugWrite X 95 static void *db_access_mutex;
97 CREATE_LINK_LIST_HEADER(lnb_rec_list);
98 CREATE_LINK_LIST_HEADER(satellite_rec_list);
99 CREATE_LINK_LIST_HEADER(lnb_band_rec_list);
100 CREATE_LINK_LIST_HEADER(network_rec_list);
101 CREATE_LINK_LIST_HEADER(transport_rec_list);
102 CREATE_LINK_LIST_HEADER(service_rec_list);
103 CREATE_LINK_LIST_HEADER(crid_rec_list);
104 CREATE_LINK_LIST_HEADER(favlist_list);
105 CREATE_LINK_LIST_HEADER(timer_list);
106 #ifdef COMMON_INTERFACE 107 CREATE_LINK_LIST_HEADER(cicam_timer_list);
110 static U8BIT num_paths;
114 static U32BIT last_timer_handle;
117 static ADB_PROFILE_TYPE current_profile;
118 static ADB_PROFILE_TYPE pushed_profile;
119 #ifdef COMMON_INTERFACE 120 static U16BIT cicam_onet_id;
121 static U32BIT cicam_identifier;
122 static U16BIT pushed_cicam_onet_id;
123 static U32BIT pushed_cicam_identifier;
126 static U16BIT num_analog_channels;
129 static U8BIT *text_langs;
130 static U8BIT *audio_langs;
131 static U8BIT *second_audio_langs;
132 static U8BIT *second_text_langs;
134 static const ADB_STREAM_TYPE audio_priority_table[] = {
136 ADB_AC3_AUDIO_STREAM,
137 ADB_EAC3_AUDIO_STREAM,
138 ADB_AAC_AUDIO_STREAM,
139 ADB_HEAAC_AUDIO_STREAM
151 U16BIT *next_allocated_lcn, BOOLEAN *lcn_assigned);
152 static U8BIT GetTargetRegionMatchDepth(
ADB_SERVICE_REC *s_ptr, U8BIT match_depth,
153 U32BIT country_code, U8BIT primary_region, U8BIT secondary_region, U16BIT tertiary_region);
156 static BOOLEAN UserPrefsMatch(ADB_TELETEXT_TYPE ttext_type, E_SUBTITLE_TYPE user_pref);
158 static U16BIT GetReqdAudioPid(
ADB_SERVICE_REC *s_ptr, E_STB_DP_AUDIO_MODE *audio_mode,
159 ADB_STREAM_TYPE *audio_type, U8BIT *db_lang_ids, BOOLEAN *primary_found,
ADB_STREAM_REC **selected_stream);
160 static U8BIT AudioStreamPriority(ADB_STREAM_TYPE stream_type);
161 static E_STREAM_MATCH_TYPE GetReqdSubtitleParams(
ADB_SERVICE_REC *s_ptr, U16BIT *pid_ptr, U16BIT *cpage_ptr,
162 U16BIT *apage_ptr, U8BIT *db_lang_ids, BOOLEAN *primary_found,
ADB_STREAM_REC **selected_stream);
163 static E_STREAM_MATCH_TYPE GetReqdTtextParams(
ADB_SERVICE_REC *s_ptr, U16BIT *pid_ptr, BOOLEAN for_subtitles,
164 U8BIT *magazine, U8BIT *page, U8BIT *db_lang_ids, BOOLEAN *primary_found,
ADB_STREAM_REC **selected_stream);
165 static U16BIT GetReqdADPid(
ADB_SERVICE_REC *s_ptr, E_STB_DP_AUDIO_MODE *ad_mode, U8BIT *db_lang_ids,
167 #if defined(COUNTRY_FINLAND) || defined(COUNTRY_IRELAND) 168 static U16BIT FindLargestLcnNumber(E_STB_DP_SIGNAL_TYPE tuner_type, U16BIT onet_id);
180 static BOOLEAN IsVideoStreamType(ADB_STREAM_TYPE type);
182 static U8BIT* ReadLanguageCode(U8BIT *dptr, U32BIT *lang_code);
183 static U8BIT* CopyString(
ADB_STRING *str_desc, BOOLEAN to_unicode);
185 #ifdef DEBUG_PRINT_DATABASE 210 if (tuned_network == NULL)
216 if (tuned_network != NULL)
218 for (i = 0; i < num_paths; i++)
220 tuned_network[i] = NULL;
225 last_timer_handle = INVALID_TIMER_HANDLE;
275 U16BIT fl_index, fs_index;
277 #ifdef COMMON_INTERFACE 278 ADB_CICAM_TIMER_REC *cicam_timer;
298 while (dba_rec != NULL)
307 lnb_ptr->dba_rec = dba_rec;
310 switch ((E_STB_DP_LNB_TYPE)tmp32bit)
312 case LNB_TYPE_SINGLE:
313 case LNB_TYPE_UNIVERSAL:
314 case LNB_TYPE_UNICABLE:
315 case LNB_TYPE_USER_DEFINED:
317 lnb_ptr->type = (E_STB_DP_LNB_TYPE)tmp32bit;
323 lnb_ptr->type = LNB_TYPE_SINGLE;
330 switch ((E_STB_DP_LNB_POWER)tmp32bit)
335 lnb_ptr->power = (E_STB_DP_LNB_POWER)tmp32bit;
339 lnb_ptr->power = LNB_POWER_AUTO;
345 lnb_ptr->is_22k = (tmp32bit ? TRUE : FALSE);
347 lnb_ptr->is_12v = (tmp32bit ? TRUE : FALSE);
349 lnb_ptr->is_pulse_posn = (tmp32bit ? TRUE : FALSE);
351 lnb_ptr->is_diseqc_posn = (tmp32bit ? TRUE : FALSE);
354 switch ((E_STB_DP_DISEQC_TONE)tmp32bit)
356 case DISEQC_TONE_OFF:
360 lnb_ptr->diseqc_tone = (E_STB_DP_DISEQC_TONE)tmp32bit;
366 lnb_ptr->diseqc_tone = DISEQC_TONE_OFF;
368 (U32BIT)lnb_ptr->diseqc_tone);
374 switch ((E_STB_DP_DISEQC_CSWITCH)tmp32bit)
376 case DISEQC_CSWITCH_OFF:
377 case DISEQC_CSWITCH_A:
378 case DISEQC_CSWITCH_B:
379 case DISEQC_CSWITCH_C:
380 case DISEQC_CSWITCH_D:
382 lnb_ptr->c_switch = (E_STB_DP_DISEQC_CSWITCH)tmp32bit;
388 lnb_ptr->c_switch = DISEQC_CSWITCH_OFF;
390 (U32BIT)lnb_ptr->c_switch);
398 lnb_ptr->u_switch = (U8BIT)tmp32bit;
403 lnb_ptr->u_switch = 0;
405 (U32BIT)lnb_ptr->u_switch);
409 lnb_ptr->is_smatv = (tmp32bit ? TRUE : FALSE);
413 lnb_ptr->diseqc_repeats = (U8BIT)tmp32bit;
418 lnb_ptr->diseqc_repeats = 0;
420 (U32BIT)lnb_ptr->diseqc_repeats);
424 lnb_ptr->unicable_if = tmp32bit;
428 lnb_ptr->unicable_chan = (U8BIT)tmp32bit;
432 lnb_ptr->unicable_chan = 0;
447 while (dba_rec != NULL)
450 if (band_ptr != NULL)
455 if (parent_rec != NULL)
459 while (lnb_ptr != NULL)
461 if (lnb_ptr->dba_rec == parent_rec)
463 band_ptr->lnb = lnb_ptr;
469 if (band_ptr->lnb != NULL)
474 band_ptr->dba_rec = dba_rec;
477 band_ptr->band_params.polarity = (E_STB_DP_POLARITY)tmp32bit;
480 band_ptr->band_params.min_freq = (U16BIT)tmp32bit;
483 band_ptr->band_params.max_freq = (U16BIT)tmp32bit;
486 band_ptr->band_params.local_oscillator_frequency = (U16BIT)tmp32bit;
489 band_ptr->band_params.lnb_voltage = (E_STB_TUNE_LNB_VOLTAGE)tmp32bit;
492 band_ptr->band_params.tone_22k = (BOOLEAN)tmp32bit;
505 while (dba_rec != NULL)
515 if (parent_rec != NULL)
519 while (lnb_ptr != NULL)
521 if (lnb_ptr->dba_rec == parent_rec)
523 sat_ptr->lnb = lnb_ptr;
530 if (sat_ptr->lnb != NULL)
535 sat_ptr->dba_rec = dba_rec;
541 sat_ptr->dish_pos = (U16BIT)tmp32bit;
544 sat_ptr->east_west = (U16BIT)tmp32bit;
547 if (tmp32bit <= 1800L)
549 sat_ptr->long_pos = (U16BIT)tmp32bit;
554 sat_ptr->long_pos = (U8BIT)0;
569 while (dba_rec != NULL)
578 n_ptr->dba_rec = dba_rec;
582 if (parent_rec != NULL)
586 while (sat_ptr != NULL)
588 if (sat_ptr->dba_rec == parent_rec)
590 n_ptr->satellite = sat_ptr;
598 n_ptr->net_id = tmp32bit;
604 n_ptr->nit_version_changed = FALSE;
608 n_ptr->nit_version = (U8BIT)tmp32bit;
611 n_ptr->profile_type = tmp32bit;
613 #ifdef COMMON_INTERFACE 615 n_ptr->cicam_onet_id = tmp32bit;
618 n_ptr->cicam_identifier = tmp32bit;
625 analog_network = NULL;
627 while (dba_rec != NULL)
636 t_ptr->dba_rec = dba_rec;
640 if (parent_rec != NULL)
644 while (n_ptr != NULL)
646 if (n_ptr->dba_rec == parent_rec)
648 t_ptr->network = n_ptr;
657 if ((tmp32bit & 0x80000000L) != 0)
660 t_ptr->frequency = (tmp32bit & 0x7fffffffL);
662 t_ptr->sig_type = SIGNAL_ANALOG;
663 t_ptr->tran_id = 0xffff;
664 t_ptr->signal_level_at_search = BAD_SIGNAL_STATUS;
666 if (analog_network == NULL)
668 analog_network = t_ptr->network;
672 t_ptr->u.anal.vtype = (E_STB_DP_ANALOG_VIDEO_TYPE)tmp32bit;
675 t_ptr->u.anal.freq_offset = (S8BIT)tmp32bit;
681 t_ptr->frequency = tmp32bit;
682 t_ptr->sig_type = SIGNAL_COFDM;
685 t_ptr->u.terr.bwidth = (E_STB_DP_TBWIDTH)tmp32bit;
688 t_ptr->u.terr.tmode = (E_STB_DP_TMODE)tmp32bit;
691 t_ptr->tran_id = tmp32bit;
694 t_ptr->orig_net_id = tmp32bit;
697 t_ptr->signal_level_at_search = (U8BIT)tmp32bit;
700 t_ptr->signal_level_at_search = GET_SIGNAL_STATUS(tmp32bit, t_ptr->signal_level_at_search);
703 t_ptr->u.terr.terr_type = (E_STB_DP_TTYPE)tmp32bit;
706 t_ptr->u.terr.plp_id = (U8BIT)tmp32bit;
709 t_ptr->u.terr.constellation = TUNE_TCONST_UNDEFINED;
710 t_ptr->u.terr.hierarchy = TUNE_THIERARCHY_UNDEFINED;
711 t_ptr->u.terr.lp_code_rate = TUNE_TCODERATE_UNDEFINED;
712 t_ptr->u.terr.hp_code_rate = TUNE_TCODERATE_UNDEFINED;
713 t_ptr->u.terr.guard_int = TUNE_TGUARDINT_UNDEFINED;
717 t_ptr->sdt_version_changed = FALSE;
721 t_ptr->sdt_version = (U8BIT)tmp32bit;
724 dba_rec =
DBA_FindRecord(DBA_RECORD_TERR_TRANSPORT, NULL, dba_rec);
729 while (dba_rec != NULL)
738 t_ptr->dba_rec = dba_rec;
742 if (parent_rec != NULL)
746 while (n_ptr != NULL)
748 if (n_ptr->dba_rec == parent_rec)
750 t_ptr->network = n_ptr;
757 t_ptr->sig_type = SIGNAL_QAM;
760 t_ptr->frequency = tmp32bit;
763 t_ptr->u.cab.cmode = (E_STB_DP_TMODE)tmp32bit;
766 t_ptr->u.cab.symbol_rate = (U16BIT)tmp32bit;
769 t_ptr->tran_id = tmp32bit;
772 t_ptr->orig_net_id = tmp32bit;
775 t_ptr->signal_level_at_search = (U8BIT)tmp32bit;
778 t_ptr->signal_level_at_search = GET_SIGNAL_STATUS(tmp32bit, t_ptr->signal_level_at_search);
781 t_ptr->sdt_version_changed = FALSE;
785 t_ptr->sdt_version = (U8BIT)tmp32bit;
788 dba_rec =
DBA_FindRecord(DBA_RECORD_CAB_TRANSPORT, NULL, dba_rec);
793 while (dba_rec != NULL)
802 t_ptr->dba_rec = dba_rec;
806 if (parent_rec != NULL)
810 while (n_ptr != NULL)
812 if (n_ptr->dba_rec == parent_rec)
814 t_ptr->network = n_ptr;
822 DBG_DBDEF(
"Parent rec not found");
825 t_ptr->sig_type = SIGNAL_QPSK;
829 t_ptr->tran_id = (U16BIT)tmp32bit;
832 t_ptr->orig_net_id = (U16BIT)tmp32bit;
835 t_ptr->frequency = tmp32bit;
838 switch ((E_STB_DP_POLARITY)tmp32bit)
840 case POLARITY_HORIZONTAL:
841 case POLARITY_VERTICAL:
845 t_ptr->u.sat.polarity = (E_STB_DP_POLARITY)tmp32bit;
851 t_ptr->u.sat.polarity = POLARITY_HORIZONTAL;
853 (U32BIT)t_ptr->u.sat.polarity);
859 t_ptr->u.sat.symbol_rate = tmp32bit;
862 switch ((E_STB_DP_FEC)tmp32bit)
878 t_ptr->u.sat.fec_code = (E_STB_DP_FEC)tmp32bit;
884 t_ptr->u.sat.fec_code = FEC_AUTOMATIC;
886 (U32BIT)t_ptr->u.sat.fec_code);
892 t_ptr->u.sat.dvb_s2 = ((tmp32bit != 0) ? TRUE : FALSE);
895 t_ptr->u.sat.modulation = tmp32bit;
898 t_ptr->signal_level_at_search = (U8BIT)tmp32bit;
901 t_ptr->signal_level_at_search = GET_SIGNAL_STATUS(tmp32bit, t_ptr->signal_level_at_search);
905 t_ptr->sdt_version = (U8BIT)tmp32bit;
908 dba_rec =
DBA_FindRecord(DBA_RECORD_SAT_TRANSPORT, NULL, dba_rec);
912 num_analog_channels = 0;
914 while (dba_rec != NULL)
923 s_ptr->dba_rec = dba_rec;
927 if (parent_rec != NULL)
931 while (t_ptr != NULL)
933 if (t_ptr->dba_rec == parent_rec)
935 s_ptr->transport = t_ptr;
943 s_ptr->serv_id = (U16BIT)tmp32bit;
946 s_ptr->allocated_lcn = (U16BIT)tmp32bit;
949 s_ptr->serv_lcn = (U16BIT)tmp32bit;
952 s_ptr->serv_type = tmp32bit;
954 if (s_ptr->serv_type == ADB_SERVICE_TYPE_ANALOG)
956 num_analog_channels++;
963 s_ptr->fav_groups = (U8BIT)tmp32bit;
966 s_ptr->locked = (BOOLEAN)tmp32bit;
969 s_ptr->hidden = (BOOLEAN)tmp32bit;
972 s_ptr->selectable = (BOOLEAN)tmp32bit;
975 s_ptr->sched_disabled = (BOOLEAN)tmp32bit;
978 s_ptr->now_next_disabled = (BOOLEAN)tmp32bit;
981 s_ptr->freesat_id = (U16BIT)tmp32bit;
984 s_ptr->region_id = (U16BIT)tmp32bit;
987 s_ptr->lcn_editable = (BOOLEAN)tmp32bit;
990 s_ptr->deleted = (BOOLEAN)tmp32bit;
1001 while (dba_rec != NULL)
1010 c_ptr->dba_rec = dba_rec;
1019 c_ptr->series_flag = (tmp32bit != 0);
1022 c_ptr->recommended_flag = (tmp32bit != 0);
1025 c_ptr->do_not_delete = (tmp32bit != 0);
1028 c_ptr->eit_date = (U16BIT)tmp32bit;
1031 c_ptr->date_time = tmp32bit;
1034 c_ptr->serv_id = (U16BIT)tmp32bit;
1041 while (dba_rec != NULL)
1050 fl_ptr->dba_rec = dba_rec;
1056 fl_ptr->list_id = (U8BIT)tmp32bit;
1059 fl_ptr->index = (U8BIT)tmp32bit;
1062 fl_ptr->user_data = tmp32bit;
1073 while (dba_rec != NULL)
1082 if (parent_rec != NULL)
1086 while (s_ptr != NULL)
1088 if (s_ptr->dba_rec == parent_rec)
1090 fs_ptr->serv_ptr = s_ptr;
1098 if (fs_ptr->serv_ptr != NULL)
1100 fs_ptr->dba_rec = dba_rec;
1103 fs_ptr->list_id = (U8BIT)tmp32bit;
1106 fs_ptr->index = (U16BIT)tmp32bit;
1110 while (fl_ptr != NULL)
1112 if (fl_ptr->list_id == fs_ptr->list_id)
1143 for (fl_index = 0; fl_ptr != NULL; fl_index++)
1145 if (fl_ptr->index != fl_index)
1147 fl_ptr->index = fl_index;
1151 STB_LLSort(&fl_ptr->serv_list, FavServiceSortCompare);
1155 for (fs_index = 0; fs_ptr != NULL; fs_index++)
1157 if (fs_ptr->index != fs_index)
1159 fs_ptr->index = fs_index;
1171 while (dba_rec != NULL)
1175 if ((tmp32bit == TIMER_TYPE_ALARM) || (tmp32bit == TIMER_TYPE_SLEEP) ||
1176 (tmp32bit == TIMER_TYPE_PVR_RECORD) || (tmp32bit == TIMER_TYPE_PRIVATE))
1185 timer->dba_rec = dba_rec;
1186 timer->type = (E_TIMER_TYPE)tmp32bit;
1189 timer->handle = tmp32bit;
1193 if (timer->handle > last_timer_handle)
1195 last_timer_handle = timer->handle;
1199 timer->start_time = tmp32bit;
1202 timer->frequency = (E_TIMER_FREQ)tmp32bit;
1207 timer->missed = TRUE;
1211 timer->missed = FALSE;
1217 memcpy(timer->name, &
string[0], num_bytes);
1220 switch (timer->type)
1222 case TIMER_TYPE_ALARM:
1225 timer->u.alarm.service_id = (U16BIT)tmp32bit;
1228 timer->u.alarm.transport_id = (U16BIT)tmp32bit;
1231 timer->u.alarm.orig_net_id = (U16BIT)tmp32bit;
1233 if (timer->u.alarm.service_id != ADB_INVALID_DVB_ID)
1235 timer->u.alarm.change_service = TRUE;
1239 timer->u.alarm.change_service = FALSE;
1245 timer->u.alarm.ramp_volume = TRUE;
1249 timer->u.alarm.ramp_volume = FALSE;
1254 case TIMER_TYPE_PVR_RECORD:
1258 timer->u.record.path = INVALID_RES_ID;
1261 timer->u.record.duration = tmp32bit;
1266 timer->u.record.event_triggered = TRUE;
1269 timer->u.record.event_id = (U16BIT)tmp32bit;
1273 timer->u.record.event_triggered = FALSE;
1277 timer->u.record.service_id = (U16BIT)tmp32bit;
1280 timer->u.record.transport_id = (U16BIT)tmp32bit;
1283 timer->u.record.orig_net_id = (U16BIT)tmp32bit;
1286 timer->u.record.disk_id = (U16BIT)tmp32bit;
1291 memcpy(timer->u.record.prog_crid, &
string[0], num_bytes);
1297 timer->u.record.recommendation = TRUE;
1301 timer->u.record.recommendation = FALSE;
1307 memcpy(timer->u.record.other_crid, &
string[0], num_bytes);
1310 if (
DBA_GetFieldString(dba_rec, DBA_FIELD_TIMER_ADDITIONAL_INFO, &
string, &num_bytes) &&
1313 memcpy(timer->u.record.additional_info,
string, num_bytes);
1317 timer->u.record.start_padding = tmp32bit;
1320 timer->u.record.end_padding = tmp32bit;
1323 timer->u.record.notify_time = (U16BIT)tmp32bit;
1328 timer->u.record.do_not_delete = TRUE;
1332 timer->u.record.do_not_delete = FALSE;
1346 #ifdef COMMON_INTERFACE 1349 while (dba_rec != NULL)
1351 cicam_timer = (ADB_CICAM_TIMER_REC *)
STB_AppGetMemory(
sizeof(ADB_CICAM_TIMER_REC));
1353 cicam_timer->timer_handle = tmp32bit;
1355 cicam_timer->cicam_identifier = tmp32bit;
1365 while (s_ptr != NULL)
1367 dba_rec =
DBA_FindRecord(DBA_RECORD_EVENT, s_ptr->dba_rec, NULL);
1368 while (dba_rec != NULL)
1375 e_ptr->dba_rec = dba_rec;
1378 e_ptr->event_id = (U16BIT)tmp32bit;
1381 e_ptr->start = (U32DHMS)tmp32bit;
1384 e_ptr->duration = (U32DHMS)tmp32bit;
1387 e_ptr->version = (U8BIT)tmp32bit;
1390 e_ptr->parental_age_rating = (U8BIT)tmp32bit;
1393 e_ptr->scrambled = (tmp32bit == 0 ? FALSE : TRUE);
1396 e_ptr->subtitles_avail = (tmp32bit == 0 ? FALSE : TRUE);
1399 e_ptr->audio_desc = (tmp32bit == 0 ? FALSE : TRUE);
1402 e_ptr->has_fta_desc = (tmp32bit == 0 ? FALSE : TRUE);
1405 e_ptr->do_not_scramble = (tmp32bit == 0 ? FALSE : TRUE);
1407 for (index = 0; index < ACFG_NUM_DB_LANGUAGES; index++)
1411 if (e_ptr->name_array[index] != NULL)
1414 lang_code, &
string, &num_bytes))
1420 if (e_ptr->desc_array[index] != NULL)
1423 lang_code, &
string, &num_bytes))
1429 if (e_ptr->extended_info[index].event_text != NULL)
1432 lang_code, &
string, &num_bytes))
1434 e_ptr->extended_info[index].event_text =
DBDEF_MakeString(lang_code,
string, num_bytes);
1438 if (e_ptr->guidance[index] != NULL)
1441 lang_code, &
string, &num_bytes))
1449 if (
DBA_GetFieldData(dba_rec, DBA_FIELD_EVENT_CONTENT_DATA, &data, &data_len) &&
1454 memcpy(e_ptr->content_data, data, data_len);
1459 InsertEventInSchedule(s_ptr, e_ptr);
1462 dba_rec =
DBA_FindRecord(DBA_RECORD_EVENT, s_ptr->dba_rec, dba_rec);
1495 while (tmp_ptr != NULL)
1504 while (tmp_ptr != NULL)
1513 while (tmp_ptr != NULL)
1522 while (tmp_ptr != NULL)
1531 while (tmp_ptr != NULL)
1540 while (tmp_ptr != NULL)
1549 while (tmp_ptr != NULL)
1558 while (tmp_ptr != NULL)
1567 while (tmp_ptr != NULL)
1575 analog_network = NULL;
1576 num_analog_channels = 0;
1594 BOOLEAN delete_network;
1600 while (s_ptr != NULL)
1614 while (t_ptr != NULL)
1628 while (n_ptr != NULL)
1635 delete_network = TRUE;
1637 while ((t_ptr != NULL) && delete_network)
1639 if (t_ptr->network == n_ptr)
1642 delete_network = FALSE;
1650 DeleteNetworkRec(n_ptr);
1657 if (tuner_type == SIGNAL_ANALOG)
1659 analog_network = NULL;
1660 num_analog_channels = 0;
1666 #ifdef DEBUG_PRINT_DATABASE 1678 void DBDEF_PrintAllRecords(
void)
1682 FUNCTION_START(DBDEF_PrintAllRecords);
1688 list_ptr = DBA_FirstLnb();
1689 while (list_ptr != NULL)
1693 list_ptr = DBA_FindNext(list_ptr);
1698 list_ptr = DBA_FirstSatellite();
1699 while (list_ptr != NULL)
1703 list_ptr = DBA_FindNext(list_ptr);
1708 list_ptr = DBA_FindFirst(DBA_REC_NETWORK);
1709 while (list_ptr != NULL)
1713 list_ptr = DBA_FindNext(list_ptr);
1718 list_ptr = DBA_FindFirst(DBA_REC_TRANSPORT);
1719 while (list_ptr != NULL)
1723 list_ptr = DBA_FindNext(list_ptr);
1728 list_ptr = DBA_FindFirst(DBA_REC_SERVICE);
1729 while (list_ptr != NULL)
1733 list_ptr = DBA_FindNext(list_ptr);
1738 FUNCTION_FINISH(DBDEF_PrintAllRecords);
1760 BOOLEAN events_shared;
1768 while (fl_ptr != NULL)
1780 for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
1782 if (s_ptr->provider_array[i] != NULL)
1786 for (j = 0; j < ADB_NUM_SERV_NAME_IDS; j++)
1788 if (s_ptr->name_array[i][j] != NULL)
1793 if (s_ptr->guidance[i].text != NULL)
1799 if (s_ptr->provider_str != NULL)
1809 events_shared = FALSE;
1811 while (s2_ptr != NULL)
1813 if ((s2_ptr != s_ptr) &&
1814 (((s2_ptr->event_schedule != NULL) && (s2_ptr->event_schedule == s_ptr->event_schedule)) ||
1815 ((s2_ptr->now_event != NULL) && (s2_ptr->now_event == s_ptr->now_event)) ||
1816 ((s2_ptr->next_event != NULL) && (s2_ptr->next_event == s_ptr->next_event))))
1818 events_shared = TRUE;
1835 if (s_ptr->serv_type == ADB_SERVICE_TYPE_ANALOG)
1837 num_analog_channels--;
1839 #ifdef COMMON_INTERFACE 1840 if (s_ptr->serv_type == ADB_SERVICE_TYPE_VIRTUAL)
1866 for (num = 0; slist != NULL; num++)
1868 slist = slist->next;
1894 while (slptr != NULL)
1900 if (srec->num_tags > 0)
1904 memcpy(srec->tag_array, slptr->tag_array, srec->num_tags);
1913 srec->tag_array = NULL;
1917 srec->next = new_list;
1921 slptr = slptr->next;
1947 while (stream_rec != NULL)
1949 next_rec = stream_rec->next;
1951 if (stream_rec->tag_array != NULL)
1957 stream_rec = next_rec;
1973 if ((s_ptr->now_event != NULL) && (s_ptr->now_event->event_id == event_id))
1975 e_ptr = s_ptr->now_event;
1977 else if ((s_ptr->next_event != NULL) && (s_ptr->next_event->event_id == event_id))
1979 e_ptr = s_ptr->next_event;
1983 e_ptr = s_ptr->event_schedule;
1984 while ((e_ptr != NULL) && (e_ptr->event_id != event_id))
1986 e_ptr = e_ptr->next;
2004 U32BIT private_data_specifier)
2007 U32BIT priv_data_code;
2012 desc_ptr = start_desc;
2014 while (desc_ptr != NULL)
2016 if (private_data_specifier == 0)
2018 if ((desc_ptr->desc_data[0] == desc_tag))
2029 if (desc_ptr->desc_data[0] == PRIV_DATA_SPEC_DTAG)
2031 priv_data_code = (desc_ptr->desc_data[2] << 24) | (desc_ptr->desc_data[3] << 16) |
2032 (desc_ptr->desc_data[4] << 8) | desc_ptr->desc_data[5];
2034 else if ((desc_ptr->desc_data[0] == desc_tag) && (priv_data_code == private_data_specifier))
2041 desc_ptr = desc_ptr->next;
2058 U8BIT *text_lang_ids;
2059 U32BIT lang_code, und_lang_code;
2060 U8BIT lang_id, i, und_lang_id;
2068 ASSERT(e_ptr != NULL);
2073 if (text_lang_ids != NULL)
2075 event_desc = e_ptr->desc_list_head;
2077 und_lang_id = ACFG_INVALID_DB_LANG;
2079 if (und_lang_code != ADB_LANG_CODE_UNDEF)
2083 if (lang_id != ACFG_INVALID_DB_LANG)
2085 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
2086 ((text_lang_ids[i] != ACFG_INVALID_DB_LANG)); i++)
2088 if (lang_id == text_lang_ids[i])
2090 und_lang_id = lang_id;
2097 und_event_desc = NULL;
2099 while ((name_str == NULL) &&
2102 dptr = ReadLanguageCode(&event_desc->desc_data[2], &lang_code);
2106 if (lang_id != ACFG_INVALID_DB_LANG)
2108 for (i = 0; (i != ACFG_MAX_DB_LANG_CODES) &&
2109 (text_lang_ids[i] != ACFG_INVALID_DB_LANG) && (name_str == NULL); i++)
2111 if (lang_id == text_lang_ids[i])
2115 if (temp_str != NULL)
2123 if ((name_str == NULL) && (und_lang_id != ACFG_INVALID_DB_LANG) && (und_event_desc == NULL))
2126 if ((lang_code == ADB_LANG_CODE_UNDEF) || (lang_code == ADB_LANG_CODE_QAA))
2128 und_event_desc = event_desc;
2131 event_desc = event_desc->next;
2134 if ((name_str == NULL) && (und_event_desc != NULL))
2137 dptr = ReadLanguageCode(&und_event_desc->desc_data[2], &lang_code);
2139 if (temp_str != NULL)
2147 if (name_str == NULL)
2152 if (event_desc != NULL)
2154 dptr = ReadLanguageCode(&event_desc->desc_data[2], &lang_code);
2156 if (temp_str != NULL)
2178 U8BIT *text_lang_ids;
2179 U32BIT lang_code, und_lang_code;
2180 U8BIT lang_id, i, und_lang_id;
2188 ASSERT(e_ptr != NULL);
2193 if (text_lang_ids != NULL)
2196 event_desc = e_ptr->desc_list_head;
2198 und_lang_id = ACFG_INVALID_DB_LANG;
2200 if (und_lang_code != ADB_LANG_CODE_UNDEF)
2204 if (lang_id != ACFG_INVALID_DB_LANG)
2206 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
2207 ((text_lang_ids[i] != ACFG_INVALID_DB_LANG)); i++)
2209 if (lang_id == text_lang_ids[i])
2211 und_lang_id = lang_id;
2218 und_event_desc = NULL;
2219 while ((desc_str == NULL) &&
2222 dptr = ReadLanguageCode(&event_desc->desc_data[2], &lang_code);
2226 if (lang_id != ACFG_INVALID_DB_LANG)
2229 dptr += dptr[0] + 1;
2231 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
2232 (text_lang_ids[i] != ACFG_INVALID_DB_LANG) && (desc_str == NULL); i++)
2234 if (lang_id == text_lang_ids[i])
2238 if (temp_str != NULL)
2246 if ((desc_str == NULL) && (und_lang_id != ACFG_INVALID_DB_LANG) && (und_event_desc == NULL))
2249 if ((lang_code == ADB_LANG_CODE_UNDEF) || (lang_code == ADB_LANG_CODE_QAA))
2251 und_event_desc = event_desc;
2254 event_desc = event_desc->next;
2257 if ((desc_str == NULL) && (und_event_desc != NULL))
2260 dptr = ReadLanguageCode(&und_event_desc->desc_data[2], &lang_code);
2262 if (temp_str != NULL)
2270 if (desc_str == NULL)
2275 if (event_desc != NULL)
2277 dptr = ReadLanguageCode(&event_desc->desc_data[2], &lang_code);
2280 dptr += dptr[0] + 1;
2283 if (temp_str != NULL)
2306 U8BIT *text_lang_ids;
2308 U32BIT selected_lang_code, und_lang_code;
2309 U8BIT lang_id, i, und_lang_id;
2321 ASSERT(e_ptr != NULL);
2325 selected_event_desc = NULL;
2328 if (text_lang_ids != NULL)
2330 event_desc = e_ptr->desc_list_head;
2332 und_lang_id = ACFG_INVALID_DB_LANG;
2334 if (und_lang_code != ADB_LANG_CODE_UNDEF)
2338 if (lang_id != ACFG_INVALID_DB_LANG)
2340 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
2341 ((text_lang_ids[i] != ACFG_INVALID_DB_LANG)); i++)
2343 if (lang_id == text_lang_ids[i])
2345 und_lang_id = lang_id;
2352 und_event_desc = NULL;
2355 while ((selected_event_desc == NULL) &&
2359 if ((event_desc->desc_data[2] >> 4) == 0)
2361 dptr = ReadLanguageCode(&event_desc->desc_data[3], &lang_code);
2365 if (lang_id != ACFG_INVALID_DB_LANG)
2367 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
2368 (text_lang_ids[i] != ACFG_INVALID_DB_LANG) && (selected_event_desc == NULL); i++)
2370 if (lang_id == text_lang_ids[i])
2373 selected_event_desc = event_desc;
2377 if ((selected_event_desc == NULL) && (und_lang_id != ACFG_INVALID_DB_LANG) &&
2378 (und_event_desc == NULL))
2382 if ((lang_code == ADB_LANG_CODE_UNDEF) || (lang_code == ADB_LANG_CODE_QAA))
2384 und_event_desc = event_desc;
2388 event_desc = event_desc->next;
2390 if ((selected_event_desc == NULL) && (und_event_desc != NULL))
2392 selected_event_desc = und_event_desc;
2396 if (selected_event_desc == NULL)
2400 event_desc = e_ptr->desc_list_head;
2401 while ((selected_event_desc == NULL) &&
2405 if ((event_desc->desc_data[2] >> 4) == 0)
2407 selected_event_desc = event_desc;
2410 event_desc = event_desc->next;
2414 if (selected_event_desc != NULL)
2418 ReadLanguageCode(&selected_event_desc->desc_data[3], &selected_lang_code);
2421 event_desc = selected_event_desc;
2422 while (event_desc != NULL)
2424 end_ptr = &event_desc->desc_data[2] + event_desc->desc_data[1];
2427 dptr = &event_desc->desc_data[6] + event_desc->desc_data[6] + 1;
2431 if (dptr + dptr[0] < end_ptr)
2437 if (si_string != NULL)
2440 selected_lang_code);
2444 if ((temp_str != NULL) && (desc_str != NULL))
2449 desc_str = temp2_str;
2451 else if ((temp_str != NULL) && (desc_str == NULL))
2453 desc_str = temp_str;
2457 if ((event_desc->desc_data[2] & 0x0f) == desc_num)
2467 event_desc = event_desc->next;
2470 if ((event_desc->desc_data[2] >> 4) == desc_num)
2472 ReadLanguageCode(&event_desc->desc_data[3], &lang_code);
2473 if (lang_code == selected_lang_code)
2480 event_desc = event_desc->next;
2507 U8BIT *text_lang_ids;
2509 U32BIT selected_lang_code, und_lang_code;
2510 U8BIT lang_id, i, und_lang_id;
2515 U8BIT *item_end_ptr;
2516 U8BIT length_of_items;
2522 ASSERT(e_ptr != NULL);
2524 event_itemized_info = NULL;
2526 selected_event_desc = NULL;
2529 if (text_lang_ids != NULL)
2531 event_desc = e_ptr->desc_list_head;
2533 und_lang_id = ACFG_INVALID_DB_LANG;
2535 if (und_lang_code != ADB_LANG_CODE_UNDEF)
2539 if (lang_id != ACFG_INVALID_DB_LANG)
2541 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
2542 ((text_lang_ids[i] != ACFG_INVALID_DB_LANG)); i++)
2544 if (lang_id == text_lang_ids[i])
2546 und_lang_id = lang_id;
2552 und_event_desc = NULL;
2556 while ((selected_event_desc == NULL) &&
2560 if ((event_desc->desc_data[2] >> 4) == 0)
2562 ReadLanguageCode(&event_desc->desc_data[3], &lang_code);
2566 if (lang_id != ACFG_INVALID_DB_LANG)
2568 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
2569 (text_lang_ids[i] != ACFG_INVALID_DB_LANG) && (selected_event_desc == NULL); i++)
2571 if (lang_id == text_lang_ids[i])
2574 selected_event_desc = event_desc;
2578 if ((selected_event_desc == NULL) && (und_lang_id != ACFG_INVALID_DB_LANG) &&
2579 (und_event_desc == NULL))
2583 if ((lang_code == ADB_LANG_CODE_UNDEF) || (lang_code == ADB_LANG_CODE_QAA))
2585 und_event_desc = event_desc;
2589 event_desc = event_desc->next;
2591 if ((selected_event_desc == NULL) && (und_event_desc != NULL))
2593 selected_event_desc = und_event_desc;
2597 if (selected_event_desc == NULL)
2601 event_desc = e_ptr->desc_list_head;
2602 while ((selected_event_desc == NULL) &&
2606 if ((event_desc->desc_data[2] >> 4) == 0)
2608 selected_event_desc = event_desc;
2610 event_desc = event_desc->next;
2614 if (selected_event_desc != NULL)
2618 ReadLanguageCode(&selected_event_desc->desc_data[3], &selected_lang_code);
2621 event_desc = selected_event_desc;
2622 while (event_desc != NULL)
2624 end_ptr = &event_desc->desc_data[2] + event_desc->desc_data[1];
2627 item_dptr = &event_desc->desc_data[6];
2628 length_of_items = event_desc->desc_data[6];
2629 item_end_ptr = item_dptr + length_of_items;
2633 if ((length_of_items != 0) && (item_dptr != NULL) && (item_end_ptr < end_ptr))
2636 U8BIT *temp_item_str;
2639 while(item_dptr < item_end_ptr)
2651 if (event_itemized_info != NULL)
2655 if (item_string != NULL)
2660 selected_lang_code);
2661 event_itemized_info[index].item_description = temp_item_str;
2666 if (item_string != NULL)
2671 selected_lang_code);
2672 event_itemized_info[index].item = temp_item_str;
2680 if ((event_desc->desc_data[2] & 0x0f) == desc_num)
2690 event_desc = event_desc->next;
2693 if ((event_desc->desc_data[2] >> 4) == desc_num)
2695 ReadLanguageCode(&event_desc->desc_data[3], &lang_code);
2696 if (lang_code == selected_lang_code)
2702 event_desc = event_desc->next;
2714 *num_items_ptr = index;
2718 return(event_itemized_info);
2735 U32BIT country_code;
2738 U8BIT *text_lang_ids;
2755 if ((country_code == COUNTRY_CODE_UK) && ((t_ptr = s_ptr->transport) != NULL))
2757 if (t_ptr->sig_type == SIGNAL_COFDM)
2760 if (text_lang_ids != NULL)
2763 event_desc = e_ptr->desc_list_head;
2765 while ((text_str == NULL) &&
2767 UK_DTT_PRIVATE_DATA_CODE)) != NULL))
2769 dlen = event_desc->desc_data[1];
2770 dptr = &event_desc->desc_data[2];
2772 *type = *dptr & 0x03;
2773 if ((*type == 0) || (*type == 1))
2781 *mode = *dptr & 0x01;
2790 dptr = ReadLanguageCode(dptr, &lang_code);
2794 if (lang_id != ACFG_INVALID_DB_LANG)
2796 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
2797 (text_lang_ids[i] != ACFG_INVALID_DB_LANG) && (text_str == NULL); i++)
2799 if (lang_id == text_lang_ids[i])
2802 if (si_string != NULL)
2813 event_desc = event_desc->next;
2817 if (text_str == NULL)
2822 USER_DEFINED_DTAG_0x89, UK_DTT_PRIVATE_DATA_CODE)) != NULL)
2824 dlen = event_desc->desc_data[1];
2825 dptr = &event_desc->desc_data[2];
2827 *type = *dptr & 0x03;
2828 if ((*type == 0) || (*type == 1))
2836 *mode = *dptr & 0x01;
2845 dptr = ReadLanguageCode(dptr, &lang_code);
2849 if (si_string != NULL)
2861 if (text_str == NULL)
2893 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) && (lang_ids[i] != ACFG_INVALID_DB_LANG) &&
2894 (text_str == NULL); i++)
2896 if ((s_ptr->guidance[lang_ids[i]].text != NULL) &&
2897 ((s_ptr->guidance[lang_ids[i]].type == 0) || (s_ptr->guidance[lang_ids[i]].type == 1)))
2899 *type = s_ptr->guidance[lang_ids[i]].type;
2900 *mode = s_ptr->guidance[lang_ids[i]].mode;
2901 text_str = CopyString(s_ptr->guidance[lang_ids[i]].text, TRUE);
2941 U32BIT country_code;
2953 dlen = event_desc->desc_data[1];
2958 dptr = &event_desc->desc_data[2];
2961 dptr = ReadLanguageCode(dptr, &lang_code);
2962 if (lang_code == country_code)
2987 U8BIT stream_content;
2988 U8BIT component_type;
2997 event_desc = e_ptr->desc_list_head;
3001 stream_content = event_desc->desc_data[2] & 0x0f;
3002 component_type = event_desc->desc_data[3];
3004 if ((stream_content == 0x02) &&
3005 ((component_type == 0x40) || (component_type == 0x42) ||
3006 (component_type == 0x47) || (component_type == 0x48)))
3011 else if ((stream_content == 0x06) &&
3012 ((component_type == 0x40) || (component_type == 0x42) ||
3013 (component_type == 0x44) || (component_type == 0x46) ||
3014 ((component_type >= 0x47) && (component_type <= 0x4a))))
3020 event_desc = event_desc->next;
3047 BOOLEAN event_found;
3055 U8BIT target_id_type;
3056 U16BIT target_onet_id;
3057 U16BIT target_trans_id;
3058 U16BIT target_serv_id;
3066 event_found = FALSE;
3068 if (hd_serv_ptr != NULL)
3070 *hd_serv_ptr = NULL;
3073 if (hd_event_ptr != NULL)
3075 *hd_event_ptr = NULL;
3082 event_desc = e_ptr->desc_list_head;
3084 while (!event_found &&
3088 link_type = event_desc->desc_data[8];
3090 if ((link_type == 0x0D) || (link_type == 0x0E))
3092 dptr = &event_desc->desc_data[2];
3094 trans_id = (dptr[0] << 8) | dptr[1];
3095 onet_id = (dptr[2] << 8) | dptr[3];
3096 serv_id = (dptr[4] << 8) | dptr[5];
3098 if (link_type == 0x0D)
3107 event_id = (dptr[7] << 8) | dptr[8];
3110 if (target_event != NULL)
3112 if ((only_simulcast && ((dptr[9] & 0x40) != 0)) || !only_simulcast)
3116 if (hd_serv_ptr != NULL)
3118 *hd_serv_ptr = s_ptr;
3120 if (hd_event_ptr != NULL)
3122 *hd_event_ptr = target_event;
3129 if ((only_simulcast && ((dptr[9] & 0x40) != 0)) || !only_simulcast)
3133 if (hd_serv_ptr != NULL)
3135 *hd_serv_ptr = s_ptr;
3145 end_ptr = &dptr[8] + dptr[7];
3148 while (!event_found && (dptr < end_ptr))
3154 target_id_type = (dptr[2] & 0x0c) >> 2;
3156 if (target_id_type == 3)
3163 if (target_id_type == 1)
3168 if ((dptr[2] & 0x02) != 0)
3173 if ((dptr[2] & 0x01) != 0)
3181 if (((dptr[2] & 0x30) >> 4) == 1)
3183 if ((only_simulcast && ((dptr[2] & 0x40) != 0)) || !only_simulcast)
3185 event_id = (dptr[0] << 8) | dptr[1];
3189 if (target_id_type == 3)
3196 desc_ptr = e_ptr->desc_list_head;
3199 UK_DTT_PRIVATE_DATA_CODE)) != NULL) && (desc_ptr != event_desc))
3201 desc_ptr = desc_ptr->next;
3204 if (desc_ptr != NULL)
3208 target_serv_id = (dptr[3] << 8) | dptr[4];
3215 info_ptr = &dptr[3];
3217 target_onet_id = onet_id;
3218 target_trans_id = trans_id;
3219 target_serv_id = serv_id;
3221 if (target_id_type == 1)
3224 target_trans_id = (info_ptr[0] << 8) | info_ptr[1];
3227 if ((dptr[2] & 0x02) != 0)
3230 target_onet_id = (info_ptr[0] << 8) | info_ptr[1];
3233 if ((dptr[2] & 0x01) != 0)
3236 target_serv_id = (info_ptr[0] << 8) | info_ptr[1];
3240 target_onet_id, target_trans_id, target_serv_id);
3249 if (target_event != NULL)
3253 if (hd_serv_ptr != NULL)
3255 *hd_serv_ptr = s_ptr;
3257 if (hd_event_ptr != NULL)
3259 *hd_event_ptr = target_event;
3267 if (*hd_serv_ptr != NULL)
3269 *hd_serv_ptr = s_ptr;
3281 event_desc = event_desc->next;
3287 return(event_found);
3301 U8BIT num_components;
3312 event_desc = e_ptr->desc_list_head;
3313 while (event_desc != NULL)
3316 if (event_desc != NULL)
3319 event_desc = event_desc->next;
3323 if (num_components != 0)
3327 if (*component_list != NULL)
3330 event_desc = e_ptr->desc_list_head;
3332 while (event_desc != NULL)
3335 if (event_desc != NULL)
3337 (*component_list)[index].stream_content = event_desc->desc_data[2] & 0x0f;
3338 (*component_list)[index].component_type = event_desc->desc_data[3];
3339 (*component_list)[index].component_tag = event_desc->desc_data[4];
3340 memcpy((*component_list)[index].language_code, &event_desc->desc_data[5], 3);
3342 event_desc = event_desc->next;
3355 return(num_components);
3366 U8BIT component_type;
3375 event_desc = e_ptr->desc_list_head;
3379 if ((event_desc->desc_data[2] & 0x0f) == 0x03)
3381 component_type = event_desc->desc_data[3];
3383 if (((0x10 <= component_type) && (component_type <= 0x14)) ||
3384 ((0x20 <= component_type) && (component_type <= 0x24)))
3391 event_desc = event_desc->next;
3420 len = event_desc->desc_data[1];
3423 retval = &event_desc->desc_data[2];
3444 U8BIT content_value;
3445 U32BIT country_code;
3446 ADB_EVENT_CONTENT genre;
3447 U8BIT *conversion_array;
3451 genre = ADB_EVENT_CONTENT_UNCLASSIFIED;
3457 if (event_desc->desc_data[1] != 0)
3463 content_value = event_desc->desc_data[2] >> 4;
3464 genre = (ADB_EVENT_CONTENT)conversion_array[content_value];
3466 if (content_value == 0x0f)
3468 if ((country_code == COUNTRY_CODE_UK) && ((t_ptr = s_ptr->transport) != NULL))
3473 if (t_ptr->sig_type == SIGNAL_COFDM)
3478 UK_DTT_PRIVATE_DATA_CODE) == NULL)
3481 genre = ADB_EVENT_CONTENT_UNCLASSIFIED;
3484 else if (t_ptr->sig_type == SIGNAL_QPSK)
3489 FREESAT_PRIVATE_DATA_CODE) == NULL)
3492 genre = ADB_EVENT_CONTENT_UNCLASSIFIED;
3531 event_desc = e_ptr->desc_list_head;
3533 while ((crid_str == NULL) &&
3536 dptr = &event_desc->desc_data[2];
3537 end_ptr = dptr + event_desc->desc_data[1];
3539 while ((crid_str == NULL) && (dptr < end_ptr))
3542 if ((dptr[0] & CRID_LOCATION_MASK) == CRID_LOCATION_0)
3544 type = (dptr[0] & CRID_TYPE_MASK) >> CRID_TYPE_SHIFT;
3546 if (type == crid_type)
3548 if ((type == UK_PROGRAMME_CRID) || (type == TVA_PROGRAMME_CRID) ||
3549 (index == crids_found))
3552 if (si_string != NULL)
3561 dptr += dptr[1] + 2;
3563 else if ((dptr[0] & CRID_LOCATION_MASK) == CRID_LOCATION_1)
3573 event_desc = event_desc->next;
3602 event_desc = e_ptr->desc_list_head;
3606 dptr = &event_desc->desc_data[2];
3607 end_ptr = dptr + event_desc->desc_data[1];
3609 while (dptr < end_ptr)
3612 if ((dptr[0] & CRID_LOCATION_MASK) == CRID_LOCATION_0)
3614 type = (dptr[0] & CRID_TYPE_MASK) >> CRID_TYPE_SHIFT;
3616 if (type == crid_type)
3621 dptr += dptr[1] + 2;
3623 else if ((dptr[0] & CRID_LOCATION_MASK) == CRID_LOCATION_1)
3633 event_desc = event_desc->next;
3639 return(crids_found);
3651 U8BIT *authority_str;
3652 U8BIT *crid_str = NULL;
3657 if ((serv_ptr != NULL) && (event_str != NULL))
3659 if (*event_str ==
'/')
3664 if (authority_str != NULL)
3666 str_len = strlen((
char *)authority_str) + strlen((
char *)event_str) + 1;
3668 if (crid_str != NULL)
3670 strncpy((
char *)crid_str, (
char *)authority_str, str_len);
3671 strncat((
char *)crid_str, (
char *)event_str, str_len);
3680 str_len = strlen((
char *)event_str) + 1;
3682 if (crid_str != NULL)
3684 strncpy((
char *)crid_str, (
char *)event_str, str_len);
3714 if (s_ptr->def_authority != NULL)
3716 crid_str = CopyString(s_ptr->def_authority, FALSE);
3721 t_ptr = s_ptr->transport;
3725 if (t_ptr->def_authority != NULL)
3727 crid_str = CopyString(t_ptr->def_authority, FALSE);
3732 n_ptr = t_ptr->network;
3735 if (n_ptr->def_authority != NULL)
3737 crid_str = CopyString(n_ptr->def_authority, FALSE);
3763 while (e_ptr != NULL)
3765 next_ptr = e_ptr->next;
3767 while (e_ptr->desc_list_head != NULL)
3769 next = e_ptr->desc_list_head->next;
3771 e_ptr->desc_list_head = next;
3774 e_ptr->desc_list_tail = NULL;
3802 alt_serv_rec = aslist;
3803 while (alt_serv_rec != NULL)
3805 next_rec = alt_serv_rec->next;
3807 alt_serv_rec = next_rec;
3823 for (l_ptr = links; l_ptr != NULL; l_ptr = next_ptr)
3825 next_ptr = l_ptr->next;
3827 if (l_ptr->uri_string != NULL)
3834 for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
3856 for (icon_ptr = icon_list; icon_ptr != NULL; icon_ptr = next_ptr)
3858 next_ptr = icon_ptr->next;
3860 if (icon_ptr->destroy_func != NULL)
3863 icon_ptr->destroy_func( icon_ptr->dsm_handle );
3866 if (icon_ptr->icon_url != NULL)
3871 if (icon_ptr->icon_data != NULL)
3896 if ((str_ptr == NULL) || (nbytes == 0))
3905 string->lang_code = lang_code;
3906 string->nbytes = nbytes;
3907 string->str_ptr = ((U8BIT *)
string) +
sizeof(
ADB_STRING);
3908 memcpy(string->str_ptr, str_ptr, nbytes);
3930 if (src_str != NULL)
3932 string =
DBDEF_MakeString(src_str->lang_code, src_str->str_ptr, src_str->nbytes);
3956 nbytes = str1->nbytes;
3957 while (str1->str_ptr[nbytes - 1] ==
'\0')
3966 string->lang_code = str1->lang_code;
3967 string->nbytes = nbytes + str2->nbytes;
3968 string->str_ptr = ((U8BIT *)
string) +
sizeof(
ADB_STRING);
3970 memcpy(string->str_ptr, str1->str_ptr, nbytes);
3971 memcpy(string->str_ptr + nbytes, str2->str_ptr, str2->nbytes);
4020 if (lnb_ptr != NULL)
4026 if (dba_rec != NULL)
4028 lnb_ptr->dba_rec = dba_rec;
4031 lnb_ptr->type = type;
4036 lnb_ptr->name = name;
4095 lnb->is_22k = is_22k;
4120 lnb->is_12v = is_12v;
4145 lnb->is_pulse_posn = is_pulse_posn;
4146 retval =
DBA_SetFieldValue(lnb->dba_rec, DBA_FIELD_LNB_PULSEPOSN, (U32BIT)is_pulse_posn);
4164 FUNCTION_START(DBDEF_SetLNBDiSEqcPosition);
4170 lnb->is_diseqc_posn = is_diseqc_posn;
4171 retval =
DBA_SetFieldValue(lnb->dba_rec, DBA_FIELD_LNB_DISPOSN, (U32BIT)is_diseqc_posn);
4174 FUNCTION_FINISH(DBDEF_SetLNBDiSEqcPosition);
4195 lnb->diseqc_tone = diseqc_tone;
4196 retval =
DBA_SetFieldValue(lnb->dba_rec, DBA_FIELD_LNB_DISTONE, (U32BIT)diseqc_tone);
4220 lnb->c_switch = cswitch;
4221 retval =
DBA_SetFieldValue(lnb->dba_rec, DBA_FIELD_LNB_DISCSWITCH, (U32BIT)cswitch);
4245 lnb->u_switch = uswitch;
4246 retval =
DBA_SetFieldValue(lnb->dba_rec, DBA_FIELD_LNB_DISUSWITCH, (U32BIT)uswitch);
4270 lnb->is_smatv = is_smatv;
4271 retval =
DBA_SetFieldValue(lnb->dba_rec, DBA_FIELD_LNB_DISSMATV, (U32BIT)is_smatv);
4295 lnb->diseqc_repeats = repeats;
4296 retval =
DBA_SetFieldValue(lnb->dba_rec, DBA_FIELD_LNB_DISREPEAT, (U32BIT)repeats);
4321 lnb->unicable_if = inter_freq;
4323 lnb->unicable_chan = chan;
4324 retval =
DBA_SetFieldValue(lnb->dba_rec, DBA_FIELD_LNB_UNICABLECHAN, (U32BIT)chan);
4344 if (lnb_ptr == NULL)
4389 if (associated_lnb != NULL)
4393 while (lnb_ptr != NULL)
4395 if (lnb_ptr == associated_lnb)
4402 if (lnb_ptr != NULL)
4405 if (sat_ptr != NULL)
4409 sat_ptr->lnb = lnb_ptr;
4413 if (dba_rec != NULL)
4415 sat_ptr->dba_rec = dba_rec;
4417 if (name_str != NULL)
4419 sat_ptr->name = name_str;
4424 sat_ptr->dish_pos = dish_pos;
4427 if (long_pos <= 1800)
4429 sat_ptr->long_pos = long_pos;
4433 sat_ptr->long_pos = 0;
4439 sat_ptr->east_west = 1;
4443 sat_ptr->east_west = 0;
4475 if (sat_ptr == NULL)
4516 if (associated_lnb != NULL)
4520 while (lnb_ptr != NULL)
4522 if (lnb_ptr == associated_lnb)
4529 if (lnb_ptr != NULL)
4532 if (band_ptr != NULL)
4536 band_ptr->lnb = lnb_ptr;
4540 if (dba_rec != NULL)
4542 band_ptr->dba_rec = dba_rec;
4544 band_ptr->band_params.polarity = band_parameters->polarity;
4545 DBA_SetFieldValue(dba_rec, DBA_FIELD_BAND_POLARITY, band_ptr->band_params.polarity);
4547 band_ptr->band_params.min_freq = band_parameters->min_freq;
4548 DBA_SetFieldValue(dba_rec, DBA_FIELD_BAND_MIN_FREQUENCY, band_ptr->band_params.min_freq);
4550 band_ptr->band_params.max_freq = band_parameters->max_freq;
4551 DBA_SetFieldValue(dba_rec, DBA_FIELD_BAND_MAX_FREQUENCY, band_ptr->band_params.max_freq);
4553 band_ptr->band_params.local_oscillator_frequency =
4554 band_parameters->local_oscillator_frequency;
4556 band_ptr->band_params.local_oscillator_frequency);
4558 band_ptr->band_params.lnb_voltage = band_parameters->lnb_voltage;
4560 band_ptr->band_params.lnb_voltage);
4562 band_ptr->band_params.tone_22k = band_parameters->tone_22k;
4563 DBA_SetFieldValue(dba_rec, DBA_FIELD_BAND_22_KHZ, band_ptr->band_params.tone_22k);
4593 if (band_ptr == NULL)
4615 if (band_ptr != NULL)
4657 if (satellite != NULL)
4659 n_ptr->satellite = satellite;
4667 if (dba_rec != NULL)
4669 n_ptr->dba_rec = dba_rec;
4672 n_ptr->net_id = net_id;
4675 n_ptr->profile_type = ADB_PROFILE_TYPE_BROADCAST;
4676 DBA_SetFieldValue(dba_rec, DBA_FIELD_PROFILE_TYPE, (U32BIT)n_ptr->profile_type);
4699 DeleteNetworkRec(n_ptr);
4711 U16BIT new_name_len;
4723 if (n_ptr->name_str != NULL)
4725 if (new_name_len == n_ptr->name_str->nbytes)
4728 if (memcmp(name, n_ptr->name_str->str_ptr, new_name_len) == 0)
4739 if (n_ptr->name_str != NULL)
4742 n_ptr->name_str = NULL;
4750 if (n_ptr->name_str != NULL)
4753 n_ptr->name_str->nbytes);
4779 while (n_ptr != NULL)
4782 ((satellite == NULL) || (n_ptr->satellite == satellite)))
4888 t_ptr->network = network;
4891 if ((freq_hz & 0x80000000L) != 0)
4894 t_ptr->sig_type = SIGNAL_ANALOG;
4895 t_ptr->frequency = (freq_hz & 0x7fffffffL);
4899 t_ptr->sig_type = SIGNAL_COFDM;
4900 t_ptr->frequency = freq_hz;
4902 t_ptr->u.terr.plp_id = plp_id;
4905 t_ptr->u.terr.constellation = TUNE_TCONST_UNDEFINED;
4906 t_ptr->u.terr.hierarchy = TUNE_THIERARCHY_UNDEFINED;
4907 t_ptr->u.terr.lp_code_rate = TUNE_TCODERATE_UNDEFINED;
4908 t_ptr->u.terr.hp_code_rate = TUNE_TCODERATE_UNDEFINED;
4909 t_ptr->u.terr.guard_int = TUNE_TGUARDINT_UNDEFINED;
4912 if (network != NULL)
4914 dba_network = network->dba_rec;
4923 if (dba_rec != NULL)
4925 t_ptr->dba_rec = dba_rec;
4959 while (t_ptr != NULL)
4961 if ((t_ptr->sig_type == SIGNAL_COFDM) &&
4962 (t_ptr->frequency == freq_hz) &&
4963 (t_ptr->u.terr.plp_id == plp_id))
4995 t_ptr->network = network;
4996 t_ptr->sig_type = SIGNAL_QAM;
4997 t_ptr->frequency = freq_hz;
4998 t_ptr->u.cab.symbol_rate = symbol_rate;
5000 if (network != NULL)
5002 dba_network = network->dba_rec;
5011 if (dba_rec != NULL)
5013 t_ptr->dba_rec = dba_rec;
5047 while (t_ptr != NULL)
5049 if ((t_ptr->sig_type == SIGNAL_QAM) && (t_ptr->frequency == freq_hz) &&
5050 (symbol_rate == SYMBOL_RATE_AUTO ||
5051 (t_ptr->u.cab.symbol_rate == SYMBOL_RATE_AUTO) ||
5052 (t_ptr->u.cab.symbol_rate == symbol_rate)))
5064 void DBDEF_SetCableTransportSymbolRate(
ADB_TRANSPORT_REC *t_ptr, U16BIT symbol_rate)
5066 FUNCTION_START(DBDEF_SetCableTransportSymbolRate);
5068 if (t_ptr->u.cab.symbol_rate != symbol_rate)
5070 t_ptr->u.cab.symbol_rate = symbol_rate;
5071 DBA_SetFieldValue(t_ptr->dba_rec, DBA_FIELD_TRAN_SRATE, t_ptr->u.cab.symbol_rate);
5075 FUNCTION_FINISH(DBDEF_SetCableTransportSymbolRate);
5078 void DBDEF_SetCableTransportMode(
ADB_TRANSPORT_REC *t_ptr, E_STB_DP_CMODE cmode)
5080 FUNCTION_START(DBDEF_SetCableTransportMode);
5082 if (t_ptr->u.cab.cmode != cmode)
5084 t_ptr->u.cab.cmode = cmode;
5089 FUNCTION_FINISH(DBDEF_SetCableTransportMode);
5103 E_STB_DP_POLARITY polarity, BOOLEAN dvb_s2, E_STB_DP_MODULATION modulation,
5117 t_ptr->network = network;
5118 t_ptr->sig_type = SIGNAL_QPSK;
5119 t_ptr->frequency = freq_hz;
5120 t_ptr->u.sat.symbol_rate = symbol_rate;
5121 t_ptr->u.sat.polarity = polarity;
5122 t_ptr->u.sat.dvb_s2 = dvb_s2;
5123 t_ptr->u.sat.modulation = modulation;
5125 if (network != NULL)
5127 dba_network = network->dba_rec;
5136 if (dba_rec != NULL)
5138 t_ptr->dba_rec = dba_rec;
5171 E_STB_DP_POLARITY polarity, BOOLEAN dvb_s2, E_STB_DP_MODULATION modulation,
void *satellite)
5178 while (t_ptr != NULL)
5180 if (t_ptr->sig_type == SIGNAL_QPSK)
5182 if ((t_ptr->frequency == freq_hz) && (t_ptr->u.sat.symbol_rate == symbol_rate) &&
5183 (t_ptr->u.sat.polarity == polarity) && (t_ptr->u.sat.dvb_s2 == dvb_s2) &&
5184 (t_ptr->u.sat.modulation == modulation))
5186 if ((satellite == NULL) ||
5187 ((t_ptr->network != NULL) &&
5188 (t_ptr->network->satellite != NULL) &&
5189 (t_ptr->network->satellite == satellite)))
5203 #ifdef COMMON_INTERFACE 5215 FUNCTION_START(DBDEF_AddVirtualTransportRec);
5222 t_ptr->network = network;
5224 t_ptr->sig_type = SIGNAL_NONE;
5226 if (network != NULL)
5228 dba_network = network->dba_rec;
5237 if (dba_rec != NULL)
5239 t_ptr->dba_rec = dba_rec;
5255 FUNCTION_FINISH(DBDEF_AddVirtualTransportRec);
5272 U16BIT symbol_rate, E_STB_DP_POLARITY polarity, BOOLEAN dvb_s2, E_STB_DP_MODULATION modulation,
5279 if ((network != NULL) && (t_ptr->network != network))
5281 t_ptr->network = network;
5285 t_ptr->frequency = freq_hz;
5288 t_ptr->u.sat.symbol_rate = symbol_rate;
5291 t_ptr->u.sat.polarity = polarity;
5294 t_ptr->u.sat.dvb_s2 = dvb_s2;
5297 t_ptr->u.sat.modulation = modulation;
5315 U32BIT onet_id, U32BIT tran_id)
5331 while (t_ptr != NULL)
5335 if (((tran_id == ADB_INVALID_DVB_ID) || (t_ptr->tran_id == tran_id)) &&
5336 ((onet_id == ADB_INVALID_DVB_ID) || (t_ptr->orig_net_id == onet_id)))
5338 n_ptr = t_ptr->network;
5340 if ((net_id == ADB_INVALID_DVB_ID) || (n_ptr == NULL))
5345 else if (n_ptr != NULL)
5347 if (n_ptr->net_id == net_id)
5372 if (t_ptr->tran_id != tran_id)
5374 t_ptr->tran_id = tran_id;
5391 if (t_ptr->orig_net_id != orig_net_id)
5393 t_ptr->orig_net_id = orig_net_id;
5414 *num_freqs = t_ptr->num_additional_frequencies;
5415 *freqs = t_ptr->additional_frequencies;
5440 while (s_ptr != NULL)
5458 if (t_ptr->additional_frequencies != NULL)
5489 pmt_ver_rec = t_ptr->pmt_version_list;
5490 while (pmt_ver_rec != NULL)
5492 tmp_ptr = (
void *)pmt_ver_rec;
5493 pmt_ver_rec = pmt_ver_rec->next;
5496 t_ptr->pmt_version_list = NULL;
5508 U16BIT num_services;
5514 for (num_services = 0; serv_ptr != NULL; )
5516 if (!serv_ptr->deleted)
5526 return(num_services);
5550 while ((serv_ptr != NULL) && serv_ptr->deleted)
5581 while ((serv_ptr != NULL) && serv_ptr->deleted)
5601 void *trans_dba_rec;
5610 s_ptr->reqd_audio_pid = 0x1FFF;
5612 trans_dba_rec = NULL;
5615 trans_dba_rec = t_ptr->dba_rec;
5620 if (serv_dba_rec != NULL)
5622 s_ptr->dba_rec = serv_dba_rec;
5623 s_ptr->transport = t_ptr;
5625 s_ptr->serv_id = serv_id;
5628 s_ptr->freesat_id = INVALID_FREESAT_SERV_ID;
5629 DBA_SetFieldValue(serv_dba_rec, DBA_FIELD_SERV_FREESAT_ID, (U32BIT)s_ptr->freesat_id);
5631 s_ptr->lcn_editable = TRUE;
5632 DBA_SetFieldValue(serv_dba_rec, DBA_FIELD_SERV_LCN_EDITABLE, (U32BIT)s_ptr->lcn_editable);
5635 s_ptr->hidden = FALSE;
5638 s_ptr->selectable = TRUE;
5673 s_ptr->serv_type = orig_serv->serv_type;
5676 if (s_ptr->serv_type == ADB_SERVICE_TYPE_ANALOG)
5678 num_analog_channels++;
5681 s_ptr->serv_lcn = orig_serv->serv_lcn;
5684 s_ptr->allocated_lcn = orig_serv->allocated_lcn;
5690 s_ptr->name_str->nbytes);
5693 s_ptr->fav_groups = orig_serv->fav_groups;
5694 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_FAV_GROUPS, s_ptr->fav_groups);
5696 s_ptr->locked = orig_serv->locked;
5699 s_ptr->hidden = orig_serv->hidden;
5702 s_ptr->selectable = orig_serv->selectable;
5703 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_SELECTABLE, s_ptr->selectable);
5705 s_ptr->lcn_editable = orig_serv->lcn_editable;
5706 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_LCN_EDITABLE, s_ptr->lcn_editable);
5708 s_ptr->sched_disabled = orig_serv->sched_disabled;
5709 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_SCHED_DISABLED, s_ptr->sched_disabled);
5711 s_ptr->now_next_disabled = orig_serv->now_next_disabled;
5712 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_NOWNEXT_DISABLED, s_ptr->now_next_disabled);
5714 s_ptr->freesat_id = orig_serv->freesat_id;
5715 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_FREESAT_ID, s_ptr->freesat_id);
5717 s_ptr->region_id = orig_serv->region_id;
5720 s_ptr->deleted = orig_serv->deleted;
5726 for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
5728 for (j = 0; j < ADB_NUM_SERV_NAME_IDS; j++)
5733 s_ptr->short_name_array[i] =
DBDEF_CopyString(orig_serv->short_name_array[i]);
5736 s_ptr->guidance[i].type = orig_serv->guidance[i].type;
5737 s_ptr->guidance[i].mode = orig_serv->guidance[i].mode;
5740 s_ptr->scrambled = orig_serv->scrambled;
5742 s_ptr->eit_now_next_avail = orig_serv->eit_now_next_avail;
5743 s_ptr->eit_sched_avail = orig_serv->eit_sched_avail;
5745 s_ptr->running_status = orig_serv->running_status;
5746 s_ptr->not_running = orig_serv->not_running;
5747 s_ptr->unavailable = orig_serv->unavailable;
5748 s_ptr->has_fta_desc = orig_serv->has_fta_desc;
5749 s_ptr->do_not_scramble = orig_serv->do_not_scramble;
5755 s_ptr->pcr_pid = orig_serv->pcr_pid;
5756 s_ptr->video_pid = orig_serv->video_pid;
5757 s_ptr->audio_pid = orig_serv->audio_pid;
5758 s_ptr->ad_pid = orig_serv->ad_pid;
5759 s_ptr->ttext_pid = orig_serv->ttext_pid;
5760 s_ptr->ttext_mag = orig_serv->ttext_mag;
5761 s_ptr->ttext_page = orig_serv->ttext_page;
5762 s_ptr->subtitle_pid = orig_serv->subtitle_pid;
5763 s_ptr->subtitle_cpage = orig_serv->subtitle_cpage;
5764 s_ptr->subtitle_apage = orig_serv->subtitle_apage;
5765 s_ptr->video_type = orig_serv->video_type;
5766 s_ptr->audio_type = orig_serv->audio_type;
5786 U16BIT new_name_len;
5798 if (s_ptr->name_str != NULL)
5800 if (new_name_len == s_ptr->name_str->nbytes)
5803 if (memcmp(name, s_ptr->name_str->str_ptr, new_name_len) == 0)
5814 if (s_ptr->name_str != NULL)
5817 s_ptr->name_str = NULL;
5825 if (s_ptr->name_str != NULL)
5828 s_ptr->name_str->nbytes);
5853 U16BIT new_name_len;
5865 if (s_ptr->short_name_str != NULL)
5867 if (new_name_len == s_ptr->short_name_str->nbytes)
5870 if (memcmp(name, s_ptr->short_name_str->str_ptr, new_name_len) == 0)
5877 else if (name == NULL)
5886 if (s_ptr->short_name_str != NULL)
5889 s_ptr->short_name_str = NULL;
5913 U16BIT new_name_len;
5925 if (s_ptr->provider_str != NULL)
5927 if (new_name_len == s_ptr->provider_str->nbytes)
5930 if (memcmp(name, s_ptr->provider_str->str_ptr, new_name_len) == 0)
5937 else if (name == NULL)
5946 if (s_ptr->provider_str != NULL)
5949 s_ptr->provider_str = NULL;
5977 if (s_ptr->serv_type != serv_type)
5979 s_ptr->serv_type = serv_type;
6005 e_ptr = s_ptr->event_schedule;
6006 while (e_ptr != NULL)
6008 if (e_ptr->dba_rec == NULL)
6013 if (e_ptr->dba_rec != NULL)
6020 DBA_SetFieldValue(e_ptr->dba_rec, DBA_FIELD_EVENT_AGE_RATING, e_ptr->parental_age_rating);
6022 DBA_SetFieldValue(e_ptr->dba_rec, DBA_FIELD_EVENT_SUBTITLES, e_ptr->subtitles_avail);
6023 DBA_SetFieldValue(e_ptr->dba_rec, DBA_FIELD_EVENT_AUDIO_DESC, e_ptr->audio_desc);
6024 DBA_SetFieldValue(e_ptr->dba_rec, DBA_FIELD_EVENT_FREE_TO_AIR, e_ptr->has_fta_desc);
6025 DBA_SetFieldValue(e_ptr->dba_rec, DBA_FIELD_EVENT_DO_NOT_SCRAMBLE, e_ptr->do_not_scramble);
6027 for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
6029 if (e_ptr->name_array[i] != NULL)
6032 e_ptr->name_array[i]->lang_code, e_ptr->name_array[i]->str_ptr,
6033 e_ptr->name_array[i]->nbytes);
6036 if (e_ptr->desc_array[i] != NULL)
6039 e_ptr->desc_array[i]->lang_code, e_ptr->desc_array[i]->str_ptr,
6040 e_ptr->desc_array[i]->nbytes);
6043 if (e_ptr->extended_info[i].event_text != NULL)
6046 e_ptr->extended_info[i].event_text->lang_code,
6047 e_ptr->extended_info[i].event_text->str_ptr,
6048 e_ptr->extended_info[i].event_text->nbytes);
6051 if (e_ptr->guidance[i] != NULL)
6054 e_ptr->guidance[i]->lang_code, e_ptr->guidance[i]->str_ptr,
6055 e_ptr->guidance[i]->nbytes);
6059 if ((e_ptr->content_data != NULL) && (e_ptr->content_len > 0))
6061 DBA_SetFieldData(e_ptr->dba_rec, DBA_FIELD_EVENT_CONTENT_DATA, e_ptr->content_data,
6062 e_ptr->content_len);
6068 e_ptr = e_ptr->next;
6071 USE_UNWANTED_PARAM(s_ptr);
6099 while (serv_ptr != NULL)
6101 if ((serv_ptr->transport == t_ptr) && !serv_ptr->deleted)
6126 while (s_ptr != NULL)
6128 if ((s_ptr->serv_id == serv_id) && (s_ptr->transport == t_ptr))
6151 U32BIT tran_id, U32BIT serv_id)
6168 while (s_ptr != NULL)
6170 if ((serv_id == ADB_INVALID_DVB_ID) || (s_ptr->serv_id == serv_id))
6172 t_ptr = s_ptr->transport;
6177 if (((tran_id == ADB_INVALID_DVB_ID) || (t_ptr->tran_id == tran_id)) &&
6178 ((onet_id == ADB_INVALID_DVB_ID) || (t_ptr->orig_net_id == onet_id)))
6180 if (net_id == ADB_INVALID_DVB_ID)
6187 n_ptr = t_ptr->network;
6190 if (n_ptr->net_id == net_id)
6225 while (s_ptr != NULL)
6227 if ((allocated_lcn && (s_ptr->allocated_lcn == lcn)) ||
6228 (!allocated_lcn && (s_ptr->serv_lcn == lcn)))
6232 if ((t_ptr == NULL) || (t_ptr == s_ptr->transport))
6267 while (s_ptr != NULL)
6269 if (s_ptr->freesat_id == freesat_id)
6302 BOOLEAN found_primary;
6307 found_primary = FALSE;
6311 a_pid = GetReqdAudioPid(s_ptr, audio_mode, audio_type, db_lang_ids, &found_primary, &selected_stream);
6316 selected_stream->in_use = TRUE;
6322 a_pid = GetReqdAudioPid(s_ptr, audio_mode, audio_type, db_lang_ids, &found_primary, &selected_stream);
6323 if (selected_stream != NULL)
6325 selected_stream->in_use = TRUE;
6362 ad_pid = GetReqdADPid(s_ptr, ad_mode, db_lang_ids, &selected_stream, broadcast_mix);
6363 if (selected_stream != NULL)
6365 selected_stream->in_use = TRUE;
6366 *ad_type = selected_stream->type;
6373 ad_pid = GetReqdADPid(s_ptr, ad_mode, db_lang_ids, &selected_stream, broadcast_mix);
6374 if (selected_stream != NULL)
6376 selected_stream->in_use = TRUE;
6377 *ad_type = selected_stream->type;
6405 U8BIT *magazine, U8BIT *page)
6408 BOOLEAN found_primary;
6409 E_STREAM_MATCH_TYPE match_type;
6414 found_primary = FALSE;
6418 match_type = GetReqdTtextParams(s_ptr, pid_ptr, for_subtitles, magazine, page, db_lang_ids,
6419 &found_primary, &selected_stream);
6423 selected_stream->in_use = TRUE;
6430 match_type = GetReqdTtextParams(s_ptr, pid_ptr, for_subtitles, magazine, page, db_lang_ids,
6431 &found_primary, &selected_stream);
6432 if (selected_stream != NULL)
6434 selected_stream->in_use = TRUE;
6443 match_type = STREAM_MATCH_NONE;
6444 if (selected_stream != NULL)
6446 selected_stream->in_use = FALSE;
6473 U16BIT *cpage_ptr, U16BIT *apage_ptr)
6476 BOOLEAN found_primary;
6477 E_STREAM_MATCH_TYPE match_type;
6482 found_primary = FALSE;
6485 match_type = GetReqdSubtitleParams(s_ptr, pid_ptr, cpage_ptr, apage_ptr, db_lang_ids,
6486 &found_primary, &selected_stream);
6491 selected_stream->in_use = TRUE;
6498 match_type = GetReqdSubtitleParams(s_ptr, pid_ptr, cpage_ptr, apage_ptr, db_lang_ids,
6499 &found_primary, &selected_stream);
6500 if (selected_stream != NULL)
6502 selected_stream->in_use = TRUE;
6511 match_type = STREAM_MATCH_NONE;
6512 if (selected_stream != NULL)
6514 selected_stream->in_use = FALSE;
6540 *video_type = ADB_VIDEO_STREAM;
6546 stream_rec = s_ptr->stream_list;
6547 while (stream_rec != NULL)
6549 if (IsVideoStreamType(stream_rec->type))
6552 stream_rec->in_use = FALSE;
6554 if ((best_stream == NULL || stream_rec->type > best_stream->type))
6558 best_stream = stream_rec;
6562 stream_rec = stream_rec->next;
6565 if (best_stream != NULL)
6567 video_pid = best_stream->pid;
6568 *video_type = best_stream->type;
6569 best_stream->in_use = TRUE;
6609 if ((s_ptr->now_event != NULL) &&
6611 USER_DEFINED_DTAG_0x85, 0)) != NULL))
6613 if (event_desc->desc_data[1] == 1)
6615 pref_name_id = event_desc->desc_data[2];
6623 if (lang_ids != NULL)
6625 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
6626 (lang_ids[i] != ACFG_INVALID_DB_LANG) && (name_str == NULL); i++)
6628 name_str = s_ptr->name_array[lang_ids[i]][pref_name_id];
6631 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
6632 (lang_ids[i] != ACFG_INVALID_DB_LANG) && (name_str == NULL); i++)
6634 name_str = s_ptr->name_array[lang_ids[i]][0];
6639 if (name_str == NULL)
6643 if (s_ptr->short_name_str != NULL)
6645 name_str = s_ptr->short_name_str;
6648 if (name_str == NULL)
6653 if (lang_ids != NULL)
6655 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
6656 (lang_ids[i] != ACFG_INVALID_DB_LANG) && (name_str == NULL); i++)
6658 name_str = s_ptr->short_name_array[lang_ids[i]];
6664 if (name_str == NULL)
6667 name_str = s_ptr->name_str;
6696 if (lang_ids != NULL)
6698 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) &&
6699 (lang_ids[i] != ACFG_INVALID_DB_LANG) && (name_str == NULL); i++)
6701 name_str = s_ptr->provider_array[lang_ids[i]];
6705 if (name_str == NULL)
6707 name_str = s_ptr->provider_str;
6725 s_ptr->deleted = deleted;
6739 U16BIT num_services;
6745 for (num_services = 0; serv_ptr != NULL; )
6747 if ((tuner_type == SIGNAL_NONE) ||
6748 ((serv_ptr->transport != NULL) && (serv_ptr->transport->sig_type == tuner_type)))
6750 if (serv_ptr->deleted)
6761 return(num_services);
6774 U16BIT num_services;
6784 if (*slist_ptr != NULL)
6787 for (num_services = 0; serv_ptr != NULL; )
6789 if ((tuner_type == SIGNAL_NONE) ||
6790 ((serv_ptr->transport != NULL) && (serv_ptr->transport->sig_type == tuner_type)))
6792 if (serv_ptr->deleted)
6794 (*slist_ptr)[num_services] = serv_ptr;
6810 return(num_services);
6831 U8BIT temp_buff[10];
6840 if (analog_network == NULL)
6846 if (analog_network != NULL)
6854 t_ptr->sig_type = SIGNAL_ANALOG;
6857 t_ptr->tran_id = 0xffff;
6858 t_ptr->signal_level_at_search = BAD_SIGNAL_STATUS;
6864 s_ptr->serv_type = ADB_SERVICE_TYPE_ANALOG;
6868 num_analog_channels++;
6869 chan_num = 900 + num_analog_channels;
6870 s_ptr->allocated_lcn = chan_num;
6873 name_len = snprintf((
char *)temp_buff, 10,
"%02d", num_analog_channels);
6876 s_ptr->name_str->nbytes);
6914 if ((s_ptr->name_str != NULL) && (new_name != NULL))
6916 if (s_ptr->name_str->nbytes == new_len)
6918 tmp_s32bit = memcmp(s_ptr->name_str->str_ptr, new_name, new_len);
6919 if (tmp_s32bit == 0)
6925 if (changed == TRUE)
6928 if (s_ptr->name_str != NULL)
6931 s_ptr->name_str = NULL;
6934 if (new_name != NULL)
6938 s_ptr->name_str->nbytes);
6964 s_ptr->pmt_pid = pmt_pid;
6988 pmt_pid = s_ptr->pmt_pid;
7007 s_ptr->fav_groups = groups;
7008 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_FAV_GROUPS, s_ptr->fav_groups);
7020 STB_LLSort(&service_rec_list, LcnSortCompareFunc);
7040 U32BIT country_code;
7041 AllocLcnFunc func_ptr;
7042 BOOLEAN duplicate_lcn_found;
7069 if (func_ptr != NULL)
7071 duplicate_lcn_found = func_ptr(tuner_type);
7077 while (s_ptr != NULL)
7079 if (s_ptr->allocated_lcn != s_ptr->old_allocated_lcn)
7091 while (s_ptr != NULL)
7093 s_ptr->allocated_lcn = 0;
7100 duplicate_lcn_found = FALSE;
7105 return(duplicate_lcn_found);
7108 BOOLEAN DBDEF_AllocateLcnsDefault(E_STB_DP_SIGNAL_TYPE tuner_type)
7113 U16BIT first_unallocated_lcn;
7114 U16BIT next_allocated_lcn;
7115 U16BIT last_allocated_lcn;
7118 BOOLEAN duplicate_lcn_found;
7120 FUNCTION_START(DBDEF_AllocateLcnsDefault);
7124 next_allocated_lcn = first_unallocated_lcn;
7128 while (s1_ptr != NULL)
7130 s1_ptr->old_allocated_lcn = s1_ptr->allocated_lcn;
7131 if ((s1_ptr->allocated_lcn >= next_allocated_lcn) && (s1_ptr->allocated_lcn < last_allocated_lcn))
7133 next_allocated_lcn = s1_ptr->allocated_lcn + 1;
7138 duplicate_lcn_found = FALSE;
7141 while (s1_ptr != NULL)
7144 if (s1_ptr->serv_lcn == 0)
7147 if (s1_ptr->allocated_lcn == 0)
7150 s1_ptr->allocated_lcn = next_allocated_lcn;
7151 next_allocated_lcn++;
7154 else if ((s1_ptr->allocated_lcn == 0) || (s1_ptr->allocated_lcn >= first_unallocated_lcn))
7160 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7165 t_ptr = s1_ptr->transport;
7168 s1_strength = t_ptr->signal_level_at_search;
7176 while (s2_ptr != NULL)
7178 if ((s1_ptr->serv_lcn == s2_ptr->serv_lcn) && (s1_ptr != s2_ptr))
7180 duplicate_lcn_found = TRUE;
7184 t_ptr = s2_ptr->transport;
7187 s2_strength = t_ptr->signal_level_at_search;
7190 if (s1_strength < s2_strength)
7194 s1_ptr->allocated_lcn = next_allocated_lcn;
7195 next_allocated_lcn++;
7201 if (s2_ptr->allocated_lcn == s2_ptr->serv_lcn)
7203 if (s2_ptr->unavailable == FALSE)
7208 s1_ptr->allocated_lcn = next_allocated_lcn;
7209 next_allocated_lcn++;
7216 s2_ptr->allocated_lcn = next_allocated_lcn;
7217 next_allocated_lcn++;
7228 FUNCTION_FINISH(DBDEF_AllocateLcnsDefault);
7230 return(duplicate_lcn_found);
7234 BOOLEAN DBDEF_AllocateLcnsUK(E_STB_DP_SIGNAL_TYPE tuner_type)
7239 U16BIT next_allocated_lcn;
7240 U16BIT first_unallocated_lcn, reqd_lcn;
7243 BOOLEAN duplicate_lcn_found;
7244 BOOLEAN lcn_assigned, visible;
7245 S16BIT onid1, onid2;
7247 FUNCTION_START(DBDEF_AllocateLcnsUK);
7251 next_allocated_lcn = first_unallocated_lcn;
7252 duplicate_lcn_found = FALSE;
7255 while (s1_ptr != NULL)
7259 if (s1_ptr->serv_lcn == 0)
7263 if ((s1_ptr->allocated_lcn == 0) || (s1_ptr->allocated_lcn >= first_unallocated_lcn))
7265 s1_ptr->allocated_lcn = next_allocated_lcn;
7266 next_allocated_lcn++;
7269 else if ((s1_ptr->allocated_lcn == 0) || (s1_ptr->allocated_lcn >= first_unallocated_lcn))
7275 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7280 t_ptr = s1_ptr->transport;
7283 s1_strength = t_ptr->signal_level_at_search;
7291 while (s2_ptr != NULL)
7294 if ((s1_ptr->serv_lcn == s2_ptr->serv_lcn) && (s1_ptr != s2_ptr))
7296 duplicate_lcn_found = TRUE;
7297 lcn_assigned = FALSE;
7299 if (tuner_type == SIGNAL_COFDM)
7301 if (!ApplyTargetRegionRules(s1_ptr, s2_ptr, &next_allocated_lcn, &lcn_assigned))
7306 if (lcn_assigned == TRUE)
7310 if (s1_ptr->transport != NULL)
7312 onid1 = s1_ptr->transport->orig_net_id;
7314 if (s2_ptr->transport != NULL)
7316 onid2 = s2_ptr->transport->orig_net_id;
7319 if ((s1_ptr->serv_id == s2_ptr->serv_id) && (onid1 == onid2) && (onid1 != -1))
7322 if (s1_ptr->allocated_lcn >= first_unallocated_lcn)
7326 else if (s2_ptr->allocated_lcn >= first_unallocated_lcn)
7328 if (s2_ptr == next_s1_ptr)
7342 t_ptr = s2_ptr->transport;
7345 s2_strength = t_ptr->signal_level_at_search;
7348 if (s1_strength < s2_strength)
7352 s1_ptr->allocated_lcn = next_allocated_lcn;
7353 next_allocated_lcn++;
7359 if (s2_ptr->allocated_lcn == s2_ptr->serv_lcn)
7361 if (s2_ptr->unavailable == FALSE)
7366 s1_ptr->allocated_lcn = next_allocated_lcn;
7367 next_allocated_lcn++;
7374 s2_ptr->allocated_lcn = next_allocated_lcn;
7375 next_allocated_lcn++;
7381 s2_ptr = next_s2_ptr;
7384 s1_ptr = next_s1_ptr;
7389 while (s1_ptr != NULL)
7391 if ((s1_ptr->allocated_lcn < first_unallocated_lcn) && (s1_ptr->hd_lcn_desc != NULL))
7393 reqd_lcn = s1_ptr->hd_lcn_desc->serv_lcn;
7394 if (reqd_lcn != s1_ptr->serv_lcn)
7397 while (s2_ptr != NULL)
7399 if (reqd_lcn == s2_ptr->serv_lcn)
7403 s2_ptr->old_allocated_lcn = s2_ptr->allocated_lcn;
7404 s2_ptr->allocated_lcn = s1_ptr->allocated_lcn;
7410 s1_ptr->old_allocated_lcn = s1_ptr->allocated_lcn;
7411 s1_ptr->allocated_lcn = reqd_lcn;
7415 visible = !s1_ptr->hidden;
7416 if (s1_ptr->hd_lcn_desc->visible != visible)
7418 if (s1_ptr->hd_lcn_desc->visible)
7420 s1_ptr->hidden = FALSE;
7425 s1_ptr->hidden = TRUE;
7432 s1_ptr->selectable = TRUE;
7440 FUNCTION_FINISH(DBDEF_AllocateLcnsUK);
7442 return(duplicate_lcn_found);
7447 #ifdef COUNTRY_FINLAND 7448 BOOLEAN DBDEF_AllocateLcnsFinland(E_STB_DP_SIGNAL_TYPE tuner_type)
7453 U16BIT next_allocated_lcn;
7454 U16BIT last_allocated_lcn;
7457 BOOLEAN duplicate_lcn_found;
7458 BOOLEAN lcn_assigned;
7460 FUNCTION_START(DBDEF_AllocateLcnsFinland);
7464 next_allocated_lcn = FindLargestLcnNumber(tuner_type, FINLAND_ONID) + 1;
7468 while (s1_ptr != NULL)
7470 s1_ptr->old_allocated_lcn = s1_ptr->allocated_lcn;
7474 if (s1_ptr->transport->orig_net_id != FINLAND_ONID)
7476 s1_ptr->allocated_lcn = 0;
7478 if ((s1_ptr->allocated_lcn >= next_allocated_lcn) && (s1_ptr->allocated_lcn < last_allocated_lcn))
7480 next_allocated_lcn = s1_ptr->allocated_lcn + 1;
7485 duplicate_lcn_found = FALSE;
7488 while (s1_ptr != NULL)
7491 if (s1_ptr->serv_lcn == 0)
7494 s1_ptr->allocated_lcn = next_allocated_lcn;
7495 next_allocated_lcn++;
7497 else if (s1_ptr->allocated_lcn == 0)
7503 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7507 t_ptr = s1_ptr->transport;
7511 if (tuner_type == SIGNAL_COFDM)
7516 if (t_ptr->orig_net_id != FINLAND_ONID)
7518 s1_ptr->allocated_lcn = next_allocated_lcn;
7519 next_allocated_lcn++;
7523 s1_strength = t_ptr->signal_level_at_search;
7531 while (s2_ptr != NULL)
7533 if ((s1_ptr->serv_lcn == s2_ptr->serv_lcn) && (s1_ptr != s2_ptr))
7536 if ((s1_ptr->transport->orig_net_id) == (s2_ptr->transport->orig_net_id))
7538 duplicate_lcn_found = TRUE;
7539 lcn_assigned = FALSE;
7544 switch (s2_ptr->serv_type)
7546 case ADB_SERVICE_TYPE_AVC_SD_TV:
7547 case ADB_SERVICE_TYPE_HD_TV:
7548 case ADB_SERVICE_TYPE_MPEG2_HD:
7549 case ADB_SERVICE_TYPE_UHD_TV:
7551 s2_ptr->allocated_lcn = s2_ptr->serv_lcn;
7553 if (s1_ptr->serv_type == ADB_SERVICE_TYPE_TV)
7555 s1_ptr->allocated_lcn = next_allocated_lcn;
7556 next_allocated_lcn++;
7557 lcn_assigned = TRUE;
7559 else if ((s1_ptr->serv_type == ADB_SERVICE_TYPE_AVC_RADIO) ||
7560 (s1_ptr->serv_type == ADB_SERVICE_TYPE_RADIO) ||
7561 (s1_ptr->serv_type == ADB_SERVICE_TYPE_DATA))
7563 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7564 lcn_assigned = TRUE;
7568 case ADB_SERVICE_TYPE_AVC_RADIO:
7570 s2_ptr->allocated_lcn = s2_ptr->serv_lcn;
7571 if (s1_ptr->serv_type == ADB_SERVICE_TYPE_RADIO)
7573 s1_ptr->allocated_lcn = next_allocated_lcn;
7574 next_allocated_lcn++;
7575 lcn_assigned = TRUE;
7577 else if (s1_ptr->serv_type == ADB_SERVICE_TYPE_DATA)
7579 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7580 lcn_assigned = TRUE;
7584 case ADB_SERVICE_TYPE_TV:
7586 if ((s1_ptr->serv_type == ADB_SERVICE_TYPE_AVC_RADIO) ||
7587 (s1_ptr->serv_type == ADB_SERVICE_TYPE_RADIO) ||
7588 (s1_ptr->serv_type == ADB_SERVICE_TYPE_DATA))
7590 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7591 s2_ptr->allocated_lcn = s2_ptr->serv_lcn;
7592 lcn_assigned = TRUE;
7594 else if ((s1_ptr->serv_type == ADB_SERVICE_TYPE_AVC_SD_TV) ||
7595 (s1_ptr->serv_type == ADB_SERVICE_TYPE_HD_TV) ||
7596 (s1_ptr->serv_type == ADB_SERVICE_TYPE_MPEG2_HD) ||
7597 (s1_ptr->serv_type == ADB_SERVICE_TYPE_UHD_TV))
7599 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7600 s2_ptr->allocated_lcn = next_allocated_lcn;
7601 next_allocated_lcn++;
7602 lcn_assigned = TRUE;
7606 case ADB_SERVICE_TYPE_RADIO:
7608 if ((s1_ptr->serv_type == ADB_SERVICE_TYPE_TV) ||
7609 (s1_ptr->serv_type == ADB_SERVICE_TYPE_AVC_SD_TV) ||
7610 (s1_ptr->serv_type == ADB_SERVICE_TYPE_HD_TV) ||
7611 (s1_ptr->serv_type == ADB_SERVICE_TYPE_DATA) ||
7612 (s1_ptr->serv_type == ADB_SERVICE_TYPE_MPEG2_HD) ||
7613 (s1_ptr->serv_type == ADB_SERVICE_TYPE_UHD_TV))
7615 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7616 s2_ptr->allocated_lcn = s2_ptr->serv_lcn;
7617 lcn_assigned = TRUE;
7619 else if (s1_ptr->serv_type == ADB_SERVICE_TYPE_AVC_RADIO)
7621 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7622 s2_ptr->allocated_lcn = next_allocated_lcn;
7623 next_allocated_lcn++;
7624 lcn_assigned = TRUE;
7630 if (s1_ptr->serv_type != ADB_SERVICE_TYPE_DATA)
7632 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7633 s2_ptr->allocated_lcn = s2_ptr->serv_lcn;
7634 lcn_assigned = TRUE;
7644 t_ptr = s2_ptr->transport;
7647 s2_strength = t_ptr->signal_level_at_search;
7650 if (s1_strength < s2_strength)
7654 s1_ptr->allocated_lcn = next_allocated_lcn;
7655 next_allocated_lcn++;
7661 if (s2_ptr->allocated_lcn == s2_ptr->serv_lcn)
7663 if (s2_ptr->unavailable == FALSE)
7668 s1_ptr->allocated_lcn = next_allocated_lcn;
7669 next_allocated_lcn++;
7676 s2_ptr->allocated_lcn = next_allocated_lcn;
7677 next_allocated_lcn++;
7691 FUNCTION_FINISH(DBDEF_AllocateLcnsFinland);
7693 return(duplicate_lcn_found);
7698 #ifdef COUNTRY_IRELAND 7699 BOOLEAN DBDEF_AllocateLcnsIreland(E_STB_DP_SIGNAL_TYPE tuner_type)
7704 U16BIT next_allocated_lcn;
7705 U16BIT last_allocated_lcn;
7708 BOOLEAN duplicate_lcn_found;
7709 BOOLEAN lcn_assigned;
7711 FUNCTION_START(DBDEF_AllocateLcnsIreland);
7715 next_allocated_lcn = FindLargestLcnNumber(tuner_type, IRELAND_ONID) + 1;
7719 while (s1_ptr != NULL)
7721 if ((s1_ptr->transport != NULL) && (s1_ptr->transport->sig_type == tuner_type))
7723 s1_ptr->old_allocated_lcn = s1_ptr->allocated_lcn;
7727 if (s1_ptr->transport->orig_net_id != IRELAND_ONID)
7729 s1_ptr->allocated_lcn = 0;
7732 if ((s1_ptr->allocated_lcn >= next_allocated_lcn) && (s1_ptr->allocated_lcn < last_allocated_lcn))
7734 next_allocated_lcn = s1_ptr->allocated_lcn + 1;
7745 while (s1_ptr != NULL)
7747 t_ptr = s1_ptr->transport;
7748 if ((t_ptr != NULL) && (t_ptr->sig_type == tuner_type))
7750 if ((s1_ptr->allocated_lcn == 0) && (s1_ptr->selectable || !s1_ptr->hidden))
7754 if (t_ptr->orig_net_id == IRELAND_ONID)
7757 if (s1_ptr->serv_lcn != 0)
7759 s1_ptr->allocated_lcn = s1_ptr->serv_lcn;
7763 s1_ptr->allocated_lcn = next_allocated_lcn;
7764 next_allocated_lcn++;
7767 s1_strength = t_ptr->signal_level_at_search;
7772 while (s2_ptr != NULL)
7774 t_ptr = s2_ptr->transport;
7776 if ((t_ptr != NULL) && (t_ptr->sig_type == tuner_type))
7778 if ((s1_ptr->serv_lcn == s2_ptr->serv_lcn) &&
7779 (t_ptr->orig_net_id == IRELAND_ONID) &&
7780 (s1_ptr->transport->orig_net_id) == (t_ptr->orig_net_id))
7782 duplicate_lcn_found = TRUE;
7783 lcn_assigned = FALSE;
7786 switch (s2_ptr->serv_type)
7788 case ADB_SERVICE_TYPE_AVC_SD_TV:
7789 case ADB_SERVICE_TYPE_HD_TV:
7790 case ADB_SERVICE_TYPE_MPEG2_HD:
7791 case ADB_SERVICE_TYPE_UHD_TV:
7795 if ((s1_ptr->serv_type != ADB_SERVICE_TYPE_AVC_SD_TV) &&
7796 (s1_ptr->serv_type != ADB_SERVICE_TYPE_HD_TV) &&
7797 (s1_ptr->serv_type != ADB_SERVICE_TYPE_MPEG2_HD) &&
7798 (s1_ptr->serv_type != ADB_SERVICE_TYPE_UHD_TV))
7802 s2_ptr->allocated_lcn = s2_ptr->serv_lcn;
7803 s1_ptr->allocated_lcn = next_allocated_lcn;
7804 next_allocated_lcn++;
7805 lcn_assigned = TRUE;
7809 case ADB_SERVICE_TYPE_AVC_RADIO:
7811 if (s1_ptr->serv_type != ADB_SERVICE_TYPE_AVC_RADIO)
7813 s2_ptr->allocated_lcn = s2_ptr->serv_lcn;
7814 s1_ptr->allocated_lcn = next_allocated_lcn;
7815 next_allocated_lcn++;
7816 lcn_assigned = TRUE;
7820 case ADB_SERVICE_TYPE_TV:
7822 if ((s1_ptr->serv_type == ADB_SERVICE_TYPE_AVC_SD_TV) ||
7823 (s1_ptr->serv_type == ADB_SERVICE_TYPE_HD_TV) ||
7824 (s1_ptr->serv_type == ADB_SERVICE_TYPE_MPEG2_HD) ||
7825 (s1_ptr->serv_type == ADB_SERVICE_TYPE_UHD_TV))
7828 s2_ptr->allocated_lcn = next_allocated_lcn;
7829 next_allocated_lcn++;
7830 lcn_assigned = TRUE;
7834 case ADB_SERVICE_TYPE_RADIO:
7836 if (s1_ptr->serv_type == ADB_SERVICE_TYPE_AVC_RADIO)
7839 s2_ptr->allocated_lcn = next_allocated_lcn;
7840 next_allocated_lcn++;
7841 lcn_assigned = TRUE;
7854 s2_strength = t_ptr->signal_level_at_search;
7856 if (s1_strength < s2_strength)
7859 s2_ptr->allocated_lcn = s2_ptr->serv_lcn;
7860 s1_ptr->allocated_lcn = next_allocated_lcn;
7861 next_allocated_lcn++;
7866 s2_ptr->allocated_lcn = next_allocated_lcn;
7867 next_allocated_lcn++;
7884 if (next_allocated_lcn != 0)
7886 next_allocated_lcn--;
7894 while (s1_ptr != NULL)
7896 t_ptr = s1_ptr->transport;
7897 if ((t_ptr != NULL) && (t_ptr->sig_type == tuner_type))
7899 if ((s1_ptr->serv_lcn != 0) && (s1_ptr->allocated_lcn == 0))
7901 if (t_ptr->orig_net_id != IRELAND_ONID)
7906 s1_ptr->allocated_lcn = s1_ptr->serv_lcn + next_allocated_lcn;
7908 s1_strength = t_ptr->signal_level_at_search;
7913 while (s2_ptr != NULL)
7915 if ((s2_ptr->serv_lcn != 0) && (s1_ptr->serv_lcn == s2_ptr->serv_lcn) &&
7916 (s2_ptr->selectable || !s2_ptr->hidden) &&
7917 (s2_ptr->transport != NULL) &&
7918 (s1_ptr->transport->orig_net_id) == (s2_ptr->transport->orig_net_id))
7920 duplicate_lcn_found = TRUE;
7923 s2_strength = s2_ptr->transport->signal_level_at_search;
7925 if (s1_strength < s2_strength)
7929 s2_ptr->allocated_lcn = s1_ptr->allocated_lcn;
7930 s1_ptr->allocated_lcn = 0;
7945 next_allocated_lcn = 0;
7948 while (s1_ptr != NULL)
7950 if ((s1_ptr->transport != NULL) && (s1_ptr->transport->sig_type == tuner_type))
7952 if (s1_ptr->allocated_lcn >= next_allocated_lcn)
7954 next_allocated_lcn = s1_ptr->allocated_lcn + 1;
7963 while (s1_ptr != NULL)
7965 if ((s1_ptr->transport != NULL) && (s1_ptr->transport->sig_type == tuner_type))
7968 if ((s1_ptr->allocated_lcn == 0) && (s1_ptr->selectable || !s1_ptr->hidden))
7971 s1_ptr->allocated_lcn = next_allocated_lcn;
7972 next_allocated_lcn++;
7979 FUNCTION_FINISH(DBDEF_AllocateLcnsIreland);
7981 return(duplicate_lcn_found);
7999 ASSERT(path < num_paths);
8000 tuned_network[path] = n_ptr;
8018 ASSERT(path < num_paths);
8020 return(tuned_network[path]);
8037 ASSERT(path < num_paths);
8056 ASSERT(path < num_paths);
8070 ASSERT(path < num_paths);
8071 if (path < num_paths)
8090 ASSERT(path < num_paths);
8094 if (path < num_paths)
8118 text_langs = lang_ids;
8154 second_text_langs = lang_ids;
8173 return(second_text_langs);
8190 audio_langs = lang_ids;
8208 second_audio_langs = lang_ids;
8227 return(audio_langs);
8245 return(second_audio_langs);
8257 BOOLEAN search_completed, BOOLEAN manual)
8259 U32BIT country_code;
8260 DBTidyFunc func_ptr;
8289 if (func_ptr != NULL)
8291 func_ptr(tuner_type, search_completed, manual);
8297 while (s_ptr != NULL)
8311 if (!search_completed)
8315 while (t_ptr != NULL)
8317 t_ptr->available = TRUE;
8340 BOOLEAN serv_removed;
8343 USE_UNWANTED_PARAM(tuner_type);
8346 while (s1_ptr != NULL)
8348 serv_removed = FALSE;
8350 if ((s1_ptr->transport != NULL) && (s1_ptr->transport->network != NULL))
8353 ((s1_ptr->transport->network->net_id >= NID_PRIVATE_BOUNDARY) ||
8354 (s1_ptr->transport->orig_net_id >= ONID_PRIVATE_BOUNDARY)))
8357 serv_removed = TRUE;
8361 if (!serv_removed && s1_ptr->unavailable)
8364 serv_removed = TRUE;
8368 if (!serv_removed && !manual && (s1_ptr->transport != NULL) &&
8369 (s1_ptr->transport->available == FALSE))
8379 while (s1_ptr != NULL)
8381 t1_ptr = s1_ptr->transport;
8386 while (s2_ptr != NULL)
8389 if ((s1_ptr != s2_ptr) && (s1_ptr->serv_id == s2_ptr->serv_id))
8391 t2_ptr = s2_ptr->transport;
8394 if ((t1_ptr->orig_net_id == t2_ptr->orig_net_id) &&
8395 (t1_ptr->tran_id == t2_ptr->tran_id))
8399 if (s1_ptr->new_service == TRUE)
8401 if (s2_ptr == next1_ptr)
8407 else if (s2_ptr->new_service == TRUE)
8416 if (t1_ptr->signal_level_at_search >= t2_ptr->signal_level_at_search)
8418 if (s2_ptr->serv_lcn == s1_ptr->serv_lcn)
8420 if (s2_ptr == next1_ptr)
8430 if (s2_ptr->serv_lcn == s1_ptr->serv_lcn)
8447 if (search_completed)
8451 while (t1_ptr != NULL)
8455 if (!t1_ptr->available)
8484 USE_UNWANTED_PARAM(tuner_type);
8485 USE_UNWANTED_PARAM(search_completed);
8488 while (s1_ptr != NULL)
8491 t1_ptr = s1_ptr->transport;
8495 while (s2_ptr != NULL)
8498 if ((s1_ptr != s2_ptr) && (s1_ptr->serv_id == s2_ptr->serv_id))
8500 t2_ptr = s2_ptr->transport;
8503 if (t1_ptr->orig_net_id == t2_ptr->orig_net_id)
8507 if (s1_ptr->new_service == TRUE)
8509 if (s2_ptr == next_s1_ptr)
8515 else if (s2_ptr->new_service == TRUE)
8525 if (t1_ptr->signal_level_at_search >= t2_ptr->signal_level_at_search)
8528 if (s2_ptr == next_s1_ptr)
8546 s2_ptr = next_s2_ptr;
8549 s1_ptr = next_s1_ptr;
8572 USE_UNWANTED_PARAM(tuner_type);
8573 USE_UNWANTED_PARAM(search_completed);
8576 while (s1_ptr != NULL)
8579 t1_ptr = s1_ptr->transport;
8583 while (s2_ptr != NULL)
8589 if ((s1_ptr != s2_ptr) && (s1_ptr->serv_id == s2_ptr->serv_id) &&
8590 (s1_ptr->freesat_id == INVALID_FREESAT_SERV_ID) &&
8591 (s2_ptr->freesat_id == INVALID_FREESAT_SERV_ID))
8593 t2_ptr = s2_ptr->transport;
8596 if ((t1_ptr->orig_net_id == t2_ptr->orig_net_id) &&
8597 (t1_ptr->tran_id == t2_ptr->tran_id))
8601 if (s1_ptr->new_service)
8603 if (s2_ptr == next_s1_ptr)
8609 else if (s2_ptr->new_service)
8619 if (t1_ptr->signal_level_at_search >= t2_ptr->signal_level_at_search)
8622 if (s2_ptr == next_s1_ptr)
8640 s2_ptr = next_s2_ptr;
8643 s1_ptr = next_s1_ptr;
8666 USE_UNWANTED_PARAM(tuner_type);
8667 USE_UNWANTED_PARAM(search_completed);
8670 while (s1_ptr != NULL)
8673 t1_ptr = s1_ptr->transport;
8677 while (s2_ptr != NULL)
8680 if ((s1_ptr != s2_ptr) && (s1_ptr->serv_id == s2_ptr->serv_id))
8682 t2_ptr = s2_ptr->transport;
8685 if ((t1_ptr->orig_net_id == t2_ptr->orig_net_id) &&
8686 (t1_ptr->tran_id == t2_ptr->tran_id))
8690 if (s1_ptr->new_service)
8692 if (s2_ptr == next_s1_ptr)
8698 else if (s2_ptr->new_service)
8708 if (t1_ptr->signal_level_at_search >= t2_ptr->signal_level_at_search)
8711 if (s2_ptr == next_s1_ptr)
8729 s2_ptr = next_s2_ptr;
8732 s1_ptr = next_s1_ptr;
8749 BOOLEAN transport_empty;
8754 while (t_ptr != NULL)
8756 transport_empty = TRUE;
8763 while ((s_ptr != NULL) && transport_empty)
8765 if (s_ptr->transport == t_ptr)
8768 transport_empty = FALSE;
8773 if (transport_empty)
8808 c_ptr->series_flag = series;
8809 c_ptr->recommended_flag = recommended;
8815 if (dba_rec != NULL)
8817 c_ptr->dba_rec = dba_rec;
8851 c_ptr->date_time = date_time;
8869 c_ptr->serv_id = serv_id;
8909 c_ptr->do_not_delete = do_not_delete;
8910 DBA_SetFieldValue(c_ptr->dba_rec, DBA_FIELD_CRID_DO_NOT_DELETE, (U32BIT)do_not_delete);
8924 ASSERT(c_ptr != NULL);
8947 if (c_ptr->name_str != NULL)
8952 if (c_ptr->crid_str != NULL)
9019 while ((next != NULL) && !valid)
9076 for (list_id = 1; list_id != 0; list_id++)
9081 while ((fl_ptr != NULL) && !id_used)
9083 if (fl_ptr->list_id == list_id)
9105 while (fl_ptr != NULL)
9107 if (fl_ptr->list_id == list_id)
9131 if (dba_rec != NULL)
9133 fav_list->dba_rec = dba_rec;
9135 fav_list->list_id = list_id;
9138 fav_list->user_data = user_data;
9143 fav_list->name = NULL;
9169 while (fl_ptr != NULL)
9171 if (fl_ptr->index >= index)
9183 for (index = 0; fl_ptr != NULL; index++)
9185 if (fl_ptr->index != index)
9187 fl_ptr->index = index;
9218 if (fav_list == NULL)
9244 while (fl_ptr != NULL)
9246 if (fl_ptr->list_id == list_id)
9267 if (fav_list != NULL)
9269 fav_list->user_data = user_data;
9289 if (fav_list->index != index)
9306 while (fl_ptr != NULL)
9308 if (fl_ptr->index >= index)
9320 for (index = 0; fl_ptr != NULL; index++)
9322 if (fl_ptr->index != index)
9324 fl_ptr->index = index;
9347 if (fav_list != NULL)
9353 while (fs_ptr != NULL)
9359 if (fav_list->name != NULL)
9370 for (index = 0; fl_ptr != NULL; index++)
9372 if (fl_ptr->index != index)
9374 fl_ptr->index = index;
9417 while (fs_ptr != NULL)
9419 if (fs_ptr->serv_ptr == serv_ptr)
9435 if (dba_rec != NULL)
9437 fav_serv->dba_rec = dba_rec;
9438 fav_serv->serv_ptr = serv_ptr;
9440 fav_serv->list_id = fav_list->list_id;
9457 while (fs_ptr != NULL)
9459 if (fs_ptr->index >= index)
9471 for (index = 0; fs_ptr != NULL; index++)
9473 if (fs_ptr->index != index)
9475 fs_ptr->index = index;
9508 while (fav_serv != NULL)
9510 if (fav_serv->serv_ptr == serv_ptr)
9534 if (fav_serv == NULL)
9559 if (fav_serv == NULL)
9588 if (fav_serv->index != index)
9605 while (fs_ptr != NULL)
9607 if (fs_ptr->index >= index)
9619 for (index = 0; fs_ptr != NULL; index++)
9621 if (fs_ptr->index != index)
9623 fs_ptr->index = index;
9645 if ((fav_list != NULL) && (fav_serv != NULL))
9655 for (index = 0; fav_serv != NULL; index++)
9657 if (fav_serv->index != index)
9659 fav_serv->index = index;
9680 if (fav_list != NULL)
9683 while (serv != NULL)
9709 U16BIT new_name_len;
9721 if (f_ptr->name != NULL)
9723 if (new_name_len == f_ptr->name->nbytes)
9726 if (memcmp(name, f_ptr->name->str_ptr, new_name_len) == 0)
9737 if (f_ptr->name != NULL)
9748 if (f_ptr->name != NULL)
9751 f_ptr->name->nbytes);
9781 if ((s_ptr != NULL) && (s_ptr->transport != NULL))
9811 if ((t_ptr != NULL) && (t_ptr->sig_type == tuner_type) &&
9812 ((satellite == NULL) || (tuner_type != SIGNAL_QPSK) ||
9813 ((tuner_type == SIGNAL_QPSK) && (t_ptr->network != NULL) &&
9814 (t_ptr->network->satellite == satellite))))
9847 handle = last_timer_handle + 1;
9848 if (handle == LAST_TIMER_HANDLE)
9850 handle = TIMER_HANDLE_BASE;
9856 if (handle == LAST_TIMER_HANDLE)
9858 handle = TIMER_HANDLE_BASE;
9862 last_timer_handle = handle;
9864 timer->handle = handle;
9870 if (dba_rec != NULL)
9872 timer->dba_rec = dba_rec;
9906 while ((timer != NULL) && (timer->handle != handle))
9928 if (timer_ptr == NULL)
9950 if (date_time_order)
9974 if (timer->dba_rec != NULL)
9990 U16BIT num_profiles;
9992 BOOLEAN broadcast_found;
9997 broadcast_found = FALSE;
10000 while (n_ptr != NULL)
10002 if (n_ptr->profile_type == ADB_PROFILE_TYPE_BROADCAST)
10005 if (!broadcast_found)
10008 broadcast_found = TRUE;
10021 return(num_profiles);
10033 U16BIT num_profiles;
10035 BOOLEAN broadcast_found;
10040 if (num_profiles > 0)
10043 if (*profile_list != NULL)
10045 broadcast_found = FALSE;
10049 while (n_ptr != NULL)
10051 if (n_ptr->profile_type == ADB_PROFILE_TYPE_BROADCAST)
10054 if (!broadcast_found)
10056 (*profile_list)[num_profiles] = (
void *)n_ptr;
10058 if (current_profile == ADB_PROFILE_TYPE_BROADCAST)
10061 *active_profile = num_profiles;
10065 broadcast_found = TRUE;
10070 (*profile_list)[num_profiles] = (
void *)n_ptr;
10072 #ifdef COMMON_INTERFACE 10073 if ((current_profile == n_ptr->profile_type) &&
10074 (cicam_onet_id == n_ptr->cicam_onet_id) &&
10075 (cicam_identifier == n_ptr->cicam_identifier))
10078 *active_profile = num_profiles;
10096 return(num_profiles);
10107 USE_UNWANTED_PARAM(num_profiles);
10109 if (profile_list != NULL)
10132 while (n_ptr != NULL)
10134 if (n_ptr == profile)
10136 if (n_ptr->profile_type == current_profile)
10138 if ((current_profile == ADB_PROFILE_TYPE_BROADCAST)
10139 #ifdef COMMON_INTERFACE 10140 || ((current_profile == ADB_PROFILE_TYPE_CIPLUS) &&
10141 (n_ptr->cicam_onet_id == cicam_onet_id) && (n_ptr->cicam_identifier == cicam_identifier))
10167 return(current_profile);
10177 current_profile = ADB_PROFILE_TYPE_BROADCAST;
10190 pushed_profile = current_profile;
10191 #ifdef COMMON_INTERFACE 10192 if (current_profile == ADB_PROFILE_TYPE_CIPLUS)
10194 pushed_cicam_onet_id = cicam_onet_id;
10195 pushed_cicam_identifier = cicam_identifier;
10198 current_profile = ADB_PROFILE_TYPE_BROADCAST;
10203 #ifdef COMMON_INTERFACE 10211 void DBDEF_PushCIPlusProfile(U16BIT onet_id, U32BIT cicam_id)
10213 FUNCTION_START(DBDEF_SelectCIPlusProfile);
10216 pushed_profile = current_profile;
10218 if (current_profile == ADB_PROFILE_TYPE_CIPLUS)
10220 pushed_cicam_onet_id = cicam_onet_id;
10221 pushed_cicam_identifier = cicam_identifier;
10224 current_profile = ADB_PROFILE_TYPE_CIPLUS;
10225 cicam_onet_id = onet_id;
10226 cicam_identifier = cicam_id;
10228 FUNCTION_FINISH(DBDEF_SelectCIPlusProfile);
10237 void DBDEF_SelectCIPlusProfile(U16BIT onet_id, U32BIT cicam_id)
10239 FUNCTION_START(DBDEF_SelectCIPlusProfile);
10241 current_profile = ADB_PROFILE_TYPE_CIPLUS;
10242 cicam_onet_id = onet_id;
10243 cicam_identifier = cicam_id;
10245 FUNCTION_FINISH(DBDEF_SelectCIPlusProfile);
10257 current_profile = pushed_profile;
10259 #ifdef COMMON_INTERFACE 10260 if (pushed_profile == ADB_PROFILE_TYPE_CIPLUS)
10262 cicam_onet_id = pushed_cicam_onet_id;
10263 cicam_identifier = pushed_cicam_identifier;
10284 if ((s_ptr->transport != NULL) && (s_ptr->transport->network != NULL))
10286 if (s_ptr->transport->network->profile_type != current_profile)
10290 #ifdef COMMON_INTERFACE 10291 else if ((current_profile == ADB_PROFILE_TYPE_CIPLUS) &&
10292 ((s_ptr->transport->network->cicam_onet_id != cicam_onet_id) ||
10293 (s_ptr->transport->network->cicam_identifier != cicam_identifier)))
10320 if (t_ptr->network != NULL)
10322 if (t_ptr->network->profile_type != current_profile)
10326 #ifdef COMMON_INTERFACE 10327 else if ((current_profile == ADB_PROFILE_TYPE_CIPLUS) &&
10328 ((t_ptr->network->cicam_onet_id != cicam_onet_id) ||
10329 (t_ptr->network->cicam_identifier != cicam_identifier)))
10356 if (n_ptr->profile_type != current_profile)
10360 #ifdef COMMON_INTERFACE 10361 else if ((current_profile == ADB_PROFILE_TYPE_CIPLUS) &&
10362 ((n_ptr->cicam_onet_id != cicam_onet_id) ||
10363 (n_ptr->cicam_identifier != cicam_identifier)))
10375 #ifdef COMMON_INTERFACE 10382 ADB_NETWORK_REC* DBDEF_FindNetworkForCIPlusProfile(U16BIT cicam_onet_id, U32BIT cicam_identifier)
10386 FUNCTION_START(DBDEF_FindNetworkForCIPlusProfile);
10389 while (n_ptr != NULL)
10391 if ((n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS) && (n_ptr->cicam_onet_id == cicam_onet_id) &&
10392 (n_ptr->cicam_identifier == cicam_identifier))
10400 FUNCTION_FINISH(DBDEF_FindNetworkForCIPlusProfile);
10415 FUNCTION_START(DBDEF_FindNetworkForCIPlusModule);
10418 while (n_ptr != NULL)
10420 if ((n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS) && n_ptr->module_present &&
10421 (n_ptr->module == module))
10429 FUNCTION_FINISH(DBDEF_FindNetworkForCIPlusModule);
10442 FUNCTION_START(DBDEF_GetCurrentCIPlusProfile);
10444 if (current_profile == ADB_PROFILE_TYPE_CIPLUS)
10446 n_ptr = DBDEF_FindNetworkForCIPlusProfile(cicam_onet_id, cicam_identifier);
10449 FUNCTION_FINISH(DBDEF_GetCurrentCIPlusProfile);
10460 ADB_CICAM_TIMER_REC* DBDEF_AddCicamTimer(U32BIT cicam_id, U32BIT timer_handle)
10462 ADB_CICAM_TIMER_REC *t;
10465 FUNCTION_START(DBDEF_AddCicamTimer);
10469 if (dba_rec != NULL)
10474 t->dba_rec = dba_rec;
10475 t->cicam_identifier = cicam_id;
10477 t->timer_handle = timer_handle;
10495 FUNCTION_FINISH(DBDEF_AddCicamTimer);
10504 void DBDEF_DeleteCicamTimerRec(ADB_CICAM_TIMER_REC *cicam_timer_ptr)
10506 FUNCTION_START(DBDEF_DeleteCicamTimerRec);
10515 FUNCTION_FINISH(DBDEF_DeleteCicamTimerRec);
10524 ADB_CICAM_TIMER_REC* DBDEF_GetNextCicamTimerRec(ADB_CICAM_TIMER_REC *cicam_timer_ptr)
10526 ADB_CICAM_TIMER_REC *t_ptr;
10528 FUNCTION_START(DBDEF_GetNextCicamTimerRec);
10530 if (cicam_timer_ptr == NULL)
10539 FUNCTION_FINISH(DBDEF_GetNextCicamTimerRec);
10549 ADB_CICAM_TIMER_REC* DBDEF_FindCicamTimer(U32BIT cicam_id)
10551 ADB_CICAM_TIMER_REC *t;
10553 FUNCTION_START(DBDEF_FindCicamTimer);
10555 t = DBDEF_GetNextCicamTimerRec(NULL);
10558 if (t->cicam_identifier == cicam_id)
10562 t = DBDEF_GetNextCicamTimerRec(t);
10565 FUNCTION_FINISH(DBDEF_FindCicamTimer)
10575 ADB_CICAM_TIMER_REC* DBDEF_FindCicamTimerByHandle(U32BIT handle)
10577 ADB_CICAM_TIMER_REC *t;
10579 FUNCTION_START(DBDEF_FindCicamTimerByHandle);
10581 t = DBDEF_GetNextCicamTimerRec(NULL);
10584 if (t->timer_handle == handle)
10588 t = DBDEF_GetNextCicamTimerRec(t);
10591 FUNCTION_FINISH(DBDEF_FindCicamTimerByHandle)
10611 net_id = PRIVATE_NETWORK_ID0;
10616 if (n_ptr->satellite == satellite)
10650 FUNCTION_START(DeleteLNBRec);
10654 if (lnb_ptr->name != NULL)
10663 FUNCTION_FINISH(DeleteLNBRec);
10674 FUNCTION_START(DeleteSatelliteRec);
10678 if (sat_ptr->name != NULL)
10683 if (sat_ptr->def_authority != NULL)
10688 ver_rec = sat_ptr->bat_version_list;
10689 while (ver_rec != NULL)
10691 sat_ptr->bat_version_list = ver_rec->next;
10693 ver_rec = sat_ptr->bat_version_list;
10700 FUNCTION_FINISH(DeleteSatelliteRec);
10718 FUNCTION_START(DeleteNetworkRec);
10722 for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
10724 if (n_ptr->name_array[i] != NULL)
10730 if (n_ptr->name_str != NULL)
10739 FUNCTION_FINISH(DeleteNetworkRec);
10742 #ifdef DEBUG_PRINT_DATABASE 10749 static const char *diseqc_cswitch[] = {
"Off",
"1",
"2",
"3",
"4" };
10750 static const char *diseqc_tone_burst[] = {
"Off",
"A",
"B" };
10752 FUNCTION_START(PrintLNBRec);
10754 STB_SPDebugWrite(
"\t\tType: %s", (lnb_ptr->type == LNB_TYPE_SINGLE ?
"Single" :
"Universal"));
10756 if (lnb_ptr->type == LNB_TYPE_UNIVERSAL)
10761 if (lnb_ptr->is_pulse_posn)
10767 if (lnb_ptr->is_diseqc_posn)
10777 STB_SPDebugWrite(
"\t\tDiSEqC 1.0 (c-switch): %s", diseqc_cswitch[lnb_ptr->c_switch]);
10778 if (lnb_ptr->u_switch)
10788 STB_SPDebugWrite(
"\t\tDiSEqC tone burst: %s", diseqc_tone_burst[lnb_ptr->diseqc_tone]);
10790 if (lnb_ptr->type == LNB_TYPE_SINGLE)
10797 FUNCTION_FINISH(PrintLNBRec);
10808 FUNCTION_START(PrintSatelliteRec);
10810 if (sat_ptr->name.str_ptr != NULL)
10814 long_pos = sat_ptr->long_pos;
10824 STB_SPDebugWrite(
"\t\tPosition: %d.%01d %c", long_pos / 10, long_pos % 10, ewc );
10826 FUNCTION_FINISH(PrintSatelliteRec);
10844 FUNCTION_START(PrintNetworkRec);
10848 if (n_ptr->name_str != NULL)
10855 if (n_ptr->stb_db_rec != NULL)
10857 STB_PrintRecord(n_ptr->stb_db_rec);
10861 for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
10863 if ((n_ptr->name_array[i] != NULL) &&
10864 (n_ptr->name_array[i]->nbytes > 0))
10874 FUNCTION_FINISH(PrintNetworkRec);
10879 #ifdef DEBUG_PRINT_DATABASE 10893 FUNCTION_START(PrintTransportRec);
10895 if (t_ptr->name_str != NULL)
10906 if (t_ptr->stb_db_rec != NULL)
10908 STB_PrintRecord(t_ptr->stb_db_rec);
10918 FUNCTION_FINISH(PrintTransportRec);
10923 #ifdef DEBUG_PRINT_DATABASE 10937 FUNCTION_START(PrintServiceRec);
10939 if (s_ptr->name_str != NULL)
10946 if (s_ptr->provider_str != NULL)
10953 if (s_ptr->stb_db_rec != NULL)
10955 STB_PrintRecord(s_ptr->stb_db_rec);
10963 STB_SPDebugWrite(
"\t\tNow/next available: %s", (s_ptr->eit_now_next_avail ?
"Yes" :
"No"));
10964 STB_SPDebugWrite(
"\t\tSchedule available: %s", (s_ptr->eit_sched_avail ?
"Yes" :
"No"));
10972 STB_SPDebugWrite(
"\t\tTeletext lang code: 0x%x", s_ptr->reqd_ttext_lang_code);
10975 STB_SPDebugWrite(
"\t\tService running: %s", (s_ptr->not_running ?
"No" :
"Yes"));
10977 FUNCTION_FINISH(PrintServiceRec);
10991 static U16BIT GetReqdAudioPid(
ADB_SERVICE_REC *s_ptr, E_STB_DP_AUDIO_MODE *audio_mode,
10992 ADB_STREAM_TYPE *audio_type, U8BIT *db_lang_ids, BOOLEAN *primary_found,
ADB_STREAM_REC **selected_stream)
11002 U32BIT def_lang_code;
11003 ADB_AUDIO_TYPE def_audio_type;
11004 BOOLEAN prefer_hd_stream;
11005 U8BIT stream_priority;
11006 U8BIT def_stream_priority;
11007 U8BIT lang_stream_priority;
11008 U8BIT qaa_stream_priority;
11009 U8BIT type_stream_priority;
11010 U8BIT nzero_stream_priority;
11011 U8BIT lang_lang_priority;
11012 U8BIT def_lang_priority;
11015 FUNCTION_START(GetReqdAudioPid);
11018 *audio_mode = AUDIO_STEREO;
11019 *audio_type = ADB_AUDIO_STREAM;
11020 *primary_found = FALSE;
11021 *selected_stream = NULL;
11025 nzero_pid_stream = NULL;
11026 lang_code_match_stream = NULL;
11027 qaa_match_stream = NULL;
11028 audio_type_match_stream = NULL;
11029 default_match_stream = NULL;
11030 exact_match_stream = NULL;
11031 def_stream_priority = 0;
11032 lang_stream_priority = 0;
11033 qaa_stream_priority = 0;
11034 type_stream_priority = 0;
11035 nzero_stream_priority = 0;
11036 lang_lang_priority = ACFG_MAX_DB_LANG_CODES;
11037 def_lang_priority = ACFG_MAX_DB_LANG_CODES;
11039 def_audio_type = (ADB_AUDIO_TYPE)
APP_NvmRead(AUDIO_TYPE_NVM);
11040 prefer_hd_stream =
APP_NvmRead(PREFER_HD_AUDIO_NVM);
11042 stream_rec = s_ptr->stream_list;
11043 while (stream_rec != NULL)
11045 if ((stream_rec->type == ADB_AUDIO_STREAM) ||
11046 (stream_rec->type == ADB_AAC_AUDIO_STREAM) ||
11047 (stream_rec->type == ADB_HEAAC_AUDIO_STREAM) ||
11048 (stream_rec->type == ADB_AC3_AUDIO_STREAM) ||
11049 (stream_rec->type == ADB_EAC3_AUDIO_STREAM)
11053 stream_rec->in_use = FALSE;
11055 if (stream_rec->pid != 0)
11058 if ((s_ptr->reqd_audio_pid < 0x1FFF) && (s_ptr->reqd_audio_pid == stream_rec->pid))
11060 exact_match_stream = stream_rec;
11061 *primary_found = TRUE;
11064 else if ((s_ptr->reqd_audio_valid == TRUE) &&
11065 (exact_match_stream == NULL) &&
11066 (stream_rec->data.audio.lang_code == s_ptr->reqd_audio_lang_code) &&
11067 (stream_rec->data.audio.type == s_ptr->reqd_audio_type) &&
11068 (stream_rec->type == s_ptr->reqd_stream_type))
11071 exact_match_stream = stream_rec;
11072 *primary_found = TRUE;
11076 stream_priority = AudioStreamPriority(stream_rec->type);
11078 if (db_lang_ids != NULL)
11081 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) && (db_lang_ids[i] != ACFG_INVALID_DB_LANG); i++)
11085 if ((def_lang_code == stream_rec->data.audio.lang_code) &&
11086 ((def_audio_type == ADB_AUDIO_TYPE_UNDEFINED) ||
11087 (def_audio_type == ADB_AUDIO_TYPE_CLEAN_EFFECTS)) &&
11088 (def_audio_type == stream_rec->data.audio.type))
11090 if ((default_match_stream == NULL) || (i < def_lang_priority))
11093 default_match_stream = stream_rec;
11094 def_stream_priority = stream_priority;
11095 def_lang_priority = i;
11096 *primary_found = TRUE;
11102 if (!prefer_hd_stream)
11105 if (stream_priority < def_stream_priority)
11108 default_match_stream = stream_rec;
11109 def_stream_priority = stream_priority;
11111 else if (stream_priority == def_stream_priority)
11115 if ((default_match_stream->data.audio.mode == AUDIO_MULTICHANNEL) &&
11116 (stream_rec->data.audio.mode != AUDIO_MULTICHANNEL))
11119 default_match_stream = stream_rec;
11120 def_stream_priority = stream_priority;
11126 if (stream_priority > def_stream_priority)
11129 default_match_stream = stream_rec;
11130 def_stream_priority = stream_priority;
11132 else if (stream_priority == def_stream_priority)
11136 if ((default_match_stream->data.audio.mode != AUDIO_MULTICHANNEL) &&
11137 (stream_rec->data.audio.mode == AUDIO_MULTICHANNEL))
11140 default_match_stream = stream_rec;
11141 def_stream_priority = stream_priority;
11151 if (((def_lang_code == stream_rec->data.audio.lang_code) ||
11152 (stream_rec->data.audio.lang_code == ADB_LANG_CODE_UNDEF)) &&
11153 (stream_rec->data.audio.type != ADB_AUDIO_TYPE_FOR_VISUALLY_IMPAIRED))
11155 if ((lang_code_match_stream == NULL) || (i < lang_lang_priority))
11158 lang_code_match_stream = stream_rec;
11159 lang_stream_priority = stream_priority;
11160 lang_lang_priority = i;
11166 if (!prefer_hd_stream)
11169 if (stream_priority < lang_stream_priority)
11172 lang_code_match_stream = stream_rec;
11173 lang_stream_priority = stream_priority;
11175 else if (stream_priority == lang_stream_priority)
11179 if ((lang_code_match_stream->data.audio.mode == AUDIO_MULTICHANNEL) &&
11180 (stream_rec->data.audio.mode != AUDIO_MULTICHANNEL))
11183 lang_code_match_stream = stream_rec;
11184 lang_stream_priority = stream_priority;
11190 if (stream_priority > lang_stream_priority)
11193 lang_code_match_stream = stream_rec;
11194 lang_stream_priority = stream_priority;
11196 else if (stream_priority == lang_stream_priority)
11200 if ((lang_code_match_stream->data.audio.mode != AUDIO_MULTICHANNEL) &&
11201 (stream_rec->data.audio.mode == AUDIO_MULTICHANNEL))
11204 lang_code_match_stream = stream_rec;
11205 lang_stream_priority = stream_priority;
11213 if ((stream_rec->data.audio.lang_code == ADB_LANG_CODE_QAA) &&
11214 (stream_rec->data.audio.type != ADB_AUDIO_TYPE_FOR_VISUALLY_IMPAIRED))
11216 if (qaa_match_stream == NULL)
11218 qaa_match_stream = stream_rec;
11219 qaa_stream_priority = stream_priority;
11225 if (!prefer_hd_stream)
11228 if (stream_priority < qaa_stream_priority)
11231 qaa_match_stream = stream_rec;
11232 qaa_stream_priority = stream_priority;
11234 else if (stream_priority == qaa_stream_priority)
11238 if ((qaa_match_stream->data.audio.mode == AUDIO_MULTICHANNEL) &&
11239 (stream_rec->data.audio.mode != AUDIO_MULTICHANNEL))
11242 qaa_match_stream = stream_rec;
11243 qaa_stream_priority = stream_priority;
11249 if (stream_priority > qaa_stream_priority)
11252 qaa_match_stream = stream_rec;
11253 qaa_stream_priority = stream_priority;
11255 else if (stream_priority == qaa_stream_priority)
11259 if ((qaa_match_stream->data.audio.mode != AUDIO_MULTICHANNEL) &&
11260 (stream_rec->data.audio.mode == AUDIO_MULTICHANNEL))
11263 qaa_match_stream = stream_rec;
11264 qaa_stream_priority = stream_priority;
11274 if (((def_audio_type == ADB_AUDIO_TYPE_UNDEFINED) ||
11275 (def_audio_type == ADB_AUDIO_TYPE_CLEAN_EFFECTS)) &&
11276 (def_audio_type == stream_rec->data.audio.type))
11278 if (audio_type_match_stream == NULL)
11280 audio_type_match_stream = stream_rec;
11281 type_stream_priority = stream_priority;
11287 if (!prefer_hd_stream)
11290 if (stream_priority < type_stream_priority)
11293 audio_type_match_stream = stream_rec;
11294 type_stream_priority = stream_priority;
11296 else if (stream_priority == type_stream_priority)
11300 if ((audio_type_match_stream->data.audio.mode == AUDIO_MULTICHANNEL) &&
11301 (stream_rec->data.audio.mode != AUDIO_MULTICHANNEL))
11304 audio_type_match_stream = stream_rec;
11305 type_stream_priority = stream_priority;
11311 if (stream_priority > type_stream_priority)
11314 audio_type_match_stream = stream_rec;
11315 type_stream_priority = stream_priority;
11317 else if (stream_priority == type_stream_priority)
11321 if ((audio_type_match_stream->data.audio.mode != AUDIO_MULTICHANNEL) &&
11322 (stream_rec->data.audio.mode == AUDIO_MULTICHANNEL))
11325 audio_type_match_stream = stream_rec;
11326 type_stream_priority = stream_priority;
11334 if (nzero_pid_stream == NULL)
11336 nzero_pid_stream = stream_rec;
11337 nzero_stream_priority = stream_priority;
11343 if (!prefer_hd_stream)
11346 if (stream_priority < nzero_stream_priority)
11349 nzero_pid_stream = stream_rec;
11350 nzero_stream_priority = stream_priority;
11352 else if (stream_priority == nzero_stream_priority)
11356 if ((nzero_pid_stream->data.audio.mode == AUDIO_MULTICHANNEL) &&
11357 (stream_rec->data.audio.mode != AUDIO_MULTICHANNEL))
11360 nzero_pid_stream = stream_rec;
11361 nzero_stream_priority = stream_priority;
11367 if (stream_priority > nzero_stream_priority)
11370 nzero_pid_stream = stream_rec;
11371 nzero_stream_priority = stream_priority;
11373 else if (stream_priority == nzero_stream_priority)
11377 if ((nzero_pid_stream->data.audio.mode != AUDIO_MULTICHANNEL) &&
11378 (stream_rec->data.audio.mode == AUDIO_MULTICHANNEL))
11381 nzero_pid_stream = stream_rec;
11382 nzero_stream_priority = stream_priority;
11390 stream_rec = stream_rec->next;
11394 stream_rec = exact_match_stream;
11395 if (stream_rec == NULL)
11397 stream_rec = default_match_stream;
11398 if (stream_rec == NULL)
11400 stream_rec = lang_code_match_stream;
11401 if (stream_rec == NULL)
11403 stream_rec = qaa_match_stream;
11404 if (stream_rec == NULL)
11406 stream_rec = audio_type_match_stream;
11407 if (stream_rec == NULL)
11409 stream_rec = nzero_pid_stream;
11417 if (stream_rec != NULL)
11419 audio_pid = stream_rec->pid;
11420 *audio_mode = stream_rec->data.audio.mode;
11421 *audio_type = stream_rec->type;
11422 *selected_stream = stream_rec;
11426 FUNCTION_FINISH(GetReqdAudioPid);
11436 static U8BIT AudioStreamPriority(ADB_STREAM_TYPE stream_type)
11439 U16BIT num_entries;
11442 FUNCTION_START(AudioStreamPriority);
11445 num_entries =
sizeof(audio_priority_table) /
sizeof(audio_priority_table[0]);
11447 for (i = 0; i < num_entries; i++)
11449 if (stream_type == audio_priority_table[i])
11456 FUNCTION_FINISH(AudioStreamPriority);
11471 static E_STREAM_MATCH_TYPE GetReqdSubtitleParams(
ADB_SERVICE_REC *s_ptr, U16BIT *pid_ptr,
11472 U16BIT *cpage_ptr, U16BIT *apage_ptr, U8BIT *db_lang_ids, BOOLEAN *primary_found,
11475 E_STREAM_MATCH_TYPE match_type;
11482 U32BIT def_lang_code;
11483 E_STB_AV_ASPECT_RATIO aspect_ratio;
11485 E_SUBTITLE_TYPE subtitle_type;
11487 FUNCTION_START(GetReqdSubtitleParams);
11489 *primary_found = FALSE;
11490 *selected_stream = NULL;
11494 nzero_pid_stream = NULL;
11495 undef_match_stream = NULL;
11496 default_match_stream = NULL;
11497 aspect_match_stream = NULL;
11498 exact_match_stream = NULL;
11500 aspect_ratio = (E_STB_AV_ASPECT_RATIO)
APP_NvmRead(ASPECT_RATIO_NVM);
11501 subtitle_type = (E_SUBTITLE_TYPE)
APP_NvmRead(SUBTITLE_TYPE_NVM);
11503 stream_rec = s_ptr->stream_list;
11504 while (stream_rec != NULL)
11506 if (stream_rec->type == ADB_SUBTITLE_STREAM)
11509 stream_rec->in_use = FALSE;
11511 if (stream_rec->pid != 0)
11514 if ((s_ptr->reqd_subtitle_valid == TRUE) &&
11515 (exact_match_stream == NULL) &&
11516 (stream_rec->data.subtitle.lang_code == s_ptr->reqd_subtitle_lang_code) &&
11517 (stream_rec->data.subtitle.type == s_ptr->reqd_subtitle_type))
11520 exact_match_stream = stream_rec;
11521 *primary_found = TRUE;
11525 if (db_lang_ids != NULL)
11529 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) && (db_lang_ids[i] != ACFG_INVALID_DB_LANG); i++)
11533 if (subtitle_type == SUBTITLE_NORMAL)
11535 if ((aspect_match_stream == NULL) &&
11536 (def_lang_code == stream_rec->data.subtitle.lang_code) &&
11537 (((aspect_ratio == ASPECT_RATIO_4_3) &&
11538 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_4_3)) ||
11539 ((aspect_ratio == ASPECT_RATIO_16_9) &&
11540 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_16_9))))
11542 aspect_match_stream = stream_rec;
11543 *primary_found = TRUE;
11548 if ((aspect_match_stream == NULL) &&
11549 (def_lang_code == stream_rec->data.subtitle.lang_code) &&
11550 (((aspect_ratio == ASPECT_RATIO_4_3) &&
11551 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_4_3)) ||
11552 ((aspect_ratio == ASPECT_RATIO_16_9) &&
11553 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_16_9))))
11555 aspect_match_stream = stream_rec;
11556 *primary_found = TRUE;
11561 if (subtitle_type == SUBTITLE_NORMAL)
11563 if ((default_match_stream == NULL) &&
11564 (def_lang_code == stream_rec->data.subtitle.lang_code) &&
11565 ((stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB) ||
11566 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_4_3) ||
11567 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_16_9) ||
11568 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HD)))
11570 default_match_stream = stream_rec;
11571 *primary_found = TRUE;
11580 if ((default_match_stream == NULL) && (def_lang_code == stream_rec->data.subtitle.lang_code) &&
11581 ((stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB) ||
11582 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_4_3) ||
11583 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_16_9) ||
11584 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HD)))
11586 default_match_stream = stream_rec;
11587 *primary_found = TRUE;
11589 if ((def_lang_code == stream_rec->data.subtitle.lang_code) &&
11590 ((stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING) ||
11591 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_4_3) ||
11592 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_16_9) ||
11593 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_HD)))
11595 default_match_stream = stream_rec;
11596 *primary_found = TRUE;
11603 if ((undef_match_stream == NULL) &&
11604 ((stream_rec->data.subtitle.lang_code == ADB_LANG_CODE_UNDEF) ||
11605 (stream_rec->data.subtitle.lang_code == ADB_LANG_CODE_QAA)))
11607 undef_match_stream = stream_rec;
11611 if (nzero_pid_stream == NULL)
11613 nzero_pid_stream = stream_rec;
11618 stream_rec = stream_rec->next;
11622 stream_rec = exact_match_stream;
11623 match_type = STREAM_MATCH_EXACT;
11624 if (stream_rec == NULL)
11626 stream_rec = aspect_match_stream;
11628 match_type = STREAM_MATCH_ASPECT;
11629 if (stream_rec == NULL)
11631 stream_rec = default_match_stream;
11632 match_type = STREAM_MATCH_LANG;
11633 if (stream_rec == NULL)
11635 stream_rec = undef_match_stream;
11636 match_type = STREAM_MATCH_TYPE;
11637 if (stream_rec == NULL)
11639 stream_rec = nzero_pid_stream;
11640 match_type = STREAM_MATCH_NOT_ZERO;
11647 if ((subtitle_type == SUBTITLE_NORMAL) &&
11648 ((stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING) ||
11649 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_4_3) ||
11650 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_16_9)))
11663 if ((stream_rec != NULL) &&
11664 ((stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB) ||
11665 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_4_3) ||
11666 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_16_9) ||
11667 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_221_1) ||
11668 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HD) ||
11669 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING) ||
11670 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_4_3) ||
11671 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_16_9) ||
11672 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_221_1) ||
11673 (stream_rec->data.subtitle.type == ADB_SUBTITLE_TYPE_DVB_HARD_HEARING_HD)))
11675 *pid_ptr = stream_rec->pid;
11676 *cpage_ptr = stream_rec->data.subtitle.composition_page;
11677 *apage_ptr = stream_rec->data.subtitle.ancillary_page;
11678 *selected_stream = stream_rec;
11685 match_type = STREAM_MATCH_NONE;
11693 match_type = STREAM_MATCH_NONE;
11696 FUNCTION_FINISH(GetReqdSubtitleParams);
11698 return(match_type);
11721 static E_STREAM_MATCH_TYPE GetReqdTtextParams(
ADB_SERVICE_REC *s_ptr, U16BIT *pid_ptr, BOOLEAN for_subtitles,
11722 U8BIT *magazine, U8BIT *page, U8BIT *db_lang_ids, BOOLEAN *primary_found,
ADB_STREAM_REC **selected_stream)
11724 E_STREAM_MATCH_TYPE match_type;
11731 U32BIT def_lang_code;
11733 E_SUBTITLE_TYPE subtitle_type;
11735 FUNCTION_START(GetReqdTtextParams);
11737 match_type = STREAM_MATCH_NONE;
11738 *primary_found = FALSE;
11739 *selected_stream = NULL;
11741 subtitle_type = (E_SUBTITLE_TYPE)
APP_NvmRead(SUBTITLE_TYPE_NVM);
11745 nzero_pid_stream = NULL;
11746 default_match_stream = NULL;
11747 exact_match_stream = NULL;
11748 normal_subt_nzero_pid_stream = NULL;
11749 normal_subt_default_match_stream = NULL;
11751 stream_rec = s_ptr->stream_list;
11752 while (stream_rec != NULL)
11754 if (stream_rec->type == ADB_TTEXT_STREAM)
11757 stream_rec->in_use = FALSE;
11759 if (stream_rec->pid != 0)
11762 if ((s_ptr->reqd_ttext_valid == TRUE) && (exact_match_stream == NULL) &&
11763 (stream_rec->data.ttext.lang_code == s_ptr->reqd_ttext_lang_code) &&
11764 (stream_rec->data.ttext.type == s_ptr->reqd_ttext_type))
11767 exact_match_stream = stream_rec;
11768 *primary_found = TRUE;
11772 if (db_lang_ids != NULL)
11775 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) && (db_lang_ids[i] != ACFG_INVALID_DB_LANG); i++)
11779 if ((default_match_stream == NULL) &&
11780 (def_lang_code == stream_rec->data.ttext.lang_code) &&
11781 ((for_subtitles && (UserPrefsMatch(stream_rec->data.ttext.type, subtitle_type) == TRUE)) ||
11782 (!for_subtitles && (stream_rec->data.ttext.type != ADB_TELETEXT_TYPE_SUBTITLE) &&
11783 (stream_rec->data.ttext.type != ADB_TELETEXT_TYPE_SUBTITLE_HARD_HEARING) &&
11784 (stream_rec->data.ttext.type == ADB_TELETEXT_TYPE_INITIAL))))
11786 default_match_stream = stream_rec;
11787 *primary_found = TRUE;
11789 else if ((normal_subt_default_match_stream == NULL) &&
11790 (def_lang_code == stream_rec->data.ttext.lang_code) &&
11791 (for_subtitles && (stream_rec->data.ttext.type == ADB_TELETEXT_TYPE_SUBTITLE) &&
11792 (subtitle_type == SUBTITLE_HARD_OF_HEARING)))
11794 normal_subt_default_match_stream = stream_rec;
11795 *primary_found = TRUE;
11801 if ((nzero_pid_stream == NULL) &&
11802 ((for_subtitles && (UserPrefsMatch(stream_rec->data.ttext.type, subtitle_type) == TRUE)) ||
11803 (!for_subtitles && (stream_rec->data.ttext.type != ADB_TELETEXT_TYPE_SUBTITLE))))
11805 nzero_pid_stream = stream_rec;
11807 else if ((normal_subt_nzero_pid_stream == NULL) &&
11808 (for_subtitles && (stream_rec->data.ttext.type == ADB_TELETEXT_TYPE_SUBTITLE) &&
11809 (subtitle_type == SUBTITLE_HARD_OF_HEARING)))
11811 normal_subt_nzero_pid_stream = stream_rec;
11816 stream_rec = stream_rec->next;
11820 stream_rec = exact_match_stream;
11821 match_type = STREAM_MATCH_EXACT;
11822 if (stream_rec == NULL)
11824 stream_rec = default_match_stream;
11825 match_type = STREAM_MATCH_LANG;
11826 if (stream_rec == NULL)
11828 stream_rec = normal_subt_default_match_stream;
11829 match_type = STREAM_MATCH_LANG;
11830 if (stream_rec == NULL)
11832 stream_rec = nzero_pid_stream;
11833 match_type = STREAM_MATCH_NOT_ZERO;
11834 if (stream_rec == NULL)
11836 stream_rec = normal_subt_nzero_pid_stream;
11837 match_type = STREAM_MATCH_NOT_ZERO;
11857 if (stream_rec != NULL)
11859 *pid_ptr = stream_rec->pid;
11860 *magazine = stream_rec->data.ttext.magazine;
11861 *page = stream_rec->data.ttext.page;
11862 *selected_stream = stream_rec;
11878 FUNCTION_FINISH(GetReqdTtextParams);
11880 return(match_type);
11892 static U16BIT GetReqdADPid(
ADB_SERVICE_REC *s_ptr, E_STB_DP_AUDIO_MODE *ad_mode, U8BIT *db_lang_ids,
11900 U32BIT def_lang_code;
11901 BOOLEAN prefer_hd_stream;
11902 U8BIT stream_priority;
11903 U8BIT lang_stream_priority;
11904 U8BIT nar_stream_priority;
11907 FUNCTION_START(GetReqdADPid);
11910 *ad_mode = AUDIO_MONO;
11911 *selected_stream = NULL;
11912 *broadcast_mix = FALSE;
11916 lang_code_match_stream = NULL;
11917 exact_match_stream = NULL;
11918 nar_match_stream = NULL;
11920 prefer_hd_stream =
APP_NvmRead(PREFER_HD_AUDIO_NVM);
11923 stream_rec = s_ptr->stream_list;
11924 while (stream_rec != NULL)
11926 if ((stream_rec->type == ADB_AUDIO_STREAM) ||
11927 (stream_rec->type == ADB_AAC_AUDIO_STREAM) ||
11928 (stream_rec->type == ADB_HEAAC_AUDIO_STREAM) ||
11929 (stream_rec->type == ADB_AC3_AUDIO_STREAM) ||
11930 (stream_rec->type == ADB_EAC3_AUDIO_STREAM)
11934 stream_rec->in_use = FALSE;
11936 if (stream_rec->pid != 0)
11939 if ((s_ptr->reqd_audio_valid == TRUE) &&
11940 (exact_match_stream == NULL) &&
11941 (stream_rec->data.audio.lang_code == s_ptr->reqd_audio_lang_code) &&
11942 (stream_rec->data.audio.type == ADB_AUDIO_TYPE_FOR_VISUALLY_IMPAIRED))
11945 exact_match_stream = stream_rec;
11949 stream_priority = AudioStreamPriority(stream_rec->type);
11950 if (db_lang_ids != NULL)
11953 for (i = 0; (i < ACFG_MAX_DB_LANG_CODES) && (db_lang_ids[i] != ACFG_INVALID_DB_LANG); i++)
11957 if (((def_lang_code == stream_rec->data.audio.lang_code) ||
11958 (stream_rec->data.audio.lang_code == ADB_LANG_CODE_UNDEF)) &&
11959 (stream_rec->data.audio.type == ADB_AUDIO_TYPE_FOR_VISUALLY_IMPAIRED))
11961 if (lang_code_match_stream == NULL)
11964 lang_code_match_stream = stream_rec;
11965 lang_stream_priority = stream_priority;
11971 if (!prefer_hd_stream)
11974 if (stream_priority < lang_stream_priority)
11977 lang_code_match_stream = stream_rec;
11978 lang_stream_priority = stream_priority;
11980 else if (stream_priority == lang_stream_priority)
11984 if ((lang_code_match_stream->data.audio.mode == AUDIO_MULTICHANNEL) &&
11985 (stream_rec->data.audio.mode != AUDIO_MULTICHANNEL))
11988 lang_code_match_stream = stream_rec;
11989 lang_stream_priority = stream_priority;
11995 if (stream_priority > lang_stream_priority)
11998 lang_code_match_stream = stream_rec;
11999 lang_stream_priority = stream_priority;
12001 else if (stream_priority == lang_stream_priority)
12005 if ((lang_code_match_stream->data.audio.mode != AUDIO_MULTICHANNEL) &&
12006 (stream_rec->data.audio.mode == AUDIO_MULTICHANNEL))
12009 lang_code_match_stream = stream_rec;
12010 lang_stream_priority = stream_priority;
12019 if (stream_rec->data.audio.lang_code == ADB_LANG_CODE_NAR)
12021 if (nar_match_stream == NULL)
12023 nar_match_stream = stream_rec;
12024 nar_stream_priority = stream_priority;
12030 if (!prefer_hd_stream)
12033 if (stream_priority < nar_stream_priority)
12036 nar_match_stream = stream_rec;
12037 nar_stream_priority = stream_priority;
12039 else if (stream_priority == nar_stream_priority)
12043 if ((nar_match_stream->data.audio.mode == AUDIO_MULTICHANNEL) &&
12044 (stream_rec->data.audio.mode != AUDIO_MULTICHANNEL))
12047 nar_match_stream = stream_rec;
12048 nar_stream_priority = stream_priority;
12054 if (stream_priority > nar_stream_priority)
12057 nar_match_stream = stream_rec;
12058 nar_stream_priority = stream_priority;
12060 else if (stream_priority == nar_stream_priority)
12064 if ((nar_match_stream->data.audio.mode != AUDIO_MULTICHANNEL) &&
12065 (stream_rec->data.audio.mode == AUDIO_MULTICHANNEL))
12068 nar_match_stream = stream_rec;
12069 nar_stream_priority = stream_priority;
12078 stream_rec = stream_rec->next;
12082 stream_rec = exact_match_stream;
12083 if (stream_rec == NULL)
12085 stream_rec = lang_code_match_stream;
12086 if (stream_rec == NULL)
12088 stream_rec = nar_match_stream;
12089 if (stream_rec != NULL)
12091 *broadcast_mix = TRUE;
12097 if (stream_rec != NULL)
12099 ad_pid = stream_rec->pid;
12100 *ad_mode = stream_rec->data.audio.mode;
12101 *selected_stream = stream_rec;
12105 FUNCTION_FINISH(GetReqdADPid);
12110 #if defined(COUNTRY_FINLAND) || defined(COUNTRY_IRELAND) 12119 static U16BIT FindLargestLcnNumber(E_STB_DP_SIGNAL_TYPE tuner_type, U16BIT onet_id)
12123 U16BIT largest_lcn = 0;
12125 FUNCTION_START(FindLargestLcnNumber);
12128 while (s_ptr != NULL)
12131 t_ptr = s_ptr->transport;
12132 if ((tuner_type == SIGNAL_NONE) || (onet_id == ADB_INVALID_DVB_ID) || (t_ptr != NULL))
12134 if ((tuner_type == SIGNAL_NONE) || (t_ptr->sig_type == tuner_type))
12136 if ((onet_id == ADB_INVALID_DVB_ID) || (onet_id == t_ptr->orig_net_id))
12138 if (s_ptr->serv_lcn > largest_lcn)
12140 largest_lcn = s_ptr->serv_lcn;
12149 FUNCTION_FINISH(FindLargestLcnNumber);
12151 return largest_lcn;
12168 U16BIT *next_allocated_lcn, BOOLEAN *lcn_assigned)
12170 BOOLEAN continue_search;
12171 U8BIT device_region_depth;
12172 U8BIT s1_region_depth, s2_region_depth;
12173 U32BIT device_country_code;
12174 U8BIT device_primary_region;
12175 U8BIT device_secondary_region;
12176 U16BIT device_tertiary_region;
12178 FUNCTION_START(ApplyTargetRegionRules);
12180 continue_search = TRUE;
12181 *lcn_assigned = FALSE;
12183 device_region_depth = (U8BIT)
APP_NvmRead(TARGET_REGION_DEPTH_NVM);
12184 if (device_region_depth > 0)
12186 device_primary_region = 0;
12187 device_secondary_region = 0;
12188 device_tertiary_region = 0;
12190 device_country_code = (U32BIT)
APP_NvmRead(TARGET_REGION_COUNTRY_NVM);
12192 if (device_region_depth > 1)
12194 device_primary_region = (U8BIT)
APP_NvmRead(TARGET_REGION_PRIMARY_NVM);
12195 if (device_region_depth > 2)
12197 device_secondary_region = (U8BIT)
APP_NvmRead(TARGET_REGION_SECONDARY_NVM);
12198 if (device_region_depth > 3)
12200 device_tertiary_region = (U8BIT)
APP_NvmRead(TARGET_REGION_TERTIARY_NVM);
12206 s1_region_depth = GetTargetRegionMatchDepth(s1_ptr, device_region_depth, device_country_code,
12207 device_primary_region, device_secondary_region, device_tertiary_region);
12209 s2_region_depth = GetTargetRegionMatchDepth(s2_ptr, device_region_depth, device_country_code,
12210 device_primary_region, device_secondary_region, device_tertiary_region);
12212 if (s1_region_depth < s2_region_depth)
12215 s1_ptr->allocated_lcn = *next_allocated_lcn;
12216 (*next_allocated_lcn)++;
12217 *lcn_assigned = TRUE;
12218 continue_search = FALSE;
12220 else if (s1_region_depth > s2_region_depth)
12223 if (s2_ptr->allocated_lcn == s2_ptr->serv_lcn)
12225 if (s2_ptr->unavailable == FALSE)
12229 s1_ptr->allocated_lcn = *next_allocated_lcn;
12230 (*next_allocated_lcn)++;
12231 continue_search = FALSE;
12236 s2_ptr->allocated_lcn = *next_allocated_lcn;
12237 (*next_allocated_lcn)++;
12241 *lcn_assigned = TRUE;
12245 FUNCTION_FINISH(ApplyTargetRegionRules);
12247 return(continue_search);
12264 static U8BIT GetTargetRegionMatchDepth(
ADB_SERVICE_REC *s_ptr, U8BIT match_depth,
12265 U32BIT country_code, U8BIT primary_region, U8BIT secondary_region, U16BIT tertiary_region)
12271 tptr = s_ptr->target_region_list;
12274 if ((s_ptr->transport != NULL) &&
12275 (s_ptr->transport->sig_type == SIGNAL_COFDM))
12277 tptr = s_ptr->transport->u.terr.target_region_list;
12280 if (s_ptr->transport->network != NULL)
12282 tptr = s_ptr->transport->network->target_region_list;
12290 while (tptr != NULL)
12292 if (tptr->country_code == country_code)
12294 if (best_depth < 1)
12299 if (match_depth > 1)
12301 rptr = tptr->region_list;
12302 while (rptr != NULL)
12304 if ((rptr->region_depth >= 1) && (rptr->primary_region_code == primary_region))
12306 if (best_depth < 2)
12311 if (match_depth > 2)
12313 if ((rptr->region_depth >= 2) && (rptr->secondary_region_code == secondary_region))
12315 if (best_depth < 3)
12320 if (match_depth > 3)
12322 if ((rptr->region_depth >= 3) && (rptr->tertiary_region_code == tertiary_region))
12324 if (best_depth < 4)
12342 return(best_depth);
12354 static BOOLEAN UserPrefsMatch(ADB_TELETEXT_TYPE ttext_type, E_SUBTITLE_TYPE user_pref)
12356 BOOLEAN retval = FALSE;
12358 if (((ttext_type == ADB_TELETEXT_TYPE_SUBTITLE) && (user_pref == SUBTITLE_NORMAL)) ||
12359 ((ttext_type == ADB_TELETEXT_TYPE_SUBTITLE_HARD_HEARING) && (user_pref == SUBTITLE_HARD_OF_HEARING)))
12381 FUNCTION_START(LcnSortCompareFunc);
12383 ASSERT(blk_1 != NULL);
12384 ASSERT(blk_2 != NULL);
12389 if ((s1_ptr != NULL) && (s2_ptr != NULL))
12391 lcn_1 = (S16BIT)s1_ptr->allocated_lcn;
12392 lcn_2 = (S16BIT)s2_ptr->allocated_lcn;
12393 ret_val = lcn_1 - lcn_2;
12396 FUNCTION_FINISH(LcnSortCompareFunc);
12414 FUNCTION_START(FavServiceSortCompare);
12421 if ((fs1 != NULL) && (fs2 != NULL))
12423 if (fs1->index < fs2->index)
12427 else if (fs1->index > fs2->index)
12433 FUNCTION_FINISH(FavServiceSortCompare);
12448 U32DHMS end_date_time;
12450 FUNCTION_START(InsertEventInSchedule);
12453 add_ptr = &(serv_ptr->event_schedule);
12455 if (serv_ptr->event_schedule != NULL)
12457 e_ptr = serv_ptr->event_schedule;
12460 while ((e_ptr != NULL) && (end_date_time < event_ptr->start))
12462 add_ptr = &(e_ptr->next);
12463 if ((e_ptr = e_ptr->next) != NULL)
12470 event_ptr->next = *add_ptr;
12471 *add_ptr = event_ptr;
12473 serv_ptr->num_events_in_schedule++;
12475 FUNCTION_FINISH(InsertEventInSchedule);
12492 FUNCTION_START(TimerSortDateTime);
12494 ASSERT(timer1 != NULL);
12495 ASSERT(timer2 != NULL);
12501 if ((t1_ptr != NULL) && (t2_ptr != NULL))
12503 if (t1_ptr->start_time > t2_ptr->start_time)
12509 if (t1_ptr->start_time < t2_ptr->start_time)
12521 FUNCTION_FINISH(TimerSortDateTime);
12543 FUNCTION_START(TimerSortName);
12545 ASSERT(timer1 != NULL);
12546 ASSERT(timer2 != NULL);
12552 if ((t1_ptr != NULL) && (t2_ptr != NULL))
12569 FUNCTION_FINISH(TimerSortName);
12579 static BOOLEAN IsVideoStreamType(ADB_STREAM_TYPE type)
12583 FUNCTION_START(IsVideoStreamType);
12585 if ((type == ADB_VIDEO_STREAM) || (type == ADB_H264_VIDEO_STREAM) ||
12586 (type == ADB_H265_VIDEO_STREAM))
12595 FUNCTION_FINISH(IsVideoStreamType);
12600 static U8BIT* ReadLanguageCode(U8BIT *dptr, U32BIT *lang_code)
12606 FUNCTION_START(ReadLanguageCode);
12609 for (i = 0; i < 3; i++)
12613 if ((code_char >=
'A') && (code_char <=
'Z'))
12617 lcode = (lcode << 8) | code_char;
12619 *lang_code = lcode;
12621 FUNCTION_FINISH(ReadLanguageCode);
12626 static U8BIT* CopyString(
ADB_STRING *str_desc, BOOLEAN to_unicode)
12629 U8BIT *copied_string;
12631 FUNCTION_START(CopyString);
12633 copied_string = NULL;
12634 if (str_desc != NULL)
12639 str_desc->lang_code);
12643 str_len = (U16BIT)str_desc->nbytes;
12645 if (copied_string != NULL)
12647 memcpy(copied_string, str_desc->str_ptr, str_len);
12652 FUNCTION_FINISH(CopyString);
12654 return(copied_string);
ADB_LNB_BAND_REC * DBDEF_GetNextLNBBandRec(ADB_LNB_BAND_REC *band_ptr)
Returns the next LNB band record after the one given. If the argument is NULL then the first record i...
U8BIT DBDEF_GetEventComponentList(ADB_EVENT_REC *e_ptr, ADB_EVENT_COMPONENT_INFO **component_list)
Retrieves a list of components associated with the specified event, as described by component descrip...
U16BIT DBDEF_GetReqdAudioPid(ADB_SERVICE_REC *s_ptr, E_STB_DP_AUDIO_MODE *audio_mode, ADB_STREAM_TYPE *audio_type)
Gets the appropriate audio pid - looks first for the pid matching exactly the required audio settings...
U8BIT * DBDEF_GetServiceGuidanceData(ADB_SERVICE_REC *s_ptr, U8BIT *type, U8BIT *mode)
Returns the guidance text for the service, as a UTF-8 string. The returned string should be freed usi...
U8BIT DBDEF_GetEventParentalAge(ADB_EVENT_REC *e_ptr)
Returns the parental age value for the given event.
void DBDEF_SetTunedTransport(U8BIT path, ADB_TRANSPORT_REC *t_ptr)
sets the currently tuned transport
U8BIT * STB_ConvertStringToUnicode(U8BIT *string, BOOLEAN *reverse_dir, U16BIT *nchar, BOOLEAN strip_DVB_cntrl_char, U32BIT lang_code)
Converts the specified DVB coded string into a unicode string, counting the number of characters and ...
void * DBA_CreateRecord(U32BIT record_id, void *parent)
Creates a new record of the given type, adding it to the database as a child of the given parent reco...
void DBDEF_DeleteCridRecord(ADB_CRID_REC *c_ptr)
Deletes the given CRID record from the database.
void STB_DPSetTunedTransport(U8BIT path, void *transport)
Saves the given transport with the specified decode path.
U32DHMS STB_GCCalculateDHMS(U32DHMS dhms, U32DHMS period, E_STB_GC_CALCTYPE calc)
Calculates the date/time when the period is added/subtracted to/from dhms.
void STB_LLAddBlockToEnd(LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the end of the linked list identified by the list...
U32BIT ACFG_GetUndefinedLanguageBehaviour(void)
Gets the language code set by ACFG_SetUndefinedLanguageBehaviour, or 'und' if that function has not b...
void DBDEF_RemoveEmptyTransports(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Delete all transport records that don't have any services.
AllocLcnFunc ACFG_GetTerrestrialLcnFunction(U32BIT country_code)
Returns a pointer to a function that's used to assign LCNs following a DVB-T/T2 scan for the given co...
void DBDEF_DeleteEventList(ADB_EVENT_REC *elist)
Deletes all events in the given list.
U16BIT DBDEF_GetNumServicesInFavouriteList(ADB_FAVLIST_REC *fav_list)
Returns the number of services in the given favourite list.
U16BIT DBDEF_GetReqdADPid(ADB_SERVICE_REC *s_ptr, E_STB_DP_AUDIO_MODE *ad_mode, ADB_STREAM_TYPE *ad_type, BOOLEAN *broadcast_mix)
Gets the appropriate audio description pid - looks first for the pid matching exactly the required au...
U8BIT * DBDEF_GetTextLang(void)
returns array of current text langs
void * STB_DPGetTunedService(U8BIT path)
Returns the service saved with the given decode path.
void DBDEF_SetSecondaryTextLang(U8BIT *lang_ids)
sets secondary text lang
ADB_FAVSERV_REC * DBDEF_FindServiceInFavouriteList(ADB_FAVLIST_REC *fav_list, void *serv_ptr)
Returns the ADB_FAVSERV_REC from the given favourite list for the given service.
U16BIT ACFG_GetLastUnallocatedLcn(U32BIT country_code, E_STB_DP_SIGNAL_TYPE tuner_type)
Returns the last LCN that should be used when assigning LCNs to services that don't appear in an LCN ...
U16BIT DBDEF_GetNumSatellites(void)
Returns the number of satellite records in the database.
BOOLEAN DBDEF_SetLNB22k(ADB_LNB_REC *lnb, BOOLEAN is_22k)
Sets the LNB 22k setting.
BOOLEAN DBA_SaveDatabase(void)
Saves any changes made to the working database to non-volatile storage. If saving to a file...
ADB_SERVICE_REC * DBDEF_FindServiceRecByLcn(U16BIT lcn, ADB_TRANSPORT_REC *t_ptr, BOOLEAN allocated_lcn)
Find the service with the given LCN, and optionally on the given transport.
ADB_TRANSPORT_REC * DBDEF_FindSatTransportRec(U32BIT freq_hz, U16BIT symbol_rate, E_STB_DP_POLARITY polarity, BOOLEAN dvb_s2, E_STB_DP_MODULATION modulation, void *satellite)
Find the satellite transport record in the database matching the given params.
void DBDEF_TidyDatabaseNordig(E_STB_DP_SIGNAL_TYPE tuner_type, BOOLEAN search_completed, BOOLEAN manual)
Iterates through all the services following a search search to see whether any need to be deleted bas...
Application configuration.
ADB_FAVSERV_REC * DBDEF_AddServiceToFavouriteList(ADB_FAVLIST_REC *fav_list, ADB_SERVICE_REC *serv_ptr, S16BIT index)
Adds a new service to the given favourite list at the given position.
ADB_EVENT_ITEMIZED_INFO * ADB_GetEventItemizedDescription(void *event_ptr, U16BIT *num_items_ptr)
Returns the items of extended event descriptor as item descriptor and item itself.
U16BIT DBDEF_GetNumCridRecords(void)
Returns the number of CRID records in the database.
Application database control.
LINK_LIST_PTR_BLK * STB_LLGetPrevBlock(LINK_LIST_PTR_BLK *blk)
Returns a pointer to the previous block in the linked list, or NULL if at the start of the list...
U16BIT DBDEF_GetDeletedServiceList(E_STB_DP_SIGNAL_TYPE tuner_type, void ***slist_ptr)
Header file - macros and function prototypes for public use.
BOOLEAN DBDEF_IsActiveProfile(ADB_NETWORK_REC *profile)
Is the given profile the currently active profile?
U8BIT * ACTL_GetRfNameFromFreq(E_STB_DP_SIGNAL_TYPE tuner_type, U32BIT freq_hz)
Returns the rf name appropriate to the frequency specified.
Header file for NVM data handling functions.
BOOLEAN DBDEF_SetServiceType(ADB_SERVICE_REC *s_ptr, ADB_SERVICE_TYPE serv_type)
Sets the service type for the given service record.
ADB_TRANSPORT_REC * DBDEF_FindTerrestrialTransportRec(U32BIT freq_hz, U8BIT plp_id)
Find the terrestrial transport record in the database matching the given params.
BOOLEAN DBDEF_SetLNBCSwitch(ADB_LNB_REC *lnb, E_STB_DP_DISEQC_CSWITCH cswitch)
Sets the LNB committed switch setting.
void DBDEF_SetCridProgrammeName(ADB_CRID_REC *c_ptr, U8BIT *prog_name)
Sets the programme name field of the given CRID record.
BOOLEAN DBA_SetFieldLangString(void *record, U32BIT field_id, U32BIT lang_code, U8BIT *string, U16BIT num_bytes)
Set the string value of a record's field. The function will fail if the record doesn't exist...
void DBDEF_SetTunedService(U8BIT path, ADB_SERVICE_REC *s_ptr)
Sets the currently tuned service.
void * STB_AppGetMemory(U32BIT bytes)
Attempts to allocate memory from the application heap.
ADB_SERVICE_REC * DBDEF_FindServiceRecByIds(ADB_SERVICE_REC *servp, U32BIT net_id, U32BIT onet_id, U32BIT tran_id, U32BIT serv_id)
Search for a service with the given IDs.
void DBDEF_SetTransportTransportId(ADB_TRANSPORT_REC *t_ptr, U16BIT tran_id)
Sets the transport ID of the given transport.
S8BIT STB_DPGetAnalogFreqOff(U8BIT path)
Reads the analogue frequency offset value from decode path store.
void DBA_SaveRecord(void *record)
Forces a record to be saved to non-volatile storage. Depending on the implementation, this function may not do anything if the data is updated to non-volatile storage as any records and/or fields are created or updated.
void DBDEF_DeleteTimerRec(ADB_TIMER_REC *timer)
Deletes the given timer from the database.
DBTidyFunc ACFG_GetSatelliteDBTidyFunction(U32BIT country_code)
Returns a pointer to a function that's used to tidy up the database following a DVB-S/S2 scan for the...
U8BIT * DBDEF_GetEventGuidance(ADB_EVENT_REC *e_ptr, ADB_SERVICE_REC *s_ptr, U8BIT *type, U8BIT *mode)
Returns the guidance text for an event, either from the event itself or the event's service...
void DBDEF_TidyDatabaseSatUK(E_STB_DP_SIGNAL_TYPE tuner_type, BOOLEAN search_completed, BOOLEAN manual)
Iterates through all the services following a search search to see whether any need to be deleted bas...
void DBDEF_SetAudioLang(U8BIT *lang_ids)
sets current audio lang
Structure representing the component information as found in the EIT component_descriptor.
void DBDEF_PopProfile(void)
Restores a previously pushed profile.
BOOLEAN DBDEF_SetServiceName(ADB_SERVICE_REC *s_ptr, U8BIT *name)
Set or change the name of a service.
ADB_TRANSPORT_REC * DBDEF_AddSatTransportRec(U32BIT freq_hz, U16BIT symbol_rate, E_STB_DP_POLARITY polarity, BOOLEAN dvb_s2, E_STB_DP_MODULATION modulation, ADB_NETWORK_REC *network)
Adds a satellite transport record with the given frequency, symbol rate and polarity.
BOOLEAN DBA_GetFieldData(void *record, U32BIT field_id, U8BIT **data, U16BIT *num_bytes)
Gets the data of a record's field. The function will fail if the record doesn't exist, the record doesn't include the given field, or the field isn't a data field. The pointer to the data returned will be to the data held by the database, so the data must not be changed.
U16BIT STB_LLGetNumBlocks(LINK_LIST_HEADER *hdr)
Counts and returns the number of blocks in a linked list.
ADB_FAVLIST_REC * DBDEF_AddFavouriteList(U8BIT list_id, U8BIT *name, U32BIT user_data, S16BIT index)
Creates a new favourite list and adds it to the list of favourite lists. Creation of the new list wil...
ADB_STREAM_REC * DBDEF_CopyStreamList(ADB_STREAM_REC *slist)
Creates a copy of a stream list, allocating new memory as required.
ADB_CRID_REC * DBDEF_GetNextCridRecord(ADB_CRID_REC *c_ptr)
Returns the next CRID record after the one specified. If the record specified is NULL then the first ...
U8BIT * STB_ConvertStringToUTF8(U8BIT *string, U16BIT *nchar, BOOLEAN strip_DVB_cntrl_char, U32BIT lang_code)
Converts the given DVB coded string into a UTF-8 unicode string. The returned string will be preceded...
Header file - Function prototypes for A/V control.
void DBDEF_ReleaseString(ADB_STRING *string)
Releases an ADB_STRING.
BOOLEAN DBA_LoadDatabase(U8BIT *pathname)
Reads a database from non-volatile storage, creating any structures in memory that will be required t...
BOOLEAN DBDEF_SetLNBUnicable(ADB_LNB_REC *lnb, U32BIT inter_freq, U8BIT chan)
Sets the LNB Unicable settings.
ADB_EVENT_ITEMIZED_INFO * DBDEF_GetEventItemizedDescription(ADB_EVENT_REC *e_ptr, U16BIT *num_items_ptr)
Returns the items of extended event descriptor as item descriptor and item itself.
void DBDEF_ReleaseProfileList(void **profile_list, U16BIT num_profiles)
Frees a profile list returned by DBDEF_GetProfileList.
ADB_TRANSPORT_REC * DBDEF_AddTerrestrialTransportRec(U32BIT freq_hz, U8BIT plp_id, ADB_NETWORK_REC *network)
Adds a terrestrial transport record with the given frequency and PLP id.
U16BIT DBDEF_GetNumFavouriteLists(void)
Returns the number of favourite lists.
U32BIT APP_NvmRead(E_NVM_ITEMS nvm_item)
Returns the current value for the given DVB setting.
BOOLEAN DBDEF_SetLNBRepeats(ADB_LNB_REC *lnb, U8BIT repeats)
Sets the LNB message repeat setting in the range 0 to 3.
void DBDEF_SelectBroadcastProfile(void)
Sets the broadcast profile type for for all network, transport and service record accesses...
void STB_SIReleaseStringDesc(SI_STRING_DESC *desc)
Frees the memory used by the descriptor specified.
ADB_NETWORK_REC * DBDEF_AddNetworkRec(U16BIT net_id, ADB_SATELLITE_REC *satellite)
Adds a new network record to the database with the given network ID.
Application timer functions and defines.
BOOLEAN DBA_GetFieldLangString(void *record, U32BIT field_id, U32BIT lang_code, U8BIT **string, U16BIT *num_bytes)
Gets the string value of a record's field. The function will fail if the record doesn't exist...
ADB_SERVICE_REC * DBDEF_GetTunedService(U8BIT path)
Returns the currently tuned service on the given path.
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')
U32BIT ACFG_ConvertLangIdToCode(U8BIT lang_id)
Returns the language code for the given language id.
LINK_LIST_PTR_BLK * STB_LLGetLastBlock(LINK_LIST_HEADER *hdr)
Returns a pointer to the last block in the linked list, identified by hdr.
BOOLEAN DBDEF_TransportInProfile(ADB_TRANSPORT_REC *t_ptr)
Checks whether the given transport is valid for the current profile. There may be multiple CI+ profil...
ADB_LNB_REC * DBDEF_GetNextLNBRec(ADB_LNB_REC *lnb_ptr)
Returns the next LNB record after the one given. If the argument is NULL then the first record is ret...
BOOLEAN DBDEF_SetLNB12V(ADB_LNB_REC *lnb, BOOLEAN is_12v)
Sets the LNB 12V setting.
AllocLcnFunc ACFG_GetSatelliteLcnFunction(U32BIT country_code)
Returns a pointer to a function that's used to assign LCNs following a DVB-S/S2 scan for the given co...
void DBDEF_DeleteImageIcons(ADB_IMAGE_ICON *icon_list)
Frees given list of image icons and any associated memory.
void DBDEF_DeleteServiceRec(ADB_SERVICE_REC *s_ptr)
Deletes specified service record.
ADB_FAVLIST_REC * DBDEF_FindFavouriteList(U8BIT list_id)
Return the favourite list with the given list id.
void DBDEF_SetSatTransportTuningParams(ADB_TRANSPORT_REC *t_ptr, U32BIT freq_hz, U16BIT symbol_rate, E_STB_DP_POLARITY polarity, BOOLEAN dvb_s2, E_STB_DP_MODULATION modulation, ADB_NETWORK_REC *network)
Sets the tuning parameters for an existing satellite transport.
ADB_LNB_REC * DBDEF_AddLNB(E_STB_DP_LNB_TYPE type, ADB_STRING *name)
Add an LNB record to the database.
void DBDEF_TidyDatabaseAfterSearch(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite, BOOLEAN search_completed, BOOLEAN manual)
Calls any country and tuner type specific function to tidy up the database following a search...
void DBDEF_SetAnalogServiceName(ADB_SERVICE_REC *s_ptr, U8BIT *new_name, U8BIT new_len)
Updates analog service names - ASSUMES NORMAL ASCII CODED.
ADB_FAVSERV_REC * DBDEF_GetPrevServiceFromFavouriteList(ADB_FAVLIST_REC *fav_list, ADB_FAVSERV_REC *fav_serv)
Returns the previous favourite list service record.
U8BIT * DBDEF_GetEventDescription(ADB_EVENT_REC *e_ptr)
Returns the short event description text of the event as a UTF-8 string. The returned string should b...
BOOLEAN DBDEF_SetLNBDiSEqCTone(ADB_LNB_REC *lnb, E_STB_DP_DISEQC_TONE diseqc_tone)
Sets the LNB DiSEqC tone setting.
void * STB_AppResizeMemory(void *ptr, U32BIT new_num_bytes)
Re-allocates a given memory area to the new size, ensuring data contained within the original memory ...
BOOLEAN DBDEF_GetEventAudioDescriptionFlag(ADB_EVENT_REC *e_ptr)
Returns whether audio description is signalled as being available for the given event.
ADB_STRING * DBDEF_GetServiceProviderName(ADB_SERVICE_REC *s_ptr)
Returns a pointer to the service provider name.
ADB_STRING * DBDEF_MakeString(U32BIT lang_code, U8BIT *str_ptr, U16BIT nbytes)
Creates an ADB_STRING, copying the given data into it. If the string passed in is NULL or the number ...
U8BIT STB_DPGetNumPaths(void)
Returns the maximum number of decode paths.
U16BIT DBDEF_GetNumServices(void)
Returns the total number of services.
E_STB_DP_ANALOG_VIDEO_TYPE STB_DPGetAnalogVideoType(U8BIT path)
Reads the analogue video type value from decode path store.
ADB_EVENT_CONTENT DBDEF_GetEventGenre(ADB_EVENT_REC *e_ptr, ADB_SERVICE_REC *s_ptr)
Returns the genre of an event.
DBTidyFunc ACFG_GetCableDBTidyFunction(U32BIT country_code)
Returns a pointer to a function that's used to tidy up the database following a DVB-C scan for the gi...
ADB_SERVICE_REC * DBDEF_GetPrevServiceRec(ADB_SERVICE_REC *s_ptr)
Returns the service before the one given. If NULL is passed then the last service in the list is retu...
void DBDEF_GetTransportAdditionalFrequencies(ADB_TRANSPORT_REC *t_ptr, U8BIT *num_freqs, U32BIT **freqs)
Returns the additional frequencies associated with a transport. The returned array should not be modi...
ADB_TRANSPORT_REC * DBDEF_GetNextTransportRec(ADB_TRANSPORT_REC *t_ptr)
Returns the transport following the one given. If the argument is NULL then the first transport will ...
S8BIT STB_CompareUnicodeStrings(U8BIT *string1_ptr, U8BIT *string2_ptr, BOOLEAN exact_match, BOOLEAN ignore_case)
Compares the contents of the two given unicode strings and returns the status (as per strcmp) ...
U16BIT DBDEF_GetNumLNBs(void)
Returns the number of LNB records in the database.
U16BIT DBDEF_GetNumProfiles(void)
Returns the number of network profiles.
ADB_LNB_BAND_REC * DBDEF_AddLNBBandRec(S_STB_DP_LNB_BAND *band_parameters, ADB_LNB_REC *associated_lnb)
Add an LNB band record to the database.
ADB_PROFILE_TYPE DBDEF_GetCurrentProfileType(void)
Returns the current profile type.
ADB_SERVICE_REC * DBDEF_FindServiceRec(U16BIT serv_id, ADB_TRANSPORT_REC *t_ptr)
Search for the service with the given service ID on the given transport.
void DBDEF_SetNetworkName(ADB_NETWORK_REC *n_ptr, U8BIT *name)
Set or change the name of the given network.
BOOLEAN DBA_GetFieldString(void *record, U32BIT field_id, U8BIT **string, U16BIT *num_bytes)
Gets the string value of a record's field. The function will fail if the record doesn't exist...
void DBDEF_SaveServiceEventSchedule(ADB_SERVICE_REC *s_ptr)
Saves the event schedule of a service to the service database.
BOOLEAN DBDEF_ServiceForTunerType(ADB_SERVICE_REC *s_ptr, E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Checks whether the given service is a terrestrial, cable or satellite service, and optionally check w...
BOOLEAN DBDEF_AddAnalogService(void)
Adds an analogue service, transport and, if necessary, network to the database based on the current t...
U8BIT * DBDEF_GetEventContentData(ADB_EVENT_REC *e_ptr, U8BIT *p_len)
Returns the level 1 and 2 values for all content identifiers for the given event. ...
void STB_ReleaseUnicodeString(U8BIT *string)
Releases the specified unicode string, freeing associated heap resources.
U8BIT * DBDEF_GetServiceDefaultAuthority(ADB_SERVICE_REC *s_ptr)
Returns a copy of the default authority CRID string for the given service. This string will be return...
void DBDEF_ReleaseAccess(void)
Releases access to the app's database.
void DBDEF_TidyDatabaseUK(E_STB_DP_SIGNAL_TYPE tuner_type, BOOLEAN search_completed, BOOLEAN manual)
Iterates through all the services following a search search to see whether any need to be deleted bas...
U16BIT DBDEF_GetNumDeletedServices(E_STB_DP_SIGNAL_TYPE tuner_type)
Returns the number of services that are marked as deleted for the given tuner type.
void DBDEF_SetTransportOrigNetworkId(ADB_TRANSPORT_REC *t_ptr, U16BIT orig_net_id)
Sets the original network ID of the given transport.
BOOLEAN DBA_Initialise(void)
Performs any initialisation required prior to the database being loaded.
BOOLEAN ACFG_IsNordigCountry(void)
Returns whether the current country requires Nordig compliance for SI.
BOOLEAN DBA_SetFieldString(void *record, U32BIT field_id, U8BIT *string, U16BIT num_bytes)
Set the string value of a record's field. The function will fail if the record doesn't exist...
void DBDEF_UpdateCridEitDate(ADB_CRID_REC *c_ptr)
Updates the stored EIT date of this CRID with the current GMT date.
void STB_SPDebugWrite(const char *format,...)
Write debug string to serial/debug port. <CR><LF> characters will be automatically added to the end o...
Debug functions header file.
void STB_LLRemoveBlock(LINK_LIST_PTR_BLK *blk)
Removes the block identified by the blk pointer from its linked list.
Header file - Function prototypes for linked lists.
Header file - macros and function prototypes for public use.
U8BIT * STB_ConcatUnicodeStrings(U8BIT *string1_ptr, U8BIT *string2_ptr)
Appends the contents of string2_ptr to string1_ptr and returns a pointer to the newly created string...
void DBDEF_SetTextLang(U8BIT *lang_ids)
sets current text lang
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. 'enter', 'wait' or 'get').
Header file - macros and function prototypes for public use.
ADB_SERVICE_REC * DBDEF_CopyServiceRec(ADB_SERVICE_REC *orig_serv)
Creates a copy of the given service, copying the service's attributes, e.g. service name...
void DBDEF_SetCridDoNotDelete(ADB_CRID_REC *c_ptr, BOOLEAN do_not_delete)
Sets the do not delete flag in the crid record.
ADB_TRANSPORT_REC * DBDEF_AddCableTransportRec(U32BIT freq_hz, U32BIT symbol_rate, ADB_NETWORK_REC *network)
Adds a cable transport record with the given frequency and symbol rate.
LINK_LIST_PTR_BLK * STB_LLGetNextBlock(LINK_LIST_PTR_BLK *blk)
Returns a pointer to the next block in the linked list, or NULL if at the end of the list...
U8BIT ACFG_ConvertLangCodeToId(U32BIT lang_code)
Returns the language id for the given language code.
Database access defines, structures and public functions.
U32BIT STB_DPGetFrequency(U8BIT path)
Reads the frequency value from decode path store.
ADB_SERVICE_REC * DBDEF_GetNextServiceRec(ADB_SERVICE_REC *s_ptr)
Returns the service after the one given. If NULL is passed then the first service in the list is retu...
ADB_TRANSPORT_REC * DBDEF_FindCableTransportRec(U32BIT freq_hz, U32BIT symbol_rate)
Find the cable transport record in the database matching the given params.
void * DBA_FindRecord(U32BIT record_id, void *parent, void *last_rec)
Finds the next record, of the given type, that comes after last_rec. last_rec must be the same type o...
ADB_FAVLIST_REC * DBDEF_GetNextFavouriteList(ADB_FAVLIST_REC *fav_list)
Returns the favourite list following the given item.
U8BIT * STB_SIReadString(U8BIT nbytes, U8BIT *dptr, SI_STRING_DESC **str_ptr)
Copies a string from a descriptor for the specified length. Converts the number of bytes specified in...
Application configuration data.
void ADB_ReleaseRCTLinks(void *links)
Frees the given list of RCT links.
void DBDEF_SetFavouriteListUserData(ADB_FAVLIST_REC *fav_list, U32BIT user_data)
Saves the given user data with a favourite list.
U16BIT DBDEF_GetNumNetworks(void)
Returns the number of networks in ther service database.
U8BIT * DBDEF_GetSecondaryAudioLang(void)
returns current secondary audio lang
ADB_STRING * DBDEF_GetServiceName(ADB_SERVICE_REC *s_ptr, BOOLEAN short_name, BOOLEAN pref_name)
Returns a pointer to the service name, taking into account perferred names and short names...
void DBDEF_SetServiceFavGroups(ADB_SERVICE_REC *s_ptr, U8BIT groups)
Sets the favourite groups for a service.
ADB_SERVICE_REC * DBDEF_AddServiceRec(U16BIT serv_id, ADB_TRANSPORT_REC *t_ptr)
Adds a new service record to the service database with the given service ID and parent transport...
Header for STB unicode string handling routines.
void DBDEF_DeleteStreamList(ADB_STREAM_REC *slist)
Deletes all records in a service stream list.
DBTidyFunc ACFG_GetTerrestrialDBTidyFunction(U32BIT country_code)
Returns a pointer to a function that's used to tidy up the database following a DVB-T/T2 scan for the...
void DBDEF_SetTunedNetwork(U8BIT path, ADB_NETWORK_REC *n_ptr)
sets the currently tuned network
void STB_DPSetTunedService(U8BIT path, void *service)
Saves the given service with the specified decode path.
void DBDEF_RequestAccess(void)
Requests access to the app's database.
BOOLEAN DBDEF_NetworkInProfile(ADB_NETWORK_REC *n_ptr)
Checks whether the given network is valid for the current profile. There may be multiple CI+ profiles...
LINK_LIST_PTR_BLK * STB_LLGetFirstBlock(LINK_LIST_HEADER *hdr)
Returns a pointer to the first block in the linked list, identified by hdr.
BOOLEAN DBDEF_SetServiceProviderName(ADB_SERVICE_REC *s_ptr, U8BIT *name)
Set or change the name of a service's provider.
U8BIT * DBDEF_GetEventName(ADB_EVENT_REC *e_ptr)
Returns the name of the event as a UTF-8 string in the currently selected language. The returned string should be freed using STB_ReleaseUnicodeString.
ADB_NETWORK_REC * DBDEF_FindNetworkRec(U16BIT net_id, ADB_SATELLITE_REC *satellite)
Finds the network with the given network ID.
void * STB_DPGetTunedTransport(U8BIT path)
Returns the transport saved with the given decode path.
BOOLEAN DBDEF_LoadDatabase(U8BIT *db_pathname)
Loads the service database from non-volatile storage and creates the RAM version of this data that wi...
void DBDEF_DeleteFavouriteList(ADB_FAVLIST_REC *fav_list)
Deletes the given favourite list.
void DBDEF_PushBroadcastProfile(void)
Saves the current profile and any related data so that it can restored using DBDEF_PopProfile(), and sets the broadcast profile type for for all network, transport and service record accesses.
void DBDEF_DeleteTransportRec(ADB_TRANSPORT_REC *t_ptr)
Deletes the given transport from the service database, deleting any service records that it's the par...
ADB_STRING * DBDEF_CopyString(ADB_STRING *src_str)
Creates a copy of the given ADB_STRING.
BOOLEAN DBDEF_IsValidCridRecord(ADB_CRID_REC *c_ptr)
Checks whether the given crid record is in the list of valid crid records.
U32BIT ACFG_GetCountry(void)
Returns the country code the DVB is configured for.
ADB_FAVSERV_REC * DBDEF_GetNextServiceFromFavouriteList(ADB_FAVLIST_REC *fav_list, ADB_FAVSERV_REC *fav_serv)
Returns the next favourite list service record.
BOOLEAN DBDEF_SetLNBSmatv(ADB_LNB_REC *lnb, BOOLEAN is_smatv)
Sets the LNB SMATV setting.
U32BIT STB_GetNumBytesInString(U8BIT *string_ptr)
Determines the no of bytes of the given string.
U8BIT DBDEF_NumberOfCridsOfType(ADB_EVENT_REC *e_ptr, U8BIT crid_type)
Returns the number of CRIDs of the given type for the event.
BOOLEAN DBDEF_ServiceInProfile(ADB_SERVICE_REC *s_ptr)
Checks whether the given service is valid for the current profile. There may be multiple CI+ profiles...
U16BIT DBDEF_GetReqdVideoPid(ADB_SERVICE_REC *s_ptr, ADB_STREAM_TYPE *video_type)
Returns the video pid and type that should be used for the given service from the list of video strea...
ADB_SERVICE_REC * DBDEF_GetNextServiceOnTransport(ADB_SERVICE_REC *s_ptr, ADB_TRANSPORT_REC *t_ptr)
Find the next service following the given service that's on the given transport.
Application stb layer control.
void DBDEF_DeleteNetworkRec(ADB_NETWORK_REC *n_ptr)
Deletes specified network record.
U8BIT * DBDEF_GetSecondaryTextLang(void)
returns array of secondary text langs
ADB_SERVICE_REC * DBDEF_FindServiceRecByFreesatId(ADB_SERVICE_REC *servp, U16BIT freesat_id)
Search for a service with the given Freesat ID.
void DBDEF_DeleteServiceFromFavouriteList(ADB_FAVLIST_REC *fav_list, ADB_FAVSERV_REC *fav_serv)
Delete the given service from the given favourite list.
void DBDEF_DeleteAllServicesFromFavouriteList(ADB_FAVLIST_REC *fav_list)
Delete the all services from the given favourite list.
Header file - Function prototypes for operating system.
System Wide Global Technical Data Type Definitions.
BOOLEAN DBA_SetFieldValue(void *record, U32BIT field_id, U32BIT value)
Set the value of a record's field. The function will fail if the record doesn't exist, the record doesn't include the given field, or the field is a string value.
void DBDEF_DeleteAllRecords(void)
Deletes all records in the database.
U16BIT DBDEF_GetServicePmtPid(ADB_SERVICE_REC *s_ptr)
gets the PMT PID associated with the service
ADB_SATELLITE_REC * DBDEF_GetNextSatelliteRec(ADB_SATELLITE_REC *sat_ptr)
Returns the next satellite record after the one given. If the argument is NULL then the first record ...
ADB_SATELLITE_REC * DBDEF_AddSatelliteRec(ADB_STRING *name_str, U16BIT dish_pos, U16BIT long_pos, BOOLEAN east_west, ADB_LNB_REC *associated_lnb)
Add a satellite record to the database.
ADB_NETWORK_REC * DBDEF_GetTunedNetwork(U8BIT path)
gets the currently tuned network
void STB_AppFreeMemory(void *addr)
Releases previously allocated application heap memory.
void DBDEF_SetServicePmtPid(ADB_SERVICE_REC *s_ptr, U16BIT pmt_pid)
Updates the pmt pid.
U8BIT * DBDEF_GetAudioLang(void)
returns current audio lang
BOOLEAN DBDEF_GetEventHDLinkageInfo(ADB_EVENT_REC *e_ptr, BOOLEAN verify_event, BOOLEAN only_simulcast, ADB_SERVICE_REC **hd_serv_ptr, ADB_EVENT_REC **hd_event_ptr)
Returns whether there's an HD event linked to the SD event and returns the info for it...
void DBDEF_DeleteRecordsForTunerType(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Deletes all network, transport and services records for the given tuner type.
ADB_TRANSPORT_REC * DBDEF_GetTunedTransport(U8BIT path)
gets the currently tuned transport
void DBDEF_SetServiceDeletedFlag(ADB_SERVICE_REC *s_ptr, BOOLEAN deleted)
Marks whether a service is deleted or not.
BOOLEAN DBDEF_SetLNBUSwitch(ADB_LNB_REC *lnb, U8BIT uswitch)
Sets the LNB uncommitted switch setting.
U8BIT * DBDEF_GetServiceGuidance(ADB_SERVICE_REC *s_ptr)
Returns the guidance text for the service, as a UTF-8 string. The returned string should be freed usi...
BOOLEAN DBDEF_SetServiceShortName(ADB_SERVICE_REC *s_ptr, U8BIT *name)
Set or change the short name of a service.
ADB_NETWORK_REC * DBDEF_FindOrAddPrivateNetwork(void *satellite)
Find or add a private network, assigning an unused private network ID.
ADB_EVENT_DESC * DBDEF_FindEventDescriptor(ADB_EVENT_DESC *start_desc, U8BIT desc_tag, U32BIT private_data_specifier)
Searches a descriptor list for the first descriptor with the given descriptor tag.
U16BIT DBDEF_GetNumTransports(void)
Returns the number of transports in ther service database.
U8BIT * DBDEF_GetFullCrid(ADB_SERVICE_REC *serv_ptr, U8BIT *event_str)
Returns the full CRID for the given CRID string The returned string should be freed using STB_AppFree...
BOOLEAN DBA_SetFieldData(void *record, U32BIT field_id, U8BIT *data, U16BIT num_bytes)
Set a variable amount of data of a record's field. The function will fail if the record doesn't exist...
AllocLcnFunc ACFG_GetCableLcnFunction(U32BIT country_code)
Returns a pointer to a function that's used to assign LCNs following a DVB-C scan for the given count...
void STB_LLAddBlockBefore(LINK_LIST_PTR_BLK *blk, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the linked list before the block identified by th...
void DBDEF_SetSecondaryAudioLang(U8BIT *lang_ids)
sets the secondary audio lang
U8BIT * DBDEF_GetEventExtendedDescription(ADB_EVENT_REC *e_ptr)
Returns the extended event description text of the event as a UTF-8 string. The returned string shoul...
U8BIT * DBDEF_GetEventCrid(ADB_SERVICE_REC *serv_ptr, ADB_EVENT_REC *e_ptr, U8BIT crid_type, U8BIT index)
Returns the full CRID of the type given for the given event.
U16BIT DBDEF_GetNumLNBBands(void)
Returns the number of LNB band records in the database.
Header file - Function prototypes for heap memory.
void DBA_DestroyRecord(void *record)
Destroys the given record, removing it from the database and freeing any memory associated with it...
void * STB_OSCreateMutex(void)
Create a mutex.
E_STREAM_MATCH_TYPE DBDEF_GetReqdSubtitleParams(ADB_SERVICE_REC *s_ptr, U16BIT *pid_ptr, U16BIT *cpage_ptr, U16BIT *apage_ptr)
Gets the appropriate subtitle pid and page ids - looks first for the params matching exactly the requ...
void DBDEF_SetFavouriteListName(ADB_FAVLIST_REC *f_ptr, U8BIT *name)
Set or change the name of the given favourite list.
void DBDEF_TidyDatabaseDefault(E_STB_DP_SIGNAL_TYPE tuner_type, BOOLEAN search_completed, BOOLEAN manual)
Iterates through all the services following a search search to see whether any need to be deleted bas...
ADB_STRING * DBDEF_ConcatSIString(ADB_STRING *str1, SI_STRING_DESC *str2)
Concatenates an SI_STRING_DESC string to the end of an ADB_STRING string, removing any terminating '\...
U8BIT * ACFG_GetEventContentTypes(U32BIT country_code)
Returns the event content types for the given country. This defines how the content type value broadc...
void DBDEF_SetCridService(ADB_CRID_REC *c_ptr, U16BIT serv_id)
Sets the service ID in the crid record.
void DBDEF_MoveFavouriteListTo(ADB_FAVLIST_REC *fav_list, S16BIT index)
Changes the order of the favourite lists by moving the given list to the given position.
BOOLEAN DBDEF_GetEventSubtitlesAvailFlag(ADB_EVENT_REC *e_ptr)
Returns whether DVB subtitles are signalled as being available for the given event.
void DBDEF_SortTimers(BOOLEAN date_time_order)
Sorts timer list into date/time or alphabetical order.
U16BIT ACFG_GetFirstUnallocatedLcn(U32BIT country_code, E_STB_DP_SIGNAL_TYPE tuner_type)
Returns the first LCN that should be used when assigning LCNs to services that don't appear in an LCN...
BOOLEAN DBDEF_SetLNBPulsePosition(ADB_LNB_REC *lnb, BOOLEAN is_pulse_posn)
Sets the LNB pulse position setting.
BOOLEAN DBDEF_TransportForTunerType(ADB_TRANSPORT_REC *t_ptr, E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Checks whether the given transport is a terrestrial, cable or satellite transport, and optionally check whether it's on a particular satellite.
ADB_TRANSPORT_REC * DBDEF_FindTransportRecByIds(ADB_TRANSPORT_REC *transp, U32BIT net_id, U32BIT onet_id, U32BIT tran_id)
Find a transport record matching the given set of IDs, starting from the given transport.
BOOLEAN DBDEF_AllocateLcns(E_STB_DP_SIGNAL_TYPE tuner_type, BOOLEAN assign_lcns)
allocates lcns - expects allocated lcn for all services to be 0
BOOLEAN DBDEF_SetLNBPower(ADB_LNB_REC *lnb, E_STB_DP_LNB_POWER power)
Sets the LNB power setting.
void DBA_LockDatabase(void)
Locks the database to prevent access from other threads or processes.
U16BIT STB_GCGetGMTDate(void)
Reads the current GMT date code.
ADB_CRID_REC * DBDEF_AddCridRecord(U8BIT *crid, BOOLEAN series, BOOLEAN recommended)
Creates a CRID record and adds it to the database.
void DBDEF_Initialise(void)
Initialises the database, preparing for it to be accessed.
void DBA_UnlockDatabase(void)
Unlocks the database to allow other threads or processes to access it.
ADB_TIMER_REC * DBDEF_GetNextTimerRec(ADB_TIMER_REC *timer_ptr)
Returns the next timer record after the one given. If the argument is NULL then the first record is r...
BOOLEAN DBA_GetFieldValue(void *record, U32BIT field_id, U32BIT *value)
Gets the value of a record's field. The function will fail if the record doesn't exist, the record doesn't include the given field, or the field is a string value.
E_STREAM_MATCH_TYPE DBDEF_GetReqdTtextPid(ADB_SERVICE_REC *s_ptr, BOOLEAN for_subtitles, U16BIT *pid_ptr, U8BIT *magazine, U8BIT *page)
Gets the appropriate teletext pid - looks first for the params matching exactly the required teletext...
void DBDEF_ClearTableVersionHistory(ADB_TRANSPORT_REC *t_ptr)
Clears the version histories stored in the transport records.
void STB_LLInitialiseHeader(LINK_LIST_HEADER *hdr)
Initialise the header variables of the linked list.
void DBA_SetRecordParent(void *record, void *parent)
Set of change the parent of the given record.
ADB_TIMER_REC * DBDEF_AddTimerRec(BOOLEAN store_in_nvm)
Creates a new timer record in the database, assigning it a unique handle.
void DBDEF_MoveFavouriteListServiceTo(ADB_FAVLIST_REC *fav_list, ADB_FAVSERV_REC *fav_serv, S16BIT index)
Changes the order of the services in the favourite list by moving the given service to the given posi...
void DBDEF_SetCridDateTime(ADB_CRID_REC *c_ptr, U32DHMS date_time)
Sets the date and time fields in the crid record.
void STB_LLAddBlockToStart(LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the start of the linked list identified by the li...
void DBDEF_DeleteLNBBandRec(ADB_LNB_BAND_REC *band_ptr)
Deletes an LNB band record from the database.
ADB_EVENT_REC * DBDEF_FindScheduleEventById(ADB_SERVICE_REC *s_ptr, U16BIT event_id)
Find an event for a service from its event_id.
U16BIT DBDEF_NumStreamsInList(ADB_STREAM_REC *slist)
Returns the number of stream records in the given list.
void DBDEF_DeleteAltServList(ADB_ALT_SERV_REC *aslist)
Deletes all records in a service alternate service list.
Application database access functions.
BOOLEAN DBDEF_SetLNBDiSEqCPosition(ADB_LNB_REC *lnb, BOOLEAN is_diseqc_posn)
Sets the LNB DiSEqC position setting.
BOOLEAN STB_LLSort(LINK_LIST_HEADER *ll_hdr, S16BIT(*cmp_func)(LINK_LIST_PTR_BLK **, LINK_LIST_PTR_BLK **))
Sorts the blocks of a link list object in ascending or descending order NOTE: The order in which the ...
ADB_NETWORK_REC * DBDEF_GetNextNetworkRec(ADB_NETWORK_REC *n_ptr)
Returns the network following the one given. If the argument is NULL then the first network will be r...
U16BIT DBDEF_GetProfileList(void ***profile_list, U16BIT *active_profile)
Gets a list of the available network profiles.
ADB_TIMER_REC * DBDEF_FindTimerRec(U32BIT handle)
Returns the timer record with the given timer handle.
Header file - macros and function prototypes for public use.
void * DBA_GetRecordParent(void *record)
Returns the handle to the parent of the given record.
void DBDEF_SortServicesByLcn(void)
Sort the full service list into ascending logical channel number order.
void DBDEF_DeleteRCTLinks(ADB_RCT_LINK_INFO *links)
Frees the given list of RCT links.