Use transport's quality index when chosing which transport to use for a subscription.

This commit is contained in:
Andreas Öman 2008-04-22 20:53:22 +00:00
parent 423349705e
commit 5dd804026c
3 changed files with 23 additions and 0 deletions

BIN
dvb.c

Binary file not shown.

View file

@ -235,6 +235,22 @@ transport_get_prio(th_transport_t *t)
}
}
/**
* Return quality index for given transport
*
* We invert the result (providers say that negative numbers are worse)
*
* But for sorting, we want low numbers first
*
*/
static int
transport_get_quality(th_transport_t *t)
{
return t->tht_quality_index ? -(t->tht_quality_index(t)) : 0;
}
/**
* a - b -> lowest number first
@ -245,6 +261,11 @@ transportcmp(const void *A, const void *B)
th_transport_t *a = *(th_transport_t **)A;
th_transport_t *b = *(th_transport_t **)B;
int q = transport_get_quality(a) - transport_get_quality(b);
if(q != 0)
return q; /* Quality precedes priority */
return transport_get_prio(a) - transport_get_prio(b);
}

View file

@ -431,6 +431,8 @@ typedef struct th_transport {
const char *(*tht_sourcename)(struct th_transport *t);
int (*tht_quality_index)(struct th_transport *t);
struct th_muxer_list tht_muxers; /* muxers */
/*