Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
service: add per-service priority modificator, fixes #2249
  • Loading branch information
perexg committed Jan 18, 2015
1 parent c92ccca commit ba7d8fa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/html/config_services.html
Expand Up @@ -24,6 +24,11 @@
check can be also disabled for given service using this
column.

<dt>Priority
<dd>Define priority (range 0-10) for this service. The higher value means more preferred.
Note that this value is _added_ to the input (tuner) priority.
Take this in account when you set the input priorities.

<dt>Channel
<dd>The channel to which the service is mapped

Expand Down
8 changes: 8 additions & 0 deletions src/service.c
Expand Up @@ -222,6 +222,12 @@ const idclass_t service_class = {
.rend = service_class_channel_rend,
.opts = PO_NOSAVE
},
{
.type = PT_INT,
.id = "priority",
.name = "Priority (0-10)",
.off = offsetof(service_t, s_prio),
},
{
.type = PT_BOOL,
.id = "encrypted",
Expand Down Expand Up @@ -1536,6 +1542,8 @@ service_instance_add(service_instance_list_t *sil,
{
service_instance_t *si;

prio += MAX(0, MIN(10, s->s_prio));

/* Existing */
TAILQ_FOREACH(si, sil, si_link)
if(si->si_s == s && si->si_instance == instance)
Expand Down
1 change: 1 addition & 0 deletions src/service.h
Expand Up @@ -288,6 +288,7 @@ typedef struct service {
*/
int s_enabled;
int s_auto;
int s_prio;

LIST_ENTRY(service) s_active_link;

Expand Down

0 comments on commit ba7d8fa

Please sign in to comment.