1 | #ifndef DMXDEV_H |
---|
2 | #define DMXDEV_H |
---|
3 | |
---|
4 | #if DVB_API_VERSION > 3 |
---|
5 | #ifndef DMX_ADD_PID |
---|
6 | #define DMX_ADD_PID _IOW('o', 51, __u16) |
---|
7 | #define DMX_REMOVE_PID _IOW('o', 52, __u16) |
---|
8 | #endif |
---|
9 | #else |
---|
10 | #define DMX_ADD_PID _IO('o', 51) |
---|
11 | #define DMX_REMOVE_PID _IO('o', 52) |
---|
12 | #endif |
---|
13 | |
---|
14 | struct dvbdev* dmxgetlast(int adapter) |
---|
15 | { |
---|
16 | struct dvbdev* node = dvbdev; |
---|
17 | struct dvbdev* lastnode = NULL; |
---|
18 | |
---|
19 | while(node != NULL) |
---|
20 | { |
---|
21 | if(node->type == DEMUXDEV && node->adapter == adapter) |
---|
22 | lastnode = node; |
---|
23 | node = node->next; |
---|
24 | } |
---|
25 | |
---|
26 | return lastnode; |
---|
27 | } |
---|
28 | |
---|
29 | //flag: 0=alt, 1=ohne NONBLOCK r, 2=ohne NONBLOCK rw |
---|
30 | struct dvbdev* dmxopen(struct dvbdev* fenode, int flag) |
---|
31 | { |
---|
32 | int fd = -1; |
---|
33 | |
---|
34 | if(fenode == NULL) return NULL; |
---|
35 | |
---|
36 | m_lock(&status.dmxdevmutex, 9); |
---|
37 | struct dvbdev* node = dvbdev; |
---|
38 | |
---|
39 | while(node != NULL) |
---|
40 | { |
---|
41 | if(node->fd == -1 && node->type == DEMUXDEV && node->adapter == fenode->adapter && node->devnr == fenode->devnr) |
---|
42 | break; |
---|
43 | node = node->next; |
---|
44 | } |
---|
45 | |
---|
46 | if(node != NULL) |
---|
47 | { |
---|
48 | if(flag == 0) |
---|
49 | fd = open(node->dev, O_RDWR); |
---|
50 | if(flag == 1) |
---|
51 | fd = open(node->dev, O_RDONLY | O_CLOEXEC); |
---|
52 | if(flag == 2) |
---|
53 | fd = open(node->dev, O_RDWR | O_CLOEXEC); |
---|
54 | if(fd < 0) |
---|
55 | { |
---|
56 | debug(200, "open dmx failed %s", node->dev); |
---|
57 | node = NULL; |
---|
58 | } |
---|
59 | else |
---|
60 | { |
---|
61 | node->fd = fd; |
---|
62 | if(flag == 0) |
---|
63 | { |
---|
64 | fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); |
---|
65 | closeonexec(fd); |
---|
66 | } |
---|
67 | } |
---|
68 | } |
---|
69 | |
---|
70 | m_unlock(&status.dmxdevmutex, 9); |
---|
71 | return node; |
---|
72 | } |
---|
73 | |
---|
74 | int dmxopendirect(char *dmxdev) |
---|
75 | { |
---|
76 | int fd = -1; |
---|
77 | |
---|
78 | if((fd = open(dmxdev, O_RDWR)) < 0) |
---|
79 | { |
---|
80 | debug(200, "open dmx failed %s", dmxdev); |
---|
81 | } |
---|
82 | else |
---|
83 | fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); |
---|
84 | |
---|
85 | closeonexec(fd); |
---|
86 | return fd; |
---|
87 | } |
---|
88 | |
---|
89 | void dmxclose(struct dvbdev* node, int fd) |
---|
90 | { |
---|
91 | if(node != NULL) |
---|
92 | { |
---|
93 | close(node->fd); |
---|
94 | node->fd = -1; |
---|
95 | } |
---|
96 | else |
---|
97 | close(fd); |
---|
98 | } |
---|
99 | |
---|
100 | int dmxstop(struct dvbdev* node) |
---|
101 | { |
---|
102 | if(node == NULL) |
---|
103 | { |
---|
104 | debug(200, "NULL detect"); |
---|
105 | return 1; |
---|
106 | } |
---|
107 | |
---|
108 | if(ioctl(node->fd, DMX_STOP) < 0) |
---|
109 | { |
---|
110 | perr("DMX_STOP"); |
---|
111 | return 1; |
---|
112 | } |
---|
113 | |
---|
114 | return 0; |
---|
115 | } |
---|
116 | |
---|
117 | int dmxstart(struct dvbdev* node) |
---|
118 | { |
---|
119 | if(node == NULL) |
---|
120 | { |
---|
121 | err("NULL detect"); |
---|
122 | return 1; |
---|
123 | } |
---|
124 | |
---|
125 | if(ioctl(node->fd, DMX_START) < 0) |
---|
126 | { |
---|
127 | perr("DMX_START"); |
---|
128 | return 1; |
---|
129 | } |
---|
130 | |
---|
131 | return 0; |
---|
132 | } |
---|
133 | |
---|
134 | int dmxsetbuffersize(struct dvbdev* node, unsigned long size) |
---|
135 | { |
---|
136 | if(node == NULL) |
---|
137 | { |
---|
138 | err("NULL detect"); |
---|
139 | return 1; |
---|
140 | } |
---|
141 | |
---|
142 | if(size == 0) |
---|
143 | size = getconfigint("dmxvideobuffersize", NULL); |
---|
144 | |
---|
145 | debug(200, "DMX_SET_BUFFER_SIZE=%ld", size); |
---|
146 | if(ioctl(node->fd, DMX_SET_BUFFER_SIZE, size) < 0) |
---|
147 | { |
---|
148 | perr("DMX_SET_BUFFER_SIZE"); |
---|
149 | return 1; |
---|
150 | } |
---|
151 | |
---|
152 | return 0; |
---|
153 | } |
---|
154 | |
---|
155 | int dmxsetfilter(struct dvbdev* node, int pid, int secnr, int flag) |
---|
156 | { |
---|
157 | struct dmx_sct_filter_params sctflt; |
---|
158 | |
---|
159 | if(node == NULL) |
---|
160 | { |
---|
161 | err("NULL detect"); |
---|
162 | return 1; |
---|
163 | } |
---|
164 | |
---|
165 | memset(&sctflt, 0, sizeof(sctflt)); |
---|
166 | |
---|
167 | if(flag == 1) //pat filter |
---|
168 | { |
---|
169 | sctflt.timeout = 0; |
---|
170 | sctflt.pid = pid; |
---|
171 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
172 | } |
---|
173 | if(flag == 2) //pmt filter |
---|
174 | { |
---|
175 | sctflt.filter.filter[0] = 0x02; |
---|
176 | sctflt.filter.mask[0] = 0xff; |
---|
177 | sctflt.timeout = 0; |
---|
178 | sctflt.pid = pid; |
---|
179 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
180 | } |
---|
181 | if(flag == 3) //date filter |
---|
182 | { |
---|
183 | sctflt.filter.filter[0] = 0x70; |
---|
184 | sctflt.filter.mask[0] = 0xff; |
---|
185 | sctflt.timeout = 0; |
---|
186 | sctflt.pid = pid; |
---|
187 | // DMX_CHECK_CRC not working on mipsel |
---|
188 | sctflt.flags = DMX_IMMEDIATE_START;// | DMX_CHECK_CRC; |
---|
189 | } |
---|
190 | if(flag == 4) //nit filter (pid 0x10) |
---|
191 | { |
---|
192 | sctflt.filter.filter[0] = 0x40; |
---|
193 | sctflt.filter.mask[0] = 0xff; |
---|
194 | sctflt.filter.filter[1] = 0x00; |
---|
195 | sctflt.filter.mask[1] = 0x00; |
---|
196 | sctflt.filter.filter[2] = 0x00; |
---|
197 | sctflt.filter.mask[2] = 0x00; |
---|
198 | sctflt.filter.filter[3] = 0x00; |
---|
199 | sctflt.filter.mask[3] = 0x00; |
---|
200 | sctflt.filter.filter[4] = secnr; |
---|
201 | sctflt.filter.mask[4] = 0xff; |
---|
202 | sctflt.timeout = 0; |
---|
203 | sctflt.pid = pid; |
---|
204 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
205 | } |
---|
206 | if(flag == 5) //eit all filter (pid 0x12) |
---|
207 | { |
---|
208 | sctflt.filter.filter[0] = 0x40; |
---|
209 | sctflt.filter.mask[0] = 0x40; |
---|
210 | sctflt.timeout = 0; |
---|
211 | sctflt.pid = pid; |
---|
212 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
213 | } |
---|
214 | if(flag == 6) //eit schedule, current multiplex (pid 0x12) |
---|
215 | { |
---|
216 | sctflt.filter.filter[0] = 0x50; |
---|
217 | sctflt.filter.mask[0] = 0xf0; |
---|
218 | sctflt.timeout = 0; |
---|
219 | sctflt.pid = pid; |
---|
220 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
221 | } |
---|
222 | if(flag == 7) //eit schedule, other multiplex (pid 0x12) |
---|
223 | { |
---|
224 | sctflt.filter.filter[0] = 0x60; |
---|
225 | sctflt.filter.mask[0] = 0xf0; |
---|
226 | sctflt.timeout = 0; |
---|
227 | sctflt.pid = pid; |
---|
228 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
229 | } |
---|
230 | if(flag == 8) //eit now/next only filter (pid 0x12) |
---|
231 | { |
---|
232 | sctflt.filter.filter[0] = 0x4e; |
---|
233 | sctflt.filter.mask[0] = 0xfe; |
---|
234 | sctflt.timeout = 0; |
---|
235 | sctflt.pid = pid; |
---|
236 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
237 | } |
---|
238 | if(flag == 9) //eit now/next current multiplex (pid 0x12) |
---|
239 | { |
---|
240 | sctflt.filter.filter[0] = 0x4e; |
---|
241 | sctflt.filter.mask[0] = 0xff; |
---|
242 | sctflt.timeout = 0; |
---|
243 | sctflt.pid = pid; |
---|
244 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
245 | } |
---|
246 | if(flag == 10) //eit now/next other multiplex (pid 0x12) |
---|
247 | { |
---|
248 | sctflt.filter.filter[0] = 0x4f; |
---|
249 | sctflt.filter.mask[0] = 0xff; |
---|
250 | sctflt.timeout = 0; |
---|
251 | sctflt.pid = pid; |
---|
252 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
253 | } |
---|
254 | if(flag == 11) //sdt akt (pid 0x11) |
---|
255 | { |
---|
256 | sctflt.filter.filter[0] = 0x42; |
---|
257 | sctflt.filter.mask[0] = 0xff; |
---|
258 | sctflt.filter.filter[1] = 0x00; |
---|
259 | sctflt.filter.mask[1] = 0x00; |
---|
260 | sctflt.filter.filter[2] = 0x00; |
---|
261 | sctflt.filter.mask[2] = 0x00; |
---|
262 | sctflt.filter.filter[3] = 0x00; |
---|
263 | sctflt.filter.mask[3] = 0x00; |
---|
264 | sctflt.filter.filter[4] = secnr; |
---|
265 | sctflt.filter.mask[4] = 0xff; |
---|
266 | sctflt.timeout = 0; |
---|
267 | sctflt.pid = pid; |
---|
268 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
269 | } |
---|
270 | if(flag == 12) //sdt other (pid 0x11) |
---|
271 | { |
---|
272 | sctflt.filter.filter[0] = 0x46; |
---|
273 | sctflt.filter.mask[0] = 0xff; |
---|
274 | sctflt.filter.filter[1] = 0x00; |
---|
275 | sctflt.filter.mask[1] = 0x00; |
---|
276 | sctflt.filter.filter[2] = 0x00; |
---|
277 | sctflt.filter.mask[2] = 0x00; |
---|
278 | sctflt.filter.filter[3] = 0x00; |
---|
279 | sctflt.filter.mask[3] = 0x00; |
---|
280 | sctflt.filter.filter[4] = secnr; |
---|
281 | sctflt.filter.mask[4] = 0xff; |
---|
282 | sctflt.timeout = 0; |
---|
283 | sctflt.pid = pid; |
---|
284 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
285 | } |
---|
286 | if(flag == 13) //rst filter (pid 0x13) |
---|
287 | { |
---|
288 | sctflt.filter.filter[0] = 0x13; |
---|
289 | sctflt.filter.mask[0] = 0xff; |
---|
290 | sctflt.timeout = 0; |
---|
291 | sctflt.pid = pid; |
---|
292 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
293 | } |
---|
294 | if(flag == 14) //ait filter |
---|
295 | { |
---|
296 | sctflt.filter.filter[0] = 0x74; |
---|
297 | sctflt.filter.mask[0] = 0xff; |
---|
298 | sctflt.timeout = 0; |
---|
299 | sctflt.pid = pid; |
---|
300 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
301 | } |
---|
302 | if(flag == 15) //mhw title |
---|
303 | { |
---|
304 | sctflt.filter.filter[0] = 0x90; |
---|
305 | sctflt.filter.mask[0] = 0xff; |
---|
306 | sctflt.timeout = 0; |
---|
307 | sctflt.pid = pid; |
---|
308 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
309 | } |
---|
310 | if(flag == 16) //mhw channel |
---|
311 | { |
---|
312 | sctflt.filter.filter[0] = 0x91; |
---|
313 | sctflt.filter.mask[0] = 0xff; |
---|
314 | sctflt.timeout = 0; |
---|
315 | sctflt.pid = pid; |
---|
316 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
317 | } |
---|
318 | if(flag == 17) //mhw summary |
---|
319 | { |
---|
320 | sctflt.filter.filter[0] = 0x90; |
---|
321 | sctflt.filter.mask[0] = 0xff; |
---|
322 | sctflt.timeout = 0; |
---|
323 | sctflt.pid = pid; |
---|
324 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
325 | } |
---|
326 | if(flag == 18) //mhw2 title |
---|
327 | { |
---|
328 | sctflt.filter.filter[0] = 0xe6; |
---|
329 | sctflt.filter.mask[0] = 0xff; |
---|
330 | sctflt.timeout = 0; |
---|
331 | sctflt.pid = pid; |
---|
332 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
333 | } |
---|
334 | if(flag == 19) //mhw2 channel |
---|
335 | { |
---|
336 | sctflt.filter.filter[0] = 0xc8; |
---|
337 | sctflt.filter.mask[0] = 0xff; |
---|
338 | sctflt.timeout = 0; |
---|
339 | sctflt.pid = pid; |
---|
340 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
341 | } |
---|
342 | if(flag == 20) //mhw2 summary |
---|
343 | { |
---|
344 | sctflt.filter.filter[0] = 0x96; |
---|
345 | sctflt.filter.mask[0] = 0xff; |
---|
346 | sctflt.timeout = 0; |
---|
347 | sctflt.pid = pid; |
---|
348 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
349 | } |
---|
350 | if(flag == 21) //opentv channel |
---|
351 | { |
---|
352 | sctflt.filter.filter[0] = 0x4a; |
---|
353 | sctflt.filter.mask[0] = 0xff; |
---|
354 | sctflt.timeout = 0; |
---|
355 | sctflt.pid = pid; |
---|
356 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
357 | } |
---|
358 | if(flag == 22) //opentv title |
---|
359 | { |
---|
360 | sctflt.filter.filter[0] = 0xa0; |
---|
361 | sctflt.filter.mask[0] = 0xfc; |
---|
362 | sctflt.timeout = 0; |
---|
363 | sctflt.pid = pid; |
---|
364 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
365 | } |
---|
366 | if(flag == 23) //opentv summary |
---|
367 | { |
---|
368 | sctflt.filter.filter[0] = 0xa8; |
---|
369 | sctflt.filter.mask[0] = 0xfc; |
---|
370 | sctflt.timeout = 0; |
---|
371 | sctflt.pid = pid; |
---|
372 | sctflt.flags = DMX_IMMEDIATE_START | DMX_CHECK_CRC; |
---|
373 | } |
---|
374 | |
---|
375 | debug(200, "DMX_SET_FILTER pid=%d, flag=%d", pid, flag); |
---|
376 | if(ioctl(node->fd, DMX_SET_FILTER, &sctflt) < 0) |
---|
377 | { |
---|
378 | perr("DMX_SET_FILTER"); |
---|
379 | return 1; |
---|
380 | } |
---|
381 | |
---|
382 | return 0; |
---|
383 | } |
---|
384 | |
---|
385 | int dmxaddpid(struct dvbdev* node, int pid) |
---|
386 | { |
---|
387 | if(node == NULL) |
---|
388 | { |
---|
389 | err("NULL detect"); |
---|
390 | return 1; |
---|
391 | } |
---|
392 | |
---|
393 | debug(200, "DMX_ADD_PID=%d", pid); |
---|
394 | while(1) |
---|
395 | { |
---|
396 | #if DVB_API_VERSION > 3 |
---|
397 | __u16 p = pid; |
---|
398 | if(ioctl(node->fd, DMX_ADD_PID, &p) < 0) |
---|
399 | #else |
---|
400 | if(ioctl(node->fd, DMX_ADD_PID, pid) < 0) |
---|
401 | #endif |
---|
402 | { |
---|
403 | perr("DMX_ADD_PID"); |
---|
404 | if(errno == EAGAIN || errno == EINTR) |
---|
405 | continue; |
---|
406 | return 1; |
---|
407 | } |
---|
408 | break; |
---|
409 | } |
---|
410 | |
---|
411 | return 0; |
---|
412 | } |
---|
413 | |
---|
414 | int dmxremovepid(struct dvbdev* node, int pid) |
---|
415 | { |
---|
416 | if(node == NULL) |
---|
417 | { |
---|
418 | err("NULL detect"); |
---|
419 | return 1; |
---|
420 | } |
---|
421 | |
---|
422 | debug(200, "DMX_REMOVE_PID=%d", pid); |
---|
423 | while(1) |
---|
424 | { |
---|
425 | #if DVB_API_VERSION > 3 |
---|
426 | __u16 p = pid; |
---|
427 | if(ioctl(node->fd, DMX_REMOVE_PID, &p) < 0) |
---|
428 | #else |
---|
429 | if(ioctl(node->fd, DMX_REMOVE_PID, pid) < 0) |
---|
430 | #endif |
---|
431 | { |
---|
432 | perr("DMX_REMOVE_PID"); |
---|
433 | if(errno == EAGAIN || errno == EINTR) |
---|
434 | continue; |
---|
435 | return 1; |
---|
436 | } |
---|
437 | break; |
---|
438 | } |
---|
439 | |
---|
440 | return 0; |
---|
441 | } |
---|
442 | |
---|
443 | int dmxgetstc(struct dvbdev* node, int64_t* stc) |
---|
444 | { |
---|
445 | struct dmx_stc dmxstc; |
---|
446 | |
---|
447 | if(node == NULL) |
---|
448 | { |
---|
449 | err("NULL detect"); |
---|
450 | return 1; |
---|
451 | } |
---|
452 | |
---|
453 | memset(&dmxstc, 0, sizeof(struct dmx_stc)); |
---|
454 | dmxstc.num = 0; |
---|
455 | dmxstc.base = 1; |
---|
456 | |
---|
457 | debug(200, "DMX_GET_STC"); |
---|
458 | if(ioctl(node->fd, DMX_GET_STC, &dmxstc) < 0) |
---|
459 | { |
---|
460 | perr("DMX_GET_STC"); |
---|
461 | return 1; |
---|
462 | } |
---|
463 | else |
---|
464 | *stc = (int64_t)dmxstc.stc; |
---|
465 | |
---|
466 | return 0; |
---|
467 | } |
---|
468 | |
---|
469 | int dmxsetsource(struct dvbdev* node, int source) |
---|
470 | { |
---|
471 | if(node == NULL) |
---|
472 | { |
---|
473 | err("NULL detect"); |
---|
474 | return 1; |
---|
475 | } |
---|
476 | if(checkrealbox("HD51") == 1 || checkbox("DM920") == 1) //source darf bei dieser Box nur einmal gesetzt werden, l\F6scht ansonsten die Filter. |
---|
477 | { |
---|
478 | if(node->fedmxsource == source) |
---|
479 | return 0; |
---|
480 | } |
---|
481 | |
---|
482 | #ifdef MIPSEL |
---|
483 | //Workaround da ansonsten DVR4 nicht funktioniert (Treiberproblem) |
---|
484 | |
---|
485 | if(source > DMX_SOURCE_DVR0 && status.setdvr0 == 0) |
---|
486 | { |
---|
487 | int sourcehelp = DMX_SOURCE_DVR0; |
---|
488 | ioctl(node->fd, DMX_SET_SOURCE, &sourcehelp); |
---|
489 | status.setdvr0 = 1; |
---|
490 | } |
---|
491 | #endif |
---|
492 | //mipsel feinfo work |
---|
493 | //#ifdef SH4 |
---|
494 | debug(200, "DMX_SET_SOURCE=%d", source); |
---|
495 | if(ioctl(node->fd, DMX_SET_SOURCE, &source) < 0) |
---|
496 | { |
---|
497 | perr("DMX_SET_SOURCE"); |
---|
498 | } |
---|
499 | else |
---|
500 | { |
---|
501 | if(checkrealbox("HD51") == 1 || checkbox("DM920") == 1) |
---|
502 | { |
---|
503 | struct dvbdev* nodeh = dvbdev; |
---|
504 | while(nodeh != NULL) |
---|
505 | { |
---|
506 | if(nodeh->type == DEMUXDEV && nodeh->adapter == node->adapter && nodeh->devnr == node->devnr) |
---|
507 | nodeh->fedmxsource = source; |
---|
508 | nodeh = nodeh->next; |
---|
509 | } |
---|
510 | } |
---|
511 | } |
---|
512 | //#endif |
---|
513 | return 0; |
---|
514 | } |
---|
515 | |
---|
516 | int dmxsetpesfilterfd(int fd, int pid, int input, int output, int pestype, int nostart) |
---|
517 | { |
---|
518 | struct dmx_pes_filter_params pesflt; |
---|
519 | memset(&pesflt, 0, sizeof(pesflt)); |
---|
520 | |
---|
521 | if(input == -1) |
---|
522 | { |
---|
523 | if(status.playing == 1) |
---|
524 | pesflt.input = DMX_IN_DVR; |
---|
525 | else |
---|
526 | pesflt.input = DMX_IN_FRONTEND; |
---|
527 | } |
---|
528 | else |
---|
529 | pesflt.input = input; |
---|
530 | |
---|
531 | pesflt.output = output; |
---|
532 | pesflt.pid = pid; |
---|
533 | if(nostart == 0) |
---|
534 | pesflt.flags = DMX_IMMEDIATE_START; |
---|
535 | pesflt.pes_type = pestype; |
---|
536 | |
---|
537 | debug(200, "DMX_SET_PES_FILTER pid=%d, pestype=%d, input=%d, output=%d", pid, pestype, pesflt.input, output); |
---|
538 | if(ioctl(fd, DMX_SET_PES_FILTER, &pesflt) < 0) |
---|
539 | { |
---|
540 | perr("DMX_SET_PES_FILTER"); |
---|
541 | return 1; |
---|
542 | } |
---|
543 | |
---|
544 | return 0; |
---|
545 | } |
---|
546 | |
---|
547 | int dmxsetpesfilter(struct dvbdev* node, int pid, int input, int output, int pestype, int nostart) |
---|
548 | { |
---|
549 | if(node == NULL) |
---|
550 | { |
---|
551 | err("NULL detect"); |
---|
552 | return 1; |
---|
553 | } |
---|
554 | return dmxsetpesfilterfd(node->fd, pid, input, output, pestype, nostart); |
---|
555 | } |
---|
556 | |
---|
557 | int dmxgetdev() |
---|
558 | { |
---|
559 | int i, y, z, fd = -1, count = 0; |
---|
560 | char *buf = NULL, *dmxdev = NULL; |
---|
561 | |
---|
562 | dmxdev = getconfig("dmxdev", NULL); |
---|
563 | if(dmxdev == NULL) |
---|
564 | { |
---|
565 | err("NULL detect"); |
---|
566 | return count; |
---|
567 | } |
---|
568 | |
---|
569 | buf = malloc(MINMALLOC); |
---|
570 | if(buf == NULL) |
---|
571 | { |
---|
572 | err("no memory"); |
---|
573 | return count; |
---|
574 | } |
---|
575 | |
---|
576 | //workaround HD51 kann nur max 4 dvr ... warum?? |
---|
577 | int help = MAXDEMUXDEV; |
---|
578 | if(checkrealbox("HD51") == 1) |
---|
579 | help = 4; |
---|
580 | // |
---|
581 | |
---|
582 | for(i = 0; i < MAXDVBADAPTER; i++) |
---|
583 | { |
---|
584 | //for(y = 0; y < MAXDEMUXDEV; y++) |
---|
585 | for(y = 0; y < help; y++) |
---|
586 | { |
---|
587 | sprintf(buf, dmxdev, i, y); |
---|
588 | fd = dmxopendirect(buf); |
---|
589 | if(fd >= 0) |
---|
590 | { |
---|
591 | count++; |
---|
592 | for(z = 0; z < MAXDEMUXDEVOPEN; z++) |
---|
593 | adddvbdev(buf, i, y, -1, DEMUXDEV, NULL, NULL, NULL, 0); |
---|
594 | //without this, on atevio7500, if the second tuner is the maintuner |
---|
595 | //no picture (i don't know why) |
---|
596 | dmxsetpesfilterfd(fd, 0, -1, DMX_OUT_DECODER, DMX_PES_AUDIO, 0); |
---|
597 | dmxclose(NULL, fd); |
---|
598 | } |
---|
599 | } |
---|
600 | } |
---|
601 | |
---|
602 | free(buf); |
---|
603 | return count; |
---|
604 | } |
---|
605 | |
---|
606 | #endif |
---|