]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
capmt: fix the weird key update when services have TELETEXT stream shared
authorJaroslav Kysela <perex@perex.cz>
Sun, 13 Aug 2017 15:29:52 +0000 (17:29 +0200)
committerJaroslav Kysela <perex@perex.cz>
Sun, 13 Aug 2017 15:29:52 +0000 (17:29 +0200)
src/descrambler/capmt.c

index f9b903bd4c664046622b4502e3bb01369be2b70c..06661bddee47e76db086d4ed34507db429b410d6 100644 (file)
@@ -192,6 +192,7 @@ typedef struct capmt_service {
 
   /* Elementary stream types */
   uint8_t ct_types[MAX_PIDS];
+  uint8_t ct_type_sok[MAX_PIDS];
 } capmt_service_t;
 
 /**
@@ -1090,7 +1091,7 @@ capmt_process_key(capmt_t *capmt, uint8_t adapter, ca_info_t *cai,
   mpegts_service_t *t;
   capmt_service_t *ct;
   uint16_t *pids;
-  int i, j, pid;
+  int i, j, pid, multipid;
 
   pthread_mutex_lock(&capmt->capmt_mutex);
   LIST_FOREACH(ct, &capmt->capmt_services, ct_link) {
@@ -1109,6 +1110,8 @@ capmt_process_key(capmt_t *capmt, uint8_t adapter, ca_info_t *cai,
     if (adapter != ct->ct_adapter)
       continue;
 
+    multipid = descrambler_multi_pid((th_descrambler_t *)ct);
+
     pids = cai->pids;
 
     for (i = 0; i < MAX_PIDS; i++) {
@@ -1117,11 +1120,11 @@ capmt_process_key(capmt_t *capmt, uint8_t adapter, ca_info_t *cai,
         pid = ct->ct_pids[j];
         if (pid == 0) break;
         if (pid == pids[i]) {
-          if (descrambler_multi_pid((th_descrambler_t *)ct)) {
+          if (multipid) {
             descrambler_keys((th_descrambler_t *)ct, type, pid, even, odd);
             continue;
-          }
-          goto found;
+          } else if (ct->ct_type_sok[j])
+            goto found;
         }
       }
     }
@@ -2021,6 +2024,10 @@ capmt_update_elementary_stream(capmt_service_t *ct, int *_i,
   if (st->es_pid != ct->ct_pids[i] || type != ct->ct_types[i]) {
     ct->ct_pids[i] = st->es_pid;
     ct->ct_types[i] = type;
+    /* mark as valid for !multipid - TELETEXT may be shared */
+    ct->ct_type_sok[i] = SCT_ISVIDEO(st->es_type) ||
+                         SCT_ISAUDIO(st->es_type) ||
+                         st->es_type == SCT_DVBSUB;
     return 1;
   }