void
transport_recv_tsb(th_transport_t *t, int pid, uint8_t *tsb)
{
- pidinfo_t *pi;
+ pidinfo_t *pi = NULL;
th_subscription_t *s;
th_channel_t *ch;
int i, cc, err = 0;
for(i = 0; i < t->tht_npids; i++) {
+ if(t->tht_pids[i].pid == pid) {
+ pi = t->tht_pids + i;
+ break;
+ }
+ }
- pi = t->tht_pids + i;
+ if(pi == NULL)
+ return;
- if(pi->pid != pid)
- continue;
-
- cc = tsb[3] & 0xf;
-
- if(tsb[3] & 0x10) {
- if(pi->cc_valid && cc != pi->cc) {
- /* Incorrect CC */
- avgstat_add(&t->tht_cc_errors, 1, dispatch_clock);
- err = 1;
- }
- pi->cc_valid = 1;
- pi->cc = (cc + 1) & 0xf;
+ cc = tsb[3] & 0xf;
+
+ if(tsb[3] & 0x10) {
+ if(pi->cc_valid && cc != pi->cc) {
+ /* Incorrect CC */
+ avgstat_add(&t->tht_cc_errors, 1, dispatch_clock);
+ err = 1;
}
+ pi->cc_valid = 1;
+ pi->cc = (cc + 1) & 0xf;
+ }
- avgstat_add(&t->tht_rate, 188, dispatch_clock);
+ avgstat_add(&t->tht_rate, 188, dispatch_clock);
- ch = t->tht_channel;
+ ch = t->tht_channel;
- if(pi->type == HTSTV_TELETEXT) {
- /* teletext */
- teletext_input(t, tsb);
- continue;
- }
+ if(pi->type == HTSTV_TELETEXT) {
+ /* teletext */
+ teletext_input(t, tsb);
+ return;
+ }
- tsb[0] = pi->type;
+ tsb[0] = pi->type;
- pthread_mutex_lock(&subscription_mutex);
+ pthread_mutex_lock(&subscription_mutex);
- LIST_FOREACH(s, &t->tht_subscriptions, ths_transport_link) {
- s->ths_total_err += err;
- s->ths_callback(s, tsb, pi, i);
- }
- pthread_mutex_unlock(&subscription_mutex);
+ LIST_FOREACH(s, &t->tht_subscriptions, ths_transport_link) {
+ s->ths_total_err += err;
+ s->ths_callback(s, tsb, pi, i);
}
+ pthread_mutex_unlock(&subscription_mutex);
}