]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
descrambler: prefcapid_lock - add constants to increase source readability
authorJaroslav Kysela <perex@perex.cz>
Sat, 21 Feb 2015 20:16:36 +0000 (21:16 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sat, 21 Feb 2015 20:16:36 +0000 (21:16 +0100)
src/descrambler/capmt.c
src/descrambler/cwc.c
src/input/mpegts.h

index 8d0bc76b6be8d3fe0c7bf539d128b98f6216d86a..818ef7a5b67270b4cd49e5f3f71735675ecb4843 100644 (file)
@@ -1664,7 +1664,7 @@ capmt_caid_change(th_descrambler_t *td)
   lock_assert(&t->s_stream_mutex);
 
   TAILQ_FOREACH(st, &t->s_filt_components, es_filt_link) {
-    if (t->s_dvb_prefcapid_lock == 2 &&
+    if (t->s_dvb_prefcapid_lock == PREFCAPID_FORCE &&
         t->s_dvb_prefcapid != st->es_pid)
       continue;
     LIST_FOREACH(c, &st->es_caids, link) {
@@ -1954,7 +1954,7 @@ capmt_service_start(caclient_t *cac, service_t *s)
 
   TAILQ_FOREACH(st, &t->s_filt_components, es_filt_link) {
     caid_t *c;
-    if (t->s_dvb_prefcapid_lock == 2 &&
+    if (t->s_dvb_prefcapid_lock == PREFCAPID_FORCE &&
         t->s_dvb_prefcapid != st->es_pid)
       continue;
     LIST_FOREACH(c, &st->es_caids, link) {
index 80337bb0ec347dd800dd4381f3ce37fb9be9abb2..091179e4d984b42e4e11cdfa990d3b6ffc5825f9 100644 (file)
@@ -769,7 +769,7 @@ forbid:
       ct->td_keystate = DS_FORBIDDEN;
       ct->ecm_state = ECM_RESET;
       /* this pid is not valid, force full scan */
-      if (t->s_dvb_prefcapid == ct->cs_channel && t->s_dvb_prefcapid_lock == 0)
+      if (t->s_dvb_prefcapid == ct->cs_channel && t->s_dvb_prefcapid_lock == PREFCAPID_OFF)
         t->s_dvb_prefcapid = 0;
     }
     return;
@@ -782,7 +782,7 @@ forbid:
 
     if(t->s_dvb_prefcapid == 0 ||
        (t->s_dvb_prefcapid != ct->cs_channel &&
-        t->s_dvb_prefcapid_lock == 0)) {
+        t->s_dvb_prefcapid_lock == PREFCAPID_OFF)) {
       t->s_dvb_prefcapid = ct->cs_channel;
       tvhlog(LOG_DEBUG, "cwc", "Saving prefered PID %d for %s",
                                t->s_dvb_prefcapid, ct->td_nicename);
@@ -1639,7 +1639,7 @@ cwc_table_input(void *opaque, int pid, const uint8_t *data, int len)
 
     if (ct->ecm_state == ECM_INIT) {
       // Validate prefered ECM PID
-      if(t->s_dvb_prefcapid != 0) {
+      if(t->s_dvb_prefcapid != PREFCAPID_OFF) {
         struct elementary_stream *prefca
           = service_stream_find((service_t*)t, t->s_dvb_prefcapid);
         if (!prefca || prefca->es_type != SCT_CA) {
@@ -1995,7 +1995,7 @@ cwc_service_start(caclient_t *cac, service_t *t)
   LIST_FOREACH(pcard, &cwc->cwc_cards, cs_card) {
     if (pcard->cwc_caid == 0) continue;
     TAILQ_FOREACH(st, &t->s_filt_components, es_filt_link) {
-      if (((mpegts_service_t *)t)->s_dvb_prefcapid_lock == 2 &&
+      if (((mpegts_service_t *)t)->s_dvb_prefcapid_lock == PREFCAPID_FORCE &&
           ((mpegts_service_t *)t)->s_dvb_prefcapid != st->es_pid)
         continue;
       LIST_FOREACH(c, &st->es_caids, link) {
index fc5dcd5d90269392fa97263e0afa4d6ccd6b2676..ef03e9bec994226b8e45f8ef7f0a53d8491a81c0 100644 (file)
@@ -450,7 +450,11 @@ struct mpegts_mux
   TAILQ_HEAD(, tsdebug_packet) mm_tsdebug_packets;
 #endif
 };
+
+#define PREFCAPID_OFF      0
+#define PREFCAPID_ON       1
+#define PREFCAPID_FORCE    2
+
 /* Service */
 struct mpegts_service
 {