]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
capmt: when the caid is forced for a service, try to use it as PID 8191, fixes #2942
authorJaroslav Kysela <perex@perex.cz>
Sat, 26 Dec 2015 17:35:12 +0000 (18:35 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sat, 26 Dec 2015 17:44:05 +0000 (18:44 +0100)
src/descrambler/capmt.c

index 8eecff21551a3fdcb908a86bc06e5f9ce81a7dbc..33269159173cfa2cda897dfdc28c6544633f66a7 100644 (file)
@@ -1737,6 +1737,24 @@ capmt_table_input(void *opaque, int pid, const uint8_t *data, int len, int emm)
   pthread_mutex_unlock(&capmt->capmt_mutex);
 }
 
+static void
+capmt_caid_add(capmt_service_t *ct, mpegts_service_t *t, int pid, caid_t *c)
+{
+  capmt_caid_ecm_t *cce;
+
+  tvhlog(LOG_DEBUG, "capmt",
+         "%s: New caid 0x%04X:0x%06X (pid 0x%04X) for service \"%s\"",
+          capmt_name(ct->ct_capmt), c->caid, c->providerid, pid, t->s_dvb_svcname);
+
+  cce = calloc(1, sizeof(capmt_caid_ecm_t));
+  cce->cce_caid = c->caid;
+  cce->cce_ecmpid = pid;
+  cce->cce_providerid = c->providerid;
+  cce->cce_service = t;
+  LIST_INSERT_HEAD(&ct->ct_caid_ecm, cce, cce_link);
+  ct->ct_constcw |= c->caid == 0x2600 ? 1 : 0;
+}
+
 static void
 capmt_caid_change(th_descrambler_t *td)
 {
@@ -1766,18 +1784,7 @@ capmt_caid_change(th_descrambler_t *td)
             break;
       if (cce)
         continue;
-      tvhlog(LOG_DEBUG, "capmt",
-             "%s: New caid 0x%04X:0x%06X for service \"%s\"",
-              capmt_name(capmt), c->caid, c->providerid, t->s_dvb_svcname);
-
-      /* ecmpid not already seen, add it to list */
-      cce             = calloc(1, sizeof(capmt_caid_ecm_t));
-      cce->cce_caid   = c->caid;
-      cce->cce_ecmpid = st->es_pid;
-      cce->cce_providerid = c->providerid;
-      cce->cce_service = t;
-      LIST_INSERT_HEAD(&ct->ct_caid_ecm, cce, cce_link);
-      ct->ct_constcw |= c->caid == 0x2600 ? 1 : 0;
+      capmt_caid_add(ct, t, st->es_pid, c);
       change = 1;
     }
   }
@@ -1970,7 +1977,6 @@ capmt_service_start(caclient_t *cac, service_t *s)
 {
   capmt_t *capmt = (capmt_t *)cac;
   capmt_service_t *ct;
-  capmt_caid_ecm_t *cce;
   th_descrambler_t *td;
   mpegts_service_t *t = (mpegts_service_t*)s;
   elementary_stream_t *st;
@@ -2055,22 +2061,19 @@ capmt_service_start(caclient_t *cac, service_t *s)
         continue;
       if (t->s_dvb_forcecaid && t->s_dvb_forcecaid != c->caid)
         continue;
-
-      tvhlog(LOG_DEBUG, "capmt",
-        "%s: New caid 0x%04X for service \"%s\"", capmt_name(capmt), c->caid, t->s_dvb_svcname);
-
-      /* add it to list */
-      cce             = calloc(1, sizeof(capmt_caid_ecm_t));
-      cce->cce_caid   = c->caid;
-      cce->cce_ecmpid = st->es_pid;
-      cce->cce_providerid = c->providerid;
-      cce->cce_service = t;
-      LIST_INSERT_HEAD(&ct->ct_caid_ecm, cce, cce_link);
-      ct->ct_constcw |= c->caid == 0x2600 ? 1 : 0;
+      capmt_caid_add(ct, t, st->es_pid, c);
       change = 1;
     }
   }
 
+  if (!change && t->s_dvb_forcecaid) {
+    caid_t sca;
+    memset(&sca, 0, sizeof(sca));
+    sca.caid = t->s_dvb_forcecaid;
+    capmt_caid_add(ct, t, 8191, &sca);
+    change = 1;
+  }
+
   td = (th_descrambler_t *)ct;
   snprintf(buf, sizeof(buf), "capmt-%s-%i",
                              capmt->capmt_sockfile,