69 #ifdef INCLUDE_OTA_SSU 76 #ifdef INTEGRATE_HBBTV 92 #ifdef COMMON_INTERFACE 105 #define DBG_STDBY(X) STB_SPDebugWrite X 110 #ifdef DEBUG_SSU_SEARCH 111 #define DBG_SSU(X) STB_SPDebugWrite X 116 #ifdef DEBUG_TOT_SEARCH 117 #define TOT_DBG(X) STB_SPDebugWrite X 122 #ifdef DEBUG_EIT_SEARCH 123 #define EIT_DBG(X) STB_SPDebugWrite X 128 #ifdef DEBUG_SUBTITLES 129 #define SUBT_DBG(X) STB_SPDebugWrite X 135 #ifdef FUNCTION_START 136 #undef FUNCTION_START 138 #define FUNCTION_START(X) STB_SPDebugWrite(">>> %s\n", # X) 140 #ifdef FUNCTION_FINISH 141 #undef FUNCTION_FINISH 143 #define FUNCTION_FINISH(X) STB_SPDebugWrite("<<< %s\n", # X) 147 extern FILE *pvr_log;
148 extern void LogDateTime();
164 INT_EVENT_INITIALISE,
168 INT_EVENT_RF_CHAN_TUNE_REQD,
169 INT_EVENT_TPTR_TUNE_REQD,
170 INT_EVENT_USERDEFINED_TUNE_REQD,
172 INT_EVENT_RESTART_DECODING,
173 INT_EVENT_RESTART_AUDIO,
174 INT_EVENT_RESTART_SUBTITLES,
175 INT_EVENT_SCRAMBLE_CHANGE,
176 INT_EVENT_RELEASE_DECODE_LOCK,
177 INT_EVENT_STANDBY_ON,
178 INT_EVENT_STANDBY_OFF,
179 INT_EVENT_STANDBY_VCR_ACTIVE,
180 INT_EVENT_ALT_AV_ALLOWED,
181 INT_EVENT_ALT_AV_NOT_ALLOWED,
182 INT_EVENT_START_MHEG_TUNE,
183 INT_EVENT_ANALOG_TV_ON,
184 INT_EVENT_ANALOG_TV_OFF,
185 INT_EVENT_ANALOG_VIDEO_ALLOWED,
186 INT_EVENT_ANALOG_VIDEO_NOT_ALLOWED
187 } E_ACTL_INTERNAL_EVENT;
191 TUNED_STATUS_NO_SIGNAL,
192 TUNED_STATUS_BAD_SIGNAL,
193 TUNED_STATUS_GOOD_SIGNAL
194 } E_ACTL_TUNED_STATUS;
203 } E_ACTL_TUNING_STATE;
211 DSTATE_STARTING_BAD_SIGNAL,
215 DSTATE_PAUSED_SIGNAL,
217 DSTATE_PAUSED_SIGNAL_AND_USER
218 } E_ACTL_DECODING_STATE;
223 const E_STB_AV_VIDEO_FORMAT mode;
231 SEARCH_TYPE_NOSEARCH,
232 SEARCH_TYPE_SERVICE_FREQ,
233 SEARCH_TYPE_SERVICE_NETWORK,
235 SEARCH_TYPE_MANUAL_FREQ,
236 SEARCH_TYPE_MANUAL_NETWORK,
238 SEARCH_TYPE_OTA_UPDATE,
241 SEARCH_TYPE_EIT_SCHED,
242 SEARCH_TYPE_EIT_PF_SCHED
246 #ifdef INCLUDE_OTA_SSU 255 F_SSU_VERSION_CALLBACK version_cb;
263 static BOOLEAN initialised = FALSE;
265 #ifdef INCLUDE_OTA_SSU 266 static S_OTA_SETTINGS ota_settings;
270 static U16BIT rf_chan_id_required;
271 static void **transport_required;
272 static E_STB_DP_SIGNAL_TYPE signal_type_required;
273 static BOOLEAN tuner_relock_required;
274 static void **service_required;
275 static E_APP_SI_MODE *si_required;
276 static BOOLEAN decode_lock_override_required;
278 #ifdef COMMON_INTERFACE 279 static void *tuneto_live_service;
280 static void *tuneto_live_transport;
281 static E_ACTL_SI_SRCH_REQD tuneto_live_si;
282 static BOOLEAN tuneto_relock;
283 static BOOLEAN tuneto_for_recording;
285 static U32BIT ci_ai_module;
289 static E_ACTL_TUNING_STATE *tuning_state;
290 static E_ACTL_DECODING_STATE *decoding_state;
291 static void **cntrl_mutex;
294 static void **current_satellite;
296 static void **current_transport;
297 static E_APP_SI_MODE *current_si;
298 static BOOLEAN current_tuner_relock;
299 static E_ACTL_AV_MODE av_mode;
300 static BOOLEAN audio_muted;
301 static U8BIT audio_volume;
302 static U8BIT ad_volume;
303 static S8BIT volume_scaling = 0;
304 static BOOLEAN ci_ui_request;
305 static BOOLEAN *decoding_started;
306 static BOOLEAN *decoding_locked;
307 static S32BIT *now_event_id;
309 static BOOLEAN dvb_subtitles;
310 static BOOLEAN subtitles_started;
311 static BOOLEAN subtitles_running;
312 static BOOLEAN subtitles_suppressed;
314 static BOOLEAN external_control = FALSE;
317 static E_ACTL_TUNED_STATUS *tuned_status;
318 static BOOLEAN audio_desc_on;
321 static BOOLEAN *decode_paused_flag;
323 static U8BIT standby_path = INVALID_RES_ID;
326 static E_SEARCH_TYPE current_search_type = SEARCH_TYPE_NOSEARCH;
327 static E_SEARCH_TYPE required_search_type = SEARCH_TYPE_NOSEARCH;
328 static U8BIT search_path = INVALID_RES_ID;
329 static U16BIT search_list_id;
330 static E_STB_DP_SIGNAL_TYPE current_search_tuner_type = SIGNAL_NONE;
333 static E_STB_TUNE_THIERARCHY terr_hierarchy;
334 static U8BIT t2_plp_id;
337 static U16BIT search_num_transports;
338 static void **search_transport_list = NULL;
341 static U32BIT eit_search_end_timer = INVALID_TIMER_HANDLE;
342 static U32BIT standby_wakeup_timer = INVALID_TIMER_HANDLE;
343 #ifdef COMMON_INTERFACE 344 static U32DHMS start_standby_time;
346 static U16BIT standby_grace_timeout = 0;
347 static U32BIT standby_grace_timer = INVALID_TIMER_HANDLE;
349 static BOOLEAN hdmi_connected = FALSE;
353 {VIDEO_FORMAT_2160P50UHD, 3840, 2160},
354 {VIDEO_FORMAT_2160P60UHD, 3840, 2160},
355 {VIDEO_FORMAT_2160P25UHD, 3840, 2160},
356 {VIDEO_FORMAT_2160P30UHD, 3840, 2160},
357 {VIDEO_FORMAT_2160P24UHD, 3840, 2160},
358 {VIDEO_FORMAT_1080P60HD, 1920, 1080},
359 {VIDEO_FORMAT_1080P50HD, 1920, 1080},
360 {VIDEO_FORMAT_1080P30HD, 1920, 1080},
361 {VIDEO_FORMAT_1080I50HD, 1920, 1080},
362 {VIDEO_FORMAT_1080P25HD, 1920, 1080},
363 {VIDEO_FORMAT_1080IHD, 1920, 1080},
364 {VIDEO_FORMAT_720P60HD, 1280, 720},
365 {VIDEO_FORMAT_720P50HD, 1280, 720},
366 {VIDEO_FORMAT_576PHD, 720, 576},
367 {VIDEO_FORMAT_576IHD, 720, 576},
368 {VIDEO_FORMAT_ORIGINAL, 0, 0},
369 {VIDEO_FORMAT_AUTO, 0, 0}
376 BOOLEAN override_parental_lock,
void *t_ptr, E_ACTL_SI_SRCH_REQD reqd_si, BOOLEAN relock_on);
378 #ifdef COMMON_INTERFACE 381 BOOLEAN override_parental_lock,
void *t_ptr, E_ACTL_SI_SRCH_REQD reqd_si, BOOLEAN relock_on);
382 static void CIPowerDownReadyCallback(
void);
385 static void ControlTuning(U8BIT path, E_ACTL_EVENT_TYPE type, U32BIT event);
386 static void ControlDecoding(U8BIT path, E_ACTL_EVENT_TYPE type, U32BIT event);
387 static void ControlAvOutput(E_ACTL_EVENT_TYPE type, U32BIT event);
388 static void AVSetAudioVolumes(BOOLEAN save_to_nvm);
390 static void SetupForTuning(U8BIT path, U32BIT event);
392 static void SetupForDecoding(U8BIT path);
393 static void StartSiProcess(U8BIT path);
395 static U8BIT AcquirePathForService(
void *s_ptr, BOOLEAN with_decoders, BOOLEAN for_recording,
398 static void ContinueServiceSearch(U8BIT path, U32BIT event);
399 static U16BIT NextSearchId(
void **tlist, U16BIT num_transports);
400 static void ReleasePath(U8BIT path);
401 static void EndSearch(U8BIT path);
402 static void ContinueTransportSearch(U8BIT path);
403 static void FinishManualSearch(U8BIT path, U32BIT event);
404 static void FinishSearch(U8BIT path);
405 static BOOLEAN StartEitSearch(
void);
406 static void ContinueEitSearch(U8BIT path);
407 static BOOLEAN EitSearchNeededNow(
void);
409 static U16BIT GetNumSatSearchIds(
void);
412 static BOOLEAN EnterStandby(
void **recording_service);
413 static void GetNextWakeupTime(U32DHMS *wakeup_date_time, BOOLEAN *wakeup_for_search,
414 E_STB_DP_SIGNAL_TYPE *search_tuner_type, BOOLEAN *wakeup_for_recording, U16BIT *onet_id,
415 U16BIT *trans_id, U16BIT *service_id);
416 static BOOLEAN StartSearch(E_STB_DP_SIGNAL_TYPE tuner_type);
417 static U32DHMS GetDateTimeNow(
void);
418 static U32DHMS CalculateWakeupTime(U32DHMS date_time);
420 #if defined(DEBUG_TUNING) || defined(DEBUG_DECODING) || defined(DEBUG_AV_OUTPUT) || defined(DEBUG_MHEG) 421 static U8BIT* GetEventDebugString(E_ACTL_EVENT_TYPE type, U32BIT event);
424 static void FinishEitSearch(U8BIT path);
425 static BOOLEAN GetNextEitSearchTime(U32DHMS *next);
427 static void UpdateTransportParameters(U8BIT path);
428 static U32BIT CreateTimer(U32DHMS date_time);
451 decoding_state =
STB_AppGetMemory(
sizeof(E_ACTL_DECODING_STATE) * num_paths);
467 dvb_subtitles = FALSE;
468 subtitles_started = FALSE;
469 subtitles_running = FALSE;
470 subtitles_suppressed = FALSE;
473 ControlAvOutput(INTERNAL_EVENT, INT_EVENT_INITIALISE);
475 for (path = 0; path < num_paths; path++)
478 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_INITIALISE);
481 for (path = 0; path < num_paths; path++)
483 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_INITIALISE);
507 #ifdef INCLUDE_OTA_SSU 508 U16BIT onet_id, tran_id, serv_id;
514 path = INVALID_RES_ID;
519 case STB_EVENT_TUNE_SIGNAL_DATA_BAD:
520 case STB_EVENT_TUNE_SIGNAL_DATA_OK:
521 case STB_EVENT_TUNE_LOCKED:
526 if (event_data != NULL)
528 path = INVALID_RES_ID;
531 ControlTuning(path, EXTERNAL_EVENT, event);
533 #ifdef INCLUDE_OTA_SSU 534 if ((current_search_type == SEARCH_TYPE_SSU) ||
535 (current_search_type == SEARCH_TYPE_OTA_UPDATE))
537 DBG_SSU((
"%s: Tuner locked, OTA started = %u", __FUNCTION__, ota_settings.ota_started));
538 if (!ota_settings.ota_started && (ota_settings.ota_tran_id != ADB_INVALID_DVB_ID))
540 DBG_SSU((
"%s: Tuner locked, looking for OTA image on 0x%04x/%04x/%04x",
541 __FUNCTION__, ota_settings.ota_onet_id, ota_settings.ota_tran_id,
542 ota_settings.ota_serv_id));
545 ota_settings.ota_serv_id, ADB_INVALID_DVB_ID, ota_settings.version_cb))
547 ota_settings.ota_started = TRUE;
549 #ifdef DEBUG_SSU_SEARCH 552 DBG_SSU((
"%s: Tuner locked but failed to start OTA", __FUNCTION__));
561 if (current_search_type != SEARCH_TYPE_NOSEARCH)
567 if (((current_search_type == SEARCH_TYPE_EIT_PF) ||
568 (current_search_type == SEARCH_TYPE_EIT_SCHED) ||
576 eit_search_end_timer = CreateTimer(search_time);
581 case STB_EVENT_TUNE_NOTLOCKED:
586 if (event_data != NULL)
588 path = INVALID_RES_ID;
591 switch (current_search_type)
593 case SEARCH_TYPE_SERVICE_FREQ:
594 case SEARCH_TYPE_SERVICE_NETWORK:
595 case SEARCH_TYPE_MANUAL_NETWORK:
596 ContinueServiceSearch(path, event);
599 #ifdef INCLUDE_OTA_SSU 600 case SEARCH_TYPE_SSU:
601 if (ota_settings.ota_started)
603 DBG_SSU((
"%s: Tuner not locked, stopping OTA download", __FUNCTION__));
605 ota_settings.ota_started = FALSE;
607 if (ota_settings.ota_path != INVALID_RES_ID)
609 DBG_SSU((
"%s: Releasing path %u used for OTA", __FUNCTION__,
610 ota_settings.ota_path));
614 ota_settings.ota_path = INVALID_RES_ID;
617 ContinueTransportSearch(path);
620 case SEARCH_TYPE_OTA_UPDATE:
621 if (ota_settings.ota_started)
623 DBG_SSU((
"%s: Tuner not locked, stopping OTA download", __FUNCTION__));
625 ota_settings.ota_started = FALSE;
627 if (ota_settings.ota_path != INVALID_RES_ID)
629 DBG_SSU((
"%s: Releasing path %u used for OTA", __FUNCTION__,
630 ota_settings.ota_path));
634 ota_settings.ota_path = INVALID_RES_ID;
637 current_search_type = SEARCH_TYPE_NOSEARCH;
641 case SEARCH_TYPE_STARTUP:
642 case SEARCH_TYPE_TOT:
643 ContinueTransportSearch(path);
646 case SEARCH_TYPE_EIT_PF:
647 case SEARCH_TYPE_EIT_SCHED:
648 case SEARCH_TYPE_EIT_PF_SCHED:
649 if (path == search_path)
651 ContinueEitSearch(path);
655 case SEARCH_TYPE_MANUAL_FREQ:
656 FinishManualSearch(path, event);
657 ControlTuning(path, EXTERNAL_EVENT, event);
661 ControlTuning(path, EXTERNAL_EVENT, event);
669 case STB_EVENT_SEARCH_FAIL:
670 case STB_EVENT_SEARCH_SUCCESS:
672 switch (current_search_type)
674 case SEARCH_TYPE_SERVICE_FREQ:
675 case SEARCH_TYPE_SERVICE_NETWORK:
676 case SEARCH_TYPE_MANUAL_NETWORK:
677 if (search_path != INVALID_RES_ID)
679 ContinueServiceSearch(search_path, event);
683 case SEARCH_TYPE_TOT:
684 if (search_path != INVALID_RES_ID)
686 if (event == STB_EVENT_SEARCH_SUCCESS)
689 FinishSearch(search_path);
693 ContinueTransportSearch(search_path);
698 case SEARCH_TYPE_STARTUP:
699 if (search_path != INVALID_RES_ID)
701 ContinueTransportSearch(search_path);
705 case SEARCH_TYPE_MANUAL_FREQ:
706 if (search_path != INVALID_RES_ID)
708 if ((signal_type_required == SIGNAL_COFDM) &&
712 ContinueServiceSearch(search_path, event);
716 FinishManualSearch(search_path, event);
717 search_path = INVALID_RES_ID;
722 case SEARCH_TYPE_EIT_PF:
723 case SEARCH_TYPE_EIT_SCHED:
724 case SEARCH_TYPE_EIT_PF_SCHED:
725 if (search_path != INVALID_RES_ID)
728 ContinueEitSearch(search_path);
732 #ifdef INCLUDE_OTA_SSU 733 case SEARCH_TYPE_SSU:
734 if (event == STB_EVENT_SEARCH_SUCCESS)
737 NULL, &onet_id, &tran_id, &serv_id);
739 if ((ota_settings.ota_location != NULL) &&
742 DBG_SSU((
"%s(%u): Looking for OTA image on 0x%04x/%04x/%04x", __FUNCTION__,
743 search_path, onet_id, tran_id, serv_id));
745 if (!ACTL_StartOTAUpdate(search_path, t_ptr, serv_id, ota_settings.version_cb))
747 DBG_SSU((
"%s: Failed to start OTA, continuing with search", __FUNCTION__));
748 ContinueTransportSearch(search_path);
753 DBG_SSU((
"%s: No OTA available, continuing with search", __FUNCTION__));
754 ContinueTransportSearch(search_path);
759 DBG_SSU((
"%s: No OTA available, continuing with search", __FUNCTION__));
760 ContinueTransportSearch(search_path);
771 #ifdef INCLUDE_OTA_SSU 772 case STB_EVENT_OTA_SW_UPGRADE_FOUND:
778 case STB_EVENT_OTA_SW_UPGRADE_NOTFOUND:
779 case STB_EVENT_OTA_SW_UPGRADE_ERROR:
781 if ((current_search_type == SEARCH_TYPE_SSU) || (current_search_type == SEARCH_TYPE_OTA_UPDATE))
783 DBG_SSU((
"%s: Failed to find an OTA update", __FUNCTION__));
784 ACTL_StopOTAUpdate();
786 if ((current_search_type == SEARCH_TYPE_SSU) && (search_path != INVALID_RES_ID))
790 ota_settings.ota_location, &onet_id, &tran_id, &serv_id);
792 if ((ota_settings.ota_location != NULL) &&
795 DBG_SSU((
"%s(%u): Looking for OTA image on 0x%04x/%04x/%04x", __FUNCTION__,
796 search_path, onet_id, tran_id, serv_id));
798 if (!ACTL_StartOTAUpdate(search_path, t_ptr, serv_id, ota_settings.version_cb))
800 DBG_SSU((
"%s: Failed to start OTA, continuing with search", __FUNCTION__));
801 ContinueTransportSearch(search_path);
806 DBG_SSU((
"%s: Continuing SSU search", __FUNCTION__));
807 ContinueTransportSearch(search_path);
816 case STB_EVENT_AUDIO_DECODE_STARTED:
820 if (event_data != NULL)
825 if (path != INVALID_RES_ID)
827 ControlDecoding(path, EXTERNAL_EVENT, event);
832 case STB_EVENT_VIDEO_DECODE_STARTED:
833 case STB_EVENT_DECODE_LOCKED:
837 if (event_data != NULL)
842 if (path != INVALID_RES_ID)
844 ControlDecoding(path, EXTERNAL_EVENT, event);
849 #ifdef COMMON_INTERFACE 850 case STB_EVENT_CI_APP_INFO:
852 ci_ai_module = *((U32BIT*)event_data);
857 case APP_EVENT_SERVICE_AUDIO_PID_UPDATE:
858 case APP_EVENT_SERVICE_VIDEO_PID_UPDATE:
859 case APP_EVENT_SERVICE_SUBTITLE_UPDATE:
860 case APP_EVENT_SERVICE_SCRAMBLE_CHANGE:
861 case APP_EVENT_SERVICE_RUNNING:
875 current_service[path] = service_required[path];
876 tuned_status[path] = TUNED_STATUS_GOOD_SIGNAL;
881 ControlDecoding(path, EXTERNAL_EVENT, event);
898 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_PVR_RECORDING_FAILED, NULL, 0);
908 case APP_EVENT_SERVICE_VIDEO_CODEC_CHANGED:
910 if (!external_control)
916 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_DECODING);
922 case APP_EVENT_SERVICE_AUDIO_CODEC_CHANGED:
924 if (!external_control)
930 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_AUDIO);
936 case APP_EVENT_SERVICE_NOT_RUNNING:
938 path = *(U8BIT *)event_data;
941 ControlDecoding(path, EXTERNAL_EVENT, event);
962 BOOLEAN retval = FALSE;
964 U16BIT onet_id, trans_id, service_id;
971 if (timer_handle == standby_wakeup_timer)
974 standby_wakeup_timer = INVALID_TIMER_HANDLE;
977 if (
APP_NvmRead(STANDBY_STATE_NVM) == STDBY_WAKE_FOR_RECORDING)
984 if (standby_path != INVALID_RES_ID)
988 standby_path = INVALID_RES_ID;
991 if ((standby_path = AcquirePathForService(s_ptr, FALSE, FALSE, NULL)) != INVALID_RES_ID)
1010 if (!StartSearch(signal_type_required))
1019 else if (timer_handle == standby_grace_timer)
1022 standby_grace_timer = INVALID_TIMER_HANDLE;
1024 DBG_STDBY((
"Standby grace time expired"));
1029 DBG_STDBY((
"Entering low power standby"));
1035 DBG_STDBY((
"Entering passive standby"));
1041 if (timer_handle == eit_search_end_timer)
1044 eit_search_end_timer = INVALID_TIMER_HANDLE;
1046 if ((current_search_type == SEARCH_TYPE_EIT_PF) ||
1047 (current_search_type == SEARCH_TYPE_EIT_SCHED) ||
1048 (current_search_type == SEARCH_TYPE_EIT_PF_SCHED))
1050 if (search_path != INVALID_RES_ID)
1052 ContinueEitSearch(search_path);
1077 if (path != INVALID_RES_ID)
1079 sat_ptr = current_satellite[path];
1101 U16BIT num_rf_chans;
1102 U32BIT country_code;
1125 return(num_rf_chans);
1140 U16BIT num_rf_chans;
1141 U32BIT country_code;
1152 (
id < num_rf_chans))
1154 ret_val = ana_channel_table[id].name;
1159 (
id < num_rf_chans))
1161 ret_val = ter_channel_table[id].name;
1166 (
id < num_rf_chans))
1168 ret_val = cab_channel_table[id].name;
1189 U16BIT num_rf_chans;
1190 U32BIT country_code;
1201 (
id < num_rf_chans))
1203 ret_val = cab_channel_table[id].symbol_rate;
1225 U16BIT num_rf_chans;
1226 U32BIT country_code;
1237 (
id < num_rf_chans))
1239 ret_val = cab_channel_table[id].mode;
1263 U16BIT num_rf_chans;
1264 U32BIT country_code;
1275 (
id < num_rf_chans))
1277 ret_val = ana_channel_table[id].freq_hz;
1282 (
id < num_rf_chans))
1284 ret_val = ter_channel_table[id].freq_hz;
1289 (
id < num_rf_chans))
1291 ret_val = cab_channel_table[id].freq_hz;
1314 U16BIT i, num_rf_chans;
1315 U32BIT country_code;
1327 for (i = 0; i < num_rf_chans; i++)
1329 if (ana_channel_table[i].freq_hz == freq_hz)
1331 ret_val = ana_channel_table[i].name;
1340 for (i = 0; i < num_rf_chans; i++)
1342 if (ter_channel_table[i].freq_hz == freq_hz)
1344 ret_val = ter_channel_table[i].name;
1353 for (i = 0; i < num_rf_chans; i++)
1355 if (cab_channel_table[i].freq_hz == freq_hz)
1357 ret_val = cab_channel_table[i].name;
1378 E_STB_DP_TTYPE ret_val;
1381 U16BIT num_rf_chans;
1385 ret_val = TERR_TYPE_UNKNOWN;
1388 if ((success == TRUE) && (
id < num_rf_chans))
1390 ret_val = rf_channel_table[id].type;
1412 U16BIT num_rf_chans;
1413 U32BIT country_code;
1420 switch (signal_type_required)
1436 if ((success == TRUE) && (
id < num_rf_chans))
1440 rf_chan_id_required = id;
1441 transport_required[path] = NULL;
1442 tuner_relock_required = relock_on;
1443 service_required[path] = NULL;
1444 decode_lock_override_required = FALSE;
1447 case ACTL_SI_CHANNEL_SEARCH: {si_required[path] = APP_SI_MODE_CHANNEL_SEARCH;
break; }
1448 case ACTL_SI_STARTUP_SEARCH: {si_required[path] = APP_SI_MODE_STARTUP_SEARCH;
break; }
1449 case ACTL_SI_EVENT_PF_SEARCH: {si_required[path] = APP_SI_MODE_EVENT_PF_SEARCH;
break; }
1450 case ACTL_SI_EVENT_SCHED_SEARCH: {si_required[path] = APP_SI_MODE_EVENT_SCHED_SEARCH;
break; }
1451 case ACTL_SI_EVENT_PF_SCHED_SEARCH: {si_required[path] = APP_SI_MODE_EVENT_PF_SCHED_SEARCH;
break; }
1452 case ACTL_SI_DVB_SSU_SEARCH: {si_required[path] = APP_SI_MODE_DVB_SSU_SEARCH;
break; }
1453 case ACTL_SI_USER_DEFINED: {si_required[path] = APP_SI_MODE_USER_DEFINED;
break; }
1454 default: {si_required[path] = APP_SI_MODE_NO_SI;
break; }
1456 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_RF_CHAN_TUNE_REQD);
1462 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TUNE_OFF);
1481 U16BIT num_rf_chans;
1488 if ((success == TRUE) && (
id < num_rf_chans))
1492 rf_chan_id_required = id;
1493 signal_type_required = SIGNAL_ANALOG;
1494 transport_required[path] = NULL;
1495 tuner_relock_required = FALSE;
1496 service_required[path] = NULL;
1497 decode_lock_override_required = FALSE;
1498 si_required[path] = APP_SI_MODE_NO_SI;
1500 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_RF_CHAN_TUNE_REQD);
1505 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TUNE_OFF);
1523 E_ACTL_SI_SRCH_REQD reqd_si, BOOLEAN relock_on)
1531 if ((path != INVALID_RES_ID) && (tuning_params != NULL))
1537 transport_required[path] = NULL;
1538 tuner_relock_required = relock_on;
1539 service_required[path] = NULL;
1540 decode_lock_override_required = FALSE;
1544 case ACTL_SI_CHANNEL_SEARCH: {si_required[path] = APP_SI_MODE_CHANNEL_SEARCH;
break; }
1545 case ACTL_SI_CHANNEL_SEARCH_NO_NIT: {si_required[path] = APP_SI_MODE_CHANNEL_SEARCH_NO_NIT;
break; }
1546 case ACTL_SI_STARTUP_SEARCH: {si_required[path] = APP_SI_MODE_STARTUP_SEARCH;
break; }
1547 case ACTL_SI_EVENT_PF_SEARCH: {si_required[path] = APP_SI_MODE_EVENT_PF_SEARCH;
break; }
1548 case ACTL_SI_EVENT_SCHED_SEARCH: {si_required[path] = APP_SI_MODE_EVENT_SCHED_SEARCH;
break; }
1549 case ACTL_SI_EVENT_PF_SCHED_SEARCH: {si_required[path] = APP_SI_MODE_EVENT_PF_SCHED_SEARCH;
break; }
1550 case ACTL_SI_DVB_SSU_SEARCH: {si_required[path] = APP_SI_MODE_DVB_SSU_SEARCH;
break; }
1551 case ACTL_SI_USER_DEFINED: {si_required[path] = APP_SI_MODE_USER_DEFINED;
break; }
1552 default: {si_required[path] = APP_SI_MODE_NO_SI;
break; }
1560 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_USERDEFINED_TUNE_REQD);
1585 E_ACTL_SI_SRCH_REQD reqd_si, BOOLEAN relock_on)
1589 if (path == INVALID_RES_ID)
1592 path = AcquireLivePath(NULL, owner_info, FALSE, t_ptr, reqd_si, relock_on);
1595 if (path != INVALID_RES_ID)
1599 transport_required[path] = t_ptr;
1600 tuner_relock_required = relock_on;
1601 service_required[path] = NULL;
1602 decode_lock_override_required = FALSE;
1606 case ACTL_SI_CHANNEL_SEARCH: {si_required[path] = APP_SI_MODE_CHANNEL_SEARCH;
break; }
1607 case ACTL_SI_CHANNEL_SEARCH_NO_NIT: {si_required[path] = APP_SI_MODE_CHANNEL_SEARCH_NO_NIT;
break; }
1608 case ACTL_SI_STARTUP_SEARCH: {si_required[path] = APP_SI_MODE_STARTUP_SEARCH;
break; }
1609 case ACTL_SI_TOT_SEARCH: {si_required[path] = APP_SI_MODE_TOT_SEARCH;
break; }
1610 case ACTL_SI_EVENT_PF_SEARCH: {si_required[path] = APP_SI_MODE_EVENT_PF_SEARCH;
break; }
1611 case ACTL_SI_EVENT_SCHED_SEARCH: {si_required[path] = APP_SI_MODE_EVENT_SCHED_SEARCH;
break; }
1612 case ACTL_SI_EVENT_PF_SCHED_SEARCH: {si_required[path] = APP_SI_MODE_EVENT_PF_SCHED_SEARCH;
break; }
1613 case ACTL_SI_DVB_SSU_SEARCH: {si_required[path] = APP_SI_MODE_DVB_SSU_SEARCH;
break; }
1614 case ACTL_SI_USER_DEFINED: {si_required[path] = APP_SI_MODE_USER_DEFINED;
break; }
1615 default: {si_required[path] = APP_SI_MODE_NO_SI;
break; }
1623 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TPTR_TUNE_REQD);
1627 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TUNE_OFF);
1652 BOOLEAN override_lock, BOOLEAN for_live)
1654 BOOLEAN slot_acquired;
1656 #if defined(EIT_EPG_4DAY_ACT) || defined(EIT_EPG_8DAY_ACT) 1658 U16BIT num_services;
1661 #if defined(INTEGRATE_HBBTV) 1662 U16BIT onet_id, ts_id, serv_id;
1668 STB_SPDebugWrite(
"ACTL_TuneToService(path=%d, owner_info=%p, service=0x%x, for_live=%u)",
1669 path, owner_info, s_ptr, for_live);
1672 if (path == INVALID_RES_ID)
1677 path = AcquireLivePath(s_ptr, owner_info, override_lock, NULL, APP_SI_MODE_UPDATE, FALSE);
1682 path = AcquireRecordingPath(s_ptr, owner_info);
1686 if (path != INVALID_RES_ID)
1690 service_required[path] = s_ptr;
1692 tuner_relock_required = TRUE;
1693 decode_lock_override_required = override_lock;
1699 si_required[path] = APP_SI_MODE_NO_SI;
1700 signal_type_required = SIGNAL_ANALOG;
1702 if ((
APP_NvmRead(PARENTAL_LOCK_NVM) != PARENTAL_LOCK_OFF) &&
1703 (decode_lock_override_required == FALSE) &&
1706 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TUNE_OFF);
1707 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_ANALOG_LOCKED, NULL, 0);
1711 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TPTR_TUNE_REQD);
1714 #ifdef COMMON_INTERFACE 1718 service_required[path] = NULL;
1719 transport_required[path] = NULL;
1720 current_service[path] = NULL;
1722 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TUNE_OFF);
1725 STB_EnterCICamChannel(ci_ai_module);
1730 #if defined(EIT_EPG_4DAY_ACT) || defined(EIT_EPG_8DAY_ACT) 1732 (current_transport[path] != NULL) &&
1733 (transport_required[path] != current_transport[path]) &&
1734 (s_ptr != current_service[path]))
1739 for (i = 0; i < num_services; i++)
1748 si_required[path] = APP_SI_MODE_UPDATE;
1749 slot_acquired = FALSE;
1751 #ifdef COMMON_INTERFACE 1752 if (ADB_GetServiceSDTReceived(s_ptr))
1756 if (ADB_HasCIProtectionExpired(s_ptr))
1760 si_required[path] = APP_SI_MODE_CIPLUS_UPDATE;
1779 si_required[path] = APP_SI_MODE_CIPLUS_UPDATE;
1796 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TPTR_TUNE_REQD);
1800 tuning_state[path] = TSTATE_TUNED;
1805 StartSiProcess(path);
1809 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_DECODING);
1810 #if defined(INTEGRATE_HBBTV) 1816 HBBTV_CHANNEL_CHANGE_SUCCEEDED);
1837 current_service[path] = NULL;
1839 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TUNE_OFF);
1877 if (path != INVALID_RES_ID)
1883 case SI_DEL_SYS_DESC_TYPE_TERR:
1892 case SI_DEL_SYS_DESC_TYPE_CABLE:
1895 dsd->cable.symbol_rate)) == NULL)
1902 case SI_DEL_SYS_DESC_TYPE_SAT:
1905 dsd->sat.polarity, dsd->sat.dvb_s2, dsd->sat.modulation, NULL)) == NULL)
1908 dsd->sat.polarity, dsd->sat.dvb_s2, dsd->sat.modulation, NULL);
1924 if (service_id != 0)
1929 t_ptr->tran_id, service_id)) == NULL)
1935 s_ptr->hidden = TRUE;
1938 s_ptr->selectable = FALSE;
1939 DBA_SetFieldValue(s_ptr->dba_rec, DBA_FIELD_SERV_SELECTABLE, s_ptr->selectable);
1941 s_ptr->serv_type = ADB_SERVICE_TYPE_DSD;
1982 if ((path != INVALID_RES_ID) && (tuning_state[path] == TSTATE_TUNED))
2000 if (path != INVALID_RES_ID)
2004 current_si[path] = APP_SI_MODE_NO_SI;
2005 si_required[path] = APP_SI_MODE_STARTUP_SEARCH;
2006 service_required[path] = NULL;
2007 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_ENABLE);
2008 StartSiProcess(path);
2009 tuned_status[path] = TUNED_STATUS_GOOD_SIGNAL;
2012 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_DISABLE);
2030 if (path != INVALID_RES_ID)
2032 service_required[path] = s_ptr;
2033 transport_required[path] = NULL;
2036 si_required[path] = APP_SI_MODE_UPDATE;
2037 signal_type_required = SIGNAL_COFDM;
2043 current_service[path] = NULL;
2044 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TUNE_OFF);
2065 current_service[path] = s_ptr;
2066 service_required[path] = s_ptr;
2067 tuned_status[path] = TUNED_STATUS_GOOD_SIGNAL;
2068 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_ENABLE);
2083 if (path != INVALID_RES_ID)
2086 transport_required[path] = NULL;
2087 service_required[path] = NULL;
2088 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TUNE_OFF);
2089 current_service[path] = NULL;
2090 current_transport[path] = NULL;
2091 current_satellite[path] = NULL;
2094 now_event_id[path] = -1;
2109 if (path != INVALID_RES_ID)
2112 service_required[path] = NULL;
2115 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_DISABLE);
2134 if (path != INVALID_RES_ID)
2136 if (signal_type_required == SIGNAL_ANALOG)
2138 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TPTR_TUNE_REQD);
2142 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RELEASE_DECODE_LOCK);
2163 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_AUDIO);
2180 if (path != INVALID_RES_ID)
2182 SUBT_DBG((
"ACTL_ReTuneSubtitles: calling ControlDecoding with INT_EVENT_RESTART_SUBTITLES"));
2183 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_SUBTITLES);
2198 if (path == INVALID_RES_ID)
2204 started = decoding_started[path];
2219 if (path == INVALID_RES_ID)
2225 locked = decoding_locked[path];
2237 E_ACTL_INTERNAL_EVENT event;
2243 event = INT_EVENT_STANDBY_ON;
2248 event = INT_EVENT_STANDBY_OFF;
2252 ControlAvOutput(INTERNAL_EVENT, event);
2264 ControlAvOutput(INTERNAL_EVENT, INT_EVENT_STANDBY_VCR_ACTIVE);
2281 void ACTL_AllowAltAVSources(BOOLEAN state)
2283 E_ACTL_INTERNAL_EVENT event;
2285 FUNCTION_START(ACTL_AllowAltAVSources);
2289 event = INT_EVENT_ALT_AV_ALLOWED;
2293 event = INT_EVENT_ALT_AV_NOT_ALLOWED;
2295 ControlAvOutput(INTERNAL_EVENT, event);
2297 FUNCTION_FINISH(ACTL_AllowAltAVSources);
2316 if (win_width == 0 || win_height == 0)
2322 output.left = win_x;
2324 output.width = win_width;
2325 output.height = win_height;
2338 E_STB_AV_VIDEO_FORMAT actual_mode;
2339 U16BIT width, height;
2344 APP_NvmSave(ASPECT_RATIO_NVM, aspect_ratio, TRUE);
2361 return((E_STB_AV_ASPECT_RATIO)
APP_NvmRead(ASPECT_RATIO_NVM));
2390 return((E_STB_AV_ASPECT_MODE)
APP_NvmRead(ASPECT_MODE_NVM));
2402 E_STB_AV_VIDEO_FORMAT actual_mode;
2403 U16BIT width, height;
2408 APP_NvmSave(ASPECT_RATIO_NVM, aspect_ratio, FALSE);
2431 #ifdef COMMON_INTERFACE 2440 void ACTL_TuneToCIService(U8BIT path,
S_ACTL_OWNER_INFO *owner_info,
void *s_ptr, E_APP_SI_MODE si_mode)
2442 FUNCTION_START(ACTL_TuneToCIService);
2445 STB_SPDebugWrite(
"ACTL_TuneToCIService(path=%d, owner_info=%p, service=0x%x, si_mode=%u)",
2446 path, owner_info, s_ptr, si_mode);
2449 if (path == INVALID_RES_ID)
2452 path = AcquireLivePath(s_ptr, owner_info, FALSE, NULL, si_mode, FALSE);
2455 if (path != INVALID_RES_ID)
2459 service_required[path] = s_ptr;
2461 tuner_relock_required = TRUE;
2462 decode_lock_override_required = FALSE;
2466 si_required[path] = si_mode;
2470 if (current_service[path] != s_ptr)
2474 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TPTR_TUNE_REQD);
2479 StartSiProcess(path);
2483 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_DECODING);
2489 current_service[path] = NULL;
2491 ControlTuning(path, INTERNAL_EVENT, INT_EVENT_TUNE_OFF);
2497 FUNCTION_FINISH(ACTL_TuneToCIService);
2507 void ACTL_ContinueCIPLUSTune(U8BIT path, BOOLEAN continue_tuning)
2509 FUNCTION_START(ACTL_ContinueCIPLUSTune);
2511 if (continue_tuning)
2513 if (path != INVALID_RES_ID)
2518 path = INVALID_RES_ID;
2521 if (tuneto_for_recording)
2523 path = AcquireRecordingPath(tuneto_live_service, tuneto_owner_info);
2526 if (tuneto_live_service != NULL)
2529 decode_lock_override_required, TRUE);
2531 else if (tuneto_live_transport != NULL)
2534 tuneto_live_si, tuneto_relock);
2540 tuneto_live_service = NULL;
2541 tuneto_live_transport = NULL;
2543 if (tuneto_owner_info != NULL)
2546 if (tuneto_owner_info->data != NULL)
2552 tuneto_owner_info = NULL;
2555 FUNCTION_FINISH(ACTL_ContinueCIPLUSTune);
2566 #ifdef COMMON_INTERFACE 2578 #ifdef COMMON_INTERFACE 2592 return(ci_ui_request);
2604 return(decode_paused_flag[path]);
2626 analog_string_changed = FALSE;
2628 if (str_ptr == NULL)
2631 if (valid_analog_string == TRUE)
2633 valid_analog_string = FALSE;
2634 analog_string_changed = TRUE;
2640 if (valid_analog_string == FALSE)
2642 analog_string_changed = TRUE;
2646 if (strncmp((
char *)str_ptr, (
char *)analog_string_buffer, (
sizeof(analog_string_buffer) - 1)) != 0)
2648 analog_string_changed = TRUE;
2652 if (analog_string_changed == TRUE)
2656 string_len = strlen((
char *)str_ptr);
2657 if (string_len >=
sizeof(analog_string_buffer))
2659 string_len =
sizeof(analog_string_buffer) - 1;
2661 memcpy(analog_string_buffer, str_ptr, string_len);
2663 analog_string_buffer[string_len] = 0;
2664 valid_analog_string = TRUE;
2669 if (analog_string_changed == TRUE)
2676 USE_UNWANTED_PARAM(str_ptr);
2686 E_ACTL_INTERNAL_EVENT event;
2690 if (allow_analog_video == TRUE)
2692 event = INT_EVENT_ANALOG_VIDEO_ALLOWED;
2696 event = INT_EVENT_ANALOG_VIDEO_NOT_ALLOWED;
2698 ControlAvOutput(INTERNAL_EVENT, event);
2711 return(audio_desc_on);
2725 BOOLEAN broadcast_mix;
2726 E_STB_DP_AUDIO_MODE mode;
2727 ADB_STREAM_TYPE type;
2731 if (path != INVALID_RES_ID)
2735 audio_desc_on = TRUE;
2742 if ((pid != 0) && (pid != 0xffff))
2748 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_AUDIO);
2764 return(audio_desc_on);
2775 if (path != INVALID_RES_ID)
2777 audio_desc_on = FALSE;
2782 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_AUDIO);
2798 AVSetAudioVolumes(TRUE);
2812 E_STB_AV_VIDEO_FORMAT current_mode;
2813 E_STB_AV_VIDEO_FORMAT *supported_modes;
2814 U8BIT num_modes, num_app_modes;
2820 current_mode = (E_STB_AV_VIDEO_FORMAT)
APP_NvmRead(HDMI_RESOLUTION_NVM);
2824 DBGPRINT(
"current mode %d", current_mode);
2829 for (i = 0; i != num_modes; i++)
2831 DBGPRINT(
"supported %d", supported_modes[i]);
2832 if (supported_modes[i] == current_mode)
2835 hdmi_connected = TRUE;
2842 num_app_modes =
sizeof(app_video_formats) /
sizeof(app_video_formats[0]);
2844 for (j = 0; j != num_app_modes; j++)
2846 if (app_video_formats[j].mode == VIDEO_FORMAT_AUTO)
2849 &(app_video_formats[j].height));
2853 DBGPRINT(
"try mode %d", app_video_formats[j].mode);
2854 for (i = 0; i != num_modes; i++)
2856 if (app_video_formats[j].mode == supported_modes[i])
2858 DBGPRINT(
"select mode %d", supported_modes[i]);
2860 current_mode = supported_modes[i];
2862 #ifdef DEBUG_AV_OUTPUT 2864 app_video_formats[j].width, app_video_formats[j].height);
2871 if (valid_mode && app_video_formats[j].mode == current_mode)
2875 *width = app_video_formats[j].width;
2880 *height = app_video_formats[j].height;
2889 num_app_modes =
sizeof(app_video_formats) /
sizeof(app_video_formats[0]);
2890 current_mode = app_video_formats[num_app_modes - 1].mode;
2891 *width = app_video_formats[num_app_modes - 1].width;
2892 *height = app_video_formats[num_app_modes - 1].height;
2897 return(current_mode);
2910 E_STB_AV_VIDEO_FORMAT current_mode;
2911 E_STB_AV_VIDEO_FORMAT actual_mode;
2912 U16BIT width, height;
2913 BOOLEAN subt_displayed;
2917 current_mode = (E_STB_AV_VIDEO_FORMAT)
APP_NvmRead(HDMI_RESOLUTION_NVM);
2919 if (actual_mode != current_mode || force)
2921 DBGPRINT(
"mode=%d actual=%d width=%d,height=%d", current_mode, actual_mode, width, height);
2923 if (current_mode != VIDEO_FORMAT_AUTO && current_mode != actual_mode &&
ACTL_IsHDMIConnected())
2926 APP_NvmSave(HDMI_RESOLUTION_NVM, actual_mode, TRUE);
2955 #ifdef COMMON_INTERFACE 2965 #ifdef COMMON_INTERFACE 2973 hdmi_connected = TRUE;
2986 hdmi_connected = FALSE;
2999 return(hdmi_connected);
3013 E_STB_AV_VIDEO_FORMAT current_mode;
3014 E_STB_AV_VIDEO_FORMAT *supported_modes;
3015 U8BIT num_modes, num_app_modes;
3016 U16BIT num_valid_modes;
3019 FUNCTION_START(ACTL_GetHDMIResolutionStrings);
3021 num_valid_modes = 0;
3023 current_mode = (E_STB_AV_VIDEO_FORMAT)
APP_NvmRead(HDMI_RESOLUTION_NVM);
3027 num_app_modes =
sizeof(app_video_formats) /
sizeof(app_video_formats[0]);
3029 for (j = 0; j != num_app_modes; j++)
3031 for (i = 0; i != num_modes; i++)
3033 if (app_video_formats[j].mode == supported_modes[i])
3042 *video_formats = (E_STB_AV_VIDEO_FORMAT *)
STB_AppGetMemory(num_valid_modes *
sizeof(E_STB_AV_VIDEO_FORMAT));
3044 num_valid_modes = 0;
3046 for (j = 0; j != num_app_modes; j++)
3048 for (i = 0; i != num_modes; i++)
3050 if (app_video_formats[j].mode == supported_modes[i])
3052 (*video_formats)[num_valid_modes] = app_video_formats[j].mode;
3054 if (current_mode == supported_modes[i])
3056 *current_index = num_valid_modes;
3065 (*video_formats)[num_valid_modes] = VIDEO_FORMAT_AUTO;
3066 if (current_mode == VIDEO_FORMAT_AUTO)
3068 *current_index = num_valid_modes;
3072 FUNCTION_FINISH(ACTL_GetHDMIResolutionStrings);
3074 return(num_valid_modes);
3094 if (setting != PARENTAL_LOCK_ON)
3096 APP_NvmSave(PARENTAL_LOCK_NVM, PARENTAL_LOCK_ON, TRUE);
3101 if (setting != PARENTAL_LOCK_OFF)
3103 APP_NvmSave(PARENTAL_LOCK_NVM, PARENTAL_LOCK_OFF, TRUE);
3121 if (
APP_NvmRead(PARENTAL_LOCK_NVM) != PARENTAL_LOCK_OFF)
3147 if ((age >= 4) && (age <= 18))
3171 if ((age < 4) || (age > 18))
3190 U8BIT parental_lock;
3192 BOOLEAN restart_decoding;
3196 parental_lock = (U8BIT)
APP_NvmRead(PARENTAL_LOCK_NVM);
3197 if (parental_lock == PARENTAL_LOCK_OFF)
3204 restart_decoding = FALSE;
3211 (decoding_state[path] != DSTATE_DECODING))
3221 restart_decoding = TRUE;
3229 if (now_event != NULL)
3238 if ((age >= 0x01) && (age <= 0x0f))
3244 if (age >= parental_lock)
3253 #ifdef INTEGRATE_HBBTV 3258 restart_decoding = TRUE;
3268 #ifdef INTEGRATE_HBBTV 3271 restart_decoding = TRUE;
3286 restart_decoding = TRUE;
3291 if (restart_decoding)
3293 if (decoding_state[path] >= DSTATE_STARTING_BAD_SIGNAL)
3320 #ifdef COMMON_INTERFACE 3385 if (now_event != NULL)
3387 #ifdef COMMON_INTERFACE 3419 #ifdef COMMON_INTERFACE 3459 subtitles_suppressed = suppress;
3460 if(suppress == FALSE && subtitles_running)
3465 return(subtitles_suppressed);
3483 if (!subtitles_suppressed && path != INVALID_RES_ID)
3485 pid = GetSubtitlePidFunc(current_service[path], &subt_info);
3488 SUBT_DBG((
"ACTL_StartSubtitles: pid=%x dvb_subtitles=%d", pid,subt_info.is_dvb_subt));
3489 dvb_subtitles = subt_info.is_dvb_subt;
3492 SUBT_DBG((
"ACTL_StartSubtitles: calling STB_SUBStart(%u,%u)",subt_info.u.subt.cpage,subt_info.u.subt.apage));
3493 STB_SUBStart(path, pid, subt_info.u.subt.cpage, subt_info.u.subt.apage);
3501 SUBT_DBG((
"ACTL_StartSubtitles: calling STB_EBUTT_Start(%u,%u)", subt_info.u.ttxt.magazine,subt_info.u.ttxt.page));
3503 STB_EBUTT_Show(EBUTT_CHARACTER_SET_DESIGNATION_LATIN_DEFAULT, FALSE, FALSE);
3508 subtitles_running = TRUE;
3509 subtitles_started = TRUE;
3513 return(subtitles_started);
3525 if (subtitles_started && subtitles_running)
3530 SUBT_DBG((
"ACTL_PauseSubtitles: calling STB_SUBEnable(FALSE)"));
3535 SUBT_DBG((
"ACTL_PauseSubtitles: calling STB_EBUTT_Hide"));
3538 subtitles_running = FALSE;
3553 if (subtitles_started && !subtitles_running)
3561 SUBT_DBG((
"ACTL_ResumeSubtitles calling STB_SUBEnable(TRUE)"));
3566 STB_EBUTT_Show(EBUTT_CHARACTER_SET_DESIGNATION_LATIN_DEFAULT, FALSE, FALSE);
3570 subtitles_running = TRUE;
3585 if (subtitles_started)
3591 if (subtitles_running)
3593 SUBT_DBG((
"ACTL_StopSubtitles: calling STB_SUBEnable(FALSE)"));
3597 SUBT_DBG((
"ACTL_StopSubtitles: calling STB_SUBStop"));
3602 SUBT_DBG((
"ACTL_StopSubtitles:: calling STB_EBUTT_Hide"));
3604 STB_EBUTT_Stop(path, TRUE);
3606 subtitles_running = FALSE;
3607 subtitles_started = FALSE;
3620 return(subtitles_running);
3630 return(subtitles_started);
3670 if (path == INVALID_RES_ID)
3696 #ifdef DEBUG_SERVICE_SEARCH 3703 if (search_path != INVALID_RES_ID)
3706 APP_NvmSave(SEARCHING_STATE_NVM, (U32BIT)TRUE, TRUE);
3711 signal_type_required = tuner_type;
3716 terr_hierarchy = TUNE_THIERARCHY_NONE;
3723 case ACTL_FREQ_SEARCH:
3724 current_search_type = SEARCH_TYPE_SERVICE_FREQ;
3725 required_search_type = SEARCH_TYPE_SERVICE_FREQ;
3728 case ACTL_NETWORK_SEARCH:
3730 current_search_type = SEARCH_TYPE_SERVICE_FREQ;
3731 required_search_type = SEARCH_TYPE_SERVICE_NETWORK;
3735 current_search_type = SEARCH_TYPE_NOSEARCH;
3739 if (current_search_type != SEARCH_TYPE_NOSEARCH)
3749 case ACTL_FREQ_SEARCH:
3750 current_search_type = SEARCH_TYPE_SERVICE_FREQ;
3751 required_search_type = SEARCH_TYPE_SERVICE_FREQ;
3754 case ACTL_NETWORK_SEARCH:
3756 current_search_type = SEARCH_TYPE_SERVICE_FREQ;
3757 required_search_type = SEARCH_TYPE_SERVICE_NETWORK;
3761 current_search_type = SEARCH_TYPE_NOSEARCH;
3765 if (current_search_type != SEARCH_TYPE_NOSEARCH)
3773 current_search_type = SEARCH_TYPE_SERVICE_FREQ;
3774 required_search_type = SEARCH_TYPE_SERVICE_FREQ;
3783 case ACTL_FREQ_SEARCH:
3784 current_search_type = SEARCH_TYPE_SERVICE_FREQ;
3785 required_search_type = SEARCH_TYPE_SERVICE_FREQ;
3788 case ACTL_NETWORK_SEARCH:
3790 current_search_type = SEARCH_TYPE_SERVICE_FREQ;
3791 required_search_type = SEARCH_TYPE_SERVICE_NETWORK;
3795 current_search_type = SEARCH_TYPE_NOSEARCH;
3799 if (current_search_type != SEARCH_TYPE_NOSEARCH)
3802 MapIdToSatTuneParams(search_list_id, &tune_params);
3809 signal_type_required = SIGNAL_NONE;
3817 DBG_STDBY((
"Starting service search"));
3823 DBG_STDBY((
"Setting STANDBY_STATE_NVM=STDBY_UPDATE_SEARCH"));
3824 APP_NvmSave(STANDBY_STATE_NVM, STDBY_UPDATE_SEARCH, TRUE);
3834 current_search_type = SEARCH_TYPE_NOSEARCH;
3835 required_search_type = SEARCH_TYPE_NOSEARCH;
3836 EndSearch(search_path);
3837 search_path = INVALID_RES_ID;
3855 U32BIT *country_codes;
3881 EndSearch(search_path);
3882 search_path = INVALID_RES_ID;
3897 U16BIT num_transports;
3905 if (num_transports > 0)
3908 search_num_transports = num_transports;
3909 current_search_type = SEARCH_TYPE_STARTUP;
3912 RES_OWNER_DVB, DP_PRIORITY_LOW, FALSE, FALSE);
3913 if (search_path != INVALID_RES_ID)
3927 #ifdef INCLUDE_OTA_SSU 3937 BOOLEAN ACTL_StartSSUSearch(E_STB_DP_SIGNAL_TYPE tuner_type, F_SSU_VERSION_CALLBACK version_callback)
3941 U16BIT num_transports;
3943 FUNCTION_START(ACTL_StartSSUSearch);
3945 DBG_SSU((
"ACTL_StartSSUSearch"));
3952 if (num_transports > 0)
3955 search_num_transports = num_transports;
3958 RES_OWNER_DVB, DP_PRIORITY_LOW, FALSE, FALSE);
3959 if (search_path != INVALID_RES_ID)
3962 current_search_type = SEARCH_TYPE_SSU;
3963 current_search_tuner_type = tuner_type;
3965 ota_settings.ota_location = NULL;
3966 ota_settings.ota_onet_id = ADB_INVALID_DVB_ID;
3967 ota_settings.ota_tran_id = ADB_INVALID_DVB_ID;
3968 ota_settings.ota_serv_id = ADB_INVALID_DVB_ID;
3969 ota_settings.version_cb = version_callback;
3975 DBG_SSU((
"Starting OTA SSU search"));
3982 DBG_STDBY((
"Setting STANDBY_STATE_NVM=STDBY_UPDATE_SEARCH"));
3983 APP_NvmSave(STANDBY_STATE_NVM, STDBY_UPDATE_SEARCH, FALSE);
3992 FUNCTION_FINISH(ACTL_StartSSUSearch);
4009 U16BIT num_transports;
4015 TOT_DBG((
"ACTL_StartTotSearch(tuner_type=%s)",
4016 ((tuner_type == SIGNAL_COFDM) ?
"DVB-T" :
4017 (tuner_type == SIGNAL_QPSK) ?
"DVB-S" :
4018 (tuner_type == SIGNAL_QAM) ?
"DVB-C" :
"All")));
4022 if (num_transports > 0)
4025 search_num_transports = num_transports;
4026 required_search_type = SEARCH_TYPE_TOT;
4027 current_search_type = SEARCH_TYPE_TOT;
4028 current_search_tuner_type = tuner_type;
4031 RES_OWNER_DVB, DP_PRIORITY_LOW, FALSE, FALSE);
4032 if (search_path != INVALID_RES_ID)
4034 TOT_DBG((
"ACTL_StartTotSearch: Tuning, num_transports=%u", search_num_transports));
4041 #ifdef DEBUG_TOT_SEARCH 4044 TOT_DBG((
"ACTL_StartTotSearch: num_transports = 0"));
4048 if (retval == FALSE)
4065 if (search_path != INVALID_RES_ID)
4067 FinishSearch(search_path);
4069 #ifdef DEBUG_TOT_SEARCH 4072 TOT_DBG((
"ACTL_StopTotSearch: invalid path"));
4089 void **transport_list;
4090 U16BIT num_transports;
4091 void **network_list;
4092 U16BIT num_networks;
4101 if ((transport_list != NULL) && (num_transports != 0))
4103 search_num_transports = num_transports;
4108 if ((network_list != NULL) && (num_networks != 0))
4110 for (i = 0; i < num_networks; i++)
4117 for (j = 0; j < num_transports; j++)
4119 if ((transport_list[j] != t_ptr) &&
4123 transport_list[j] = NULL;
4124 search_num_transports--;
4133 if (search_num_transports != 0)
4136 search_transport_list = (
void **)
STB_AppGetMemory(search_num_transports *
sizeof(
void *));
4137 if (search_transport_list != NULL)
4139 for (i = 0, j = 0; i < num_transports; i++)
4141 if (transport_list[i] != NULL)
4143 search_transport_list[j] = transport_list[i];
4151 EIT_DBG((
"%s: Starting EIT %s search on %u transports", __FUNCTION__,
4152 ((search_type == ACTL_EVENT_SEARCH_PF) ?
"p/f" :
4153 (search_type == ACTL_EVENT_SEARCH_SCHED) ?
"sched" :
"p/f+sched"),
4154 search_num_transports));
4158 switch (search_type)
4160 case ACTL_EVENT_SEARCH_PF:
4161 current_search_type = SEARCH_TYPE_EIT_PF;
4163 case ACTL_EVENT_SEARCH_SCHED:
4164 current_search_type = SEARCH_TYPE_EIT_SCHED;
4166 case ACTL_EVENT_SEARCH_PF_SCHED:
4167 current_search_type = SEARCH_TYPE_EIT_PF_SCHED;
4171 retval = StartEitSearch();
4174 current_search_type = SEARCH_TYPE_NOSEARCH;
4179 EIT_DBG((
"%s: Failed to allocate memory for transports to be searched", __FUNCTION__));
4181 search_num_transports = 0;
4186 EIT_DBG((
"%s: No transports left after removing network transports!", __FUNCTION__));
4192 EIT_DBG((
"%s: Failed to find any transports for tuner type %u", __FUNCTION__, tuner_type));
4207 if (search_path != INVALID_RES_ID)
4211 search_path = INVALID_RES_ID;
4213 #ifdef DEBUG_EIT_SEARCH 4216 EIT_DBG((
"ACTL_StopEitSearch: invalid path"));
4232 return(current_search_type == SEARCH_TYPE_NOSEARCH);
4246 #if defined(DEBUG_SERVICE_SEARCH) || defined(DEBUG_TOT_SEARCH) || defined(DEBUG_SSU_SEARCH) || \ 4247 defined(DEBUG_STARTUP_SEARCH) 4248 static U8BIT last_progress = 0;
4254 switch (current_search_type)
4256 case SEARCH_TYPE_SERVICE_FREQ:
4257 if (signal_type_required == SIGNAL_QPSK)
4259 if ((num = GetNumSatSearchIds()) == 0)
4265 progress = (search_list_id * 100) / num;
4267 #ifdef DEBUG_SERVICE_SEARCH 4268 if (progress != last_progress)
4270 STB_SPDebugWrite(
"Progress: %u of %u, %u%%", search_list_id, num, progress);
4271 last_progress = progress;
4283 progress = (search_list_id * 100) / num;
4285 #ifdef DEBUG_SERVICE_SEARCH 4286 if (progress != last_progress)
4288 STB_SPDebugWrite(
"Progress: %u of %u, %u%%", search_list_id, num, progress);
4289 last_progress = progress;
4295 case SEARCH_TYPE_SERVICE_NETWORK:
4296 case SEARCH_TYPE_MANUAL_NETWORK:
4303 progress = (search_list_id * 100) / num;
4305 #ifdef DEBUG_SERVICE_SEARCH 4306 if (progress != last_progress)
4308 STB_SPDebugWrite(
"Progress: %u of %u, %u%%", search_list_id, num, progress);
4309 last_progress = progress;
4314 case SEARCH_TYPE_TOT:
4315 case SEARCH_TYPE_STARTUP:
4316 case SEARCH_TYPE_SSU:
4317 if (search_num_transports == 0)
4323 progress = (search_list_id * 100) / search_num_transports;
4325 #if defined(DEBUG_TOT_SEARCH) || defined(DEBUG_SSU_SEARCH) || defined(DEBUG_STARTUP_SEARCH) 4326 if (progress != last_progress)
4328 STB_SPDebugWrite(
"Progress: %u of %u, %u%%", search_list_id, search_num_transports, progress);
4329 last_progress = progress;
4361 E_ACTL_SI_SRCH_REQD si_type;
4368 if (chan_id < num_chans)
4370 if (search_path == INVALID_RES_ID)
4376 if (search_path != INVALID_RES_ID)
4380 si_type = ACTL_SI_CHANNEL_SEARCH;
4381 current_search_type = SEARCH_TYPE_MANUAL_FREQ;
4382 required_search_type = SEARCH_TYPE_MANUAL_FREQ;
4383 if (tuner_type == SIGNAL_COFDM)
4385 terr_hierarchy = TUNE_THIERARCHY_NONE;
4392 si_type = ACTL_SI_NO_SEARCH;
4393 current_search_type = SEARCH_TYPE_NOSEARCH;
4394 required_search_type = SEARCH_TYPE_NOSEARCH;
4397 signal_type_required = tuner_type;
4398 search_list_id = chan_id;
4403 current_search_type = SEARCH_TYPE_NOSEARCH;
4404 required_search_type = SEARCH_TYPE_NOSEARCH;
4407 search_path = INVALID_RES_ID;
4434 #ifdef DEBUG_SERVICE_SEARCH 4438 if (tuning_params != NULL)
4443 if (search_path != INVALID_RES_ID)
4450 terr_hierarchy = TUNE_THIERARCHY_NONE;
4451 t2_plp_id = tuning_params->u.terr.plp_id;
4460 tuner_type = SIGNAL_NONE;
4464 signal_type_required = tuner_type;
4466 if (signal_type_required != SIGNAL_NONE)
4468 if (type == ACTL_FREQ_SEARCH)
4470 current_search_type = SEARCH_TYPE_MANUAL_FREQ;
4471 required_search_type = SEARCH_TYPE_MANUAL_FREQ;
4475 current_search_type = SEARCH_TYPE_MANUAL_NETWORK;
4476 required_search_type = SEARCH_TYPE_MANUAL_NETWORK;
4487 DBG_STDBY((
"Starting manual service search"));
4493 DBG_STDBY((
"Setting STANDBY_STATE_NVM=STDBY_UPDATE_SEARCH"));
4494 APP_NvmSave(STANDBY_STATE_NVM, STDBY_UPDATE_SEARCH, TRUE);
4504 current_search_type = SEARCH_TYPE_NOSEARCH;
4505 required_search_type = SEARCH_TYPE_NOSEARCH;
4506 EndSearch(search_path);
4507 search_path = INVALID_RES_ID;
4526 if (search_path != INVALID_RES_ID)
4530 search_path = INVALID_RES_ID;
4533 #ifdef INTEGRATE_HBBTV 4539 required_search_type = SEARCH_TYPE_NOSEARCH;
4540 current_search_type = SEARCH_TYPE_NOSEARCH;
4553 #ifdef INCLUDE_OTA_SSU 4567 BOOLEAN ACTL_StartOTAUpdate(U8BIT path,
void *transport, U16BIT serv_id,
4568 F_SSU_VERSION_CALLBACK version_callback)
4573 FUNCTION_START(ACTL_StartOTAUpdate);
4577 ota_settings.ota_started = FALSE;
4578 ota_settings.ota_path = INVALID_RES_ID;
4580 DBG_SSU((
"%s(path=%u, ts=%p, serv=0x%04x, cb=%p)", __FUNCTION__, path, transport, serv_id,
4583 if (path == INVALID_RES_ID)
4593 ota_settings.ota_serv_id = serv_id;
4594 ota_settings.version_cb = version_callback;
4596 if (current_search_type == SEARCH_TYPE_NOSEARCH)
4598 current_search_type = SEARCH_TYPE_OTA_UPDATE;
4601 if (path != INVALID_RES_ID)
4608 if (ota_path != INVALID_RES_ID)
4610 if (ota_path != path)
4613 ota_settings.ota_path = ota_path;
4616 DBG_SSU((
"%s: Tuning to transport 0x%04x/%04x, path=%u", __FUNCTION__,
4623 DBG_SSU((
"%s: Failed to tune to transport 0x%04x/%04x", __FUNCTION__,
4626 if (current_search_type == SEARCH_TYPE_OTA_UPDATE)
4628 current_search_type = SEARCH_TYPE_NOSEARCH;
4635 if (current_search_type == SEARCH_TYPE_NOSEARCH)
4637 current_search_type = SEARCH_TYPE_OTA_UPDATE;
4642 if (!retval && (current_search_type == SEARCH_TYPE_OTA_UPDATE))
4644 current_search_type = SEARCH_TYPE_NOSEARCH;
4647 DBG_SSU((
"%s: Already tuned to transport, OTA search %s", __FUNCTION__,
4648 (retval ?
"started" :
"failed")));
4650 ota_settings.ota_started = retval;
4653 FUNCTION_FINISH(ACTL_StartOTAUpdate);
4663 void ACTL_ContinueOTAUpdate(BOOLEAN do_update)
4665 FUNCTION_START(ACTL_ContinueOTAUpdate);
4667 DBG_SSU((
"ACTL_ContinueOTAUpdate(%s)", do_update ?
"TRUE" :
"FALSE"));
4672 FUNCTION_FINISH(ACTL_ContinueOTAUpdate);
4678 void ACTL_StopOTAUpdate(
void)
4680 FUNCTION_START(ACTL_StopOTAUpdate);
4682 DBG_SSU((
"ACTL_StopOTAUpdate"));
4686 if (current_search_type == SEARCH_TYPE_OTA_UPDATE)
4688 current_search_type = SEARCH_TYPE_NOSEARCH;
4691 ota_settings.ota_onet_id = ADB_INVALID_DVB_ID;
4692 ota_settings.ota_tran_id = ADB_INVALID_DVB_ID;
4693 ota_settings.ota_serv_id = ADB_INVALID_DVB_ID;
4694 ota_settings.ota_started = FALSE;
4696 FUNCTION_FINISH(ACTL_StopOTAUpdate);
4707 external_control = control;
4724 GetSubtitlePidFunc = func;
4736 volume_scaling = scaling;
4737 if(volume_scaling < -100)
4738 volume_scaling = -100;
4739 if(volume_scaling > 100)
4740 volume_scaling = 100;
4743 AVSetAudioVolumes(FALSE);
4756 return(audio_volume);
4766 S8BIT volume_change;
4771 volume_change = (S8BIT)volume - audio_volume;
4772 if (volume_change != 0)
4778 new_volume = audio_volume;
4795 if (volume_change != 0)
4800 audio_muted = FALSE;
4801 AVSetAudioVolumes(FALSE);
4805 if (volume_change > 0)
4807 audio_volume += volume_change;
4808 if (audio_volume > 100)
4815 if (audio_volume < -volume_change)
4821 audio_volume += volume_change;
4825 AVSetAudioVolumes(TRUE);
4831 return(audio_volume);
4848 audio_muted = FALSE;
4850 AVSetAudioVolumes(FALSE);
4865 audio_muted = FALSE;
4871 AVSetAudioVolumes(FALSE);
4875 return(audio_muted);
4886 return(audio_muted);
4904 path = AcquirePathForService(s_ptr, with_decoders, for_recording, owner_info);
4947 #ifdef COMMON_INTERFACE 5073 standby_grace_timeout = num_seconds;
5083 U8BIT path, num_paths;
5085 U32BIT recording_handle;
5086 U8BIT hours, mins, secs;
5087 U16BIT grace_timeout;
5088 U32DHMS enter_standby_time;
5092 DBG_STDBY((
"%s", __FUNCTION__));
5111 DBG_STDBY((
"ACTL_EnterStandby: saving service to NVM... LCN=%d",
ADB_GetServiceLcn(s_ptr)));
5133 standby_path = INVALID_RES_ID;
5139 DBG_STDBY((
"Recording in progress, entering active standby"));
5140 APP_NvmSave(STANDBY_STATE_NVM, (U32BIT)STDBY_RECORDING, TRUE);
5150 if (EnterStandby(&s_ptr))
5161 for (path = 0; path < num_paths; path++)
5168 #ifdef COMMON_INTERFACE 5169 hours = standby_grace_timeout / 3600;
5170 mins = (standby_grace_timeout % 3600) / 60;
5171 secs = standby_grace_timeout % 60;
5175 if (STB_CIStartPowerDown(CIPowerDownReadyCallback))
5178 grace_timeout = (standby_grace_timeout > 30)? standby_grace_timeout : 30;
5182 grace_timeout = standby_grace_timeout;
5185 grace_timeout = standby_grace_timeout;
5187 if (grace_timeout != 0)
5191 hours = grace_timeout / 3600;
5192 mins = (grace_timeout % 3600) / 60;
5193 secs = grace_timeout % 60;
5195 DBG_STDBY((
"Starting standby grace period of %02u:%02u:%02u", hours, mins, secs));
5200 standby_grace_timer = CreateTimer(enter_standby_time);
5209 DBG_STDBY((
"Entering low power standby"));
5215 DBG_STDBY((
"Entering passive standby"));
5220 else if (s_ptr != NULL)
5223 if ((standby_path = AcquirePathForService(s_ptr, FALSE, FALSE, NULL)) != INVALID_RES_ID)
5229 DBG_STDBY((
"Recording due to start soon, entering active standby"));
5230 APP_NvmSave(STANDBY_STATE_NVM, (U32BIT)STDBY_WAKE_FOR_RECORDING, TRUE);
5236 DBG_STDBY((
"Background search due to start, entering active standby"));
5237 APP_NvmSave(STANDBY_STATE_NVM, (U32BIT)STDBY_WAKE_FOR_SEARCH, TRUE);
5255 U16BIT num_services;
5258 U32BIT recording_handle;
5262 DBG_STDBY((
"%s(%p, tune_to_service=%u)", __FUNCTION__, s_ptr, tune_to_service));
5267 if (required_search_type != SEARCH_TYPE_NOSEARCH)
5269 switch (required_search_type)
5271 case SEARCH_TYPE_SERVICE_FREQ:
5272 case SEARCH_TYPE_SERVICE_NETWORK:
5278 case SEARCH_TYPE_EIT_PF:
5279 case SEARCH_TYPE_EIT_SCHED:
5280 case SEARCH_TYPE_EIT_PF_SCHED:
5284 case SEARCH_TYPE_SSU:
5311 DBG_STDBY((
"Setting STANDBY_STATE_NVM=STDBY_POWER_ON"));
5312 APP_NvmSave(STANDBY_STATE_NVM, STDBY_POWER_ON, TRUE);
5316 if (standby_wakeup_timer != INVALID_TIMER_HANDLE)
5319 standby_wakeup_timer = INVALID_TIMER_HANDLE;
5322 if (standby_grace_timer != INVALID_TIMER_HANDLE)
5325 standby_grace_timer = INVALID_TIMER_HANDLE;
5329 if (required_search_type == SEARCH_TYPE_NOSEARCH)
5331 if ((s_ptr == NULL) && tune_to_service)
5335 DBG_STDBY((
"ACTL_LeaveStandby: LCN in NVM=%u", lcn));
5340 if ((slist != NULL) && (num_services > 0))
5343 #ifdef DEBUG_STANDBY 5346 DBG_STDBY((
"ACTL_LeaveStandby: LCN not found, use first TV service, serv_id %u",
5358 if ((slist != NULL) && (num_services > 0))
5361 #ifdef DEBUG_STANDBY 5364 DBG_STDBY((
"ACTL_LeaveStandby: LCN not found, use first service, serv_id %u",
5372 #ifdef DEBUG_STANDBY 5375 DBG_STDBY((
"ACTL_LeaveStandby: LCN %u found, serv_id %u", lcn,
ADB_GetServiceId(s_ptr)));
5386 standby_path = INVALID_RES_ID;
5394 if (path != INVALID_RES_ID)
5397 #ifdef DEBUG_STANDBY 5400 DBG_STDBY((
"%s: can't tune to service so tuning to live service %u", __FUNCTION__,
5408 for (path = 0, s_ptr = NULL; (path <
STB_DPGetNumPaths()) && (s_ptr == NULL); path++)
5412 #ifdef DEBUG_STANDBY 5415 DBG_STDBY((
"%s: can't tune to service so tuning to service %u", __FUNCTION__,
5426 #ifdef DEBUG_STANDBY 5429 DBG_STDBY((
"%s: No service to tune to!", __FUNCTION__));
5447 void *tuned_service;
5453 if (((live_path =
STB_DPGetLivePath()) != INVALID_RES_ID) && (current_service[live_path] != NULL))
5457 if (tuned_service != current_service[live_path])
5460 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_CHANGED, &tuned_service,
sizeof(
void *));
5463 current_service[live_path] = tuned_service;
5485 ADB_PROFILE_TYPE type;
5486 #ifdef COMMON_INTERFACE 5487 U16BIT cicam_onet_id;
5495 if (profile != NULL)
5497 #ifdef COMMON_INTERFACE 5506 if (type == ADB_PROFILE_TYPE_BROADCAST)
5511 #ifdef COMMON_INTERFACE 5512 else if (type == ADB_PROFILE_TYPE_CIPLUS)
5514 if (ADB_GetProfileModulePresent(profile))
5519 ADB_GetProfileCAMInfo(profile, &cicam_onet_id, &cicam_id);
5520 DBDEF_SelectCIPlusProfile(cicam_onet_id, cicam_id);
5542 E_ACTL_DECODE_CHANGE change;
5543 E_STB_DP_AUDIO_MODE mode;
5544 E_STB_DP_AUDIO_CODEC codec;
5545 ADB_STREAM_TYPE type;
5547 BOOLEAN broadcast_mix;
5551 change = ACTL_NO_CHANGE;
5569 change |= ACTL_ADESC_CHANGE;
5583 change |= ACTL_AUDIO_CHANGE;
5611 #if defined(DEBUG_TUNING) || defined(DEBUG_DECODING) || defined(DEBUG_AV_OUTPUT) || defined(DEBUG_MHEG) 5612 static U8BIT* GetEventDebugString(E_ACTL_EVENT_TYPE type, U32BIT event)
5616 if (type == INTERNAL_EVENT)
5620 case INT_EVENT_INITIALISE: {
string = (U8BIT *)
"initialise";
break; }
5621 case INT_EVENT_ENABLE: {
string = (U8BIT *)
"enable";
break; }
5622 case INT_EVENT_DISABLE: {
string = (U8BIT *)
"disable";
break; }
5623 case INT_EVENT_UPDATE: {
string = (U8BIT *)
"update";
break; }
5624 case INT_EVENT_RF_CHAN_TUNE_REQD: {
string = (U8BIT *)
"rf tune";
break; }
5625 case INT_EVENT_TPTR_TUNE_REQD: {
string = (U8BIT *)
"tp tune";
break; }
5626 case INT_EVENT_USERDEFINED_TUNE_REQD: {
string = (U8BIT *)
"user tune";
break; }
5627 case INT_EVENT_TUNE_OFF: {
string = (U8BIT *)
"tune off";
break; }
5628 case INT_EVENT_RESTART_DECODING: {
string = (U8BIT *)
"restart decode";
break; }
5629 case INT_EVENT_RESTART_AUDIO: {
string = (U8BIT *)
"restart audio";
break; }
5630 case INT_EVENT_RESTART_SUBTITLES: {
string = (U8BIT *)
"restart subtitles";
break; }
5631 case INT_EVENT_RELEASE_DECODE_LOCK: {
string = (U8BIT *)
"release decode lock";
break; }
5632 case INT_EVENT_STANDBY_ON: {
string = (U8BIT *)
"standby on";
break; }
5633 case INT_EVENT_STANDBY_OFF: {
string = (U8BIT *)
"standby off";
break; }
5634 case INT_EVENT_STANDBY_VCR_ACTIVE: {
string = (U8BIT *)
"standby vcr active";
break; }
5635 case INT_EVENT_ALT_AV_ALLOWED: {
string = (U8BIT *)
"scart allowed";
break; }
5636 case INT_EVENT_ALT_AV_NOT_ALLOWED: {
string = (U8BIT *)
"scart not allowed";
break; }
5637 case INT_EVENT_ANALOG_TV_ON: {
string = (U8BIT *)
"analogue tv on";
break; }
5638 case INT_EVENT_ANALOG_TV_OFF: {
string = (U8BIT *)
"analogue tv off";
break; }
5639 case INT_EVENT_ANALOG_VIDEO_ALLOWED: {
string = (U8BIT *)
"analogue video allowed";
break; }
5640 case INT_EVENT_ANALOG_VIDEO_NOT_ALLOWED: {
string = (U8BIT *)
"analogue video not allowed";
break; }
5641 default: {
string = (U8BIT *)
"unknown internal event";
break; }
5648 case STB_EVENT_TUNE_LOCKED: {
string = (U8BIT *)
"TUNE LOCKED";
break; }
5649 case STB_EVENT_TUNE_NOTLOCKED: {
string = (U8BIT *)
"TUNE NOT LOCKED";
break; }
5650 case STB_EVENT_TUNE_SIGNAL_DATA_BAD: {
string = (U8BIT *)
"SIGNAL BAD";
break; }
5651 case STB_EVENT_TUNE_SIGNAL_DATA_OK: {
string = (U8BIT *)
"SIGNAL OK";
break; }
5652 case STB_EVENT_AUDIO_DECODE_STARTED: {
string = (U8BIT *)
"AUDIO DECODE STARTED";
break; }
5653 case STB_EVENT_VIDEO_DECODE_STARTED: {
string = (U8BIT *)
"VIDEO DECODE STARTED";
break; }
5654 case STB_EVENT_AUDIO_DECODE_STOPPED: {
string = (U8BIT *)
"AUDIO DECODE STOPPED";
break; }
5655 case STB_EVENT_VIDEO_DECODE_STOPPED: {
string = (U8BIT *)
"VIDEO DECODE STOPPED";
break; }
5656 case STB_EVENT_DECODE_LOCKED: {
string = (U8BIT *)
"DECODE LOCKED";
break; }
5658 case STB_EVENT_SCART_DISCONNECTED: {
string = (U8BIT *)
"SCART OFF";
break; }
5659 case STB_EVENT_SCART_FORCE: {
string = (U8BIT *)
"SCART ON";
break; }
5661 case STB_EVENT_CI_OPEN_MODULE: {
string = (U8BIT *)
"CI UI ON";
break; }
5662 case STB_EVENT_CI_CLOSE_MODULE: {
string = (U8BIT *)
"CI UI OFF";
break; }
5663 case APP_EVENT_SERVICE_NOT_RUNNING: {
string = (U8BIT *)
"SERV NOT RUNNING";
break; }
5664 case APP_EVENT_SERVICE_RUNNING: {
string = (U8BIT *)
"SERV RUNNING";
break; }
5665 case APP_EVENT_SERVICE_AUDIO_PID_UPDATE: {
string = (U8BIT *)
"AUDIO PID CHANGE";
break; }
5666 case APP_EVENT_SERVICE_VIDEO_PID_UPDATE: {
string = (U8BIT *)
"VIDEO PID CHANGE";
break; }
5667 case APP_EVENT_SERVICE_SUBTITLE_UPDATE: {
string = (U8BIT *)
"SUBTITLE CHANGE";
break; }
5668 case APP_EVENT_SERVICE_SCRAMBLE_CHANGE: {
string = (U8BIT *)
"SERV SCRAMBLE CHANGE";
break; }
5669 default: {
string = (U8BIT *)
"unknown external event";
break; }
5677 #ifdef COMMON_INTERFACE 5690 BOOLEAN override_parental_lock,
void *t_ptr, E_ACTL_SI_SRCH_REQD reqd_si, BOOLEAN relock_on)
5696 tuneto_live_service = s_ptr;
5697 decode_lock_override_required = override_parental_lock;
5698 tuneto_live_transport = t_ptr;
5699 tuneto_live_si = reqd_si;
5700 tuneto_relock = relock_on;
5701 tuneto_for_recording = FALSE;
5702 tuneto_owner_info = CopyOwnerInfo(owner_info);
5711 DBGPRINT(
"Need to ask for path %u to be released by CI+, but there's no owner data!", path);
5731 BOOLEAN override_parental_lock,
void *t_ptr, E_ACTL_SI_SRCH_REQD reqd_si, BOOLEAN relock_on)
5733 E_STB_DP_SIGNAL_TYPE signal_type;
5735 E_STB_DP_RES_OWNER owner;
5736 #ifdef COMMON_INTERFACE 5737 BOOLEAN ask_release;
5740 FUNCTION_START(AcquireLivePath);
5742 #ifndef COMMON_INTERFACE 5743 USE_UNWANTED_PARAM(override_parental_lock);
5744 USE_UNWANTED_PARAM(reqd_si);
5745 USE_UNWANTED_PARAM(relock_on);
5748 if (owner_info != NULL)
5750 owner = owner_info->owner;
5754 owner = RES_OWNER_NONE;
5764 if (current_service[path] != NULL)
5775 path = AcquirePathForService(s_ptr, TRUE, FALSE, owner_info);
5777 else if (t_ptr != NULL)
5782 if ((path != INVALID_RES_ID) && (owner_info != NULL))
5787 #ifdef COMMON_INTERFACE 5788 if (owner == RES_OWNER_CIPLUS)
5797 #ifdef COMMON_INTERFACE 5798 if ((path == INVALID_RES_ID) && (owner == RES_OWNER_CIPLUS))
5800 ACI_TuneReply(path, *(U32BIT *)owner_info->data, CIP_TUNER_BUSY);
5808 #ifdef COMMON_INTERFACE 5811 AskRelease(path, s_ptr, owner_info, override_parental_lock, t_ptr, reqd_si, relock_on);
5814 path = INVALID_RES_ID;
5819 STB_SPDebugWrite(
"[%s:%d]: Live path needs to be released but has an owner which isn't CI+\n",
5820 __FUNCTION__, __LINE__);
5829 path = AcquirePathForService(s_ptr, TRUE, FALSE, owner_info);
5831 else if (t_ptr != NULL)
5847 if ((path != INVALID_RES_ID) && (owner_info != NULL))
5852 #ifdef COMMON_INTERFACE 5853 if (owner == RES_OWNER_CIPLUS)
5862 #ifdef COMMON_INTERFACE 5863 if (path == INVALID_RES_ID)
5865 ask_release = FALSE;
5873 AskRelease(path, s_ptr, owner_info, override_parental_lock, t_ptr, reqd_si,
5877 path = INVALID_RES_ID;
5883 STB_SPDebugWrite(
"[%s:%d]: Live path needs to be released but has an owner which isn't CI+\n",
5884 __FUNCTION__, __LINE__);
5888 if (!ask_release && (owner == RES_OWNER_CIPLUS))
5891 path = INVALID_RES_ID;
5892 ACI_TuneReply(path, *(U32BIT *)owner_info->data, CIP_TUNER_BUSY);
5898 FUNCTION_FINISH(AcquireLivePath);
5906 E_STB_DP_SIGNAL_TYPE sig_type;
5908 E_STB_DP_RES_OWNER owner;
5909 BOOLEAN slot_acquired;
5910 #ifdef COMMON_INTERFACE 5919 FUNCTION_START(AcquireRecordingPath);
5921 path = INVALID_RES_ID;
5923 if (owner_info != NULL)
5925 owner = owner_info->owner;
5929 owner = RES_OWNER_NONE;
5938 slot_acquired = FALSE;
5941 if (path != INVALID_RES_ID)
5943 if (owner_info != NULL)
5949 #ifdef COMMON_INTERFACE 5973 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_CHANGED, &s_ptr,
sizeof(
void *));
5982 #ifdef COMMON_INTERFACE 5986 tuneto_live_service = s_ptr;
5987 decode_lock_override_required = FALSE;
5988 tuneto_live_transport = NULL;
5989 tuneto_for_recording = TRUE;
5990 tuneto_owner_info = CopyOwnerInfo(owner_info);
5999 STB_SPDebugWrite(
"[%s:%d]: Need to ask for path %u to be released by CI+, but there's no owner data!",
6000 __FUNCTION__, __LINE__, path);
6004 path = INVALID_RES_ID;
6009 path = INVALID_RES_ID;
6010 STB_SPDebugWrite(
"[%s:%d]: Live path needs to be released but has an owner which isn't CI+\n",
6011 __FUNCTION__, __LINE__);
6016 STB_SPDebugWrite(
"[%s:%d]: No live path but can't acquire a recording path!\n", __FUNCTION__, __LINE__);
6021 FUNCTION_FINISH(AcquireRecordingPath);
6026 #ifdef COMMON_INTERFACE 6031 FUNCTION_START(CopyOwnerInfo);
6033 if (owner_info != NULL)
6037 copy->owner = owner_info->owner;
6039 copy->data_size = 0;
6041 if ((owner_info->data != NULL) && (owner_info->data_size > 0))
6045 memcpy(copy->data, owner_info->data, owner_info->data_size);
6046 copy->data_size = owner_info->data_size;
6056 FUNCTION_FINISH(CopyOwnerInfo);
6076 static void SetupForTuning(U8BIT path, U32BIT event)
6078 U32BIT country_code;
6082 U16BIT num_rf_chans;
6085 U32BIT *additional_freqs;
6088 FUNCTION_START(SetupForTuning);
6090 if (event == INT_EVENT_RF_CHAN_TUNE_REQD)
6094 switch (signal_type_required)
6111 if (success && (rf_chan_id_required < num_rf_chans))
6113 switch (signal_type_required)
6116 tuning_params.freq = ana_channel_table[rf_chan_id_required].freq_hz;
6117 tuning_params.u.ana.offset = 0;
6118 tuning_params.u.ana.vtype = ANLG_VIDEO_PAL_I;
6121 tuning_params.freq = ter_channel_table[rf_chan_id_required].freq_hz;
6122 tuning_params.u.terr.type = ter_channel_table[rf_chan_id_required].type;
6123 tuning_params.u.terr.mode = ter_channel_table[rf_chan_id_required].mode;
6124 tuning_params.u.terr.bwidth = ter_channel_table[rf_chan_id_required].bwidth;
6130 tuning_params.freq = cab_channel_table[rf_chan_id_required].freq_hz;
6131 tuning_params.u.cab.mode = cab_channel_table[rf_chan_id_required].mode;
6132 tuning_params.u.cab.symbol_rate = cab_channel_table[rf_chan_id_required].symbol_rate;
6142 tuning_params.freq = 0;
6145 else if (event == INT_EVENT_USERDEFINED_TUNE_REQD)
6152 switch (signal_type_required)
6156 &tuning_params.u.ana.offset, &tuning_params.u.ana.vtype);
6160 &tuning_params.freq, &tuning_params.u.terr.mode, &tuning_params.u.terr.bwidth,
6161 &tuning_params.u.terr.plp_id);
6165 &tuning_params.u.cab.mode, &tuning_params.u.cab.symbol_rate);
6170 &tuning_params.u.sat.polarity, &tuning_params.u.sat.symbol_rate,
6171 &tuning_params.u.sat.fec, &tuning_params.u.sat.dvb_s2, &tuning_params.u.sat.modulation);
6174 tuning_params.freq = 0;
6184 StartTune(path, &tuning_params);
6186 FUNCTION_FINISH(SetupForTuning);
6197 void *lnb_ptr, *band;
6202 FUNCTION_START(StartTune);
6204 if (sat_lnb_bands != NULL)
6207 sat_lnb_bands = NULL;
6214 switch (signal_type_required)
6219 current_satellite[path] = NULL;
6226 current_satellite[path] = NULL;
6231 current_satellite[path] = NULL;
6241 current_satellite[path] = tuning_params->u.sat.satellite;
6265 if (lnb_settings.type == LNB_TYPE_USER_DEFINED)
6269 while (band != NULL)
6281 if (sat_lnb_bands != NULL)
6285 while (band != NULL)
6318 current_transport[path] = transport_required[path];
6319 current_tuner_relock = tuner_relock_required;
6320 current_si[path] = APP_SI_MODE_NO_SI;
6322 FUNCTION_FINISH(StartTune);
6336 static void SetupForDecoding(U8BIT path)
6338 E_STB_AV_ASPECT_MODE aspect_mode;
6343 ADB_STREAM_TYPE stream_type;
6345 U8BIT audio_decoder;
6346 E_STB_DIGITAL_AUDIO_TYPE audio_type;
6347 E_STB_DP_AUDIO_CODEC audio_codec;
6350 FUNCTION_START(SetupForDecoding);
6355 if (!external_control)
6361 ADB_GetStreamList(service_required[path], ADB_VIDEO_LIST_STREAM, &stream_list, &num_streams);
6362 if ((num_streams > 0) && (stream_list != NULL))
6365 for (i = 0; i < num_streams; i++)
6384 audio_type = (E_STB_DIGITAL_AUDIO_TYPE)
APP_NvmRead(SPDIF_OUTPUT_NVM);
6386 if ((audio_type == DIGITAL_AUDIO_COMPRESSED) && ((audio_codec == AUDIO_CODEC_MP2) ||
6387 (audio_codec == AUDIO_CODEC_MP3)))
6389 audio_type = DIGITAL_AUDIO_PCM;
6393 audio_type = (E_STB_DIGITAL_AUDIO_TYPE)
APP_NvmRead(HDMI_AUDIO_OUTPUT_NVM);
6394 if ((audio_type == DIGITAL_AUDIO_COMPRESSED) && ((audio_codec == AUDIO_CODEC_MP2) ||
6395 (audio_codec == AUDIO_CODEC_MP3)))
6397 audio_type = DIGITAL_AUDIO_PCM;
6401 subt_pid = GetSubtitlePidFunc(current_service[path], &subt_info);
6408 aspect_mode = (E_STB_AV_ASPECT_MODE)
APP_NvmRead(ASPECT_MODE_NVM);
6412 AVSetAudioVolumes(FALSE);
6418 FUNCTION_FINISH(SetupForDecoding);
6432 static void StartSiProcess(U8BIT path)
6434 FUNCTION_START(StartSiProcess);
6436 if (si_required[path] == APP_SI_MODE_NO_SI)
6444 if (si_required[path] == APP_SI_MODE_UPDATE)
6454 current_si[path] = si_required[path];
6456 FUNCTION_FINISH(StartSiProcess);
6473 static void ControlTuning(U8BIT path, E_ACTL_EVENT_TYPE type, U32BIT event)
6477 E_STB_DP_TUNE_STATUS tune_status;
6478 #ifdef COMMON_INTERFACE 6483 #if defined(INTEGRATE_HBBTV) 6484 U16BIT onet_id, ts_id, serv_id;
6487 FUNCTION_START(ControlTuning);
6491 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_INITIALISE))
6495 tuning_state[path] = TSTATE_OFF;
6496 tuned_status[path] = TUNED_STATUS_NO_SIGNAL;
6498 transport_required[path] = NULL;
6499 service_required[path] = NULL;
6500 si_required[path] = APP_SI_MODE_NO_SI;
6502 current_satellite[path] = NULL;
6503 current_service[path] = NULL;
6504 current_transport[path] = NULL;
6505 current_si[path] = APP_SI_MODE_NO_SI;
6507 current_tuner_relock = FALSE;
6516 U8BIT *state_string;
6517 U8BIT *event_string;
6519 switch (tuning_state[path])
6521 case TSTATE_OFF: {state_string = (U8BIT *)
"Off";
break; }
6522 case TSTATE_TUNING: {state_string = (U8BIT *)
"Tuning";
break; }
6523 case TSTATE_NOT_TUNED: {state_string = (U8BIT *)
"Not tuned";
break; }
6524 case TSTATE_TUNED: {state_string = (U8BIT *)
"Tuned";
break; }
6525 case TSTATE_ANALOG: {state_string = (U8BIT *)
"Analogue";
break; }
6526 default: {state_string = (U8BIT *)
"Unknown state - error";
break; }
6528 event_string = GetEventDebugString(type, event);
6529 STB_SPDebugWrite(
"ControlTuning(%d): %s, %s", path, state_string, event_string);
6533 switch (tuning_state[path])
6537 if ((type == INTERNAL_EVENT) &&
6538 ((event == INT_EVENT_RF_CHAN_TUNE_REQD) ||
6539 (event == INT_EVENT_TPTR_TUNE_REQD) ||
6540 (event == INT_EVENT_USERDEFINED_TUNE_REQD)))
6542 if (signal_type_required == SIGNAL_ANALOG)
6547 tuning_state[path] = TSTATE_ANALOG;
6548 SetupForTuning(path, event);
6550 if (service_required[path] != NULL)
6552 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_ANALOG_STARTED, NULL, 0);
6553 ControlAvOutput(INTERNAL_EVENT, INT_EVENT_ANALOG_TV_ON);
6561 tuning_state[path] = TSTATE_TUNING;
6562 SetupForTuning(path, event);
6570 if (type == INTERNAL_EVENT)
6572 if (event == INT_EVENT_TUNE_OFF)
6579 tuning_state[path] = TSTATE_OFF;
6581 else if ((event == INT_EVENT_RF_CHAN_TUNE_REQD) ||
6582 (event == INT_EVENT_TPTR_TUNE_REQD) || (event == INT_EVENT_USERDEFINED_TUNE_REQD))
6584 if (signal_type_required == SIGNAL_ANALOG)
6589 tuning_state[path] = TSTATE_ANALOG;
6590 if (service_required[path] != NULL)
6592 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_ANALOG_STARTED, NULL, 0);
6593 ControlAvOutput(INTERNAL_EVENT, INT_EVENT_ANALOG_TV_ON);
6596 SetupForTuning(path, event);
6597 #if defined(INTEGRATE_HBBTV) 6601 if (service_required[path] != NULL)
6607 onet_id = ADB_INVALID_DVB_ID;
6608 ts_id = ADB_INVALID_DVB_ID;
6609 serv_id = ADB_INVALID_DVB_ID;
6612 HBBTV_CHANNEL_CHANGE_INTERRUPTED);
6621 case STB_EVENT_TUNE_NOTLOCKED:
6627 if (tune_status == TUNE_NO_LOCK)
6637 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_ENABLE);
6640 tuning_state[path] = TSTATE_NOT_TUNED;
6642 #ifdef COMMON_INTERFACE 6649 ACI_TuneReply(path, *(U32BIT *)owner_data, CIP_TUNER_NOTLOCKED);
6657 #ifdef COMMON_INTERFACE 6674 EV_PVR_RECORDING_FAILED, NULL, 0);
6677 #if defined(INTEGRATE_HBBTV) 6681 if (service_required[path] != NULL)
6687 onet_id = ADB_INVALID_DVB_ID;
6688 ts_id = ADB_INVALID_DVB_ID;
6689 serv_id = ADB_INVALID_DVB_ID;
6692 HBBTV_CHANNEL_CHANGE_NO_SIGNAL);
6698 case STB_EVENT_TUNE_LOCKED:
6704 if (tune_status == TUNE_LOCKED)
6710 tuning_state[path] = TSTATE_TUNED;
6711 tuned_status[path] = TUNED_STATUS_GOOD_SIGNAL;
6713 UpdateTransportParameters(path);
6716 StartSiProcess(path);
6719 current_service[path]->pmt_received)
6723 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_CHANGED,
6724 ¤t_service[path],
sizeof(
void *));
6725 #if defined(INTEGRATE_HBBTV) 6729 HBBTV_CHANNEL_CHANGE_SUCCEEDED);
6733 #ifdef COMMON_INTERFACE 6741 ((si_required[path] == APP_SI_MODE_NO_SI) ||
6742 ((current_service[path] != NULL) && current_service[path]->pmt_received)))
6746 ACI_TuneReply(path, *(U32BIT *)owner_data, CIP_TUNER_LOCKED);
6755 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_ENABLE);
6777 case TSTATE_NOT_TUNED:
6779 if (type == INTERNAL_EVENT)
6783 case INT_EVENT_TUNE_OFF:
6791 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_DISABLE);
6794 tuning_state[path] = TSTATE_OFF;
6797 case INT_EVENT_RF_CHAN_TUNE_REQD:
6798 case INT_EVENT_TPTR_TUNE_REQD:
6799 case INT_EVENT_USERDEFINED_TUNE_REQD:
6803 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_DISABLE);
6805 if (signal_type_required == SIGNAL_ANALOG)
6810 tuning_state[path] = TSTATE_ANALOG;
6811 if (service_required[path] != NULL)
6813 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_ANALOG_STARTED, NULL, 0);
6814 ControlAvOutput(INTERNAL_EVENT, INT_EVENT_ANALOG_TV_ON);
6822 tuning_state[path] = TSTATE_TUNING;
6824 SetupForTuning(path, event);
6831 if (event == STB_EVENT_TUNE_LOCKED)
6835 if (tune_status == TUNE_LOCKED)
6841 tuning_state[path] = TSTATE_TUNED;
6842 tuned_status[path] = TUNED_STATUS_GOOD_SIGNAL;
6846 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_DECODING);
6850 StartSiProcess(path);
6853 current_service[path]->pmt_received)
6857 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_CHANGED,
6858 ¤t_service[path],
sizeof(
void *));
6859 #if defined(INTEGRATE_HBBTV) 6863 HBBTV_CHANNEL_CHANGE_SUCCEEDED);
6874 if (type == INTERNAL_EVENT)
6876 if ((event == INT_EVENT_TUNE_OFF) || (event == INT_EVENT_RF_CHAN_TUNE_REQD) ||
6877 (event == INT_EVENT_TPTR_TUNE_REQD) || (event == INT_EVENT_USERDEFINED_TUNE_REQD))
6890 case INT_EVENT_TUNE_OFF:
6896 tuning_state[path] = TSTATE_OFF;
6897 tuned_status[path] = TUNED_STATUS_NO_SIGNAL;
6900 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_DISABLE);
6905 case INT_EVENT_RF_CHAN_TUNE_REQD:
6906 case INT_EVENT_USERDEFINED_TUNE_REQD:
6908 tuned_status[path] = TUNED_STATUS_NO_SIGNAL;
6911 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_DISABLE);
6913 if (signal_type_required == SIGNAL_ANALOG)
6918 tuning_state[path] = TSTATE_ANALOG;
6925 tuning_state[path] = TSTATE_TUNING;
6927 SetupForTuning(path, event);
6930 case INT_EVENT_TPTR_TUNE_REQD:
6932 if ((transport_required[path] != current_transport[path]) ||
6933 (tuner_relock_required != current_tuner_relock) ||
6934 (si_required[path] != current_si[path]))
6937 tuned_status[path] = TUNED_STATUS_NO_SIGNAL;
6940 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_DISABLE);
6942 if (signal_type_required == SIGNAL_ANALOG)
6947 tuning_state[path] = TSTATE_ANALOG;
6948 if (service_required[path] != NULL)
6950 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_ANALOG_STARTED, NULL, 0);
6951 ControlAvOutput(INTERNAL_EVENT, INT_EVENT_ANALOG_TV_ON);
6959 tuning_state[path] = TSTATE_TUNING;
6961 SetupForTuning(path, event);
6969 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_RESTART_DECODING);
6972 StartSiProcess(path);
6983 case STB_EVENT_TUNE_LOCKED:
6984 case STB_EVENT_TUNE_SIGNAL_DATA_OK:
6986 tuned_status[path] = TUNED_STATUS_GOOD_SIGNAL;
6989 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_UPDATE);
6993 case STB_EVENT_TUNE_NOTLOCKED:
6995 tuned_status[path] = TUNED_STATUS_NO_SIGNAL;
6998 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_UPDATE);
7002 case STB_EVENT_TUNE_SIGNAL_DATA_BAD:
7004 tuned_status[path] = TUNED_STATUS_BAD_SIGNAL;
7007 ControlDecoding(path, INTERNAL_EVENT, INT_EVENT_UPDATE);
7019 if (type == INTERNAL_EVENT)
7021 if (event == INT_EVENT_TUNE_OFF)
7028 tuning_state[path] = TSTATE_OFF;
7029 ControlAvOutput(INTERNAL_EVENT, INT_EVENT_ANALOG_TV_OFF);
7031 else if ((event == INT_EVENT_RF_CHAN_TUNE_REQD) ||
7032 (event == INT_EVENT_TPTR_TUNE_REQD) || (event == INT_EVENT_USERDEFINED_TUNE_REQD))
7034 if (signal_type_required == SIGNAL_ANALOG)
7036 if (service_required[path] != NULL)
7038 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_ANALOG_STARTED, NULL, 0);
7039 ControlAvOutput(INTERNAL_EVENT, INT_EVENT_ANALOG_TV_ON);
7047 tuning_state[path] = TSTATE_TUNING;
7048 ControlAvOutput(INTERNAL_EVENT, INT_EVENT_ANALOG_TV_OFF);
7050 SetupForTuning(path, event);
7060 FUNCTION_FINISH(ControlTuning);
7077 static void ControlDecoding(U8BIT path, E_ACTL_EVENT_TYPE type, U32BIT event)
7079 E_STB_DP_DECODE_STATUS video_status;
7080 E_STB_DP_DECODE_STATUS audio_status;
7081 #if defined(INTEGRATE_HBBTV) 7082 U16BIT onet_id, ts_id, serv_id;
7085 FUNCTION_START(ControlDecoding);
7093 if (type == EXTERNAL_EVENT)
7095 if (event == APP_EVENT_SERVICE_NOT_RUNNING)
7097 type = INTERNAL_EVENT;
7098 event = INT_EVENT_DISABLE;
7100 else if ((event == APP_EVENT_SERVICE_VIDEO_PID_UPDATE) ||
7101 (event == APP_EVENT_SERVICE_RUNNING))
7103 type = INTERNAL_EVENT;
7104 if (decoding_state[path] == DSTATE_DISABLED)
7106 event = INT_EVENT_ENABLE;
7110 event = INT_EVENT_RESTART_DECODING;
7113 else if (event == APP_EVENT_SERVICE_SUBTITLE_UPDATE)
7115 type = INTERNAL_EVENT;
7116 event = INT_EVENT_RESTART_SUBTITLES;
7118 else if (event == APP_EVENT_SERVICE_SCRAMBLE_CHANGE)
7120 type = INTERNAL_EVENT;
7121 if (decoding_state[path] == DSTATE_DISABLED)
7123 event = INT_EVENT_ENABLE;
7127 event = INT_EVENT_SCRAMBLE_CHANGE;
7131 else if (type == INTERNAL_EVENT)
7134 if ((event == INT_EVENT_RESTART_DECODING) && (decoding_state[path] == DSTATE_DISABLED))
7136 event = INT_EVENT_ENABLE;
7140 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_INITIALISE))
7143 decoding_state[path] = DSTATE_DISABLED;
7144 decoding_started[path] = FALSE;
7145 decoding_locked[path] = FALSE;
7146 now_event_id[path] = -1;
7147 #ifdef DEBUG_DECODING 7153 #ifdef DEBUG_DECODING 7155 U8BIT *state_string;
7156 U8BIT *event_string;
7158 switch (decoding_state[path])
7160 case DSTATE_DISABLED: {state_string = (U8BIT *)
"Disabled";
break; }
7161 case DSTATE_OFF: {state_string = (U8BIT *)
"Off";
break; }
7162 case DSTATE_STARTING_BAD_SIGNAL: {state_string = (U8BIT *)
"Starting bad";
break; }
7163 case DSTATE_STARTING: {state_string = (U8BIT *)
"Starting";
break; }
7164 case DSTATE_LOCKED: {state_string = (U8BIT *)
"Locked";
break; }
7165 case DSTATE_DECODING: {state_string = (U8BIT *)
"Decoding";
break; }
7166 case DSTATE_PAUSED_SIGNAL: {state_string = (U8BIT *)
"Signal pause";
break; }
7167 case DSTATE_PAUSED_USER: {state_string = (U8BIT *)
"User pause";
break; }
7168 case DSTATE_PAUSED_SIGNAL_AND_USER: {state_string = (U8BIT *)
"Signal/user pause";
break; }
7169 default: {state_string = (U8BIT *)
"Unknown decode state - error";
break; }
7171 event_string = GetEventDebugString(type, event);
7172 STB_SPDebugWrite(
"ControlDecoding(%d): %s, %s", path, state_string, event_string);
7177 if ((type == INTERNAL_EVENT) &&
7178 ((event == INT_EVENT_DISABLE) ||
7179 (event == INT_EVENT_RESTART_DECODING) ||
7180 (event == INT_EVENT_SCRAMBLE_CHANGE)))
7182 if (decoding_state[path] != DSTATE_DISABLED)
7184 if (decoding_state[path] >= DSTATE_DECODING)
7189 if (!external_control)
7194 if (event != INT_EVENT_RESTART_DECODING)
7202 if ((decoding_state[path] == DSTATE_STARTING) || (decoding_state[path] == DSTATE_DECODING))
7216 if (!external_control ||
7217 ((event == INT_EVENT_SCRAMBLE_CHANGE) &&
7224 if ((event == INT_EVENT_DISABLE) ||
7225 ((event == INT_EVENT_RESTART_DECODING) && (service_required[path] == NULL)) ||
7226 (((event == INT_EVENT_RESTART_DECODING) || (event == INT_EVENT_SCRAMBLE_CHANGE)) &&
7227 (service_required[path] != NULL) &&
7230 if (decoding_state[path] >= DSTATE_STARTING)
7233 if (!external_control)
7238 if (event == INT_EVENT_DISABLE)
7240 #ifdef DEBUG_DECODING 7243 decoding_state[path] = DSTATE_DISABLED;
7247 #ifdef DEBUG_DECODING 7250 decoding_state[path] = DSTATE_OFF;
7256 SetupForDecoding(path);
7258 if (tuned_status[path] == TUNED_STATUS_GOOD_SIGNAL)
7262 #ifdef DEBUG_DECODING 7268 if (!external_control || (event == INT_EVENT_SCRAMBLE_CHANGE))
7275 decoding_state[path] = DSTATE_STARTING;
7279 #ifdef DEBUG_DECODING 7282 decoding_state[path] = DSTATE_STARTING_BAD_SIGNAL;
7287 else if (((type == INTERNAL_EVENT) && (event == INT_EVENT_RESTART_AUDIO)) ||
7288 (event == APP_EVENT_SERVICE_AUDIO_PID_UPDATE))
7296 if (!external_control)
7298 if (decoding_state[path] > DSTATE_OFF)
7300 E_ACTL_DECODE_CHANGE changed;
7305 if ((event != APP_EVENT_SERVICE_AUDIO_PID_UPDATE) || changed)
7308 if ((decoding_state[path] == DSTATE_STARTING) ||
7309 (decoding_state[path] == DSTATE_DECODING))
7319 #ifdef DEBUG_DECODING 7322 STB_SPDebugWrite(
" no audio PID change, not restarting audio decoding(%u)", path);
7328 else if ((type == INTERNAL_EVENT) && (event == INT_EVENT_RESTART_SUBTITLES))
7332 if ((decoding_state[path] == DSTATE_STARTING) || (decoding_state[path] >= DSTATE_DECODING))
7353 switch (decoding_state[path])
7355 case DSTATE_DISABLED:
7357 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_ENABLE))
7359 if (service_required[path] != NULL)
7361 SetupForDecoding(path);
7362 if (tuned_status[path] == TUNED_STATUS_GOOD_SIGNAL)
7366 #ifdef DEBUG_DECODING 7372 decoding_state[path] = DSTATE_STARTING;
7376 #ifdef DEBUG_DECODING 7379 decoding_state[path] = DSTATE_STARTING_BAD_SIGNAL;
7393 case DSTATE_STARTING_BAD_SIGNAL:
7395 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_UPDATE))
7397 if (tuned_status[path] == TUNED_STATUS_GOOD_SIGNAL)
7401 #ifdef DEBUG_DECODING 7407 decoding_state[path] = DSTATE_STARTING;
7413 case DSTATE_STARTING:
7415 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_UPDATE))
7417 if (tuned_status[path] != TUNED_STATUS_GOOD_SIGNAL)
7419 #ifdef DEBUG_DECODING 7423 decoding_state[path] = DSTATE_STARTING_BAD_SIGNAL;
7426 else if ((type == EXTERNAL_EVENT) && (event == STB_EVENT_DECODE_LOCKED))
7428 #ifdef DEBUG_DECODING 7431 decoding_state[path] = DSTATE_LOCKED;
7437 #if defined(INTEGRATE_HBBTV) 7441 if (service_required[path] != NULL)
7447 onet_id = ADB_INVALID_DVB_ID;
7448 ts_id = ADB_INVALID_DVB_ID;
7449 serv_id = ADB_INVALID_DVB_ID;
7452 HBBTV_CHANNEL_CHANGE_PARENTAL_LOCKED);
7456 else if ((type == EXTERNAL_EVENT) &&
7457 ((event == STB_EVENT_VIDEO_DECODE_STARTED) || (event == STB_EVENT_AUDIO_DECODE_STARTED)))
7462 if ((video_status == DECODE_RUNNING) || (audio_status == DECODE_RUNNING))
7464 if (video_status == DECODE_RUNNING)
7467 #ifdef COMMON_INTERFACE 7473 if ((video_status == DECODE_RUNNING) ||
7476 #ifdef DEBUG_DECODING 7479 decoding_state[path] = DSTATE_DECODING;
7488 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_RELEASE_DECODE_LOCK))
7491 if (tuned_status[path] == TUNED_STATUS_GOOD_SIGNAL)
7497 #ifdef DEBUG_DECODING 7501 decoding_state[path] = DSTATE_STARTING;
7505 #ifdef DEBUG_DECODING 7508 decoding_state[path] = DSTATE_STARTING_BAD_SIGNAL;
7514 case DSTATE_DECODING:
7516 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_UPDATE))
7518 if (tuned_status[path] != TUNED_STATUS_GOOD_SIGNAL)
7520 #ifdef DEBUG_DECODING 7525 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_DECODE_PAUSED, &path,
sizeof(U8BIT));
7527 decoding_state[path] = DSTATE_PAUSED_SIGNAL;
7531 else if ((type == EXTERNAL_EVENT) && (event == STB_EVENT_VIDEO_DECODE_STARTED))
7539 #ifdef COMMON_INTERFACE 7548 case DSTATE_PAUSED_SIGNAL:
7550 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_UPDATE))
7552 if (tuned_status[path] == TUNED_STATUS_GOOD_SIGNAL)
7556 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_DECODE_RESUMED, &path,
sizeof(U8BIT));
7557 #ifdef DEBUG_DECODING 7563 decoding_state[path] = DSTATE_DECODING;
7569 case DSTATE_PAUSED_USER:
7571 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_UPDATE))
7573 if (tuned_status[path] != TUNED_STATUS_GOOD_SIGNAL)
7575 #ifdef DEBUG_DECODING 7578 decoding_state[path] = DSTATE_PAUSED_SIGNAL_AND_USER;
7584 case DSTATE_PAUSED_SIGNAL_AND_USER:
7586 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_UPDATE))
7588 if (tuned_status[path] == TUNED_STATUS_GOOD_SIGNAL)
7590 #ifdef DEBUG_DECODING 7593 decoding_state[path] = DSTATE_PAUSED_USER;
7602 decoding_started[path] = (decoding_state[path] >= DSTATE_DECODING);
7605 decoding_locked[path] = (decoding_state[path] == DSTATE_LOCKED);
7608 decode_paused_flag[path] = (decoding_state[path] >= DSTATE_PAUSED_SIGNAL);
7613 FUNCTION_FINISH(ControlDecoding);
7629 static void ControlAvOutput(E_ACTL_EVENT_TYPE type, U32BIT event)
7632 BOOLEAN scart_ip_changed_to_on;
7633 BOOLEAN scart_ip_changed_to_off;
7634 E_STB_AV_VIDEO_FORMAT actual_mode;
7635 U16BIT width, height;
7637 static BOOLEAN allow_alt_av_sources;
7638 static BOOLEAN scart_ip_present;
7640 FUNCTION_START(ControlAvOutput);
7642 #ifdef DEBUG_AV_OUTPUT 7644 U8BIT *state_string;
7645 U8BIT *event_string;
7647 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_INITIALISE))
7649 state_string =
"Uninitialised";
7655 case ACTL_STANDBY_MODE: {state_string =
"Standby";
break; }
7656 case ACTL_STANDBY_SCART_MODE: {state_string =
"Standby, vcr i/p";
break; }
7657 case ACTL_TV_MODE: {state_string =
"Tv mode";
break; }
7658 case ACTL_SCART_MODE: {state_string =
"Vcr i/p mode";
break; }
7661 event_string = GetEventDebugString(type, event);
7666 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_INITIALISE))
7672 av_mode = ACTL_TV_MODE;
7673 allow_alt_av_sources = FALSE;
7674 scart_ip_present = FALSE;
7675 audio_muted = FALSE;
7684 #ifdef INCLUDE_UHF_MODULATOR 7690 if (path != INVALID_RES_ID)
7699 AVSetAudioVolumes(FALSE);
7701 #ifdef DEBUG_AV_OUTPUT 7705 else if ((type == INTERNAL_EVENT) && (event == INT_EVENT_ALT_AV_ALLOWED))
7707 allow_alt_av_sources = TRUE;
7709 else if ((type == INTERNAL_EVENT) && (event == INT_EVENT_ALT_AV_NOT_ALLOWED))
7711 allow_alt_av_sources = FALSE;
7715 scart_ip_changed_to_on = FALSE;
7716 scart_ip_changed_to_off = FALSE;
7718 if ((type == EXTERNAL_EVENT) && (event == STB_EVENT_SCART_FORCE))
7720 scart_ip_changed_to_on = TRUE;
7721 scart_ip_present = TRUE;
7723 else if ((type == EXTERNAL_EVENT) && (event == STB_EVENT_SCART_DISCONNECTED))
7725 scart_ip_changed_to_off = TRUE;
7726 scart_ip_present = FALSE;
7732 case ACTL_STANDBY_MODE:
7734 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_STANDBY_OFF))
7740 AVSetAudioVolumes(FALSE);
7743 #ifdef DEBUG_AV_OUTPUT 7752 av_mode = ACTL_TV_MODE;
7754 else if (scart_ip_present == TRUE)
7757 #ifdef DEBUG_AV_OUTPUT 7761 av_mode = ACTL_STANDBY_SCART_MODE;
7765 case ACTL_STANDBY_SCART_MODE:
7767 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_STANDBY_OFF))
7773 AVSetAudioVolumes(FALSE);
7776 #ifdef DEBUG_AV_OUTPUT 7784 av_mode = ACTL_TV_MODE;
7786 else if (scart_ip_present == FALSE)
7789 #ifdef DEBUG_AV_OUTPUT 7794 av_mode = ACTL_STANDBY_MODE;
7800 if ((type == INTERNAL_EVENT) && (event == INT_EVENT_STANDBY_ON))
7802 if (scart_ip_present == TRUE)
7805 #ifdef DEBUG_AV_OUTPUT 7809 av_mode = ACTL_STANDBY_SCART_MODE;
7814 #ifdef DEBUG_AV_OUTPUT 7819 av_mode = ACTL_STANDBY_MODE;
7824 else if ((allow_alt_av_sources == TRUE) && (scart_ip_changed_to_on == TRUE))
7827 #ifdef DEBUG_AV_OUTPUT 7831 av_mode = ACTL_SCART_MODE;
7835 case ACTL_SCART_MODE:
7837 if ((type == INTERNAL_EVENT) &&
7838 ((event == INT_EVENT_STANDBY_ON) || (event == INT_EVENT_STANDBY_VCR_ACTIVE)))
7840 #ifdef DEBUG_AV_OUTPUT 7844 if (event == INT_EVENT_STANDBY_VCR_ACTIVE)
7853 av_mode = ACTL_STANDBY_SCART_MODE;
7855 else if (scart_ip_changed_to_off == TRUE)
7858 #ifdef DEBUG_AV_OUTPUT 7865 av_mode = ACTL_TV_MODE;
7874 FUNCTION_FINISH(ControlAvOutput);
7888 static void AVSetAudioVolumes(BOOLEAN save_to_nvm)
7898 if (path != INVALID_RES_ID)
7900 S16BIT scaled_vol = 0;
7901 S16BIT ad_scaled_vol = 0;
7903 if(audio_muted == FALSE)
7905 scaled_vol = audio_volume + (volume_scaling * audio_volume)/100;
7908 if(scaled_vol > 100)
7911 ad_scaled_vol = ad_volume + (volume_scaling * ad_volume)/100;
7912 if(ad_scaled_vol < 0)
7914 if(ad_scaled_vol > 100)
7915 ad_scaled_vol = 100;
7938 static U8BIT AcquirePathForService(
void *s_ptr, BOOLEAN with_decoders, BOOLEAN for_recording,
7942 E_STB_DP_SIGNAL_TYPE sig_type;
7944 E_STB_DP_RES_OWNER owner;
7946 FUNCTION_START(AcquirePathForService);
7948 path = INVALID_RES_ID;
7956 if (owner_info != NULL)
7958 owner = owner_info->owner;
7962 owner = RES_OWNER_NONE;
7967 if ((path != INVALID_RES_ID) && (owner_info != NULL))
7973 FUNCTION_FINISH(AcquirePathForService);
7983 static void ContinueServiceSearch(U8BIT path, U32BIT event)
7986 U16BIT num_transports;
7990 FUNCTION_START(ContinueServiceSearch);
7992 if ((required_search_type == SEARCH_TYPE_SERVICE_NETWORK) ||
7993 (required_search_type == SEARCH_TYPE_MANUAL_NETWORK))
8003 if (event == STB_EVENT_TUNE_NOTLOCKED)
8008 t_ptr = tlist[search_list_id];
8015 if (signal_type_required == SIGNAL_COFDM)
8020 if ((terr_hierarchy != TUNE_THIERARCHY_NONE) && (t2_plp_id > 1))
8030 search_list_id = NextSearchId(tlist, num_transports);
8031 terr_hierarchy = TUNE_THIERARCHY_NONE;
8037 terr_hierarchy = TUNE_THIERARCHY_NONE;
8040 search_list_id = NextSearchId(tlist, num_transports);
8046 search_list_id = NextSearchId(tlist, num_transports);
8049 if (current_search_type == SEARCH_TYPE_SERVICE_FREQ)
8051 if (((signal_type_required == SIGNAL_QPSK) && (search_list_id < GetNumSatSearchIds())) ||
8054 switch (signal_type_required)
8070 MapIdToSatTuneParams(search_list_id, &tune_params);
8083 else if ((current_search_type == SEARCH_TYPE_SERVICE_NETWORK) ||
8084 (current_search_type == SEARCH_TYPE_MANUAL_NETWORK))
8086 #ifdef DEBUG_SERVICE_SEARCH 8087 STB_SPDebugWrite(
"Tuning to transport %u of %u", search_list_id, num_transports);
8089 if ((search_list_id < num_transports) && tlist)
8106 else if ((event == STB_EVENT_SEARCH_SUCCESS) || (event == STB_EVENT_SEARCH_FAIL))
8114 if ((signal_type_required == SIGNAL_COFDM) &&
8117 if (terr_hierarchy == TUNE_THIERARCHY_NONE)
8122 if ((terr_hierarchy != TUNE_THIERARCHY_NONE) &&
8123 (terr_hierarchy > TUNE_THIERARCHY_NONE))
8126 t2_plp_id = (U8BIT)terr_hierarchy;
8131 if (current_search_type == SEARCH_TYPE_MANUAL_FREQ)
8134 FinishManualSearch(path, event);
8139 search_list_id = NextSearchId(tlist, num_transports);
8140 terr_hierarchy = TUNE_THIERARCHY_NONE;
8144 else if (t2_plp_id > 1)
8152 if (current_search_type == SEARCH_TYPE_MANUAL_FREQ)
8155 FinishManualSearch(path, event);
8160 search_list_id = NextSearchId(tlist, num_transports);
8161 terr_hierarchy = TUNE_THIERARCHY_NONE;
8170 search_list_id = NextSearchId(tlist, num_transports);
8173 if ((current_search_type == SEARCH_TYPE_SERVICE_FREQ) ||
8174 (current_search_type == SEARCH_TYPE_MANUAL_FREQ))
8176 if (((signal_type_required == SIGNAL_QPSK) && (search_list_id < GetNumSatSearchIds())) ||
8179 switch (signal_type_required)
8195 MapIdToSatTuneParams(search_list_id, &tune_params);
8208 else if ((current_search_type == SEARCH_TYPE_SERVICE_NETWORK) ||
8209 (current_search_type == SEARCH_TYPE_MANUAL_NETWORK))
8211 #ifdef DEBUG_SERVICE_SEARCH 8212 STB_SPDebugWrite(
"Tuning to transport %u of %u", search_list_id, num_transports);
8214 if (search_list_id < num_transports)
8237 FUNCTION_FINISH(ContinueServiceSearch);
8245 static U16BIT NextSearchId(
void **tlist, U16BIT num_transports)
8249 FUNCTION_START(NextSearchId);
8251 next_id = search_list_id;
8253 if ((required_search_type == SEARCH_TYPE_SERVICE_NETWORK) &&
8254 (current_search_type == SEARCH_TYPE_SERVICE_FREQ) && tlist)
8258 for (next_id = 0; next_id < num_transports; )
8264 current_search_type = SEARCH_TYPE_SERVICE_NETWORK;
8273 if (current_search_type != SEARCH_TYPE_SERVICE_NETWORK)
8275 next_id = search_list_id + 1;
8280 if (((current_search_type == SEARCH_TYPE_SERVICE_NETWORK) ||
8281 (current_search_type == SEARCH_TYPE_MANUAL_NETWORK)) && tlist)
8293 FUNCTION_FINISH(NextSearchId);
8298 static U16BIT GetNumSatSearchIds(
void)
8300 U32BIT country_code;
8301 U16BIT max_scan_ids;
8303 FUNCTION_START(GetNumSatSearchIds);
8316 FUNCTION_FINISH(GetNumSatSearchIds);
8318 return(max_scan_ids);
8323 U32BIT country_code;
8324 U16BIT num_tunes_per_freq;
8325 U16BIT num_tunes_per_srate;
8329 FUNCTION_START(MapIdToSatTuneParams);
8334 num_tunes_per_srate = 2;
8337 num_tunes_per_srate *= 2;
8345 srate_id = (search_id % num_tunes_per_freq);
8348 tuning_params->u.sat.symbol_rate = srates[srate_id / num_tunes_per_srate];
8350 if ((srate_id % 2) == 0)
8352 tuning_params->u.sat.polarity = POLARITY_HORIZONTAL;
8356 tuning_params->u.sat.polarity = POLARITY_VERTICAL;
8361 if (((srate_id % 4) / 2) == 0)
8363 tuning_params->u.sat.dvb_s2 = FALSE;
8367 tuning_params->u.sat.dvb_s2 = TRUE;
8372 tuning_params->u.sat.dvb_s2 = FALSE;
8375 tuning_params->u.sat.fec = FEC_AUTOMATIC;
8376 tuning_params->u.sat.modulation = MOD_QPSK;
8379 #ifdef DEBUG_SERVICE_SEARCH 8380 STB_SPDebugWrite(
"%s(%u): f=%u, sr=%u, p=%u, s2=%u", __FUNCTION__, search_id, tuning_params->freq,
8381 tuning_params->u.sat.symbol_rate, tuning_params->u.sat.polarity, tuning_params->u.sat.dvb_s2);
8384 FUNCTION_FINISH(MapIdToSatTuneParams);
8387 static void ReleasePath(U8BIT path)
8389 FUNCTION_START(ReleasePath);
8393 if (search_path == path)
8395 search_path = INVALID_RES_ID;
8398 FUNCTION_FINISH(ReleasePath);
8405 static void EndSearch(U8BIT path)
8407 FUNCTION_START(EndSearch);
8410 if (path != INVALID_RES_ID)
8418 APP_NvmSave(FIRST_BOOT_NVM, (U32BIT)FALSE, FALSE);
8419 APP_NvmSave(SEARCHING_STATE_NVM, (U32BIT)FALSE, TRUE);
8421 current_search_type = SEARCH_TYPE_NOSEARCH;
8422 required_search_type = SEARCH_TYPE_NOSEARCH;
8437 FUNCTION_FINISH(EndSearch);
8444 static void ContinueTransportSearch(U8BIT path)
8447 U16BIT num_transports;
8448 BOOLEAN search_complete;
8450 FUNCTION_START(ContinueTransportSearch);
8452 search_complete = FALSE;
8455 if (search_list_id < search_num_transports)
8465 NULL, NULL, RES_OWNER_DVB, DP_PRIORITY_LOW, FALSE, FALSE);
8467 if (path == INVALID_RES_ID)
8474 while ((path == INVALID_RES_ID) && (search_list_id < search_num_transports));
8476 if (path != INVALID_RES_ID)
8479 switch (current_search_type)
8481 case SEARCH_TYPE_STARTUP:
8484 case SEARCH_TYPE_TOT:
8487 case SEARCH_TYPE_SSU:
8493 current_search_type = SEARCH_TYPE_NOSEARCH;
8494 required_search_type = SEARCH_TYPE_NOSEARCH;
8495 current_search_tuner_type = SIGNAL_NONE;
8502 current_search_type = SEARCH_TYPE_NOSEARCH;
8503 required_search_type = SEARCH_TYPE_NOSEARCH;
8504 current_search_tuner_type = SIGNAL_NONE;
8512 required_search_type = SEARCH_TYPE_NOSEARCH;
8517 if (current_search_type == SEARCH_TYPE_SSU)
8521 current_search_type = SEARCH_TYPE_NOSEARCH;
8522 current_search_tuner_type = SIGNAL_NONE;
8528 search_complete = TRUE;
8533 current_search_type = SEARCH_TYPE_NOSEARCH;
8534 current_search_tuner_type = SIGNAL_NONE;
8543 search_complete = TRUE;
8556 FUNCTION_FINISH(ContinueTransportSearch);
8559 static BOOLEAN StartEitSearch(
void)
8561 BOOLEAN search_started;
8563 E_ACTL_SI_SRCH_REQD si_search;
8565 FUNCTION_START(StartEitSearch);
8567 for (search_started = FALSE; (search_list_id < search_num_transports) && !search_started; search_list_id++)
8569 t_ptr = search_transport_list[search_list_id];
8572 RES_OWNER_DVB, DP_PRIORITY_LOW, FALSE, FALSE);
8573 if (search_path != INVALID_RES_ID)
8575 EIT_DBG((
"%s: Tuning to transport %u of %u, freq %lu", __FUNCTION__,
8578 switch (current_search_type)
8580 case SEARCH_TYPE_EIT_PF:
8581 si_search = ACTL_SI_EVENT_PF_SEARCH;
8583 case SEARCH_TYPE_EIT_SCHED:
8584 si_search = ACTL_SI_EVENT_SCHED_SEARCH;
8586 case SEARCH_TYPE_EIT_PF_SCHED:
8587 si_search = ACTL_SI_EVENT_PF_SCHED_SEARCH;
8589 case SEARCH_TYPE_NOSEARCH:
8591 si_search = ACTL_SI_NO_SEARCH;
8595 if (si_search != ACTL_SI_NO_SEARCH)
8598 search_started = TRUE;
8603 FUNCTION_FINISH(StartEitSearch);
8605 return(search_started);
8608 static void ContinueEitSearch(U8BIT path)
8610 BOOLEAN search_started;
8612 FUNCTION_START(ContinueEitSearch);
8614 if (path != INVALID_RES_ID)
8618 path = INVALID_RES_ID;
8621 search_started = StartEitSearch();
8622 if (!search_started)
8624 FinishEitSearch(path);
8633 FUNCTION_FINISH(ContinueEitSearch);
8641 static void FinishManualSearch(U8BIT path, U32BIT event)
8645 FUNCTION_START(FinishManualSearch);
8647 if (event == STB_EVENT_TUNE_NOTLOCKED)
8657 current_search_type = SEARCH_TYPE_NOSEARCH;
8658 required_search_type = SEARCH_TYPE_NOSEARCH;
8662 else if ((event == STB_EVENT_SEARCH_SUCCESS) || (event == STB_EVENT_SEARCH_FAIL))
8672 current_search_type = SEARCH_TYPE_NOSEARCH;
8673 required_search_type = SEARCH_TYPE_NOSEARCH;
8681 FUNCTION_FINISH(FinishManualSearch);
8688 static void FinishSearch(U8BIT path)
8690 FUNCTION_START(FinishSearch);
8692 current_search_type = SEARCH_TYPE_NOSEARCH;
8693 current_search_tuner_type = SIGNAL_NONE;
8694 required_search_type = SEARCH_TYPE_NOSEARCH;
8697 #if defined(DEBUG_TOT_SEARCH) || defined(DEBUG_EIT_SEARCH) 8701 if (path != INVALID_RES_ID)
8710 FUNCTION_FINISH(FinishSearch);
8720 static BOOLEAN GetNextEitSearchTime(U32DHMS *next)
8722 U32DHMS last_eit_srch;
8723 U16BIT n_of_searches;
8726 U32DHMS next_srch_gmt;
8727 BOOLEAN srch_needed;
8729 last_eit_srch = (U32DHMS)
APP_NvmRead(LAST_EIT_UPDATE_NVM);
8731 if (last_eit_srch == 0)
8733 EIT_DBG((
"GetNextEitSearchTime: never searched before"));
8735 last_eit_srch = GetDateTimeNow();
8736 APP_NvmSave(LAST_EIT_UPDATE_NVM, last_eit_srch, TRUE);
8740 if (n_of_searches > 0)
8744 time_mins = ((24 * 60)-1) / n_of_searches;
8745 ohour = time_mins / 60;
8746 omin = time_mins % 60;
8748 EIT_DBG((
"GetNextEitSearchTime: last day=%d time=%02u:%02u n_of_searches=%d, time to wait h=%d m=%d",
8749 DHMS_DATE(last_eit_srch), DHMS_HOUR(last_eit_srch), DHMS_MINS(last_eit_srch),
8750 n_of_searches, ohour, omin));
8758 DHMS_MINS(next_srch_gmt), 0))
8766 srch_needed = FALSE;
8769 return(srch_needed);
8772 static BOOLEAN EitSearchNeededNow(
void)
8774 U32DHMS next_eit_srch;
8776 BOOLEAN retval = FALSE;
8778 if (GetNextEitSearchTime(&next_eit_srch))
8782 if (next_eit_srch <= now_local)
8796 static BOOLEAN EnterStandby(
void **recording_service)
8798 BOOLEAN enter_standby;
8800 U8BIT day, wday, month;
8802 BOOLEAN wakeup_for_search;
8803 U32DHMS wakeup_date_time;
8805 BOOLEAN wakeup_for_recording;
8806 U16BIT onet_id, trans_id, service_id;
8807 BOOLEAN standby_set;
8808 E_STB_DP_SIGNAL_TYPE tuner_type;
8810 FUNCTION_START(EnterStandby);
8812 enter_standby = FALSE;
8813 *recording_service = NULL;
8815 standby_set = FALSE;
8817 while (!standby_set)
8821 now_local = GetDateTimeNow();
8822 if (DHMS_DATE(now_local) == 0)
8826 enter_standby = TRUE;
8830 GetNextWakeupTime(&wakeup_date_time, &wakeup_for_search, &tuner_type,
8831 &wakeup_for_recording, &onet_id, &trans_id, &service_id);
8833 DBG_STDBY((
"EnterStandby: time now=%u@%02u:%02u, wakeup=%u@%02u:%02u",
8834 DHMS_DATE(now_local), DHMS_HOUR(now_local), DHMS_MINS(now_local),
8835 DHMS_DATE(wakeup_date_time), DHMS_HOUR(wakeup_date_time), DHMS_MINS(wakeup_date_time)));
8838 if ((!wakeup_for_search && !wakeup_for_recording) || (wakeup_date_time > now_local))
8841 enter_standby = TRUE;
8847 if (wakeup_for_recording)
8849 DBG_STDBY((
"%s: Setting wakeup for recording", __FUNCTION__));
8850 APP_NvmSave(STANDBY_STATE_NVM, (U32BIT)STDBY_WAKE_FOR_RECORDING, TRUE);
8852 else if (wakeup_for_search)
8854 DBG_STDBY((
"%s: Setting wakeup for search", __FUNCTION__));
8855 APP_NvmSave(STANDBY_STATE_NVM, (U32BIT)STDBY_WAKE_FOR_SEARCH, TRUE);
8859 DBG_STDBY((
"%s: No wakeup needed", __FUNCTION__));
8860 APP_NvmSave(STANDBY_STATE_NVM, (U32BIT)STDBY_STANDBY, TRUE);
8864 now_local = GetDateTimeNow();
8865 STB_GCGetDateInfo(DHMS_DATE(now_local), DHMS_HOUR(now_local), DHMS_MINS(now_local),
8866 &day, &wday, &month, &year);
8868 STB_FPSetClock(DHMS_DATE(now_local), year, month, day, DHMS_DATE(now_local),
8869 DHMS_DATE(now_local), DHMS_DATE(now_local));
8871 #ifdef DEBUG_STANDBY 8872 if (wakeup_for_search || wakeup_for_recording)
8875 DHMS_MINS(wakeup_date_time), &day, &wday, &month, &year);
8876 DBG_STDBY((
"%s: Wakeup date/time= %02u/%02u/%u @ %02u:%02u", __FUNCTION__,
8877 day, month, year, DHMS_HOUR(wakeup_date_time), DHMS_MINS(wakeup_date_time)));
8884 if (wakeup_for_search || wakeup_for_recording)
8887 time_diff = (DHMS_DATE(wakeup_date_time) - DHMS_DATE(now_local)) * 24 * 60 +
8888 (DHMS_HOUR(wakeup_date_time) - DHMS_HOUR(now_local)) * 60 +
8889 (DHMS_MINS(wakeup_date_time) - DHMS_MINS(now_local));
8893 if ((time_diff < 2) || (time_diff <= (U32BIT)(standby_grace_timeout + 59) / 60))
8895 enter_standby = FALSE;
8898 standby_wakeup_timer = CreateTimer(
STB_GCConvertDHMS(wakeup_date_time, CONV_GMT));
8904 DHMS_MINS(wakeup_date_time), &day, &wday, &month, &year);
8907 DHMS_HOUR(wakeup_date_time), DHMS_MINS(wakeup_date_time), time_diff);
8913 if (wakeup_for_search || wakeup_for_recording)
8916 standby_wakeup_timer = CreateTimer(
STB_GCConvertDHMS(wakeup_date_time, CONV_GMT));
8922 enter_standby = FALSE;
8924 if (wakeup_for_recording)
8929 DBG_STDBY((
"%s: Recording to be started", __FUNCTION__));
8931 else if (wakeup_for_search)
8933 DBG_STDBY((
"%s: Search being started for tuner_type %u", __FUNCTION__, tuner_type));
8935 if (!StartSearch(tuner_type))
8939 standby_set = FALSE;
8945 FUNCTION_FINISH(EnterStandby);
8947 return(enter_standby);
8950 #ifdef COMMON_INTERFACE 8955 static void CIPowerDownReadyCallback(
void)
8957 FUNCTION_START(CIPowerDownReadyCallback);
8960 standby_grace_timer != INVALID_TIMER_HANDLE)
8963 standby_grace_timer = INVALID_TIMER_HANDLE;
8965 DBG_STDBY((
"Standby grace time with CI expired"));
8970 DBG_STDBY((
"Entering low power standby"));
8976 DBG_STDBY((
"Entering passive standby"));
8981 FUNCTION_FINISH(CIPowerDownReadyCallback);
9003 static void GetNextWakeupTime(U32DHMS *wakeup_date_time, BOOLEAN *wakeup_for_search,
9004 E_STB_DP_SIGNAL_TYPE *search_tuner_type, BOOLEAN *wakeup_for_recording, U16BIT *onet_id,
9005 U16BIT *trans_id, U16BIT *service_id)
9009 U8BIT search_hours, search_mins;
9011 U16BIT last_service_srch;
9012 U16BIT background_search_start;
9013 U16BIT background_search_end;
9014 BOOLEAN service_search_enabled;
9015 BOOLEAN ssu_search_enabled;
9016 BOOLEAN eit_search_enabled;
9017 U16BIT last_update_srch;
9018 U8BIT hours, mins, secs;
9020 U32BIT timer_handle;
9021 U32DHMS recording_wakeup;
9023 #ifdef COMMON_INTERFACE 9028 FUNCTION_START(GetNextWakeupTime);
9031 last_service_srch = (U16BIT)
APP_NvmRead(LAST_CHAN_SRCH_NVM);
9032 last_update_srch = (U16BIT)
APP_NvmRead(OTA_LAST_UPDATE_SRCH_NVM);
9034 now_local = GetDateTimeNow();
9037 time_mins = DHMS_HOUR(now_local) * 60 + DHMS_MINS(now_local);
9039 DBG_STDBY((
"%s: today=%u time=%02u:%02u", __FUNCTION__, DHMS_DATE(now_local),
9040 DHMS_HOUR(now_local), DHMS_MINS(now_local)));
9041 DBG_STDBY((
" last service search=%u", last_service_srch));
9042 DBG_STDBY((
" last SSU search=%u", last_update_srch));
9045 *wakeup_for_search = FALSE;
9046 *wakeup_for_recording = FALSE;
9053 DBG_STDBY((
"%s: background_search_start=%d background_search_end=%d", __FUNCTION__,
9054 background_search_start, background_search_end));
9057 if ((((last_service_srch == DHMS_DATE(now_local)) || !service_search_enabled) &&
9058 ((last_update_srch == DHMS_DATE(now_local)) || (
APP_NvmRead(OTA_TYPE_NVM) != OTA_TYPE_AUTO) ||
9059 !ssu_search_enabled)) || (time_mins >= background_search_end))
9062 search_date = DHMS_DATE(now_local) + 1;
9067 search_date = DHMS_DATE(now_local);
9070 search_hours = background_search_start / 60;
9071 search_mins = background_search_start - (search_hours * 60);
9073 if (
APP_NvmRead(STANDBY_STATE_NVM) == STDBY_POWER_ON)
9077 DBG_STDBY((
"%s: resetting last EIT search to today", __FUNCTION__));
9078 APP_NvmSave(LAST_EIT_UPDATE_NVM, now_local, FALSE);
9081 #ifdef FREEVIEW_PLAYBACK 9082 eit_search_enabled = TRUE;
9084 eit_search_enabled = FALSE;
9089 if (timer_handle != INVALID_TIMER_HANDLE)
9091 *wakeup_for_recording = TRUE;
9095 *wakeup_for_recording = FALSE;
9098 if (*wakeup_for_recording)
9100 DBG_STDBY((
"%s: Next wakeup on service 0x%04x/0x%04x/0x%04x on %u @ %02u:%02u",
9101 __FUNCTION__, *onet_id, *trans_id, *service_id, DHMS_DATE(recording_wakeup),
9102 DHMS_HOUR(recording_wakeup), DHMS_MINS(recording_wakeup)));
9104 if (
ATMR_GetType(timer_handle) == TIMER_TYPE_PVR_RECORD)
9108 recording_wakeup = CalculateWakeupTime(recording_wakeup);
9112 if ((!service_search_enabled && !ssu_search_enabled && !eit_search_enabled) ||
9113 (recording_wakeup <= DHMS_CREATE(search_date, search_hours, search_mins, 0)) ||
9114 (recording_wakeup <= now_local))
9117 *wakeup_date_time = recording_wakeup;
9123 &date, &hours, &mins, &secs, CALC_ADD);
9125 if (recording_wakeup <= DHMS_CREATE(date, hours, mins, secs))
9128 *wakeup_date_time = recording_wakeup;
9132 *search_tuner_type = SIGNAL_NONE;
9138 DBG_STDBY((
"%s: DVB-T service line-up may have changed", __FUNCTION__));
9139 *search_tuner_type = SIGNAL_COFDM;
9143 DBG_STDBY((
"%s: DVB-S service line-up may have changed", __FUNCTION__));
9144 *search_tuner_type = SIGNAL_QPSK;
9148 DBG_STDBY((
"%s: DVB-C service line-up may have changed", __FUNCTION__));
9149 *search_tuner_type = SIGNAL_QAM;
9152 if (*search_tuner_type == SIGNAL_NONE)
9155 *wakeup_date_time = recording_wakeup;
9163 search_date = DHMS_DATE(now_offset);
9164 search_hours = DHMS_HOUR(now_offset);;
9165 search_mins = DHMS_MINS(now_offset);
9167 *wakeup_date_time = DHMS_CREATE(search_date, search_hours, search_mins, 0);
9168 *wakeup_for_recording = FALSE;
9169 *wakeup_for_search = TRUE;
9174 *wakeup_date_time = recording_wakeup;
9181 *search_tuner_type = SIGNAL_NONE;
9187 DBG_STDBY((
"%s: DVB-T service line-up may have changed", __FUNCTION__));
9188 *search_tuner_type = SIGNAL_COFDM;
9192 DBG_STDBY((
"%s: DVB-S service line-up may have changed", __FUNCTION__));
9193 *search_tuner_type = SIGNAL_QPSK;
9197 DBG_STDBY((
"%s: DVB-C service line-up may have changed", __FUNCTION__));
9198 *search_tuner_type = SIGNAL_QAM;
9202 if (((service_search_enabled || ssu_search_enabled) && (*search_tuner_type != SIGNAL_NONE))
9203 || eit_search_enabled)
9209 search_date = DHMS_DATE(now_offset);
9210 search_hours = DHMS_HOUR(now_offset);;
9211 search_mins = DHMS_MINS(now_offset);
9213 *wakeup_date_time = DHMS_CREATE(search_date, search_hours, search_mins, 0);
9214 *wakeup_for_search = TRUE;
9219 *wakeup_date_time = DHMS_CREATE(0, 0, 0, 0);
9220 *wakeup_for_search = FALSE;
9224 #ifdef COMMON_INTERFACE 9226 time_diff = (DHMS_DATE(*wakeup_date_time) - DHMS_DATE(now_local)) * 24 * 60 +
9227 (DHMS_HOUR(*wakeup_date_time) - DHMS_HOUR(now_local)) * 60 +
9228 (DHMS_MINS(*wakeup_date_time) - DHMS_MINS(now_local));
9232 if (!(*wakeup_for_search) || (time_diff > 30))
9241 *wakeup_date_time = now_local;
9242 *wakeup_for_search = TRUE;
9251 &date, &hours, &mins, &secs, CALC_ADD);
9253 if ((*wakeup_date_time == 0) ||
9254 (DHMS_CREATE(date, hours, mins, 0) <= *wakeup_date_time))
9257 *wakeup_date_time = DHMS_CREATE(search_date, search_hours, search_mins, 0);
9258 *wakeup_for_search = TRUE;
9270 &date, &hours, &mins, &secs, CALC_ADD);
9272 if ((*wakeup_date_time == 0) ||
9273 (DHMS_CREATE(date, hours, mins, 0) <= *wakeup_date_time))
9276 *wakeup_date_time = DHMS_CREATE(search_date, search_hours, search_mins, 0);
9277 *wakeup_for_search = TRUE;
9283 DBG_STDBY((
"%s: wakeup on %u@%02u:%02u", __FUNCTION__, DHMS_DATE(*wakeup_date_time),
9284 DHMS_HOUR(*wakeup_date_time), DHMS_MINS(*wakeup_date_time)));
9286 FUNCTION_FINISH(GetNextWakeupTime);
9294 static BOOLEAN StartSearch(E_STB_DP_SIGNAL_TYPE tuner_type)
9296 BOOLEAN search_started;
9299 U16BIT last_service_srch;
9300 U16BIT background_search_start;
9301 U16BIT background_search_end;
9302 U16BIT last_update_srch;
9303 #ifdef DEBUG_STANDBY 9304 U32DHMS last_eit_srch;
9306 #ifdef COMMON_INTERFACE 9309 U8BIT search_hours, search_mins;
9310 U8BIT gmt_hours, gmt_mins;
9313 FUNCTION_START(StartSearch);
9315 search_started = FALSE;
9317 if (tuner_type != SIGNAL_NONE)
9320 now_local = GetDateTimeNow();
9323 time_mins = DHMS_HOUR(now_local) * 60 + DHMS_MINS(now_local);
9328 last_service_srch = (U16BIT)
APP_NvmRead(LAST_CHAN_SRCH_NVM);
9329 last_update_srch = (U16BIT)
APP_NvmRead(OTA_LAST_UPDATE_SRCH_NVM);
9330 #ifdef DEBUG_STANDBY 9331 last_eit_srch = (U32DHMS)
APP_NvmRead(LAST_EIT_UPDATE_NVM);
9333 DBG_STDBY((
"%s: today=%u", __FUNCTION__, DHMS_DATE(now_local)));
9334 DBG_STDBY((
" last service search=%u, enabled=%u", last_service_srch,
9337 DBG_STDBY((
" last EIT update=%u@%02u:%02u, needed=%u", DHMS_DATE(last_eit_srch),
9338 DHMS_HOUR(last_eit_srch), DHMS_MINS(last_eit_srch), EitSearchNeededNow()));
9342 ((background_search_start <= time_mins) && (time_mins < background_search_end))))
9345 DBG_STDBY((
"Sending request to start service search"));
9346 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_START_SERVICE_SEARCH,
9347 &tuner_type,
sizeof(E_STB_DP_SIGNAL_TYPE));
9348 search_started = TRUE;
9353 (last_update_srch != DHMS_DATE(now_local)) &&
9354 ((background_search_start <= time_mins) && (time_mins < background_search_end)))
9357 DBG_STDBY((
"Sending request to start an SSU search"));
9358 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_START_SSU_SEARCH, NULL, 0);
9359 search_started = TRUE;
9362 if (!search_started && EitSearchNeededNow())
9368 APP_NvmSave(LAST_EIT_UPDATE_NVM, now_local, TRUE);
9374 DBG_STDBY((
"Setting STANDBY_STATE_NVM=STDBY_UPDATE_SEARCH"));
9375 APP_NvmSave(STANDBY_STATE_NVM, STDBY_UPDATE_SEARCH, FALSE);
9378 search_started = TRUE;
9382 #ifdef COMMON_INTERFACE 9383 if (!search_started)
9387 DBG_STDBY((
"Starting immediate CI+ operator profile search"));
9392 search_started = TRUE;
9397 DBG_STDBY((
"Starting CI+ operator profile search for module %u", module));
9403 search_started = TRUE;
9411 gmt_hours = time_mins / 60;
9412 gmt_mins = time_mins % 60;
9415 search_date, search_hours, search_mins, 0, COMP_1GE2))
9417 DBG_STDBY((
"Starting scheduled CI+ operator profile search for module %u", module));
9422 search_started = TRUE;
9431 FUNCTION_FINISH(StartSearch);
9433 return(search_started);
9440 static U32DHMS GetDateTimeNow(
void)
9444 FUNCTION_START(GetDateTimeNow);
9448 FUNCTION_FINISH(GetDateTimeNow);
9459 static U32DHMS CalculateWakeupTime(U32DHMS date_time)
9463 FUNCTION_START(CalculateWakeupTime);
9468 FUNCTION_FINISH(CalculateWakeupTime);
9473 static void FinishEitSearch(U8BIT path)
9475 EIT_DBG((
"FinishEitSearch(%u)", path));
9477 if (eit_search_end_timer != INVALID_TIMER_HANDLE)
9480 eit_search_end_timer = INVALID_TIMER_HANDLE;
9486 search_transport_list = NULL;
9487 search_num_transports = 0;
9490 static void UpdateTransportParameters(U8BIT path)
9494 E_STB_DP_TMODE tmode;
9495 E_STB_DP_TBWIDTH bwidth;
9496 E_STB_DP_TTYPE terr_type;
9497 E_STB_DP_CMODE cmode;
9500 FUNCTION_START(UpdateTransportParameters);
9503 if (tuner != INVALID_RES_ID)
9505 if ((t_ptr = current_transport[path]) == NULL)
9514 switch (t_ptr->sig_type)
9526 case TUNE_MODE_COFDM_1K: {tmode = MODE_COFDM_1K;
break; }
9527 case TUNE_MODE_COFDM_2K: {tmode = MODE_COFDM_2K;
break; }
9528 case TUNE_MODE_COFDM_4K: {tmode = MODE_COFDM_4K;
break; }
9529 case TUNE_MODE_COFDM_8K: {tmode = MODE_COFDM_8K;
break; }
9530 case TUNE_MODE_COFDM_16K: {tmode = MODE_COFDM_16K;
break; }
9531 case TUNE_MODE_COFDM_32K: {tmode = MODE_COFDM_32K;
break; }
9532 default: {tmode = MODE_COFDM_UNDEFINED;
break; }
9534 if (t_ptr->u.terr.tmode != tmode)
9536 t_ptr->u.terr.tmode = tmode;
9542 case TUNE_TBWIDTH_8MHZ: {bwidth = TBWIDTH_8MHZ;
break; }
9543 case TUNE_TBWIDTH_7MHZ: {bwidth = TBWIDTH_7MHZ;
break; }
9544 case TUNE_TBWIDTH_6MHZ: {bwidth = TBWIDTH_6MHZ;
break; }
9545 default: {bwidth = 0;
break; }
9547 if (t_ptr->u.terr.bwidth != bwidth)
9549 t_ptr->u.terr.bwidth = bwidth;
9555 case TUNE_SYSTEM_TYPE_DVBT2: {terr_type = TERR_TYPE_DVBT2;
break; }
9556 case TUNE_SYSTEM_TYPE_DVBT: {terr_type = TERR_TYPE_DVBT;
break; }
9557 default: {terr_type = TERR_TYPE_UNKNOWN;
break; }
9560 if (t_ptr->u.terr.terr_type != terr_type)
9562 t_ptr->u.terr.terr_type = terr_type;
9572 srate = srate / 1000;
9574 if (t_ptr->u.cab.symbol_rate != srate)
9576 t_ptr->u.cab.symbol_rate = srate;
9583 case TUNE_MODE_QAM_4: {cmode = MODE_QAM_4;
break; }
9584 case TUNE_MODE_QAM_8: {cmode = MODE_QAM_8;
break; }
9585 case TUNE_MODE_QAM_16: {cmode = MODE_QAM_16;
break; }
9586 case TUNE_MODE_QAM_32: {cmode = MODE_QAM_32;
break; }
9587 case TUNE_MODE_QAM_64: {cmode = MODE_QAM_64;
break; }
9588 case TUNE_MODE_QAM_128: {cmode = MODE_QAM_128;
break; }
9589 case TUNE_MODE_QAM_256: {cmode = MODE_QAM_256;
break; }
9590 default: {cmode = MODE_QAM_AUTO;
break; }
9592 if (t_ptr->u.cab.cmode != cmode)
9594 t_ptr->u.cab.cmode = cmode;
9604 srate = srate / 1000;
9606 if (t_ptr->u.sat.symbol_rate != srate)
9608 t_ptr->u.sat.symbol_rate = (U16BIT)srate;
9626 FUNCTION_FINISH(UpdateTransportParameters);
9629 static U32BIT CreateTimer(U32DHMS date_time)
9634 FUNCTION_START(CreateTimer);
9639 timer_info.start_time = date_time;
9640 timer_info.ram_only = TRUE;
9644 FUNCTION_FINISH(CreateTimer);
void STB_DPSetDISEQCSMATV(U8BIT path, BOOLEAN state)
Enables/disables DiSEqC SMATV and writes status into decode path store.
void STB_DPStartDecoding(U8BIT path)
Requests start of channel decoding process.
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...
BOOLEAN STB_DPSetVideoCodec(U8BIT path, E_STB_DP_VIDEO_CODEC codec)
Sets the type of CODEC to be used for Video decoding.
U8BIT STB_DPGetPathForService(void *service)
Checks whether any of the paths are tuned to the given service.
void APVR_PausePlay(void)
Pause playback.
Application level CI control functions.
BOOLEAN ACTL_StartManualSearchById(E_STB_DP_SIGNAL_TYPE tuner_type, U16BIT chan_id, BOOLEAN start_search)
Start a service search on, or just tune to, a transport, using chan_id as an index into the country's...
void ACTL_SetParentalControl(BOOLEAN enabled)
Enables or disables parental control. This enables or disables locking on a per channel basis...
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 ADB_GetLNBBandParameters(void *band_ptr, S_STB_DP_LNB_BAND *params)
Returns the structure describing the band and the expected LNB behaviour in it.
U16BIT ADB_GetNumTransports(void)
Returns the number of transports in the database.
void STB_DPSetADPID(U8BIT path, U16BIT pid)
Writes AD PID value into decode path store.
E_STB_DP_TTYPE ACTL_GetTerRfChanType(U16BIT id)
Returns the terrestrial type (T or T2) for the given channel id.
BOOLEAN STB_DPIsRecording(U8BIT path, U32BIT *handle)
Returns status of recording on specified path.
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.
BOOLEAN ATMR_CheckRecordStatus(BOOLEAN recordings_can_start, void *service)
Checks all timers to see whether any recordings should be started or stopped as a result of the now e...
BOOLEAN ACTL_TuneToRfChanArrayEntry(U8BIT path, U16BIT id, E_ACTL_SI_SRCH_REQD reqd_si, BOOLEAN relock_on)
Tunes to the specified rf channel array entry for DVB-T and DVB-C.
void STB_OTAContinueDownload(BOOLEAN status)
This function should be called to unblock the download process. This can be used to in the case where...
void ADB_SaveDatabase(void)
Saves the database to non-volatile memory.
API interfacing the midware with Intellibyte loader library.
U8BIT ACTL_GetVolume(void)
Returns the current audio volume.
BOOLEAN APVR_GetRecordingHandle(U8BIT path, U32BIT *recording_handle_ptr)
Returns the handle of the recording taking place on the given decode path.
U16BIT(* F_ServiceGetSubtitlePid)(void *serv_ptr, ADB_SUBT_INFO *subt_info)
Function pointer definition: Determines subtitle PID and whether it is DVB or teletext, for the given service.
macros and function prototypes for public use
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...
void STB_AVEnableHDMIDecoding(void)
Enables AV output to HDMI.
BOOLEAN ACTL_IsDecodingLocked(U8BIT path)
Returns whether decoding is locked, due to parental locking, on the given path.
void ACTL_StopAudioDescription(U8BIT path)
Stops AD decoding.
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...
U32BIT ADB_GetTransportFreqHz(void *t_ptr)
Returns the frequency, in Hz for DVB-T/T2 and DVB-C, and MHz for DVB-S/S2, of the given transport...
void * STB_DPGetTunedService(U8BIT path)
Returns the service saved with the given decode path.
void ADB_DeleteServiceEvents(void *serv_ptr, BOOLEAN delete_now_next)
Deletes all events and event related data for the given service.
U32DHMS STB_GCNowDHMSLocal(void)
Reads the current Local date code and time.
void STB_DPSetLNB12v(U8BIT path, BOOLEAN state)
Sets LNB 12v on or off and writes status into decode path store.
void STB_DPSetLNB22k(U8BIT path, BOOLEAN state)
Sets LNB 22kHz on or off and writes status into decode path store.
void * ADB_GetServiceTransportPtr(void *s_ptr)
Returns a pointer to the service's parent transport record.
BOOLEAN ADB_GetServiceNotRunningFlag(void *s_ptr)
Returns the status of the 'not running' flag of the given service. This flag indicates whether a serv...
BOOLEAN STB_AVIsHDCPAuthenticated(void)
Returns whether HDCP has authenticated.
void ACFG_GetBackgroundSearchTime(U16BIT *start_time, U16BIT *end_time)
Gets the background start and end search times.
BOOLEAN STB_EBUTT_Show(E_EBUTT_CHARACTER_SET_DESIGNATION character_set_designation, BOOLEAN navigate_to_index_page, BOOLEAN show_header)
Called to initiate continuous display of TeleText page content. This will result in either the index ...
void ACTL_SetMhegSubtitlePidFunc(F_ServiceGetSubtitlePid func)
Sets function retrieve Subtitle PID and info. Allows external MHEG5 module to override the default fu...
void ACTL_StopServiceSearch(void)
Function to stop the service search before it completes.
U16BIT ACFG_GetMinSatelliteScanFreq(U32BIT country_code)
Returns the minimum frequency to be used when performing a satellite based frequency scan in the give...
void STB_SUBStop(U8BIT path)
Stops subtitling display.
void * ADB_GetFullSITransport(void *n_ptr)
Returns a transport that is signalled as containing a complete set of SI data via an NIT linkage desc...
BOOLEAN STB_DPIsLivePath(U8BIT path)
Is the given decode path being used for live viewing.
U8BIT ADB_GetServiceContentProtectionLevel(void *s_ptr)
Returns the content protection level value for the service that will have been set by the Nordig cont...
void ACTL_SetVideoWindow(S16BIT win_x, S16BIT win_y, U16BIT win_width, U16BIT win_height)
Sets the video window to the size specified. Coordinates are relative to the screen resolution...
BOOLEAN ACTL_StartServiceSearch(E_STB_DP_SIGNAL_TYPE tuner_type, E_ACTL_SEARCH_TYPE type)
Entry point for starting a service search for a full retune or to update the existing service lineup...
void ACTL_SetADVolume(U8BIT volume)
Sets the AD volume.
BOOLEAN ADB_GetServiceLockedFlag(void *s_ptr)
Returns the status of the 'locked' flag of the given service, which is used by the parental control...
void HBBTV_NotifyChannelChangeStatus(U16BIT onet_id, U16BIT trans_id, U16BIT serv_id, E_HBBTV_CHANNEL_CHANGE_STATUS status)
Notifies the HbbTV engine of a change in the status of the service identified by the specified DVB tr...
void ASTE_SearchComplete(void)
void ACTL_LeaveStandby(void *s_ptr, BOOLEAN tune_to_service)
Brings the DVB out of standby mode.
BOOLEAN ACTL_IsTargetRegionRequired(void)
When the search has completed, this function should be called to see whether the target region UI sho...
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 ACI_AskRelease(U32BIT module)
Ask the host control module to restore replaced PIDs and to close the session with the host control r...
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...
U8BIT ADB_GetNetworkTargetCountries(U32BIT **code_array)
Returns a combined array of country codes for all discovered networks.
ADB_STREAM_TYPE ADB_GetServiceVideoType(void *s_ptr)
Returns the video type being used by the given service.
void ACTL_HDMIDisconnected(void)
Sets flag to indicate HDMI is now disconnected. This function is called by the event task when the HD...
void STB_FPSetClock(U16BIT mjd, U16BIT year, U8BIT month, U8BIT day, U8BIT hours, U8BIT minutes, U8BIT seconds)
Set the current date on the front panel.
Application configuration.
U8BIT ACTL_SetVolume(U8BIT volume)
Sets the main audio volume and returns the new volume.
void STB_AVSetSpdifMode(U8BIT path, E_STB_DIGITAL_AUDIO_TYPE audio_type)
Sets the SPDIF output mode, PCM or compressed audio.
U32BIT ACI_GetOperatorSearchModule(void)
Returns the module performing or requiring and operator search.
void STB_DPSetVideoPID(U8BIT path, U16BIT pid)
Writes video PID value into decode path store.
void * ADB_GetSatelliteLNB(void *sat_ptr)
Returns the LNB associated with the given satellite.
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.
U8BIT ACFG_GetEitUpdateTime(void)
Returns the number of minutes after which all the events should have been received during an EIT sear...
Header file - macros and function prototypes for public use.
BOOLEAN ACFG_GetAnaRfChannelTable(U32BIT country_code, ACFG_ANA_RF_CHANNEL_DATA **rf_chan_data_ptr, U16BIT *num_entries_ptr)
Returns a pointer to the channel table for an analog tuner for the given country. ...
void * ADB_FindServiceByLcn(U32BIT list_type, U16BIT lcn, BOOLEAN show_unselectable)
Returns the service matching the given LCN and list type.
void * ADB_GetTunedNetwork(U8BIT path)
Returns the network currently tuned to on the given decode path.
U8BIT STB_DPPathForTuner(U8BIT start_path, U8BIT tuner_num)
Returns the decode path that is using the given tuner ID.
Header file for NVM data handling functions.
void STB_GCGetDateInfo(U16BIT code, U8BIT hour, U8BIT min, U8BIT *day, U8BIT *wday, U8BIT *month, U16BIT *year)
Get the day, weekday, month and the year from a date code and hour / minute offset.
void STB_DPSetDISEQCRepeats(U8BIT path, U8BIT count)
Sets DiSEqC repeats and writes value into decode path store.
E_STB_DP_AUDIO_CODEC STB_DPGetAudioCodec(U8BIT path)
Returns the type of CODEC to be used for Audio decoding.
ADB_TRANSPORT_REC * DBDEF_FindTerrestrialTransportRec(U32BIT freq_hz, U8BIT plp_id)
Find the terrestrial transport record in the database matching the given params.
void ACTL_SetStandbyGracePeriod(U16BIT num_seconds)
Sets a grace period during which a system will enter active standby before going into passive or low ...
BOOLEAN ADB_GetServiceDoNotScramble(void *s_ptr)
Returns the do_not_scramble flag for the service which is based on the presence of an FTA descriptor...
void ADB_ReleaseStreamList(void **streamlist_ptr, U16BIT num_entries)
Frees the memory allocated for a stream list using ADB_GetStreamList.
void STB_DPStartAudioDecoding(U8BIT path)
Requests start of channel decoding process.
void * STB_AppGetMemory(U32BIT bytes)
Attempts to allocate memory from the application heap.
void STB_DPStartSI(U8BIT path)
Requests start of SI engine, mode is determined by flags in general control.
void ACTL_StartPlayback(void *s_ptr)
Start streaming the specified service.
void ACTL_SetAnalogChanIdString(U8BIT *str_ptr)
sends string to be displayed via pixelworks if it has changed (Must not send message to PixelWorks if...
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 STB_AVGetHDMINativeResolution(U16BIT *width, U16BIT *height)
Returns the native resolution, i.e. the resolution that is set with a call to STB_AVSetTVType(path, ratio, VIDEO_FORMAT_AUTO);.
BOOLEAN ACTL_IsMuted(void)
Returns the muted state of the audio.
Application level CA control functions.
void ACTL_ApplyHDCP(void *s_ptr)
Checks content protection requirements for the current event on the given service to determine whethe...
BOOLEAN ACI_RequestOperatorStatus(U32BIT module)
Called by the host to request changing to an operator profile and request the operator status to be s...
BOOLEAN STB_DPSetOwnerData(U8BIT path, void *data, U32BIT data_size)
Saves a copy of the given data with the path. If data is passed as NULL and owner data already exists...
void STB_GCCalculateDateTime(U16BIT code, U8BIT hour, U8BIT min, U8BIT secs, U8BIT ohour, U8BIT omin, U8BIT osecs, U16BIT *rcode, U8BIT *rhour, U8BIT *rmin, U8BIT *rsecs, E_STB_GC_CALCTYPE calc)
Adds or subtracts offset from a date/time.
void STB_AVSetHDMIAudioMode(U8BIT path, E_STB_DIGITAL_AUDIO_TYPE audio_type)
Sets the HDMI audio output mode, PCM or compressed.
E_STB_DP_AUDIO_MODE STB_DPGetADMode(U8BIT path)
Reads the AD mode value from decode path store.
E_STB_TUNE_TCODERATE STB_TuneGetActualTerrHpCodeRate(U8BIT path)
Returns the HP code rate of the current terrestrial signal.
BOOLEAN STB_CiCcSendRecordStop(U8BIT slot_id)
Called by the app when a recording is stopped or completes.
BOOLEAN ACTL_TuneUsingDSD(U8BIT path, SI_DELIVERY_SYS_DESC_TYPE dsd_type, SI_DELIVERY_SYS_DESC *dsd, U16BIT service_id, E_ACTL_SI_SRCH_REQD reqd_si)
Starts the process of tuning to a given transport or service that's defined by the given delivery sys...
ADB_TRANSPORT_REC * DBDEF_AddSatTransportRec(U32BIT freq_hz, U16BIT symbol_rate, E_STB_DP_POLARITY polarity, BOOLEAN dvb_s2, E_STB_DP_MODULATION modulation, ADB_NETWORK_REC *network)
Adds a satellite transport record with the given frequency, symbol rate and polarity.
BOOLEAN STB_CADescramblerRequiredForRecording(U16BIT *ca_ids, U16BIT num_ca_ids)
This function works out whether a CA descrambler is required to record a service with one of the give...
BOOLEAN ACTL_StartEitSearch(E_STB_DP_SIGNAL_TYPE tuner_type, E_ACTL_EVENT_SEARCH search_type)
Entry point for starting an EIT search.
void STB_DPSetDISEQCPosition(U8BIT path, BOOLEAN state)
Enables/disables DiSEqC positioning and writes status into decode path store.
void ACTL_SetupPlayback(void)
Starts the SI to acquire the PMT and fill the ip service in.
void STB_DPSetSearchMode(U8BIT path, BOOLEAN state)
Writes SI search mode flag into decode path store.
BOOLEAN ACI_OperatorExit(void)
Request the current operator module to exit operator profile.
BOOLEAN STB_DPSetADCodec(U8BIT path, E_STB_DP_AUDIO_CODEC codec)
Sets the type of CODEC to be used for AD decoding.
BOOLEAN ADB_GetLNBSettings(void *lnb_ptr, ADB_LNB_SETTINGS *settings)
Returns the current settings for the given LNB.
void * ADB_GetLNBBandLNB(void *band_ptr)
Returns the LNB associated with the band.
BOOLEAN ACI_AcquireCISlotForRecording(U8BIT path, void *s_ptr)
Acquires a CI slot for the recording path. This function may need to "steal" the CI slot from the liv...
E_STB_TUNE_TBWIDTH STB_TuneGetActualTerrBwidth(U8BIT path)
Returns the actual bandwidth of the current terrestrial signal.
void ACTL_DecodeOff(U8BIT path)
Stops decoding on the given path.
void STB_DPSetDISEQCUSwitch(U8BIT path, U8BIT state)
Sets DiSEqC uncommitted switch and writes status into decode path store.
Header file - Function prototypes for A/V control.
void STB_DPSetTerrType(U8BIT path, E_STB_DP_TTYPE type)
Sets terrestrial tuning type into decode path store.
U16BIT ADB_GetStreamPID(void *stream_ptr)
Returns the PID for the given stream.
BOOLEAN ACTL_AcquirePathOwnership(U8BIT path, S_ACTL_OWNER_INFO *owner_info)
Attempts to take ownership of the given path (used by CI+)
void * ADB_GetTransportSatellite(void *t_ptr)
Returns the parent satellite for the given transport.
void STB_AVSetHDMIStandby(BOOLEAN standby)
Sets the standby state of the HDMI output.
void STB_ChangePesCollectionPID(U8BIT path, U16BIT text_pid)
Changes the PID that the DMX is using to gather data on.
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.
void ADB_ReportNoSignalDuringSearch(void *t_ptr)
Set the signal level to 0 and searched flag to TRUE for the given transport.
U32BIT APP_NvmRead(E_NVM_ITEMS nvm_item)
Returns the current value for the given DVB setting.
void DBDEF_SelectBroadcastProfile(void)
Sets the broadcast profile type for for all network, transport and service record accesses...
U32DHMS STB_GCCreateDHMS(U16BIT date, U8BIT hour, U8BIT mins, U8BIT secs)
Makes U32DHMS formated date/time from date code, hour, minutes, seconds.
E_STB_TUNE_THIERARCHY STB_TuneGetActualTerrHierarchy(U8BIT path)
Returns the heirarchy of the current terrestrial signal.
ADB_PROFILE_TYPE ADB_GetProfileType(void *profile)
Returns the type of the given profile.
ADB_STREAM_TYPE ADB_GetServiceAudioType(void *s_ptr)
Returns the audio type being used by the given service.
void * ADB_FindServiceByIds(U16BIT onet_id, U16BIT tid, U16BIT sid)
Returns a pointer to the service matching the given IDs.
U8BIT ADB_GetServiceNumRCTLinks(void *serv_ptr)
Returns the number of RCT links for the given service.
U8BIT * ADB_GetServicePMTData(void *s_ptr, U16BIT *data_len)
Returns the current PMT data for the given service.
Application timer functions and defines.
void ADB_GetTransportList(void ***tlist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all transport records in the database.
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.
BOOLEAN ACTL_IsCiUiRequired(void)
Returns state of ci_ui_required flag.
E_ACTL_AV_MODE ACTL_GetAvModeStatus(void)
Returns av_mode.
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.
void ACTL_SetVolumeAdjustment(S8BIT scaling)
Sets the audio volume scaling to be applied.
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.
void ADB_GetNowNextEvents(void *serv_ptr, void **now_event, void **next_event)
Makes copies of the now and/or next events (EITp/f) for the given service. The returned events should...
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')
BOOLEAN ACI_IsOperatorSearchRequired(void)
Returns whether an operator profile search has been requested.
void STB_DPSetADMode(U8BIT path, E_STB_DP_AUDIO_MODE mode)
Writes AD mode value into decode path store.
BOOLEAN STB_DPReleasePath(U8BIT path, E_STB_DP_RES_OWNER owner)
Releases the decode path and all resources no longer needed. The path won't be released if the path i...
U32DHMS STB_GCConvertDHMS(U32DHMS dhms, E_STB_GC_CONVTYPE conv)
Converts the given date/time to local or GMT.
Header file - macros and function prototypes for public use.
void ADB_ReleaseTransportList(void **tlist, U16BIT num_transports)
Frees a transport list returned from one of the ADB_GetTransportList functions.
void ACTL_ReleaseLivePathForService(void *s_ptr, E_STB_DP_RES_OWNER owner)
Finds the path being used to view the given service and releases it.
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.
U32BIT ACTL_GetRfChanFreqHz(E_STB_DP_SIGNAL_TYPE tuner_type, U16BIT id)
Returns a pointer to the channel name.
U16BIT ACTL_GetNumRfChanArrayEntries(E_STB_DP_SIGNAL_TYPE tuner_type)
Returns the number of entries in the rf channel table.
void STB_DPSetUnicableFrequency(U8BIT path, U32BIT freq)
Sets the Unicable (IF) frequency.
E_STB_DP_SIGNAL_TYPE STB_DPGetSignalType(U8BIT path)
Reads the signal type value from decode path store.
E_STB_TUNE_TGUARDINT STB_TuneGetActualTerrGuardInt(U8BIT path)
Returns the guard interval of the current terrestrial signal.
void STB_DPSetAdditionalFrequencies(U8BIT path, U8BIT num_freqs, U32BIT *frequencies)
Sets an array of frequencies that can be tried when tuning to a transport if the tuner fails to lock ...
void ACTL_HDMIConnected(void)
Checks that the selected HDMI resolution mode is supported and, if not, chooses the best one availabl...
U8BIT ACTL_TuneToService(U8BIT path, S_ACTL_OWNER_INFO *owner_info, void *s_ptr, BOOLEAN override_lock, BOOLEAN for_live)
Starts the process of tuning to the specified service. If the service is to be tuned on the live path...
void ACTL_EnableCiModule(void)
Enables CI module.
BOOLEAN ACFG_GetBackgroundServiceSearch(void)
Returns whether the background service search is enabled or not.
U8BIT * ACTL_GetRfNameFromFreq(E_STB_DP_SIGNAL_TYPE tuner_type, U32BIT freq_hz)
Returns the rf name appropriate to the frequency specified.
void ADB_GetStreamList(void *serv_ptr, ADB_STREAM_LIST_TYPE stream_list_type, void ***streamlist_ptr, U16BIT *num_entries_ptr)
Allocates and returns an array of the streams of the given type and for the given service...
BOOLEAN ACTL_SetActiveProfile(void *profile)
Sets the current profile. (CI+ only) If the profile is being set to CI+ profile and the necessary CAM...
BOOLEAN ACTL_IsAudioDescriptionOn(void)
Returns whether audio description has been turned on.
U16BIT STB_DPGetADPID(U8BIT path)
Reads the audio PID value from decode path store.
void * ADB_GetTransportFromIds(U16BIT net_id, U16BIT onet_id, U16BIT tran_id)
Finds the transport with the given ids.
void ACTL_AllowAnalogVideo(BOOLEAN allow_analog_video)
Enables or disables analog video display.
void STB_SUBEnable(U8BIT path, BOOLEAN enable)
Enables or disables subtitling display.
void STB_DPSetAudioMode(U8BIT path, E_STB_DP_AUDIO_MODE mode)
Writes audio mode value into decode path store.
U8BIT STB_DPGetNumPaths(void)
Returns the maximum number of decode paths.
BOOLEAN ACI_GetFirstOperatorSearchModule(U32BIT *module)
Checks all the CI+ profiles to see if any have requested an update search.
void ASTE_Initialise(void)
void ACI_UseCiModuleOnPath(U8BIT path, U32BIT module)
Use the CI module with the given path.
U8BIT STB_DPGetPlaybackPath(void)
Returns the ID of the decode path being used for playback.
U8BIT ADB_GetEventParentalAge(void *event_ptr)
Returns the parental age value for the given event.
void ACTL_SetMhegAVControl(BOOLEAN control)
Sets the MHEG5 audio volume adjust to be applied.
void STB_DPSetTerrBandwidth(U8BIT path, E_STB_DP_TBWIDTH bwidth)
Writes terrestrial bandwidth value into decode path store.
void * ADB_GetNextSatellite(void *sat_ptr)
Returns the next satellite from the database.
void * ADB_GetTransportNetworkPtr(void *t_ptr)
Returns the network of the given transport.
BOOLEAN ACTL_HasDecodingStarted(U8BIT path)
Returns whether decoding has been started on the given path.
BOOLEAN ACFG_GetCabRfChannelTable(U32BIT country_code, ACFG_CAB_RF_CHANNEL_DATA **rf_chan_data_ptr, U16BIT *num_entries_ptr)
Returns a pointer to the channel table for a cable tuner for the given country.
E_STB_DP_SIGNAL_TYPE ADB_GetTransportSignalType(void *t_ptr)
Returns the signal type for the given transport.
void ADB_ReleaseServiceList(void **slist, U16BIT num_servs)
Frees a list of services returned from one of the functions that returns a service list...
BOOLEAN ACFG_GetBackgroundSSUSearch(void)
Returns whether the background SSU search is enabled or not.
U8BIT STB_DPGetLivePath(void)
Returns the ID of the decode path being used for live viewing.
void DBDEF_GetTransportAdditionalFrequencies(ADB_TRANSPORT_REC *t_ptr, U8BIT *num_freqs, U32BIT **freqs)
Returns the additional frequencies associated with a transport. The returned array should not be modi...
Header file - macros and function prototypes for public use.
void ACTL_DisableCiModule(void)
Disables CI module.
void STB_AVSetUhfModulatorChannel(U8BIT chan)
Sets the output channel of the RF Modulator.
void STB_PVRSetStandbyState(BOOLEAN state)
Sets the standby state of the PVR path control.
void ADB_GetTransportAnalogTuningParams(void *t_ptr, U32BIT *freq_hz, S8BIT *offset, E_STB_DP_ANALOG_VIDEO_TYPE *vtype)
Returns the settings to tune to the given terrestrial analog transport.
BOOLEAN ACTL_HandlePrivateTimerEvent(U32BIT timer_handle)
Handles all the private timer events.
void ASTE_EnterStandby(BOOLEAN recording)
ADB_PROFILE_TYPE DBDEF_GetCurrentProfileType(void)
Returns the current profile type.
BOOLEAN STB_DPIsDecodingPath(U8BIT path)
Is the given decode path being used for decoding.
void ACTL_SetTVAspectMode(E_STB_AV_ASPECT_MODE aspect_mode)
Used to set the TV aspect mode which defines how the video will be displayed based on the aspect rati...
void * ADB_GetNextLNBBand(void *band_ptr)
Returns the next LNB band from the database.
Header file - EBU Teletext driver.
void STB_DPSetAudioPID(U8BIT path, U16BIT pid)
Writes audio PID value into decode path store.
BOOLEAN ACFG_GetSatelliteScanDvbS2(U32BIT country_code)
Returns whether DVB-S2 should be included when performing a satellite based frequency scan in the giv...
U8BIT ACTL_AcquirePathForService(void *s_ptr, BOOLEAN with_decoders, BOOLEAN for_recording, S_ACTL_OWNER_INFO *owner_info)
Acquires a decode path suitable for tuning to the given service.
BOOLEAN STB_DPGetLockMode(U8BIT path)
Reads the lock mode value from decode path store.
E_TIMER_TYPE ATMR_GetType(U32BIT handle)
Returns the type of the given timer.
void ACTL_SetTVAspectRatio(E_STB_AV_ASPECT_RATIO aspect_ratio)
Used to set the TV aspect ratio.
U16BIT ADB_GetTransportTid(void *t_ptr)
Returns the transport id of the given transport.
void STB_DPSetLockMode(U8BIT path, BOOLEAN mode)
Writes lock mode value into decode path store.
void STB_DPTuneOff(U8BIT path)
Requests stop of tuning and powers down tuner.
void DBDEF_ReleaseAccess(void)
Releases access to the app's database.
void ACTL_StopEitSearch(void)
Function to stop the EIT search before it completes.
BOOLEAN ACTL_IsHDMIConnected(void)
Returns whether the HDMI is connected or not.
void ACTL_ActionEvent(U32BIT event, void *event_data)
Actions external events.
U16BIT ADB_GetServiceLcn(void *s_ptr)
Returns the logical channel number assigned to the given service.
void STB_DPSetTerrMode(U8BIT path, E_STB_DP_TMODE mode)
Writes terrestrial tuning mode value into decode path store.
BOOLEAN ACFG_IsNordigCountry(void)
Returns whether the current country requires Nordig compliance for SI.
void ACTL_StopSubtitles(void)
Stops subtitles from being displayed and processed.
BOOLEAN STB_DPIsOwnedBy(U8BIT path, E_STB_DP_RES_OWNER owner)
Checks whether the path is owned by the given owner.
void STB_SPDebugWrite(const char *format,...)
Write debug string to serial/debug port. <CR><LF> characters will be automatically added to the end o...
Debug functions header file.
Header file - Function prototypes for linked lists.
Header file - macros and function prototypes for public use.
void STB_AVSetAudioVolume(U8BIT path, U8BIT vol)
Sets the volume of the main audio output.
void ASI_SetStandbyState(BOOLEAN standby_state)
Performs the neccessary actions for this module when entering/exiting standby according to the value ...
void ACTL_SetParentalControlAge(U8BIT age)
Sets the age (valid values 4-18) at which parental control will be will be applied. If the age is invalid, no change will be made to the current setting.
void * ADB_GetTunedTransport(U8BIT path)
Returns the transport that's tuned to on the given decode path.
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. 'enter', 'wait' or 'get').
void ACTL_UpdateVideoMode(E_STB_AV_ASPECT_RATIO aspect, BOOLEAN force)
Update video mode sets MHEG resolution as well as platform Also, stops subtitles during the operation...
Header file - macros and function prototypes for public use.
void STB_VTSetVideoAlignmentPref(E_VIDEO_ASPECT_MODE pref)
Set video alignment preference.
BOOLEAN ACTL_StartSubtitles(void)
Starts subtitle processing and display if the current service has valid subtitle data. If DVB subtitles aren't available, teletext will be used if available.
BOOLEAN ACI_GetFirstScheduledOperatorSearch(U32BIT *module, U16BIT *date, U8BIT *hours, U8BIT *mins)
Checks all the CI+ profiles to find the one with the earliest scheduled search. All returned values a...
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.
BOOLEAN ADB_GetServiceScrambledFlag(void *s_ptr)
Returns the status of the 'scrambled' flag of the given service. This flag is set depending on the sc...
void * ADB_GetTunedService(U8BIT path)
Returns the tuned service for the given decode path.
void STB_DPSetFrequency(U8BIT path, U32BIT freq)
Writes frequency value into decode path store.
Database access defines, structures and public functions.
void ADB_SetTunedService(U8BIT path, void *s_ptr)
Sets the tuned service for the given path, together with the associated tuned transport and network...
void STB_HWSetWakeUpTime(U16BIT mjd, U16BIT year, U8BIT month, U8BIT day, U8BIT hours, U8BIT minutes, U32BIT time_in_mins)
Used to set the wake up time for when the system is going to be put into the low power standby state...
BOOLEAN ACFG_IsNordigService(E_STB_DP_SIGNAL_TYPE tuner_type)
Returns whether the broadcast SI data for the given tuner type is to be treated as Nordig compliant...
void STB_DPSetAnalogFreqOff(U8BIT path, S8BIT offset)
Writes analogue frequency offset value into decode path store.
U16BIT STB_DPGetAudioPID(U8BIT path)
Reads the audio PID value from decode path store.
void ACI_UsageRulesStatusChanged(U8BIT path)
Re-evaluate current state follwing a change related to usage rules.
ADB_TRANSPORT_REC * DBDEF_FindCableTransportRec(U32BIT freq_hz, U32BIT symbol_rate)
Find the cable transport record in the database matching the given params.
void ADB_ReleaseNetworkList(void **nlist)
Frees a network list returned by ADB_GetNetworkList.
Application level CI - internal functions.
void ACTL_StopTotSearch(void)
Function to stop the TOT search before it completes.
void STB_EBUTT_SetCacheMethod(E_EBUTT_CACHING_METHOD ebutt_caching_method)
Called to define the strategy used to determine what page content is to be displayed form the TeleTex...
void STB_DPStartTune(U8BIT path)
Requests start of tuning process.
U16BIT ADB_ServiceGetSubtitlePid(void *serv_ptr, ADB_SUBT_INFO *subt_info)
Determines subtitle PID and whether it is DVB or teletext, for the given service. ...
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...
void ASTE_LeaveStandby(void)
void STB_AVSetAudioMute(U8BIT path, BOOLEAN mute)
Mute or unmute the audio output on the given audio decoder path.
U8BIT ACFG_GetEitSearchesPerDay(void)
Returns the number of EIT searches that should be performed per day when the box is in standby...
U32BIT ATMR_GetFirstWakeupTime(U32DHMS *rec_date_time, U16BIT *onet_id, U16BIT *trans_id, U16BIT *service_id)
Searches the timers for the first timer that will cause the DVB to wakeup that hasn't been missed...
BOOLEAN ACTL_StartStartupSearch(void)
Function to start the startup search when booting from cold. This search checks the validity of the s...
void ASI_SetAppSiMode(U8BIT path, E_APP_SI_MODE si_mode)
Sets application SI mode - used before STB_DPStartSI() is called.
void ACTL_SetMute(BOOLEAN mute)
Sets the audio mute state.
void STB_DPSetDecodePIDs(U8BIT path, U16BIT pcr_pid, U16BIT video_pid, U16BIT audio_pid, U16BIT text_pid, U16BIT data_pid, U16BIT AD_pid)
BOOLEAN STB_DPCanTuneTo(E_STB_DP_SIGNAL_TYPE tuner_type, void *service, void *transport)
Checks whether there's a tuner available to tune to the given service or transport.
U16BIT ADB_GetTransportOriginalNetworkId(void *t_ptr)
Returns the original network id of the given transport.
void STB_DPSetPulsePosition(U8BIT path, BOOLEAN state)
Enables/disables pulse positioning and writes status into decode path store.
void STB_DPSetSymbolRate(U8BIT path, U16BIT sym)
Writes symbol rate value into decode path store.
U8BIT STB_DPGetPathTuner(U8BIT path)
Returns the tuner ID acquired by the given decode path.
E_STB_AV_ASPECT_RATIO ACTL_GetTVAspectRatio(void)
Returns the current TV aspect ratio.
void ACTL_StartDecoding(U8BIT path, void *s_ptr)
Sets up and starts decoding for the given service. This is used for PVR playback, but could also be u...
U8BIT ACTL_GetActivePath(void)
Returns the active path (live, playback, etc...), i.e. the one using the decoders.
Header file - Function prototypes for Event Reporting.
U8BIT ACFG_GetSatelliteScanNumSymbolRates(U32BIT country_code)
Returns the number of items in the fixed array of symbol rates to be used when performing a satellite...
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...
void ACTL_SetStandbyState(BOOLEAN state)
Reports the standby state to the A/V output controller.
BOOLEAN ACTL_AreSubtitlesDisplayed(void)
Returns whether subtitles are being displayed.
U16BIT ADB_GetServiceVideoPid(void *s_ptr)
Returns the video PID for the given service.
BOOLEAN ACTL_StartTotSearch(E_STB_DP_SIGNAL_TYPE tuner_type)
Function to start a TOT search which is required to set the system clock when starting from power off...
Header file - Function prototypes for version numbers.
void STB_SUBStart(U8BIT path, U16BIT pid, U16BIT composition_id, U16BIT ancillary_id)
Starts subtitling display.
U8BIT STB_DPGetPathAudioDecoder(U8BIT path)
Returns the audio decoder ID acquired by the given decode path.
void STB_DPSetPCRPID(U8BIT path, U16BIT pid)
Writes PCR PID value into decode path store.
void STB_DPSetAnalogVideoType(U8BIT path, E_STB_DP_ANALOG_VIDEO_TYPE vtype)
Writes analogue video type into decode path store.
void HBBTV_NotifyParentalRatingChange(BOOLEAN blocked)
Notifies the HbbTV engine that the parental rating of the currently playing service has changed...
void ADB_SetTransportSearchFlag(void *t_ptr, BOOLEAN state)
Sets whether a transport has been used during a service scan operation.
void DBDEF_RequestAccess(void)
Requests access to the app's database.
U8BIT ACTL_GetParentalControlAge(void)
Returns the current age set for parental control. 0 will be returned if parental control is disabled ...
void ACTL_ResumeSubtitles(void)
Resumes the display of subtitles after they've been paused.
Glue layer between DVB and conditional access systems.
void STB_AVSetAVOutput(BOOLEAN av_on)
Turns on/off all AV outputs (e.g. for standby mode)
void STB_DPSetDISEQCCSwitch(U8BIT path, E_STB_DP_DISEQC_CSWITCH state)
Sets DiSEqC committed switch and writes status into decode path store.
BOOLEAN ACTL_ParentalControlEnabled(void)
Returns whether parental control is enabled. This will also return TRUE if parental control has been ...
E_STB_DP_DECODE_STATUS STB_DPGetVideoStatus(U8BIT path)
Reads the video status from decode path store.
void STB_DPSetTuneRelock(U8BIT path, BOOLEAN state)
Writes tuner auto relock flag into decode path store.
BOOLEAN STB_GCIsFutureDateTime(U16BIT code, U8BIT hour, U8BIT min, U8BIT secs)
Tests given date and time against current GMT date and time.
void STB_OTAStopLoader(void)
Stops the download process.
void ADB_GetServiceList(U32BIT list_type, void ***slist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all services in the database for the given list type.
void STB_DPSetPolarity(U8BIT path, E_STB_DP_POLARITY pol)
Writes polarity value into decode path store.
BOOLEAN ACTL_CheckLiveServiceChange(void)
Checks whether the service tuned to on the live path has changed and informs the UI if it has...
void ADB_GetTransportSatTuningParams(void *t_ptr, U32BIT *freq_hz, E_STB_DP_POLARITY *polarity, U16BIT *symrate, E_STB_DP_FEC *fec, BOOLEAN *dvb_s2, E_STB_DP_MODULATION *modulation)
Returns the parameters needed to tune a satellite tuner to a transport.
BOOLEAN ACTL_TuneToRfChanArrayAnalogEntry(U8BIT path, U16BIT id)
Tunes to the specified rf channel array entry in analogue mode.
void APVR_StopPauseRecord(BOOLEAN return_to_live)
Stops timeshifted playback and recording and optionally restarts decoding of the live signal...
void STB_DPSetSignalType(U8BIT path, E_STB_DP_SIGNAL_TYPE sigtype)
Writes signal type value into decode path store.
void HBBTV_NotifyServiceListChange(void)
Notifies the HbbTV ending that it must update Service list. This will cause the engine to subsequentl...
BOOLEAN STB_HWSetStandbyState(E_HW_STANDBY_STATE state)
Used to transition the system between the various standby states. It's assumed that the system can mo...
void ADB_FinaliseDatabaseAfterSearch(BOOLEAN save_changes, E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite, BOOLEAN search_completed, BOOLEAN clear_new_flags, BOOLEAN manual_search)
Completes the database setup after a search has completed or been stopped.
U16BIT ADB_GetServiceId(void *s_ptr)
Returns the signalled service id of the given service.
E_ACTL_DECODE_CHANGE ACTL_SetupAudioDecoding(U8BIT path, void *s_ptr)
Setup default audio decoding params on current tuned service Can be used by external module (e...
U32BIT ACFG_GetCountry(void)
Returns the country code the DVB is configured for.
void ADB_GetNetworkList(void ***nlist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of the network records in the database.
E_STB_DP_DECODE_STATUS STB_DPGetAudioStatus(U8BIT path)
Reads the audio status from decode path store.
application level SI task
BOOLEAN ACTL_IsTrailerBookingAvailable(void *serv_ptr)
Returns whether trailer booking is available based on whether it's enabled and the number of links cu...
Application stb layer control.
E_STB_DP_AUDIO_CODEC STB_DPGetADCodec(U8BIT path)
Returns the type of CODEC to be used for AD decoding.
void STB_DPSetDVBS2(U8BIT path, BOOLEAN dvb_s2)
Set whether the satellite should be tuned to DVB-S/S2 for the tuner in the given decode path...
BOOLEAN APVR_IsRecordingInProgress(void)
Returns TRUE if there are any recordings currently in progress.
void ADB_SaveEventSchedule(E_STB_DP_SIGNAL_TYPE tuner_type, void *satellite)
Saves the event schedule for all services for the given type of tuner to the database. Note: the database has to support this operation.
void STB_DPStopDecoding(U8BIT path)
Requests stop of channel decoding (blanks screen).
void ACTL_SetStandbyVCRActive(void)
Reports standby state to the a/v output control state machine.
void ADB_GetTransportListForTunerType(E_STB_DP_SIGNAL_TYPE tuner_type, void ***tlist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all transport records in the database for the given type of tuner...
Header file - Function prototypes for operating system.
BOOLEAN STB_CiCcIsHDCPRequired(U16BIT service_id)
Tell whether the given service requires HDCP.
System Wide Global Technical Data Type Definitions.
void STB_DPStopSI(U8BIT path)
Requests stop of SI engine.
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.
BOOLEAN APVR_StopRecording(U32BIT recording_handle)
Stops the given recording.
void STB_EBUTT_Start(U8BIT path, U16BIT text_pid, U8BIT magazine, U8BIT page)
These functions are called to control whether received TeleText data is processed. Using this functionality ensures that the process of collating page information can be halted when processing resources are a consideration. It is envisaged that some implementations may wish only to collate TeleText content only when the display is being shown, whilst other designs may which to cache significant page content as a background process. Abstracting this functionality from the initialisation routines gives the option to support both solution types.
void STB_AppFreeMemory(void *addr)
Releases previously allocated application heap memory.
U8BIT ACTL_GetSearchProgress(void)
Returns search progress as a percentage. This works for any of the available types of searches...
void * ACTL_GetCurrentSatellite(U8BIT path)
Returns the current satellite being used by the given decode path.
U8BIT ACTL_GetRfModulation(E_STB_DP_SIGNAL_TYPE tuner_type, U16BIT id)
Returns the modulation mode.
void STB_DPSetLNBPower(U8BIT path, E_STB_DP_LNB_POWER state)
Sets LNB power on or off and writes status into decode path store.
Application level HBBTV callback functions.
U32BIT STB_TuneGetActualSymbolRate(U8BIT path)
Returns the actual symbol rate when a tuner has locked.
BOOLEAN ACTL_SuppressSubtitles(BOOLEAN suppress)
Stops subtitles being displayed if another OSD requires them to be hidden, such as CI+...
U16BIT STB_DPGetVideoPID(U8BIT path)
Reads the video PID value from decode path store.
void ACTL_FinishManualSearch(void)
Function to be called when a manual service search has completed, or is being stopped.
void ATMR_RecordingFailed(U8BIT path)
Handles the timer when a recording fails to start for some reason. This may result in the timer being...
S8BIT STB_TuneGetActualTerrFreqOffset(U8BIT path)
Returns the actual freq offset of the current terrestrial signal.
U8BIT STB_DPAcquireTunerPath(E_STB_DP_SIGNAL_TYPE tuner_type, void *service, void *transport, E_STB_DP_RES_OWNER owner, E_STB_DP_PRIORITY priority, BOOLEAN with_decoders, BOOLEAN for_recording)
Acquires a decode path and all the required resources (tuner, demux, audio and video decoders)...
U32BIT ATMR_AddTimer(S_TIMER_INFO *info)
Creates a new timer based on the information supplied.
BOOLEAN ATMR_InitialiseTimer(S_TIMER_INFO *timer_info, E_TIMER_TYPE timer_type, void *serv_ptr, void *event_ptr)
Sets up the given timer info structure with default values for the given timer type using the service...
BOOLEAN STB_DPIsRecordingPath(U8BIT path)
Is the given decode path being used for recording.
void STB_DPSetUserDefinedLNBBands(U8BIT path, U8BIT number_of_bands, S_STB_DP_LNB_BAND *band_definitions)
Stores the pointer to the array of band definitions for the user defined LNB.
E_STB_TUNE_CMODE STB_TuneGetActualCableMode(U8BIT path)
Returns the cable mode when the tuner has locked.
U16BIT ACFG_GetSatelliteScanFreqInc(U32BIT country_code)
Returns the increment frequency to be used when performing a satellite based frequency scan in the gi...
Header file - Function prototype for init function.
E_STB_AV_ASPECT_MODE ACTL_GetTVAspectMode(void)
Returns the current TV aspect mode.
void STB_AVDisableHDMIDecoding(void)
Disables AV output to HDMI.
U8BIT * ACTL_GetRfChanName(E_STB_DP_SIGNAL_TYPE tuner_type, U16BIT id)
Returns a pointer to the channel name.
void STB_DPStartADDecoding(U8BIT path)
Requests start of channel decoding process.
ADB_SERVICE_TYPE ADB_GetServiceType(void *s_ptr)
Returns the signalled type of the given service.
void STB_DPSetModulation(U8BIT path, E_STB_DP_MODULATION modulation)
Set the satellite modulation for the tuner in the given decode path.
void STB_VTSetVideoOutput(S_RECTANGLE *output)
DVBCore application output window for entire video.
void ACTL_EnterStandby(void)
Puts DVB into standby mode. It will continue to monitor SI for recordings, SSU updates, etc., unless it goes into low power standby.
void STB_DPSetLNBType(U8BIT path, E_STB_DP_LNB_TYPE type)
Writes LNB type value into decode path store.
void STB_DPSetLockEnable(U8BIT path, BOOLEAN state)
Writes lock enable flag into decode path store.
void STB_AVSetAVOutputSource(E_STB_AV_OUTPUTS output, E_STB_AV_SOURCES source, U32BIT param)
Routes a specified AV source to a specified AV output.
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...
U16BIT ADB_GetServicePCRPid(void *s_ptr)
Returns the PCR PID for the given service.
void * STB_DPGetOwnerData(U8BIT path, U32BIT *data_size)
Returns the owner data saved with the path. This data should not be freed.
BOOLEAN ASTE_InStandby(void)
BOOLEAN ACI_StartOperatorSearchForModule(U32BIT module)
Called by the app to start an operator profile search for the given module.
Header file - Function prototypes for DVB subtitles api.
Header file - Function prototypes for heap memory.
void ADB_GetServiceIds(void *s_ptr, U16BIT *onet_id, U16BIT *trans_id, U16BIT *serv_id)
Returns the original network id, transport id and service id for the given service.
void ADB_GetTransportCableTuningParams(void *t_ptr, U32BIT *freq_hz, E_STB_DP_CMODE *mode, U16BIT *symrate)
Returns the parameters needed to tune a cable tuner to a transport.
void STB_GCSetCIStandby(BOOLEAN standby)
Enables / disables CI standby state.
BOOLEAN ACTL_StartAudioDescription(U8BIT path)
Starts decoding an audio description stream, if available, on the given path. If AD isn't currently a...
void * STB_OSCreateMutex(void)
Create a mutex.
void STB_DPSetADEnabled(U8BIT path, BOOLEAN state)
Writes the AD Audio into decode path store. To be set to ON or OFF. The exact ON state is depends if ...
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...
U8BIT ACTL_ChangeVolume(S8BIT volume_change)
Changes the main audio volume and returns the new volume.
BOOLEAN ATMR_DeleteTimer(U32BIT handle)
Deletes the timer with the given handle.
void ACTL_InitialiseAppControl(void)
Control system initialisation.
void STB_DPSetDISEQCTone(U8BIT path, E_STB_DP_DISEQC_TONE state)
Sets DiSEqC tone and writes status into decode path store.
U8BIT STB_AVGetHDMISupportedModes(E_STB_AV_VIDEO_FORMAT **modes)
Returns the resolutions supported by the HDMI.
void * ATMR_GetRecordService(U8BIT path)
Returns the service for the recording timer on the given path.
void STB_AVSetADVolume(U8BIT path, U8BIT vol)
Sets the volume of the audio description output.
E_STB_DP_AUDIO_CODEC ADB_GetAudioCodecFromStream(ADB_STREAM_TYPE audio_stream_type)
Derive audio codec from stream.
U16BIT * ACFG_GetSatelliteScanSymbolRates(U32BIT country_code)
Returns a fixed array of symbol rates to be used when performing a satellite based frequency scan in ...
void STB_SIReleaseCaIdDescArray(U16BIT *desc_array, U8BIT num_entries)
Frees the memory used by the descriptor array specified.
BOOLEAN ACTL_TuneToUserDefinedParams(U8BIT path, S_MANUAL_TUNING_PARAMS *tuning_params, E_ACTL_SI_SRCH_REQD reqd_si, BOOLEAN relock_on)
Tunes to the given set of tuning parameters.
BOOLEAN ASI_PmtReported(U8BIT path)
Returns TRUE if pmt has been reported to third parties.
void ACTL_ApplyParentalControl(U8BIT path, void *s_ptr)
Checks the parental control for the current event on the given service to determine whether decoding ...
BOOLEAN ADB_GetEventDoNotScramble(void *event_ptr)
Returns the do_not_scramble flag for the event, which will have been found by looking backwards in th...
BOOLEAN STB_DPGetLockEnable(U8BIT path)
Reads the lock enable flag state from decode path store.
void ADB_GetTransportServiceList(void *t_ptr, void ***slist_ptr, U16BIT *num_entries_ptr)
Allocates and returns a list of all services in the database on the given transport.
void ASTE_StartServiceSearch(void)
BOOLEAN ADB_GetServiceIsHd(void *s_ptr)
Returns whether the service is signalled as an HD service.
BOOLEAN ACTL_GetDecodePausedState(U8BIT path)
Gets user paused flag value.
BOOLEAN ACTL_StartManualSearch(E_STB_DP_SIGNAL_TYPE tuner_type, S_MANUAL_TUNING_PARAMS *tuning_params, E_ACTL_SEARCH_TYPE type)
Start a service search on, or just tune to, the transport defined by the given tuning parameters...
U16BIT ADB_GetEventId(void *event_ptr)
Returns the event id for the given event.
Header file - Function prototypes for Demux control.
void ACTL_SetTVAspectConversion(E_STB_AV_ASPECT_RATIO aspect_ratio, E_STB_AV_ASPECT_MODE aspect_mode)
Used to set the aspect conversion applied to the video based on the TV aspect ratio and aspect mode t...
U16BIT ACTL_GetHDMIResolutions(E_STB_AV_VIDEO_FORMAT **video_formats, U16BIT *current_index)
Returns an array of valid HDMI resolutions and the index of the currently selected format...
U8BIT STB_DPPathForAudioDecoder(U8BIT decoder_num)
Returns the decode path that is using the given audio decoder.
BOOLEAN ACTL_CanServiceBeViewed(void *s_ptr)
Checks whether there's a tuner available to view the given service. This takes into account whether t...
BOOLEAN STB_GCCompareDateTime(U16BIT code1, U8BIT hour1, U8BIT min1, U8BIT secs1, U16BIT code2, U8BIT hour2, U8BIT min2, U8BIT secs2, E_STB_GC_COMPTYPE comp)
Compares one date/time to another.
Header file - Function prototypes for PES collection task.
void STB_EBUTT_Hide(void)
Called to halt the continuous display of TeleText page content, and to clear the relevant area of the...
U16BIT ACTL_GetRfSymbolRate(E_STB_DP_SIGNAL_TYPE tuner_type, U16BIT id)
Returns the channel symbol rate.
BOOLEAN ACTL_IsTuned(U8BIT path)
Returns whether the given path is currently tuned.
BOOLEAN ACFG_GetTerRfChannelTable(U32BIT country_code, ACFG_TER_RF_CHANNEL_DATA **rf_chan_data_ptr, U16BIT *num_entries_ptr)
Returns a pointer to the channel table for a terrestrial tuner for the given country.
U16BIT ACFG_GetMaxSatelliteScanFreq(U32BIT country_code)
Returns the maximum frequency to be used when performing a satellite based frequency scan in the give...
void STB_DPSetCableMode(U8BIT path, E_STB_DP_CMODE mode)
Writes cable tuning mode value into decode path store.
void ACTL_PauseSubtitles(void)
Disables the display of subtitles but processing continues.
E_STB_AV_VIDEO_FORMAT ACTL_GetActualVideoMode(U16BIT *width, U16BIT *height)
Reads the saved video format and returns the best mode available if it's set to AUTO or is invalid fo...
void STB_DPSetFEC(U8BIT path, E_STB_DP_FEC fec)
Writes FEC value into decode path store.
void STB_DPStopADDecoding(U8BIT path)
Requests stop of channel decoding.
U8BIT ACTL_TuneToTransport(U8BIT path, S_ACTL_OWNER_INFO *owner_info, void *t_ptr, E_ACTL_SI_SRCH_REQD reqd_si, BOOLEAN relock_on)
Tunes to the given transport and sets the type of SI monitoring that will be started when the tuning ...
BOOLEAN STB_DPSetAudioCodec(U8BIT path, E_STB_DP_AUDIO_CODEC codec)
Sets the type of CODEC to be used for Audio decoding.
void STB_AVSetTVType(U8BIT path, E_STB_AV_ASPECT_RATIO ratio, E_STB_AV_VIDEO_FORMAT format)
Sets the aspect ratio and signal format for the connected television.
void STB_AVBlankVideo(U8BIT path, BOOLEAN blank)
Blanks or unblanks the video display.
U16BIT ADB_GetServiceAudioPid(void *s_ptr)
Returns the audio PID for the given service. This will be the one chosen based on the settings for la...
BOOLEAN APVR_IsTimeshiftStarted(void)
Checks whether timeshift has been started, which includes both recording and playback.
E_STB_TUNE_TCODERATE STB_TuneGetActualTerrLpCodeRate(U8BIT path)
Returns the LP code rate of the current terrestrial signal.
BOOLEAN ADB_ServiceHasSubtitles(void *serv_ptr, BOOLEAN *dvb_subs)
Determines whether the given service has subtitles, DVB or teletext.
void STB_DPStopAudioDecoding(U8BIT path)
Requests stop of channel decoding.
void ACTL_TuneOff(U8BIT path)
Stops tuning on the given path.
BOOLEAN ACTL_ToggleMute(void)
Toggles the current mute state and returns the new mute setting.
void ACTL_ReTuneSubtitles(void)
Stops and restarts subtitle decoding on the live path. This may be required due to a change in langua...
void ACTL_ReleaseChannelLock(void)
Releases the lock on a channel after decoding has been blocked due to the service being parental lock...
E_STB_TUNE_TCONST STB_TuneGetActualTerrConstellation(U8BIT path)
Returns the constellation of the current terrestrial signal.
U8BIT STB_DPPathForVideoDecoder(U8BIT decoder_num)
Returns the decode path that is using the given video decoder.
BOOLEAN ACTL_IsSearchComplete(void)
Returns TRUE if current search has finished. This works for any of the available types of searches...
BOOLEAN ACTL_ReleasePathOwnership(U8BIT path, E_STB_DP_RES_OWNER owner)
Releases ownership of the path, and frees any associated data, if the given owner is the path's owner...
BOOLEAN STB_OTAStartLoader(U8BIT path, U16BIT onet_id, U16BIT tran_id, U16BIT serv_id, U16BIT download_pid, F_SSU_VERSION_CALLBACK version_cb)
Starts the over-the-air download process.
Application database access functions.
BOOLEAN ACTL_AreSubtitlesStarted(void)
Returns whether subtitles have been started, even if they aren't being displayed. ...
void STB_DPSetUnicableChannel(U8BIT path, U8BIT chan)
Sets the current Unicable Channel (User Band).
E_STB_TUNE_TMODE STB_TuneGetActualTerrMode(U8BIT path)
Returns the actual mode of the current terrestrial signal.
E_STB_DP_AUDIO_MODE STB_DPGetAudioMode(U8BIT path)
Reads the audio mode value from decode path store.
BOOLEAN ACTL_ReleasePath(U8BIT path)
Releases the decode path and all resources no longer needed. The path may not be released if the path...
ADB_STREAM_TYPE ADB_GetStreamType(void *stream_ptr)
Returns the type of the given stream.
void ACTL_ReTuneAudio(void)
Stops and restarts audio decoding on the live path. This may be required due to a change in language ...
Header file - Function prototypes for front panel control.
BOOLEAN ADB_GetTransportSearchFlag(void *t_ptr)
Returns whether a transport has been used during a service scan operation.
void STB_DPReleaseAllPaths(void)
Releases all decode paths and all the resources they are using.
void STB_AVSetAudioDelay(U8BIT path, U16BIT millisecond)
Sets the audio delay on the given path.
void ADB_GetTransportTerrestrialTuningParams(void *t_ptr, E_STB_DP_TTYPE *terr_type, U32BIT *freq_hz, E_STB_DP_TMODE *mode, E_STB_DP_TBWIDTH *bwidth, U8BIT *plp_id)
Returns the settings to tune to the given DVB-T/T2 transport.
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...
U8BIT ACTL_GetServiceSearchPath()
Returns path used buy currently running search. This works for any of the available types of searches...
Header file - macros and function prototypes for public use.
Application level CI Operator Profile functions.
void STB_DPSetOwner(U8BIT path, E_STB_DP_RES_OWNER owner)
Sets the owner of the given path.
void STB_DPSetTerrPLP(U8BIT path, U8BIT plp_id)
Sets terrestrial T2 PLP id into decode path store.
E_STB_DP_VIDEO_CODEC ADB_GetVideoCodecFromStream(ADB_STREAM_TYPE video_stream_type)
Derive video codec from stream.
void ASTE_StartSSUSearch(void)
void ADB_ReleaseEventData(void *event_ptr)
Frees any memory allocated for the given event and the event itself.