Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
IPTV: Add priority value to the IPTV network
  • Loading branch information
perexg committed Aug 11, 2014
1 parent 88e692c commit 2088863
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/html/config_networks.html
Expand Up @@ -46,8 +46,8 @@
<dt>Character Set
<dd>The character encoding for this network (e.g. UTF-8).

<dt>Priority
<dd>IPTV : The network priority value (higher value = higher priority to use muxes/services from this network).



</dl>
</div>
26 changes: 24 additions & 2 deletions src/input/mpegts/iptv/iptv.c
Expand Up @@ -169,6 +169,14 @@ iptv_input_get_grace ( mpegts_input_t *mi, mpegts_mux_t *mm )
return in->in_max_timeout;
}

static int
iptv_input_get_priority ( mpegts_input_t *mi, mpegts_mux_t *mm )
{
iptv_mux_t *im = (iptv_mux_t *)mm;
iptv_network_t *in = (iptv_network_t *)im->mm_network;
return in->in_priority;
}

static int
iptv_input_start_mux ( mpegts_input_t *mi, mpegts_mux_instance_t *mmi )
{
Expand Down Expand Up @@ -396,6 +404,14 @@ const idclass_t iptv_network_class = {
.ic_caption = "IPTV Network",
.ic_delete = iptv_network_class_delete,
.ic_properties = (const property_t[]){
{
.type = PT_INT,
.id = "priority",
.name = "Priority",
.off = offsetof(iptv_network_t, in_priority),
.def.i = 1,
.opts = PO_ADVANCED
},
{
.type = PT_U32,
.id = "max_streams",
Expand Down Expand Up @@ -457,12 +473,17 @@ iptv_network_t *
iptv_network_create0
( const char *uuid, htsmsg_t *conf )
{
iptv_network_t *in;
iptv_network_t *in = calloc(1, sizeof(*in));
htsmsg_t *c;

/* Init Network */
if (!(in = mpegts_network_create(iptv_network, uuid, NULL, conf)))
in->in_priority = 1;
if (!mpegts_network_create0((mpegts_network_t *)in,
&iptv_network_class,
uuid, NULL, conf)) {
free(in);
return NULL;
}
in->mn_create_service = iptv_network_create_service;
in->mn_mux_class = iptv_network_mux_class;
in->mn_mux_create2 = iptv_network_create_mux2;
Expand Down Expand Up @@ -541,6 +562,7 @@ void iptv_init ( void )
iptv_input->mi_is_free = iptv_input_is_free;
iptv_input->mi_get_weight = iptv_input_get_weight;
iptv_input->mi_get_grace = iptv_input_get_grace;
iptv_input->mi_get_priority = iptv_input_get_priority;
iptv_input->mi_display_name = iptv_input_display_name;
iptv_input->mi_enabled = 1;

Expand Down
2 changes: 2 additions & 0 deletions src/input/mpegts/iptv/iptv_private.h
Expand Up @@ -64,6 +64,8 @@ struct iptv_network
int in_bps;
int in_bw_limited;

int in_priority;

uint32_t in_max_streams;
uint32_t in_max_bandwidth;
uint32_t in_max_timeout;
Expand Down

0 comments on commit 2088863

Please sign in to comment.