DVBCore  20.3.0
DVBCore Documentation
ap_events.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2011 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 /*#define OUTPUT_DEBUG*/
26 
27 /*---includes for this file--------------------------------------------------*/
28 /* compiler library header files */
29 #include <stdio.h>
30 #include <string.h>
31 /* third party header files */
32 
33 /* DVBCore header files */
34 #include <techtype.h>
35 #include <dbgfuncs.h>
36 
37 #include "stbhwos.h"
38 #include "stbhwav.h"
39 
40 #include "stberc.h"
41 #include "stbdpc.h"
42 #include "stbheap.h"
43 #include "stbsiflt.h"
44 #include "stbsitab.h"
45 #include "stbllist.h"
46 #include "stbpvr.h"
47 #include "stberc.h"
48 
49 #include "ap_si.h"
50 #include "ap_tmr.h"
51 #include "ap_events.h"
52 #include "ap_dbacc.h"
53 #include "ap_pvr.h"
54 #include "app.h"
55 #include "ap_state.h"
56 #include "ap_cntrl.h"
57 
58 #ifdef COMMON_INTERFACE
59 #include "ap_ci_int.h"
60 #endif
61 
62 #ifdef INTEGRATE_HBBTV
63 #include "hbbtv_api.h"
64 #endif
65 
66 /*---constant definitions for this file--------------------------------------*/
67 #define MAX_EVENTS 500
68 
69 #define TASK_STACK_SIZE 4096
70 #define TASK_PRIORITY 11
71 
72 #ifdef OUTPUT_DEBUG
73 #define DBG(x) STB_SPDebugWrite x
74 #else
75 #define DBG(x)
76 #endif
77 
78 /*---local typedef structs for this file-------------------------------------*/
79 
80 /*---local (static) variable declarations for this file----------------------*/
81 /* (internal variables declared static to make them local) */
82 static void *event_queue;
83 
84 static void *original_alternative_service;
85 static BOOLEAN classify_repeats = FALSE;
86 
87 typedef struct aev_event_handler
88 {
89  LINK_LIST_PTR_BLK ptrs; /* prev/next handler in linked list */
90  DVB_EVENT_HANDLER handler;
92 LINK_LIST_HEADER event_handler_list;
93 
94 void* event_handlers_mutex = NULL;
95 
96 /*---local function prototypes for this file---------------------------------*/
97 /* (internal functions declared static to make them local) */
98 static BOOLEAN STBEventHandler(BOOLEAN latched, BOOLEAN repeat, U16BIT path_class, U16BIT type,
99  void *data, U32BIT data_size);
100 static void EventTask(void *param);
101 static BOOLEAN CheckForAlternativeService(U8BIT alt_serv_type);
102 static BOOLEAN ReturnFromAlternativeService(void);
103 
104 
105 /*---global function definitions---------------------------------------------*/
106 
107 /*****************************************************************************
108  * @brief
109  ******************************************************************************/
110 BOOLEAN AEV_Initialise(DVB_EVENT_HANDLER event_handler)
111 {
112  BOOLEAN retval;
113 
114  FUNCTION_START(AEV_Initialise);
115 
116  retval = TRUE;
117 
118  /* Create an event queue */
119  event_queue = STB_OSCreateQueue(sizeof(S_EVENT_INFO), MAX_EVENTS);
120 
121  /* Register a handler to deal with events from the midware */
122  STB_ERRegisterHandler(STBEventHandler);
123 
124  /* Initialise the external event handler list */
125  STB_LLInitialiseHeader(&event_handler_list);
126 
127  /* Save the external event handler */
128  /* Create a task to handle the events */
129  event_handlers_mutex = STB_OSCreateMutex();
130  if ((event_handlers_mutex == NULL) ||
131  (event_handler && (APP_RegisterDVBEventHandler(event_handler) == FALSE)) ||
132  (STB_OSCreateTask(EventTask, NULL, TASK_STACK_SIZE, TASK_PRIORITY, (U8BIT *)"EventTask") == NULL))
133  {
134  retval = FALSE;
135  }
136 
137  original_alternative_service = NULL;
138 
139  FUNCTION_FINISH(AEV_Initialise);
140 
141  return(retval);
142 }
143 
144 void AEV_Terminate(void)
145 {
146  LINK_LIST_PTR_BLK * entry;
147 
148 
149  while (NULL != (entry = STB_LLGetFirstBlock(&event_handler_list)))
150  {
151  STB_LLRemoveBlock(entry);
152  STB_AppFreeMemory(entry);
153  }
154 
155  if (event_handlers_mutex)
156  {
157  STB_OSDeleteMutex(event_handlers_mutex);
158  event_handlers_mutex = NULL;
159  }
160 }
161 
163 {
164  AEV_EVENT_HANDLER *handler;
165  BOOLEAN registered = FALSE;
166 
167  if (event_handler && event_handlers_mutex)
168  {
169  handler = STB_AppGetMemory(sizeof(AEV_EVENT_HANDLER));
170  if (handler)
171  {
172  handler->handler = event_handler;
173  STB_OSMutexLock(event_handlers_mutex);
174  STB_LLAddBlockToEnd(&event_handler_list, (LINK_LIST_PTR_BLK *)handler);
175  STB_OSMutexUnlock(event_handlers_mutex);
176  registered = TRUE;
177  }
178  }
179  return registered;
180 }
181 
183 {
184  LINK_LIST_PTR_BLK * entry;
185  AEV_EVENT_HANDLER * handler;
186  BOOLEAN unregistered = FALSE;
187 
188  if (event_handler && event_handlers_mutex)
189  {
190  STB_OSMutexLock(event_handlers_mutex);
191  entry = STB_LLGetFirstBlock(&event_handler_list);
192  while (entry)
193  {
194  handler = ((AEV_EVENT_HANDLER*)entry);
195  if (handler->handler == event_handler)
196  {
197  STB_LLRemoveBlock(entry);
198  unregistered = TRUE;
199  STB_AppFreeMemory(handler);
200  break;
201  }
202  entry = STB_LLGetNextBlock(entry);
203  }
204  STB_OSMutexUnlock(event_handlers_mutex);
205  }
206  return unregistered;
207 }
208 
213 void APP_SetClassifyRepeatEvents(BOOLEAN enable)
214 {
215  classify_repeats = enable;
216 }
217 
218 /*---local function definitions----------------------------------------------*/
219 
220 static void NotifyAll(U32BIT event, void *event_data, U32BIT data_size)
221 {
222  LINK_LIST_PTR_BLK * entry;
223  AEV_EVENT_HANDLER * handler;
224 
225  if (event_handlers_mutex)
226  {
227  STB_OSMutexLock(event_handlers_mutex);
228  entry = STB_LLGetFirstBlock(&event_handler_list);
229  while (entry)
230  {
231  handler = ((AEV_EVENT_HANDLER*)entry);
232  handler->handler(event, event_data, data_size);
233  entry = STB_LLGetNextBlock(entry);
234  }
235  STB_OSMutexUnlock(event_handlers_mutex);
236  }
237 }
238 
239 
240 /*****************************************************************************
241  * @brief
242  ******************************************************************************/
243 static BOOLEAN STBEventHandler(BOOLEAN latched, BOOLEAN repeat, U16BIT class, U16BIT type,
244  void *data, U32BIT data_size)
245 {
246  S_EVENT_INFO event_info;
247  BOOLEAN retval;
248 
249  FUNCTION_START(STBEventHandler);
250 
251  USE_UNWANTED_PARAM(latched);
252 
253  retval = TRUE;
254 
255  if (repeat && (class & EV_CLASS_CAN_REPEAT_FLAG) && classify_repeats)
256  {
257  class |= EV_CLASS_IS_REPEAT;
258  }
259 
260  /* Build the 32 bit event code from the event parameters */
261  event_info.event_code = (U32BIT)(class << 16) | type;
262 
263  if ((data != NULL) && (data_size > 0))
264  {
265  /* Allocate memory for the event data to be passed on */
266  if ((event_info.data = STB_AppGetMemory(data_size)) != NULL)
267  {
268  memcpy(event_info.data, data, data_size);
269  event_info.data_size = data_size;
270  }
271  else
272  {
273  retval = FALSE;
274  }
275  }
276  else
277  {
278  event_info.data = NULL;
279  event_info.data_size = 0;
280  }
281 
282  if (retval)
283  {
284  /* Send the event to the queue */
285  STB_OSWriteQueue(event_queue, (void *)&event_info, sizeof(S_EVENT_INFO), TIMEOUT_NEVER);
286  }
287 
288  FUNCTION_FINISH(STBEventHandler);
289 
290  return(retval);
291 }
292 
293 /*****************************************************************************
294  * @brief
295  ******************************************************************************/
296 static void EventTask(void *param)
297 {
298  S_EVENT_INFO event_info;
299  U8BIT path;
300  void *serv_ptr;
301  void *event_serv;
302  U16BIT disk_id;
303  U32BIT handle;
304 #if 0
305  U32BIT heap_stats_time = STB_OSGetClockMilliseconds();
306 #endif
307  BOOLEAN is_live;
308 
309  FUNCTION_START(EventTask);
310 
311  USE_UNWANTED_PARAM(param);
312 
313  DBG(("EventTask: started"));
314 
315  while (1)
316  {
317  if (STB_OSReadQueue(event_queue, (void *)&event_info, sizeof(S_EVENT_INFO), TIMEOUT_NEVER))
318  {
319  DBG(("EventTask: event 0x%08lx, data %p, %lu bytes", event_info.event_code,
320  event_info.data, event_info.data_size));
321 
322  switch (event_info.event_code)
323  {
324  case STB_EVENT_TUNE_LOCKED:
325  case STB_EVENT_TUNE_NOTLOCKED:
326  case STB_EVENT_TUNE_SIGNAL_DATA_BAD:
327  case STB_EVENT_TUNE_SIGNAL_DATA_OK:
328  case STB_EVENT_SEARCH_SUCCESS:
329  case STB_EVENT_SEARCH_FAIL:
330  {
331  ACTL_ActionEvent(event_info.event_code, event_info.data);
332  break;
333  }
334 
335  case STB_EVENT_AUDIO_DECODE_STARTED:
336  case STB_EVENT_VIDEO_DECODE_STARTED:
337  case STB_EVENT_AUDIO_DECODE_STOPPED:
338  case STB_EVENT_VIDEO_DECODE_STOPPED:
339  case STB_EVENT_AUDIO_DECODE_UNDERFLOW:
340  case STB_EVENT_VIDEO_DECODE_UNDERFLOW:
341  case STB_EVENT_SAMPLE_DECODE_STOPPED:
342  case STB_EVENT_DECODE_LOCKED:
343  {
344  ACTL_ActionEvent(event_info.event_code, event_info.data);
345  break;
346  }
347 
348  case STB_EVENT_HDMI_CONNECTED:
349  {
351  break;
352  }
353 
354  case STB_EVENT_HDMI_DISCONNECTED:
355  {
357  break;
358  }
359 
360  case STB_EVENT_OTA_SW_UPGRADE_FOUND:
361  case STB_EVENT_OTA_SW_UPGRADE_NOTFOUND:
362  case STB_EVENT_OTA_SW_UPGRADE_ERROR:
363  {
364  ACTL_ActionEvent(event_info.event_code, event_info.data);
365  break;
366  }
367 
368  case STB_EVENT_DISK_FULL:
369  {
370  /* Stop any recordings being made on the given disk */
371  disk_id = *(U16BIT *)event_info.data;
372 
373  for (path = 0; path < STB_DPGetNumPaths(); path++)
374  {
375  if (STB_DPIsRecording(path, &handle) &&
376  (STB_PVRRecordingGetDiskId(handle) == disk_id))
377  {
378  APVR_StopRecording(handle);
379  }
380  }
381  break;
382  }
383 
384  case APP_EVENT_SERVICE_NOT_RUNNING:
385  {
387 
388  /* Check for an alternative service */
389  if (!CheckForAlternativeService(LINK_TYPE_SERVICE_REPLACEMENT))
390  {
391  /* No alterative service found */
392  ACTL_ActionEvent(event_info.event_code, event_info.data);
393  }
394  break;
395  }
396 
397  case APP_EVENT_SERVICE_AUDIO_PID_UPDATE:
398  case APP_EVENT_SERVICE_VIDEO_PID_UPDATE:
399  case APP_EVENT_SERVICE_RUNNING:
400  {
401  event_serv = *(void **)event_info.data;
402  if ((path = STB_DPGetPathForService(event_serv)) != INVALID_RES_ID)
403  {
404  if (STB_DPIsDecodingPath(path))
405  {
406  if ((original_alternative_service != NULL) &&
407  (event_serv == original_alternative_service))
408  {
409  /* A non-running / scrambled service that was switched away from has now
410  * started again, so switch back to it */
412  ReturnFromAlternativeService();
413  }
414  else
415  {
416  /* Handle the PID update for the service */
417  ACTL_ActionEvent(event_info.event_code, event_serv);
418  }
419  }
420  else
421  {
422  /* Handle the PID update for the service */
423  ACTL_ActionEvent(event_info.event_code, event_serv);
424  }
425  }
426  break;
427  }
428 
429  case APP_EVENT_SERVICE_STREAMS_CHANGED:
430  {
431  event_serv = *(void **)event_info.data;
432 
433  /* The service may be used by more than one path, so need to check them all */
434  for (path = 0; path < STB_DPGetNumPaths(); path++)
435  {
436  if ((ADB_GetTunedService(path) == event_serv) && STB_DPIsRecordingPath(path))
437  {
438  /* PIDs for the recording have changed */
439  APVR_PidsUpdated(path);
440  }
441  }
442  break;
443  }
444 
445  case APP_EVENT_SERVICE_SCRAMBLE_CHANGE:
446  {
447  event_serv = *(void **)event_info.data;
448  if ((path = STB_DPGetLivePath()) != INVALID_RES_ID)
449  {
450  serv_ptr = ADB_GetTunedService(path);
451  }
452 
453  if ((path != INVALID_RES_ID) && (event_serv == serv_ptr))
454  {
455  if (ADB_GetServiceScrambledFlag(serv_ptr))
456  {
458 
459  if (!CheckForAlternativeService(LINK_TYPE_CA_REPLACEMENT_SERVICE))
460  {
461  /* No alternative service found, so handle the event here */
462  ACTL_ActionEvent(event_info.event_code, NULL);
463  }
464  }
465  else
466  {
467  /* Existing service has become unscrambled */
468  ACTL_ActionEvent(event_info.event_code, event_serv);
469  }
470  }
471  else if ((original_alternative_service != NULL) &&
472  (event_serv == original_alternative_service))
473  {
474  if (!ADB_GetServiceScrambledFlag(original_alternative_service))
475  {
476  /* The original service is no longer scrambled so we can return to it */
478  ReturnFromAlternativeService();
479  }
480  }
481  break;
482  }
483 
484  case APP_EVENT_SERVICE_SUBTITLE_UPDATE:
485  case APP_EVENT_SERVICE_VIDEO_CODEC_CHANGED:
486  case APP_EVENT_SERVICE_AUDIO_CODEC_CHANGED:
487  {
488  event_serv = *(void **)event_info.data;
489  if ((path = STB_DPGetPathForService(event_serv)) != INVALID_RES_ID)
490  {
491  ACTL_ActionEvent(event_info.event_code, event_serv);
492  }
493  break;
494  }
495 
496  case STB_EVENT_TIMER_EXPIRE:
497  {
498  /* Check if this is a private timer for any module */
499 #ifdef COMMON_INTERFACE
500  if (!ACI_HandlePrivateTimer(*((U32BIT *)event_info.data)))
501 #endif
502  {
503  if (!APVR_HandlePrivateTimer(*((U32BIT *)event_info.data)))
504  {
505  if (!ACTL_HandlePrivateTimerEvent(*((U32BIT *)event_info.data)))
506  {
507  ATMR_HandleTimerEvent(*((U32BIT *)event_info.data));
508  }
509  }
510  }
511  break;
512  }
513 
514  case STB_EVENT_TIMER_NOTIFY:
515  {
516 #ifdef INTEGRATE_HBBTV
517  if ((event_info.data != NULL) && (event_info.data_size == sizeof(U32BIT)))
518  {
519  U32BIT timer_handle = *(U32BIT *)event_info.data;
520  if (timer_handle != INVALID_TIMER_HANDLE)
521  {
522  HBBTV_NotifyRecordingEvent(timer_handle, HBBTV_RECORDING_ABOUT_TO_START);
523  }
524  }
525 #endif
526  break;
527  }
528 
529  case APP_EVENT_SERVICE_EIT_NOW_UPDATE:
530  {
531 #ifdef NOW_EVENTS_LATCHED
532  /* This event is latched so notify that it's now been handled.
533  * The event is unlatched first to ensure that a new event coming in
534  * while this one if being processed isn't lost, even if it means some
535  * unecessary processing is performed, because it's safer than missing an event */
536  STB_ERNotifyEvent(EVENT_CLASS(event_info.event_code), EVENT_TYPE(event_info.event_code));
537 
538  path = ACTL_GetActivePath();
539  if ((path != INVALID_RES_ID) && STB_DPIsDecodingPath(path) &&
540  ((serv_ptr = ADB_GetTunedService(path)) != NULL))
541  {
542  ACTL_ApplyParentalControl(path, serv_ptr);
543  ACTL_ApplyHDCP(serv_ptr);
544  }
545 
546  event_serv = NULL;
547 #else
548  event_serv = *(void **)event_info.data;
549 
550  for (path = 0; path < STB_DPGetNumPaths(); path++)
551  {
552  if ((ADB_GetTunedService(path) == event_serv) && STB_DPIsDecodingPath(path))
553  {
554  ACTL_ApplyParentalControl(path, event_serv);
555  ACTL_ApplyHDCP(event_serv);
556  }
557  }
558 #endif
559 
560  if (ATMR_CheckRecordStatus(TRUE, event_serv))
561  {
562  /* A recording has been started */
564  }
565 
566  APVR_EitUpdated();
567  break;
568  }
569 
570  case APP_EVENT_PVR_RECORDING_FAILED:
571  case STB_EVENT_PVR_REC_STOP:
572  {
574  {
575  /* All recordings have finished and none are ready to start */
577  }
578  break;
579  }
580 
581  case APP_EVENT_SERVICE_EIT_SCHED_UPDATE:
582  {
583  /* This event is latched so notify that it's now been handled */
584  STB_ERNotifyEvent(EVENT_CLASS(event_info.event_code), EVENT_TYPE(event_info.event_code));
585  APVR_EitUpdated();
586  break;
587  }
588 
589  case STB_EVENT_FORCED_SERVICE_CHANGE:
590  {
591  path = *(U8BIT *)event_info.data;
592  serv_ptr = STB_DPGetTunedService(path);
593  is_live = STB_DPIsLivePath(path);
594  ACTL_TuneToService(path, NULL, serv_ptr, FALSE, is_live);
595  if (is_live == TRUE)
596  {
597  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_APPLICATION, EV_SERVICE_CHANGED,
598  &serv_ptr, sizeof(void *));
599  }
600  break;
601  }
602 
603 #ifdef COMMON_INTERFACE
604  case STB_EVENT_CI_APP_INFO:
605  {
606  ACTL_ActionEvent(event_info.event_code, event_info.data);
607  break;
608  }
609 #endif
610 
611  default:
612  {
613  break;
614  }
615  }
616 
617  /* Now pass the event to the event handler that was registered on startup, if any,
618  * which may pass the event to the UI */
619  NotifyAll(event_info.event_code, event_info.data, event_info.data_size);
620 
621  /* The memory associated with the event can now be freed */
622  if (event_info.data != NULL)
623  {
624  STB_AppFreeMemory(event_info.data);
625  }
626 #if 0
627  if (STB_OSGetClockDiff(heap_stats_time) >= 30000)
628  {
629  U32BIT cur_app, max_app, num_app, cur_mem, max_mem, num_mem;
630  STB_GetHeapStats(&cur_app, &max_app, &num_app, &cur_mem, &max_mem, &num_mem);
631  STB_SPDebugWrite("<<<<< Mem usage:\n");
632  STB_SPDebugWrite(" App: Current=%luKB, Max=%luKB, Num=%lu\n", cur_app / 1024, max_app / 1024, num_app);
633  STB_SPDebugWrite(" Sys: Current=%luKB, Max=%luKB, Num=%lu\n", cur_mem / 1024, max_mem / 1024, num_mem);
634  heap_stats_time = STB_OSGetClockMilliseconds();
635  }
636 #endif
637  }
638  }
639 
640  DBG(("EventTask: finished"));
641 
642  FUNCTION_FINISH(EventTask);
643 }
644 
645 /*****************************************************************************
646  * @brief Checks for an alternative service and if found, tunes to it.
647  * This will usually be triggered when a service is not running or is scrambled.
648  * @param alt_serv_type - linkage type for the alterative service to be searched for
649  * @return TRUE if an alternative service is found
650  ******************************************************************************/
651 static BOOLEAN CheckForAlternativeService(U8BIT alt_serv_type)
652 {
653  void *serv_ptr;
654  void *new_serv;
655  U8BIT path;
656  BOOLEAN retval;
657 
658  FUNCTION_START(CheckForAlternativeService);
659 
660  retval = FALSE;
661 
662  path = STB_DPGetLivePath();
663  if (path != INVALID_RES_ID)
664  {
665  serv_ptr = ADB_GetTunedService(path);
666 
667  new_serv = ADB_GetAlternativeService(serv_ptr, alt_serv_type);
668  if (new_serv != NULL)
669  {
670  /* Store the original service so that it can be returned to */
671  original_alternative_service = serv_ptr;
672 
673  NotifyAll(APP_EVENT_SWITCH_ALTERNATIVE_SERVICE,&new_serv, sizeof(void *));
674  ACTL_TuneToService(INVALID_RES_ID, NULL, new_serv, FALSE, TRUE);
675  retval = TRUE;
676  }
677  }
678 
679  FUNCTION_FINISH(CheckForAlternativeService);
680 
681  return(retval);
682 }
683 
684 /*!**************************************************************************
685  * @brief Changes back to a service that was left due to a switch to an alternative
686  * service as a result of something like a non-running event.
687  * @return TRUE if the service is changed, FALSE otherwise
688  ****************************************************************************/
689 static BOOLEAN ReturnFromAlternativeService(void)
690 {
691  BOOLEAN retval;
692 
693  FUNCTION_START(ReturnFromAlternativeService);
694 
695  if (original_alternative_service != NULL)
696  {
697  NotifyAll(APP_EVENT_SWITCH_ALTERNATIVE_SERVICE,&original_alternative_service, sizeof(void *));
698  ACTL_TuneToService(INVALID_RES_ID, NULL, original_alternative_service, FALSE, TRUE);
699  retval = TRUE;
700  original_alternative_service = NULL;
701  }
702  else
703  {
704  retval = FALSE;
705  }
706 
707  FUNCTION_FINISH(ReturnFromAlternativeService);
708 
709  return(retval);
710 }
711 
712 /****************************************************************************
713  * End of file
714  *****************************************************************************/
715 
716 /*****************************************************************************
717  * @brief
718  ******************************************************************************/
719 
U8BIT STB_DPGetPathForService(void *service)
Checks whether any of the paths are tuned to the given service.
Definition: stbdpc.c:1804
void STB_LLAddBlockToEnd(LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the end of the linked list identified by the list...
Definition: stbllist.c:325
BOOLEAN STB_DPIsRecording(U8BIT path, U32BIT *handle)
Returns status of recording on specified path.
Definition: stbdpc.c:2189
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...
Definition: ap_tmr.c:1939
BOOLEAN ACTL_HandlePrivateTimerEvent(U32BIT timer_handle)
Handles all the private timer events.
Definition: ap_cntrl.c:960
void * ADB_GetAlternativeService(void *s_ptr, U8BIT alt_serv_type)
Searches for a replacement service of the given type for the given service.
Definition: ap_dbacc.c:6706
macros and function prototypes for public use
void ACTL_ApplyParentalControl(U8BIT path, void *s_ptr)
Checks the parental control for the current event on the given service to determine whether decoding ...
Definition: ap_cntrl.c:3187
void * STB_DPGetTunedService(U8BIT path)
Returns the service saved with the given decode path.
Definition: stbdpc.c:1582
void ACTL_ActionEvent(U32BIT event, void *event_data)
Actions external events.
Definition: ap_cntrl.c:502
BOOLEAN STB_DPIsLivePath(U8BIT path)
Is the given decode path being used for live viewing.
Definition: stbdpc.c:1297
U32BIT STB_OSGetClockDiff(U32BIT timestamp)
Get Difference between Given Time and Current Time.
Header file - macros and function prototypes for public use.
void APVR_PidsUpdated(U8BIT path)
This function should be called when there&#39;s an update to the PIDs for a service that&#39;s being recorded...
Definition: ap_pvr.c:3791
BOOLEAN APP_UnregisterDVBEventHandler(DVB_EVENT_HANDLER event_handler)
Unregister a previously registered event handler.
Definition: ap_events.c:182
void * STB_AppGetMemory(U32BIT bytes)
Attempts to allocate memory from the application heap.
Definition: stbheap.c:651
void STB_ERRegisterHandler(BOOLEAN(*func)(BOOLEAN latched, BOOLEAN repeat, U16BIT class, U16BIT type, void *data, U32BIT data_size))
Called by app to register callback function for events.
Definition: stberc.c:510
BOOLEAN ACI_HandlePrivateTimer(U32BIT timer_handle)
Checks whether the given timer is associated with any of the CI+ profiles and starts the operator sea...
Definition: ap_ci.c:1292
Header file - Function prototypes for A/V control.
void(* DVB_EVENT_HANDLER)(U32BIT event, void *event_data, U32BIT data_size)
The event notification callback function.
Definition: app.h:184
U16BIT STB_PVRRecordingGetDiskId(U32BIT handle)
Gets the disk id for a recording.
Definition: stbpvr.c:1593
void ASTE_StartRecording(void)
Definition: ap_state.c:140
Application timer functions and defines.
void ATMR_HandleTimerEvent(U32BIT timer_handle)
Used by the DVB stack to handle an event for the given timer. If the timer requires the app to deal w...
Definition: ap_tmr.c:1674
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. &#39;leave&#39;, &#39;signal&#39; or &#39;release&#39;)
Header file - macros and function prototypes for public use.
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.
Definition: ap_cntrl.c:5081
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.
Definition: stberc.c:571
U8BIT STB_DPGetNumPaths(void)
Returns the maximum number of decode paths.
Definition: stbdpc.c:532
BOOLEAN APP_RegisterDVBEventHandler(DVB_EVENT_HANDLER event_handler)
Register for DVB event notifications.
Definition: ap_events.c:162
U8BIT STB_DPGetLivePath(void)
Returns the ID of the decode path being used for live viewing.
Definition: stbdpc.c:1271
void ACTL_ApplyHDCP(void *s_ptr)
Checks content protection requirements for the current event on the given service to determine whethe...
Definition: ap_cntrl.c:3311
BOOLEAN STB_DPIsDecodingPath(U8BIT path)
Is the given decode path being used for decoding.
Definition: stbdpc.c:1346
void STB_ERNotifyEvent(U8BIT event_class, U16BIT event_type)
Called by app to notify consumption of latched event.
Definition: stberc.c:532
void STB_SPDebugWrite(const char *format,...)
Write debug string to serial/debug port. <CR><LF> characters will be automatically added to the end o...
Debug functions header file.
void STB_LLRemoveBlock(LINK_LIST_PTR_BLK *blk)
Removes the block identified by the blk pointer from its linked list.
Definition: stbllist.c:488
Header file - Function prototypes for linked lists.
Header file - macros and function prototypes for public use.
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. &#39;enter&#39;, &#39;wait&#39; or &#39;get&#39;).
BOOLEAN ADB_GetServiceScrambledFlag(void *s_ptr)
Returns the status of the &#39;scrambled&#39; flag of the given service. This flag is set depending on the sc...
Definition: ap_dbacc.c:5679
void * ADB_GetTunedService(U8BIT path)
Returns the tuned service for the given decode path.
Definition: ap_dbacc.c:6068
LINK_LIST_PTR_BLK * STB_LLGetNextBlock(LINK_LIST_PTR_BLK *blk)
Returns a pointer to the next block in the linked list, or NULL if at the end of the list...
Definition: stbllist.c:566
Application level CI - internal functions.
void APP_SetClassifyRepeatEvents(BOOLEAN enable)
Enable classifying of repeat events by EV_CLASS_IS_REPEAT flag.
Definition: ap_events.c:213
Header file - Function prototypes for Event Reporting.
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...
Definition: ap_cntrl.c:1651
LINK_LIST_PTR_BLK * STB_LLGetFirstBlock(LINK_LIST_HEADER *hdr)
Returns a pointer to the first block in the linked list, identified by hdr.
Definition: stbllist.c:633
application level SI task
Application stb layer control.
BOOLEAN APVR_IsRecordingInProgress(void)
Returns TRUE if there are any recordings currently in progress.
Definition: ap_pvr.c:2798
BOOLEAN STB_OSWriteQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
Write a message to the queue.
Header file - Function prototypes for operating system.
System Wide Global Technical Data Type Definitions.
BOOLEAN APVR_StopRecording(U32BIT recording_handle)
Stops the given recording.
Definition: ap_pvr.c:2156
void STB_AppFreeMemory(void *addr)
Releases previously allocated application heap memory.
Definition: stbheap.c:781
Application level HBBTV callback functions.
void ACTL_HDMIDisconnected(void)
Sets flag to indicate HDMI is now disconnected. This function is called by the event task when the HD...
Definition: ap_cntrl.c:2982
void ACTL_StopSubtitles(void)
Stops subtitles from being displayed and processed.
Definition: ap_cntrl.c:3579
BOOLEAN STB_DPIsRecordingPath(U8BIT path)
Is the given decode path being used for recording.
Definition: stbdpc.c:1320
void * STB_OSCreateTask(void(*function)(void *), void *param, U32BIT stack, U8BIT priority, U8BIT *name)
Create a New Task to the calling process. Upon success, the created task runs on its own stack...
void * STB_OSCreateQueue(U16BIT msg_size, U16BIT msg_max)
Create Queue of given number of messages and size of message.
BOOLEAN APVR_HandlePrivateTimer(U32BIT timer_handle)
Deals with any private timers started by the PVR module.
Definition: ap_pvr.c:3619
void ACTL_HDMIConnected(void)
Checks that the selected HDMI resolution mode is supported and, if not, chooses the best one availabl...
Definition: ap_cntrl.c:2953
BOOLEAN ASTE_InStandby(void)
Definition: ap_state.c:117
Header file - Function prototypes for heap memory.
void * STB_OSCreateMutex(void)
Create a mutex.
U8BIT ACTL_GetActivePath(void)
Returns the active path (live, playback, etc...), i.e. the one using the decoders.
Definition: ap_cntrl.c:3663
Application header file.
BOOLEAN STB_OSReadQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
Read a message from a queue.
void HBBTV_NotifyRecordingEvent(U32BIT id, E_HBBTV_RECORDING_EVENT event)
Notifies the HbbTV engine of a recording event.
void STB_OSDeleteMutex(void *mutex)
Delete a mutex.
void APVR_EitUpdated(void)
Ensures that any EIT updates are processed to handle scenarios such as checking for new series record...
Definition: ap_pvr.c:3770
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.
void STB_LLInitialiseHeader(LINK_LIST_HEADER *hdr)
Initialise the header variables of the linked list.
Definition: stbllist.c:119
Application database access functions.
Header file - macros and function prototypes for public use.