source: trunk/module-dvbapi.h@ 4149

Last change on this file since 4149 was 4141, checked in by dingo35, 13 years ago

all: simplify debug system, add D_DVBAPI = -d128, eliminate cs_ptyp which complicates stuff unnecc

File size: 4.5 KB
Line 
1#ifdef HAVE_DVBAPI
2
3#ifndef MODULEDVBAPI_H_
4#define MODULEDVBAPI_H_
5
6
7#include <sys/un.h>
8#include <dirent.h>
9
10#define TYPE_ECM 1
11#define TYPE_EMM 2
12
13//api
14#define DVBAPI_3 0
15#define DVBAPI_1 1
16#define STAPI 2
17#define COOLAPI 3
18
19
20#define T_UNIQUE 1
21#define T_SHARED 2
22#define T_GLOBAL 4
23
24#define TMPDIR "/tmp/"
25#define STANDBY_FILE "/tmp/.pauseoscam"
26#define ECMINFO_FILE "/tmp/ecm.info"
27
28#ifdef COOL
29#define MAX_DEMUX 3
30#else
31#define MAX_DEMUX 5
32#endif
33#define MAX_CAID 50
34#define ECM_PIDS 20
35#define MAX_FILTER 10
36
37#ifndef FALSE
38#define FALSE 0
39#endif
40
41#define BOX_COUNT 5
42
43struct box_devices
44{
45 char *path;
46 char *ca_device;
47 char *demux_device;
48 char *cam_socket_path;
49};
50
51struct s_ecmpids
52{
53 unsigned short CAID;
54 unsigned long PROVID;
55 unsigned short ECM_PID;
56 unsigned short EMM_PID;
57 int irdeto_numchids;
58 int irdeto_curchid;
59 int irdeto_chid;
60 int checked;
61 int status;
62 unsigned char table;
63 int index;
64 unsigned char slen;
65 char stream[8];
66};
67
68typedef struct filter_s
69{
70 uint fd; //FilterHandle
71 int pidindex;
72 int pid;
73 ushort type;
74 int count;
75} FILTERTYPE;
76
77struct s_emmpids
78{
79 ushort CAID;
80 ulong PROVID;
81 ushort PID;
82 uint8 type;
83};
84
85typedef struct demux_s
86{
87 int demux_index;
88 FILTERTYPE demux_fd[MAX_FILTER];
89 int ca_mask;
90 int adapter_index;
91 int socket_fd;
92 int ECMpidcount;
93 struct s_ecmpids ECMpids[ECM_PIDS];
94 int EMMpidcount;
95 struct s_emmpids EMMpids[ECM_PIDS];
96 int STREAMpidcount;
97 unsigned short STREAMpids[ECM_PIDS];
98 int pidindex;
99 int curindex;
100 int tries;
101 int max_status;
102 unsigned short program_number;
103 unsigned char lastcw[2][8];
104 int emm_filter;
105 uchar hexserial[8];
106 struct s_reader *rdr;
107 char pmt_file[30];
108 int pmt_time;
109} DEMUXTYPE;
110
111struct s_dvbapi_priority
112{
113 char type; // p or i
114 ushort caid;
115 ulong provid;
116 ushort srvid;
117 ushort chid;
118 ushort ecmpid;
119 ushort mapcaid;
120 ulong mapprovid;
121 int delay;
122 int force;
123#ifdef WITH_STAPI
124 char devname[30];
125 char pmtfile[30];
126 int disablefilter;
127#endif
128 struct s_dvbapi_priority *next;
129};
130
131
132#define DMX_FILTER_SIZE 16
133
134
135//dvbapi 1
136typedef struct dmxFilter
137{
138 uint8_t filter[DMX_FILTER_SIZE];
139 uint8_t mask[DMX_FILTER_SIZE];
140} dmxFilter_t;
141
142struct dmxSctFilterParams
143{
144 uint16_t pid;
145 dmxFilter_t filter;
146 uint32_t timeout;
147 uint32_t flags;
148#define DMX_CHECK_CRC 1
149#define DMX_ONESHOT 2
150#define DMX_IMMEDIATE_START 4
151#define DMX_BUCKET 0x1000 /* added in 2005.05.18 */
152#define DMX_KERNEL_CLIENT 0x8000
153};
154
155#define DMX_START1 _IOW('o',41,int)
156#define DMX_STOP1 _IOW('o',42,int)
157#define DMX_SET_FILTER1 _IOW('o',43,struct dmxSctFilterParams *)
158//------------------------------------------------------------------
159
160
161//dbox2+ufs
162typedef struct dmx_filter
163{
164 uint8_t filter[DMX_FILTER_SIZE];
165 uint8_t mask[DMX_FILTER_SIZE];
166 uint8_t mode[DMX_FILTER_SIZE];
167} dmx_filter_t;
168
169
170struct dmx_sct_filter_params
171{
172 uint16_t pid;
173 dmx_filter_t filter;
174 uint32_t timeout;
175 uint32_t flags;
176#define DMX_CHECK_CRC 1
177#define DMX_ONESHOT 2
178#define DMX_IMMEDIATE_START 4
179#define DMX_KERNEL_CLIENT 0x8000
180};
181
182typedef struct ca_descr {
183 unsigned int index;
184 unsigned int parity; /* 0 == even, 1 == odd */
185 unsigned char cw[8];
186} ca_descr_t;
187
188typedef struct ca_pid {
189 unsigned int pid;
190 int index; /* -1 == disable*/
191} ca_pid_t;
192
193#define DMX_START _IO('o', 41)
194#define DMX_STOP _IO('o', 42)
195#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
196
197#define CA_SET_DESCR _IOW('o', 134, ca_descr_t)
198#define CA_SET_PID _IOW('o', 135, ca_pid_t)
199// --------------------------------------------------------------------
200
201#ifdef WITH_STAPI
202int stapi_open();
203int stapi_set_filter(int demux_id, ushort pid, uchar *filter, uchar *mask, int num, char *pmtfile);
204int stapi_remove_filter(int demux_id, int num, char *pmtfile);
205int stapi_set_pid(int demux_id, int num, int index, ushort pid, char *pmtfile);
206int stapi_write_cw(int demux_id, uchar *cw, ushort *, int, char *pmtfile);
207#endif
208
209void dvbapi_stop_descrambling(int);
210void dvbapi_process_input(int demux_id, int filter_num, uchar *buffer, int len);
211int dvbapi_open_device(int, int, int);
212int dvbapi_stop_filternum(int demux_index, int num);
213int dvbapi_stop_filter(int demux_index, int type);
214struct s_dvbapi_priority *dvbapi_check_prio_match(int demux_id, int pidindex, char type);
215
216#ifdef WITH_STAPI
217 #define cs_log(x...) cs_log("stapi: "x)
218 #ifdef WITH_DEBUG
219 #define cs_debug_mask(x,y...) cs_debug_mask(x,"stapi: "y)
220 #endif
221#else
222 #define cs_log(x...) cs_log("dvbapi: "x)
223 #ifdef WITH_DEBUG
224 #define cs_debug_mask(x,y...) cs_debug_mask(x,"dvbapi: "y)
225 #endif
226#endif
227
228#endif // MODULEDVBAPI_H_
229#endif // WITH_DVBAPI
Note: See TracBrowser for help on using the repository browser.