v = 0;
tdmi->tdmi_fec_err_per_sec = (tdmi->tdmi_fec_err_per_sec * 7 + v) / 8;
- subscription_lock();
-
if(tdmi->tdmi_fec_err_per_sec > DVB_FEC_ERROR_LIMIT) {
if(LIST_FIRST(&tda->tda_transports) != NULL) {
LIST_REMOVE(tdmi, tdmi_mux_link);
LIST_INSERT_SORTED(&tdm->tdm_instances, tdmi, tdmi_mux_link,
mux_sort_quality);
- subscription_unlock();
}
}
{
th_dvb_adapter_t *tda = aux;
th_dvb_mux_instance_t *tdmi;
- unsigned int w;
stimer_add(dvb_mux_scanner, tda, 10);
- subscription_lock();
-
- w = transport_compute_weight(&tda->tda_transports);
-
- subscription_unlock();
-
- if(w > 0)
+ if(transport_compute_weight(&tda->tda_transports) > 0)
return; /* someone is here */
tdmi = tda->tda_mux_current;
#include "iptv_input.h"
#include "psi.h"
-/*
- * subscriptions_mutex protects all operations concerning subscription lists
- */
-
-static pthread_mutex_t subscription_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-/*
- *
- */
-void
-subscription_lock(void)
-{
- pthread_mutex_lock(&subscription_mutex);
-}
-
-void
-subscription_unlock(void)
-{
- pthread_mutex_unlock(&subscription_mutex);
-}
-
-
struct th_subscription_list subscriptions;
static void
auto_reschedule(void *aux)
{
stimer_add(auto_reschedule, NULL, 10);
-
- pthread_mutex_lock(&subscription_mutex);
subscription_reschedule();
- pthread_mutex_unlock(&subscription_mutex);
}
void
subscription_unsubscribe(th_subscription_t *s)
{
- pthread_mutex_lock(&subscription_mutex);
-
s->ths_callback(s, NULL, NULL, AV_NOPTS_VALUE);
LIST_REMOVE(s, ths_global_link);
free(s);
subscription_reschedule();
-
- pthread_mutex_unlock(&subscription_mutex);
}
{
th_subscription_t *s;
- pthread_mutex_lock(&subscription_mutex);
-
s = malloc(sizeof(th_subscription_t));
s->ths_pkt = NULL;
s->ths_callback = callback;
"to channel \"%s\"",
s->ths_title, s->ths_channel->ch_name);
- pthread_mutex_unlock(&subscription_mutex);
-
return s;
}
if(s->ths_weight == weight)
return;
- pthread_mutex_lock(&subscription_mutex);
-
LIST_REMOVE(s, ths_global_link);
s->ths_weight = weight;
LIST_INSERT_SORTED(&subscriptions, s, ths_global_link, subscription_sort);
subscription_reschedule();
-
- pthread_mutex_unlock(&subscription_mutex);
}
void subscription_set_weight(th_subscription_t *s, unsigned int weight);
-void subscription_lock(void);
-
-void subscription_unlock(void);
-
typedef void (subscription_callback_t)(struct th_subscription *s,
uint8_t *pkt, th_pid_t *pi,
int64_t pcr);