91 #if defined(INCLUDE_DSMCC_FILE_REQUEST) 92 #include "dsm_client.h" 93 #include "dsm_control.h" 95 #ifdef INTEGRATE_HBBTV 110 #ifdef COMMON_INTERFACE 122 #define AP_SI_PRINT(x) STB_SPDebugWrite x 123 #define AP_SI_PRINT1(x) STB_SPDebugWrite x 125 #define AP_SI_PRINT(x) 129 #define DONT_CARE_ID_MATCH 0x0000 130 #define DONT_CARE_ID_MASK 0x0000 133 #define EITPF_ACTUAL_TID 0x4E 134 #define EITPF_OTHER_TID 0x4F 135 #define EITSC_ACTUAL_TID 0x50 // range 0x50 to 0x5f 136 #define EITSC_OTHER_TID 0x60 // range 0x60 to 0x6f 137 #define EITPF_PLUS_TID 0xd1 142 #define AC3_DESC_DTAG 0x6a 143 #define EAC3_DESC_DTAG 0x7a 146 #define BAT_TIMEOUT_MS 12000 147 #define CAT_TIMEOUT_MS 2000 148 #define PAT_TIMEOUT_MS 800 149 #define PMT_TIMEOUT_MS 3000 150 #define NIT_TIMEOUT_MS 15000 151 #define SDT_TIMEOUT_MS 5000 152 #define EIT_TIMEOUT_MS 3000 153 #define TOT_TIMEOUT_MS 32000 154 #define TDT_TIMEOUT_MS 32000 155 #define SCHED_TIMEOUT_MS 3600000 156 #define EVENT_SCHED_SEARCH_TIMEOUT_MS 10000 158 #define PMT_UPDATE_MS 1000 159 #define SI_UPDATE_DELAY_MS 100 161 #define MAX_PMT_PRIORITY_LIST 4 163 #define DVB_SSU_LINKAGE_TYPE 0x09 164 #define DVB_DVBH1_LINKAGE_TYPE 0x0B 165 #define DVB_DVBH2_LINKAGE_TYPE 0x0C 168 #define IGNORE_VERSION TRUE 169 #define CHECK_VERSION FALSE 171 #define EIT_ACTUAL_ONLY TRUE 172 #define EIT_ACTUAL_OR_OTHER FALSE 174 #define REPORT_PMT TRUE 175 #define DONT_REPORT_PMT FALSE 177 #define EIT_LIST_REQD TRUE 178 #define EIT_LIST_NOT_REQD FALSE 180 #define REPORT_CAT TRUE 181 #define DONT_REPORT_CAT FALSE 183 #define INVALID_SERVICE_ID 0xffffffff 186 #define UK_DTT_PRIVATE_DATA_CODE 0x0000233a 187 #define FREESAT_PRIVATE_DATA_CODE 0x46534154 224 } E_PMT_REQUEST_MODE;
259 U16BIT num_nordig_lcns;
279 static E_APP_SI_MODE *required_si_mode;
280 static F_SIManager *current_manager;
281 static E_SEARCH_SERVICE_TYPE required_service_type;
289 static void **pat_filter;
290 static void **pmt_filter;
291 static void **eit_filter;
293 static void **sched_filter;
294 static void **nit_filter;
295 static void **sdt_filter;
296 static void **bat_filter;
297 static void **tot_filter;
298 static void **tdt_filter;
299 static void **cat_filter;
300 static void **rct_filter;
301 static void **ait_filter;
303 static U32BIT *pat_start_timestamp;
304 static U32BIT *pmt_start_timestamp;
305 static U32BIT *nit_start_timestamp;
306 static U32BIT *sdt_start_timestamp;
307 static U32BIT *bat_start_timestamp;
308 static U32BIT *eit_start_timestamp;
309 static U32BIT *sched_start_timestamp;
310 static U32BIT *sched_timeout_ms;
311 static U32BIT *tot_start_timestamp;
312 static U32BIT *tdt_start_timestamp;
313 static U32BIT *si_update_delay_timestamp;
314 static U32BIT *pmt_update_timestamp;
315 static U32BIT *cat_start_timestamp;
316 static U32BIT *pmt_update_period_ms;
317 static U32BIT *last_timestamp;
319 static BOOLEAN *sdt_complete;
320 static BOOLEAN *bat_complete;
321 static BOOLEAN *nit_complete;
322 static BOOLEAN *pmts_complete;
323 static BOOLEAN *eits_complete;
324 static BOOLEAN *tot_complete;
326 static BOOLEAN *tot_already_received;
328 static BOOLEAN *pat_rcvd_on_this_trnsprt;
331 static U16BIT *num_pmt_list_entries;
332 static U16BIT *pmt_list_id;
333 static U16BIT *pmt_filter_pid;
334 static BOOLEAN *pmt_service_changed;
335 static BOOLEAN *report_pmt_allowed;
336 static BOOLEAN *pmt_reported;
337 static BOOLEAN *stop_pmt_reporting;
338 static E_PMT_REQUEST_MODE *pmt_request_mode;
339 static U32BIT pmt_priority_list[MAX_PMT_PRIORITY_LIST] = {INVALID_SERVICE_ID};
340 static void *si_pmt_list_sem;
343 static U16BIT *num_eit_list_entries;
345 static U16BIT eit_schedule_limit;
348 static BOOLEAN *service_list_ready;
350 static S16BIT *last_reported_cat_version;
351 static S16BIT *last_reported_nit_version;
352 static U8BIT *last_reported_pmt_version;
354 static BOOLEAN use_bats_active;
356 static U16BIT num_active_bouquet_ids;
359 static U16BIT active_network_id = 0;
361 static S16BIT last_playback_pmt_version = -1;
362 static S16BIT last_playback_pat_version = -1;
369 static BOOLEAN ssu_refused;
370 static BOOLEAN dvb_ssu_mandatory;
371 static U8BIT dvb_oui[3] = {0x00, 0x01, 0x5a};
373 static F_EitParser eit_parser_func = NULL;
374 static F_BatTableUpdate update_bat_func = NULL;
375 static F_EitTableUpdate update_eit_func = NULL;
376 static F_NitTableUpdate update_nit_func = NULL;
377 static F_PmtTableUpdate update_pmt_func = NULL;
378 static F_SdtTableUpdate update_sdt_func = NULL;
380 static F_EitSchedUpdateCB eit_sched_update_callback = NULL;
388 static void HandleSiEvent(U8BIT path, E_APP_SI_EVENT_TYPE event);
389 static void CheckForTimeout(U8BIT path, U32BIT timestamp, U32BIT timeout, U32BIT event);
390 static void ReceiveSiTable(
void *filter_ptr, U32BIT ret_param,
SI_TABLE_RECORD *table_rec);
392 static BOOLEAN ManageChannelSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
393 static BOOLEAN ManageStartupSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
394 static BOOLEAN ManageEventSchedSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
395 static BOOLEAN ManageUpdate(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
396 static BOOLEAN ManageTotSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
398 #ifdef COMMON_INTERFACE 399 static BOOLEAN ManageCIPlusUpdate(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
400 static BOOLEAN ManageCIPlusNoPatPmt(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
404 static BOOLEAN ManageUpdatePlayback(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
405 static BOOLEAN ManageRecording(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
406 static void StartEITScheduleFilter(U8BIT path);
408 static BOOLEAN ProcessSdtTable(
SI_TABLE_RECORD *table_rec, E_DB_ACCESS_MODE mode,
409 BOOLEAN ignore_version, BOOLEAN eit_list_reqd);
411 static BOOLEAN ProcessPmtTable(
SI_TABLE_RECORD *table_rec, BOOLEAN ignore_version, BOOLEAN report_pmt,
412 U16BIT *service_id, E_DB_ACCESS_MODE mode);
414 BOOLEAN db_services, E_DB_ACCESS_MODE mode);
416 static BOOLEAN ProcessNitTable(
SI_TABLE_RECORD *table_rec, E_DB_ACCESS_MODE mode, BOOLEAN report_nit,
417 BOOLEAN transport_changed);
419 static U32DHMS ReadEventStart(U8BIT *data_ptr);
420 static U32DHMS ReadEventDuration(U8BIT *data_ptr);
423 static BOOLEAN DeleteEventsForPeriod(
ADB_SERVICE_REC *s_ptr, U32DHMS start_time, U32DHMS end_time);
425 static void ProcessEitTable(
SI_TABLE_RECORD *table_rec, BOOLEAN ignore_version, E_DB_ACCESS_MODE mode, BOOLEAN playback);
427 static void ProcessCatTable(U8BIT path,
SI_TABLE_RECORD *table_rec, BOOLEAN report_cat, BOOLEAN transport_changed);
429 static BOOLEAN ProcessBatTable(
SI_TABLE_RECORD *table_rec, E_DB_ACCESS_MODE mode, BOOLEAN report_bat);
433 #if defined(INCLUDE_DSMCC_FILE_REQUEST) 437 static BOOLEAN MakeNewPmtRequest(U8BIT path);
438 static U16BIT GetPriorityListId(U8BIT path);
439 static void CancelTableRequests(U8BIT path, BOOLEAN this_path_only);
440 static void UpdateTransportParameters(U8BIT path);
442 static BOOLEAN ManageDvbSsuSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec);
444 U16BIT *tid_ptr, U16BIT *sid_ptr);
457 static void ApplyDynamicUpdates(U8BIT path);
458 static void ClearDynamicUpdates(
void);
477 static void HandleSiEvent(U8BIT path, E_APP_SI_EVENT_TYPE event)
482 FUNCTION_START(HandleSiEvent);
488 AP_SI_PRINT((
"APSI Stop(%d)", path));
489 if (current_manager[path] != NULL)
491 finished = (current_manager[path])(path, APP_SI_STOP_MANAGER, NULL);
492 current_manager[path] = NULL;
496 case START_SI_SEARCHING:
499 if (current_manager[path] != NULL)
501 finished = (current_manager[path])(path, APP_SI_STOP_MANAGER, NULL);
502 current_manager[path] = NULL;
505 switch (required_si_mode[path])
507 case APP_SI_MODE_CHANNEL_SEARCH:
508 case APP_SI_MODE_CHANNEL_SEARCH_NO_NIT:
510 AP_SI_PRINT((
"APSI(%d): channel search", path));
511 current_manager[path] = ManageChannelSearch;
515 case APP_SI_MODE_STARTUP_SEARCH:
517 AP_SI_PRINT((
"APSI(%d): startup search", path));
518 current_manager[path] = ManageStartupSearch;
522 case APP_SI_MODE_TOT_SEARCH:
524 AP_SI_PRINT((
"APSI(%d): tot search", path));
525 current_manager[path] = ManageTotSearch;
529 case APP_SI_MODE_EVENT_PF_SEARCH:
530 case APP_SI_MODE_EVENT_SCHED_SEARCH:
531 case APP_SI_MODE_EVENT_PF_SCHED_SEARCH:
533 AP_SI_PRINT((
"APSI(%d): schedule search", path));
534 current_manager[path] = ManageEventSchedSearch;
538 case APP_SI_MODE_DVB_SSU_SEARCH:
540 AP_SI_PRINT((
"APSI(%d): dvb ssu search", path));
541 current_manager[path] = ManageDvbSsuSearch;
545 #ifdef COMMON_INTERFACE 546 case APP_SI_MODE_CIPLUS_UPDATE:
548 AP_SI_PRINT((
"APSI(%d): CI+ update search", path));
549 current_manager[path] = ManageCIPlusUpdate;
553 case APP_SI_MODE_CIPLUS_NO_PAT_PMT:
555 AP_SI_PRINT((
"APSI(%d): CI+ no PAT/PMT search", path));
556 current_manager[path] = ManageCIPlusNoPatPmt;
561 case APP_SI_MODE_USER_DEFINED:
563 AP_SI_PRINT((
"APSI(%d): user defined search", path));
567 case APP_SI_MODE_NO_SI:
568 case APP_SI_MODE_UPDATE:
571 AP_SI_PRINT((
"APSI(%d): search failed - invalid mode %d", path, required_si_mode[path]));
576 if (current_manager[path] != NULL)
578 finished = (current_manager[path])(path, APP_SI_START_MANAGER, NULL);
579 if (finished == TRUE)
581 current_manager[path] = NULL;
587 case START_SI_UPDATING_NEW_TRANSPORT:
598 while (t_ptr != NULL)
600 t_ptr->sdt_version = 0xFF;
607 if (current_manager[path] != NULL)
609 finished = (current_manager[path])(path, APP_SI_STOP_MANAGER, NULL);
610 current_manager[path] = NULL;
613 if (required_si_mode[path] == APP_SI_MODE_UPDATE)
619 AP_SI_PRINT((
"APSI(%d): recording", path));
620 current_manager[path] = ManageRecording;
621 finished = ManageRecording(path, APP_SI_START_MANAGER, NULL);
625 AP_SI_PRINT((
"APSI(%d): update for playback", path));
626 current_manager[path] = ManageUpdatePlayback;
627 finished = ManageUpdatePlayback(path, APP_SI_START_MANAGER, NULL);
631 AP_SI_PRINT((
"APSI(%d): update", path));
632 current_manager[path] = ManageUpdate;
633 finished = ManageUpdate(path, APP_SI_START_MANAGER, NULL);
636 if (finished == TRUE)
638 current_manager[path] = NULL;
643 AP_SI_PRINT((
"APSI(%d): update failed - invalid mode %d", path, required_si_mode[path]));
648 case START_SI_UPDATING_SAME_TRANSPORT:
651 if (required_si_mode[path] == APP_SI_MODE_UPDATE)
657 AP_SI_PRINT((
"APSI(%d): recording", path));
659 if (current_manager[path] != NULL)
661 finished = (current_manager[path])(path, APP_SI_STOP_MANAGER, NULL);
662 current_manager[path] = NULL;
665 current_manager[path] = ManageRecording;
666 finished = ManageRecording(path, APP_SI_START_MANAGER, NULL);
673 AP_SI_PRINT((
"APSI(%d): update", path));
675 if (current_manager[path] != ManageUpdate)
678 if (current_manager[path] != NULL)
680 (current_manager[path])(path, APP_SI_STOP_MANAGER, NULL);
683 current_manager[path] = ManageUpdate;
684 finished = ManageUpdate(path, APP_SI_START_MANAGER, NULL);
689 finished = ManageUpdate(path, APP_SI_CHANNEL_CHANGE, NULL);
694 AP_SI_PRINT((
"APSI(%d): update for playback", path));
696 if (current_manager[path] != ManageUpdatePlayback)
699 (current_manager[path])(path, APP_SI_STOP_MANAGER, NULL);
700 current_manager[path] = ManageUpdatePlayback;
701 finished = ManageUpdatePlayback(path, APP_SI_START_MANAGER, NULL);
706 finished = ManageUpdatePlayback(path, APP_SI_CHANNEL_CHANGE, NULL);
711 if (finished == TRUE)
713 current_manager[path] = NULL;
718 AP_SI_PRINT((
"APSI(%d): update failed - invalid mode %d", path, required_si_mode[path]));
719 if (current_manager[path] != NULL)
721 (current_manager[path])(path, APP_SI_STOP_MANAGER, NULL);
722 current_manager[path] = NULL;
730 U32BIT time_now, time_adjust;
732 if (path == INVALID_RES_ID)
741 last_path = path + 1;
744 for (; path < last_path; path++)
753 time_adjust = time_now - last_timestamp[path];
755 last_timestamp[path] = time_now;
757 if (current_manager[path] != NULL)
759 if (time_adjust != 0)
761 if (cat_start_timestamp[path] != 0)
763 cat_start_timestamp[path] += time_adjust;
765 if (pat_start_timestamp[path] != 0)
767 pat_start_timestamp[path] += time_adjust;
769 if (pmt_start_timestamp[path] != 0)
771 pmt_start_timestamp[path] += time_adjust;
773 if (eit_start_timestamp[path] != 0)
775 eit_start_timestamp[path] += time_adjust;
777 if (sched_start_timestamp[path] != 0)
779 sched_start_timestamp[path] += time_adjust;
781 if (pmt_update_timestamp[path] != 0)
783 pmt_update_timestamp[path] += time_adjust;
785 if (si_update_delay_timestamp[path] != 0)
787 si_update_delay_timestamp[path] += time_adjust;
789 if (nit_start_timestamp[path] != 0)
791 nit_start_timestamp[path] += time_adjust;
793 if (sdt_start_timestamp[path] != 0)
795 sdt_start_timestamp[path] += time_adjust;
797 if (tot_start_timestamp[path] != 0)
799 tot_start_timestamp[path] += time_adjust;
801 if (tdt_start_timestamp[path] != 0)
803 tdt_start_timestamp[path] += time_adjust;
805 if (bat_start_timestamp[path] != 0)
807 bat_start_timestamp[path] += time_adjust;
811 CheckForTimeout(path, cat_start_timestamp[path], CAT_TIMEOUT_MS, APP_SI_CAT_TIMEOUT);
812 CheckForTimeout(path, pat_start_timestamp[path], PAT_TIMEOUT_MS, APP_SI_PAT_TIMEOUT);
813 CheckForTimeout(path, pmt_start_timestamp[path], PMT_TIMEOUT_MS, APP_SI_PMT_TIMEOUT);
814 CheckForTimeout(path, eit_start_timestamp[path], EIT_TIMEOUT_MS, APP_SI_EIT_TIMEOUT);
815 CheckForTimeout(path, sched_start_timestamp[path], sched_timeout_ms[path],
816 APP_SI_SCHED_TIMEOUT);
820 CheckForTimeout(path, nit_start_timestamp[path], NIT_TIMEOUT_MS, APP_SI_NIT_TIMEOUT);
821 CheckForTimeout(path, sdt_start_timestamp[path], SDT_TIMEOUT_MS, APP_SI_SDT_TIMEOUT);
822 CheckForTimeout(path, tot_start_timestamp[path], TOT_TIMEOUT_MS, APP_SI_TOT_TIMEOUT);
823 CheckForTimeout(path, tdt_start_timestamp[path], TDT_TIMEOUT_MS, APP_SI_TDT_TIMEOUT);
824 CheckForTimeout(path, bat_start_timestamp[path], BAT_TIMEOUT_MS, APP_SI_BAT_TIMEOUT);
828 CheckForTimeout(path, pmt_update_timestamp[path], pmt_update_period_ms[path], APP_SI_PMT_UPDATE);
829 CheckForTimeout(path, si_update_delay_timestamp[path], SI_UPDATE_DELAY_MS, APP_SI_UPDATE_DELAY_EXPIRED);
832 if (stop_pmt_reporting[path] == TRUE)
834 stop_pmt_reporting[path] = FALSE;
835 finished = (current_manager[path])(path, APP_SI_STOP_PMT_REPORTING, NULL);
836 if (finished == TRUE)
838 current_manager[path] = NULL;
847 FUNCTION_FINISH(HandleSiEvent);
863 static void CheckForTimeout(U8BIT path, U32BIT timestamp, U32BIT timeout, U32BIT event)
867 FUNCTION_START(CheckForTimeout);
873 finished = (current_manager[path])(path, event, NULL);
874 if (finished == TRUE)
876 current_manager[path] = NULL;
880 FUNCTION_FINISH(CheckForTimeout);
897 static void ReceiveSiTable(
void *filter_ptr, U32BIT ret_param,
SI_TABLE_RECORD *table_rec)
901 FUNCTION_START(ReceiveSiTable);
903 USE_UNWANTED_PARAM(filter_ptr);
905 if (table_rec != NULL)
907 path = table_rec->path;
911 AP_SI_PRINT((
"===ReceiveSiTable: table_rec is NULL, so path = 0\n"));
915 if (current_manager[path] != NULL)
919 (current_manager[path])(path, ret_param, table_rec);
927 CancelTableRequests(path, TRUE);
930 FUNCTION_FINISH(ReceiveSiTable);
946 static BOOLEAN ManageChannelSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
952 E_STB_DP_SIGNAL_TYPE tuner_type;
956 FUNCTION_START(ManageChannelSearch);
959 if (event == APP_SI_START_MANAGER)
962 service_list_ready[path] = FALSE;
976 if (current_transport_rec[path] == NULL)
979 #ifdef DEBUG_SI_CHAN_SEARCH 980 AP_SI_PRINT((
"Chan search(%d): start - new terrestrial transport (%s), PLP=%u", path,
985 #ifdef DEBUG_SI_CHAN_SEARCH 988 AP_SI_PRINT((
"Chan search(%d): start - existing transport (%s)", path,
995 if (current_transport_rec[path] == NULL)
998 #ifdef DEBUG_SI_CHAN_SEARCH 999 AP_SI_PRINT((
"Chan search(%d): start - new cable transport (%s), sym_rate=%u", path,
1005 #ifdef DEBUG_SI_CHAN_SEARCH 1008 AP_SI_PRINT((
"Chan search(%d): start - existing transport (%s)", path,
1017 if (current_transport_rec[path] == NULL)
1020 #ifdef DEBUG_SI_CHAN_SEARCH 1021 AP_SI_PRINT((
"Chan search(%d): start - new sat transport (%s), sym_rate=%u, polarity=%u",
1028 #ifdef DEBUG_SI_CHAN_SEARCH 1031 AP_SI_PRINT((
"Chan search(%d): start - existing transport (%s)", path,
1037 #ifdef DEBUG_SI_CHAN_SEARCH 1038 AP_SI_PRINT((
"Chan search(%u): Unknown tuner type, %u", path, tuner_type));
1040 current_transport_rec[path] = NULL;
1046 if (current_transport_rec[path] != NULL)
1050 current_network_rec[path] = current_transport_rec[path]->network;
1051 current_service_rec[path] = NULL;
1053 pat_rcvd_on_this_trnsprt[path] = FALSE;
1054 last_transport_rec[path] = NULL;
1055 pmts_complete[path] = FALSE;
1056 sdt_complete[path] = FALSE;
1057 nit_complete[path] = FALSE;
1058 eits_complete[path] = FALSE;
1059 tot_complete[path] = FALSE;
1060 bat_complete[path] = FALSE;
1062 #ifdef COMMON_INTERFACE 1069 sdt_filter[path] =
STB_SIRequestSdt(path, ONE_SHOT_REQUEST, TRUE, FALSE, DONT_CARE_ID_MATCH,
1070 DONT_CARE_ID_MASK, 1, ReceiveSiTable, APP_SI_SDT_RECEIVED);
1074 tot_filter[path] =
STB_SIRequestTot(path, ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_TOT_RECEIVED);
1077 tdt_filter[path] =
STB_SIRequestTdt(path, ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_TDT_RECEIVED);
1079 #ifdef COMMON_INTERFACE 1082 #ifdef DEBUG_SI_CHAN_SEARCH 1083 AP_SI_PRINT((
"Chan search(%d): start - failed to route TS securely", path));
1093 #ifdef DEBUG_SI_CHAN_SEARCH 1094 AP_SI_PRINT((
"Chan search(%d): start - failed, no transport", path));
1101 else if (event == APP_SI_STOP_MANAGER)
1103 #ifdef DEBUG_SI_CHAN_SEARCH 1104 AP_SI_PRINT((
"Chan search(%d): stop", path));
1106 CancelTableRequests(path, FALSE);
1113 case APP_SI_SDT_RECEIVED:
1115 #ifdef DEBUG_SI_CHAN_SEARCH 1116 AP_SI_PRINT((
"Chan search(%d): SDT received (tid 0x%04x)", path, table_rec->xtid));
1118 ProcessSdtTable(table_rec, DB_ACCESS_SEARCH, IGNORE_VERSION, EIT_LIST_REQD);
1121 sdt_complete[path] = TRUE;
1122 service_list_ready[path] = TRUE;
1125 sdt_filter[path] = NULL;
1126 sdt_start_timestamp[path] = 0;
1130 pat_filter[path] =
STB_SIRequestPat(path, ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_PAT_RECEIVED);
1132 if (required_si_mode[path] != APP_SI_MODE_CHANNEL_SEARCH_NO_NIT)
1137 if (active_network_id == 0)
1139 nit_filter[path] =
STB_SIRequestNit(path, ONE_SHOT_REQUEST, ReceiveSiTable,
1140 APP_SI_NIT_RECEIVED);
1145 ReceiveSiTable, APP_SI_NIT_RECEIVED);
1150 nit_complete[path] = TRUE;
1153 if (use_bats_active)
1157 bat_filter[path] =
STB_SIRequestBat(path, CONTINUOUS_REQUEST, DONT_CARE_ID_MATCH,
1158 DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable, APP_SI_BAT_RECEIVED);
1162 bat_complete[path] = TRUE;
1167 eit_filter[path] =
STB_SIRequestEit(path, ONE_SHOT_REQUEST, EIT_NOW_NEXT_ACT,
1168 DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 0xffff,
1169 ReceiveSiTable, APP_SI_EIT_RECEIVED);
1173 case APP_SI_SDT_TIMEOUT:
1177 #ifdef DEBUG_SI_CHAN_SEARCH 1178 AP_SI_PRINT((
"Chan search(%d): SDT timeout", path));
1183 sdt_filter[path] = NULL;
1184 sdt_start_timestamp[path] = 0;
1189 case APP_SI_PAT_RECEIVED:
1191 #ifdef DEBUG_SI_CHAN_SEARCH 1192 AP_SI_PRINT((
"Chan search(%d): PAT received (tid 0x%04x)", path, table_rec->xtid));
1194 ProcessPatTable(table_rec);
1195 if (pmt_list[path] != NULL)
1197 pmt_list_id[path] = 0;
1198 pmt_request_mode[path] = PMT_REQUEST_MONITOR;
1199 MakeNewPmtRequest(path);
1203 pmts_complete[path] = TRUE;
1208 pat_filter[path] = NULL;
1209 pat_start_timestamp[path] = 0;
1213 case APP_SI_PAT_TIMEOUT:
1215 #ifdef DEBUG_SI_CHAN_SEARCH 1216 AP_SI_PRINT((
"Chan search(%d): PAT timeout", path));
1221 pat_filter[path] = NULL;
1222 pat_start_timestamp[path] = 0;
1227 case APP_SI_PMT_RECEIVED:
1228 case APP_SI_PMT_TIMEOUT:
1230 if (event == APP_SI_PMT_RECEIVED)
1232 #ifdef DEBUG_SI_CHAN_SEARCH 1233 AP_SI_PRINT((
"Chan search(%d): PMT received (sid 0x%04x)", path, table_rec->xtid));
1236 ProcessPmtTable(table_rec, IGNORE_VERSION, DONT_REPORT_PMT, NULL, DB_ACCESS_SEARCH);
1238 #ifdef DEBUG_SI_CHAN_SEARCH 1241 AP_SI_PRINT((
"Chan search(%d): PMT timeout (sid 0x%04x)", path,
1242 pmt_list[path][pmt_list_id[path]].serv_id));
1246 if ((pmt_list_id[path] + 1) >= num_pmt_list_entries[path])
1249 pmts_complete[path] = TRUE;
1251 pmt_filter[path] = NULL;
1252 pmt_start_timestamp[path] = 0;
1257 pmt_list_id[path]++;
1258 pmt_request_mode[path] = PMT_REQUEST_MONITOR;
1259 MakeNewPmtRequest(path);
1264 case APP_SI_NIT_RECEIVED:
1265 case APP_SI_NIT_TIMEOUT:
1267 if (event == APP_SI_NIT_RECEIVED)
1269 #ifdef DEBUG_SI_CHAN_SEARCH 1270 AP_SI_PRINT((
"Chan search(%d): NIT received (nid 0x%04x)", path, table_rec->xtid));
1272 ProcessNitTable(table_rec, DB_ACCESS_SEARCH, FALSE, FALSE);
1276 if (current_transport_rec[path]->sig_type == SIGNAL_QPSK)
1280 if (current_network_rec[path] != NULL)
1285 current_transport_rec[path]->network = current_network_rec[path];
1287 current_network_rec[path]->dba_rec);
1292 AP_SI_PRINT((
"Chan search(%d): NIT timeout", path));
1296 nit_complete[path] = TRUE;
1298 nit_filter[path] = NULL;
1299 nit_start_timestamp[path] = 0;
1303 case APP_SI_BAT_RECEIVED:
1305 #ifdef DEBUG_SI_CHAN_SEARCH 1306 AP_SI_PRINT((
"Chan search(%d): BAT received (bouquet id 0x%04x, v%d)", path,
1307 table_rec->xtid, table_rec->version));
1309 ProcessBatTable(table_rec, DB_ACCESS_SEARCH, FALSE);
1314 stop_search = FALSE;
1316 if (active_bouquet_ids != NULL)
1320 for (i = 0; i < num_active_bouquet_ids; i++)
1322 if (!active_bouquet_ids[i].received)
1325 stop_search = FALSE;
1333 bat_complete[path] = TRUE;
1335 bat_filter[path] = NULL;
1336 bat_start_timestamp[path] = 0;
1346 case APP_SI_BAT_TIMEOUT:
1348 #ifdef DEBUG_SI_CHAN_SEARCH 1349 AP_SI_PRINT((
"Chan search(%d): BAT timeout", path));
1352 bat_complete[path] = TRUE;
1354 bat_filter[path] = NULL;
1355 bat_start_timestamp[path] = 0;
1359 case APP_SI_EIT_RECEIVED:
1361 #ifdef DEBUG_SI_CHAN_SEARCH 1362 AP_SI_PRINT((
"Chan search(%d): EIT received (sid 0x%04x)", path, table_rec->xtid));
1364 ProcessEitTable(table_rec, IGNORE_VERSION, DB_ACCESS_SEARCH, FALSE);
1367 if (eit_list[path] != NULL)
1369 eits_complete[path] = TRUE;
1370 for (i = 0; i < num_eit_list_entries[path]; i++)
1372 if (eit_list[path][i].got_eit == FALSE)
1374 eits_complete[path] = FALSE;
1379 if (eits_complete[path] == TRUE)
1382 eit_filter[path] = NULL;
1383 eit_start_timestamp[path] = 0;
1386 sched_filter[path] = NULL;
1387 sched_start_timestamp[path] = 0;
1392 case APP_SI_EIT_TIMEOUT:
1394 #ifdef DEBUG_SI_CHAN_SEARCH 1395 AP_SI_PRINT((
"Chan search(%d): EIT timeout", path));
1398 eits_complete[path] = TRUE;
1399 if (eit_filter[path] != NULL)
1402 eit_filter[path] = NULL;
1403 eit_start_timestamp[path] = 0;
1406 sched_filter[path] = NULL;
1407 sched_start_timestamp[path] = 0;
1412 case APP_SI_TOT_RECEIVED:
1413 case APP_SI_TOT_TIMEOUT:
1415 if (event == APP_SI_TOT_RECEIVED)
1417 #ifdef DEBUG_SI_CHAN_SEARCH 1418 AP_SI_PRINT((
"Chan search(%d): TOT received", path));
1422 #ifdef DEBUG_SI_CHAN_SEARCH 1425 AP_SI_PRINT((
"Chan search(%d): TOT timeout", path));
1430 tot_complete[path] = TRUE;
1432 tot_filter[path] = NULL;
1433 tot_start_timestamp[path] = 0;
1437 case APP_SI_TDT_RECEIVED:
1438 case APP_SI_TDT_TIMEOUT:
1440 if (event == APP_SI_TDT_RECEIVED)
1442 #ifdef DEBUG_SI_CHAN_SEARCH 1443 AP_SI_PRINT((
"Chan search(%u): TDT received", path));
1448 #ifdef DEBUG_SI_CHAN_SEARCH 1451 AP_SI_PRINT((
"Chan search(%u): TDT timeout", path));
1457 tot_complete[path] = TRUE;
1459 tdt_filter[path] = NULL;
1460 tdt_start_timestamp[path] = 0;
1466 if (finished || (sdt_complete[path] && nit_complete[path] && pmts_complete[path] &&
1467 eits_complete[path] && tot_complete[path] && bat_complete[path]))
1469 if (current_transport_rec[path] != NULL)
1471 UpdateTransportParameters(path);
1475 #ifdef DEBUG_SI_CHAN_SEARCH 1476 AP_SI_PRINT((
"Chan search(%d): search complete", path));
1478 CancelTableRequests(path, FALSE);
1480 success = (sdt_complete[path] && nit_complete[path] && pmts_complete[path] &&
1481 eits_complete[path] && tot_complete[path] && bat_complete[path]);
1488 FUNCTION_FINISH(ManageChannelSearch);
1506 static BOOLEAN ManageTotSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
1510 FUNCTION_START(ManageTotSearch);
1513 if (event == APP_SI_START_MANAGER)
1518 if (current_transport_rec[path] != NULL)
1520 #ifdef DEBUG_SI_TOT_SEARCH 1521 AP_SI_PRINT((
"Tot search(%d): start (%s)", path,
1527 if (tot_already_received[path])
1529 tot_complete[path] = TRUE;
1536 tot_complete[path] = FALSE;
1538 tot_filter[path] =
STB_SIRequestTot(path, ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_TOT_RECEIVED);
1543 #ifdef DEBUG_SI_TOT_SEARCH 1544 AP_SI_PRINT((
"Tot search(%d): start - failed, no transport", path));
1551 else if (event == APP_SI_STOP_MANAGER)
1553 #ifdef DEBUG_SI_TOT_SEARCH 1554 AP_SI_PRINT((
"Tot search(%d): stop", path));
1556 CancelTableRequests(path, FALSE);
1563 case APP_SI_TOT_RECEIVED:
1565 #ifdef DEBUG_SI_TOT_SEARCH 1566 AP_SI_PRINT((
"Tot search(%d): TOT received, search complete", path));
1569 tot_already_received[path] = TRUE;
1573 case APP_SI_TOT_TIMEOUT:
1575 #ifdef DEBUG_SI_TOT_SEARCH 1576 AP_SI_PRINT((
"Tot search(%d): TOT timeout, search complete", path));
1584 tot_complete[path] = TRUE;
1586 tot_filter[path] = NULL;
1587 tot_start_timestamp[path] = 0;
1590 FUNCTION_FINISH(ManageTotSearch);
1610 static BOOLEAN ManageStartupSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
1615 FUNCTION_START(ManageStartupSearch);
1618 if (event == APP_SI_START_MANAGER)
1621 service_list_ready[path] = FALSE;
1626 if (current_transport_rec[path] != NULL)
1628 #ifdef DEBUG_SI_STARTUP_SEARCH 1629 AP_SI_PRINT((
"Startup search(%d): start (%s)", path,
1633 current_network_rec[path] = current_transport_rec[path]->network;
1634 current_service_rec[path] = NULL;
1636 pat_rcvd_on_this_trnsprt[path] = FALSE;
1637 last_transport_rec[path] = NULL;
1638 pmts_complete[path] = FALSE;
1639 sdt_complete[path] = FALSE;
1640 eits_complete[path] = FALSE;
1641 tot_complete[path] = FALSE;
1643 #ifdef COMMON_INTERFACE 1650 sdt_filter[path] =
STB_SIRequestSdt(path, ONE_SHOT_REQUEST, TRUE, FALSE, DONT_CARE_ID_MATCH,
1651 DONT_CARE_ID_MASK, 1, ReceiveSiTable, APP_SI_SDT_RECEIVED);
1655 if (tot_already_received[path])
1657 tot_complete[path] = TRUE;
1663 tot_filter[path] =
STB_SIRequestTot(path, ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_TOT_RECEIVED);
1668 pat_filter[path] =
STB_SIRequestPat(path, ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_PAT_RECEIVED);
1670 #ifdef COMMON_INTERFACE 1673 #ifdef DEBUG_SI_STARTUP_SEARCH 1674 AP_SI_PRINT((
"Startup search(%d): start - failed to route TS securely", path));
1684 #ifdef DEBUG_SI_STARTUP_SEARCH 1685 AP_SI_PRINT((
"Startup search(%d): start - failed, no transport", path));
1692 else if (event == APP_SI_STOP_MANAGER)
1694 #ifdef DEBUG_SI_STARTUP_SEARCH 1695 AP_SI_PRINT((
"Startup search(%d): stop", path));
1697 CancelTableRequests(path, FALSE);
1704 case APP_SI_SDT_RECEIVED:
1706 #ifdef DEBUG_SI_STARTUP_SEARCH 1707 AP_SI_PRINT((
"Startup search(%d): SDT received (tid 0x%04x v%d)", path, table_rec->xtid, table_rec->version));
1709 ProcessSdtTable(table_rec, DB_ACCESS_UPDATE, IGNORE_VERSION, EIT_LIST_REQD);
1716 eit_filter[path] =
STB_SIRequestEit(path, ONE_SHOT_REQUEST, EIT_NOW_NEXT_ACT, DONT_CARE_ID_MATCH,
1717 DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable, APP_SI_EIT_RECEIVED);
1720 sdt_complete[path] = TRUE;
1721 service_list_ready[path] = TRUE;
1723 sdt_filter[path] = NULL;
1724 sdt_start_timestamp[path] = 0;
1728 case APP_SI_SDT_TIMEOUT:
1729 #ifdef DEBUG_SI_STARTUP_SEARCH 1730 AP_SI_PRINT((
"Startup search(%d): SDT timeout", path));
1737 sdt_complete[path] = TRUE;
1738 pmts_complete[path] = TRUE;
1739 eits_complete[path] = TRUE;
1740 tot_complete[path] = TRUE;
1743 service_list_ready[path] = TRUE;
1745 sdt_filter[path] = NULL;
1746 sdt_start_timestamp[path] = 0;
1749 case APP_SI_PAT_RECEIVED:
1750 case APP_SI_PAT_TIMEOUT:
1752 if (event == APP_SI_PAT_RECEIVED)
1754 #ifdef DEBUG_SI_STARTUP_SEARCH 1755 AP_SI_PRINT((
"Startup search(%d): PAT received (tid 0x%04x)", path, table_rec->xtid));
1757 ProcessPatTable(table_rec);
1758 if (pmt_list[path] != NULL)
1760 pmt_list_id[path] = 0;
1761 pmt_request_mode[path] = PMT_REQUEST_MONITOR;
1762 MakeNewPmtRequest(path);
1766 pmts_complete[path] = TRUE;
1771 #ifdef DEBUG_SI_STARTUP_SEARCH 1772 AP_SI_PRINT((
"Startup search(%d): PAT timeout", path));
1774 pmts_complete[path] = TRUE;
1779 pat_filter[path] = NULL;
1780 pat_start_timestamp[path] = 0;
1784 case APP_SI_PMT_RECEIVED:
1785 case APP_SI_PMT_TIMEOUT:
1787 if (event == APP_SI_PMT_RECEIVED)
1789 #ifdef DEBUG_SI_STARTUP_SEARCH 1790 AP_SI_PRINT((
"Startup search(%d): PMT received (sid 0x%04x)", path, table_rec->xtid));
1793 ProcessPmtTable(table_rec, IGNORE_VERSION, DONT_REPORT_PMT, NULL, FALSE);
1795 #ifdef DEBUG_SI_STARTUP_SEARCH 1798 AP_SI_PRINT((
"Startup search(%d): PMT timeout (sid 0x%04x)", path,
1799 pmt_list[path][pmt_list_id[path]].serv_id));
1803 if ((pmt_list_id[path] + 1) >= num_pmt_list_entries[path])
1806 pmts_complete[path] = TRUE;
1808 pmt_filter[path] = NULL;
1809 pmt_start_timestamp[path] = 0;
1814 pmt_list_id[path]++;
1815 pmt_request_mode[path] = PMT_REQUEST_MONITOR;
1816 MakeNewPmtRequest(path);
1821 case APP_SI_EIT_RECEIVED:
1823 #ifdef DEBUG_SI_STARTUP_SEARCH 1824 AP_SI_PRINT((
"Startup search(%d): EIT received (sid 0x%04x)", path, table_rec->xtid));
1826 ProcessEitTable(table_rec, IGNORE_VERSION, DB_ACCESS_SEARCH, FALSE);
1829 if (eit_list[path] != NULL)
1831 eits_complete[path] = TRUE;
1832 for (i = 0; i < num_eit_list_entries[path]; i++)
1834 if (eit_list[path][i].got_eit == FALSE)
1836 eits_complete[path] = FALSE;
1841 if (eits_complete[path] == TRUE)
1844 eit_filter[path] = NULL;
1845 eit_start_timestamp[path] = 0;
1848 sched_filter[path] = NULL;
1849 sched_start_timestamp[path] = 0;
1854 case APP_SI_EIT_TIMEOUT:
1856 #ifdef DEBUG_SI_STARTUP_SEARCH 1857 AP_SI_PRINT((
"Startup search(%d): EIT timeout", path));
1860 eits_complete[path] = TRUE;
1861 if (eit_filter[path] != NULL)
1864 eit_filter[path] = NULL;
1865 eit_start_timestamp[path] = 0;
1868 if (sched_filter[path] != NULL)
1871 sched_filter[path] = NULL;
1872 sched_start_timestamp[path] = 0;
1877 case APP_SI_TOT_RECEIVED:
1878 case APP_SI_TOT_TIMEOUT:
1880 if (event == APP_SI_TOT_RECEIVED)
1882 #ifdef DEBUG_SI_STARTUP_SEARCH 1883 AP_SI_PRINT((
"Startup search(%d): TOT received", path));
1887 tot_already_received[path] = TRUE;
1889 #ifdef DEBUG_SI_STARTUP_SEARCH 1892 AP_SI_PRINT((
"Startup search(%d): TOT timeout", path));
1897 tot_complete[path] = TRUE;
1899 tot_filter[path] = NULL;
1900 tot_start_timestamp[path] = 0;
1906 if (sdt_complete[path] && pmts_complete[path] && eits_complete[path] && tot_complete[path])
1909 #ifdef DEBUG_SI_STARTUP_SEARCH 1910 AP_SI_PRINT((
"Startup search(%d): search complete", path));
1912 CancelTableRequests(path, FALSE);
1918 FUNCTION_FINISH(ManageStartupSearch);
1935 static BOOLEAN ManageEventSchedSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
1939 FUNCTION_START(ManageEventSchedSearch);
1942 if (event == APP_SI_START_MANAGER)
1947 if (current_transport_rec[path] != NULL)
1949 #ifdef DEBUG_SI_EVENT_SCHED_SEARCH 1950 AP_SI_PRINT((
"Event sched search: start, freq %lu", current_transport_rec[path]->frequency));
1954 current_network_rec[path] = current_transport_rec[path]->network;
1955 current_service_rec[path] = NULL;
1957 if ((required_si_mode[path] == APP_SI_MODE_EVENT_PF_SEARCH) ||
1958 (required_si_mode[path] == APP_SI_MODE_EVENT_PF_SCHED_SEARCH))
1961 eit_filter[path] =
STB_SIRequestEit(path, ONE_SHOT_REQUEST, EIT_NOW_NEXT_ACT, DONT_CARE_ID_MATCH,
1962 DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable, APP_SI_EIT_RECEIVED);
1965 if ((required_si_mode[path] == APP_SI_MODE_EVENT_SCHED_SEARCH) ||
1966 (required_si_mode[path] == APP_SI_MODE_EVENT_PF_SCHED_SEARCH))
1968 StartEITScheduleFilter(path);
1970 sched_timeout_ms[path] = EVENT_SCHED_SEARCH_TIMEOUT_MS;
1975 #ifdef DEBUG_SI_EVENT_SCHED_SEARCH 1976 AP_SI_PRINT((
"Event sched search: start - failed, no transport"));
1983 else if (event == APP_SI_STOP_MANAGER)
1985 #ifdef DEBUG_SI_EVENT_SCHED_SEARCH 1986 AP_SI_PRINT((
"Event sched search: stop"));
1988 CancelTableRequests(path, FALSE);
1995 case APP_SI_EIT_RECEIVED:
1997 #ifdef DEBUG_SI_EVENT_SCHED_SEARCH 1998 AP_SI_PRINT((
"Event sched search: EIT 0x%02x received (sid 0x%04x)",
1999 table_rec->tid, table_rec->xtid));
2001 ProcessEitTable(table_rec, IGNORE_VERSION, DB_ACCESS_UPDATE, FALSE);
2004 if ((eit_start_timestamp[path] != 0) &&
2005 ((table_rec->tid == EITPF_ACTUAL_TID) || (table_rec->tid == EITPF_PLUS_TID)))
2009 else if (sched_start_timestamp[path] != 0)
2016 case APP_SI_EIT_TIMEOUT:
2018 #ifdef DEBUG_SI_EVENT_SCHED_SEARCH 2019 AP_SI_PRINT((
"Event sched search: EIT timeout"));
2022 eit_filter[path] = NULL;
2023 eit_start_timestamp[path] = 0;
2025 if (sched_filter[path] == NULL)
2027 #ifdef DEBUG_SI_EVENT_SCHED_SEARCH 2028 AP_SI_PRINT((
"Event sched search: Search complete"));
2037 case APP_SI_SCHED_TIMEOUT:
2039 #ifdef DEBUG_SI_EVENT_SCHED_SEARCH 2040 AP_SI_PRINT((
"Event sched search: Schedule timeout"));
2043 sched_filter[path] = NULL;
2044 sched_start_timestamp[path] = 0;
2046 if (eit_filter[path] == NULL)
2048 #ifdef DEBUG_SI_EVENT_SCHED_SEARCH 2049 AP_SI_PRINT((
"Event sched search: Search complete"));
2060 FUNCTION_FINISH(ManageEventSchedSearch);
2077 static BOOLEAN ManageUpdate(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
2079 static BOOLEAN transport_changed;
2080 static BOOLEAN first_pmt;
2082 BOOLEAN pmt_list_changed;
2083 BOOLEAN sdt_changed;
2086 FUNCTION_START(ManageUpdate);
2091 case APP_SI_START_MANAGER:
2097 if (current_transport_rec[path] != NULL)
2099 #ifdef DEBUG_SI_UPDATE 2100 AP_SI_PRINT((
"Update(%d): start, freq %luHz, (%s)", path,
2101 current_transport_rec[path]->frequency,
2105 pat_rcvd_on_this_trnsprt[path] = FALSE;
2106 pmt_service_changed[path] = TRUE;
2107 report_pmt_allowed[path] = TRUE;
2108 pmt_reported[path] = FALSE;
2112 if (last_transport_rec[path] != current_transport_rec[path])
2114 transport_changed = TRUE;
2115 last_transport_rec[path] = current_transport_rec[path];
2119 transport_changed = FALSE;
2124 case APP_SI_STOP_MANAGER:
2126 #ifdef DEBUG_SI_UPDATE 2127 AP_SI_PRINT((
"Update(%d): stop", path));
2129 CancelTableRequests(path, FALSE);
2130 ClearDynamicUpdates();
2135 case APP_SI_UPDATE_DELAY_EXPIRED:
2138 #ifdef DEBUG_SI_UPDATE 2139 AP_SI_PRINT((
"Update(%d): start delay expired", path));
2141 si_update_delay_timestamp[path] = 0;
2144 #ifdef DEBUG_SI_UPDATE 2145 AP_SI_PRINT((
"Update(%d): requesting CAT", path));
2147 cat_start_timestamp[path] = 0;
2148 cat_filter[path] =
STB_SIRequestCat(path, CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_CAT_RECEIVED);
2151 #ifdef DEBUG_SI_UPDATE 2152 AP_SI_PRINT((
"Update(%d): requesting PAT", path));
2154 pat_start_timestamp[path] = 0;
2155 pat_filter[path] =
STB_SIRequestPat(path, CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_PAT_RECEIVED);
2159 if (current_service_rec[path]->rct_pid != 0)
2162 AP_SI_PRINT((
"Requesting RCT for service 0x%04x on PID %u",
2163 current_service_rec[path]->serv_id, current_service_rec[path]->rct_pid));
2166 current_service_rec[path]->rct_pid, ReceiveSiTable, APP_SI_RCT_RECEIVED);
2171 case APP_SI_CHANNEL_CHANGE:
2173 #ifdef DEBUG_SI_UPDATE 2174 AP_SI_PRINT((
"Update(%d): Channel changed", path));
2180 pmt_service_changed[path] = TRUE;
2181 report_pmt_allowed[path] = TRUE;
2182 pmt_reported[path] = FALSE;
2184 pmt_update_period_ms[path] = SI_UPDATE_DELAY_MS;
2188 case APP_SI_STOP_PMT_REPORTING:
2190 #ifdef DEBUG_SI_UPDATE 2191 AP_SI_PRINT((
"Update(%d): Stop pmt reporting", path));
2195 if (pmt_filter[path] != NULL)
2198 pmt_filter[path] = NULL;
2199 pmt_start_timestamp[path] = 0;
2200 pmt_update_timestamp[path] = 0;
2205 case APP_SI_PAT_RECEIVED:
2211 if ((current_transport_rec[path]->tran_id != 0) &&
2212 (table_rec->xtid != current_transport_rec[path]->tran_id))
2214 #ifdef DEBUG_SI_UPDATE 2215 AP_SI_PRINT((
"Update(%d): Wrong PAT (tid 0x%04x v%d)", path, table_rec->xtid, table_rec->version));
2221 #ifdef DEBUG_SI_UPDATE 2222 AP_SI_PRINT((
"Update(%d): PAT received (tid 0x%04x v%d)", path, table_rec->xtid, table_rec->version));
2226 pmt_list_changed = ProcessPatTable(table_rec);
2227 if (pmt_list_changed == TRUE)
2229 if ((pmt_list[path] != NULL) && (report_pmt_allowed[path] == TRUE))
2234 pmt_list_id[path] = 0;
2235 pmt_request_mode[path] = PMT_REQUEST_CURRENT;
2236 if (!MakeNewPmtRequest(path))
2240 EV_SERVICE_NOT_RUNNING, &path,
sizeof(U8BIT));
2246 if (pmt_filter[path] != NULL)
2249 pmt_filter[path] = NULL;
2250 pmt_start_timestamp[path] = 0;
2264 case APP_SI_PMT_RECEIVED:
2265 case APP_SI_PMT_TIMEOUT:
2266 case APP_SI_PMT_UPDATE:
2268 if (event == APP_SI_PMT_RECEIVED)
2271 #ifdef DEBUG_SI_UPDATE 2272 AP_SI_PRINT((
"Update(%d): PMT received (sid 0x%04x)", path, table_rec->xtid));
2275 if (ProcessPmtTable(table_rec, first_pmt, REPORT_PMT, &serv_id, DB_ACCESS_UPDATE) &&
2276 (serv_id == current_service_rec[path]->serv_id))
2285 if (nit_filter[path] != NULL)
2289 if (cat_filter[path] != NULL)
2293 if (bat_filter[path] != NULL)
2301 if (rct_filter[path] != NULL)
2304 AP_SI_PRINT((
"Cancelling RCT request"));
2307 rct_filter[path] = NULL;
2310 if (current_service_rec[path]->rct_pid != 0)
2313 AP_SI_PRINT((
"Requesting RCT for service 0x%04x on PID %u",
2314 serv_id, current_service_rec[path]->rct_pid));
2317 current_service_rec[path]->rct_pid, ReceiveSiTable, APP_SI_RCT_RECEIVED);
2320 #ifdef INTEGRATE_HBBTV 2321 if (ait_filter[path] != NULL)
2323 AP_SI_PRINT((
"Cancelling AIT request"));
2325 ait_filter[path] = NULL;
2328 if (current_service_rec[path]->ait_pid != 0)
2331 current_service_rec[path]->ait_pid, ReceiveSiTable, APP_SI_AIT_RECEIVED);
2336 #ifdef INTEGRATE_HBBTV 2337 if ((ait_filter[path] == NULL) && (current_service_rec[path]->ait_pid != 0))
2340 current_service_rec[path]->ait_pid, ReceiveSiTable, APP_SI_AIT_RECEIVED);
2346 pmt_update_period_ms[path] = PMT_UPDATE_MS;
2350 #ifdef DEBUG_SI_UPDATE 2351 if (event == APP_SI_PMT_TIMEOUT)
2353 AP_SI_PRINT((
"Update(%d): PMT timeout (sid 0x%04x)", path,
2354 pmt_list[path][pmt_list_id[path]].serv_id));
2359 if (pmt_list[path] != NULL)
2361 if (pmt_filter[path] == NULL)
2364 pmt_list_id[path] = 0;
2365 pmt_request_mode[path] = PMT_REQUEST_CURRENT;
2370 if (pmt_request_mode[path] == PMT_REQUEST_CURRENT)
2374 if (pmt_priority_list[0] != INVALID_SERVICE_ID)
2376 pmt_request_mode[path] = PMT_REQUEST_PRIORITY;
2380 pmt_request_mode[path] = PMT_REQUEST_MONITOR;
2382 pmt_list_id[path]++;
2383 if (pmt_list_id[path] >= num_pmt_list_entries[path])
2385 pmt_list_id[path] = 0;
2391 else if (pmt_request_mode[path] == PMT_REQUEST_PRIORITY)
2393 pmt_request_mode[path] = PMT_REQUEST_MONITOR;
2395 pmt_list_id[path]++;
2396 if (pmt_list_id[path] >= num_pmt_list_entries[path])
2398 pmt_list_id[path] = 0;
2403 pmt_request_mode[path] = PMT_REQUEST_CURRENT;
2406 MakeNewPmtRequest(path);
2410 pmt_start_timestamp[path] = 0;
2411 pmt_update_timestamp[path] = 0;
2417 case APP_SI_NIT_RECEIVED:
2419 #ifdef DEBUG_SI_UPDATE 2420 AP_SI_PRINT((
"Update(%u): NIT received (tid 0x%04x v%d)", path, table_rec->xtid, table_rec->version));
2422 if (ProcessNitTable(table_rec, DB_ACCESS_UPDATE, TRUE, transport_changed))
2425 #ifdef DEBUG_SI_UPDATE 2426 AP_SI_PRINT((
"Update(%u): NIT changed; restarting SDT collection", path));
2433 case APP_SI_SDT_RECEIVED:
2435 #ifdef DEBUG_SI_UPDATE 2436 AP_SI_PRINT((
"Update(%d): SDT received (tid 0x%04x v%d)", path, table_rec->xtid, table_rec->version));
2438 sdt_changed = ProcessSdtTable(table_rec, DB_ACCESS_UPDATE, CHECK_VERSION, EIT_LIST_NOT_REQD);
2450 case APP_SI_EIT_RECEIVED:
2452 #ifdef DEBUG_SI_UPDATE 2453 AP_SI_PRINT((
"Update(%d): EIT received (sid 0x%04x)", path, table_rec->xtid));
2455 ProcessEitTable(table_rec, CHECK_VERSION, DB_ACCESS_UPDATE, FALSE);
2459 case APP_SI_TDT_RECEIVED:
2461 #ifdef DEBUG_SI_UPDATE 2462 AP_SI_PRINT((
"Update(%d): TDT received", path));
2469 tdt_filter[path] = NULL;
2470 tdt_start_timestamp[path] = 0;
2474 case APP_SI_TOT_RECEIVED:
2477 #ifdef DEBUG_SI_UPDATE 2478 AP_SI_PRINT((
"Update(%d): TOT received", path));
2484 case APP_SI_CAT_RECEIVED:
2485 case APP_SI_CAT_TIMEOUT:
2487 if (event == APP_SI_CAT_RECEIVED)
2490 #ifdef DEBUG_SI_UPDATE 2491 AP_SI_PRINT((
"Update(%d): CAT received", path));
2493 ProcessCatTable(path, table_rec, REPORT_CAT, transport_changed);
2495 #ifdef DEBUG_SI_UPDATE 2498 AP_SI_PRINT((
"Update(%d): CAT timeout", path));
2504 case APP_SI_RCT_RECEIVED:
2507 AP_SI_PRINT((
"Update(%u): RCT received", path));
2509 ProcessRctTable(table_rec);
2513 case APP_SI_SCHED_TIMEOUT:
2517 sched_filter[path] = NULL;
2518 sched_start_timestamp[path] = 0;
2519 StartEITScheduleFilter(path);
2523 case APP_SI_BAT_RECEIVED:
2525 #ifdef DEBUG_SI_UPDATE 2526 AP_SI_PRINT((
"Update(%u): BAT received (bouquet id 0x%04x, v%d)", path, table_rec->xtid, table_rec->version));
2528 if (ProcessBatTable(table_rec, DB_ACCESS_UPDATE, TRUE))
2531 #ifdef DEBUG_SI_UPDATE 2532 AP_SI_PRINT((
"Update(%u): BAT changed; restarting SDT collection", path));
2538 #ifdef INTEGRATE_HBBTV 2539 case APP_SI_AIT_RECEIVED:
2544 #ifdef DEBUG_SI_UPDATE 2545 AP_SI_PRINT((
"Update(%u): AIT received (test:%d,type:0x%04x, v%d)", path,
2546 table_rec->xtid >> 15, table_rec->xtid & 0x7F, table_rec->version));
2549 section = table_rec->section_list;
2550 for (i = 0; (i < table_rec->num_sect) && (section != NULL); i++)
2553 section = section->next;
2560 FUNCTION_FINISH(ManageUpdate);
2565 static void StartEITScheduleFilter(U8BIT path)
2567 E_SI_SCHED_TABLE_REQ sched_table_req;
2569 if ((eit_schedule_limit == 0) || (eit_schedule_limit >= 8 * 24))
2571 #ifdef DEBUG_SI_UPDATE 2572 AP_SI_PRINT((
"Update(%d): requesting SCHED all", path));
2574 sched_table_req = EIT_SCHED_ALL;
2575 sched_start_timestamp[path] = 0;
2576 sched_timeout_ms[path] = 0;
2578 else if (eit_schedule_limit < 4 * 24)
2580 #ifdef DEBUG_SI_UPDATE 2581 AP_SI_PRINT((
"Update(%d): requesting SCHED 4 day", path));
2583 sched_table_req = EIT_SCHED_ALL_4DAY;
2585 sched_timeout_ms[path] = SCHED_TIMEOUT_MS;
2589 #ifdef DEBUG_SI_UPDATE 2590 AP_SI_PRINT((
"Update(%d): requesting SCHED 8 day", path));
2592 sched_table_req = EIT_SCHED_ALL_8DAY;
2594 sched_timeout_ms[path] = SCHED_TIMEOUT_MS;
2599 DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable, APP_SI_EIT_RECEIVED);
2615 static BOOLEAN ManageUpdatePlayback(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
2618 BOOLEAN pmt_list_changed;
2619 BOOLEAN service_updated;
2621 U16BIT pmt_data_len;
2625 FUNCTION_START(ManageUpdatePlayback);
2630 case APP_SI_START_MANAGER:
2635 last_playback_pmt_version = -1;
2636 last_playback_pat_version = -1;
2638 #ifdef DEBUG_SI_PLAYBACK 2639 AP_SI_PRINT((
"UpdatePlayback(%d): start (playback service = %p)", path, current_service_rec[path]));
2642 pat_rcvd_on_this_trnsprt[path] = FALSE;
2643 pmt_service_changed[path] = TRUE;
2644 report_pmt_allowed[path] = TRUE;
2645 pmt_reported[path] = FALSE;
2646 si_update_delay_timestamp[path] = 0;
2649 cat_start_timestamp[path] = 0;
2650 cat_filter[path] =
STB_SIRequestCat(path, CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_CAT_RECEIVED);
2653 pmt_filter_pid[path] = 0;
2654 pat_start_timestamp[path] = 0;
2655 pat_filter[path] =
STB_SIRequestPat(path, CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_PAT_RECEIVED);
2658 eit_start_timestamp[path] = 0;
2659 eit_filter[path] =
STB_SIRequestEit(path, CONTINUOUS_REQUEST, EIT_NOW_NEXT_ACT,
2660 current_service_rec[path]->serv_id, 0xffff, 0xffff, ReceiveSiTable, APP_SI_EIT_RECEIVED);
2664 case APP_SI_STOP_MANAGER:
2666 #ifdef DEBUG_SI_PLAYBACK 2667 AP_SI_PRINT((
"UpdatePlayback(%d): stop", path));
2669 CancelTableRequests(path, FALSE);
2674 case APP_SI_STOP_PMT_REPORTING:
2676 #ifdef DEBUG_SI_PLAYBACK 2677 AP_SI_PRINT((
"UpdatePlayback(%d): Stop pmt reporting", path));
2681 if (pmt_filter[path] != NULL)
2684 pmt_filter[path] = NULL;
2685 pmt_start_timestamp[path] = 0;
2686 pmt_update_timestamp[path] = 0;
2691 case APP_SI_PAT_RECEIVED:
2693 #ifdef DEBUG_SI_PLAYBACK 2694 AP_SI_PRINT((
"UpdatePlayback(%d): PAT received (tid 0x%04x v%d)", path, table_rec->xtid, table_rec->version));
2698 pmt_list_changed = ProcessPatTablePlayback(table_rec);
2699 if (pmt_list_changed == TRUE)
2701 if (pmt_filter[path] != NULL)
2704 pmt_filter[path] = NULL;
2708 pmt_filter[path] =
STB_SIRequestPmt(path, CONTINUOUS_REQUEST, pmt_filter_pid[path],
2709 current_service_rec[path]->serv_id, 0xffff, 0xffff, ReceiveSiTable, APP_SI_PMT_RECEIVED);
2720 case APP_SI_PMT_RECEIVED:
2721 case APP_SI_PMT_TIMEOUT:
2722 case APP_SI_PMT_UPDATE:
2724 if (event == APP_SI_PMT_RECEIVED)
2727 #ifdef DEBUG_SI_PLAYBACK 2728 AP_SI_PRINT((
"UpdatePlayback(%d): PMT received", path));
2731 service_updated = ProcessPmtTable(table_rec, CHECK_VERSION, REPORT_PMT, NULL, DB_ACCESS_PLAYBACK);
2732 if (service_updated && (current_service_rec[path] != NULL))
2751 if (bat_filter[path] != NULL)
2763 pmt_update_timestamp[path] = 0;
2767 #ifdef DEBUG_SI_PLAYBACK 2768 if (event == APP_SI_PMT_TIMEOUT)
2770 AP_SI_PRINT((
"UpdatePlayback(%d): PMT timeout", path));
2774 AP_SI_PRINT((
"UpdatePlayback(%d): #1# PMT update", path));
2781 case APP_SI_EIT_RECEIVED:
2783 #ifdef DEBUG_SI_PLAYBACK 2784 AP_SI_PRINT((
"UpdatePlayback(%d): EIT received (sid 0x%04x)", path, table_rec->xtid));
2786 ProcessEitTable(table_rec, CHECK_VERSION, DB_ACCESS_UPDATE, TRUE);
2790 case APP_SI_CAT_RECEIVED:
2791 case APP_SI_CAT_TIMEOUT:
2793 if (event == APP_SI_CAT_RECEIVED)
2796 #ifdef DEBUG_SI_PLAYBACK 2797 AP_SI_PRINT((
"UpdatePlayback(%d): CAT received", path));
2799 ProcessCatTable(path, table_rec, REPORT_CAT, FALSE);
2801 #ifdef DEBUG_SI_PLAYBACK 2804 AP_SI_PRINT((
"UpdatePlayback(%d): CAT timeout", path));
2812 FUNCTION_FINISH(ManageUpdatePlayback);
2816 #ifdef COMMON_INTERFACE 2826 static BOOLEAN ManageCIPlusUpdate(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
2833 FUNCTION_START(ManageCIPlusUpdate);
2839 case APP_SI_START_MANAGER:
2844 #ifdef DEBUG_CI_SI_UPDATE 2845 AP_SI_PRINT((
"CI+ update(%u): start for sid 0x%04x", path, current_service_rec[path]->serv_id));
2851 #ifdef DEBUG_CI_SI_UPDATE 2852 AP_SI_PRINT((
"CI+ update(%u): Requesting SDT for tid 0x%04x", path,
2853 current_transport_rec[path]->tran_id));
2859 DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 1, ReceiveSiTable, APP_SI_SDT_RECEIVED);
2864 case APP_SI_STOP_MANAGER:
2866 #ifdef DEBUG_CI_SI_UPDATE 2867 AP_SI_PRINT((
"CI+ update(%u): stop", path));
2869 CancelTableRequests(path, FALSE);
2874 case APP_SI_SDT_RECEIVED:
2876 #ifdef DEBUG_CI_SI_UPDATE 2877 AP_SI_PRINT((
"CI+ update(%u): SDT received (tid 0x%04x v%d)", path, table_rec->xtid,
2878 table_rec->version));
2881 if (!current_transport_rec[path]->sdt_received)
2887 current_transport_rec[path]->tran_id = table_rec->xtid;
2889 current_transport_rec[path]->tran_id);
2891 section_rec = table_rec->section_list;
2892 data_ptr = &(section_rec->data_start) + 8;
2893 current_transport_rec[path]->orig_net_id = (data_ptr[0] << 8) | data_ptr[1];
2895 current_transport_rec[path]->orig_net_id);
2897 current_transport_rec[path]->sdt_received = TRUE;
2906 ProcessSdtTable(table_rec, DB_ACCESS_UPDATE, IGNORE_VERSION, EIT_LIST_NOT_REQD);
2910 if (ADB_GetServiceSDTReceived(current_service_rec[path]))
2913 sdt_filter[path] = NULL;
2914 sdt_start_timestamp[path] = 0;
2930 if (bat_filter[path] != NULL)
2938 #ifdef DEBUG_CI_SI_UPDATE 2939 AP_SI_PRINT((
"CI+ update(%u): start update", path));
2941 current_manager[path] = ManageUpdate;
2942 finished = ManageUpdate(path, APP_SI_START_MANAGER, NULL);
2945 current_manager[path] = NULL;
2949 #ifdef DEBUG_CI_SI_UPDATE 2952 AP_SI_PRINT((
"CI+ update(%u): required SDT not yet received, continue", path));
2958 case APP_SI_SDT_TIMEOUT:
2960 #ifdef DEBUG_CI_SI_UPDATE 2961 AP_SI_PRINT((
"CI+ update(%u): SDT timeout", path));
2967 sdt_filter[path] = NULL;
2968 sdt_start_timestamp[path] = 0;
2985 if (bat_filter[path] != NULL)
2993 #ifdef DEBUG_CI_SI_UPDATE 2994 AP_SI_PRINT((
"CI+ update(%u): start update", path));
2996 current_manager[path] = ManageUpdate;
2997 finished = ManageUpdate(path, APP_SI_START_MANAGER, NULL);
3000 current_manager[path] = NULL;
3007 FUNCTION_FINISH(ManageCIPlusUpdate);
3020 static BOOLEAN ManageCIPlusNoPatPmt(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
3025 FUNCTION_START(ManageCIPlusNoPatPmt);
3031 case APP_SI_START_MANAGER:
3036 #ifdef DEBUG_CI_SI_UPDATE 3037 AP_SI_PRINT((
"CI+ no PAT/PMT(%u): start for sid 0x%04x", path, current_service_rec[path]->serv_id));
3043 #ifdef DEBUG_CI_SI_UPDATE 3044 AP_SI_PRINT((
"CI+ no PAT/PMT(%u): Requesting SDT for tid 0x%04x", path,
3045 current_transport_rec[path]->tran_id));
3050 DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 1, ReceiveSiTable, APP_SI_SDT_RECEIVED);
3055 case APP_SI_STOP_MANAGER:
3057 #ifdef DEBUG_CI_SI_UPDATE 3058 AP_SI_PRINT((
"CI+ no PAT/PMT(%u): stop", path));
3060 CancelTableRequests(path, FALSE);
3065 case APP_SI_SDT_RECEIVED:
3066 case APP_SI_SDT_TIMEOUT:
3068 if (event == APP_SI_SDT_RECEIVED)
3070 #ifdef DEBUG_CI_SI_UPDATE 3071 AP_SI_PRINT((
"CI+ no PAT/PMT(%u): SDT received (tid 0x%04x v%d)", path, table_rec->xtid,
3072 table_rec->version));
3075 ProcessSdtTable(table_rec, DB_ACCESS_UPDATE, IGNORE_VERSION, EIT_LIST_NOT_REQD);
3078 if (!ADB_GetServiceSDTReceived(current_service_rec[path]))
3080 #ifdef DEBUG_CI_SI_UPDATE 3081 AP_SI_PRINT((
"CI+ no PAT/PMT(%u): required SDT not yet received, continue search", path));
3086 #ifdef DEBUG_CI_SI_UPDATE 3089 AP_SI_PRINT((
"CI+ no PAT/PMT(%u): SDT timeout", path));
3094 sdt_filter[path] = NULL;
3095 sdt_start_timestamp[path] = 0;
3111 if (bat_filter[path] != NULL)
3119 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_CIPLUS_TUNE_COMPLETED, &path,
sizeof(path));
3122 #ifdef DEBUG_CI_SI_UPDATE 3123 AP_SI_PRINT((
"CI+ no PAT/PMT(%u): starting other tables", path));
3127 tdt_start_timestamp[path] = 0;
3128 tdt_filter[path] =
STB_SIRequestTdt(path, ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_TDT_RECEIVED);
3129 tot_start_timestamp[path] = 0;
3130 tot_filter[path] =
STB_SIRequestTot(path, CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_TOT_RECEIVED);
3134 case APP_SI_TDT_RECEIVED:
3136 #ifdef DEBUG_CI_SI_UPDATE 3137 AP_SI_PRINT((
"CI+ no PAT/PMT(%d): TDT received", path));
3144 tdt_filter[path] = NULL;
3145 tdt_start_timestamp[path] = 0;
3149 case APP_SI_TOT_RECEIVED:
3151 #ifdef DEBUG_CI_SI_UPDATE 3152 AP_SI_PRINT((
"CI+ no PAT/PMT(%d): TOT received", path));
3159 FUNCTION_FINISH(ManageCIPlusNoPatPmt);
3179 static BOOLEAN ManageRecording(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
3184 FUNCTION_START(ManageRecording);
3190 case APP_SI_START_MANAGER:
3194 if (current_transport_rec[path] != NULL)
3196 #ifdef DEBUG_SI_RECORDING 3197 AP_SI_PRINT((
"Recording(%u): start on transport %p (tid 0x%04x)", path,
3198 current_transport_rec[path], current_transport_rec[path]->tran_id));
3201 pat_rcvd_on_this_trnsprt[path] = FALSE;
3204 cat_start_timestamp[path] = 0;
3205 cat_filter[path] =
STB_SIRequestCat(path, CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_CAT_RECEIVED);
3208 pat_start_timestamp[path] = 0;
3209 pat_filter[path] =
STB_SIRequestPat(path, CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_PAT_RECEIVED);
3215 if (current_service_rec[path]->eit_pf_plus_pid != 0)
3217 eit_pid = current_service_rec[path]->eit_pf_plus_pid;
3219 else if (current_service_rec[path]->eit_pf_pid != 0)
3221 eit_pid = current_service_rec[path]->eit_pf_pid;
3226 #ifdef DEBUG_SI_RECORDING 3227 AP_SI_PRINT((
"Recording(%u): requesting EIT on PID %u", path, eit_pid));
3229 eit_start_timestamp[path] = 0;
3231 DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable, APP_SI_EIT_RECEIVED);
3236 eit_filter[path] =
STB_SIRequestEit(path, CONTINUOUS_REQUEST, EIT_NOW_NEXT_ACT, DONT_CARE_ID_MATCH,
3237 DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable, APP_SI_EIT_RECEIVED);
3243 case APP_SI_STOP_MANAGER:
3245 #ifdef DEBUG_SI_RECORDING 3246 AP_SI_PRINT((
"Recording(%d): stop", path));
3248 CancelTableRequests(path, FALSE);
3253 case APP_SI_CAT_RECEIVED:
3254 case APP_SI_CAT_TIMEOUT:
3256 if (event == APP_SI_CAT_RECEIVED)
3259 #ifdef DEBUG_SI_RECORDING 3260 AP_SI_PRINT((
"Recording(%d): CAT received", path));
3262 ProcessCatTable(path, table_rec, REPORT_CAT, FALSE);
3264 #ifdef DEBUG_SI_RECORDING 3267 AP_SI_PRINT((
"recording(%d): CAT timeout", path));
3273 case APP_SI_PAT_RECEIVED:
3276 if (table_rec->xtid != current_transport_rec[path]->tran_id)
3278 #ifdef DEBUG_SI_RECORDING 3279 AP_SI_PRINT((
"Recording(%d): Wrong PAT (tid 0x%04x v%d)", path, table_rec->xtid, table_rec->version));
3285 #ifdef DEBUG_SI_RECORDING 3286 AP_SI_PRINT((
"Recording(%d): PAT received (tid 0x%04x v%d)", path, table_rec->xtid, table_rec->version));
3290 if (ProcessPatTable(table_rec))
3292 if (pmt_list[path] != NULL)
3295 pmt_list_id[path] = 0;
3296 pmt_request_mode[path] = PMT_REQUEST_CURRENT;
3297 MakeNewPmtRequest(path);
3302 if (pmt_filter[path] != NULL)
3305 pmt_filter[path] = NULL;
3306 pmt_start_timestamp[path] = 0;
3320 case APP_SI_PMT_RECEIVED:
3321 case APP_SI_PMT_TIMEOUT:
3322 case APP_SI_PMT_UPDATE:
3324 if (event == APP_SI_PMT_RECEIVED)
3327 #ifdef DEBUG_SI_RECORDING 3328 AP_SI_PRINT((
"Recording(%d): PMT received (sid 0x%04x)", path, table_rec->xtid));
3330 ProcessPmtTable(table_rec, CHECK_VERSION, DONT_REPORT_PMT, NULL, DB_ACCESS_UPDATE);
3332 pmt_update_period_ms[path] = PMT_UPDATE_MS;
3336 #ifdef DEBUG_SI_RECORDING 3337 if (event == APP_SI_PMT_TIMEOUT)
3339 AP_SI_PRINT((
"Recording(%d): PMT timeout (sid 0x%04x)", path,
3340 pmt_list[path][pmt_list_id[path]].serv_id));
3344 AP_SI_PRINT((
"Recording(%d): PMT update", path));
3349 if (pmt_list[path] != NULL)
3351 if (pmt_filter[path] == NULL)
3354 pmt_list_id[path] = 0;
3355 pmt_request_mode[path] = PMT_REQUEST_CURRENT;
3360 if (pmt_request_mode[path] == PMT_REQUEST_CURRENT)
3364 if (pmt_priority_list[0] != INVALID_SERVICE_ID)
3366 pmt_request_mode[path] = PMT_REQUEST_PRIORITY;
3370 pmt_request_mode[path] = PMT_REQUEST_MONITOR;
3372 pmt_list_id[path]++;
3373 if (pmt_list_id[path] >= num_pmt_list_entries[path])
3375 pmt_list_id[path] = 0;
3381 else if (pmt_request_mode[path] == PMT_REQUEST_PRIORITY)
3383 pmt_request_mode[path] = PMT_REQUEST_MONITOR;
3385 pmt_list_id[path]++;
3386 if (pmt_list_id[path] >= num_pmt_list_entries[path])
3388 pmt_list_id[path] = 0;
3393 pmt_request_mode[path] = PMT_REQUEST_CURRENT;
3396 MakeNewPmtRequest(path);
3400 pmt_start_timestamp[path] = 0;
3401 pmt_update_timestamp[path] = 0;
3407 case APP_SI_EIT_RECEIVED:
3409 #ifdef DEBUG_SI_RECORDING 3410 AP_SI_PRINT((
"Recording(%d): EIT received (sid 0x%04x)", path, table_rec->xtid));
3412 ProcessEitTable(table_rec, CHECK_VERSION, DB_ACCESS_UPDATE, FALSE);
3417 FUNCTION_FINISH(ManageRecording);
3423 static BOOLEAN ValidServiceType(ADB_SERVICE_TYPE serv_type, BOOLEAN all_streams_free)
3425 BOOLEAN valid_service;
3427 FUNCTION_START(ValidServiceType);
3429 valid_service = FALSE;
3431 if (((serv_type == ADB_SERVICE_TYPE_TV) ||
3432 (serv_type == ADB_SERVICE_TYPE_RADIO) ||
3433 (serv_type == ADB_SERVICE_TYPE_DATA) ||
3434 (((serv_type == ADB_SERVICE_TYPE_AVC_RADIO) ||
3435 (serv_type == ADB_SERVICE_TYPE_AVC_SD_TV)) &&
3436 ((required_service_type & SEARCH_SERVICE_TYPE_ADVANCED_CODEC) != 0)) ||
3437 (((serv_type == ADB_SERVICE_TYPE_HD_TV) ||
3438 (serv_type == ADB_SERVICE_TYPE_MPEG2_HD)) &&
3439 ((required_service_type & SEARCH_SERVICE_TYPE_HD) != 0)) ||
3440 ((serv_type == ADB_SERVICE_TYPE_UHD_TV) &&
3441 ((required_service_type & SEARCH_SERVICE_TYPE_HEVC) != 0))))
3443 if ((((required_service_type & SEARCH_SERVICE_TYPE_FREE_TO_AIR) != 0) && all_streams_free) ||
3444 (((required_service_type & SEARCH_SERVICE_TYPE_ENCRYPTED) != 0) && !all_streams_free))
3446 valid_service = TRUE;
3450 FUNCTION_FINISH(ValidServiceType);
3452 return(valid_service);
3468 static BOOLEAN ProcessSdtTable(
SI_TABLE_RECORD *table_rec, E_DB_ACCESS_MODE mode,
3469 BOOLEAN ignore_version, BOOLEAN eit_list_reqd)
3491 BOOLEAN serv_scrambled;
3492 BOOLEAN serv_not_running;
3493 BOOLEAN service_updated;
3494 U8BIT serv_running_status;
3497 FUNCTION_START(ProcessSdtTable);
3500 path = table_rec->path;
3504 if (sdt_table != NULL)
3508 if (mode == DB_ACCESS_SEARCH)
3510 t_ptr = current_transport_rec[path];
3512 if (t_ptr->sig_type != SIGNAL_COFDM)
3515 sdt_table->tran_id)) == NULL)
3518 t_ptr = current_transport_rec[path];
3522 if (t_ptr != current_transport_rec[path])
3533 while (s_ptr != NULL)
3535 if (s_ptr->transport == current_transport_rec[path])
3538 s_ptr->transport = t_ptr;
3549 current_transport_rec[path] = t_ptr;
3555 else if (sdt_table->num_services > 0)
3562 if ((t_ptr != NULL) && ((t_ptr->network == NULL) || (t_ptr->network->profile_type != ADB_PROFILE_TYPE_CIPLUS)))
3565 if (mode == DB_ACCESS_SEARCH)
3567 AP_SI_PRINT((
"SDT Table: tran_id 0x%04x onet_id 0x%04x v%d %d services",
3568 sdt_table->tran_id, sdt_table->orig_net_id, sdt_table->version,
3569 sdt_table->num_services));
3573 if ((t_ptr->sdt_version != sdt_table->version) || (ignore_version == TRUE))
3575 AP_SI_PRINT((
"SDT Table: tran_id 0x%04x onet_id 0x%04x v%d %d services - new",
3576 sdt_table->tran_id, sdt_table->orig_net_id, sdt_table->version,
3577 sdt_table->num_services));
3581 AP_SI_PRINT((
"SDT Table: tran_id 0x%04x onet_id 0x%04x v%d %d services - same",
3582 sdt_table->tran_id, sdt_table->orig_net_id, sdt_table->version,
3583 sdt_table->num_services));
3588 if (eit_list_reqd == TRUE)
3591 if (eit_list[path] != NULL)
3595 num_eit_list_entries[path] = sdt_table->num_services;
3598 memset(eit_list[path], 0, num_eit_list_entries[path] *
sizeof(
EIT_LIST_ENTRY));
3602 if ((mode == DB_ACCESS_SEARCH) || (ignore_version == TRUE) || !t_ptr->sdt_received ||
3603 (t_ptr->sdt_version != sdt_table->version))
3612 t_ptr->sdt_received = TRUE;
3614 if (t_ptr->sdt_version != sdt_table->version)
3617 t_ptr->sdt_version = sdt_table->version;
3623 if (mode != DB_ACCESS_SEARCH)
3625 t_ptr->sdt_version_changed = TRUE;
3629 if (mode == DB_ACCESS_SEARCH)
3632 t_ptr->sdt_version_changed = FALSE;
3635 if (t_ptr->tran_id != sdt_table->tran_id)
3637 t_ptr->tran_id = sdt_table->tran_id;
3643 if (t_ptr->orig_net_id == 0)
3645 t_ptr->orig_net_id = sdt_table->orig_net_id;
3660 while (s_ptr != NULL)
3662 s_ptr->unavailable = TRUE;
3667 sdt_entry = sdt_table->service_list;
3668 while (sdt_entry != NULL)
3671 if (mode == DB_ACCESS_SEARCH)
3678 t_ptr->tran_id, sdt_entry->serv_id);
3681 if ((s_ptr == NULL) && ValidServiceType(sdt_entry->serv_type, sdt_entry->all_streams_free))
3683 if (mode == DB_ACCESS_SEARCH)
3686 AP_SI_PRINT((
" add service sid 0x%04x", sdt_entry->serv_id));
3691 s_ptr->new_service = TRUE;
3696 (dynamic_update_head != NULL))
3699 AP_SI_PRINT((
" add service sid 0x%04x", sdt_entry->serv_id));
3704 s_ptr->new_service = TRUE;
3706 DynamicUpdateAddService(t_ptr, s_ptr,
3712 s_ptr->target_region_list = sdt_entry->target_region_list;
3713 sdt_entry->target_region_list = NULL;
3718 while (s_ptr != NULL)
3721 AP_SI_PRINT((
" Service 0x%04x", sdt_entry->serv_id));
3722 if (s_ptr->name_str != NULL)
3724 AP_SI_PRINT((
" name \"%s\"", s_ptr->name_str->str_ptr));
3728 service_updated = FALSE;
3729 s_ptr->found = TRUE;
3732 serv_scrambled = s_ptr->scrambled;
3734 if ((eit_list_reqd == TRUE) && (eit_list[path] != NULL))
3737 if (eit_list_id < num_eit_list_entries[path])
3739 eit_list[path][eit_list_id].serv_id = sdt_entry->serv_id;
3753 service_updated = TRUE;
3757 if (sdt_entry->name_str != NULL)
3762 AP_SI_PRINT((
" new name \"%s\"", sdt_entry->name_str->str_ptr));
3764 service_updated = TRUE;
3772 AP_SI_PRINT((
" new NULL name"));
3774 service_updated = TRUE;
3782 s_ptr->unavailable = FALSE;
3783 s_ptr->scrambled = (sdt_entry->all_streams_free == FALSE);
3784 serv_running_status = s_ptr->running_status;
3785 s_ptr->running_status = sdt_entry->running_status;
3786 serv_not_running = s_ptr->not_running;
3789 if ((sdt_entry->running_status == RUN_STATE_NOT_RUNNING) ||
3790 (sdt_entry->running_status == RUN_STATE_STARTS_SOON) ||
3791 (sdt_entry->running_status == RUN_STATE_OFF_AIR))
3793 s_ptr->not_running = TRUE;
3797 s_ptr->not_running = FALSE;
3800 if (sdt_entry->fta_content_desc != NULL)
3802 s_ptr->has_fta_desc = TRUE;
3803 s_ptr->do_not_scramble = sdt_entry->fta_content_desc->do_not_scramble;
3809 if (sdt_entry->provider_str != NULL)
3817 service_updated = TRUE;
3821 if (sdt_entry->short_name_str != NULL)
3825 service_updated = TRUE;
3832 service_updated = TRUE;
3837 for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
3839 if (s_ptr->short_name_array[i] != NULL)
3842 s_ptr->short_name_array[i] = NULL;
3844 if (s_ptr->provider_array[i] != NULL)
3847 s_ptr->provider_array[i] = NULL;
3849 for (j = 0; j < ADB_NUM_SERV_NAME_IDS; j++)
3851 if (s_ptr->name_array[i][j] != NULL)
3854 s_ptr->name_array[i][j] = NULL;
3860 short_name_desc_ptr = sdt_entry->multiling_short_name_array;
3861 for (i = 0; i < sdt_entry->num_multiling_short_names; i++, short_name_desc_ptr++)
3864 if (lang_id != ACFG_INVALID_DB_LANG)
3866 if (short_name_desc_ptr->name_str != NULL)
3868 if (s_ptr->short_name_array[lang_id] == NULL)
3870 str_desc = short_name_desc_ptr->name_str;
3872 short_name_desc_ptr->lang_code, str_desc->str_ptr, str_desc->nbytes);
3879 mlsn_desc_ptr = sdt_entry->multiling_name_desc_array;
3880 for (i = 0; i < sdt_entry->num_multiling_names; i++, mlsn_desc_ptr++)
3883 if (lang_id != ACFG_INVALID_DB_LANG)
3887 if (mlsn_desc_ptr->name_str != NULL)
3889 if (s_ptr->name_array[lang_id][0] == NULL)
3891 str_desc = mlsn_desc_ptr->name_str;
3893 mlsn_desc_ptr->lang_code, str_desc->str_ptr, str_desc->nbytes);
3899 if (mlsn_desc_ptr->provider_str != NULL)
3901 if (s_ptr->provider_array[lang_id] == NULL)
3903 str_desc = mlsn_desc_ptr->provider_str;
3905 mlsn_desc_ptr->lang_code, str_desc->str_ptr, str_desc->nbytes);
3912 pref_name_desc_ptr = sdt_entry->preferred_name_desc_array;
3913 for (i = 0; i < sdt_entry->num_preferred_names; i++, pref_name_desc_ptr++)
3915 if (pref_name_desc_ptr->name_str != NULL)
3918 if (lang_id != ACFG_INVALID_DB_LANG)
3920 if (pref_name_desc_ptr->name_id < ADB_NUM_SERV_NAME_IDS)
3922 name_id = pref_name_desc_ptr->name_id;
3923 if (s_ptr->name_array[lang_id][name_id] == NULL)
3925 str_desc = pref_name_desc_ptr->name_str;
3927 pref_name_desc_ptr->lang_code, str_desc->str_ptr, str_desc->nbytes);
3935 if ((sdt_entry->guidance != NULL) &&
3936 ((sdt_entry->guidance->guidance_type == 0) || (sdt_entry->guidance->guidance_type == 1)))
3938 for (i = 0; i < sdt_entry->guidance->num_langs; i++)
3941 if (lang_id != ACFG_INVALID_DB_LANG)
3943 if (s_ptr->guidance[lang_id].text != NULL)
3946 s_ptr->guidance[lang_id].text = NULL;
3949 s_ptr->guidance[lang_id].type = sdt_entry->guidance->guidance_type;
3950 s_ptr->guidance[lang_id].mode = sdt_entry->guidance->guidance_mode;
3953 sdt_entry->guidance->lang_codes[i],
3954 sdt_entry->guidance->strings[i]->str_ptr,
3955 sdt_entry->guidance->strings[i]->nbytes);
3959 else if (s_ptr->guidance != NULL)
3961 for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
3963 if (s_ptr->guidance[i].text != NULL)
3966 s_ptr->guidance[i].text = NULL;
3973 s_ptr->alt_serv_list = NULL;
3974 last_alt_serv_rec_next_ptr = &(s_ptr->alt_serv_list);
3976 linkage_desc_ptr = sdt_entry->linkage_desc_list;
3977 while (linkage_desc_ptr != NULL)
3979 if ((linkage_desc_ptr->link_type == LINK_TYPE_SERVICE_REPLACEMENT) ||
3980 (linkage_desc_ptr->link_type == LINK_TYPE_CA_REPLACEMENT_SERVICE))
3983 if (alt_serv_rec != NULL)
3985 alt_serv_rec->onet_id = linkage_desc_ptr->orig_net_id;
3986 alt_serv_rec->tran_id = linkage_desc_ptr->tran_id;
3987 alt_serv_rec->serv_id = linkage_desc_ptr->serv_id;
3988 alt_serv_rec->link_type = linkage_desc_ptr->link_type;
3989 alt_serv_rec->next = NULL;
3990 *last_alt_serv_rec_next_ptr = alt_serv_rec;
3991 last_alt_serv_rec_next_ptr = &(alt_serv_rec->next);
3993 AP_SI_PRINT((
" add alt service type=0x%02x, 0x%04x/0x%04x/0x%04x",
3994 alt_serv_rec->link_type, alt_serv_rec->onet_id, alt_serv_rec->tran_id,
3995 alt_serv_rec->serv_id));
3999 linkage_desc_ptr = linkage_desc_ptr->next;
4002 if (sdt_entry->def_authority != NULL)
4006 if (s_ptr->def_authority != NULL)
4009 if (sdt_entry->def_authority->nbytes == s_ptr->def_authority->nbytes)
4011 if (memcmp(s_ptr->def_authority->str_ptr, sdt_entry->def_authority->str_ptr,
4012 s_ptr->def_authority->nbytes) == 0)
4023 if (s_ptr->def_authority != NULL)
4026 s_ptr->def_authority = NULL;
4031 sdt_entry->def_authority->str_ptr, sdt_entry->def_authority->nbytes);
4033 AP_SI_PRINT((
" SDT \"%s\" has default authority \"%s\"", s_ptr->name_str->str_ptr,
4034 s_ptr->def_authority->str_ptr));
4039 if ((current_service_rec[path] == s_ptr) &&
4040 (s_ptr->running_status != serv_running_status) &&
4047 if (s_ptr->not_running != serv_not_running)
4050 if ((current_service_rec[path] == s_ptr) && s_ptr->not_running)
4054 AP_SI_PRINT((
" sid 0x%04x report service not running", s_ptr->serv_id));
4057 EV_SERVICE_NOT_RUNNING, &path,
sizeof(U8BIT));
4060 else if ((s_ptr->not_running == FALSE) &&
4061 ((s_ptr->video_pid != 0) || (s_ptr->audio_pid != 0) ||
4062 (t_ptr != current_transport_rec[path])))
4066 AP_SI_PRINT((
" sid 0x%04x report service running", s_ptr->serv_id));
4068 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_RUNNING,
4069 &s_ptr,
sizeof(s_ptr));
4074 if (s_ptr->scrambled != serv_scrambled)
4085 AP_SI_PRINT((
" sid 0x%04x report scramble change", s_ptr->serv_id));
4088 EV_SERVICE_SCRAMBLE_CHANGE, &s_ptr,
sizeof(s_ptr));
4092 if (mode == DB_ACCESS_SEARCH)
4097 s_ptr->target_region_list = sdt_entry->target_region_list;
4098 sdt_entry->target_region_list = NULL;
4101 if (service_updated)
4104 EV_SERVICE_UPDATED, &s_ptr,
sizeof(s_ptr));
4109 t_ptr->tran_id, sdt_entry->serv_id);
4113 t_ptr->tran_id, sdt_entry->serv_id)) != NULL)
4116 DeleteLinkageDescripterArray(s_ptr->linkage_desc_list);
4117 s_ptr->last_linkage_entry = NULL;
4118 s_ptr->num_linkage_entries = 0;
4119 s_ptr->linkage_desc_list = NULL;
4121 linkage_desc_ptr = sdt_entry->linkage_desc_list;
4122 while (linkage_desc_ptr != NULL)
4125 CopyLinkageDesc(linkage_desc_ptr,
4126 &s_ptr->linkage_desc_list,
4127 &s_ptr->last_linkage_entry,
4128 &s_ptr->num_linkage_entries);
4130 linkage_desc_ptr = linkage_desc_ptr->next;
4133 #ifdef COMMON_INTERFACE 4138 s_ptr->sdt_received = TRUE;
4140 if (s_ptr->ci_protection_desc != NULL)
4143 s_ptr->ci_protection_desc = NULL;
4147 if (sdt_entry->ci_protection_desc != NULL)
4151 s_ptr->ci_protection_desc = sdt_entry->ci_protection_desc;
4152 sdt_entry->ci_protection_desc = NULL;
4160 s_ptr->sdt_received = FALSE;
4165 sdt_entry = sdt_entry->next;
4172 while (s_ptr != NULL)
4176 if (s_ptr->unavailable)
4179 AP_SI_PRINT((
" sid 0x%04x deleted as not available", s_ptr->serv_id));
4189 (dynamic_update_head != NULL))
4196 if (s_ptr->unavailable)
4203 DynamicUpdateDeleteService(t_ptr, s_ptr, TRUE);
4208 if (current_service_rec[path] != s_ptr)
4212 AP_SI_PRINT((
" sid 0x%04x deleted", s_ptr->serv_id));
4214 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_DELETED,
4215 &s_ptr,
sizeof(s_ptr));
4224 AP_SI_PRINT((
" sid 0x%04x needs to be deleted", s_ptr->serv_id));
4226 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_DELETE_SERVICE,
4227 &s_ptr,
sizeof(s_ptr));
4234 if ((current_service_rec[path] != NULL) && (t_ptr == current_transport_rec[path]))
4236 if (current_service_rec[path]->unavailable)
4239 AP_SI_PRINT((
" sid 0x%04x report not running", current_service_rec[path]->serv_id));
4241 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_NOT_RUNNING,
4242 &path,
sizeof(U8BIT));
4252 ApplyDynamicUpdates(path);
4254 if (update_sdt_func != NULL)
4257 (*update_sdt_func)(path, sdt_table, table_rec);
4260 #ifdef INTEGRATE_HBBTV 4261 if ((mode != DB_ACCESS_SEARCH) && retval)
4273 FUNCTION_FINISH(ProcessSdtTable);
4300 FUNCTION_START(ProcessPatTable);
4307 path = table_rec->path;
4311 if (pat_table != NULL)
4314 if (pmt_list[path] == NULL)
4316 AP_SI_PRINT((
"PAT Table: tran_id 0x%04x v%d %d services",
4317 pat_table->tran_id, pat_table->version, pat_table->num_services));
4321 if (current_transport_rec[path]->pat_version != pat_table->version)
4323 AP_SI_PRINT((
"PAT Table: tran_id 0x%04x v%d %d services - new",
4324 pat_table->tran_id, pat_table->version, pat_table->num_services));
4328 AP_SI_PRINT((
"PAT Table: tran_id 0x%04x v%d %d services - same",
4329 pat_table->tran_id, pat_table->version, pat_table->num_services));
4334 if ((pat_rcvd_on_this_trnsprt[path] == FALSE) || (current_transport_rec[path]->pat_version != pat_table->version))
4337 current_transport_rec[path]->pat_version = pat_table->version;
4338 pat_rcvd_on_this_trnsprt[path] = TRUE;
4341 if (pmt_list[path] != NULL)
4347 num_pmt_list_entries[path] = pat_table->num_services;
4349 pmt_list_id[path] = 0;
4350 if (pmt_list[path] != NULL)
4352 pat_entry = pat_table->service_list;
4353 for (i = 0; ((i < num_pmt_list_entries[path]) && (pat_entry != NULL)); i++)
4356 AP_SI_PRINT((
" sid 0x%04x pmt 0x%04x", pat_entry->serv_id, pat_entry->pmt_pid));
4358 pmt_list[path][i].serv_id = pat_entry->serv_id;
4361 pmt_list[path][i].pid = pat_entry->pmt_pid;
4363 pat_entry = pat_entry->next;
4366 num_pmt_list_entries[path] = i;
4375 while (s_ptr != NULL)
4378 for (i = 0; i < num_pmt_list_entries[path]; i++)
4380 if (pmt_list[path][i].serv_id == s_ptr->serv_id)
4389 if (s_ptr->not_running == FALSE)
4392 AP_SI_PRINT((
" sid 0x%04x marked not running", s_ptr->serv_id));
4396 s_ptr->not_running = TRUE;
4398 s_ptr->stream_list = NULL;
4399 s_ptr->video_pid = 0;
4400 s_ptr->audio_pid = 0;
4401 s_ptr->subtitle_pid = 0;
4405 pmt_ver_rec = current_transport_rec[path]->pmt_version_list;
4406 prev_ver_rec = NULL;
4407 while (pmt_ver_rec != NULL)
4409 if (pmt_ver_rec->serv_id == s_ptr->serv_id)
4413 if (prev_ver_rec == NULL)
4415 current_transport_rec[path]->pmt_version_list = pmt_ver_rec->next;
4419 prev_ver_rec->next = pmt_ver_rec->next;
4427 prev_ver_rec = pmt_ver_rec;
4428 pmt_ver_rec = pmt_ver_rec->next;
4433 if (s_ptr == current_service_rec[path])
4436 AP_SI_PRINT((
" sid 0x%04x report not running", s_ptr->serv_id));
4438 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_NOT_RUNNING,
4439 &path,
sizeof(U8BIT));
4459 FUNCTION_FINISH(ProcessPatTable);
4482 FUNCTION_START(ProcessPatTablePlayback);
4489 path = table_rec->path;
4493 if (pat_table != NULL)
4495 if ((pat_rcvd_on_this_trnsprt[path] == FALSE) || (last_playback_pat_version != pat_table->version))
4498 pat_rcvd_on_this_trnsprt[path] = TRUE;
4499 last_playback_pat_version = pat_table->version;
4501 pat_entry = pat_table->service_list;
4502 for (i = 0; ((i < pat_table->num_services) && (pat_entry != NULL)); i++)
4504 if ((pat_entry->serv_id == current_service_rec[path]->serv_id) ||
4505 (current_service_rec[path]->serv_id == 0))
4507 #ifdef DEBUG_SI_PAT_PLAYBACK 4508 AP_SI_PRINT((
"ProcessPatTablePlayback: path=%u found sid 0x%04x pmt 0x%04x", path, pat_entry->serv_id, pat_entry->pmt_pid));
4511 pmt_filter_pid[path] = pat_entry->pmt_pid;
4515 if (current_service_rec[path]->serv_id == 0)
4517 current_service_rec[path]->serv_id = pat_entry->serv_id;
4522 pat_entry = pat_entry->next;
4529 FUNCTION_FINISH(ProcessPatTablePlayback);
4552 static BOOLEAN ProcessPmtTable(
SI_TABLE_RECORD *table_rec, BOOLEAN ignore_version, BOOLEAN report_pmt,
4553 U16BIT *service_id, E_DB_ACCESS_MODE mode)
4556 BOOLEAN pmt_ver_changed;
4559 BOOLEAN service_updated;
4560 BOOLEAN pmt_received = FALSE;
4561 #ifdef COMMON_INTERFACE 4566 FUNCTION_START(ProcessPmtTable);
4568 path = table_rec->path;
4573 if (mode == DB_ACCESS_PLAYBACK)
4575 if (last_playback_pmt_version != table_rec->version)
4577 pmt_ver_changed = TRUE;
4578 last_playback_pmt_version = table_rec->version;
4579 #ifdef DEBUG_SI_PMT_PLAYBACK 4580 AP_SI_PRINT((
"Playback, PMT table: serv_id 0x%04x v%d - update",
4581 table_rec->xtid, table_rec->version));
4586 pmt_ver_changed = FALSE;
4587 #ifdef DEBUG_SI_PMT_PLAYBACK 4588 if (ignore_version == TRUE)
4590 AP_SI_PRINT((
"Playback, PMT table: serv_id 0x%04x v%d - same",
4591 table_rec->xtid, table_rec->version));
4599 pmt_ver_changed = TRUE;
4600 pmt_ver_rec = current_transport_rec[path]->pmt_version_list;
4601 while (pmt_ver_rec != NULL)
4603 if (pmt_ver_rec->serv_id == table_rec->xtid)
4606 if (pmt_ver_rec->version != table_rec->version)
4608 pmt_ver_rec->version = table_rec->version;
4610 AP_SI_PRINT((
"PMT table: serv_id 0x%04x v%d - update",
4611 table_rec->xtid, table_rec->version));
4616 pmt_ver_changed = FALSE;
4618 if (ignore_version == TRUE)
4620 AP_SI_PRINT((
"PMT table: serv_id 0x%04x v%d - same",
4621 table_rec->xtid, table_rec->version));
4627 pmt_ver_rec = pmt_ver_rec->next;
4629 if (pmt_ver_rec == NULL)
4633 if (pmt_ver_rec != NULL)
4635 pmt_ver_rec->serv_id = table_rec->xtid;
4636 pmt_ver_rec->version = table_rec->version;
4637 pmt_ver_rec->next = current_transport_rec[path]->pmt_version_list;
4638 current_transport_rec[path]->pmt_version_list = pmt_ver_rec;
4640 AP_SI_PRINT((
"PMT table: serv_id 0x%04x v%d - new",
4641 table_rec->xtid, table_rec->version));
4647 if (service_id != NULL)
4649 *service_id = table_rec->xtid;
4652 service_updated = FALSE;
4654 if (mode == DB_ACCESS_PLAYBACK)
4656 s_ptr = current_service_rec[path];
4663 current_transport_rec[path]->orig_net_id, current_transport_rec[path]->tran_id,
4668 AP_SI_PRINT((
"PMT table, service = %p, ignore_version=%u, pmt_ver_changed=%u", s_ptr,
4669 ignore_version, pmt_ver_changed));
4676 pmt_received = s_ptr->pmt_received;
4680 if ((ignore_version == TRUE) || (pmt_ver_changed == TRUE))
4682 service_updated = InternalProcessPmtTable(path, s_ptr, table_rec,
4683 ((mode == DB_ACCESS_PLAYBACK) ? FALSE : TRUE), mode);
4688 if (update_pmt_func != NULL)
4691 (*update_pmt_func)(path, NULL, table_rec, NULL);
4699 (s_ptr == current_service_rec[path]) && !pmt_received)
4702 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_CHANGED, &s_ptr,
sizeof(
void *));
4706 if (report_pmt == TRUE)
4708 if (report_pmt_allowed[path] == TRUE)
4711 AP_SI_PRINT((
"Report pmt: serv_id 0x%04x v%d", table_rec->xtid, table_rec->version));
4714 #ifdef COMMON_INTERFACE 4715 if (pmt_service_changed[path] &&
STB_DPIsOwnedBy(path, RES_OWNER_CIPLUS))
4721 if (table_rec->xtid == current_service_rec[path]->serv_id)
4723 ACI_TuneReply(path, *(U32BIT *)owner_data, CIP_TUNER_LOCKED);
4727 ACI_TuneReply(path, *(U32BIT *)owner_data, CIP_TUNER_SERVICE_NOT_FOUND);
4733 if ((current_service_rec[path] != NULL) &&
4734 (table_rec->xtid == current_service_rec[path]->serv_id) &&
4735 (table_rec->version != last_reported_pmt_version[path]))
4737 pmt_ver_changed = TRUE;
4738 last_reported_pmt_version[path] = table_rec->version;
4742 pmt_ver_changed = FALSE;
4747 #ifdef COMMON_INTERFACE 4748 if (table_rec->section_list != NULL)
4754 pmt_reported[path] = TRUE;
4755 pmt_service_changed[path] = FALSE;
4762 FUNCTION_FINISH(ProcessPmtTable);
4764 return(service_updated);
4777 BOOLEAN db_services, E_DB_ACCESS_MODE mode)
4789 BOOLEAN prev_not_running;
4790 BOOLEAN match_found;
4791 E_STB_DP_AUDIO_MODE audio_mode;
4792 ADB_STREAM_TYPE audio_type;
4793 ADB_STREAM_TYPE adesc_type;
4794 ADB_STREAM_TYPE video_type;
4798 BOOLEAN service_updated;
4802 #if defined(DEBUG_SI_PMT_AUDIO) || defined(DEBUG_SI_PMT_VIDEO) 4805 #ifdef COMMON_INTERFACE 4809 FUNCTION_START(InternalProcessPmtTable);
4811 service_updated = FALSE;
4814 if (pmt_table != NULL)
4818 while (s_ptr != NULL)
4820 if (s_ptr->pmt_data != NULL)
4823 s_ptr->pmt_data = NULL;
4824 s_ptr->pmt_data_len = 0;
4829 if (s_ptr->pmt_data != NULL)
4831 memcpy(s_ptr->pmt_data, &(table_rec->section_list->data_start),
4832 table_rec->section_list->data_len);
4833 s_ptr->pmt_data_len = table_rec->section_list->data_len;
4836 #ifdef COMMON_INTERFACE 4840 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_CI, EV_TYPE_CI_URI_UPDATED, &slot_id,
sizeof(slot_id));
4843 service_updated = TRUE;
4844 s_ptr->pmt_received = TRUE;
4848 video_pid = s_ptr->video_pid;
4849 audio_pid = s_ptr->audio_pid;
4850 video_type = s_ptr->video_type;
4851 audio_type = s_ptr->audio_type;
4862 old_stream_list = s_ptr->stream_list;
4864 s_ptr->stream_list = NULL;
4865 s_ptr->video_pid = 0;
4866 s_ptr->audio_pid = 0;
4867 s_ptr->subtitle_pid = 0;
4868 s_ptr->pcr_pid = pmt_table->pcr_pid;
4871 prev_not_running = s_ptr->not_running;
4872 s_ptr->not_running = FALSE;
4874 if (pmt_table->ca_desc_array == NULL)
4876 s_ptr->has_ca_descriptor = FALSE;
4880 s_ptr->has_ca_descriptor = TRUE;
4885 s_ptr->content_protection_level = pmt_table->content_protection_level;
4887 #ifdef INTEGRATE_HBBTV 4892 last_stream_rec_next_ptr = &(s_ptr->stream_list);
4893 pmt_entry = pmt_table->stream_list;
4894 while (pmt_entry != NULL)
4896 switch (pmt_entry->type)
4898 case SI_STREAM_TYPE_VIDEO1:
4899 case SI_STREAM_TYPE_VIDEO2:
4900 case SI_STREAM_TYPE_H264:
4901 case SI_STREAM_TYPE_H265:
4905 if (stream_rec != NULL)
4909 CopyComponentTagArray(stream_rec, pmt_entry);
4910 stream_rec->pid = pmt_entry->pid;
4911 if (pmt_entry->type == SI_STREAM_TYPE_H264)
4913 stream_rec->type = ADB_H264_VIDEO_STREAM;
4915 else if (pmt_entry->type == SI_STREAM_TYPE_H265)
4917 stream_rec->type = ADB_H265_VIDEO_STREAM;
4921 stream_rec->type = ADB_VIDEO_STREAM;
4923 stream_rec->next = NULL;
4924 *last_stream_rec_next_ptr = stream_rec;
4925 last_stream_rec_next_ptr = &(stream_rec->next);
4927 #ifdef DEBUG_SI_PMT_VIDEO 4928 AP_SI_PRINT((
" video stream: pid 0x%04x", pmt_entry->pid));
4929 for (tag_count = 0; tag_count < pmt_entry->num_tag_entries; tag_count++)
4931 AP_SI_PRINT((
" tag: %x", pmt_entry->tag_array_ptr[tag_count]));
4938 case SI_STREAM_TYPE_AUDIO1:
4939 case SI_STREAM_TYPE_AUDIO2:
4940 case SI_STREAM_TYPE_AAC:
4941 case SI_STREAM_TYPE_HEAAC:
4943 if (pmt_entry->num_iso_lang_entries == 0)
4946 if (stream_rec != NULL)
4950 CopyComponentTagArray(stream_rec, pmt_entry);
4951 stream_rec->pid = pmt_entry->pid;
4952 if (pmt_entry->type == SI_STREAM_TYPE_AAC)
4954 if (pmt_entry->aac_descriptor != NULL)
4956 switch (pmt_entry->aac_descriptor->profile_level)
4962 stream_rec->type = ADB_HEAAC_AUDIO_STREAM;
4969 stream_rec->type = ADB_HEAACv2_AUDIO_STREAM;
4973 stream_rec->type = ADB_AAC_AUDIO_STREAM;
4977 if (pmt_entry->aac_descriptor->type_present)
4979 switch (pmt_entry->aac_descriptor->aac_type)
4982 stream_rec->data.audio.mode = AUDIO_MONO;
4986 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
4992 stream_rec->data.audio.mode = AUDIO_STEREO;
4999 stream_rec->data.audio.mode = AUDIO_STEREO;
5005 stream_rec->type = ADB_AAC_AUDIO_STREAM;
5006 stream_rec->data.audio.mode = AUDIO_STEREO;
5009 else if (pmt_entry->type == SI_STREAM_TYPE_HEAAC)
5011 if (pmt_entry->aac_descriptor != NULL)
5013 switch (pmt_entry->aac_descriptor->profile_level)
5019 stream_rec->type = ADB_HEAACv2_AUDIO_STREAM;
5023 stream_rec->type = ADB_HEAAC_AUDIO_STREAM;
5027 if (pmt_entry->aac_descriptor->type_present)
5029 switch (pmt_entry->aac_descriptor->aac_type)
5032 stream_rec->data.audio.mode = AUDIO_MONO;
5036 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5042 stream_rec->data.audio.mode = AUDIO_STEREO;
5049 stream_rec->data.audio.mode = AUDIO_STEREO;
5055 stream_rec->type = ADB_HEAAC_AUDIO_STREAM;
5056 stream_rec->data.audio.mode = AUDIO_STEREO;
5061 stream_rec->type = ADB_AUDIO_STREAM;
5062 stream_rec->data.audio.mode = AUDIO_UNDEF;
5064 stream_rec->data.audio.lang_code = ACFG_UNDEFINED_DB_LANG_CODE;
5065 stream_rec->data.audio.type = ADB_AUDIO_TYPE_UNDEFINED;
5067 stream_rec->next = NULL;
5068 *last_stream_rec_next_ptr = stream_rec;
5069 last_stream_rec_next_ptr = &(stream_rec->next);
5071 #ifdef DEBUG_SI_PMT_AUDIO 5072 AP_SI_PRINT((
" %s audio stream: pid 0x%04x, type %u, mode %u",
5073 ((stream_rec->type == ADB_HEAACv2_AUDIO_STREAM) ?
"HE-AACv2" :
5074 ((stream_rec->type == ADB_HEAAC_AUDIO_STREAM) ?
"HE-AACv1" :
5075 ((stream_rec->type == ADB_AAC_AUDIO_STREAM) ?
"AAC" :
"MPEG"))),
5077 stream_rec->data.audio.type,
5078 stream_rec->data.audio.mode));
5079 for (tag_count = 0; tag_count < pmt_entry->num_tag_entries; tag_count++)
5081 AP_SI_PRINT((
" tag: %x", pmt_entry->tag_array_ptr[tag_count]));
5090 for (i = 0; i < pmt_entry->num_iso_lang_entries; i++)
5093 if (stream_rec != NULL)
5097 CopyComponentTagArray(stream_rec, pmt_entry);
5098 stream_rec->pid = pmt_entry->pid;
5099 if (pmt_entry->type == SI_STREAM_TYPE_AAC)
5101 if (pmt_entry->aac_descriptor != NULL)
5103 switch (pmt_entry->aac_descriptor->profile_level)
5109 stream_rec->type = ADB_HEAAC_AUDIO_STREAM;
5116 stream_rec->type = ADB_HEAACv2_AUDIO_STREAM;
5120 stream_rec->type = ADB_AAC_AUDIO_STREAM;
5124 if (pmt_entry->aac_descriptor->type_present)
5126 switch (pmt_entry->aac_descriptor->aac_type)
5129 stream_rec->data.audio.mode = AUDIO_MONO;
5133 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5139 stream_rec->data.audio.mode = AUDIO_STEREO;
5146 stream_rec->data.audio.mode = AUDIO_STEREO;
5152 stream_rec->type = ADB_AAC_AUDIO_STREAM;
5153 stream_rec->data.audio.mode = AUDIO_STEREO;
5156 else if (pmt_entry->type == SI_STREAM_TYPE_HEAAC)
5158 if (pmt_entry->aac_descriptor != NULL)
5160 switch (pmt_entry->aac_descriptor->profile_level)
5166 stream_rec->type = ADB_HEAACv2_AUDIO_STREAM;
5170 stream_rec->type = ADB_HEAAC_AUDIO_STREAM;
5174 if (pmt_entry->aac_descriptor->type_present)
5176 switch (pmt_entry->aac_descriptor->aac_type)
5179 stream_rec->data.audio.mode = AUDIO_MONO;
5183 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5189 stream_rec->data.audio.mode = AUDIO_STEREO;
5196 stream_rec->data.audio.mode = AUDIO_STEREO;
5202 stream_rec->type = ADB_HEAAC_AUDIO_STREAM;
5203 stream_rec->data.audio.mode = AUDIO_STEREO;
5208 stream_rec->type = ADB_AUDIO_STREAM;
5209 stream_rec->data.audio.mode = AUDIO_UNDEF;
5211 stream_rec->data.audio.lang_code =
5212 pmt_entry->iso_lang_desc_array[i].lang_code;
5213 stream_rec->data.audio.type =
5214 pmt_entry->iso_lang_desc_array[i].audio_type;
5216 stream_rec->next = NULL;
5217 *last_stream_rec_next_ptr = stream_rec;
5218 last_stream_rec_next_ptr = &(stream_rec->next);
5220 #ifdef DEBUG_SI_PMT_AUDIO 5221 AP_SI_PRINT((
" %s audio stream: pid 0x%04x, lang %c%c%c, type %u, mode %u",
5222 ((stream_rec->type == ADB_HEAACv2_AUDIO_STREAM) ?
"HE-AACv2" :
5223 ((stream_rec->type == ADB_HEAAC_AUDIO_STREAM) ?
"HE-AACv1" :
5224 ((stream_rec->type == ADB_AAC_AUDIO_STREAM) ?
"AAC" :
"MPEG"))),
5226 ((stream_rec->data.audio.lang_code >> 16) & 0xff),
5227 ((stream_rec->data.audio.lang_code >> 8) & 0xff),
5228 (stream_rec->data.audio.lang_code & 0xff),
5229 stream_rec->data.audio.type,
5230 stream_rec->data.audio.mode));
5231 for (tag_count = 0; tag_count < pmt_entry->num_tag_entries; tag_count++)
5233 AP_SI_PRINT((
" tag: %x", pmt_entry->tag_array_ptr[tag_count]));
5242 case SI_STREAM_TYPE_PES_PKT:
5244 if ((pmt_entry->ac3_descriptor != NULL) &&
5245 ((pmt_entry->ac3_descriptor->dtag == AC3_DESC_DTAG) ||
5246 (pmt_entry->ac3_descriptor->dtag == EAC3_DESC_DTAG)))
5248 if (pmt_entry->num_iso_lang_entries == 0)
5251 if (stream_rec != NULL)
5256 CopyComponentTagArray(stream_rec, pmt_entry);
5258 stream_rec->pid = pmt_entry->pid;
5259 stream_rec->data.audio.type = ADB_AUDIO_TYPE_UNDEFINED;
5261 if (pmt_entry->ac3_descriptor->dtag == AC3_DESC_DTAG)
5263 stream_rec->type = ADB_AC3_AUDIO_STREAM;
5265 if (pmt_entry->ac3_descriptor->component_type_flag)
5267 if ((pmt_entry->ac3_descriptor->component_type & 0x40) == 0)
5270 stream_rec->data.audio.type = ADB_AUDIO_TYPE_CLEAN_EFFECTS;
5274 switch ((pmt_entry->ac3_descriptor->component_type >> 3) & 0x07)
5277 stream_rec->data.audio.type = ADB_AUDIO_TYPE_FOR_VISUALLY_IMPAIRED;
5280 stream_rec->data.audio.type = ADB_AUDIO_TYPE_FOR_HEARING_IMPAIRED;
5288 switch(pmt_entry->ac3_descriptor->component_type & 0x07)
5292 stream_rec->data.audio.mode = AUDIO_MONO;
5296 stream_rec->data.audio.mode = AUDIO_STEREO;
5299 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5302 stream_rec->data.audio.mode = AUDIO_STEREO;
5309 stream_rec->data.audio.mode = AUDIO_STEREO;
5314 stream_rec->type = ADB_EAC3_AUDIO_STREAM;
5316 if (pmt_entry->ac3_descriptor->component_type_flag)
5318 if ((pmt_entry->ac3_descriptor->component_type & 0x40) == 0)
5321 stream_rec->data.audio.type = ADB_AUDIO_TYPE_CLEAN_EFFECTS;
5325 switch ((pmt_entry->ac3_descriptor->component_type >> 3) & 0x07)
5328 stream_rec->data.audio.type = ADB_AUDIO_TYPE_FOR_VISUALLY_IMPAIRED;
5331 stream_rec->data.audio.type = ADB_AUDIO_TYPE_FOR_HEARING_IMPAIRED;
5339 switch(pmt_entry->ac3_descriptor->component_type & 0x07)
5343 stream_rec->data.audio.mode = AUDIO_MONO;
5347 stream_rec->data.audio.mode = AUDIO_STEREO;
5351 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5354 stream_rec->data.audio.mode = AUDIO_STEREO;
5361 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5365 stream_rec->data.audio.lang_code = ACFG_UNDEFINED_DB_LANG_CODE;
5367 stream_rec->next = NULL;
5368 *last_stream_rec_next_ptr = stream_rec;
5369 last_stream_rec_next_ptr = &(stream_rec->next);
5371 #ifdef DEBUG_SI_PMT_AUDIO 5372 AP_SI_PRINT((
" %s audio stream: pid 0x%04x, type %u, mode %u",
5373 ((stream_rec->type == ADB_EAC3_AUDIO_STREAM) ?
"E-AC3" :
"AC3"),
5375 stream_rec->data.audio.type,
5376 stream_rec->data.audio.mode));
5377 for (tag_count = 0; tag_count < pmt_entry->num_tag_entries; tag_count++)
5379 AP_SI_PRINT((
" tag: %x", pmt_entry->tag_array_ptr[tag_count]));
5388 for (i = 0; i < pmt_entry->num_iso_lang_entries; i++)
5391 if (stream_rec != NULL)
5396 CopyComponentTagArray(stream_rec, pmt_entry);
5398 stream_rec->pid = pmt_entry->pid;
5400 if (pmt_entry->ac3_descriptor->dtag == AC3_DESC_DTAG)
5402 stream_rec->type = ADB_AC3_AUDIO_STREAM;
5404 if (pmt_entry->ac3_descriptor->component_type_flag)
5406 switch(pmt_entry->ac3_descriptor->component_type & 0x07)
5410 stream_rec->data.audio.mode = AUDIO_MONO;
5414 stream_rec->data.audio.mode = AUDIO_STEREO;
5417 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5420 stream_rec->data.audio.mode = AUDIO_STEREO;
5427 stream_rec->data.audio.mode = AUDIO_STEREO;
5432 stream_rec->type = ADB_EAC3_AUDIO_STREAM;
5434 if (pmt_entry->ac3_descriptor->component_type_flag)
5436 switch(pmt_entry->ac3_descriptor->component_type & 0x07)
5440 stream_rec->data.audio.mode = AUDIO_MONO;
5444 stream_rec->data.audio.mode = AUDIO_STEREO;
5448 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5451 stream_rec->data.audio.mode = AUDIO_STEREO;
5458 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5462 stream_rec->data.audio.lang_code =
5463 pmt_entry->iso_lang_desc_array[i].lang_code;
5464 stream_rec->data.audio.type =
5465 pmt_entry->iso_lang_desc_array[i].audio_type;
5467 stream_rec->next = NULL;
5468 *last_stream_rec_next_ptr = stream_rec;
5469 last_stream_rec_next_ptr = &(stream_rec->next);
5471 #ifdef DEBUG_SI_PMT_AUDIO 5472 AP_SI_PRINT((
" %s audio stream: pid 0x%04x, lang %c%c%c, type %u, mode %u",
5473 ((stream_rec->type == ADB_EAC3_AUDIO_STREAM) ?
"E-AC3" :
"AC3"),
5475 ((stream_rec->data.audio.lang_code >> 16) & 0xff),
5476 ((stream_rec->data.audio.lang_code >> 8) & 0xff),
5477 (stream_rec->data.audio.lang_code & 0xff),
5478 stream_rec->data.audio.type,
5479 stream_rec->data.audio.mode));
5480 for (tag_count = 0; tag_count < pmt_entry->num_tag_entries; tag_count++)
5482 AP_SI_PRINT((
" tag: %x", pmt_entry->tag_array_ptr[tag_count]));
5491 if (pmt_entry->subtitle_desc_array != NULL)
5494 AP_SI_PRINT((
"PMT: %d subtitle entries, PID = %d", pmt_entry->num_subtitle_entries,
5500 for (i = 0; i < pmt_entry->num_subtitle_entries; i++)
5503 if (stream_rec != NULL)
5507 CopyComponentTagArray(stream_rec, pmt_entry);
5508 stream_rec->pid = pmt_entry->pid;
5509 stream_rec->type = ADB_SUBTITLE_STREAM;
5510 stream_rec->data.subtitle.lang_code =
5511 pmt_entry->subtitle_desc_array[i].lang_code;
5512 stream_rec->data.subtitle.type =
5513 pmt_entry->subtitle_desc_array[i].type;
5514 stream_rec->data.subtitle.composition_page =
5515 pmt_entry->subtitle_desc_array[i].composition_page;
5516 stream_rec->data.subtitle.ancillary_page =
5517 pmt_entry->subtitle_desc_array[i].ancillary_page;
5519 stream_rec->next = NULL;
5520 *last_stream_rec_next_ptr = stream_rec;
5521 last_stream_rec_next_ptr = &(stream_rec->next);
5528 if (pmt_entry->teletext_desc_array != NULL)
5531 AP_SI_PRINT((
"PMT: %d teletext entries, PID=%d", pmt_entry->num_teletext_entries,
5537 for (i = 0; i < pmt_entry->num_teletext_entries; i++)
5540 AP_SI_PRINT((
" lang_code=0x%x, type=%d, magazine=%d, page=%d",
5541 pmt_entry->teletext_desc_array[i].lang_code,
5542 pmt_entry->teletext_desc_array[i].type,
5543 pmt_entry->teletext_desc_array[i].magazine,
5544 pmt_entry->teletext_desc_array[i].page));
5548 if (stream_rec != NULL)
5552 CopyComponentTagArray(stream_rec, pmt_entry);
5553 stream_rec->pid = pmt_entry->pid;
5554 stream_rec->type = ADB_TTEXT_STREAM;
5555 stream_rec->data.ttext.lang_code =
5556 pmt_entry->teletext_desc_array[i].lang_code;
5557 stream_rec->data.ttext.type =
5558 pmt_entry->teletext_desc_array[i].type;
5559 stream_rec->data.ttext.magazine =
5560 pmt_entry->teletext_desc_array[i].magazine;
5561 stream_rec->data.ttext.page =
5562 pmt_entry->teletext_desc_array[i].page;
5564 stream_rec->next = NULL;
5565 *last_stream_rec_next_ptr = stream_rec;
5566 last_stream_rec_next_ptr = &(stream_rec->next);
5573 AP_SI_PRINT((
"PMT: data stream, PID=%d", pmt_entry->pid));
5578 if (stream_rec != NULL)
5582 CopyComponentTagArray(stream_rec, pmt_entry);
5583 stream_rec->pid = pmt_entry->pid;
5584 stream_rec->type = ADB_DATA_STREAM;
5586 stream_rec->next = NULL;
5587 *last_stream_rec_next_ptr = stream_rec;
5588 last_stream_rec_next_ptr = &(stream_rec->next);
5596 case SI_STREAM_TYPE_AC3:
5598 if (pmt_entry->num_iso_lang_entries == 0)
5601 if (stream_rec != NULL)
5605 CopyComponentTagArray(stream_rec, pmt_entry);
5606 stream_rec->pid = pmt_entry->pid;
5607 stream_rec->type = ADB_AC3_AUDIO_STREAM;
5608 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5610 stream_rec->data.audio.lang_code = ACFG_UNDEFINED_DB_LANG_CODE;
5611 stream_rec->data.audio.type = ADB_AUDIO_TYPE_UNDEFINED;
5613 stream_rec->next = NULL;
5614 *last_stream_rec_next_ptr = stream_rec;
5615 last_stream_rec_next_ptr = &(stream_rec->next);
5617 #ifdef DEBUG_SI_PMT_AUDIO 5618 AP_SI_PRINT((
" AC3 audio stream: pid 0x%04x, type %u, mode %u",
5620 stream_rec->data.audio.type,
5621 stream_rec->data.audio.mode));
5622 for (tag_count = 0; tag_count < pmt_entry->num_tag_entries; tag_count++)
5624 AP_SI_PRINT((
" tag: %x", pmt_entry->tag_array_ptr[tag_count]));
5633 for (i = 0; i < pmt_entry->num_iso_lang_entries; i++)
5636 if (stream_rec != NULL)
5640 CopyComponentTagArray(stream_rec, pmt_entry);
5641 stream_rec->pid = pmt_entry->pid;
5642 stream_rec->type = ADB_AC3_AUDIO_STREAM;
5643 stream_rec->data.audio.mode = AUDIO_MULTICHANNEL;
5645 stream_rec->data.audio.lang_code =
5646 pmt_entry->iso_lang_desc_array[i].lang_code;
5647 stream_rec->data.audio.type =
5648 pmt_entry->iso_lang_desc_array[i].audio_type;
5650 stream_rec->next = NULL;
5651 *last_stream_rec_next_ptr = stream_rec;
5652 last_stream_rec_next_ptr = &(stream_rec->next);
5654 #ifdef DEBUG_SI_PMT_AUDIO 5655 AP_SI_PRINT((
" AC3 audio stream: pid 0x%04x, lang %c%c%c, type %u, mode %u",
5657 ((stream_rec->data.audio.lang_code >> 16) & 0xff),
5658 ((stream_rec->data.audio.lang_code >> 8) & 0xff),
5659 (stream_rec->data.audio.lang_code & 0xff),
5660 stream_rec->data.audio.type,
5661 stream_rec->data.audio.mode));
5662 for (tag_count = 0; tag_count < pmt_entry->num_tag_entries; tag_count++)
5664 AP_SI_PRINT((
" tag: %x", pmt_entry->tag_array_ptr[tag_count]));
5673 case SI_STREAM_TYPE_PRIVATE:
5675 if (pmt_entry->has_rct)
5678 s_ptr->rct_pid = pmt_entry->pid;
5684 #ifdef INTEGRATE_HBBTV 5686 AP_SI_PRINT((
"PMT: has AIT: %s, num application signalling descriptors %d",
5687 pmt_entry->has_ait ?
"TRUE" :
"FALSE", pmt_entry->num_app_sig_entries));
5689 if (pmt_entry->has_ait)
5696 if (s_ptr->ait_pid == 0)
5699 s_ptr->ait_pid = pmt_entry->pid;
5701 else if (pmt_entry->num_app_sig_entries > 0)
5703 for (i = 0; i < pmt_entry->num_app_sig_entries; i++)
5706 AP_SI_PRINT((
"PMT: app_type=0x%x", pmt_entry->app_sig_desc_array[i].app_type));
5708 if (pmt_entry->app_sig_desc_array[i].app_type == 0x0010)
5710 s_ptr->ait_pid = pmt_entry->pid;
5718 AP_SI_PRINT((
"PMT: num application signalling descriptors %d but app_sig_desc_array is NULL ",
5719 pmt_entry->num_app_sig_entries));
5731 if (stream_rec != NULL)
5735 CopyComponentTagArray(stream_rec, pmt_entry);
5736 stream_rec->pid = pmt_entry->pid;
5737 stream_rec->type = ADB_DATA_STREAM;
5739 stream_rec->next = NULL;
5740 *last_stream_rec_next_ptr = stream_rec;
5741 last_stream_rec_next_ptr = &(stream_rec->next);
5747 if (stream_rec != NULL)
5749 if (pmt_entry->ca_desc_array == NULL)
5751 stream_rec->has_ca_descriptor = FALSE;
5755 stream_rec->has_ca_descriptor = TRUE;
5759 pmt_entry = pmt_entry->next;
5763 stream_rec = s_ptr->stream_list;
5764 while (stream_rec != NULL)
5766 if (((stream_rec->type == ADB_AUDIO_STREAM) ||
5767 (stream_rec->type == ADB_AAC_AUDIO_STREAM) ||
5768 (stream_rec->type == ADB_HEAAC_AUDIO_STREAM) ||
5769 (stream_rec->type == ADB_AC3_AUDIO_STREAM) ||
5770 (stream_rec->type == ADB_EAC3_AUDIO_STREAM)) &&
5771 (stream_rec->pid != 0) && (stream_rec->data.audio.mode == AUDIO_UNDEF))
5773 if (stream_rec->data.audio.type == ADB_AUDIO_TYPE_FOR_VISUALLY_IMPAIRED)
5775 stream_rec->data.audio.mode = AUDIO_MONO;
5780 srec = stream_rec->next;
5781 match_found = FALSE;
5783 while ((srec != NULL) && !match_found)
5785 if ((srec->type == stream_rec->type) && (srec->pid == stream_rec->pid) &&
5786 (srec->data.audio.type != ADB_AUDIO_TYPE_FOR_VISUALLY_IMPAIRED))
5792 if (stream_rec->data.audio.lang_code == srec->data.audio.lang_code)
5794 if (stream_rec->data.audio.type == srec->data.audio.type)
5798 stream_rec->data.audio.mode = AUDIO_STEREO;
5799 srec->data.audio.mode = AUDIO_STEREO;
5801 #ifdef DEBUG_SI_PMT_AUDIO 5802 AP_SI_PRINT((
" Stereo left/right audio stream: pid 0x%04x, lang %c%c%c, type %u, mode %u",
5804 ((stream_rec->data.audio.lang_code >> 16) & 0xff),
5805 ((stream_rec->data.audio.lang_code >> 8) & 0xff),
5806 (stream_rec->data.audio.lang_code & 0xff),
5807 stream_rec->data.audio.type,
5808 stream_rec->data.audio.mode));
5814 stream_rec->data.audio.mode = AUDIO_LEFT;
5815 srec->data.audio.mode = AUDIO_RIGHT;
5817 #ifdef DEBUG_SI_PMT_AUDIO 5818 AP_SI_PRINT((
" Left/right audio stream with diff types: pid 0x%04x, lang %c%c%c, type %u, mode %u",
5820 ((stream_rec->data.audio.lang_code >> 16) & 0xff),
5821 ((stream_rec->data.audio.lang_code >> 8) & 0xff),
5822 (stream_rec->data.audio.lang_code & 0xff),
5823 stream_rec->data.audio.type,
5824 stream_rec->data.audio.mode));
5831 stream_rec->data.audio.mode = AUDIO_LEFT;
5832 srec->data.audio.mode = AUDIO_RIGHT;
5834 #ifdef DEBUG_SI_PMT_AUDIO 5835 AP_SI_PRINT((
" Left/right audio stream with diff langs: pid 0x%04x, lang %c%c%c, type %u, mode %u",
5837 ((stream_rec->data.audio.lang_code >> 16) & 0xff),
5838 ((stream_rec->data.audio.lang_code >> 8) & 0xff),
5839 (stream_rec->data.audio.lang_code & 0xff),
5840 stream_rec->data.audio.type,
5841 stream_rec->data.audio.mode));
5852 stream_rec->data.audio.mode = AUDIO_LEFT;
5857 stream_rec = stream_rec->next;
5862 if ((HaveStreamsChanged(old_stream_list, s_ptr->stream_list) == TRUE) && (mode != DB_ACCESS_SEARCH))
5865 AP_SI_PRINT((
"PMT: streams changed for service %p (id=0x%04x)", s_ptr, s_ptr->serv_id));
5867 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_STREAMS_CHANGED,
5868 &s_ptr,
sizeof(s_ptr));
5879 &(s_ptr->subtitle_apage));
5882 &(s_ptr->ttext_page));
5888 if (((video_pid != s_ptr->video_pid) || prev_not_running) && (mode != DB_ACCESS_SEARCH))
5891 AP_SI_PRINT((
"PMT: report video PID update for service %p (id=0x%04x)", s_ptr, s_ptr->serv_id));
5893 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_VIDEO_PID_UPDATE,
5894 &s_ptr,
sizeof(s_ptr));
5897 if ((mode != DB_ACCESS_SEARCH) &&
5898 ((audio_pid != s_ptr->audio_pid) || prev_not_running ||
5901 #ifdef DEBUG_SI_PMT_AUDIO 5902 AP_SI_PRINT((
"PMT: report audio PID update for service %p (id=0x%04x) pid=%x", s_ptr, s_ptr->serv_id,s_ptr->audio_pid));
5904 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_AUDIO_PID_UPDATE,
5905 &s_ptr,
sizeof(s_ptr));
5909 if ((video_type != s_ptr->video_type) && (mode != DB_ACCESS_SEARCH))
5912 AP_SI_PRINT((
"PMT: report video codec changed for service %p (id=0x%04x)", s_ptr, s_ptr->serv_id));
5915 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_VIDEO_CODEC_CHANGED,
5916 &s_ptr,
sizeof(s_ptr));
5920 if ((audio_type != s_ptr->audio_type) && (mode != DB_ACCESS_SEARCH))
5923 AP_SI_PRINT((
"PMT: report audio codec changed for service %p (id=0x%04x)", s_ptr, s_ptr->serv_id));
5926 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_AUDIO_CODEC_CHANGED,
5927 &s_ptr,
sizeof(s_ptr));
5930 if (s_ptr == current_service_rec[path])
5935 if (((subt_pid != s_ptr->subtitle_pid) ||
5936 (subt_cpage != s_ptr->subtitle_cpage) ||
5937 (subt_apage != s_ptr->subtitle_apage) ||
5938 (ttxt_pid != s_ptr->ttext_pid) ||
5939 (ttxt_mag != s_ptr->ttext_mag) ||
5940 (ttxt_page != s_ptr->ttext_page)) &&
5941 (mode != DB_ACCESS_SEARCH))
5944 AP_SI_PRINT((
"PMT: report subtitle update for service %p (id=0x%04x)", s_ptr, s_ptr->serv_id));
5946 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_SUBTITLE_UPDATE,
5947 &s_ptr,
sizeof(s_ptr));
5952 if (update_pmt_func != NULL)
5955 (*update_pmt_func)(path, pmt_table, table_rec, s_ptr);
5962 current_transport_rec[path]->orig_net_id, current_transport_rec[path]->tran_id,
5975 FUNCTION_FINISH(InternalProcessPmtTable);
5977 return(service_updated);
5989 FUNCTION_START(CopyComponentTagArray);
5991 if (pmt_entry->tag_array_ptr != NULL)
5994 if (stream_rec->tag_array != NULL)
5996 for (i = 0; i < pmt_entry->num_tag_entries; i++)
5998 stream_rec->tag_array[i] = pmt_entry->tag_array_ptr[i];
6000 stream_rec->num_tags = pmt_entry->num_tag_entries;
6004 FUNCTION_FINISH(CopyComponentTagArray);
6019 FUNCTION_START(HaveStreamsChanged);
6031 while ((srec1 != NULL) && !changed)
6034 while ((srec2 != NULL) && (srec2->pid != srec1->pid))
6036 srec2 = srec2->next;
6045 srec1 = srec1->next;
6049 FUNCTION_FINISH(HaveStreamsChanged);
6065 static BOOLEAN ProcessNitTable(
SI_TABLE_RECORD *table_rec, E_DB_ACCESS_MODE mode, BOOLEAN report_nit,
6066 BOOLEAN transport_changed)
6083 BOOLEAN restart_sdts;
6086 FUNCTION_START(ProcessNitTable);
6088 restart_sdts = FALSE;
6090 path = table_rec->path;
6093 if (nit_table != NULL)
6096 AP_SI_PRINT((
"NIT Table: net_id 0x%04x v%d",
6097 nit_table->net_id, nit_table->version));
6109 if (n_ptr->profile_type == ADB_PROFILE_TYPE_CIPLUS)
6112 while (n_ptr != NULL)
6115 if ((n_ptr != NULL) && (n_ptr->net_id == nit_table->net_id) &&
6116 (n_ptr->satellite == sat_ptr) && (n_ptr->profile_type != ADB_PROFILE_TYPE_CIPLUS))
6126 if (n_ptr->nit_version != nit_table->version)
6129 n_ptr->nit_version = nit_table->version;
6131 if (mode != DB_ACCESS_SEARCH)
6133 n_ptr->nit_version_changed = TRUE;
6141 n_ptr->nit_version_changed = FALSE;
6146 if (mode == DB_ACCESS_SEARCH)
6157 current_network_rec[path] = n_ptr;
6159 if (current_transport_rec[path]->network != n_ptr)
6162 current_transport_rec[path]->network = n_ptr;
6168 n_ptr->nit_version = nit_table->version;
6172 n_ptr->nit_version_changed = FALSE;
6174 if (n_ptr->satellite != sat_ptr)
6176 if ((n_ptr->satellite = sat_ptr) != NULL)
6191 n_ptr->target_region_name_list = nit_table->target_region_name_list;
6192 nit_table->target_region_name_list = NULL;
6194 n_ptr->target_region_list = nit_table->target_region_list;
6195 nit_table->target_region_list = NULL;
6199 linkage_desc_ptr = nit_table->linkage_desc_list;
6201 while (linkage_desc_ptr != NULL)
6203 if ((linkage_desc_ptr->link_type == DVB_DVBH1_LINKAGE_TYPE) ||
6204 (linkage_desc_ptr->link_type == DVB_DVBH2_LINKAGE_TYPE))
6207 AP_SI_PRINT((
" linkage_type=0x%x (DVB-H) onid=0x%x tran_id=0x%x", linkage_desc_ptr->link_type,
6208 linkage_desc_ptr->orig_net_id, linkage_desc_ptr->tran_id));
6212 linkage_desc_ptr->orig_net_id, linkage_desc_ptr->tran_id, ADB_INVALID_DVB_ID);
6213 while (s_ptr != NULL)
6216 linkage_desc_ptr->orig_net_id, linkage_desc_ptr->tran_id, ADB_INVALID_DVB_ID);
6218 AP_SI_PRINT((
" deleting non DVB-T/C/S sid=0x%x", s_ptr->serv_id));
6221 if ((s_ptr->transport == NULL) ||
6222 (s_ptr->transport->network == NULL) ||
6223 (s_ptr->transport->network->profile_type != ADB_PROFILE_TYPE_CIPLUS))
6230 linkage_desc_ptr = linkage_desc_ptr->next;
6234 nit_entry = nit_table->transport_list;
6235 while (nit_entry != NULL)
6238 if ((nit_entry->tran_id == current_transport_rec[path]->tran_id) &&
6239 ((current_transport_rec[path]->network == NULL) ||
6240 current_transport_rec[path]->network->profile_type != ADB_PROFILE_TYPE_CIPLUS))
6242 if (current_transport_rec[path]->orig_net_id != nit_entry->orig_net_id)
6244 current_transport_rec[path]->orig_net_id = nit_entry->orig_net_id;
6246 current_transport_rec[path]->orig_net_id);
6250 if (nit_entry->nordig_lcn_desc_array != NULL)
6254 while (s_ptr != NULL)
6256 if (s_ptr->serv_lcn != 0)
6258 s_ptr->unavailable = TRUE;
6263 for (j = 0; j < nit_entry->num_nordig_lcn_entries; j++)
6265 for (i = 0; i < nit_entry->nordig_lcn_desc_array[j].num_services; i++)
6268 current_transport_rec[path]);
6272 reqd_lcn = nit_entry->nordig_lcn_desc_array[j].serv_array[i].serv_lcn;
6277 s_ptr->hidden = !nit_entry->nordig_lcn_desc_array[j].serv_array[i].visible;
6280 s_ptr->selectable = TRUE;
6281 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_SELECTABLE, s_ptr->selectable);
6283 if (reqd_lcn != s_ptr->serv_lcn)
6285 if (s_ptr->serv_lcn == 0)
6287 s_ptr->unavailable = FALSE;
6290 s_ptr->serv_lcn = reqd_lcn;
6293 AP_SI_PRINT((
" LCN for 0x%04x, %u, hidden=%u", s_ptr->serv_id,
6294 reqd_lcn, s_ptr->hidden));
6306 AP_SI_PRINT((
" copy service sid 0x%04x, lcn %u, new lcn %u",
6307 s_ptr->serv_id, s_ptr->serv_lcn, reqd_lcn));
6312 s2_ptr->unavailable = FALSE;
6314 s2_ptr->new_service = TRUE;
6315 s2_ptr->serv_lcn = reqd_lcn;
6325 s_ptr->unavailable = FALSE;
6334 for (i = 0; i < nit_entry->num_lcn_entries; i++)
6337 current_transport_rec[path]);
6341 reqd_lcn = nit_entry->lcn_desc_array[i].serv_lcn;
6345 s_ptr->hidden = !nit_entry->lcn_desc_array[i].visible;
6348 s_ptr->selectable = TRUE;
6349 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_SELECTABLE, s_ptr->selectable);
6351 if (reqd_lcn != s_ptr->serv_lcn)
6353 s_ptr->serv_lcn = reqd_lcn;
6356 AP_SI_PRINT((
" LCN for 0x%04x, %u, hidden=%u", s_ptr->serv_id, reqd_lcn,
6366 for (i = 0; i < nit_entry->num_serv_attr_entries; i++)
6369 current_transport_rec[path]);
6373 s_ptr->hidden = !nit_entry->serv_attr_array[i].service_visible;
6376 s_ptr->selectable = nit_entry->serv_attr_array[i].service_selectable;
6377 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_SELECTABLE, s_ptr->selectable);
6384 for (i = 0; i < nit_entry->num_hd_lcn_entries; i++)
6387 current_transport_rec[path]);
6389 if ((s_ptr != NULL) && (s_ptr->old_allocated_lcn == 0))
6396 memcpy(s_ptr->hd_lcn_desc, &nit_entry->hd_lcn_desc_array[i],
6403 nit_entry->orig_net_id, nit_entry->tran_id);
6404 if ((t_ptr != NULL) && (t_ptr->network != NULL) &&
6405 (t_ptr->network->profile_type == ADB_PROFILE_TYPE_CIPLUS))
6411 if (nit_entry->del_sys_desc != NULL)
6416 switch (nit_entry->del_sys_desc_type)
6418 case SI_DEL_SYS_DESC_TYPE_TERR:
6419 if (current_transport_rec[path]->sig_type == SIGNAL_COFDM)
6421 if (nit_entry->del_sys_desc->terr.is_t2)
6423 if ((nit_entry->del_sys_desc->terr.u.t2.num_cells > 0) &&
6424 (nit_entry->del_sys_desc->terr.u.t2.cell[0].num_freqs > 0))
6427 nit_entry->del_sys_desc->terr.u.t2.cell[0].freq_hz[0],
6428 nit_entry->del_sys_desc->terr.u.t2.plp_id)) == NULL)
6431 AP_SI_PRINT((
" Adding terr transport for %lu Hz, PLP %u",
6432 nit_entry->del_sys_desc->terr.u.t2.cell[0].freq_hz[0],
6433 nit_entry->del_sys_desc->terr.u.t2.plp_id));
6436 nit_entry->del_sys_desc->terr.u.t2.cell[0].freq_hz[0],
6437 nit_entry->del_sys_desc->terr.u.t2.plp_id, n_ptr);
6446 AP_SI_PRINT((
" Adding terr transport for %lu Hz",
6447 nit_entry->del_sys_desc->terr.u.t1.freq_hz));
6455 case SI_DEL_SYS_DESC_TYPE_CABLE:
6456 if (current_transport_rec[path]->sig_type == SIGNAL_QAM)
6459 nit_entry->del_sys_desc->cable.symbol_rate)) == NULL)
6462 AP_SI_PRINT((
" Adding cable transport for %lu Hz, symbol rate %u Kbits",
6463 nit_entry->del_sys_desc->cable.freq_hz,
6464 nit_entry->del_sys_desc->cable.symbol_rate));
6467 nit_entry->del_sys_desc->cable.symbol_rate, n_ptr);
6473 t_ptr->u.cab.symbol_rate = (U16BIT)nit_entry->del_sys_desc->cable.symbol_rate;
6474 DBA_SetFieldValue(t_ptr->dba_rec, DBA_FIELD_TRAN_SRATE, t_ptr->u.cab.symbol_rate);
6478 case SI_DEL_SYS_DESC_TYPE_SAT:
6479 if (current_transport_rec[path]->sig_type == SIGNAL_QPSK)
6482 nit_entry->del_sys_desc->sat.sym_rate,
6483 nit_entry->del_sys_desc->sat.polarity,
6484 nit_entry->del_sys_desc->sat.dvb_s2,
6485 nit_entry->del_sys_desc->sat.modulation, sat_ptr)) == NULL)
6488 AP_SI_PRINT((
" Adding sat transport for %lu Hz, symrate %u, polarity %u, DVB-S2 %u, modulation %u",
6489 nit_entry->del_sys_desc->sat.freq_hz,
6490 nit_entry->del_sys_desc->sat.sym_rate,
6491 nit_entry->del_sys_desc->sat.polarity,
6492 nit_entry->del_sys_desc->sat.dvb_s2,
6493 nit_entry->del_sys_desc->sat.modulation));
6496 nit_entry->del_sys_desc->sat.sym_rate,
6497 nit_entry->del_sys_desc->sat.polarity,
6498 nit_entry->del_sys_desc->sat.dvb_s2,
6499 nit_entry->del_sys_desc->sat.modulation, n_ptr);
6515 switch (nit_entry->del_sys_desc_type)
6517 case SI_DEL_SYS_DESC_TYPE_TERR:
6519 case SI_DEL_SYS_DESC_TYPE_CABLE:
6521 if (t_ptr->sig_type == SIGNAL_QAM)
6525 t_ptr->u.cab.symbol_rate = (U16BIT)nit_entry->del_sys_desc->cable.symbol_rate;
6526 DBA_SetFieldValue(t_ptr->dba_rec, DBA_FIELD_TRAN_SRATE, t_ptr->u.cab.symbol_rate);
6529 case SI_DEL_SYS_DESC_TYPE_SAT:
6544 if (nit_entry->target_region_list != NULL)
6549 t_ptr->u.terr.target_region_list = nit_entry->target_region_list;
6550 nit_entry->target_region_list = NULL;
6554 nit_entry = nit_entry->next;
6557 else if ((mode == DB_ACCESS_UPDATE) && (n_ptr != NULL) && n_ptr->nit_version_changed)
6559 nit_entry = nit_table->transport_list;
6560 while (nit_entry != NULL)
6563 nit_entry->orig_net_id, nit_entry->tran_id);
6568 (ACFG_DYNAMIC_SI_UPDATE_LCNS |
6569 ACFG_DYNAMIC_SI_UPDATE_SERVICE_ADD |
6570 ACFG_DYNAMIC_SI_UPDATE_SERVICE_REMOVE)))
6574 if (DynamicUpdateAddTransport(t_ptr,
6575 nit_entry->num_lcn_entries, nit_entry->lcn_desc_array,
6576 nit_entry->num_hd_lcn_entries, nit_entry->hd_lcn_desc_array,
6577 nit_entry->num_nordig_lcn_entries, nit_entry->nordig_lcn_desc_array))
6582 nit_entry->num_nordig_lcn_entries = 0;
6583 nit_entry->nordig_lcn_desc_array = NULL;
6588 t_ptr->u.terr.target_region_list = nit_entry->target_region_list;
6589 nit_entry->target_region_list = NULL;
6593 t_ptr->sdt_received = FALSE;
6595 restart_sdts = TRUE;
6600 nit_entry = nit_entry->next;
6608 if (nit_table->name_str != NULL)
6619 for (i = 0; i < ACFG_NUM_DB_LANGUAGES; i++)
6621 if (n_ptr->name_array[i] != NULL)
6624 n_ptr->name_array[i] = NULL;
6629 mlnn_desc_ptr = nit_table->multiling_net_name_desc_array;
6630 for (i = 0; i < nit_table->num_multiling_net_names; i++, mlnn_desc_ptr++)
6632 if (mlnn_desc_ptr->name_str != NULL)
6635 if (lang_id != ACFG_INVALID_DB_LANG)
6637 if (n_ptr->name_array[lang_id] == NULL)
6639 str_desc = mlnn_desc_ptr->name_str;
6641 str_desc->str_ptr, str_desc->nbytes);
6648 if (nit_table->def_authority != NULL)
6652 if (n_ptr->def_authority != NULL)
6655 if (nit_table->def_authority->nbytes == n_ptr->def_authority->nbytes)
6657 if (memcmp(n_ptr->def_authority->str_ptr, nit_table->def_authority->str_ptr,
6658 n_ptr->def_authority->nbytes) == 0)
6669 if (n_ptr->def_authority != NULL)
6672 n_ptr->def_authority = NULL;
6676 n_ptr->def_authority =
DBDEF_MakeString(0, nit_table->def_authority->str_ptr,
6677 nit_table->def_authority->nbytes);
6679 AP_SI_PRINT((
" Network \"%s\" has default authority \"%s\"", n_ptr->name_str->str_ptr,
6680 n_ptr->def_authority->str_ptr));
6685 if (nit_table->fta_content_desc != NULL)
6687 n_ptr->has_fta_desc = TRUE;
6688 n_ptr->do_not_scramble = nit_table->fta_content_desc->do_not_scramble;
6692 nit_entry = nit_table->transport_list;
6693 while (nit_entry != NULL)
6696 nit_entry->tran_id);
6697 if ((t_ptr != NULL) && (t_ptr->network != NULL) &&
6698 (t_ptr->network->profile_type == ADB_PROFILE_TYPE_CIPLUS))
6706 if (nit_entry->fta_content_desc != NULL)
6708 t_ptr->has_fta_desc = TRUE;
6709 t_ptr->do_not_scramble = nit_entry->fta_content_desc->do_not_scramble;
6712 if (nit_entry->def_authority != NULL)
6716 if (t_ptr->def_authority != NULL)
6719 if (nit_entry->def_authority->nbytes == t_ptr->def_authority->nbytes)
6721 if (memcmp(t_ptr->def_authority->str_ptr, nit_entry->def_authority->str_ptr,
6722 t_ptr->def_authority->nbytes) == 0)
6733 if (t_ptr->def_authority != NULL)
6736 t_ptr->def_authority = NULL;
6740 t_ptr->def_authority =
DBDEF_MakeString(0, nit_entry->def_authority->str_ptr,
6741 nit_entry->def_authority->nbytes);
6743 AP_SI_PRINT((
" Transport 0x%x has default authority \"%s\"", t_ptr->tran_id,
6744 t_ptr->def_authority->str_ptr));
6749 if (nit_entry->freq_list != NULL)
6751 if (t_ptr->additional_frequencies != NULL)
6754 t_ptr->additional_frequencies = NULL;
6755 t_ptr->num_additional_frequencies = 0;
6759 for (freq_list_ptr = nit_entry->freq_list; freq_list_ptr != NULL; freq_list_ptr = freq_list_ptr->next)
6761 if (((t_ptr->sig_type == SIGNAL_QPSK) &&
6762 (freq_list_ptr->coding_type == FREQ_LIST_CODING_TYPE_SATELLITE)) ||
6763 ((t_ptr->sig_type == SIGNAL_QAM) &&
6764 (freq_list_ptr->coding_type == FREQ_LIST_CODING_TYPE_CABLE)) ||
6765 ((t_ptr->sig_type == SIGNAL_COFDM) &&
6766 (freq_list_ptr->coding_type == FREQ_LIST_CODING_TYPE_TERRESTRIAL)))
6771 t_ptr->additional_frequencies =
STB_AppGetMemory(freq_list_ptr->num_frequencies *
sizeof(U32BIT));
6772 if (t_ptr->additional_frequencies != NULL)
6774 memcpy(t_ptr->additional_frequencies, freq_list_ptr->frequency_array,
6775 freq_list_ptr->num_frequencies *
sizeof(U32BIT));
6776 t_ptr->num_additional_frequencies = freq_list_ptr->num_frequencies;
6784 nit_entry = nit_entry->next;
6789 if (mode == DB_ACCESS_UPDATE)
6792 DeleteLinkageDescripterArray(n_ptr->linkage_desc_list);
6793 n_ptr->last_linkage_entry = NULL;
6794 n_ptr->num_linkage_entries = 0;
6795 n_ptr->linkage_desc_list = NULL;
6798 linkage_desc_ptr = nit_table->linkage_desc_list;
6799 while (linkage_desc_ptr != NULL)
6801 CopyLinkageDesc(linkage_desc_ptr,
6802 &n_ptr->linkage_desc_list,
6803 &n_ptr->last_linkage_entry,
6804 &n_ptr->num_linkage_entries);
6806 linkage_desc_ptr = linkage_desc_ptr->next;
6814 if (update_nit_func != NULL)
6817 (*update_nit_func)(path, nit_table, table_rec);
6824 if (report_nit && (transport_changed || (table_rec->version != last_reported_nit_version[path])))
6827 AP_SI_PRINT((
"%s: reporting NIT 0x%04x, ver=%u", __FUNCTION__, table_rec->xtid, table_rec->version));
6832 last_reported_nit_version[path] = table_rec->version;
6838 FUNCTION_FINISH(ProcessNitTable);
6840 return(restart_sdts);
6861 static void ProcessCatTable(U8BIT path,
SI_TABLE_RECORD *table_rec, BOOLEAN report_cat, BOOLEAN transport_changed)
6863 FUNCTION_START(ProcessCatTable);
6866 AP_SI_PRINT((
"%s(%u, report_cat=%u, transport_changed=%u): table_rec->version=%d last version=%d",
6867 __FUNCTION__, path, report_cat, transport_changed, table_rec->version, last_reported_cat_version[path]));
6871 if (report_cat && (transport_changed || (table_rec->version != last_reported_cat_version[path])))
6874 AP_SI_PRINT((
"Reporting cat: version=%d num_sects=%d", table_rec->version, table_rec->num_sect));
6879 last_reported_cat_version[path] = table_rec->version;
6885 FUNCTION_FINISH(ProcessCatTable);
6906 BOOLEAN links_cleared;
6907 BOOLEAN service_links_updated;
6909 FUNCTION_START(ProcessRctTable);
6911 path = table_rec->path;
6912 service_links_updated = FALSE;
6917 if (rct_table != NULL)
6919 links_cleared = FALSE;
6922 subtable = rct_table->subtables;
6923 while (subtable != NULL)
6926 if ((subtable->service_id == 0) || (subtable->service_id == current_service_rec[path]->serv_id))
6931 AP_SI_PRINT((
"Clearing RCT links for service 0x%04x", current_service_rec[path]->serv_id));
6935 links_cleared = TRUE;
6936 service_links_updated = TRUE;
6939 subdata = subtable->data;
6940 while (subdata != NULL)
6943 for (link = 0; link < subdata->link_count; link++)
6945 link_info = &subdata->link_array[link];
6948 if ((link_info->link_type == RCT_LINK_TYPE_URI) &&
6949 (link_info->how_related == RCT_HOW_RELATED_TVA_2007) &&
6950 (link_info->uri_string != NULL))
6952 switch (link_info->term_id)
6954 case RCT_TERMID_IS_TRAILER_OF:
6956 AP_SI_PRINT((
"ProcessRctTable: Found TRAILER_OF link with uri \"%s\"",
6957 link_info->uri_string));
6962 case RCT_TERMID_IS_GROUP_TRAILER_OF:
6964 AP_SI_PRINT((
"ProcessRctTable: Found GROUP_TRAILER_OF link with uri \"%s\"",
6965 link_info->uri_string));
6978 if (adb_link != NULL)
6982 if (link_info->term_id == RCT_TERMID_IS_GROUP_TRAILER_OF)
6984 adb_link->is_group_trailer = TRUE;
6987 adb_link->uri_string = (U8BIT *)
STB_AppGetMemory(strlen((
char *)link_info->uri_string) + 1);
6988 if (adb_link->uri_string != NULL)
6990 strncpy((
char *)adb_link->uri_string, (
char *)link_info->uri_string, strlen((
char *)link_info->uri_string) + 1);
6992 adb_link->can_use_default_icon = link_info->can_use_default_icon;
6993 adb_link->icon_id = link_info->icon_id;
6995 if ((link_info->event_desc != NULL) && (link_info->event_desc->name_str != NULL))
6998 link_info->event_desc->name_str->str_ptr,
6999 link_info->event_desc->name_str->nbytes);
7003 for (i = 0; i < link_info->num_items; i++)
7005 promo_text = &link_info->promo_text_array[i];
7007 if (promo_text->string != NULL)
7010 if (lang_id == ACFG_INVALID_DB_LANG)
7015 if (adb_link->promo_text[lang_id] == NULL)
7018 promo_text->string->str_ptr, promo_text->string->nbytes);
7024 AP_SI_PRINT((
"ProcessRctTable: \"%s\" can_use_default=%u",
7025 adb_link->uri_string, adb_link->can_use_default_icon));
7028 service_links_updated = TRUE;
7031 for (i = 0; i < link_info->num_icons; i++)
7033 if ((icon_ptr = ProcessImageIcon(&link_info->icon_array[i])) != NULL)
7037 #if defined(INCLUDE_DSMCC_FILE_REQUEST) 7038 IconFileRequest(icon_ptr,path);
7055 for (i = 0; i < subdata->num_icons; i++)
7057 if ((icon_ptr = ProcessImageIcon(&subdata->icon_array[i])) != NULL)
7061 #if defined(INCLUDE_DSMCC_FILE_REQUEST) 7062 IconFileRequest(icon_ptr,path);
7068 subdata = subdata->next;
7072 subtable = subtable->next;
7077 if (service_links_updated)
7080 AP_SI_PRINT((
"ProcessRctTable: Sending PROMO_LINK_CHANGE event"));
7083 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_MHEG, EV_TYPE_MHEG_PROMO_LINK_CHANGE, NULL, 0);
7087 FUNCTION_FINISH(ProcessRctTable);
7097 static BOOLEAN ProcessBatTable(
SI_TABLE_RECORD *table_rec, E_DB_ACCESS_MODE mode, BOOLEAN report_bat)
7113 BOOLEAN restart_sdts;
7115 FUNCTION_START(ProcessBatTable);
7117 restart_sdts = FALSE;
7120 if (active_bouquet_ids != NULL)
7124 for (i = 0; i < num_active_bouquet_ids; i++)
7126 if (active_bouquet_ids[i].bouquet_id == table_rec->xtid)
7128 active_bouquet_ids[i].received = TRUE;
7143 if (bat_table != NULL)
7146 AP_SI_PRINT((
"BAT received: id=%u, num_trans=%u", bat_table->bouquet_id, bat_table->num_transports));
7148 if (bat_table->bouquet_name != NULL)
7150 AP_SI_PRINT((
" name=\"%s\"", bat_table->bouquet_name->str_ptr));
7154 path = table_rec->path;
7159 bat_version_rec = sat_ptr->bat_version_list;
7160 while (bat_version_rec != NULL)
7162 if (bat_version_rec->bouquet_id == bat_table->bouquet_id)
7164 if (bat_version_rec->version == bat_table->version)
7168 AP_SI_PRINT((
" existing BAT version %u", bat_table->version));
7175 bat_version_rec = bat_version_rec->next;
7178 if (bat_version_rec == NULL)
7182 AP_SI_PRINT((
" new BAT version %u", bat_table->version));
7185 if (bat_version_rec != NULL)
7187 bat_version_rec->bouquet_id = bat_table->bouquet_id;
7188 bat_version_rec->next = sat_ptr->bat_version_list;
7189 sat_ptr->bat_version_list = bat_version_rec;
7193 if (process && (bat_version_rec != NULL))
7195 bat_version_rec->version = bat_table->version;
7201 if (mode == DB_ACCESS_SEARCH)
7204 if (bat_table->bouquet_name != NULL)
7216 for (trans_entry = bat_table->transport_list; trans_entry != NULL;
7217 trans_entry = trans_entry->next)
7220 trans_entry->orig_net_id, trans_entry->tran_id);
7222 if ((trans_entry->num_serv_list_entries > 0) &&
7223 (trans_entry->serv_list_desc_array != NULL))
7228 AP_SI_PRINT((
" New transport 0x%04x/0x%04x", trans_entry->orig_net_id,
7229 trans_entry->tran_id));
7233 switch (current_transport_rec[path]->sig_type)
7245 FALSE, MOD_AUTO, NULL);
7260 AP_SI_PRINT((
" Failed to create transport!", __FUNCTION__));
7267 AP_SI_PRINT((
" Existing transport 0x%04x/0x%04x", trans_entry->orig_net_id,
7268 trans_entry->tran_id));
7274 for (i = 0; i < trans_entry->num_serv_list_entries; i++)
7276 serv_desc = &trans_entry->serv_list_desc_array[i];
7278 t_ptr->orig_net_id, t_ptr->tran_id, serv_desc->serv_id);
7282 AP_SI_PRINT((
" New service 0x%04x", serv_desc->serv_id));
7288 s_ptr->found = FALSE;
7289 s_ptr->unavailable = TRUE;
7291 s_ptr->serv_type = serv_desc->serv_type;
7299 AP_SI_PRINT((
" Failed to create service!", __FUNCTION__));
7306 AP_SI_PRINT((
" Existing service 0x%04x", serv_desc->serv_id));
7317 AP_SI_PRINT((
" Failed to add service to fav list 0x%02x", list_id));
7331 AP_SI_PRINT((
"%s: Deleting empty bouquet favourite list", __FUNCTION__));
7343 else if (mode == DB_ACCESS_UPDATE)
7347 trans_entry = bat_table->transport_list;
7348 while (trans_entry != NULL)
7351 trans_entry->orig_net_id, trans_entry->tran_id);
7356 (ACFG_DYNAMIC_SI_UPDATE_LCNS |
7357 ACFG_DYNAMIC_SI_UPDATE_SERVICE_ADD |
7358 ACFG_DYNAMIC_SI_UPDATE_SERVICE_REMOVE)))
7362 if (DynamicUpdateAddTransport(t_ptr,
7363 trans_entry->num_lcn_entries, trans_entry->lcn_desc_array, 0, NULL, 0, NULL))
7367 t_ptr->sdt_received = FALSE;
7369 restart_sdts = TRUE;
7374 trans_entry = trans_entry->next;
7378 if (sat_ptr != NULL)
7380 if (bat_table->fta_content_desc != NULL)
7382 sat_ptr->has_fta_desc = TRUE;
7383 sat_ptr->do_not_scramble = bat_table->fta_content_desc->do_not_scramble;
7386 if (bat_table->def_authority != NULL)
7390 if (sat_ptr->def_authority != NULL)
7392 if (bat_table->def_authority->nbytes == sat_ptr->def_authority->nbytes)
7395 if (memcmp(bat_table->def_authority->str_ptr, sat_ptr->def_authority->str_ptr,
7396 bat_table->def_authority->nbytes) == 0)
7406 if (sat_ptr->def_authority != NULL)
7411 sat_ptr->def_authority =
DBDEF_MakeString(0, bat_table->def_authority->str_ptr,
7412 bat_table->def_authority->nbytes);
7414 AP_SI_PRINT((
" Satellite has default authority \"%s\"",
7415 sat_ptr->def_authority->str_ptr));
7419 else if (sat_ptr->def_authority != NULL)
7423 sat_ptr->def_authority = NULL;
7426 for (trans_entry = bat_table->transport_list; trans_entry != NULL;
7427 trans_entry = trans_entry->next)
7430 trans_entry->orig_net_id, trans_entry->tran_id);
7433 if (trans_entry->def_authority != NULL)
7437 if (t_ptr->def_authority != NULL)
7439 if (trans_entry->def_authority->nbytes == t_ptr->def_authority->nbytes)
7442 if (memcmp(trans_entry->def_authority->str_ptr,
7443 t_ptr->def_authority->str_ptr,
7444 trans_entry->def_authority->nbytes) == 0)
7454 if (t_ptr->def_authority != NULL)
7460 trans_entry->def_authority->str_ptr,
7461 trans_entry->def_authority->nbytes);
7463 AP_SI_PRINT((
" Transport 0x%04x has default authority \"%s\"",
7464 t_ptr->tran_id, t_ptr->def_authority->str_ptr));
7468 else if (t_ptr->def_authority != NULL)
7472 t_ptr->def_authority = NULL;
7479 if (update_bat_func != NULL)
7482 (*update_bat_func)(path, bat_table, table_rec);
7491 AP_SI_PRINT((
"%s: reporting BAT 0x%04x, ver=%u", __FUNCTION__, table_rec->xtid, table_rec->version));
7500 FUNCTION_FINISH(ProcessBatTable);
7502 return(restart_sdts);
7514 FUNCTION_START(ProcessImageIcon);
7518 if (((si_icon->transport_mode == ICON_TRANS_LOCAL) || (si_icon->transport_mode == ICON_TRANS_URL)) &&
7519 (si_icon->icon_type != NULL) && (si_icon->data_len > 0) && (si_icon->icon_data != NULL))
7529 if (icon_ptr != NULL)
7533 icon_ptr->icon_id = si_icon->icon_id;
7534 icon_ptr->transport_mode = si_icon->transport_mode;
7539 icon_ptr->icon_type = ICON_TYPE_PNG;
7544 icon_ptr->icon_type = ICON_TYPE_JPEG;
7548 icon_ptr->coord_system = ICON_COORDS_576;
7550 icon_ptr->position_defined = si_icon->position_defined;
7551 if (icon_ptr->position_defined)
7555 switch (si_icon->coord_system)
7557 case ICON_COORDS_576:
7558 if ((si_icon->x_pos < 720) && (si_icon->y_pos < 576))
7560 icon_ptr->coord_system = si_icon->coord_system;
7561 icon_ptr->x_pos = si_icon->x_pos;
7562 icon_ptr->y_pos = si_icon->y_pos;
7566 icon_ptr->position_defined = FALSE;
7570 case ICON_COORDS_720:
7571 if ((si_icon->x_pos < 1280) && (si_icon->y_pos < 720))
7573 icon_ptr->coord_system = si_icon->coord_system;
7574 icon_ptr->x_pos = si_icon->x_pos;
7575 icon_ptr->y_pos = si_icon->y_pos;
7579 icon_ptr->position_defined = FALSE;
7583 case ICON_COORDS_1080:
7584 if ((si_icon->x_pos < 1920) && (si_icon->y_pos < 1080))
7586 icon_ptr->coord_system = si_icon->coord_system;
7587 icon_ptr->x_pos = si_icon->x_pos;
7588 icon_ptr->y_pos = si_icon->y_pos;
7592 icon_ptr->position_defined = FALSE;
7597 icon_ptr->position_defined = FALSE;
7602 if (si_icon->transport_mode == ICON_TRANS_URL)
7606 if (icon_ptr->icon_url != NULL)
7608 memcpy(icon_ptr->icon_url, si_icon->icon_data, si_icon->data_len);
7615 if (icon_ptr->icon_type == ICON_TYPE_PNG)
7618 AP_SI_PRINT((
"ProcessImageIcon: Inline PNG icon @ (%u, %u), size %u x %u",
7619 icon_ptr->x_pos, icon_ptr->y_pos, icon_ptr->width, icon_ptr->height));
7623 &icon_ptr->icon_data, &icon_ptr->data_len, &icon_ptr->width, &icon_ptr->height))
7626 AP_SI_PRINT((
"ProcessImageIcon: Failed to process PNG icon"));
7635 AP_SI_PRINT((
"ProcessImageIcon: Inline JPEG icon @ (%u, %u), size %u x %u",
7636 icon_ptr->x_pos, icon_ptr->y_pos, icon_ptr->width, icon_ptr->height));
7640 &icon_ptr->icon_data, &icon_ptr->data_len, &icon_ptr->width, &icon_ptr->height))
7643 AP_SI_PRINT((
"ProcessImageIcon: Failed to process JPEG icon"));
7654 FUNCTION_FINISH(ProcessImageIcon);
7659 #if defined(INCLUDE_DSMCC_FILE_REQUEST) 7667 static void IconFileReceived(E_FsStatus status, S_CONTENT *pContent)
7671 FUNCTION_START(IconFileReceived);
7672 ASSERT( pContent != NULL );
7675 if (status == FS_STATUS_OK)
7677 ASSERT((pContent->data != NULL) && (pContent->size > 0));
7679 if (icon_ptr->icon_type == ICON_TYPE_PNG)
7682 AP_SI_PRINT((
"IconFileReceived: PNG icon \"%s\" received", icon_ptr->icon_url));
7686 &icon_ptr->data_len, &icon_ptr->width, &icon_ptr->height))
7689 AP_SI_PRINT((
"IconFileReceived: Failed to process PNG icon"));
7696 AP_SI_PRINT((
"IconFileReceived: JPEG icon \"%s\" received", icon_ptr->icon_url));
7700 &icon_ptr->data_len, &icon_ptr->width, &icon_ptr->height))
7703 AP_SI_PRINT((
"IconFileReceived: Failed to process JPEG icon"));
7707 ASSERT( pContent->destroy != NULL );
7708 pContent->destroy( pContent->fs_handle );
7709 icon_ptr->destroy_func = NULL;
7710 icon_ptr->dsm_handle = NULL;
7715 AP_SI_PRINT((
"IconFileReceived: Failed to obtain icon file \"%s\", status %u",
7716 icon_ptr->icon_url, status));
7720 FUNCTION_FINISH(IconFileReceived);
7726 H_DsmControl dsmctrl;
7729 FUNCTION_START(IconFileRequest);
7733 if ((icon_ptr->transport_mode == ICON_TRANS_URL) &&
7734 (icon_ptr->icon_url != NULL))
7737 AP_SI_PRINT((
"IconFileRequest: Requesting icon file \"%s\"", icon_ptr->icon_url));
7739 dsm.user_data = icon_ptr;
7740 dsmctrl = DSMCC_FindInstance(current_service_rec[path]->serv_id,
STB_DPGetPathDemux(path));
7741 if (dsmctrl != NULL)
7743 status = DSMCC_ClientLoadObject(dsmctrl, icon_ptr->icon_url,
7744 LOAD_FLAGS_DEFAULT, IconFileReceived, &dsm);
7745 if (status == FS_STATUS_PENDING)
7747 icon_ptr->destroy_func = dsm.destroy;
7748 icon_ptr->dsm_handle = dsm.fs_handle;
7750 else if (status == FS_STATUS_OK)
7752 if (icon_ptr->icon_type == ICON_TYPE_PNG)
7755 AP_SI_PRINT((
"IconFileRequest: PNG icon received"));
7758 STB_IMGConvertPNG(dsm.data, dsm.size, &icon_ptr->icon_data, &icon_ptr->data_len,
7759 &icon_ptr->width, &icon_ptr->height);
7764 AP_SI_PRINT((
"IconFileRequest: JPEG icon received"));
7768 &icon_ptr->width, &icon_ptr->height);
7770 ASSERT( dsm.destroy != NULL );
7771 dsm.destroy( dsm.fs_handle );
7776 FUNCTION_FINISH(IconFileRequest);
7781 static void ProcessEitTable(
SI_TABLE_RECORD *table_rec, BOOLEAN ignore_version,
7782 E_DB_ACCESS_MODE mode, BOOLEAN playback)
7795 U32BIT priv_data_code;
7803 BOOLEAN now_next_updated;
7804 BOOLEAN sched_updated;
7806 U32DHMS start_date_time;
7807 U32DHMS limit_date_time;
7808 U8BIT sect_num, seg_last_sect_num, segment;
7810 BOOLEAN complete_segment;
7811 U16BIT offset_hours;
7812 U32DHMS segment_start;
7814 FUNCTION_START(ProcessEitTable);
7816 if (table_rec != NULL)
7818 now_next_updated = FALSE;
7819 sched_updated = FALSE;
7822 table_id = table_rec->tid;
7823 if ((table_id == EITPF_ACTUAL_TID) || (table_id == EITPF_PLUS_TID) ||
7824 ((playback == FALSE) && ((table_id == EITPF_OTHER_TID) ||
7825 ((table_id & 0xf0) == EITSC_ACTUAL_TID) || ((table_id & 0xf0) == EITSC_OTHER_TID))))
7827 path = table_rec->path;
7829 version = table_rec->version;
7830 serv_id = table_rec->xtid;
7833 AP_SI_PRINT((
"EIT: tid=0x%02x, serv=0x%04x, version=%u", table_id, serv_id, version));
7837 section_rec = table_rec->section_list;
7838 if (section_rec != NULL)
7841 data_ptr = &(section_rec->data_start);
7845 tran_id = (data_ptr[8] << 8) | data_ptr[9];
7846 orig_net_id = (data_ptr[10] << 8) | data_ptr[11];
7851 if (playback == TRUE)
7853 s_ptr = current_service_rec[path];
7858 if (mode == DB_ACCESS_SEARCH)
7862 current_transport_rec[path]->orig_net_id, current_transport_rec[path]->tran_id,
7878 if (eit_schedule_limit == 0)
7880 limit_date_time = 0;
7889 limit_date_time = 0;
7894 DHMS_CREATE(0, eit_schedule_limit, 0, 0), CALC_ADD);
7899 if (DeleteOutOfDateEvents(s_ptr))
7901 sched_updated = TRUE;
7906 section_rec = table_rec->section_list;
7907 while ((section_rec != NULL) && !abort)
7910 data_ptr = &(section_rec->data_start);
7914 sect_num = data_ptr[6];
7916 if (((sect_num % 8) == 0) &&
7917 (((table_id & 0xf0) == EITSC_ACTUAL_TID) || ((table_id & 0xf0) == EITSC_OTHER_TID)))
7921 segment = sect_num / 8;
7922 seg_last_sect_num = data_ptr[12];
7923 complete_segment = FALSE;
7925 if (sect_num == seg_last_sect_num)
7927 complete_segment = TRUE;
7931 section_ptr = section_rec->next;
7935 while (!complete_segment && (section_ptr != NULL))
7937 data_ptr = &(section_ptr->data_start);
7940 if (data_ptr[6] == sect_num)
7942 if (data_ptr[6] == seg_last_sect_num)
7945 complete_segment = TRUE;
7951 section_ptr = section_ptr->next;
7963 if (complete_segment)
7970 if ((table_id & 0xf0) == EITSC_ACTUAL_TID)
7972 offset_hours = ((table_id - EITSC_ACTUAL_TID) * 32 + segment) * 3;
7976 offset_hours = ((table_id - EITSC_OTHER_TID) * 32 + segment) * 3;
7984 if (DeleteEventsForPeriod(s_ptr, segment_start,
7987 sched_updated = TRUE;
7993 data_ptr = &(section_rec->data_start);
7994 data_end = data_ptr + section_rec->data_len - 4;
8000 while ((data_ptr < data_end) && !abort)
8002 start_date_time = ReadEventStart(data_ptr);
8004 if ((limit_date_time == 0) || (start_date_time <= limit_date_time))
8011 e_ptr->event_id = (data_ptr[0] << 8) | data_ptr[1];
8012 e_ptr->start = ReadEventStart(data_ptr);
8013 e_ptr->duration = ReadEventDuration(data_ptr);
8014 e_ptr->running_status = data_ptr[10] >> 5;
8015 e_ptr->free_to_air = ((data_ptr[10] & 0x10) == 0);
8016 e_ptr->version = version;
8018 dloop_len = ((data_ptr[10] & 0x0f) << 8) | data_ptr[11];
8022 AP_SI_PRINT((
" event_id=%u, start=%u, duration=%u, len=%u",
8023 e_ptr->event_id, e_ptr->start, e_ptr->duration, dloop_len));
8027 dloop_end = data_ptr + dloop_len;
8028 while (data_ptr < dloop_end)
8031 AP_SI_PRINT((
" dtag=0x%02x, dlen=%u", data_ptr[0], data_ptr[1]));
8036 if (data_ptr[0] == PRIVATE_DATA_SPEC_DTAG)
8042 priv_data_code = (data_ptr[2] << 24) | (data_ptr[3] << 16) |
8043 (data_ptr[4] << 8) | data_ptr[5];
8046 else if (data_ptr[0] == FTA_CONTENT_DESC_DTAG)
8050 e_ptr->has_content_management_desc = TRUE;
8051 if ((data_ptr[2] & 0x08) != 0)
8053 e_ptr->do_not_scramble = TRUE;
8057 e_ptr->do_not_scramble = FALSE;
8065 if (eit_parser_func != NULL)
8067 (*eit_parser_func)(data_ptr[0], (U8BIT)dlen, data_ptr + 2, priv_data_code, e_ptr);
8075 if (event_desc != NULL)
8077 event_desc->desc_data = (U8BIT *)event_desc +
sizeof(
ADB_EVENT_DESC);
8078 if (event_desc->desc_data != NULL)
8080 memcpy(event_desc->desc_data, data_ptr, dlen);
8082 event_desc->next = NULL;
8084 if (e_ptr->desc_list_head == NULL)
8086 e_ptr->desc_list_head = event_desc;
8090 e_ptr->desc_list_tail->next = event_desc;
8093 e_ptr->desc_list_tail = event_desc;
8105 if ((table_id == EITPF_ACTUAL_TID) || (table_id == EITPF_OTHER_TID) ||
8106 (table_id == EITPF_PLUS_TID))
8108 if (section_rec->sect_num == 0)
8110 if (ignore_version || (s_ptr->now_event == NULL) ||
8111 ((s_ptr->now_event != NULL) &&
8112 ((s_ptr->now_event->event_id != e_ptr->event_id) ||
8113 (s_ptr->now_event->version != version))))
8116 if (s_ptr->now_event != NULL)
8121 s_ptr->now_event = e_ptr;
8123 now_next_updated = TRUE;
8126 else if (section_rec->sect_num == 1)
8128 if (ignore_version || (s_ptr->next_event == NULL) ||
8129 ((s_ptr->next_event != NULL) &&
8130 ((s_ptr->next_event->event_id != e_ptr->event_id) ||
8131 (s_ptr->next_event->version != version))))
8134 if (s_ptr->next_event != NULL)
8137 s_ptr->next_event = NULL;
8140 s_ptr->next_event = e_ptr;
8142 now_next_updated = TRUE;
8145 else if (table_id == EITPF_PLUS_TID)
8149 if (UpdateEvents(e_ptr, s_ptr, TRUE))
8152 sched_updated = TRUE;
8159 if (UpdateEvents(e_ptr, s_ptr, FALSE))
8162 sched_updated = TRUE;
8174 if ((mode == DB_ACCESS_UPDATE) && !playback)
8177 orig_net_id, tran_id, serv_id);
8179 while (s2_ptr != NULL)
8181 s2_ptr->now_event = s_ptr->now_event;
8182 s2_ptr->next_event = s_ptr->next_event;
8183 s2_ptr->event_schedule = s_ptr->event_schedule;
8187 orig_net_id, tran_id, serv_id);
8201 data_ptr = data_end;
8206 section_rec = section_rec->next;
8211 if ((mode == DB_ACCESS_SEARCH) && (eit_list[path] != NULL) && (playback == FALSE))
8213 for (i = 0; i < num_eit_list_entries[path]; i++)
8215 if (eit_list[path][i].serv_id == serv_id)
8217 eit_list[path][i].got_eit = TRUE;
8227 if (update_eit_func != NULL)
8230 (*update_eit_func)(path, table_rec);
8237 if (now_next_updated && (s_ptr->now_event != NULL))
8239 #ifdef NOW_EVENTS_LATCHED 8243 STB_ERSendEvent(TRUE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_EIT_NOW_UPDATE, NULL, 0);
8245 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_EIT_NOW_UPDATE,
8246 &s_ptr,
sizeof(s_ptr));
8249 #ifdef INTEGRATE_HBBTV 8250 if (s_ptr == current_service_rec[path])
8262 STB_ERSendEvent(TRUE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_EIT_SCHED_UPDATE, NULL, 0);
8266 FUNCTION_FINISH(ProcessEitTable);
8269 static U32DHMS ReadEventStart(U8BIT *data_ptr)
8272 U8BIT hrs, mns, scs;
8274 FUNCTION_START(ReadEventStart);
8276 date = (data_ptr[2] << 8) | data_ptr[3];
8277 hrs = ((data_ptr[4] >> 4) * 10) + (data_ptr[4] & 0x0f);
8278 mns = ((data_ptr[5] >> 4) * 10) + (data_ptr[5] & 0x0f);
8279 scs = ((data_ptr[6] >> 4) * 10) + (data_ptr[6] & 0x0f);
8281 FUNCTION_FINISH(ReadEventStart);
8283 return DHMS_CREATE(date, hrs, mns, scs);
8286 static U32DHMS ReadEventDuration(U8BIT *data_ptr)
8289 U8BIT hrs, mns, scs;
8291 FUNCTION_START(ReadEventDuration);
8293 hrs = ((data_ptr[7] >> 4) * 10) + (data_ptr[7] & 0x0f);
8294 mns = ((data_ptr[8] >> 4) * 10) + (data_ptr[8] & 0x0f);
8295 scs = ((data_ptr[9] >> 4) * 10) + (data_ptr[9] & 0x0f);
8306 FUNCTION_FINISH(ReadEventDuration);
8308 return DHMS_CREATE(days, hrs, mns, scs);
8317 U32DHMS end_date_time;
8318 BOOLEAN sched_updated = FALSE;
8321 if (s_ptr->event_schedule != NULL)
8324 e_ptr = s_ptr->event_schedule;
8332 if (end_date_time < now)
8336 e_ptr = e_ptr->next;
8337 s_ptr->num_events_in_schedule--;
8338 sched_updated = TRUE;
8345 while (e_ptr != NULL);
8347 if (prev_e_ptr != NULL)
8351 prev_e_ptr->next = NULL;
8354 expired_e_ptr = s_ptr->event_schedule;
8358 s_ptr->event_schedule = e_ptr;
8361 e_ptr = expired_e_ptr;
8365 AP_SI_PRINT((
"[-] EIT %d v%d for LCN %d: deleting (expire)",
8366 (
int)e_ptr->event_id, (
int)e_ptr->version,
8367 (
int)s_ptr->serv_lcn));
8370 APP_SI_EIT_JOURNAL_TYPE_EXPIRE);
8371 e_ptr = e_ptr->next;
8378 return sched_updated;
8393 return start(e1) <= start(e2);
8398 return before(e2, e1);
8403 event->next = *list;
8411 *list =
event->next;
8421 static BOOLEAN DeleteEventsForPeriod(
ADB_SERVICE_REC *s_ptr, U32DHMS start_time, U32DHMS end_time)
8427 BOOLEAN events_deleted;
8429 events_deleted = FALSE;
8433 AP_SI_PRINT((
"%s(%u): %u@%02u:%02u - %u@%02u:%02u", __FUNCTION__, s_ptr->serv_lcn,
8434 DHMS_DATE(start_time), DHMS_HOUR(start_time), DHMS_MINS(start_time),
8435 DHMS_DATE(end_time), DHMS_HOUR(end_time), DHMS_MINS(end_time)));
8437 e_ptr = s_ptr->event_schedule;
8438 while (e_ptr != NULL)
8440 if (start(e_ptr) >= end_time)
8445 else if (start(e_ptr) < start_time)
8449 e_ptr = e_ptr->next;
8456 if (prev_ptr != NULL)
8458 prev_delete_ptr = prev_ptr;
8462 prev_delete_ptr = NULL;
8465 while ((e_ptr != NULL) && (start(e_ptr) < end_time))
8468 AP_SI_PRINT((
"[-] EIT %u v%u for LCN %u, %u@%02u:%02u - deleting",
8469 e_ptr->event_id, e_ptr->version, s_ptr->serv_lcn,
8470 DHMS_DATE(e_ptr->start), DHMS_HOUR(e_ptr->start), DHMS_MINS(e_ptr->start)));
8476 e_ptr = e_ptr->next;
8480 prev_ptr->next = NULL;
8482 if (prev_delete_ptr == NULL)
8484 s_ptr->event_schedule = e_ptr;
8488 prev_delete_ptr->next = e_ptr;
8492 events_deleted = TRUE;
8497 return(events_deleted);
8507 BOOLEAN past_event = FALSE;
8508 BOOLEAN found_match = FALSE;
8509 BOOLEAN old_version;
8512 FUNCTION_START(PruneEvents);
8523 while ((*walk_ptr != NULL) && !(found_match && past_event))
8526 AP_SI_PRINT((
"Found EIT event %d v%d, (%u-%u)",
8527 (
int)(*walk_ptr)->event_id, (
int)(*walk_ptr)->version,
8528 (
unsigned)start(*walk_ptr), (
unsigned)end(*walk_ptr)));
8534 old_version = FALSE;
8535 if (!found_match && ((*walk_ptr)->event_id == event_ptr->event_id))
8538 if ((*walk_ptr)->version == event_ptr->version)
8541 AP_SI_PRINT((
"EIT event %d v%d is a duplicate",
8542 (
int)event_ptr->event_id, (
int)event_ptr->version));
8550 AP_SI_PRINT((
"EIT event update %d: v%d->v%d, (%u-%u)->(%u-%u)",
8551 (
int)event_ptr->event_id,
8552 (
int)(*walk_ptr)->version, (
int)event_ptr->version,
8553 (
unsigned)start(event_ptr), (
unsigned)end(event_ptr),
8554 (
unsigned)start(*walk_ptr), (
unsigned)end(*walk_ptr)
8569 if (before(*walk_ptr, event_ptr))
8572 add_ptr = &((*walk_ptr)->next);
8576 past_event = after(*walk_ptr, event_ptr);
8582 if (old_version || (overlap && !update_only))
8585 temp = pop(walk_ptr);
8587 AP_SI_PRINT((
"[-] EIT %d v%d for LCN %d: deleting %s",
8588 (
int)temp->event_id, (
int)temp->version,
8589 (
int)s_ptr->serv_lcn,
8590 found_match ?
"(update)" :
"(overlap)"));
8596 APP_SI_EIT_JOURNAL_TYPE_DELETE);
8601 s_ptr->num_events_in_schedule--;
8603 if (prev_ptr != NULL)
8605 add_ptr = &(prev_ptr->next);
8609 add_ptr = &(s_ptr->event_schedule);
8614 prev_ptr = *walk_ptr;
8615 walk_ptr = &((*walk_ptr)->next);
8618 *is_update = found_match;
8620 FUNCTION_FINISH(PruneEvents);
8629 BOOLEAN is_update = FALSE;
8631 FUNCTION_START(UpdateEvents);
8636 AP_SI_PRINT((
"EIT received event %u v%u for service %u,%u,%u LCN %u, (%u@%02u:%02u - %u@%02u:%02u)",
8637 event_ptr->event_id, event_ptr->version,
8638 s_ptr->transport->orig_net_id, s_ptr->transport->tran_id,
8639 s_ptr->serv_id, s_ptr->serv_lcn,
8640 DHMS_DATE(event_ptr->start), DHMS_HOUR(event_ptr->start), DHMS_MINS(event_ptr->start),
8641 DHMS_DATE(end(event_ptr)), DHMS_HOUR(end(event_ptr)), DHMS_MINS(end(event_ptr))));
8646 add_ptr = PruneEvents(event_ptr, s_ptr, update_only, &is_update);
8647 if (add_ptr != NULL)
8650 AP_SI_PRINT((
"[+] EIT %u v%u for LCN %u: adding %s",
8651 event_ptr->event_id, event_ptr->version,
8653 is_update ?
"(update)" :
"(new)"));
8655 push(add_ptr, event_ptr);
8656 s_ptr->num_events_in_schedule++;
8659 APP_SI_EIT_JOURNAL_TYPE_UPDATE :
8660 APP_SI_EIT_JOURNAL_TYPE_ADD);
8667 AP_SI_PRINT((
"[ ] EIT %u v%u for LCN %u: discarding, duplicate",
8668 event_ptr->event_id, event_ptr->version, s_ptr->serv_lcn));
8675 AP_SI_PRINT((
"[ ] EIT %u v%u for LCN %u: discarding, ends in the past (%lu now)",
8676 event_ptr->event_id, event_ptr->version, s_ptr->serv_lcn,
8680 FUNCTION_FINISH(UpdateEvents);
8698 static BOOLEAN MakeNewPmtRequest(U8BIT path)
8700 BOOLEAN service_found;
8704 FUNCTION_START(MakeNewPmtRequest);
8706 service_found = FALSE;
8708 if ((pmt_request_mode[path] == PMT_REQUEST_CURRENT) && (current_service_rec[path] != NULL))
8711 for (i = 0; i < num_pmt_list_entries[path]; i++)
8713 if (pmt_list[path][i].serv_id == current_service_rec[path]->serv_id)
8716 service_found = TRUE;
8721 else if (pmt_request_mode[path] == PMT_REQUEST_PRIORITY)
8723 list_id = GetPriorityListId(path);
8727 list_id = pmt_list_id[path];
8730 if ((pmt_filter[path] != NULL) && (pmt_filter_pid[path] == pmt_list[path][list_id].pid))
8732 #ifdef DEBUG_SI_UPDATE 8733 AP_SI_PRINT((
"Update(%u): PMT request (sid 0x%04x)", path, pmt_list[path][list_id].serv_id));
8738 pmt_update_timestamp[path] = 0;
8744 if (pmt_filter[path] != NULL)
8747 pmt_filter[path] = NULL;
8750 #ifdef DEBUG_SI_UPDATE 8751 AP_SI_PRINT((
"Update(%u): PMT request (sid 0x%04x)", path, pmt_list[path][list_id].serv_id));
8753 pmt_filter_pid[path] = pmt_list[path][list_id].pid;
8755 pmt_update_timestamp[path] = 0;
8756 pmt_filter[path] =
STB_SIRequestPmt(path, ONE_SHOT_REQUEST, pmt_filter_pid[path],
8757 pmt_list[path][list_id].serv_id, 0xffff, 1, ReceiveSiTable, APP_SI_PMT_RECEIVED);
8760 FUNCTION_FINISH(MakeNewPmtRequest);
8762 return(service_found);
8765 static U16BIT GetPriorityListId(U8BIT path)
8771 FUNCTION_START(GetPriorityListId);
8773 list_id = pmt_list_id[path];
8777 if (pmt_priority_list[0] != INVALID_SERVICE_ID)
8780 for (i = 0; i < num_pmt_list_entries[path]; i++)
8782 if (pmt_list[path][i].serv_id == pmt_priority_list[0])
8790 index = MAX_PMT_PRIORITY_LIST - 1;
8791 for (i = 1; i < MAX_PMT_PRIORITY_LIST; i++)
8793 if (pmt_priority_list[i] == INVALID_SERVICE_ID)
8800 service_id = (U16BIT)pmt_priority_list[0];
8801 for (i = 0; i < index; i++)
8803 pmt_priority_list[i] = pmt_priority_list[i + 1];
8806 pmt_priority_list[index] = service_id;
8811 FUNCTION_FINISH(GetPriorityListId);
8827 static void UpdateTransportParameters(U8BIT path)
8833 E_STB_DP_TMODE tmode;
8834 E_STB_DP_TBWIDTH bwidth;
8835 E_STB_DP_TTYPE terr_type;
8836 E_STB_DP_CMODE cmode;
8839 FUNCTION_START(UpdateTransportParameters);
8842 if (tuner != INVALID_RES_ID)
8844 if ((t_ptr = current_transport_rec[path]) != NULL)
8848 switch (t_ptr->sig_type)
8854 case TUNE_MODE_COFDM_1K: {tmode = MODE_COFDM_1K;
break; }
8855 case TUNE_MODE_COFDM_2K: {tmode = MODE_COFDM_2K;
break; }
8856 case TUNE_MODE_COFDM_4K: {tmode = MODE_COFDM_4K;
break; }
8857 case TUNE_MODE_COFDM_8K: {tmode = MODE_COFDM_8K;
break; }
8858 case TUNE_MODE_COFDM_16K: {tmode = MODE_COFDM_16K;
break; }
8859 case TUNE_MODE_COFDM_32K: {tmode = MODE_COFDM_32K;
break; }
8860 default: {tmode = MODE_COFDM_UNDEFINED;
break; }
8862 if (t_ptr->u.terr.tmode != tmode)
8864 t_ptr->u.terr.tmode = tmode;
8870 case TUNE_TBWIDTH_8MHZ: {bwidth = TBWIDTH_8MHZ;
break; }
8871 case TUNE_TBWIDTH_7MHZ: {bwidth = TBWIDTH_7MHZ;
break; }
8872 case TUNE_TBWIDTH_6MHZ: {bwidth = TBWIDTH_6MHZ;
break; }
8873 default: {bwidth = 0;
break; }
8875 if (t_ptr->u.terr.bwidth != bwidth)
8877 t_ptr->u.terr.bwidth = bwidth;
8883 case TUNE_SYSTEM_TYPE_DVBT2: {terr_type = TERR_TYPE_DVBT2;
break; }
8884 case TUNE_SYSTEM_TYPE_DVBT: {terr_type = TERR_TYPE_DVBT;
break; }
8885 default: {terr_type = TERR_TYPE_UNKNOWN;
break; }
8888 if (t_ptr->u.terr.terr_type != terr_type)
8890 t_ptr->u.terr.terr_type = terr_type;
8900 srate = srate / 1000;
8901 DBDEF_SetCableTransportSymbolRate(t_ptr, (U16BIT)srate);
8906 case TUNE_MODE_QAM_4: {cmode = MODE_QAM_4;
break; }
8907 case TUNE_MODE_QAM_8: {cmode = MODE_QAM_8;
break; }
8908 case TUNE_MODE_QAM_16: {cmode = MODE_QAM_16;
break; }
8909 case TUNE_MODE_QAM_32: {cmode = MODE_QAM_32;
break; }
8910 case TUNE_MODE_QAM_64: {cmode = MODE_QAM_64;
break; }
8911 case TUNE_MODE_QAM_128: {cmode = MODE_QAM_128;
break; }
8912 case TUNE_MODE_QAM_256: {cmode = MODE_QAM_256;
break; }
8913 default: {cmode = MODE_QAM_AUTO;
break; }
8916 DBDEF_SetCableTransportMode(t_ptr, cmode);
8924 srate = srate / 1000;
8926 if (t_ptr->u.sat.symbol_rate != srate)
8928 t_ptr->u.sat.symbol_rate = (U16BIT)srate;
8946 DBA_SetFieldValue(t_ptr->dba_rec, DBA_FIELD_TRAN_SIGNAL_STRENGTH, sig_strength);
8950 current_transport_rec[path]->signal_level_at_search = GET_SIGNAL_STATUS(sig_quality, sig_strength);
8952 current_transport_rec[path]->available = TRUE;
8959 FUNCTION_FINISH(UpdateTransportParameters);
8973 static void CancelTableRequests(U8BIT path, BOOLEAN this_path_only)
8975 if (!this_path_only && (rct_filter[path] != NULL))
8978 rct_filter[path] = NULL;
8980 if (current_service_rec[path] != NULL)
8985 if (!this_path_only && (cat_filter[path] != NULL))
8988 cat_filter[path] = NULL;
8989 cat_start_timestamp[path] = 0;
8991 if (pat_filter[path] != NULL)
8994 pat_filter[path] = NULL;
8995 pat_start_timestamp[path] = 0;
8997 if (pmt_filter[path] != NULL)
9000 pmt_filter[path] = NULL;
9001 pmt_start_timestamp[path] = 0;
9003 if (pmt_list[path] != NULL)
9006 pmt_list[path] = NULL;
9007 num_pmt_list_entries[path] = 0;
9009 if (!this_path_only && (nit_filter[path] != NULL))
9012 nit_filter[path] = NULL;
9013 nit_start_timestamp[path] = 0;
9015 if (!this_path_only && (sdt_filter[path] != NULL))
9018 sdt_filter[path] = NULL;
9019 sdt_start_timestamp[path] = 0;
9021 if (!this_path_only && (eit_list[path] != NULL))
9024 eit_list[path] = NULL;
9025 num_eit_list_entries[path] = 0;
9027 if (eit_filter[path] != NULL)
9030 eit_filter[path] = NULL;
9031 eit_start_timestamp[path] = 0;
9033 if (!this_path_only && (sched_filter[path] != NULL))
9036 sched_filter[path] = NULL;
9037 sched_start_timestamp[path] = 0;
9039 if (!this_path_only && (tot_filter[path] != NULL))
9042 tot_filter[path] = NULL;
9043 tot_start_timestamp[path] = 0;
9045 if (!this_path_only && (tdt_filter[path] != NULL))
9048 tdt_filter[path] = NULL;
9049 tdt_start_timestamp[path] = 0;
9051 if (bat_filter[path] != NULL)
9054 bat_filter[path] = NULL;
9055 bat_start_timestamp[path] = 0;
9057 if (ait_filter[path] != NULL)
9060 ait_filter[path] = NULL;
9063 if (!this_path_only)
9066 report_pmt_allowed[path] = FALSE;
9067 pmt_reported[path] = FALSE;
9068 si_update_delay_timestamp[path] = 0;
9071 pmt_update_timestamp[path] = 0;
9087 static BOOLEAN ManageDvbSsuSearch(U8BIT path, U32BIT event,
SI_TABLE_RECORD *table_rec)
9090 U16BIT onet_id, tran_id, serv_id;
9092 FUNCTION_START(ManageDvbSsuSearch);
9095 if (event == APP_SI_START_MANAGER)
9100 if (current_transport_rec[path] != NULL)
9102 #ifdef DEBUG_SI_DVB_SSU_SEARCH 9103 AP_SI_PRINT((
"DVB SSU search: start (%s)",
9108 current_network_rec[path] = current_transport_rec[path]->network;
9109 current_service_rec[path] = NULL;
9114 if (active_network_id == 0)
9116 nit_filter[path] =
STB_SIRequestNit(path, ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_NIT_RECEIVED);
9121 ReceiveSiTable, APP_SI_NIT_RECEIVED);
9126 #ifdef DEBUG_SI_DVB_SSU_SEARCH 9127 AP_SI_PRINT((
"DVB SSU search: start - failed, no transport"));
9134 else if (event == APP_SI_STOP_MANAGER)
9136 #ifdef DEBUG_SI_DVB_SSU_SEARCH 9137 AP_SI_PRINT((
"DVB SSU search: stop"));
9139 CancelTableRequests(path, FALSE);
9146 case APP_SI_NIT_RECEIVED:
9148 #ifdef DEBUG_SI_DVB_SSU_SEARCH 9149 AP_SI_PRINT((
"DVB SSU search: NIT received (nid 0x%04x)", table_rec->xtid));
9152 ProcessNitTable(table_rec, DB_ACCESS_UPDATE, TRUE, TRUE);
9156 nit_filter[path] = NULL;
9157 nit_start_timestamp[path] = 0;
9160 CancelTableRequests(path, FALSE);
9166 #ifdef DEBUG_SI_DVB_SSU_SEARCH 9167 AP_SI_PRINT((
"DVB SSU search: possible OTA update found, search succeeded"));
9174 #ifdef DEBUG_SI_DVB_SSU_SEARCH 9175 AP_SI_PRINT((
"DVB SSU search: no OTA update found, search failed"));
9182 case APP_SI_NIT_TIMEOUT:
9184 #ifdef DEBUG_SI_DVB_SSU_SEARCH 9185 AP_SI_PRINT((
"DVB_SSU search: NIT timeout"));
9190 nit_filter[path] = NULL;
9191 nit_start_timestamp[path] = 0;
9194 #ifdef DEBUG_SI_DVB_SSU_SEARCH 9195 AP_SI_PRINT((
"DVB SSU search: search failed"));
9198 CancelTableRequests(path, FALSE);
9206 FUNCTION_FINISH(ManageDvbSsuSearch);
9227 FUNCTION_START(CopyLinkageDesc);
9230 if (desc_ptr != NULL)
9232 desc_ptr->next = NULL;
9233 desc_ptr->tran_id = new_list_ptr->tran_id;
9234 desc_ptr->orig_net_id = new_list_ptr->orig_net_id;
9235 desc_ptr->serv_id = new_list_ptr->serv_id;
9236 desc_ptr->link_type = new_list_ptr->link_type;
9237 desc_ptr->data_length = new_list_ptr->data_length;
9239 if (new_list_ptr->data_length != 0)
9241 memcpy(&(desc_ptr->data), &(new_list_ptr->data), new_list_ptr->data_length);
9245 if (*last_entry_ptr == NULL)
9248 *list_ptr = desc_ptr;
9253 (*last_entry_ptr)->next = desc_ptr;
9255 *last_entry_ptr = desc_ptr;
9256 (*num_linkage_desc)++;
9259 AP_SI_PRINT((
" AP_SI---- Linkage desc: tid=0x%04x, onid=0x%04x, sid=0x%04x, type=%d, dlen=%d",
9260 desc_ptr->tran_id, desc_ptr->orig_net_id, desc_ptr->serv_id,
9261 desc_ptr->link_type, desc_ptr->data_length));
9265 FUNCTION_FINISH(CopyLinkageDesc);
9277 FUNCTION_START(DeleteLinkageDescripterArray);
9279 desc_ptr = list_ptr;
9280 while (desc_ptr != NULL)
9282 tmp_ptr = desc_ptr->next;
9287 FUNCTION_FINISH(DeleteLinkageDescripterArray);
9305 U16BIT *tid_ptr, U16BIT *sid_ptr)
9310 U8BIT *oui_loop_end;
9314 FUNCTION_START(CheckSsuLinkageDescForUpgrade);
9316 ASSERT(desc_ptr != NULL);
9317 ASSERT(onid_ptr != NULL);
9318 ASSERT(tid_ptr != NULL);
9319 ASSERT(sid_ptr != NULL);
9321 #ifdef DEBUG_DVB_SSU 9322 AP_SI_PRINT((
" DVB SSU link desc 0x%04x/0x%04x/0x%04x len %d",
9323 desc_ptr->orig_net_id, desc_ptr->tran_id, desc_ptr->serv_id, desc_ptr->data_length));
9329 data_ptr = &(desc_ptr->data);
9330 oui_loop_len = data_ptr[0];
9332 oui_loop_end = data_ptr + oui_loop_len;
9333 while (data_ptr < oui_loop_end)
9335 memcpy(oui, data_ptr, 3);
9336 selector_len = data_ptr[3];
9338 #ifdef DEBUG_DVB_SSU 9339 AP_SI_PRINT((
" OUI=0x%02x%02x%02x", oui[0], oui[1], oui[2]));
9341 if ((memcmp(oui, dvb_oui, 3) == 0) ||
9344 *onid_ptr = desc_ptr->orig_net_id;
9345 *tid_ptr = desc_ptr->tran_id;
9346 *sid_ptr = desc_ptr->serv_id;
9347 #ifdef DEBUG_DVB_SSU 9348 AP_SI_PRINT((
" DVB SSU: upgrade service detected, onid=0x%x, tid=0x%x, sid=0x%x",
9349 *onid_ptr, *tid_ptr, *sid_ptr));
9355 data_ptr += selector_len;
9358 FUNCTION_FINISH(CheckSsuLinkageDescForUpgrade);
9371 U8BIT path, num_paths;
9378 current_manager = (F_SIManager *)
STB_AppGetMemory(
sizeof(F_SIManager) * num_paths);
9379 required_si_mode = (E_APP_SI_MODE *)
STB_AppGetMemory(
sizeof(E_APP_SI_MODE) * num_paths);
9399 pat_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9400 pmt_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9401 nit_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9402 sdt_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9403 bat_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9404 eit_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9405 sched_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9407 tot_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9408 tdt_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9409 si_update_delay_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9410 pmt_update_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9411 cat_start_timestamp = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9413 pmt_update_period_ms = (U32BIT *)
STB_AppGetMemory(
sizeof(U32BIT) * num_paths);
9425 tot_already_received = (BOOLEAN *)
STB_AppGetMemory(
sizeof(BOOLEAN) * num_paths);
9426 pat_rcvd_on_this_trnsprt = (BOOLEAN *)
STB_AppGetMemory(
sizeof(BOOLEAN) * num_paths);
9428 num_pmt_list_entries = (U16BIT *)
STB_AppGetMemory(
sizeof(U16BIT) * num_paths);
9430 pmt_service_changed = (BOOLEAN *)
STB_AppGetMemory(
sizeof(BOOLEAN) * num_paths);
9431 report_pmt_allowed = (BOOLEAN *)
STB_AppGetMemory(
sizeof(BOOLEAN) * num_paths);
9433 stop_pmt_reporting = (BOOLEAN *)
STB_AppGetMemory(
sizeof(BOOLEAN) * num_paths);
9434 pmt_request_mode = (E_PMT_REQUEST_MODE *)
STB_AppGetMemory(
sizeof(E_PMT_REQUEST_MODE) * num_paths);
9436 num_eit_list_entries = (U16BIT *)
STB_AppGetMemory(
sizeof(U16BIT) * num_paths);
9438 service_list_ready = (BOOLEAN *)
STB_AppGetMemory(
sizeof(BOOLEAN) * num_paths);
9439 last_reported_cat_version = (S16BIT *)
STB_AppGetMemory(
sizeof(S16BIT) * num_paths);
9440 last_reported_nit_version = (S16BIT *)
STB_AppGetMemory(
sizeof(S16BIT) * num_paths);
9441 last_reported_pmt_version = (U8BIT *)
STB_AppGetMemory(
sizeof(U8BIT) * num_paths);
9443 for (path = 0; path < num_paths; path++)
9445 current_manager[path] = NULL;
9446 required_si_mode[path] = STOP_SI;
9447 current_network_rec[path] = NULL;
9448 current_transport_rec[path] = NULL;
9449 current_service_rec[path] = NULL;
9450 last_transport_rec[path] = NULL;
9452 sched_filter[path] = NULL;
9453 eit_filter[path] = NULL;
9454 pat_filter[path] = NULL;
9455 pmt_filter[path] = NULL;
9456 nit_filter[path] = NULL;
9457 sdt_filter[path] = NULL;
9458 bat_filter[path] = NULL;
9459 tot_filter[path] = NULL;
9460 tdt_filter[path] = NULL;
9461 cat_filter[path] = NULL;
9462 rct_filter[path] = NULL;
9463 ait_filter[path] = NULL;
9465 pat_start_timestamp[path] = 0;
9466 pmt_start_timestamp[path] = 0;
9467 nit_start_timestamp[path] = 0;
9468 sdt_start_timestamp[path] = 0;
9469 bat_start_timestamp[path] = 0;
9470 eit_start_timestamp[path] = 0;
9471 sched_start_timestamp[path] = 0;
9472 sched_timeout_ms[path] = 0;
9473 tot_start_timestamp[path] = 0;
9474 tdt_start_timestamp[path] = 0;
9475 si_update_delay_timestamp[path] = 0;
9476 pmt_update_timestamp[path] = 0;
9477 cat_start_timestamp[path] = 0;
9478 pmt_update_period_ms[path] = 0;
9479 last_timestamp[path] = 0;
9481 pmt_list_id[path] = 0;
9483 sdt_complete[path] = FALSE;
9484 bat_complete[path] = FALSE;
9485 nit_complete[path] = FALSE;
9486 pmts_complete[path] = FALSE;
9487 eits_complete[path] = FALSE;
9488 tot_complete[path] = FALSE;
9490 tot_already_received[path] = FALSE;
9491 pat_rcvd_on_this_trnsprt[path] = FALSE;
9492 pmt_list[path] = NULL;
9493 num_pmt_list_entries[path] = 0;
9494 pmt_filter_pid[path] = 0;
9495 pmt_service_changed[path] = FALSE;
9496 report_pmt_allowed[path] = FALSE;
9497 pmt_reported[path] = FALSE;
9498 stop_pmt_reporting[path] = FALSE;
9499 pmt_request_mode[path] = PMT_REQUEST_MONITOR;
9500 eit_list[path] = NULL;
9501 num_eit_list_entries[path] = 0;
9503 service_list_ready[path] = FALSE;
9504 last_reported_cat_version[path] = -1;
9505 last_reported_nit_version[path] = -1;
9506 last_reported_pmt_version[path] = 0;
9509 required_service_type = SEARCH_SERVICE_TYPE_ALL;
9513 eit_schedule_limit = (U16BIT)
APP_NvmRead(EIT_SCHED_LIMIT_NVM);
9520 use_bats_active = FALSE;
9521 active_bouquet_ids = NULL;
9522 num_active_bouquet_ids = 0;
9524 active_network_id = 0;
9536 FUNCTION_START(APP_SetAppSiMode);
9540 required_si_mode[path] = si_mode;
9543 FUNCTION_FINISH(APP_SetAppSiMode);
9562 return(service_list_ready[path]);
9582 if (path != INVALID_RES_ID && pmt_list[path] != NULL)
9584 for (i = 0; i < num_pmt_list_entries[path]; i++)
9586 if ((pmt_list[path][i].serv_id == serv_id) &&
9587 ((ts_id == ADB_INVALID_DVB_ID) || (pmt_list[path][i].ts_id == ts_id)) &&
9588 ((on_id == ADB_INVALID_DVB_ID) || (pmt_list[path][i].on_id == on_id)))
9590 pid = pmt_list[path][i].pid;
9608 stop_pmt_reporting[path] = TRUE;
9621 return(pmt_reported[path]);
9639 if (standby_state == TRUE)
9643 for (i = 0; i < num_paths; i++)
9645 last_transport_rec[i] = NULL;
9665 U16BIT *tid_ptr, U16BIT *sid_ptr)
9669 U16BIT onid, tsid, sid;
9674 if (network != NULL)
9680 if (prev_location != NULL)
9683 for (desc_ptr = n_ptr->linkage_desc_list; desc_ptr != NULL; desc_ptr = desc_ptr->next)
9685 if (desc_ptr == prev_location)
9687 desc_ptr = desc_ptr->next;
9695 desc_ptr = n_ptr->linkage_desc_list;
9698 for ( ; desc_ptr != NULL; desc_ptr = desc_ptr->next)
9700 if (CheckSsuLinkageDescForUpgrade(desc_ptr, &onid, &tsid, &sid))
9732 ssu_refused = refuse;
9742 dvb_ssu_mandatory = mandatory;
9754 return dvb_ssu_mandatory;
9767 BOOLEAN service_change;
9772 service_change = FALSE;
9778 while (!service_change && (t_ptr != NULL))
9780 if ((tuner_type == SIGNAL_NONE) || (t_ptr->sig_type == tuner_type))
9782 service_change = t_ptr->sdt_version_changed;
9783 if (!service_change && (t_ptr->network != NULL))
9785 service_change = t_ptr->network->nit_version_changed;
9796 return(service_change);
9810 if (cat_filter[path] != NULL)
9815 last_reported_cat_version[path] = -1;
9832 if (nit_filter[path] != NULL)
9837 last_reported_nit_version[path] = -1;
9854 if (sdt_filter[path] != NULL)
9874 if (bat_filter[path] != NULL)
9894 if (tot_filter[path] != NULL)
9914 if (tdt_filter[path] != NULL)
9930 required_service_type = service_type;
9941 U8BIT i, index = MAX_PMT_PRIORITY_LIST - 1;
9947 for (i = 0; i < MAX_PMT_PRIORITY_LIST; i++)
9949 if (pmt_priority_list[i] == service_id)
9958 for (i = index; i > 0; i--)
9960 pmt_priority_list[i] = pmt_priority_list[i - 1];
9963 pmt_priority_list[0] = service_id;
9976 U8BIT i, index = MAX_PMT_PRIORITY_LIST;
9982 for (i = 0; i < MAX_PMT_PRIORITY_LIST; i++)
9984 if (pmt_priority_list[i] == service_id)
9991 if (index < MAX_PMT_PRIORITY_LIST)
9993 for (i = index; i < MAX_PMT_PRIORITY_LIST - 1; i++)
9995 pmt_priority_list[i] = pmt_priority_list[i + 1];
9998 pmt_priority_list[MAX_PMT_PRIORITY_LIST - 1] = INVALID_SERVICE_ID;
10017 for (i = 0; i < MAX_PMT_PRIORITY_LIST; i++)
10019 pmt_priority_list[i] = INVALID_SERVICE_ID;
10044 pmt_size = ((pmt_data[1] & 0x0f) << 8) + pmt_data[2];
10049 sect->sect_num = 0;
10050 sect->data_len = pmt_size;
10051 memcpy(§->data_start, pmt_data, pmt_size);
10053 table_rec.path = path;
10054 table_rec.tid = pmt_data[0];
10055 table_rec.version = pmt_data[5] & 0x1f;
10056 table_rec.xtid = (pmt_data[3] << 8) + pmt_data[4];
10057 table_rec.num_sect = 1;
10058 table_rec.section_list = sect;
10062 InternalProcessPmtTable(path, (
ADB_SERVICE_REC *)s_ptr, &table_rec, FALSE, DB_ACCESS_UPDATE);
10067 #ifdef COMMON_INTERFACE 10087 eit_schedule_limit = limit_hours;
10088 APP_NvmSave(EIT_SCHED_LIMIT_NVM, eit_schedule_limit, TRUE);
10101 return(eit_schedule_limit);
10118 if (active_bouquet_ids != NULL)
10122 active_bouquet_ids = NULL;
10123 num_active_bouquet_ids = 0;
10126 use_bats_active = use_bats;
10128 if (use_bats && (bouquet_ids != NULL) && (num_ids > 0))
10132 if (active_bouquet_ids != NULL)
10134 num_active_bouquet_ids = num_ids;
10135 for (i = 0; i < num_ids; i++)
10137 active_bouquet_ids[i].bouquet_id = bouquet_ids[i];
10138 active_bouquet_ids[i].received = FALSE;
10160 #ifdef DEBUG_SI_UPDATE 10161 AP_SI_PRINT((
"%s(%u, standard_pids=%u)", __FUNCTION__, path, use_standard_pids));
10164 if ((path != INVALID_RES_ID) && (current_service_rec[path] != NULL))
10166 if (sdt_filter[path] != NULL)
10169 sdt_filter[path] = NULL;
10170 sdt_start_timestamp[path] = 0;
10173 if (use_standard_pids)
10175 #ifdef DEBUG_SI_UPDATE 10176 AP_SI_PRINT((
"Update(%d): requesting SDT", path));
10178 sdt_start_timestamp[path] = 0;
10179 sdt_filter[path] =
STB_SIRequestSdt(path, CONTINUOUS_REQUEST, TRUE, TRUE, DONT_CARE_ID_MATCH,
10180 DONT_CARE_ID_MASK, 1, ReceiveSiTable, APP_SI_SDT_RECEIVED);
10182 else if (current_service_rec[path]->sdt_pid != 0)
10184 #ifdef DEBUG_SI_UPDATE 10185 AP_SI_PRINT((
"Update(%d): requesting SDT on PID %u", path, current_service_rec[path]->sdt_pid));
10187 sdt_start_timestamp[path] = 0;
10189 CONTINUOUS_REQUEST, TRUE, TRUE, DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 1,
10190 ReceiveSiTable, APP_SI_SDT_RECEIVED);
10193 if (tdt_filter[path] != NULL)
10196 tdt_filter[path] = NULL;
10197 tdt_start_timestamp[path] = 0;
10200 if (use_standard_pids)
10202 #ifdef DEBUG_SI_UPDATE 10203 AP_SI_PRINT((
"Update(%d): requesting TDT", path));
10205 tdt_start_timestamp[path] = 0;
10206 tdt_filter[path] =
STB_SIRequestTdt(path, ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_TDT_RECEIVED);
10208 else if (current_service_rec[path]->tdt_pid != 0)
10210 #ifdef DEBUG_SI_UPDATE 10211 AP_SI_PRINT((
"Update(%d): requesting TDT on PID %u", path, current_service_rec[path]->tdt_pid));
10213 tdt_start_timestamp[path] = 0;
10215 ONE_SHOT_REQUEST, ReceiveSiTable, APP_SI_TDT_RECEIVED);
10218 if (tot_filter[path] != NULL)
10221 tot_filter[path] = NULL;
10222 tot_start_timestamp[path] = 0;
10225 if (use_standard_pids)
10227 #ifdef DEBUG_SI_UPDATE 10228 AP_SI_PRINT((
"Update(%d): requesting TOT", path));
10230 tot_start_timestamp[path] = 0;
10231 tot_filter[path] =
STB_SIRequestTot(path, CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_TOT_RECEIVED);
10233 else if (current_service_rec[path]->tot_pid != 0)
10235 #ifdef DEBUG_SI_UPDATE 10236 AP_SI_PRINT((
"Update(%d): requesting TOT on PID %u", path, current_service_rec[path]->tot_pid));
10238 tot_start_timestamp[path] = 0;
10240 CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_TOT_RECEIVED);
10243 if (nit_filter[path] != NULL)
10246 nit_filter[path] = NULL;
10247 nit_start_timestamp[path] = 0;
10250 if (use_standard_pids)
10252 #ifdef DEBUG_SI_UPDATE 10253 AP_SI_PRINT((
"Update(%d): requesting NIT", path));
10255 nit_start_timestamp[path] = 0;
10257 if (active_network_id == 0)
10259 nit_filter[path] =
STB_SIRequestNit(path, CONTINUOUS_REQUEST, ReceiveSiTable,
10260 APP_SI_NIT_RECEIVED);
10265 ReceiveSiTable, APP_SI_NIT_RECEIVED);
10268 else if (current_service_rec[path]->nit_pid != 0)
10270 #ifdef DEBUG_SI_UPDATE 10271 AP_SI_PRINT((
"Update(%d): requesting NIT on PID %u", path, current_service_rec[path]->nit_pid));
10273 nit_start_timestamp[path] = 0;
10275 FALSE, CONTINUOUS_REQUEST, ReceiveSiTable, APP_SI_NIT_RECEIVED);
10278 if (eit_filter[path] != NULL)
10281 eit_filter[path] = NULL;
10282 eit_start_timestamp[path] = 0;
10285 if (use_standard_pids)
10287 #ifdef DEBUG_SI_UPDATE 10288 AP_SI_PRINT((
"Update(%d): requesting EIT", path));
10290 eit_start_timestamp[path] = 0;
10291 eit_filter[path] =
STB_SIRequestEit(path, CONTINUOUS_REQUEST, EIT_NOW_NEXT_ALL,
10292 DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable, APP_SI_EIT_RECEIVED);
10297 if (current_service_rec[path]->eit_pf_plus_pid != 0)
10299 eit_pid = current_service_rec[path]->eit_pf_plus_pid;
10301 else if (current_service_rec[path]->eit_pf_pid != 0)
10303 eit_pid = current_service_rec[path]->eit_pf_pid;
10308 #ifdef DEBUG_SI_UPDATE 10309 AP_SI_PRINT((
"Update(%d): requesting EIT on PID %u", path, eit_pid));
10311 eit_start_timestamp[path] = 0;
10313 DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable, APP_SI_EIT_RECEIVED);
10317 if (sched_filter[path] != NULL)
10320 sched_filter[path] = NULL;
10321 sched_start_timestamp[path] = 0;
10324 if (use_standard_pids)
10327 StartEITScheduleFilter(path);
10329 else if (current_service_rec[path]->eit_sched_pid != 0)
10331 #ifdef DEBUG_SI_UPDATE 10332 AP_SI_PRINT((
"Update(%d): requesting SCHED on PID %u", path, current_service_rec[path]->eit_sched_pid));
10334 sched_start_timestamp[path] = 0;
10336 CONTINUOUS_REQUEST, EIT_SCHED_ALL, DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 0xffff,
10337 ReceiveSiTable, APP_SI_EIT_RECEIVED);
10340 if (bat_filter[path] != NULL)
10343 bat_filter[path] = NULL;
10344 bat_start_timestamp[path] = 0;
10347 if (use_bats_active)
10349 if (use_standard_pids)
10351 #ifdef DEBUG_SI_UPDATE 10352 AP_SI_PRINT((
"Update(%d): requesting BAT", path));
10354 bat_start_timestamp[path] = 0;
10355 bat_filter[path] =
STB_SIRequestBat(path, CONTINUOUS_REQUEST, DONT_CARE_ID_MATCH,
10356 DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable, APP_SI_BAT_RECEIVED);
10358 else if (current_service_rec[path]->bat_pid != 0)
10360 #ifdef DEBUG_SI_UPDATE 10361 AP_SI_PRINT((
"Update(%d): requesting BAT on PID %u", path, current_service_rec[path]->bat_pid));
10363 bat_start_timestamp[path] = 0;
10365 CONTINUOUS_REQUEST, DONT_CARE_ID_MATCH, DONT_CARE_ID_MASK, 0xffff, ReceiveSiTable,
10366 APP_SI_BAT_RECEIVED);
10382 eit_parser_func = parser_func;
10393 update_bat_func = update_func;
10404 update_eit_func = update_func;
10415 update_nit_func = update_func;
10426 update_pmt_func = update_func;
10437 update_sdt_func = update_func;
10449 ProcessEitTable(table_rec, TRUE, DB_ACCESS_UPDATE, playback);
10462 U32BIT reqd_country_code;
10463 BOOLEAN regions_exist;
10464 U8BIT reqd_region_code;
10470 if (tot_table != NULL)
10472 #ifdef DEBUG_SI_TOT 10473 AP_SI_PRINT((
"TOT table: %02d:%02d:%02d on %d",
10474 tot_table->hrs, tot_table->mins, tot_table->secs, tot_table->date));
10484 &reqd_region_code);
10486 lto_desc_ptr = tot_table->lto_desc_array;
10487 for (i = 0; i < tot_table->num_lto_entries; i++, lto_desc_ptr++)
10489 if (lto_desc_ptr->country_code == reqd_country_code)
10491 if ((regions_exist == FALSE) ||
10492 ((regions_exist == TRUE) && (lto_desc_ptr->region == reqd_region_code)))
10495 lto_desc_ptr->change_hrs,
10496 lto_desc_ptr->change_mins,
10497 lto_desc_ptr->change_secs,
10498 lto_desc_ptr->offset_hrs,
10499 lto_desc_ptr->offset_mins,
10500 lto_desc_ptr->next_offset_hrs,
10501 lto_desc_ptr->next_offset_mins,
10502 lto_desc_ptr->offset_negative);
10511 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_TIME_CHANGED, NULL, 0);
10529 if (tdt_table != NULL)
10531 #ifdef DEBUG_SI_TDT 10532 AP_SI_PRINT((
"TDT table: %02d:%02d:%02d on %d",
10533 tdt_table->hrs, tdt_table->mins, tdt_table->secs, tdt_table->date));
10543 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_TIME_CHANGED, NULL, 0);
10560 eit_sched_update_callback = sched_update_callback;
10579 if ((eit_sched_update_callback != NULL) && (serv_ptr != NULL))
10583 update.type = type;
10588 update.is_sched = TRUE;
10589 update.event_id = event_id;
10591 (*eit_sched_update_callback)(&update);
10609 active_network_id = network_id;
10632 if (signal_type == SIGNAL_NONE)
10634 db_updates_allowed.terrestrial = allow;
10635 db_updates_allowed.cable = allow;
10636 db_updates_allowed.satellite = allow;
10638 else if (signal_type == SIGNAL_COFDM)
10640 db_updates_allowed.terrestrial = allow;
10642 else if (signal_type == SIGNAL_QAM)
10644 db_updates_allowed.cable = allow;
10646 else if (signal_type == SIGNAL_QPSK)
10648 db_updates_allowed.satellite = allow;
10665 if (signal_type == SIGNAL_COFDM)
10667 allowed = db_updates_allowed.terrestrial;
10669 else if (signal_type == SIGNAL_QAM)
10671 allowed = db_updates_allowed.cable;
10673 else if (signal_type == SIGNAL_QPSK)
10675 allowed = db_updates_allowed.satellite;
10696 #ifdef DEBUG_DYNAMIC_UPDATE 10697 AP_SI_PRINT((
"%s: tid 0x%04x, %u LCNs, %u HD LCNs, %u Nordig LCNs", __FUNCTION__, transport->tran_id,
10698 num_lcns, num_hd_lcns, num_nordig_lcns));
10705 if (dyn_ts_ptr != NULL)
10709 dyn_ts_ptr->t_ptr = transport;
10711 dyn_ts_ptr->num_lcns = num_lcns;
10712 dyn_ts_ptr->lcn_array = (
SI_LCN_DESC *)(dyn_ts_ptr + 1);
10715 memcpy(dyn_ts_ptr->lcn_array, lcn_array, num_lcns *
sizeof(
SI_LCN_DESC));
10718 dyn_ts_ptr->num_hd_lcns = num_hd_lcns;
10719 dyn_ts_ptr->hd_lcn_array = dyn_ts_ptr->lcn_array + dyn_ts_ptr->num_lcns;
10720 if (num_hd_lcns != 0)
10722 memcpy(dyn_ts_ptr->hd_lcn_array, hd_lcn_array, num_hd_lcns *
sizeof(
SI_LCN_DESC));
10727 dyn_ts_ptr->num_nordig_lcns = num_nordig_lcns;
10728 dyn_ts_ptr->nordig_lcn_array = nordig_lcn_array;
10730 if (dynamic_update_head == NULL)
10732 dynamic_update_head = dyn_ts_ptr;
10733 dynamic_update_tail = dyn_ts_ptr;
10737 dynamic_update_tail->next = dyn_ts_ptr;
10738 dynamic_update_tail = dyn_ts_ptr;
10752 #ifdef DEBUG_DYNAMIC_UPDATE 10753 AP_SI_PRINT((
"%s: tid 0x%04x, sid 0x%04x, %s", __FUNCTION__, transport->tran_id, service->serv_id,
10754 (check_move ?
"check move" :
"")));
10764 for (dyn_ts_ptr = dynamic_update_head, dyn_s_ptr = NULL; (dyn_ts_ptr != NULL) && (dyn_s_ptr == NULL);
10765 dyn_ts_ptr = dyn_ts_ptr->next)
10767 for (dyn_s_ptr = dyn_ts_ptr->service_head; dyn_s_ptr != NULL; dyn_s_ptr = dyn_s_ptr->next)
10769 if ((dyn_s_ptr->delete_s_ptr != NULL) && (dyn_s_ptr->delete_s_ptr->serv_id == service->serv_id))
10771 #ifdef DEBUG_DYNAMIC_UPDATE 10772 AP_SI_PRINT((
"%s: Found deleted service with the same service ID, tid 0x%04x",
10773 __FUNCTION__, dyn_s_ptr->delete_t_ptr->tran_id));
10777 dyn_s_ptr->add_s_ptr = service;
10778 dyn_s_ptr->add_t_ptr = transport;
10783 if (dyn_s_ptr != NULL)
10794 if (dyn_ts_ptr == NULL)
10797 dyn_ts_ptr = dynamic_update_head;
10798 while ((dyn_ts_ptr != NULL) && (dyn_ts_ptr->t_ptr != transport))
10800 dyn_ts_ptr = dyn_ts_ptr->next;
10803 if (dyn_ts_ptr != NULL)
10807 if (dyn_s_ptr != NULL)
10811 dyn_s_ptr->add_s_ptr = service;
10812 dyn_s_ptr->add_t_ptr = transport;
10815 if (dyn_ts_ptr->service_head == NULL)
10817 dyn_ts_ptr->service_head = dyn_s_ptr;
10818 dyn_ts_ptr->service_tail = dyn_s_ptr;
10822 dyn_ts_ptr->service_tail->next = dyn_s_ptr;
10823 dyn_ts_ptr->service_tail = dyn_s_ptr;
10825 #ifdef DEBUG_DYNAMIC_UPDATE 10826 AP_SI_PRINT((
"%s: New entry for service 0x%04x being added", __FUNCTION__, service->serv_id));
10832 #ifdef DEBUG_DYNAMIC_UPDATE 10833 AP_SI_PRINT((
"%s: Attempt to add service to a transport that isn't in the dynamic update list",
10845 #ifdef DEBUG_DYNAMIC_UPDATE 10846 AP_SI_PRINT((
"%s: tid 0x%04x, sid 0x%04x, %s", __FUNCTION__, transport->tran_id, service->serv_id,
10847 (check_move ?
"check move" :
"")));
10857 for (dyn_ts_ptr = dynamic_update_head, dyn_s_ptr = NULL; (dyn_ts_ptr != NULL) && (dyn_s_ptr == NULL);
10858 dyn_ts_ptr = dyn_ts_ptr->next)
10860 for (dyn_s_ptr = dyn_ts_ptr->service_head; dyn_s_ptr != NULL; dyn_s_ptr = dyn_s_ptr->next)
10862 if ((dyn_s_ptr->add_s_ptr != NULL) && (dyn_s_ptr->add_s_ptr->serv_id == service->serv_id))
10864 #ifdef DEBUG_DYNAMIC_UPDATE 10865 AP_SI_PRINT((
"%s: Found added service with the same service ID, tid 0x%04x",
10866 __FUNCTION__, dyn_s_ptr->add_t_ptr->tran_id));
10870 dyn_s_ptr->delete_s_ptr = service;
10871 dyn_s_ptr->delete_t_ptr = transport;
10876 if (dyn_s_ptr != NULL)
10887 if (dyn_ts_ptr == NULL)
10890 dyn_ts_ptr = dynamic_update_head;
10891 while ((dyn_ts_ptr != NULL) && (dyn_ts_ptr->t_ptr != transport))
10893 dyn_ts_ptr = dyn_ts_ptr->next;
10896 if (dyn_ts_ptr != NULL)
10900 if (dyn_s_ptr != NULL)
10904 dyn_s_ptr->delete_s_ptr = service;
10905 dyn_s_ptr->delete_t_ptr = transport;
10908 if (dyn_ts_ptr->service_head == NULL)
10910 dyn_ts_ptr->service_head = dyn_s_ptr;
10911 dyn_ts_ptr->service_tail = dyn_s_ptr;
10915 dyn_ts_ptr->service_tail->next = dyn_s_ptr;
10916 dyn_ts_ptr->service_tail = dyn_s_ptr;
10922 #ifdef DEBUG_DYNAMIC_UPDATE 10923 AP_SI_PRINT((
"%s: Attempt to delete service from a transport that isn't in the dynamic update list",
10930 static void ApplyDynamicUpdates(U8BIT path)
10932 BOOLEAN sdts_received;
10939 if (dynamic_update_head != NULL)
10944 sdts_received = TRUE;
10946 for (dyn_ts_ptr = dynamic_update_head; (dyn_ts_ptr != NULL) && sdts_received;
10947 dyn_ts_ptr = dyn_ts_ptr->next)
10949 sdts_received = dyn_ts_ptr->t_ptr->sdt_received;
10959 for (dyn_ts_ptr = dynamic_update_head; dyn_ts_ptr != NULL; dyn_ts_ptr = dyn_ts_ptr->next)
10961 #ifdef DEBUG_DYNAMIC_UPDATE 10962 AP_SI_PRINT((
"%s: Apply updates for transport 0x%04x", __FUNCTION__, dyn_ts_ptr->t_ptr->tran_id));
10965 for (dyn_s_ptr = dyn_ts_ptr->service_head; dyn_s_ptr != NULL; dyn_s_ptr = dyn_s_ptr->next)
10968 if ((dyn_s_ptr->add_s_ptr != NULL) && (dyn_s_ptr->delete_s_ptr == NULL))
10970 #ifdef DEBUG_DYNAMIC_UPDATE 10971 AP_SI_PRINT((
"%s: Added service 0x%04x to transport 0x%04x", __FUNCTION__,
10972 dyn_s_ptr->add_s_ptr->serv_id, dyn_s_ptr->add_t_ptr->tran_id));
10975 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_ADDED,
10976 &dyn_s_ptr->add_s_ptr,
sizeof(
void *));
10978 else if ((dyn_s_ptr->add_s_ptr != NULL) && (dyn_s_ptr->delete_s_ptr != NULL))
10984 #ifdef DEBUG_DYNAMIC_UPDATE 10985 AP_SI_PRINT((
"%s: Move service 0x%04x (new sid 0x%04x) from 0x%04x to 0x%04x",
10987 dyn_s_ptr->delete_s_ptr->serv_id, dyn_s_ptr->add_s_ptr->serv_id,
10988 dyn_s_ptr->delete_t_ptr->tran_id, dyn_s_ptr->add_t_ptr->tran_id));
10990 dyn_s_ptr->delete_s_ptr->transport = dyn_s_ptr->add_t_ptr;
10992 if (dyn_s_ptr->delete_s_ptr->dba_rec != NULL)
11004 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_MOVED,
11005 &dyn_s_ptr->delete_s_ptr,
sizeof(
void *));
11008 else if (dyn_s_ptr->delete_s_ptr != NULL)
11012 #ifdef DEBUG_DYNAMIC_UPDATE 11013 AP_SI_PRINT((
"%s: Delete service 0x%04x from transport 0x%04x", __FUNCTION__,
11014 dyn_s_ptr->delete_s_ptr->serv_id, dyn_s_ptr->delete_t_ptr->tran_id));
11017 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_DELETED,
11018 &dyn_s_ptr->delete_s_ptr,
sizeof(dyn_s_ptr->delete_s_ptr));
11025 #ifdef DEBUG_DYNAMIC_UPDATE 11026 AP_SI_PRINT((
"%s: Service 0x%04x on transport 0x%04x is the current service, not deleting",
11027 __FUNCTION__, dyn_s_ptr->delete_s_ptr->serv_id, dyn_s_ptr->delete_t_ptr->tran_id));
11029 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_DELETE_SERVICE,
11030 &dyn_s_ptr->delete_s_ptr,
sizeof(dyn_s_ptr->delete_s_ptr));
11036 if ((dyn_ts_ptr->num_nordig_lcns != 0) && (dyn_ts_ptr->nordig_lcn_array != NULL))
11038 for (i = 0; i < dyn_ts_ptr->num_nordig_lcns; i++)
11040 for (j = 0; j < dyn_ts_ptr->nordig_lcn_array[i].num_services; j++)
11043 dyn_ts_ptr->t_ptr);
11046 if (s_ptr->hidden != !dyn_ts_ptr->nordig_lcn_array[i].serv_array[j].visible)
11048 s_ptr->hidden = !dyn_ts_ptr->nordig_lcn_array[i].serv_array[j].visible;
11050 #ifdef DEBUG_DYNAMIC_UPDATE 11051 AP_SI_PRINT((
"%s: service 0x%04x, hidden flag now %u", __FUNCTION__,
11052 s_ptr->serv_id, s_ptr->hidden));
11056 s_ptr->selectable = TRUE;
11057 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_SELECTABLE, s_ptr->selectable);
11059 reqd_lcn = dyn_ts_ptr->nordig_lcn_array[i].serv_array[j].serv_lcn;
11060 if (reqd_lcn != s_ptr->serv_lcn)
11064 s_ptr->allocated_lcn = 0;
11065 s_ptr->serv_lcn = reqd_lcn;
11067 #ifdef DEBUG_DYNAMIC_UPDATE 11068 AP_SI_PRINT((
"%s: service 0x%04x, LCN %u", __FUNCTION__, s_ptr->serv_id, reqd_lcn));
11079 for (i = 0; i < dyn_ts_ptr->num_lcns; i++)
11085 if (s_ptr->hidden != !dyn_ts_ptr->lcn_array[i].visible)
11087 s_ptr->hidden = !dyn_ts_ptr->lcn_array[i].visible;
11089 #ifdef DEBUG_DYNAMIC_UPDATE 11090 AP_SI_PRINT((
"%s: service 0x%04x, hidden flag now %u", __FUNCTION__,
11091 s_ptr->serv_id, s_ptr->hidden));
11096 s_ptr->selectable = TRUE;
11097 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_SELECTABLE, s_ptr->selectable);
11099 reqd_lcn = dyn_ts_ptr->lcn_array[i].serv_lcn;
11100 if (reqd_lcn != s_ptr->serv_lcn)
11104 s_ptr->allocated_lcn = 0;
11105 s_ptr->serv_lcn = reqd_lcn;
11107 #ifdef DEBUG_DYNAMIC_UPDATE 11108 AP_SI_PRINT((
"%s: service 0x%04x, LCN %u", __FUNCTION__, s_ptr->serv_id, reqd_lcn));
11117 if (dyn_ts_ptr->num_hd_lcns != 0)
11120 for (i = 0; i < dyn_ts_ptr->num_hd_lcns; i++)
11124 if ((s_ptr != NULL) && (s_ptr->old_allocated_lcn == 0))
11129 memcpy(s_ptr->hd_lcn_desc, &dyn_ts_ptr->hd_lcn_array[i],
sizeof(
SI_LCN_DESC));
11130 #ifdef DEBUG_DYNAMIC_UPDATE 11131 AP_SI_PRINT((
"%s: service 0x%04x has an HD LCN, %u", s_ptr->serv_id,
11132 s_ptr->hd_lcn_desc->serv_lcn));
11140 ClearDynamicUpdates();
11154 static void ClearDynamicUpdates(
void)
11159 #ifdef DEBUG_DYNAMIC_UPDATE 11160 AP_SI_PRINT((
"%s", __FUNCTION__));
11163 for ( ; dynamic_update_head != NULL; dynamic_update_head = next_ts_ptr)
11165 next_ts_ptr = dynamic_update_head->next;
11167 for ( ; dynamic_update_head->service_head != NULL; dynamic_update_head->service_head = next_s_ptr)
11169 next_s_ptr = dynamic_update_head->service_head->next;
11174 if (dynamic_update_head->nordig_lcn_array != NULL)
11177 dynamic_update_head->num_nordig_lcns);
11183 dynamic_update_tail = NULL;
BOOLEAN STB_CADescramblerRequiredForPlayback(U16BIT *ca_ids, U16BIT num_ca_ids)
This function works out whether a CA descrambler is required to playback a recording with one of the ...
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...
void DBDEF_SetTunedTransport(U8BIT path, ADB_TRANSPORT_REC *t_ptr)
sets the currently tuned transport
Application level CI control functions.
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.
BOOLEAN STB_SIReportCat(SI_TABLE_RECORD *table_rec)
Reports the CAT has been received so it can be passed on to other modules.
BOOLEAN ADB_AddServiceToFavouriteList(U8BIT list_id, void *serv_ptr, S16BIT index)
Adds the given service to the favourite list defined by list_id, with the service being optionally ad...
void * APVR_GetPlaybackService(void)
A service instance is associated to the playback, this function returns its pointer. The handle can be used, for example, to call ADB_ServiceHasSubtitles as it's done for live channels.
void * STB_SIRequestNitWithId(U8BIT path, U16BIT network_id, E_SI_REQUEST_TYPE req_type, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for NITactual and NITother for the given network ID.
void * STB_SIRequestAit(U8BIT path, E_SI_REQUEST_TYPE req_type, U16BIT ait_pid, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for AIT on given PID.
U8BIT STB_TuneGetDataIntegrity(U8BIT path)
Returns the current data integrity.
void * STB_GetMemory(U32BIT bytes)
Attempts to allocate memory from the heap.
void ADB_SaveDatabase(void)
Saves the database to non-volatile memory.
void DBDEF_DeleteEventList(ADB_EVENT_REC *elist)
Deletes all events in the given list.
macros and function prototypes for public use
void ASI_InitialiseAppSi(void)
Initialises application SI handling.
void ASI_SetEITScheduleLimit(U16BIT limit_hours)
Sets the number of hours of EIT data that's kept for each service that hasn't its had EIT schedule di...
U8BIT STB_DPGetPathCISlot(U8BIT path)
Returns the CI slot id associated with the given path.
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...
void STB_SIReleaseBatTable(SI_BAT_TABLE *bat_table)
Frees the memory used by the bat table.
void * ADB_GetServiceTransportPtr(void *s_ptr)
Returns a pointer to the service's parent transport record.
void * STB_SIRequestEitFromPid(U8BIT path, U16BIT pid, E_SI_REQUEST_TYPE req_type, E_SI_EIT_TABLE_REQ reqd_eit_tables, U16BIT sid_match, U16BIT sid_mask, U16BIT table_count, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for EIT.
void ASI_RestartTotFilter(U8BIT path)
Forces the SI demux filter collecting the TOT tables to be reset, so a previously processed versions ...
BOOLEAN ACFG_GetDynamicSIUpdate(E_STB_DP_SIGNAL_TYPE signal_type, U16BIT onet_id, E_ACFG_DYNAMIC_SI_UPDATE_TYPE update_type)
Use to check whether a dynamic SI update is enabled for the currently configured country and given si...
U8BIT * STB_HWGetOUI(void)
Returns the number of smart card slots on the platorm.
BOOLEAN ACI_IsTrustedPath(U8BIT path)
The given decode path is only trusted if it doesn't include a CI slot or the CI slot contains a CI+ C...
void STB_GCSetGMTDate(U16BIT code)
Sets current GMT date.
void * STB_SIRequestTotFromPid(U8BIT path, U16BIT pid, E_SI_REQUEST_TYPE req_type, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for TOT.
BOOLEAN DBA_SaveDatabase(void)
Saves any changes made to the working database to non-volatile storage. If saving to a file...
void * ASI_GetNextOTALocation(void *network, void *prev_location, U16BIT *onid_ptr, U16BIT *tid_ptr, U16BIT *sid_ptr)
Returns the DVB triplet for the next location containing a possible OTA update.
BOOLEAN STB_DPIsLivePath(U8BIT path)
Is the given decode path being used for live viewing.
void STB_SIReleaseRctTable(SI_RCT_TABLE *rct_table)
Frees memory used by an RCT table.
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.
SI_NIT_TABLE * STB_SIParseNitTable(SI_TABLE_RECORD *table_rec)
Parses the Nit table supplied in TABLE_RECORD format to create a NIT_TABLE structure. Returns a pointer to the table. Application must call STB_SIReleaseNitTable to free the data.
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.
BOOLEAN ACA_AcquireCADescrambler(U8BIT path, void *s_ptr)
Acquires a CA descrambler for the given path on the given service if needed. No CA descrambler is acq...
Application configuration.
U16BIT ADB_GetNumServicesInList(U32BIT list_type, BOOLEAN inc_hidden)
Returns the number of services in the database that would be returned with the given list type...
Application database control.
U32DHMS STB_GCNowDHMSGmt(void)
Reads the current GMT date code and time.
E_STB_DP_TUNE_STATUS STB_DPGetTuneStatus(U8BIT path)
Reads the tuning status from decode path store.
U32BIT STB_OSGetClockDiff(U32BIT timestamp)
Get Difference between Given Time and Current Time.
Header file - macros and function prototypes for public use.
void * STB_OSCreateSemaphore(void)
Create a Semaphore.
void * STB_SIRequestNitFromPid(U8BIT path, U16BIT pid, BOOLEAN actual, E_SI_REQUEST_TYPE req_type, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Create an SI filter for an NIT table.
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.
BOOLEAN ADB_ServiceAddImageIcon(void *serv_ptr, void *icon_ptr)
Adds the given image icon to the end of the service's icon list. The icon id is checked and if it mat...
SI_SDT_TABLE * STB_SIParseSdtTable(SI_TABLE_RECORD *table_rec)
Parses the Sdt table supplied in TABLE_RECORD format to create a SDT_TABLE structure. Returns a pointer to the table. Application must call STB_SIReleaseSdtTable to free the data.
U16BIT ASI_GetPmtPid(U16BIT serv_id, U16BIT ts_id, U16BIT on_id)
Returns the PID for the pmt of a given service (on live path)
ADB_TRANSPORT_REC * DBDEF_FindTerrestrialTransportRec(U32BIT freq_hz, U8BIT plp_id)
Find the terrestrial transport record in the database matching the given params.
void ASI_SetUpdateBatFunction(F_BatTableUpdate update_func)
Sets a function that will be called when a BAT table is received.
void * STB_AppGetMemory(U32BIT bytes)
Attempts to allocate memory from the application heap.
void STB_GCSetLocalTimeChange(U16BIT code, U8BIT hour, U8BIT min, U8BIT secs, U8BIT ohour1, U8BIT omin1, U8BIT ohour2, U8BIT omin2, BOOLEAN neg)
Sets new and old local time offset from GMT.
void ASI_SSUSetMandatory(BOOLEAN mandatory)
Sets the flag indicating whether the SSU can be refused by the user.
void STB_SIReleasePmtTable(SI_PMT_TABLE *pmt_table)
Frees the memory used by the pmt table.
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.
void ADB_DeleteFavouriteList(U8BIT list_id)
Deletes the favourite list with the given list id.
Application level CA control functions.
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.
BOOLEAN DBDEF_SetServiceName(ADB_SERVICE_REC *s_ptr, U8BIT *name)
Set or change the name of a service.
void STB_SIReleaseTimeTable(SI_TIME_TABLE *time_table)
Frees the memory used by the time table (tdt or tot)
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.
void ADB_ServiceReleaseRCTLinks(void *serv_ptr)
Frees all RCT link info for the given service.
void ASI_RegisterEitSchedUpdateCallback(F_EitSchedUpdateCB sched_update_callback)
Registers a function that will be called whenever an EIT event is added, updated, deleted or expires ...
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...
void * STB_SIRequestCat(U8BIT path, E_SI_REQUEST_TYPE req_type, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for CAT.
E_STB_TUNE_TBWIDTH STB_TuneGetActualTerrBwidth(U8BIT path)
Returns the actual bandwidth of the current terrestrial signal.
Header file - Function prototypes for A/V control.
void ASI_ProcessPmt(U8BIT path, void *s_ptr, U8BIT *pmt_data)
Takes data for a raw PMT for the given service and processes it as if it had been received from the d...
void STB_OSSemaphoreSignal(void *semaphore)
Signal a Semaphore to Release it by decrementing its counter.
void DBDEF_ReleaseString(ADB_STRING *string)
Releases an ADB_STRING.
void ASI_SetStandbyState(BOOLEAN standby_state)
Performs the neccessary actions for this module when entering/exiting standby according to the value ...
U8BIT STB_DPGetTerrPLP(U8BIT path)
Reads the terrestrial T2 PLP id from decode path store.
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.
U32BIT APP_NvmRead(E_NVM_ITEMS nvm_item)
Returns the current value for the given DVB setting.
U32DHMS STB_GCCreateDHMS(U16BIT date, U8BIT hour, U8BIT mins, U8BIT secs)
Makes U32DHMS formated date/time from date code, hour, minutes, seconds.
void ACI_ProgramMapTableChanged(U8BIT *pmt)
Handle PMT change.
E_STB_DP_POLARITY STB_DPGetPolarity(U8BIT path)
Reads the polarity value from decode path store.
SI_PAT_TABLE * STB_SIParsePatTable(SI_TABLE_RECORD *table_rec)
Parses the Pat table supplied in TABLE_RECORD format to create a PAT_TABLE structure. Returns a pointer to the table. Application must call STB_SIReleasePatTable to free the data.
U8BIT * ADB_GetServicePMTData(void *s_ptr, U16BIT *data_len)
Returns the current PMT data for the given service.
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.
void STB_SIRestartTableRequest(void *filter_handle)
restarts the section filtering on an existing filter without changing and pid or match/mask filter se...
void APP_NvmSave(E_NVM_ITEMS nvm_item, U32BIT new_value, BOOLEAN write_to_flash_now)
Sets the current value for the given DVB setting.
SI_TIME_TABLE * STB_SIParseTimeTable(SI_TABLE_RECORD *table_rec)
Parses the tdt or tot table supplied in TABLE_RECORD format to create a TIME_TABLE structure...
E_STB_TUNE_SYSTEM_TYPE STB_TuneGetSystemType(U8BIT path)
Returns the signal type as set by STB_TuneSetTerrType or as re-written by the driver.
BOOLEAN STB_SIReportNit(SI_TABLE_RECORD *table_rec)
Reports the NIT has been received so it can be passed on to other modules.
BOOLEAN STB_SIReportBat(SI_TABLE_RECORD *table_rec)
Reports the BAT has been received so it can be passed on to other modules.
void ASI_SetEITParserFunction(F_EitParser parser_func)
Sets a function that will be called when parsing an EIT table and a descriptor is found that the stan...
void HBBTV_ProcessAitSection(U16BIT service_id, U8BIT *data, U32BIT nbytes)
Requests the HbbTV engine to process the specified AIT. The HbbTV engine expects the relevant AITs on...
BOOLEAN ASI_DatabaseUpdatesAllowed(E_STB_DP_SIGNAL_TYPE signal_type)
Returns whether service database updates are allowed for the given signal type.
void STB_SIReleaseNordigLcn2DescArray(SI_NORDIG_LCN_DESC *desc_array, U16BIT num_entries)
Frees the memory used by the descriptor array specified.
SI_BAT_TABLE * STB_SIParseBatTable(SI_TABLE_RECORD *table_rec)
Parses the BAT table supplied in TABLE_RECORD format to create a SI_BAT_TABLE structure. Returns a pointer to the table. Application must call STB_SIReleaseBatTable to free the data.
void * STB_SIRequestPat(U8BIT path, E_SI_REQUEST_TYPE req_type, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for PAT.
void ASI_SetAppSiMode(U8BIT path, E_APP_SI_MODE si_mode)
Sets application SI mode - used before STB_DPStartSI() is called.
void ASI_RestartSITables(U8BIT path, BOOLEAN use_standard_pids)
Cancels any existing SI filters and starts a new one for the SDT, TDT, TOT, NIT, EIT (pf...
void STB_OSSemaphoreWait(void *semaphore)
Wait on Semaphore Indefinity or Until Released.
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.
void * STB_SIRequestSdtFromPid(U8BIT path, U16BIT pid, E_SI_REQUEST_TYPE req_type, BOOLEAN inc_sdt_actual, BOOLEAN inc_sdt_other, U16BIT tran_id_match, U16BIT tran_id_mask, U16BIT table_count, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for SDT.
void STB_ERSendEvent(BOOLEAN latched, BOOLEAN repeat, U16BIT path_class, U16BIT type, void *data, U32BIT data_size)
Sends an event to event reporting control module.
E_STB_DP_SIGNAL_TYPE STB_DPGetSignalType(U8BIT path)
Reads the signal type value from decode path store.
void HBBTV_NotifyProgrammeChanged(void)
Notifies the HbbTV engine that the present/following events have changed on the current service...
void * ADB_GetTransportFromIds(U16BIT net_id, U16BIT onet_id, U16BIT tran_id)
Finds the transport with the given ids.
void * STB_SIRequestTdt(U8BIT path, E_SI_REQUEST_TYPE req_type, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for TDT.
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.
BOOLEAN ADB_AddFavouriteList(U8BIT *name, U32BIT user_data, S16BIT index, U8BIT *list_id)
Creates a new favourite list and adds it to the existing lists, if any.
U8BIT STB_DPGetPlaybackPath(void)
Returns the ID of the decode path being used for playback.
U32BIT STB_OSGetClockRTC(void)
Returns the current time in seconds. This is calculated by using the set UTC time and adding the diff...
void STB_SIReleaseTableRecord(SI_TABLE_RECORD *table_rec)
Frees the memory used in a table record passed to the application.
BOOLEAN ASI_PmtReported(U8BIT path)
Returns TRUE if pmt has been reported to third parties.
U8BIT STB_DPGetLivePath(void)
Returns the ID of the decode path being used for live viewing.
void ASI_SetUpdateSdtFunction(F_SdtTableUpdate update_func)
Sets a function that will be called when an SDT table is received.
U8BIT STB_TuneGetSignalStrength(U8BIT path)
Returns the current signal strength.
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 ...
BOOLEAN ASI_CheckServiceListReadyDuringSearch(U8BIT path)
Reports the state of the service_list_ready flag which is set when the sdt has been processed in a se...
void STB_FreeMemory(void *addr)
Releases previously allocated heap memory.
void * STB_SIRequestBatFromPid(U8BIT path, U16BIT pid, E_SI_REQUEST_TYPE req_type, U16BIT tran_id_match, U16BIT tran_id_mask, U16BIT table_count, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for Bat.
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.
void STB_SISearchComplete(U8BIT path, BOOLEAN success, void *event_data, U32BIT data_size)
Indicates SI search is complete.
void STB_SIReportCurrentPmt(U16BIT service_id, SI_TABLE_RECORD *table_rec, BOOLEAN new_serv, BOOLEAN new_pmt_version)
Reports current pmt has arrived so that it can be passed on to interested parties.
void ADB_ReleaseDatabaseSearchData(void)
Frees all data that's only required for service search. This should be called after the search is com...
void * STB_SIRequestPmt(U8BIT path, E_SI_REQUEST_TYPE req_type, U16BIT pmt_pid, U16BIT sid_match, U16BIT sid_mask, U16BIT table_count, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for PMT.
void STB_ReleaseUnicodeString(U8BIT *string)
Releases the specified unicode string, freeing associated heap resources.
U16BIT ADB_GetTransportTid(void *t_ptr)
Returns the transport id of the given transport.
void DBDEF_ReleaseAccess(void)
Releases access to the app's database.
U16BIT ADB_GetServiceLcn(void *s_ptr)
Returns the logical channel number assigned to the given service.
void ASI_RestartCatFilter(U8BIT path)
Forces the SI demux filter collecting the CAT tables to be reset, so a previously processed version o...
void DBDEF_SetTransportOrigNetworkId(ADB_TRANSPORT_REC *t_ptr, U16BIT orig_net_id)
Sets the original network ID of the given transport.
BOOLEAN ACFG_IsNordigCountry(void)
Returns whether the current country requires Nordig compliance for SI.
BOOLEAN STB_DPIsOwnedBy(U8BIT path, E_STB_DP_RES_OWNER owner)
Checks whether the path is owned by the given owner.
void ASI_RestartBatFilter(U8BIT path)
Forces the SI demux filter collecting the BAT tables to be reset, so a previously processed versions ...
Debug functions header file.
Header file - Function prototypes for linked lists.
Header file - macros and function prototypes for public use.
void * ADB_GetTunedTransport(U8BIT path)
Returns the transport that's tuned to on the given decode path.
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...
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.
void * ADB_GetTunedService(U8BIT path)
Returns the tuned service for the given decode path.
void ASI_RemoveServiceFromPmtList(U16BIT service_id)
Removes the service id from the PMT priority list.
BOOLEAN ACI_SetSecureRouting(U8BIT path)
Ensures the TS is routed securely for CI+, either by setting the TS to pass through if a CI slot cont...
U8BIT ACFG_ConvertLangCodeToId(U32BIT lang_code)
Returns the language id for the given language code.
Database access defines, structures and public functions.
BOOLEAN ACTL_AreSubtitlesStarted(void)
Returns whether subtitles have been started, even if they aren't being displayed. ...
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.
Application level CI - internal functions.
void ASI_ClearPmtList(void)
Clears all service ids from the PMT priority list.
void ACI_TuneReply(U8BIT path, U32BIT module, E_CIP_TUNER_STATUS status)
This function is called by the host to send the status of the tune operation to the module...
SI_PMT_TABLE * STB_SIParsePmtTable(SI_TABLE_RECORD *table_rec)
Parses the Pmt table supplied in TABLE_RECORD format to create a PMT_TABLE structure. Returns a pointer to the table. Application must call STB_SIReleasePmtTable to free the data.
Application configuration data.
BOOLEAN ACFG_GetRegionCode(U32BIT country_code, U8BIT region_id, U8BIT *code_ptr)
Returns the region code that identifies the given region.
void STB_SIReleaseSdtTable(SI_SDT_TABLE *sdt_table)
Frees the memory used by the sdt table.
U16BIT ADB_GetTransportOriginalNetworkId(void *t_ptr)
Returns the original network id of the given transport.
U8BIT STB_DPGetPathTuner(U8BIT path)
Returns the tuner ID acquired by the given decode path.
U16BIT ASI_GetEITScheduleLimit(void)
Returns the current setting for the number of hours of EIT data that's kept.
U8BIT APVR_GetPlaybackPath(void)
Returns the path currently acquired fro playback.
Header file - Function prototypes for Event Reporting.
void ASI_RestartNitFilter(U8BIT path)
Forces the SI demux filter collecting the NIT tables to be reset, so a previously processed version o...
void * STB_SIRequestBat(U8BIT path, E_SI_REQUEST_TYPE req_type, U16BIT bouquet_id_match, U16BIT bouquet_id_mask, U16BIT table_count, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for Bat.
void STB_CANotifyRunningStatus(U32BIT handle, U8BIT status)
This function will be called when there's a change to the running status of a service being descrambl...
E_STB_DP_MODULATION STB_DPGetModulation(U8BIT path)
Returns the satellite modulation type for the give decode path.
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.
void DBDEF_SetTunedNetwork(U8BIT path, ADB_NETWORK_REC *n_ptr)
sets the currently tuned network
void ASI_RestartSdtFilter(U8BIT path)
Forces the SI demux filter collecting the SDT tables to be reset, so a previously processed versions ...
void DBDEF_RequestAccess(void)
Requests access to the app's database.
Glue layer between DVB and conditional access systems.
BOOLEAN DBDEF_SetServiceProviderName(ADB_SERVICE_REC *s_ptr, U8BIT *name)
Set or change the name of a service's provider.
void * STB_SIRequestTdtFromPid(U8BIT path, U16BIT pid, E_SI_REQUEST_TYPE req_type, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for TDT.
BOOLEAN ADB_IsFreesatService(void *s_ptr)
Returns a value indicating whether the given service is a Freesat service.
ADB_NETWORK_REC * DBDEF_FindNetworkRec(U16BIT net_id, ADB_SATELLITE_REC *satellite)
Finds the network with the given network ID.
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...
void HBBTV_NotifyServiceListChange(void)
Notifies the HbbTV ending that it must update Service list. This will cause the engine to subsequentl...
SI_RCT_TABLE * STB_SIParseRctTable(SI_TABLE_RECORD *table_rec)
Parses the related content table (RCT) to create an SI_RCT_TABLE structure.
U16BIT ADB_GetServiceId(void *s_ptr)
Returns the signalled service id of the given service.
U32BIT ACFG_GetCountry(void)
Returns the country code the DVB is configured for.
void ASI_SetUpdatePmtFunction(F_PmtTableUpdate update_func)
Sets a function that will be called when a PMT table is received.
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...
application level SI task
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 ASI_RefuseSSU(BOOLEAN refuse)
Sets the flag indicating whether the SSU has been refused or not.
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 * STB_SIRequestSched(U8BIT path, E_SI_REQUEST_TYPE req_type, E_SI_SCHED_TABLE_REQ reqd_eit_tables, U16BIT sid_match, U16BIT sid_mask, U16BIT table_count, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for EIT schedule table.
U16BIT STB_DPGetSymbolRate(U8BIT path)
Reads the symbol rate value from decode path store.
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.
void ASI_AddServiceToPmtList(U16BIT service_id)
Add the given service id to the list of services whose PMT will be requested with a higher priority t...
void * STB_SIRequestRct(U8BIT path, E_SI_REQUEST_TYPE req_type, U16BIT rct_pid, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for RCT on given PID.
ADB_TRANSPORT_REC * DBDEF_GetTunedTransport(U8BIT path)
gets the currently tuned transport
Application level HBBTV callback functions.
U32BIT STB_TuneGetActualSymbolRate(U8BIT path)
Returns the actual symbol rate when a tuner has locked.
void ASI_SetSearchServiceType(E_SEARCH_SERVICE_TYPE service_type)
Set the type for services that should be added during a service search.
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.
void * STB_SIRequestSchedFromPid(U8BIT path, U16BIT pid, E_SI_REQUEST_TYPE req_type, E_SI_SCHED_TABLE_REQ reqd_eit_tables, U16BIT sid_match, U16BIT sid_mask, U16BIT table_count, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for EIT schedule table.
void STB_GCSetGMTTime(U8BIT hour, U8BIT min, U8BIT secs)
Sets current GMT time.
BOOLEAN STB_DPIsRecordingPath(U8BIT path)
Is the given decode path being used for recording.
E_STB_TUNE_CMODE STB_TuneGetActualCableMode(U8BIT path)
Returns the cable mode when the tuner has locked.
void ASI_RestartTdtFilter(U8BIT path)
Forces the SI demux filter collecting the TDT tables to be reset, so a previously processed versions ...
void ASI_SetUpdateEitFunction(F_EitTableUpdate update_func)
Sets a function that will be called when an EIT table is received.
void * STB_SIRequestNit(U8BIT path, E_SI_REQUEST_TYPE req_type, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for NIT(actual)
BOOLEAN ASI_SSUGetMandatory(void)
Returns the flag indicating whether the SSU is mandatory and so can't be refused. ...
BOOLEAN STB_DPGetDVBS2(U8BIT path)
Returns whether the sat tuner is tuned to DVB-S or DVB-S2.
BOOLEAN STB_DPGetPathCADescrambler(U8BIT path, U32BIT *handle)
Get the handle of the CA descrambler associated with the given path.
void ASI_StopPmtReporting(U8BIT path)
Prevents the current pmt being reported (e.g. to MHEG).
void * STB_SIRequestEit(U8BIT path, E_SI_REQUEST_TYPE req_type, E_SI_EIT_TABLE_REQ reqd_eit_tables, U16BIT sid_match, U16BIT sid_mask, U16BIT table_count, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for EIT.
U16BIT STB_SIGetPmtCaIdDescArray(U8BIT *pmt_data, U16BIT **pmt_ca_ids)
Parses the given PMT to produce an array of the CA system IDs required by the service or streams on t...
S8BIT STB_CompareStringsIgnoreCase(U8BIT *string1_ptr, U8BIT *string2_ptr)
Compares the contents of the two given ASCII strings and returns the status (as per strcmp) but ignor...
void * STB_DPGetOwnerData(U8BIT path, U32BIT *data_size)
Returns the owner data saved with the path. This data should not be freed.
Header file - Function prototypes for DVB subtitles api.
Header file - Function prototypes for heap memory.
void ASI_SetUpdateNitFunction(F_NitTableUpdate update_func)
Sets a function that will be called when an NIT table is received.
void STB_SIModifyPmtRequest(void *fhandle, U16BIT sid_match, U16BIT sid_mask, U16BIT table_count)
Modifies request for PMT to look for different service on SAME PID.
void STB_CiCcSetSDTAcquisitionStatus(BOOLEAN complete)
To implement the first part of the diagram in "Figure 10.2: Shunning Operation" of ci-plus_specificat...
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 STB_SIReleasePatTable(SI_PAT_TABLE *pat_table)
Frees the memory used by the pat table.
void ASI_EnableBatCollection(BOOLEAN use_bats, U16BIT *bouquet_ids, U16BIT num_ids)
Enables or disables the collection of BATs as part of the SI processing and allows the bouquet IDs of...
BOOLEAN ACI_AcquireCISlot(U8BIT path, void *s_ptr)
Acquires a CI slot for the given path on the given service after releasing any slot already being use...
void ASI_ProcessTotTable(SI_TABLE_RECORD *table_rec)
Processes the TOT table record to extract data for the database.
void STB_SIReleaseCaIdDescArray(U16BIT *desc_array, U8BIT num_entries)
Frees the memory used by the descriptor array specified.
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
void * STB_SIRequestSdt(U8BIT path, E_SI_REQUEST_TYPE req_type, BOOLEAN inc_sdt_actual, BOOLEAN inc_sdt_other, U16BIT tran_id_match, U16BIT tran_id_mask, U16BIT table_count, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for SDT.
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.
void DBA_UnlockDatabase(void)
Unlocks the database to allow other threads or processes to access it.
void STB_SICancelTableRequest(void *filter_ptr)
Stops filtering for SI table.
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 ASI_NotifyEitSchedUpdate(void *serv_ptr, U16BIT event_id, E_APP_SI_EIT_JOURNAL_TYPE type)
Calls the EIT schedule update callback function, if one has been registered, with details of the serv...
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.
void ASI_SetActiveNetworkId(U16BIT network_id)
Sets the network ID to be used for all future requests to get an NIT. If this value isn't set...
void DBA_SetRecordParent(void *record, void *parent)
Set of change the parent of the given record.
void ADB_ServiceAddRCTLink(void *serv_ptr, void *link_ptr)
Adds the given RCT link info to the end of the list of existing RCT links already defined for the giv...
void ASI_ProcessTdtTable(SI_TABLE_RECORD *table_rec)
Processes the TDT table record to extract data for the database.
BOOLEAN ASI_CheckForServiceChange(E_STB_DP_SIGNAL_TYPE tuner_type)
Checks whether the NIT or SDT version numbers have changed, which may indicate a change to the servic...
U8BIT STB_DPGetPathDemux(U8BIT path)
Returns the demux path ID acquired by the given decode path.
U16BIT DBDEF_NumStreamsInList(ADB_STREAM_REC *slist)
Returns the number of stream records in the given list.
void * ACTL_GetCurrentSatellite(U8BIT path)
Returns the current satellite being used by the given decode path.
void DBDEF_DeleteAltServList(ADB_ALT_SERV_REC *aslist)
Deletes all records in a service alternate service list.
Application database access functions.
void STB_SIReleaseNitTable(SI_NIT_TABLE *nit_table)
Frees the memory used by the nit table.
void ASI_ProcessEitTable(SI_TABLE_RECORD *table_rec, BOOLEAN playback)
Processes an EIT table, partial or full, and updates the events of the service it is for...
F_AppSiEventHandler STB_SIRegisterAppSiEventHandler(F_AppSiEventHandler func_ptr)
Registers a function to be called to handle SI events. The currently registered event handler is retu...
E_STB_TUNE_TMODE STB_TuneGetActualTerrMode(U8BIT path)
Returns the actual mode of the current terrestrial signal.
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...
BOOLEAN ASI_SSURefused(void)
Returns the flag indicating whether the SSU was refused.
void * STB_SIRequestTot(U8BIT path, E_SI_REQUEST_TYPE req_type, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Generates request for TOT.
void ADB_SetTunedTransport(U8BIT path, void *t_ptr)
Sets the given transport as the one tuned to on the given decode path. The transport's network is als...
Header file - macros and function prototypes for public use.
Header file - Function prototypes for tuner control.
void DBDEF_SortServicesByLcn(void)
Sort the full service list into ascending logical channel number order.
void ASI_AllowDatabaseUpdates(E_STB_DP_SIGNAL_TYPE signal_type, BOOLEAN allow)
Sets whether updates should be allowed to the service database from standard SI tables that are recei...