Database Cache Management

This module is used to allow changes to be recorded by the PID filters running in the TS Filter thread without having the thread halted while the database file is accessed. More...

Functions

int CacheInit ()
void CacheDeInit ()
int CacheLoad (Multiplex_t *multiplex)
 Load the cache with all the service in the specfied multiplex.
void CacheWriteback ()
 Write any changes in the cache, back to the database.
Multiplex_tCacheMultiplexGet (void)
 Retrieve the Multiplex that the cache is currently managing the services of.
Service_tCacheServiceFind (char *name)
 Find a service in the cache by either name or fully qualified id (i.e.
Service_tCacheServiceFindId (int id)
 Find a service in the cache with the specified id.
Service_tCacheServiceFindName (char *name)
 Find a service with a given name in the cache.
Service_t ** CacheServicesGet (int *count)
 Retrieve all the services currently in the cache and locks the cache to prevent updates to the list.
void CacheServicesRelease (void)
 Releases the services retieved by CacheServiesGet and allows updates to the cache.
PIDList_tCachePIDsGet (Service_t *service)
 Retrieve the PIDs for a given service and locks the cache to prevent updates.
void CachePIDsRelease (void)
 Releases the PIDs retrieved by CachePIDsGet and allows updates to the cache.
void CacheUpdateMultiplex (Multiplex_t *multiplex, int patversion, int tsid)
 Update the specified Multiplex's pat version and TS id.
void CacheUpdateNetworkId (Multiplex_t *multiplex, int netid)
 Update the specified Multiplex's network id.
void CacheUpdateServicePMTPID (Service_t *service, int pmtpid)
 Update the cached service with a new PMT PID.
void CacheUpdateServiceName (Service_t *service, char *name)
 Update the cached service with a new name.
void CacheUpdateServiceProvider (Service_t *service, char *provider)
 Update the cached service with a new provider.
void CacheUpdateServiceDefaultAuthority (Service_t *service, char *defaultAuthority)
 Update the cached service with a new default authority, used by TVAnytime.
void CacheUpdateServiceSource (Service_t *service, uint16_t source)
 Update the cached service with a new source id.
void CacheUpdateServiceConditionalAccess (Service_t *service, bool ca)
 Update the cached service with the new CA state of the service.
void CacheUpdateServiceType (Service_t *service, ServiceType type)
 Update the cached service with the new type of the service.
void CacheUpdatePIDs (Service_t *service, int pcrpid, PIDList_t *pids, int pmtversion)
 Update the PIDs for the specified service.
Service_tCacheServiceAdd (int id)
 Add a new Service to the cache.
bool CacheServiceSeen (Service_t *service, bool seen, bool pat)
 Update the 'seen' state of the service.
void CacheServiceDelete (Service_t *service)
 Delete a service from the cache.

Detailed Description

This module is used to allow changes to be recorded by the PID filters running in the TS Filter thread without having the thread halted while the database file is accessed.

Note:
Functions in this module should only be used from within the TS Filter thread, all other threads should access the database through Services and Multiplexes modules

Function Documentation

void CacheDeInit (  ) 

For internal use only.

De-initialise the cache module, release all services and pids.

int CacheInit (  ) 

For internal use only.

Initialise the cache module.

int CacheLoad ( Multiplex_t multiplex  ) 

Load the cache with all the service in the specfied multiplex.

Parameters:
multiplex The multiplex to load all the services for.
Returns:
0 on success or an SQLite error code.

Multiplex_t* CacheMultiplexGet ( void   ) 

Retrieve the Multiplex that the cache is currently managing the services of.

Returns:
A Multiplex_t instance or NULL if the cache has not be loaded.

PIDList_t* CachePIDsGet ( Service_t service  ) 

Retrieve the PIDs for a given service and locks the cache to prevent updates.

CachePIDsRelease() should be called when the list is no longer needed.

Parameters:
service Service to retrieve the PIDs for.
Returns:
A PIDList_t structure.

Service_t* CacheServiceAdd ( int  id  ) 

Add a new Service to the cache.

Parameters:
id The new service/program id.

void CacheServiceDelete ( Service_t service  ) 

Delete a service from the cache.

Parameters:
service The service to be deleted when CacheWriteback() is called.

Service_t* CacheServiceFind ( char *  name  ) 

Find a service in the cache by either name or fully qualified id (i.e.

<network id>.<ts id>.<service id> where ids are in hex).

Parameters:
name Name of the service or fully qualified id
Returns:
A Service_t instance or NULL if not found.

Service_t* CacheServiceFindId ( int  id  ) 

Find a service in the cache with the specified id.

Parameters:
id The service/program id to search for.
Returns:
A Service_t instance or NULL if not found.

Service_t* CacheServiceFindName ( char *  name  ) 

Find a service with a given name in the cache.

Parameters:
name Name of the service to look for.
Returns:
A Service_t instance or NULL if not found in the cache.

bool CacheServiceSeen ( Service_t service,
bool  seen,
bool  pat 
)

Update the 'seen' state of the service.

If a service is seen in the PAT but not in the SDT/VCT or vice versa the service still exists, but if the service is no longer seen in the PAT and SDT/VCT, the service no longer exists and should be deleted.

Parameters:
service The service to update the 'seen' status of.
seen Whether the service has been seen or not.
pat If the services was (not) seen in the PAT, but in the SDT/VCT.
Returns:
True if the service still exists, False otherwise.

Service_t** CacheServicesGet ( int *  count  ) 

Retrieve all the services currently in the cache and locks the cache to prevent updates to the list.

CacheServicesRelease() should be called when the list is no longer needed.

Parameters:
count Used to store the number of services in the cache.
Returns:
An array of pointers to Service_t instances.

void CacheUpdateMultiplex ( Multiplex_t multiplex,
int  patversion,
int  tsid 
)

Update the specified Multiplex's pat version and TS id.

Parameters:
multiplex The multiplex to update.
patversion The new pat version.
tsid The new TS ID.

void CacheUpdateNetworkId ( Multiplex_t multiplex,
int  netid 
)

Update the specified Multiplex's network id.

Parameters:
multiplex The multiplex to update.
netid The network id to set.

void CacheUpdatePIDs ( Service_t service,
int  pcrpid,
PIDList_t pids,
int  pmtversion 
)

Update the PIDs for the specified service.

Parameters:
service The service to update.
pcrpid The PID the PCR is being sent on.
pids A PIDList_t structure of new PIDs.
pmtversion The new PMT version.

void CacheUpdateServiceConditionalAccess ( Service_t service,
bool  ca 
)

Update the cached service with the new CA state of the service.

Parameters:
service The service to update.
ca The new CA state.

void CacheUpdateServiceDefaultAuthority ( Service_t service,
char *  defaultAuthority 
)

Update the cached service with a new default authority, used by TVAnytime.

Parameters:
service The service to update.
defaultAuthority The new default authority.

void CacheUpdateServiceName ( Service_t service,
char *  name 
)

Update the cached service with a new name.

Parameters:
service The service to update.
name The new name.

void CacheUpdateServicePMTPID ( Service_t service,
int  pmtpid 
)

Update the cached service with a new PMT PID.

Parameters:
service The service to update.
pmtpid The new PMT PID.

void CacheUpdateServiceProvider ( Service_t service,
char *  provider 
)

Update the cached service with a new provider.

Parameters:
service The service to update.
provider The new provider name.

void CacheUpdateServiceSource ( Service_t service,
uint16_t  source 
)

Update the cached service with a new source id.

Parameters:
service The service to update.
source The new source id.

void CacheUpdateServiceType ( Service_t service,
ServiceType  type 
)

Update the cached service with the new type of the service.

Parameters:
service The service to update.
type The new type of the service.


Generated on Thu Jun 26 12:58:31 2008 for DVBStreamer by  doxygen 1.5.5