]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
mpegts pid: add MPS_WEIGHT_ALLLIMIT
authorJaroslav Kysela <perex@perex.cz>
Wed, 14 Mar 2018 13:31:56 +0000 (14:31 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 14 Mar 2018 13:31:56 +0000 (14:31 +0100)
src/input/mpegts.h
src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/mpegts_pid.c
src/input/mpegts/satip/satip_frontend.c
src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c

index 3605251cc48a27cd7c7f25a82ada446540bb0a0b..9868b63d164ec194e05ebdc868f708a4a5abe0e9 100644 (file)
@@ -115,7 +115,7 @@ int mpegts_pid_compare ( mpegts_apids_t *dst, mpegts_apids_t *src,
                          mpegts_apids_t *add, mpegts_apids_t *del );
 int mpegts_pid_compare_weight ( mpegts_apids_t *dst, mpegts_apids_t *src,
                                 mpegts_apids_t *add, mpegts_apids_t *del );
-int mpegts_pid_weighted ( mpegts_apids_t *dst, mpegts_apids_t *src, int limit );
+int mpegts_pid_weighted ( mpegts_apids_t *dst, mpegts_apids_t *src, int limit, int mweight );
 int mpegts_pid_dump ( mpegts_apids_t *pids, char *buf, int len, int wflag, int raw );
 
 /* **************************************************************************
@@ -184,6 +184,8 @@ typedef struct mpegts_pid_sub
 #define MPS_WEIGHT_RAW      400
 #define MPS_WEIGHT_NIT2     300
 #define MPS_WEIGHT_SDT2     300
+#define MPS_WEIGHT_ALLLIMIT 200 /* values under this limit does not switch */
+                                /* input to the unfiltered PIDs (all) mode */
 #define MPS_WEIGHT_TDT      101
 #define MPS_WEIGHT_STT      101
 #define MPS_WEIGHT_PMT_SCAN 100
index 6406b0cd36564c995d13b9a2393aad61cb178c63..612628d994fcec194d5c360c785a1e9e3e052336 100644 (file)
@@ -1322,7 +1322,7 @@ linuxdvb_update_pids ( linuxdvb_frontend_t *lfe, const char *name,
   pthread_mutex_lock(&lfe->lfe_dvr_lock);
 
   if (!all) {
-    overlimit = mpegts_pid_weighted(&wpid, &lfe->lfe_pids, max);
+    overlimit = mpegts_pid_weighted(&wpid, &lfe->lfe_pids, max, MPS_WEIGHT_ALLLIMIT);
     if (tvhtrace_enabled()) {
       mpegts_pid_dump(&wpid, buf, sizeof(buf), 1, 1);
       tvhtrace(LS_LINUXDVB, "%s - weighted PIDs %s", name, buf);
index 0e11261bceedd43d062c5c645035c952a0ecd12d..04c9602ca1df1ccb5700de50c84c83bd7ef952cf 100644 (file)
@@ -338,7 +338,8 @@ mpegts_pid_compare_weight(mpegts_apids_t *dst, mpegts_apids_t *src,
 }
 
 int
-mpegts_pid_weighted(mpegts_apids_t *dst, mpegts_apids_t *pids, int limit)
+mpegts_pid_weighted
+  (mpegts_apids_t *dst, mpegts_apids_t *pids, int limit, int mweight)
 {
   int i, j, overlimit = 0;
   mpegts_apids_t sorted;
@@ -359,7 +360,9 @@ mpegts_pid_weighted(mpegts_apids_t *dst, mpegts_apids_t *pids, int limit)
   }
   for ( ; i < sorted.count; i++) {
     p = &sorted.pids[i];
-    if (mpegts_pid_find_rindex(dst, sorted.pids[i].pid) < 0)
+    if (p->weight < mweight)
+      continue;
+    if (mpegts_pid_find_rindex(dst, p->pid) < 0)
       overlimit++;
   }
   dst->all = pids->all;
@@ -380,7 +383,7 @@ mpegts_pid_dump(mpegts_apids_t *pids, char *buf, int len, int wflag, int raw)
   if (pids->all)
     return snprintf(buf, len, "all");
   if (!raw) {
-    mpegts_pid_weighted(&spids, pids, len / 2);
+    mpegts_pid_weighted(&spids, pids, len / 2, 0);
     pids = &spids;
   }
   *buf = '\0';
index c655814e84ec08bc271216fd4c107d81214fbcce..b176d0a8e1a4281791e431cbb517b63f3dbd7812 100644 (file)
@@ -1094,7 +1094,8 @@ all:
              tr->sf_pids_tuned.all ||
              tr->sf_pids.count == 0) {
 
-    overlimit = mpegts_pid_weighted(&wpid, &tr->sf_pids, max_pids_count);
+    overlimit = mpegts_pid_weighted(&wpid, &tr->sf_pids,
+                                    max_pids_count, MPS_WEIGHT_ALLLIMIT);
 
     if (overlimit > 0 && sd->sd_fullmux_ok) {
       mpegts_pid_done(&wpid);
@@ -1116,7 +1117,8 @@ all:
 
   } else {
 
-    overlimit = mpegts_pid_weighted(&wpid, &tr->sf_pids, max_pids_count);
+    overlimit = mpegts_pid_weighted(&wpid, &tr->sf_pids,
+                                    max_pids_count, MPS_WEIGHT_ALLLIMIT);
 
     if (overlimit > 0 && sd->sd_fullmux_ok) {
       mpegts_pid_done(&wpid);
index 32fda7eb69302f280b3b497c3f39e921cf89acf0..6ed2dacc56c829f1fd78bd564f9b70a2579c5c29 100644 (file)
@@ -521,7 +521,7 @@ static void tvhdhomerun_frontend_update_pids( mpegts_input_t *mi, mpegts_mux_t *
     }
   }
 
-  mpegts_pid_weighted(&wpids, &pids, 128 /* max? */);
+  mpegts_pid_weighted(&wpids, &pids, 128 /* max? */, MPS_WEIGHT_ALLLIMIT);
   for (i = 0; i < wpids.count; i++)
     tvhdhomerun_device_open_pid(hfe, wpids.pids[i].pid);
   if (wpids.all)