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