Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
linuxdvb: add proper support for multiple frontends in one adapter di…
…rectory
  • Loading branch information
perexg committed May 30, 2015
1 parent 90b2571 commit f27ac40
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
19 changes: 15 additions & 4 deletions src/input/mpegts/linuxdvb/linuxdvb_adapter.c
Expand Up @@ -453,11 +453,22 @@ linuxdvb_adapter_add ( const char *path )
memset(fetypes, 0, sizeof(fetypes));
LIST_FOREACH(lfe, &la->la_frontends, lfe_link)
fetypes[lfe->lfe_type]++;
for (i = 0; i < ARRAY_SIZE(fetypes); i++)
for (i = j = r = 0; i < ARRAY_SIZE(fetypes); i++) {
if (fetypes[i] > 1)
tvhwarn("linuxdvb", "adapter %d has multiple tuners %d for type %s, "
"only one can be used at a time",
a, fetypes[i], dvb_type2str(i));
r++;
else if (fetypes[i] > 0)
j++;
}
if (r && j) {
la->la_exclusive = 1;
for (i = 0; i < ARRAY_SIZE(fetypes); i++)
if (fetypes[i] > 0)
tvhwarn("linuxdvb", "adapter %d has tuner count %d for type %s (wrong config)",
a, fetypes[i], dvb_type2str(i));
} else if (!r && j > 1) {
la->la_exclusive = 1;
tvhinfo("linuxdvb", "adapter %d setting exlusive flag", a);
}
#endif

/* Save configuration */
Expand Down
8 changes: 6 additions & 2 deletions src/input/mpegts/linuxdvb/linuxdvb_frontend.c
Expand Up @@ -271,8 +271,12 @@ linuxdvb_frontend_get_weight ( mpegts_input_t *mi, mpegts_mux_t *mm, int flags )
int weight = 0;
linuxdvb_adapter_t *la = ((linuxdvb_frontend_t*)mi)->lfe_adapter;
linuxdvb_frontend_t *lfe;
LIST_FOREACH(lfe, &la->la_frontends, lfe_link)
weight = MAX(weight, mpegts_input_get_weight((mpegts_input_t*)lfe, mm, flags));
if (la->la_exclusive) {
LIST_FOREACH(lfe, &la->la_frontends, lfe_link)
weight = MAX(weight, mpegts_input_get_weight((mpegts_input_t*)lfe, mm, flags));
} else {
weight = mpegts_input_get_weight(mi, mm, flags);
}
return weight;
}

Expand Down
1 change: 1 addition & 0 deletions src/input/mpegts/linuxdvb/linuxdvb_private.h
Expand Up @@ -78,6 +78,7 @@ struct linuxdvb_adapter
char *la_name;
char *la_rootpath;
int la_dvb_number;
int la_exclusive; /* one frontend at a time */

/*
* Frontends
Expand Down

0 comments on commit f27ac40

Please sign in to comment.