Feature #1503 ยป multi_frontend-tvheadend-9999.patch
src/dvb/dvb.c | ||
---|---|---|
23 | 23 |
#include "dvb_charset.h" |
24 | 24 | |
25 | 25 |
void |
26 |
dvb_init(uint32_t adapter_mask, const char *rawfile) |
|
26 |
dvb_init(uint32_t adapter_mask, uint32_t *adapter_frontends, const char *rawfile)
|
|
27 | 27 |
{ |
28 | 28 |
dvb_charset_init(); |
29 |
dvb_adapter_init(adapter_mask, rawfile); |
|
29 |
dvb_adapter_init(adapter_mask, adapter_frontends, rawfile);
|
|
30 | 30 |
} |
src/dvb/dvb.h | ||
---|---|---|
327 | 327 |
extern struct th_dvb_adapter_queue dvb_adapters; |
328 | 328 |
extern struct th_dvb_mux_instance_tree dvb_muxes; |
329 | 329 | |
330 |
void dvb_init(uint32_t adapter_mask, const char *rawfile); |
|
330 |
void dvb_init(uint32_t adapter_mask, uint32_t *adapter_frontends, const char *rawfile);
|
|
331 | 331 | |
332 | 332 |
/** |
333 | 333 |
* DVB Adapter |
334 | 334 |
*/ |
335 |
void dvb_adapter_init(uint32_t adapter_mask, const char *rawfile); |
|
335 |
void dvb_adapter_init(uint32_t adapter_mask, uint32_t *adapter_frontends, const char *rawfile);
|
|
336 | 336 | |
337 | 337 |
void dvb_adapter_mux_scanner(void *aux); |
338 | 338 |
src/dvb/dvb_adapter.c | ||
---|---|---|
445 | 445 |
* |
446 | 446 |
*/ |
447 | 447 |
static void |
448 |
tda_add(int adapter_num) |
|
448 |
tda_add(int adapter_num, int frontend_num, int demux_num)
|
|
449 | 449 |
{ |
450 | 450 |
char path[200], fname[256]; |
451 | 451 |
int fe, i, r; |
... | ... | |
453 | 453 |
char buf[400]; |
454 | 454 | |
455 | 455 |
snprintf(path, sizeof(path), "/dev/dvb/adapter%d", adapter_num); |
456 |
snprintf(fname, sizeof(fname), "%s/frontend0", path);
|
|
456 |
snprintf(fname, sizeof(fname), "%s/frontend%d", path, frontend_num);
|
|
457 | 457 |
|
458 | 458 |
fe = tvh_open(fname, O_RDWR | O_NONBLOCK, 0); |
459 | 459 |
if(fe == -1) { |
... | ... | |
468 | 468 |
tda->tda_adapter_num = adapter_num; |
469 | 469 |
tda->tda_rootpath = strdup(path); |
470 | 470 |
tda->tda_demux_path = malloc(256); |
471 |
snprintf(tda->tda_demux_path, 256, "%s/demux0", path);
|
|
471 |
snprintf(tda->tda_demux_path, 256, "%s/demux%d", path, demux_num);
|
|
472 | 472 |
tda->tda_fe_path = strdup(fname); |
473 | 473 |
tda->tda_fe_fd = -1; |
474 | 474 |
tda->tda_dvr_pipe.rd = -1; |
... | ... | |
637 | 637 |
* |
638 | 638 |
*/ |
639 | 639 |
void |
640 |
dvb_adapter_init(uint32_t adapter_mask, const char *rawfile) |
|
640 |
dvb_adapter_init(uint32_t adapter_mask, uint32_t *adapter_frontends, const char *rawfile)
|
|
641 | 641 |
{ |
642 | 642 |
htsmsg_t *l, *c; |
643 | 643 |
htsmsg_field_t *f; |
... | ... | |
650 | 650 | |
651 | 651 |
/* Initialise hardware */ |
652 | 652 |
for(i = 0; i < 32; i++) |
653 |
if ((1 << i) & adapter_mask)
|
|
654 |
tda_add(i); |
|
653 |
if ((1 << i) & adapter_mask) |
|
654 |
tda_add(i, adapter_frontends[i], 0);
|
|
655 | 655 | |
656 | 656 |
/* Initialise rawts test file */ |
657 | 657 |
if(rawfile) |
src/main.c | ||
---|---|---|
190 | 190 |
printf("usage: %s [options]\n", argv0); |
191 | 191 |
printf("\n"); |
192 | 192 |
printf(" -a <adapters> Use only DVB adapters specified (csv)\n"); |
193 |
printf(" -b <adpN>:<frN> Specify which frontend frN to use for adapter adpN\n"); |
|
193 | 194 |
printf(" -c <directory> Alternate configuration path.\n" |
194 | 195 |
" Defaults to [$HOME/.hts/tvheadend]\n"); |
195 | 196 |
printf(" -m <directory> Alternate mux configuration directory\n"); |
... | ... | |
288 | 289 |
const char *confpath = NULL; |
289 | 290 |
char *p, *endp; |
290 | 291 |
uint32_t adapter_mask = 0xffffffff; |
292 |
uint32_t *adapter_frontends = (uint32_t*)malloc(sizeof(uint32_t)*32); |
|
291 | 293 |
int crash = 0; |
292 | 294 |
webui_port = 9981; |
293 | 295 |
htsp_port = 9982; |
294 | 296 |
gid_t gid; |
295 | 297 |
uid_t uid; |
296 | 298 | |
299 |
memset(adapter_frontends, 0, sizeof(uint32_t)*32); |
|
300 | ||
297 | 301 |
/* Get current directory */ |
298 | 302 |
tvheadend_cwd = dirname(dirname(tvh_strdupa(argv[0]))); |
299 | 303 | |
... | ... | |
303 | 307 |
// make sure the timezone is set |
304 | 308 |
tzset(); |
305 | 309 | |
306 |
while((c = getopt(argc, argv, "Aa:fp:u:g:c:Chdr:j:sw:e:E:R:W:")) != -1) { |
|
310 |
while((c = getopt(argc, argv, "Aa:b:fp:u:g:c:Chdr:j:sw:e:E:R:W:")) != -1) {
|
|
307 | 311 |
switch(c) { |
308 | 312 |
case 'a': |
309 | 313 |
adapter_mask = 0x0; |
... | ... | |
325 | 329 |
usage(argv[0]); |
326 | 330 |
} |
327 | 331 |
break; |
332 |
case 'b': |
|
333 |
p = strtok(optarg, ":"); |
|
334 |
if (p != NULL) { |
|
335 |
int tmp_frontend = strtol(p, &endp, 10); |
|
336 |
p = strtok(NULL, ":"); |
|
337 |
if(p == NULL || *endp != 0 || tmp_frontend < 0 || tmp_frontend > 31) |
|
338 |
usage(argv[0]); |
|
339 |
adapter_frontends[tmp_frontend] = strtol(p, &endp, 10); |
|
340 |
} else { |
|
341 |
usage(argv[0]); |
|
342 |
} |
|
343 |
break; |
|
328 | 344 |
case 'A': |
329 | 345 |
crash = 1; |
330 | 346 |
break; |
... | ... | |
480 | 496 | |
481 | 497 |
#if ENABLE_LINUXDVB |
482 | 498 |
muxes_init(); |
483 |
dvb_init(adapter_mask, dvb_rawts_input); |
|
499 |
dvb_init(adapter_mask, adapter_frontends, dvb_rawts_input);
|
|
484 | 500 |
#endif |
485 | 501 | |
502 |
free(adapter_frontends); |
|
503 | ||
486 | 504 |
iptv_input_init(); |
487 | 505 | |
488 | 506 |
#if ENABLE_V4L |