DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
ap_si.h File Reference

application level SI task More...

#include "techtype.h"
#include "stbsiflt.h"
#include "stbsitab.h"

Go to the source code of this file.

Data Structures

struct  s_app_si_eit_journal
 

Macros

#define GET_SIGNAL_STATUS(quality, strength)   (((quality) & 0x0a) << 4 | ((strength) & 0x0a))
 
#define BAD_SIGNAL_STATUS   0xff
 
#define GET_SIGNAL_QUALITY(status)   ((status) >> 4)
 
#define GET_SIGNAL_STRENGTH(status)   ((status) & 0x0f)
 

Typedefs

typedef struct s_app_si_eit_journal S_APP_SI_EIT_SCHED_UPDATE
 
typedef BOOLEAN(* F_SIManager )(U8BIT, U32BIT, SI_TABLE_RECORD *)
 
typedef void(* F_EitParser )(U8BIT, U8BIT, U8BIT *, U32BIT, void *)
 
typedef void(* F_BatTableUpdate )(U8BIT, SI_BAT_TABLE *, SI_TABLE_RECORD *)
 
typedef void(* F_EitTableUpdate )(U8BIT, SI_TABLE_RECORD *)
 
typedef void(* F_NitTableUpdate )(U8BIT, SI_NIT_TABLE *, SI_TABLE_RECORD *)
 
typedef void(* F_PmtTableUpdate )(U8BIT, SI_PMT_TABLE *, SI_TABLE_RECORD *, void *)
 
typedef void(* F_SdtTableUpdate )(U8BIT, SI_SDT_TABLE *, SI_TABLE_RECORD *)
 
typedef void(* F_EitSchedUpdateCB )(S_APP_SI_EIT_SCHED_UPDATE *update)
 

Enumerations

enum  E_APP_SI_MODE {
  APP_SI_MODE_NO_SI, APP_SI_MODE_CHANNEL_SEARCH, APP_SI_MODE_CHANNEL_SEARCH_NO_NIT, APP_SI_MODE_STARTUP_SEARCH,
  APP_SI_MODE_EVENT_SCHED_SEARCH, APP_SI_MODE_DVB_SSU_SEARCH, APP_SI_MODE_UPDATE, APP_SI_MODE_CIPLUS_UPDATE,
  APP_SI_MODE_CIPLUS_NO_PAT_PMT, APP_SI_MODE_TOT_SEARCH, APP_SI_MODE_USER_DEFINED
}
 
enum  E_SEARCH_SERVICE_TYPE {
  SEARCH_SERVICE_TYPE_ADVANCED_CODEC = 0x0001, SEARCH_SERVICE_TYPE_HD = 0x0002, SEARCH_SERVICE_TYPE_HEVC = 0x0004, SEARCH_SERVICE_TYPE_FREE_TO_AIR = 0x4000,
  SEARCH_SERVICE_TYPE_ENCRYPTED = 0x8000, SEARCH_SERVICE_TYPE_FTA = (SEARCH_SERVICE_TYPE_FREE_TO_AIR | 0x3fff), SEARCH_SERVICE_TYPE_SCRAMBLED = (SEARCH_SERVICE_TYPE_ENCRYPTED | 0x3fff), SEARCH_SERVICE_TYPE_ALL = 0xffff
}
 
enum  E_SERVICE_UPDATE_MODE { UPDATE_MODE_DEFAULT, UPDATE_MODE_AUTOMATIC }
 
enum  E_SORT_ORDER { SORT_ADD_TO_END, SORT_ADD_TO_BEGINNING, SORT_BY_LCN }
 
enum  E_APP_SI_EVENT_CODE {
  APP_SI_START_MANAGER = 0x0001, APP_SI_STOP_MANAGER = 0x0002, APP_SI_CHANNEL_CHANGE = 0x0003, APP_SI_PAT_RECEIVED = 0x0011,
  APP_SI_PMT_RECEIVED = 0x0012, APP_SI_SDT_RECEIVED = 0x0013, APP_SI_NIT_RECEIVED = 0x0014, APP_SI_EIT_RECEIVED = 0x0015,
  APP_SI_TOT_RECEIVED = 0x0016, APP_SI_TDT_RECEIVED = 0x0017, APP_SI_CAT_RECEIVED = 0x0018, APP_SI_RCT_RECEIVED = 0x0019,
  APP_SI_AIT_RECEIVED = 0x001A, APP_SI_BAT_RECEIVED = 0x0020, APP_SI_PAT_TIMEOUT = 0x0031, APP_SI_PMT_TIMEOUT = 0x0032,
  APP_SI_SDT_TIMEOUT = 0x0033, APP_SI_NIT_TIMEOUT = 0x0034, APP_SI_EIT_TIMEOUT = 0x0035, APP_SI_TOT_TIMEOUT = 0x0036,
  APP_SI_TDT_TIMEOUT = 0x0037, APP_SI_CAT_TIMEOUT = 0x0038, APP_SI_SCHED_TIMEOUT = 0x0039, APP_SI_BAT_TIMEOUT = 0x0040,
  APP_SI_PMT_UPDATE = 0x0051, APP_SI_UPDATE_DELAY_EXPIRED = 0x0052, APP_SI_STOP_PMT_REPORTING = 0x0053, APP_SI_USER_DEFINED_EVENT = 0x0100
}
 
enum  E_APP_SI_EIT_JOURNAL_TYPE {
  APP_SI_EIT_JOURNAL_TYPE_CLEAR, APP_SI_EIT_JOURNAL_TYPE_ADD, APP_SI_EIT_JOURNAL_TYPE_DELETE, APP_SI_EIT_JOURNAL_TYPE_UPDATE,
  APP_SI_EIT_JOURNAL_TYPE_EXPIRE
}
 

Functions

BOOLEAN ASI_CheckForServiceChange (void)
 Checks whether the NIT or SDT version numbers have changed, which may indicate a change to the service lineup requiring an update service scan. More...
 
void ASI_SetSearchServiceType (E_SEARCH_SERVICE_TYPE service_type)
 Set the type for services that should be added during a service search. More...
 
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 automatically added, deleted or modified. More...
 
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 than others. More...
 
void ASI_RemoveServiceFromPmtList (U16BIT service_id)
 Removes the service id from the PMT priority list. More...
 
void ASI_ClearPmtList (void)
 Clears all service ids from the PMT priority list.
 
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 demux, also passing it to anything monitoring PMTs and CI+. More...
 
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 disabled. More...
 
U16BIT ASI_GetEITScheduleLimit (void)
 Returns the current setting for the number of hours of EIT data that's kept. More...
 
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 the BATs to be collected to be specified. More...
 
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. More...
 
void ASI_RefuseSSU (BOOLEAN refuse)
 Sets the flag indicating whether the SSU has been refused or not. More...
 
BOOLEAN ASI_SSURefused (void)
 Returns the flag indicating whether the SSU was refused. More...
 
void ASI_SSUSetMandatory (BOOLEAN mandatory)
 Sets the flag indicating whether the SSU can be refused by the user. More...
 
BOOLEAN ASI_SSUGetMandatory (void)
 Returns the flag indicating whether the SSU is mandatory and so can't be refused. More...
 
void ASI_InitialiseAppSi (void)
 Initialises application SI handling.
 
void ASI_SetAppSiMode (U8BIT path, E_APP_SI_MODE si_mode)
 Sets application SI mode - used before STB_DPStartSI() is called. More...
 
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) More...
 
void ASI_StopPmtReporting (U8BIT path)
 Prevents the current pmt being reported (e.g. to MHEG).
 
BOOLEAN ASI_PmtReported (U8BIT path)
 Returns TRUE if pmt has been reported to third parties. More...
 
void ASI_SetStandbyState (BOOLEAN standby_state)
 Performs the neccessary actions for this module when entering/exiting standby according to the value passed in standby_state. More...
 
void ASI_RestartCatFilter (U8BIT path)
 Forces the SI demux filter collecting the CAT tables to be reset, so a previously processed version of the table won't be ignored. More...
 
void ASI_RestartNitFilter (U8BIT path)
 Forces the SI demux filter collecting the NIT tables to be reset, so a previously processed version of the table won't be ignored. More...
 
void ASI_RestartSdtFilter (U8BIT path)
 Forces the SI demux filter collecting the SDT tables to be reset, so a previously processed versions of the tables won't be ignored. More...
 
void ASI_RestartBatFilter (U8BIT path)
 Forces the SI demux filter collecting the BAT tables to be reset, so a previously processed versions of the tables won't be ignored. More...
 
void ASI_RestartTotFilter (U8BIT path)
 Forces the SI demux filter collecting the TOT tables to be reset, so a previously processed versions of the tables won't be ignored. More...
 
void ASI_RestartTdtFilter (U8BIT path)
 Forces the SI demux filter collecting the TDT tables to be reset, so a previously processed versions of the tables won't be ignored. More...
 
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, pf++ and sched) and BAT SI tables. More...
 
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 standard code doesn't know how to parse. More...
 
void ASI_SetUpdateBatFunction (F_BatTableUpdate update_func)
 Sets a function that will be called when a BAT table is received. More...
 
void ASI_SetUpdateEitFunction (F_EitTableUpdate update_func)
 Sets a function that will be called when an EIT table is received. More...
 
void ASI_SetUpdateNitFunction (F_NitTableUpdate update_func)
 Sets a function that will be called when an NIT table is received. More...
 
void ASI_SetUpdatePmtFunction (F_PmtTableUpdate update_func)
 Sets a function that will be called when a PMT table is received. More...
 
void ASI_SetUpdateSdtFunction (F_SdtTableUpdate update_func)
 Sets a function that will be called when an SDT table is received. More...
 
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. More...
 
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 from a service's EIT schedule. The registered function should return control as soon as possible, otherwise processing of other EIT events will be affected. More...
 
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 service and event. More...
 
void ASI_ProcessTotTable (SI_TABLE_RECORD *table_rec)
 Processes the TOT table record to extract data for the database. More...
 
void ASI_ProcessTdtTable (SI_TABLE_RECORD *table_rec)
 Processes the TDT table record to extract data for the database. More...
 

Detailed Description

application level SI task

Date
01/10/2002

Function Documentation

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 than others.

Parameters
service_idservice id to be added to the list
BOOLEAN ASI_CheckForServiceChange ( void  )

Checks whether the NIT or SDT version numbers have changed, which may indicate a change to the service lineup requiring an update service scan.

Returns
TRUE if one of the version numbers has changed, FALSE otherwise
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 the BATs to be collected to be specified.

Parameters
use_batsTRUE to enable the collection and processing of BATs, FALSE to disable
bouquet_idsan array of the bouquet IDs that are to be used. If this is NULL then all BATs will be used.
num_idsnumber of bouquet IDs in the array
U16BIT ASI_GetEITScheduleLimit ( void  )

Returns the current setting for the number of hours of EIT data that's kept.

Returns
number of hours, 0 means all data is kept
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.

Parameters
networknetwork on which the OTA search is being made
prev_locationif this is NULL then info from the first OTA location on the network will be returned, otherwise it should be the value returned when this function was last called so the next possible OTA location will be returned
onid_ptrpointer to return the value of the original network ID for the possible OTA
tdi_ptrpointer to return the value of the transport ID for the possible OTA
sid_ptrpointer to return the value of the service ID for the possible OTA
Returns
If NULL then no OTA locations are available, otherwise a possible OTA is available and the returned value should be passed in the next time this function is called
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)

Parameters
service_idprovides the required service ID
ts_idprovides the required transport stream ID
on_idprovides the required original network ID
Returns
the PID of the pmt for that service
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 service and event.

Parameters
serv_ptrservice whose EIT schedule has changed
event_idID of the event that's been added, updated, deleted or expired
typetype of the change. For APP_SI_EIT_JOURNAL_TYPE_CLEAR, the event_id is irrelevant
BOOLEAN ASI_PmtReported ( U8BIT  path)

Returns TRUE if pmt has been reported to third parties.

Parameters
pathdecode path
Returns
TRUE if reported, FALSE otherwise
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.

Parameters
table_recSI table record containing the EIT data
playbackTRUE if the EIT is related to PVR playback
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 demux, also passing it to anything monitoring PMTs and CI+.

Parameters
pathdecode path
s_ptrservice to be updated with info extracted from the PMT
pmt_dataraw PMT data
void ASI_ProcessTdtTable ( SI_TABLE_RECORD table_rec)

Processes the TDT table record to extract data for the database.

Parameters
table_recpointer to the TDT table record
table_recpointer to the pat table record
void ASI_ProcessTotTable ( SI_TABLE_RECORD table_rec)

Processes the TOT table record to extract data for the database.

Parameters
table_recpointer to the TOT table record
table_recpointer to the pat table record
void ASI_RefuseSSU ( BOOLEAN  refuse)

Sets the flag indicating whether the SSU has been refused or not.

Parameters
refuseTRUE to refuse the SSU, FALSE to accept
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 from a service's EIT schedule. The registered function should return control as soon as possible, otherwise processing of other EIT events will be affected.

Parameters
sched_update_callbackfunction to be called
void ASI_RemoveServiceFromPmtList ( U16BIT  service_id)

Removes the service id from the PMT priority list.

Parameters
service_idservice id to be removed
void ASI_RestartBatFilter ( U8BIT  path)

Forces the SI demux filter collecting the BAT tables to be reset, so a previously processed versions of the tables won't be ignored.

Parameters
path- decode path that will be affected
void ASI_RestartCatFilter ( U8BIT  path)

Forces the SI demux filter collecting the CAT tables to be reset, so a previously processed version of the table won't be ignored.

Parameters
path- decode path that will be affected
void ASI_RestartNitFilter ( U8BIT  path)

Forces the SI demux filter collecting the NIT tables to be reset, so a previously processed version of the table won't be ignored.

Parameters
path- decode path that will be affected
void ASI_RestartSdtFilter ( U8BIT  path)

Forces the SI demux filter collecting the SDT tables to be reset, so a previously processed versions of the tables won't be ignored.

Parameters
path- decode path that will be affected
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, pf++ and sched) and BAT SI tables.

Parameters
pathdecode path the filters are using
use_standard_pidsTRUE if SI tables on the DVB standard PIDs are to be collected, FALSE will only start a filter if a PID is defined for that table on the current service.
void ASI_RestartTdtFilter ( U8BIT  path)

Forces the SI demux filter collecting the TDT tables to be reset, so a previously processed versions of the tables won't be ignored.

Parameters
path- decode path that will be affected
void ASI_RestartTotFilter ( U8BIT  path)

Forces the SI demux filter collecting the TOT tables to be reset, so a previously processed versions of the tables won't be ignored.

Parameters
path- decode path that will be affected
void ASI_SetAppSiMode ( U8BIT  path,
E_APP_SI_MODE  si_mode 
)

Sets application SI mode - used before STB_DPStartSI() is called.

Parameters
pathdecode path
si_moderequired mode
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 standard code doesn't know how to parse.

Parameters
parser_funcfunction pointer
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 disabled.

Parameters
limit_hoursnumber of hours to EIT data to be kept. 0 turns this feature off and all data will be kept.
void ASI_SetSearchServiceType ( E_SEARCH_SERVICE_TYPE  service_type)

Set the type for services that should be added during a service search.

Parameters
service_typeall, free-to-air, or scrambled
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 automatically added, deleted or modified.

Parameters
update_modeignore changes (default) or automatically add/remove services
sort_orderspecify where new services should be added to database

Set the update mode to specify behaviour when SDT or NIT version changes and whether services are automatically added, deleted or modified.

Parameters
update_modeignore changes (default) or automatically add/remove services
sort_orderspecify where new services should be added to database
void ASI_SetStandbyState ( BOOLEAN  standby_state)

Performs the neccessary actions for this module when entering/exiting standby according to the value passed in standby_state.

Parameters
standby_stateif set TRUE indicates that the STB is entering standby mode and if set FALSE indicates shat the STB is exiting from standby mode.
void ASI_SetUpdateBatFunction ( F_BatTableUpdate  update_func)

Sets a function that will be called when a BAT table is received.

Parameters
update_funcfunction pointer
void ASI_SetUpdateEitFunction ( F_EitTableUpdate  update_func)

Sets a function that will be called when an EIT table is received.

Parameters
update_funcfunction pointer
void ASI_SetUpdateNitFunction ( F_NitTableUpdate  update_func)

Sets a function that will be called when an NIT table is received.

Parameters
update_funcfunction pointer
void ASI_SetUpdatePmtFunction ( F_PmtTableUpdate  update_func)

Sets a function that will be called when a PMT table is received.

Parameters
update_funcfunction pointer
void ASI_SetUpdateSdtFunction ( F_SdtTableUpdate  update_func)

Sets a function that will be called when an SDT table is received.

Parameters
update_funcfunction pointer
BOOLEAN ASI_SSUGetMandatory ( void  )

Returns the flag indicating whether the SSU is mandatory and so can't be refused.

Returns
TRUE if the SSU is mandatory, FALSE otherwise
BOOLEAN ASI_SSURefused ( void  )

Returns the flag indicating whether the SSU was refused.

Returns
TRUE if the SSU was refused, FALSE otherwise
void ASI_SSUSetMandatory ( BOOLEAN  mandatory)

Sets the flag indicating whether the SSU can be refused by the user.

Parameters
mandatoryTRUE if the SSU can't be refused by the user, FALSE otherwise