DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
ap_si.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 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  *******************************************************************************/
24 // pre-processor mechanism so multiple inclusions don't cause compilation error
25 #ifndef _AP_SI_H
26 #define _AP_SI_H
27 
28 #include "techtype.h"
29 #include "stbsiflt.h"
30 #include "stbsitab.h"
31 
32 /* quality and strength are on a scale 0 to 10 */
33 #define GET_SIGNAL_STATUS(quality, strength) (((quality) & 0x0a) << 4 | ((strength) & 0x0a))
34 #define BAD_SIGNAL_STATUS 0xff
35 
36 #define GET_SIGNAL_QUALITY(status) ((status) >> 4)
37 #define GET_SIGNAL_STRENGTH(status) ((status) & 0x0f)
38 
39 //---Constant and macro definitions for public use-----------------------------
40 
41 //---Enumerations for public use-----------------------------------------------
42 
43 typedef enum
44 {
45  APP_SI_MODE_NO_SI,
46  APP_SI_MODE_CHANNEL_SEARCH, // use STB_DPSetSearchMode(0, TRUE);
47  APP_SI_MODE_CHANNEL_SEARCH_NO_NIT, // use STB_DPSetSearchMode(0, TRUE);
48  APP_SI_MODE_STARTUP_SEARCH, // use STB_DPSetSearchMode(0, TRUE);
49  APP_SI_MODE_EVENT_SCHED_SEARCH, // use STB_DPSetSearchMode(0, TRUE);
50  APP_SI_MODE_DVB_SSU_SEARCH, // use STB_DPSetSearchMode(0, TRUE);
51  APP_SI_MODE_UPDATE, // use STB_DPSetSearchMode(0, FALSE);
52  APP_SI_MODE_CIPLUS_UPDATE, // use STB_DPSetSearchMode(0, FALSE);
53  APP_SI_MODE_CIPLUS_NO_PAT_PMT, // use STB_DPSetSearchMode(0, FALSE);
54  APP_SI_MODE_TOT_SEARCH, // use STB_DPSetSearchMode(0, TRUE);
55  APP_SI_MODE_USER_DEFINED
56 } E_APP_SI_MODE;
57 
58 typedef enum
59 {
60  SEARCH_SERVICE_TYPE_ADVANCED_CODEC = 0x0001, /* Advanced codec services - H264, AC-3, AAC, etc */
61  SEARCH_SERVICE_TYPE_HD = 0x0002, /* Services defined as HD, including MPEG2 HD */
62  SEARCH_SERVICE_TYPE_HEVC = 0x0004, /* HEVC codec services */
63 
64  SEARCH_SERVICE_TYPE_FREE_TO_AIR = 0x4000,
65  SEARCH_SERVICE_TYPE_ENCRYPTED = 0x8000,
66 
67  SEARCH_SERVICE_TYPE_FTA = (SEARCH_SERVICE_TYPE_FREE_TO_AIR | 0x3fff),
68  SEARCH_SERVICE_TYPE_SCRAMBLED = (SEARCH_SERVICE_TYPE_ENCRYPTED | 0x3fff),
69  SEARCH_SERVICE_TYPE_ALL = 0xffff
70 } E_SEARCH_SERVICE_TYPE;
71 
72 typedef enum
73 {
74  UPDATE_MODE_DEFAULT,
75  UPDATE_MODE_AUTOMATIC
76 } E_SERVICE_UPDATE_MODE;
77 
78 typedef enum
79 {
80  SORT_ADD_TO_END,
81  SORT_ADD_TO_BEGINNING,
82  SORT_BY_LCN,
83 } E_SORT_ORDER;
84 
85 /* Events passed to SI managers */
86 typedef enum
87 {
88  APP_SI_START_MANAGER = 0x0001,
89  APP_SI_STOP_MANAGER = 0x0002,
90  APP_SI_CHANNEL_CHANGE = 0x0003,
91 
92  APP_SI_PAT_RECEIVED = 0x0011,
93  APP_SI_PMT_RECEIVED = 0x0012,
94  APP_SI_SDT_RECEIVED = 0x0013,
95  APP_SI_NIT_RECEIVED = 0x0014,
96  APP_SI_EIT_RECEIVED = 0x0015,
97  APP_SI_TOT_RECEIVED = 0x0016,
98  APP_SI_TDT_RECEIVED = 0x0017,
99  APP_SI_CAT_RECEIVED = 0x0018,
100  APP_SI_RCT_RECEIVED = 0x0019,
101  APP_SI_AIT_RECEIVED = 0x001A,
102  APP_SI_BAT_RECEIVED = 0x0020,
103 
104  APP_SI_PAT_TIMEOUT = 0x0031,
105  APP_SI_PMT_TIMEOUT = 0x0032,
106  APP_SI_SDT_TIMEOUT = 0x0033,
107  APP_SI_NIT_TIMEOUT = 0x0034,
108  APP_SI_EIT_TIMEOUT = 0x0035,
109  APP_SI_TOT_TIMEOUT = 0x0036,
110  APP_SI_TDT_TIMEOUT = 0x0037,
111  APP_SI_CAT_TIMEOUT = 0x0038,
112  APP_SI_SCHED_TIMEOUT = 0x0039,
113  APP_SI_BAT_TIMEOUT = 0x0040,
114 
115  APP_SI_PMT_UPDATE = 0x0051,
116  APP_SI_UPDATE_DELAY_EXPIRED = 0x0052,
117  APP_SI_STOP_PMT_REPORTING = 0x0053,
118 
119  APP_SI_USER_DEFINED_EVENT = 0x0100
120 } E_APP_SI_EVENT_CODE;
121 
122 typedef enum {
123  APP_SI_EIT_JOURNAL_TYPE_CLEAR,
124  APP_SI_EIT_JOURNAL_TYPE_ADD,
125  APP_SI_EIT_JOURNAL_TYPE_DELETE,
126  APP_SI_EIT_JOURNAL_TYPE_UPDATE,
127  APP_SI_EIT_JOURNAL_TYPE_EXPIRE
128 } E_APP_SI_EIT_JOURNAL_TYPE;
129 
130 typedef struct s_app_si_eit_journal
131 {
132  E_APP_SI_EIT_JOURNAL_TYPE type;
133  U16BIT orig_net_id;
134  U16BIT tran_id;
135  U16BIT serv_id;
136  U16BIT allocated_lcn;
137  BOOLEAN is_sched;
138  U16BIT event_id;
140 
141 
142 //---Global type defs for public use-------------------------------------------
143 typedef BOOLEAN (*F_SIManager)(U8BIT, U32BIT, SI_TABLE_RECORD *); /* Type of SI manager function */
144 typedef void (*F_EitParser)(U8BIT, U8BIT, U8BIT *, U32BIT, void *);
145 typedef void (*F_BatTableUpdate)(U8BIT, SI_BAT_TABLE *, SI_TABLE_RECORD *);
146 typedef void (*F_EitTableUpdate)(U8BIT, SI_TABLE_RECORD *);
147 typedef void (*F_NitTableUpdate)(U8BIT, SI_NIT_TABLE *, SI_TABLE_RECORD *);
148 typedef void (*F_PmtTableUpdate)(U8BIT, SI_PMT_TABLE *, SI_TABLE_RECORD *, void *);
149 typedef void (*F_SdtTableUpdate)(U8BIT, SI_SDT_TABLE *, SI_TABLE_RECORD *);
150 
151 typedef void (*F_EitSchedUpdateCB)(S_APP_SI_EIT_SCHED_UPDATE *update);
152 
153 
154 //---Global Function prototypes for public use---------------------------------
155 
162 BOOLEAN ASI_CheckForServiceChange(void);
163 
168 void ASI_SetSearchServiceType(E_SEARCH_SERVICE_TYPE service_type);
169 
176 void ASI_SetServiceUpdateMode(E_SERVICE_UPDATE_MODE update_mode, E_SORT_ORDER sort_order);
177 
183 void ASI_AddServiceToPmtList(U16BIT service_id);
184 
189 void ASI_RemoveServiceFromPmtList(U16BIT service_id);
190 
194 void ASI_ClearPmtList(void);
195 
204 void ASI_ProcessPmt(U8BIT path, void *s_ptr, U8BIT *pmt_data);
205 
212 void ASI_SetEITScheduleLimit(U16BIT limit_hours);
213 
218 U16BIT ASI_GetEITScheduleLimit(void);
219 
228 void ASI_EnableBatCollection(BOOLEAN use_bats, U16BIT *bouquet_ids, U16BIT num_ids);
229 
242 void* ASI_GetNextOTALocation(void *network, void *prev_location, U16BIT *onid_ptr,
243  U16BIT *tid_ptr, U16BIT *sid_ptr);
244 
249 void ASI_RefuseSSU(BOOLEAN refuse);
250 
255 BOOLEAN ASI_SSURefused(void);
256 
261 void ASI_SSUSetMandatory(BOOLEAN mandatory);
262 
267 BOOLEAN ASI_SSUGetMandatory(void);
268 
269 
270 //---Global Function prototypes for internal use---------------------------------
274 void ASI_InitialiseAppSi(void);
275 
281 void ASI_SetAppSiMode(U8BIT path, E_APP_SI_MODE si_mode);
282 
290 U16BIT ASI_GetPmtPid(U16BIT serv_id, U16BIT ts_id, U16BIT on_id);
291 
295 void ASI_StopPmtReporting(U8BIT path);
296 
302 BOOLEAN ASI_PmtReported(U8BIT path);
303 
310 void ASI_SetStandbyState(BOOLEAN standby_state);
311 
317 void ASI_RestartCatFilter(U8BIT path);
318 
324 void ASI_RestartNitFilter(U8BIT path);
325 
331 void ASI_RestartSdtFilter(U8BIT path);
332 
338 void ASI_RestartBatFilter(U8BIT path);
339 
345 void ASI_RestartTotFilter(U8BIT path);
346 
352 void ASI_RestartTdtFilter(U8BIT path);
353 
362 void ASI_RestartSITables(U8BIT path, BOOLEAN use_standard_pids);
363 
369 void ASI_SetEITParserFunction(F_EitParser parser_func);
370 
375 void ASI_SetUpdateBatFunction(F_BatTableUpdate update_func);
376 
381 void ASI_SetUpdateEitFunction(F_EitTableUpdate update_func);
382 
387 void ASI_SetUpdateNitFunction(F_NitTableUpdate update_func);
388 
393 void ASI_SetUpdatePmtFunction(F_PmtTableUpdate update_func);
394 
399 void ASI_SetUpdateSdtFunction(F_SdtTableUpdate update_func);
400 
406 void ASI_ProcessEitTable(SI_TABLE_RECORD *table_rec, BOOLEAN playback);
407 
415 void ASI_RegisterEitSchedUpdateCallback(F_EitSchedUpdateCB sched_update_callback);
416 
424 void ASI_NotifyEitSchedUpdate(void *serv_ptr, U16BIT event_id, E_APP_SI_EIT_JOURNAL_TYPE type);
425 
430 void ASI_ProcessTotTable(SI_TABLE_RECORD *table_rec);
431 
436 void ASI_ProcessTdtTable(SI_TABLE_RECORD *table_rec);
437 
438 #endif
BOOLEAN ASI_SSUGetMandatory(void)
Returns the flag indicating whether the SSU is mandatory and so can't be refused. ...
Definition: ap_si.c:9356
void ASI_StopPmtReporting(U8BIT path)
Prevents the current pmt being reported (e.g. to MHEG).
Definition: ap_si.c:9211
void ASI_NotifyEitSchedUpdate(void *serv_ptr, U16BIT event_id, E_APP_SI_EIT_JOURNAL_TYPE type)
Calls the EIT schedule update callback function, if one has been registered, with details of the serv...
Definition: ap_si.c:10184
void ASI_SSUSetMandatory(BOOLEAN mandatory)
Sets the flag indicating whether the SSU can be refused by the user.
Definition: ap_si.c:9345
Definition: stbsitab.h:635
void ASI_InitialiseAppSi(void)
Initialises application SI handling.
Definition: ap_si.c:8978
void ASI_SetEITScheduleLimit(U16BIT limit_hours)
Sets the number of hours of EIT data that's kept for each service that hasn't its had EIT schedule di...
Definition: ap_si.c:9705
void ASI_RestartTotFilter(U8BIT path)
Forces the SI demux filter collecting the TOT tables to be reset, so a previously processed versions ...
Definition: ap_si.c:9496
void ASI_RestartTdtFilter(U8BIT path)
Forces the SI demux filter collecting the TDT tables to be reset, so a previously processed versions ...
Definition: ap_si.c:9516
Definition: ap_si.h:130
void ASI_RegisterEitSchedUpdateCallback(F_EitSchedUpdateCB sched_update_callback)
Registers a function that will be called whenever an EIT event is added, updated, deleted or expires ...
Definition: ap_si.c:10168
Definition: stbsitab.h:375
void ASI_SetUpdateSdtFunction(F_SdtTableUpdate update_func)
Sets a function that will be called when an SDT table is received.
Definition: ap_si.c:10046
void ASI_ProcessPmt(U8BIT path, void *s_ptr, U8BIT *pmt_data)
Takes data for a raw PMT for the given service and processes it as if it had been received from the d...
Definition: ap_si.c:9657
void ASI_AddServiceToPmtList(U16BIT service_id)
Add the given service id to the list of services whose PMT will be requested with a higher priority t...
Definition: ap_si.c:9561
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.
Definition: ap_si.c:9271
Definition: stbsiflt.h:84
U16BIT ASI_GetPmtPid(U16BIT serv_id, U16BIT ts_id, U16BIT on_id)
Returns the PID for the pmt of a given service (on live path)
Definition: ap_si.c:9179
void ASI_ProcessTotTable(SI_TABLE_RECORD *table_rec)
Processes the TOT table record to extract data for the database.
Definition: ap_si.c:10069
void ASI_ClearPmtList(void)
Clears all service ids from the PMT priority list.
Definition: ap_si.c:9631
void ASI_SetServiceUpdateMode(E_SERVICE_UPDATE_MODE update_mode, E_SORT_ORDER sort_order)
Set the update mode to specify behaviour when SDT or NIT version changes and whether services are aut...
Definition: ap_si.c:9548
BOOLEAN ASI_CheckForServiceChange(void)
Checks whether the NIT or SDT version numbers have changed, which may indicate a change to the servic...
Definition: ap_si.c:9369
void ASI_RestartSdtFilter(U8BIT path)
Forces the SI demux filter collecting the SDT tables to be reset, so a previously processed versions ...
Definition: ap_si.c:9456
Header file - macros and function prototypes for public use.
void ASI_SetStandbyState(BOOLEAN standby_state)
Performs the neccessary actions for this module when entering/exiting standby according to the value ...
Definition: ap_si.c:9237
void ASI_SetUpdateEitFunction(F_EitTableUpdate update_func)
Sets a function that will be called when an EIT table is received.
Definition: ap_si.c:10013
U16BIT ASI_GetEITScheduleLimit(void)
Returns the current setting for the number of hours of EIT data that's kept.
Definition: ap_si.c:9719
void ASI_RestartNitFilter(U8BIT path)
Forces the SI demux filter collecting the NIT tables to be reset, so a previously processed version o...
Definition: ap_si.c:9434
void ASI_RestartCatFilter(U8BIT path)
Forces the SI demux filter collecting the CAT tables to be reset, so a previously processed version o...
Definition: ap_si.c:9412
void ASI_RestartBatFilter(U8BIT path)
Forces the SI demux filter collecting the BAT tables to be reset, so a previously processed versions ...
Definition: ap_si.c:9476
void ASI_SetAppSiMode(U8BIT path, E_APP_SI_MODE si_mode)
Sets application SI mode - used before STB_DPStartSI() is called.
Definition: ap_si.c:9141
void ASI_RestartSITables(U8BIT path, BOOLEAN use_standard_pids)
Cancels any existing SI filters and starts a new one for the SDT, TDT, TOT, NIT, EIT (pf...
Definition: ap_si.c:9776
void ASI_RemoveServiceFromPmtList(U16BIT service_id)
Removes the service id from the PMT priority list.
Definition: ap_si.c:9596
void ASI_SetUpdateBatFunction(F_BatTableUpdate update_func)
Sets a function that will be called when a BAT table is received.
Definition: ap_si.c:10002
Definition: stbsitab.h:724
System Wide Global Technical Data Type Definitions.
void ASI_ProcessTdtTable(SI_TABLE_RECORD *table_rec)
Processes the TDT table record to extract data for the database.
Definition: ap_si.c:10133
void ASI_SetUpdatePmtFunction(F_PmtTableUpdate update_func)
Sets a function that will be called when a PMT table is received.
Definition: ap_si.c:10035
void ASI_RefuseSSU(BOOLEAN refuse)
Sets the flag indicating whether the SSU has been refused or not.
Definition: ap_si.c:9336
BOOLEAN ASI_SSURefused(void)
Returns the flag indicating whether the SSU was refused.
Definition: ap_si.c:9327
BOOLEAN ASI_PmtReported(U8BIT path)
Returns TRUE if pmt has been reported to third parties.
Definition: ap_si.c:9224
Definition: stbsitab.h:824
void ASI_SetUpdateNitFunction(F_NitTableUpdate update_func)
Sets a function that will be called when an NIT table is received.
Definition: ap_si.c:10024
void ASI_EnableBatCollection(BOOLEAN use_bats, U16BIT *bouquet_ids, U16BIT num_ids)
Enables or disables the collection of BATs as part of the SI processing and allows the bouquet IDs of...
Definition: ap_si.c:9734
void ASI_ProcessEitTable(SI_TABLE_RECORD *table_rec, BOOLEAN playback)
Processes an EIT table, partial or full, and updates the events of the service it is for...
Definition: ap_si.c:10058
void ASI_SetEITParserFunction(F_EitParser parser_func)
Sets a function that will be called when parsing an EIT table and a descriptor is found that the stan...
Definition: ap_si.c:9991
void ASI_SetSearchServiceType(E_SEARCH_SERVICE_TYPE service_type)
Set the type for services that should be added during a service search.
Definition: ap_si.c:9535
Header file - macros and function prototypes for public use.