DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
ca_glue.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2013 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 /* pre-processor mechanism so multiple inclusions don't cause compilation error*/
26 #ifndef __CA_GLUE_H
27 #define __CA_GLUE_H
28 
29 #include "techtype.h"
30 
31 /*---Constant and macro definitions for public use-----------------------------*/
32 
33 /*---Enumerations for public use-----------------------------------------------*/
34 typedef enum
35 {
36  CA_DECODE_STATUS_STARTING,
37  CA_DECODE_STATUS_STARTED,
38  CA_DECODE_STATUS_STOPPED
39 } E_CA_DECODE_STATUS;
40 
41 /*---Global type defs for public use-------------------------------------------*/
42 
43 /*---Global Function prototypes for public use---------------------------------*/
44 
45 /*!**************************************************************************
46  * @brief Called once on system startup to allow initialisation of the CA systems
47  * @return TRUE if initialisation is successful, FALSE otherwise
48  ****************************************************************************/
49 BOOLEAN STB_CAInitialise(void);
50 
51 /*!**************************************************************************
52  * @brief This function is used by the resource manager to acquire a CA descrambler
53  * that's able to descramble a service that uses one of the CA systems
54  * defined by the array of CA system IDs (ca_ids). If a descrambler is
55  * available then a handle should be returned in 'handle' which will be
56  * used in all future calls related to this descrambler.
57  * If the CA software needs to set the demux descrambling keys, or create
58  * any filters to monitor SI data, the given demux handle should be used.
59  * @param demux - demux to be used if a descrambler is acquired
60  * @param serv_id - ID of the service the descrambler is being acquired for
61  * @param ca_ids - array of CA system IDs for the service
62  * @param num_ca_ids - number of CA system IDs in the array
63  * @param handle - pointer to return a handle to identify the acquired CA descrambler
64  * @return TRUE if a descrambler is acquired, FALSE otherwise
65  ****************************************************************************/
66 BOOLEAN STB_CAAcquireDescrambler(U8BIT demux, U16BIT serv_id, U16BIT *ca_ids, U16BIT num_ca_ids,
67  U32BIT *handle);
68 
69 /*!**************************************************************************
70  * @brief Will be called when a CA descrambler is no longer required.
71  * @param handle - CA descrambler handle being released
72  * @return TRUE if the descrambler is released, FALSE otherwise
73  ****************************************************************************/
74 BOOLEAN STB_CAReleaseDescrambler(U32BIT handle);
75 
76 /*!**************************************************************************
77  * @brief This function will be called when decoding of a service is about to start
78  * and there's an associated descrambler.
79  * @param handle - CA descrambler handle
80  ****************************************************************************/
81 void STB_CADescrambleServiceStart(U32BIT handle);
82 
83 /*!**************************************************************************
84  * @brief This function will be called when decoding of a service is stopped
85  * @param handle - CA descrambler handle
86  ****************************************************************************/
87 void STB_CADescrambleServiceStop(U32BIT handle);
88 
89 /*!**************************************************************************
90  * @brief When there's an update to the PMT for a service, the updated PMT
91  * will be reported to the CA system using this function.
92  * @param handle - CA descrambler handle
93  * @param pmt_data - raw PMT section data
94  * @param data_len - number of bytes in the PMT
95  ****************************************************************************/
96 void STB_CAReportPMT(U32BIT handle, U8BIT *pmt_data, U16BIT data_len);
97 
98 /*!**************************************************************************
99  * @brief When there's an update to the CAT for a service, the updated CAT
100  * will be reported to the CA system using this function. The data is
101  * provided a section at a time, rather than as a complete table.
102  * @param handle - CA descrambler handle
103  * @param cat_data - raw CAT section data
104  * @param data_len - number of bytes in the CAT section
105  ****************************************************************************/
106 void STB_CAReportCAT(U32BIT handle, U8BIT *cat_data, U16BIT data_len);
107 
108 /*!**************************************************************************
109  * @brief When there's an update to the BAT, the updated BAT will be reported
110  * to the CA system using this function. The data is provided a section
111  * at a time, rather than as a complete table.
112  * @param handle - CA descrambler handle
113  * @param bat_data - raw BAT section data
114  * @param data_len - number of bytes in the BAT section
115  ****************************************************************************/
116 void STB_CAReportBAT(U32BIT handle, U8BIT *bat_data, U16BIT data_len);
117 
118 /*!**************************************************************************
119  * @brief When there's an update to the NIT, the updated NIT will be reported
120  * to the CA system using this function. The data is provided a section
121  * at a time, rather than as a complete table.
122  * @param handle - CA descrambler handle
123  * @param nit_data - raw NIT section data
124  * @param data_len - number of bytes in the NIT section
125  ****************************************************************************/
126 void STB_CAReportNIT(U32BIT handle, U8BIT *nit_data, U16BIT data_len);
127 
128 /*!**************************************************************************
129  * @brief Notifies the CA system of a change in the video decoding state
130  * @param handle - CA descrambler handle
131  * @param decode_status - decoding status
132  ****************************************************************************/
133 void STB_CADecodeVideoStatus(U32BIT handle, E_CA_DECODE_STATUS decode_status);
134 
135 /*!**************************************************************************
136  * @brief Notifies the CA system of a change in the audio decoding state
137  * @param handle - CA descrambler handle
138  * @param decode_status - decoding status
139  ****************************************************************************/
140 void STB_CADecodeAudioStatus(U32BIT handle, E_CA_DECODE_STATUS decode_status);
141 
142 /*!**************************************************************************
143  * @brief Notifies the CA system of a change in the AD decoding state
144  * @param handle - CA descrambler handle
145  * @param decode_status - decoding status
146  ****************************************************************************/
147 void STB_CADecodeADStatus(U32BIT handle, E_CA_DECODE_STATUS decode_status);
148 
149 /*!**************************************************************************
150  * @brief This function will be called when there's a change to the running status
151  * of a service being descrambled as indicated by the running_status field
152  * in the SDT.
153  * @param handle - CA descrambler handle
154  * @param status - running status as defined in the SDT
155  ****************************************************************************/
156 void STB_CANotifyRunningStatus(U32BIT handle, U8BIT status);
157 
158 /*!**************************************************************************
159  * @brief This function works out whether a CA descrambler is required to playback
160  * a recording with one of the given CA system IDs.
161  * @param ca_ids - array of CA system IDs
162  * @param num_ca_ids - number of CA system IDs in the array
163  * @return TRUE if a CA descrambler is required, FALSE otherwise
164  ****************************************************************************/
165 BOOLEAN STB_CADescramblerRequiredForPlayback(U16BIT *ca_ids, U16BIT num_ca_ids);
166 
167 /*!**************************************************************************
168  * @brief This function works out whether a CA descrambler is required to record
169  * a service with one of the given CA system IDs.
170  * @param ca_ids - array of CA system IDs
171  * @param num_ca_ids - number of CA system IDs in the array
172  * @return TRUE if a CA descrambler is required, FALSE otherwise
173  ****************************************************************************/
174 BOOLEAN STB_CADescramblerRequiredForRecording(U16BIT *ca_ids, U16BIT num_ca_ids);
175 
176 /*!**************************************************************************
177  * @brief This function is called to get an array of PIDs that need to be recorded
178  * for the CA system required for the given PMT. The array must be allocated
179  * by this function, which also returns the number of items in the array.
180  * @param pmt_data - raw PMT section data
181  * @param pid_array - pointer to an array allocated by this function on return,
182  * containing the PIDs to be recorded
183  * @return the number of PIDs in the returned array
184  ****************************************************************************/
185 U16BIT STB_CAGetRecordingPids(U8BIT *pmt_data, U16BIT **pid_array);
186 
187 /*!**************************************************************************
188  * @brief Called to free the array of PIDs allocated by STB_CAGetRecordingPids.
189  * @param pid_array - array of PIDs to be freed
190  * @param num_pids - number of PIDs in the array
191  ****************************************************************************/
192 void STB_CAReleaseRecordingPids(U16BIT *pid_array, U16BIT num_pids);
193 
194 /*!**************************************************************************
195  * @brief This function is called when a recording starts and when it stops
196  * @param handle - CA descrambler handle
197  * @param status - TRUE when a recording starts, FALSE when it stops
198  ****************************************************************************/
199 void STB_CANotifyRecordingStatus(U32BIT handle, BOOLEAN status);
200 
201 #endif /* __CA_GLUE_H */
202 
203 /******************************************************************************
204 ** End of file
205 ******************************************************************************/
BOOLEAN STB_CADescramblerRequiredForPlayback(U16BIT *ca_ids, U16BIT num_ca_ids)
This function works out whether a CA descrambler is required to playback a recording with one of the ...
Definition: ca_glue.c:315
BOOLEAN STB_CAReleaseDescrambler(U32BIT handle)
Will be called when a CA descrambler is no longer required.
Definition: ca_glue.c:111
void STB_CAReportBAT(U32BIT handle, U8BIT *bat_data, U16BIT data_len)
When there's an update to the BAT, the updated BAT will be reported to the CA system using this funct...
Definition: ca_glue.c:204
void STB_CAReportCAT(U32BIT handle, U8BIT *cat_data, U16BIT data_len)
When there's an update to the CAT for a service, the updated CAT will be reported to the CA system us...
Definition: ca_glue.c:183
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...
Definition: ca_glue.c:336
void STB_CAReportNIT(U32BIT handle, U8BIT *nit_data, U16BIT data_len)
When there's an update to the NIT, the updated NIT will be reported to the CA system using this funct...
Definition: ca_glue.c:225
void STB_CADecodeVideoStatus(U32BIT handle, E_CA_DECODE_STATUS decode_status)
Notifies the CA system of a change in the video decoding state.
Definition: ca_glue.c:243
void STB_CANotifyRecordingStatus(U32BIT handle, BOOLEAN status)
This function is called when a recording starts and when it stops.
Definition: ca_glue.c:399
void STB_CADescrambleServiceStop(U32BIT handle)
This function will be called when decoding of a service is stopped.
Definition: ca_glue.c:144
BOOLEAN STB_CAAcquireDescrambler(U8BIT demux, U16BIT serv_id, U16BIT *ca_ids, U16BIT num_ca_ids, U32BIT *handle)
This function is used by the resource manager to acquire a CA descrambler that's able to descramble a...
Definition: ca_glue.c:87
void STB_CADescrambleServiceStart(U32BIT handle)
This function will be called when decoding of a service is about to start and there's an associated d...
Definition: ca_glue.c:129
void STB_CANotifyRunningStatus(U32BIT handle, U8BIT status)
This function will be called when there's a change to the running status of a service being descrambl...
Definition: ca_glue.c:296
void STB_CAReleaseRecordingPids(U16BIT *pid_array, U16BIT num_pids)
Called to free the array of PIDs allocated by STB_CAGetRecordingPids.
Definition: ca_glue.c:382
System Wide Global Technical Data Type Definitions.
void STB_CADecodeAudioStatus(U32BIT handle, E_CA_DECODE_STATUS decode_status)
Notifies the CA system of a change in the audio decoding state.
Definition: ca_glue.c:260
BOOLEAN STB_CAInitialise(void)
Called once on system startup to allow initialisation of the CA systems.
Definition: ca_glue.c:61
void STB_CADecodeADStatus(U32BIT handle, E_CA_DECODE_STATUS decode_status)
Notifies the CA system of a change in the AD decoding state.
Definition: ca_glue.c:277
void STB_CAReportPMT(U32BIT handle, U8BIT *pmt_data, U16BIT data_len)
When there's an update to the PMT for a service, the updated PMT will be reported to the CA system us...
Definition: ca_glue.c:162
U16BIT STB_CAGetRecordingPids(U8BIT *pmt_data, U16BIT **pid_array)
This function is called to get an array of PIDs that need to be recorded for the CA system required f...
Definition: ca_glue.c:359