]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
mpegts: add weight to the pid subscription
authorJaroslav Kysela <perex@perex.cz>
Mon, 27 Apr 2015 06:40:19 +0000 (08:40 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 27 Apr 2015 17:56:58 +0000 (19:56 +0200)
12 files changed:
src/descrambler/descrambler.c
src/epggrab/module/eit.c
src/epggrab/module/opentv.c
src/input/mpegts.h
src/input/mpegts/dvb_psi.c
src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/mpegts_input.c
src/input/mpegts/mpegts_mux.c
src/input/mpegts/mpegts_service.c
src/input/mpegts/mpegts_table.c
src/input/mpegts/satip/satip_frontend.c
src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c

index f27fc53a46221a2f42b1fc41567b7807c4b7f7ba..7a80df2f408b3a4b346c93d8e01ffb14707fe30e 100644 (file)
@@ -636,7 +636,8 @@ descrambler_open_pid_( mpegts_mux_t *mux, void *opaque, int pid,
     TAILQ_INIT(&dt->sections);
     dt->table = mpegts_table_add(mux, 0, 0, descrambler_table_callback,
                                  dt, "descrambler",
-                                 MT_FULL | MT_DEFER | flags, pid);
+                                 MT_FULL | MT_DEFER | flags, pid,
+                                 MPS_WEIGHT_CA);
     if (dt->table)
       dt->table->mt_service = (mpegts_service_t *)service;
     TAILQ_INSERT_TAIL(&mux->mm_descrambler_tables, dt, link);
index e0052757e0d24a047b0a6e73c123523e36d9e0aa..e1d5eeecd62954d6c4c79d4b896ac9a02c027d50 100644 (file)
@@ -705,7 +705,7 @@ static int _eit_start
 
   /* Freesat (3002/3003) */
   if (!strcmp("uk_freesat", m->id)) {
-    mpegts_table_add(dm, 0, 0, dvb_bat_callback, NULL, "bat", MT_CRC, 3002);
+    mpegts_table_add(dm, 0, 0, dvb_bat_callback, NULL, "bat", MT_CRC, 3002, MPS_WEIGHT_EIT);
     pid = 3003;
 
   /* Viasat Baltic (0x39) */
@@ -717,7 +717,7 @@ static int _eit_start
     pid  = DVB_EIT_PID;
     opts = MT_RECORD;
   }
-  mpegts_table_add(dm, 0, 0, _eit_callback, map, m->id, MT_CRC | opts, pid);
+  mpegts_table_add(dm, 0, 0, _eit_callback, map, m->id, MT_CRC | opts, pid, MPS_WEIGHT_EIT);
   // TODO: might want to limit recording to EITpf only
   tvhlog(LOG_DEBUG, m->id, "installed table handlers");
   return 0;
index 8a88aab0a301eba8b061e276c78908be2a300e47..28ca696255988f7cde9f12686f4b8242a4399f41 100644 (file)
@@ -590,7 +590,8 @@ done:
           mt2 = mpegts_table_add(mt->mt_mux,
                                  OPENTV_SUMMARY_BASE, OPENTV_TABLE_MASK,
                                  opentv_table_callback, sta,
-                                 mod->id, MT_CRC, *t++);
+                                 mod->id, MT_CRC, *t++,
+                                 MPS_WEIGHT_EIT);
           if (mt2) {
             sta->os_refcount++;
             mt2->mt_destroy    = opentv_status_destroy;
@@ -638,7 +639,8 @@ opentv_bat_callback
       mt2 = mpegts_table_add(mt->mt_mux,
                              OPENTV_TITLE_BASE, OPENTV_TABLE_MASK,
                              opentv_table_callback, mt->mt_opaque,
-                             mod->id, MT_CRC, *t++);
+                             mod->id, MT_CRC, *t++,
+                             MPS_WEIGHT_EIT);
       if (mt2) {
         if (!mt2->mt_destroy) {
           sta->os_refcount++;
@@ -688,7 +690,8 @@ static int _opentv_start
     }
     mt = mpegts_table_add(mm, DVB_BAT_BASE, DVB_BAT_MASK,
                           opentv_bat_callback, sta,
-                          m->id, MT_CRC, *t++);
+                          m->id, MT_CRC, *t++,
+                          MPS_WEIGHT_EIT);
     if (mt) {
       mt->mt_mux_cb  = bat_desc;
       if (!mt->mt_destroy) {
index 2fdc13ef1802bae345bfaf0c2c35032c8b536d26..119e1e20f6f6bdf3408cce5fad5cd9140cbddf39 100644 (file)
@@ -136,8 +136,26 @@ typedef struct mpegts_pid_sub
 #define MPS_TABLE   0x10
 #define MPS_FTABLE  0x20
 #define MPS_TABLES  0x40
-  int                       mps_type;
-  void                     *mps_owner;
+  int   mps_type;
+#define MPS_WEIGHT_PAT     1000
+#define MPS_WEIGHT_CAT      999
+#define MPS_WEIGHT_SDT      999
+#define MPS_WEIGHT_NIT      999
+#define MPS_WEIGHT_BAT      999
+#define MPS_WEIGHT_VCT      999
+#define MPS_WEIGHT_EIT      999
+#define MPS_WEIGHT_PMT      998
+#define MPS_WEIGHT_PCR      997
+#define MPS_WEIGHT_CA       996
+#define MPS_WEIGHT_VIDEO    900
+#define MPS_WEIGHT_AUDIO    800
+#define MPS_WEIGHT_SUBTITLE 700
+#define MPS_WEIGHT_ESOTHER  500
+#define MPS_WEIGHT_RAW      400
+#define MPS_WEIGHT_NIT2     300
+#define MPS_WEIGHT_SDT2     300
+  int   mps_weight;
+  void *mps_owner;
 } mpegts_pid_sub_t;
 
 typedef struct mpegts_pid
@@ -172,6 +190,11 @@ struct mpegts_table
 #define MT_SLOW       0x0100
 #define MT_DEFER      0x0200
 
+  /**
+   * PID subscription weight
+   */
+  int mt_weight;
+
   /**
    * Cycle queue
    * Tables that did not get a fd or filter in hardware will end up here
@@ -648,8 +671,8 @@ struct mpegts_input
   void (*mi_stop_mux)       (mpegts_input_t*,mpegts_mux_instance_t*);
   void (*mi_open_service)   (mpegts_input_t*,mpegts_service_t*,int flags, int first);
   void (*mi_close_service)  (mpegts_input_t*,mpegts_service_t*);
-  mpegts_pid_t *(*mi_open_pid)(mpegts_input_t*,mpegts_mux_t*,int,int,void*);
-  int  (*mi_close_pid)      (mpegts_input_t*,mpegts_mux_t*,int,int,void*);
+  mpegts_pid_t *(*mi_open_pid)(mpegts_input_t*,mpegts_mux_t*,int,int,int,void*);
+  int  (*mi_close_pid)      (mpegts_input_t*,mpegts_mux_t*,int,int,int,void*);
   void (*mi_create_mux_instance) (mpegts_input_t*,mpegts_mux_t*);
   void (*mi_started_mux)    (mpegts_input_t*,mpegts_mux_instance_t*);
   void (*mi_stopping_mux)   (mpegts_input_t*,mpegts_mux_instance_t*);
@@ -845,10 +868,10 @@ void mpegts_input_save ( mpegts_input_t *mi, htsmsg_t *c );
 void mpegts_input_flush_mux ( mpegts_input_t *mi, mpegts_mux_t *mm );
 
 mpegts_pid_t * mpegts_input_open_pid
-  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner );
+  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner );
 
 int mpegts_input_close_pid
-  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner );
+  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner );
 
 void mpegts_input_close_pids
   ( mpegts_input_t *mi, mpegts_mux_t *mm, void *owner, int all );
@@ -902,7 +925,7 @@ int mpegts_table_type
 mpegts_table_t *mpegts_table_add
   (mpegts_mux_t *mm, int tableid, int mask,
    mpegts_table_callback_t callback, void *opaque,
-   const char *name, int flags, int pid);
+   const char *name, int flags, int pid, int weight);
 void mpegts_table_flush_all
   (mpegts_mux_t *mm);
 void mpegts_table_destroy ( mpegts_table_t *mt );
index 7f487b839d18045754df912bb66b678ee36e8fe0..1411ca1d8b266f4eade0d97b37708121331d7c0b 100644 (file)
@@ -890,7 +890,7 @@ dvb_pat_callback
         s->s_dvb_check_seen = dispatch_clock;
         mpegts_table_add(mm, DVB_PMT_BASE, DVB_PMT_MASK, dvb_pmt_callback,
                          NULL, "pmt", MT_CRC | MT_QUICKREQ | MT_SCANSUBS,
-                         pid);
+                         pid, MPS_WEIGHT_PMT);
 
         if (save)
           service_request_save((service_t*)s, 1);
@@ -905,7 +905,8 @@ dvb_pat_callback
   /* Install NIT handler */
   if (nit_pid)
     mpegts_table_add(mm, DVB_NIT_BASE, DVB_NIT_MASK, dvb_nit_callback,
-                     NULL, "nit", MT_QUICKREQ | MT_CRC, nit_pid);
+                     NULL, "nit", MT_QUICKREQ | MT_CRC, nit_pid,
+                     MPS_WEIGHT_NIT);
 
   /* End */
   return dvb_table_end((mpegts_psi_table_t *)mt, st, sect);
@@ -2377,9 +2378,10 @@ psi_tables_default ( mpegts_mux_t *mm )
 {
   mpegts_table_add(mm, DVB_PAT_BASE, DVB_PAT_MASK, dvb_pat_callback,
                    NULL, "pat", MT_QUICKREQ | MT_CRC | MT_RECORD,
-                   DVB_PAT_PID);
+                   DVB_PAT_PID, MPS_WEIGHT_PAT);
   mpegts_table_add(mm, DVB_CAT_BASE, DVB_CAT_MASK, dvb_cat_callback,
-                   NULL, "cat", MT_QUICKREQ | MT_CRC, DVB_CAT_PID);
+                   NULL, "cat", MT_QUICKREQ | MT_CRC, DVB_CAT_PID,
+                   MPS_WEIGHT_CAT);
 }
 
 #if ENABLE_MPEGTS_DVB
@@ -2388,9 +2390,11 @@ psi_tables_dvb_fastscan( void *aux, bouquet_t *bq, const char *name, int pid )
 {
   tvhtrace("fastscan", "adding table %04X (%i) for '%s'", pid, pid, name);
   mpegts_table_add(aux, DVB_FASTSCAN_NIT_BASE, DVB_FASTSCAN_MASK,
-                   dvb_nit_callback, bq, "fs_nit", MT_CRC, pid);
+                   dvb_nit_callback, bq, "fs_nit", MT_CRC, pid,
+                   MPS_WEIGHT_NIT2);
   mpegts_table_add(aux, DVB_FASTSCAN_SDT_BASE, DVB_FASTSCAN_MASK,
-                   dvb_fs_sdt_callback, NULL, "fs_sdt", MT_CRC, pid);
+                   dvb_fs_sdt_callback, NULL, "fs_sdt", MT_CRC, pid,
+                   MPS_WEIGHT_SDT2);
 }
 #endif
 
@@ -2398,12 +2402,13 @@ void
 psi_tables_dvb ( mpegts_mux_t *mm )
 {
   mpegts_table_add(mm, DVB_NIT_BASE, DVB_NIT_MASK, dvb_nit_callback,
-                   NULL, "nit", MT_QUICKREQ | MT_CRC, DVB_NIT_PID);
+                   NULL, "nit", MT_QUICKREQ | MT_CRC, DVB_NIT_PID,
+                   MPS_WEIGHT_NIT);
   mpegts_table_add(mm, DVB_SDT_BASE, DVB_SDT_MASK, dvb_sdt_callback,
                    NULL, "sdt", MT_QUICKREQ | MT_CRC | MT_RECORD,
-                   DVB_SDT_PID);
+                   DVB_SDT_PID, MPS_WEIGHT_SDT);
   mpegts_table_add(mm, DVB_BAT_BASE, DVB_BAT_MASK, dvb_bat_callback,
-                   NULL, "bat", MT_CRC, DVB_BAT_PID);
+                   NULL, "bat", MT_CRC, DVB_BAT_PID, MPS_WEIGHT_BAT);
 #if ENABLE_MPEGTS_DVB
   if (idnode_is_instance(&mm->mm_id, &dvb_mux_dvbs_class)) {
     dvb_mux_conf_t *mc = &((dvb_mux_t *)mm)->lm_tuning;
@@ -2419,7 +2424,7 @@ psi_tables_atsc_c ( mpegts_mux_t *mm )
 {
   mpegts_table_add(mm, DVB_VCT_C_BASE, DVB_VCT_MASK, atsc_vct_callback,
                    NULL, "vct", MT_QUICKREQ | MT_CRC | MT_RECORD,
-                   DVB_VCT_PID);
+                   DVB_VCT_PID, MPS_WEIGHT_VCT);
 }
 
 void
@@ -2427,5 +2432,5 @@ psi_tables_atsc_t ( mpegts_mux_t *mm )
 {
   mpegts_table_add(mm, DVB_VCT_T_BASE, DVB_VCT_MASK, atsc_vct_callback,
                    NULL, "vct", MT_QUICKREQ | MT_CRC | MT_RECORD,
-                   DVB_VCT_PID);
+                   DVB_VCT_PID, MPS_WEIGHT_VCT);
 }
index 12e76e7002dedb9bf0e799b871e628a8c46ef5c2..baac4ef3402d71fb29af9862078e5684ef8b57e3 100644 (file)
@@ -415,12 +415,12 @@ linuxdvb_frontend_open_pid0
 
 static mpegts_pid_t *
 linuxdvb_frontend_open_pid
-  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner )
+  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner )
 {
   mpegts_pid_t *mp;
   linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)mi;
 
-  if (!(mp = mpegts_input_open_pid(mi, mm, pid, type, owner)))
+  if (!(mp = mpegts_input_open_pid(mi, mm, pid, type, weight, owner)))
     return NULL;
 
   linuxdvb_frontend_open_pid0(lfe, mp);
index 6821cc1f3a454916cbca8a8dee124eee3f97112a..46db8d6a101def2c81b53dbe632c313f16e950db 100644 (file)
@@ -409,20 +409,20 @@ mpegts_input_close_pids
       if (mps->mps_owner != owner) continue;
       pid = MPEGTS_FULLMUX_PID;
       if (mps->mps_type & MPS_TABLES) pid = MPEGTS_TABLES_PID;
-      mi->mi_close_pid(mi, mm, pid, mps->mps_type, mps->mps_owner);
+      mi->mi_close_pid(mi, mm, pid, mps->mps_type, mps->mps_weight, mps->mps_owner);
     }
   for (mp = RB_FIRST(&mm->mm_pids); mp; mp = mp_next) {
     mp_next = RB_NEXT(mp, mp_link);
     for (mps = RB_FIRST(&mp->mp_subs); mps; mps = mps_next) {
       mps_next = RB_NEXT(mps, mps_link);
       if (mps->mps_owner != owner) continue;
-      mi->mi_close_pid(mi, mm, mp->mp_pid, mps->mps_type, mps->mps_owner);
+      mi->mi_close_pid(mi, mm, mp->mp_pid, mps->mps_type, mps->mps_weight, mps->mps_owner);
     }
   }
 }
 mpegts_pid_t *
 mpegts_input_open_pid
-  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner )
+  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner )
 {
   char buf[512];
   mpegts_pid_t *mp;
@@ -440,8 +440,9 @@ mpegts_input_open_pid
 
   if ((mp = mpegts_mux_find_pid(mm, pid, 1))) {
     mps = calloc(1, sizeof(*mps));
-    mps->mps_type  = type;
-    mps->mps_owner = owner;
+    mps->mps_type   = type;
+    mps->mps_weight = weight;
+    mps->mps_owner  = owner;
     if (pid == MPEGTS_FULLMUX_PID || pid == MPEGTS_TABLES_PID) {
       mp->mp_type |= type;
       LIST_FOREACH(mps2, &mm->mm_all_subs, mps_svcraw_link)
@@ -469,7 +470,7 @@ mpegts_input_open_pid
 
 int
 mpegts_input_close_pid
-  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner )
+  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner )
 {
   char buf[512];
   mpegts_pid_sub_t *mps, skel;
@@ -496,8 +497,9 @@ mpegts_input_close_pid
       if (mps->mps_type & mask) break;
     if (mps) return 0;
   } else {
-    skel.mps_type  = type;
-    skel.mps_owner = owner;
+    skel.mps_type   = type;
+    skel.mps_weight = weight;
+    skel.mps_owner  = owner;
     mps = RB_FIND(&mp->mp_subs, &skel, mps_link, mpegts_mps_cmp);
     if (pid == mm->mm_last_pid) {
       mm->mm_last_pid = -1;
@@ -528,6 +530,18 @@ mpegts_input_close_pid
   return 0;
 }
 
+static int mps_weight(elementary_stream_t *st)
+{
+   if (SCT_ISVIDEO(st->es_type))
+     return MPS_WEIGHT_VIDEO + MIN(st->es_index, 49);
+   else if (SCT_ISAUDIO(st->es_type))
+     return MPS_WEIGHT_AUDIO + MIN(st->es_index, 49);
+   else if (SCT_ISSUBTITLE(st->es_type))
+     return MPS_WEIGHT_SUBTITLE + MIN(st->es_index, 49);
+   else
+     return MPS_WEIGHT_ESOTHER + MIN(st->es_index, 49);
+}
+
 void
 mpegts_input_open_service ( mpegts_input_t *mi, mpegts_service_t *s, int flags, int init )
 {
@@ -550,15 +564,15 @@ mpegts_input_open_service ( mpegts_input_t *mi, mpegts_service_t *s, int flags,
 
     pids = mpegts_pid_alloc();
 
-    mi->mi_open_pid(mi, mm, s->s_pmt_pid, MPS_SERVICE, s);
-    mi->mi_open_pid(mi, mm, s->s_pcr_pid, MPS_SERVICE, s);
+    mi->mi_open_pid(mi, mm, s->s_pmt_pid, MPS_SERVICE, MPS_WEIGHT_PMT, s);
+    mi->mi_open_pid(mi, mm, s->s_pcr_pid, MPS_SERVICE, MPS_WEIGHT_PCR, s);
     mpegts_pid_add(pids, s->s_pmt_pid);
     mpegts_pid_add(pids, s->s_pcr_pid);
     /* Open only filtered components here */
     TAILQ_FOREACH(st, &s->s_filt_components, es_filt_link)
       if (st->es_type != SCT_CA) {
         st->es_pid_opened = 1;
-        mi->mi_open_pid(mi, mm, st->es_pid, MPS_SERVICE, s);
+        mi->mi_open_pid(mi, mm, st->es_pid, MPS_SERVICE, mps_weight(st), s);
       }
 
     /* Ensure that filtered PIDs are not send in ts_recv_raw */
@@ -577,15 +591,15 @@ mpegts_input_open_service ( mpegts_input_t *mi, mpegts_service_t *s, int flags,
   } else {
     if ((pids = s->s_pids) != NULL) {
       if (pids->all) {
-        mi->mi_open_pid(mi, mm, MPEGTS_FULLMUX_PID, MPS_RAW | MPS_ALL, s);
+        mi->mi_open_pid(mi, mm, MPEGTS_FULLMUX_PID, MPS_RAW | MPS_ALL, MPS_WEIGHT_RAW, s);
       } else {
         for (i = 0; i < pids->count; i++)
-          mi->mi_open_pid(mi, mm, pids->pids[i], MPS_RAW, s);
+          mi->mi_open_pid(mi, mm, pids->pids[i], MPS_RAW, MPS_WEIGHT_RAW, s);
       }
     } else if (flags & SUBSCRIPTION_TABLES) {
-      mi->mi_open_pid(mi, mm, MPEGTS_TABLES_PID, MPS_RAW | MPS_TABLES, s);
+      mi->mi_open_pid(mi, mm, MPEGTS_TABLES_PID, MPS_RAW | MPS_TABLES, MPS_WEIGHT_PAT, s);
     } else if (flags & SUBSCRIPTION_MINIMAL) {
-      mi->mi_open_pid(mi, mm, DVB_PAT_PID, MPS_RAW, s);
+      mi->mi_open_pid(mi, mm, DVB_PAT_PID, MPS_RAW, MPS_WEIGHT_PAT, s);
     }
   }
 
@@ -597,7 +611,7 @@ mpegts_input_open_service ( mpegts_input_t *mi, mpegts_service_t *s, int flags,
     s->s_pmt_mon =
       mpegts_table_add(mm, DVB_PMT_BASE, DVB_PMT_MASK,
                        dvb_pmt_callback, s, "pmt",
-                       MT_CRC, s->s_pmt_pid);
+                       MT_CRC, s->s_pmt_pid, MPS_WEIGHT_PMT);
   }
 }
 
@@ -627,15 +641,15 @@ mpegts_input_close_service ( mpegts_input_t *mi, mpegts_service_t *s )
 
     pids = mpegts_pid_alloc();
 
-    mi->mi_close_pid(mi, mm, s->s_pmt_pid, MPS_SERVICE, s);
-    mi->mi_close_pid(mi, mm, s->s_pcr_pid, MPS_SERVICE, s);
+    mi->mi_close_pid(mi, mm, s->s_pmt_pid, MPS_SERVICE, MPS_WEIGHT_PMT, s);
+    mi->mi_close_pid(mi, mm, s->s_pcr_pid, MPS_SERVICE, MPS_WEIGHT_PCR, s);
     mpegts_pid_del(pids, s->s_pmt_pid);
     mpegts_pid_del(pids, s->s_pcr_pid);
     /* Close all opened PIDs (the component filter may be changed at runtime) */
     TAILQ_FOREACH(st, &s->s_components, es_link) {
       if (st->es_pid_opened) {
         st->es_pid_opened = 0;
-        mi->mi_close_pid(mi, mm, st->es_pid, MPS_SERVICE, s);
+        mi->mi_close_pid(mi, mm, st->es_pid, MPS_SERVICE, mps_weight(st), s);
       }
       if (st->es_pid >= 0 && st->es_pid < 8192)
         mpegts_pid_del(pids, st->es_pid);
@@ -963,7 +977,7 @@ mpegts_input_table_waiting ( mpegts_input_t *mi, mpegts_mux_t *mm )
       if (!mt->mt_subscribed) {
         mt->mt_subscribed = 1;
         pthread_mutex_unlock(&mm->mm_tables_lock);
-        mi->mi_open_pid(mi, mm, mt->mt_pid, mpegts_table_type(mt), mt);
+        mi->mi_open_pid(mi, mm, mt->mt_pid, mpegts_table_type(mt), mt->mt_weight, mt);
       } else {
         pthread_mutex_unlock(&mm->mm_tables_lock);
       }
@@ -972,7 +986,7 @@ mpegts_input_table_waiting ( mpegts_input_t *mi, mpegts_mux_t *mm )
       if (mt->mt_subscribed) {
         mt->mt_subscribed = 0;
         pthread_mutex_unlock(&mm->mm_tables_lock);
-        mi->mi_close_pid(mi, mm, mt->mt_pid, mpegts_table_type(mt), mt);
+        mi->mi_close_pid(mi, mm, mt->mt_pid, mpegts_table_type(mt), mt->mt_weight, mt);
       } else {
         pthread_mutex_unlock(&mm->mm_tables_lock);
       }
index 678ad7eda8fce06f3f16901a3bfca3f2486a82d2..fb0db5a69bca1227884f8e0d6beb6426c8766d81 100644 (file)
@@ -810,7 +810,7 @@ mpegts_mux_open_table ( mpegts_mux_t *mm, mpegts_table_t *mt, int subscribe )
     mt->mt_subscribed = 1;
     pthread_mutex_unlock(&mm->mm_tables_lock);
     pthread_mutex_lock(&mi->mi_output_lock);
-    mi->mi_open_pid(mi, mm, mt->mt_pid, mpegts_table_type(mt), mt);
+    mi->mi_open_pid(mi, mm, mt->mt_pid, mpegts_table_type(mt), mt->mt_weight, mt);
     pthread_mutex_unlock(&mi->mi_output_lock);
     pthread_mutex_lock(&mm->mm_tables_lock);
     mpegts_table_release(mt);
@@ -860,7 +860,7 @@ mpegts_mux_close_table ( mpegts_mux_t *mm, mpegts_table_t *mt )
     mt->mt_subscribed = 0;
     pthread_mutex_unlock(&mm->mm_tables_lock);
     pthread_mutex_lock(&mi->mi_output_lock);
-    mi->mi_close_pid(mi, mm, mt->mt_pid, mpegts_table_type(mt), mt);
+    mi->mi_close_pid(mi, mm, mt->mt_pid, mpegts_table_type(mt), mt->mt_weight, mt);
     pthread_mutex_unlock(&mi->mi_output_lock);
     pthread_mutex_lock(&mm->mm_tables_lock);
     mpegts_table_release(mt);
index bb27255b077b507b954716e91531ba1631f3a80c..c781ff0781d0d48377664b45bc7421f5cbe3c21e 100644 (file)
@@ -750,20 +750,20 @@ mpegts_service_raw_update_pids(mpegts_service_t *t, mpegts_apids_t *pids)
     x = t->s_pids;
     t->s_pids = p;
     if (!pids->all && x && x->all) {
-      mi->mi_close_pid(mi, mm, MPEGTS_FULLMUX_PID, MPS_RAW, t);
+      mi->mi_close_pid(mi, mm, MPEGTS_FULLMUX_PID, MPS_RAW, MPS_WEIGHT_RAW, t);
       mpegts_input_close_pids(mi, mm, t, 1);
       for (i = 0; i < x->count; i++)
-        mi->mi_open_pid(mi, mm, x->pids[i], MPS_RAW, t);
+        mi->mi_open_pid(mi, mm, x->pids[i], MPS_RAW, MPS_WEIGHT_RAW, t);
     } else {
       if (pids->all) {
         mpegts_input_close_pids(mi, mm, t, 1);
-        mi->mi_open_pid(mi, mm, MPEGTS_FULLMUX_PID, MPS_RAW, t);
+        mi->mi_open_pid(mi, mm, MPEGTS_FULLMUX_PID, MPS_RAW, MPS_WEIGHT_RAW, t);
       } else {
         mpegts_pid_compare(p, x, &add, &del);
         for (i = 0; i < del.count; i++)
-          mi->mi_close_pid(mi, mm, del.pids[i], MPS_RAW, t);
+          mi->mi_close_pid(mi, mm, del.pids[i], MPS_RAW, MPS_WEIGHT_RAW, t);
         for (i = 0; i < add.count; i++)
-          mi->mi_open_pid(mi, mm, add.pids[i], MPS_RAW, t);
+          mi->mi_open_pid(mi, mm, add.pids[i], MPS_RAW, MPS_WEIGHT_RAW, t);
         mpegts_pid_done(&add);
         mpegts_pid_done(&del);
       }
index ed0e7f7df6a6a18a522666e16505781d3c13bd69..d3163f64d5de3a08b43c89498f77dc2c66663d52 100644 (file)
@@ -166,7 +166,7 @@ mpegts_table_t *
 mpegts_table_add
   ( mpegts_mux_t *mm, int tableid, int mask,
     mpegts_table_callback_t callback, void *opaque,
-    const char *name, int flags, int pid )
+    const char *name, int flags, int pid, int weight )
 {
   mpegts_table_t *mt;
   int subscribe = 1;
@@ -182,6 +182,7 @@ mpegts_table_add
         continue;
       mt->mt_callback   = callback;
       mt->mt_pid        = pid;
+      mt->mt_weight     = weight;
       mt->mt_table      = tableid;
       mm->mm_open_table(mm, mt, 1);
     } else if (pid >= 0) {
@@ -209,6 +210,7 @@ mpegts_table_add
   mt->mt_callback   = callback;
   mt->mt_opaque     = opaque;
   mt->mt_pid        = pid;
+  mt->mt_weight     = weight;
   mt->mt_flags      = flags & ~(MT_SKIPSUBS|MT_SCANSUBS);
   mt->mt_table      = tableid;
   mt->mt_mask       = mask;
index 26c0411b613159f80ab2ce5caa8dd1327232a07c..48fda65eb6a773deabd5fa910680953ff008029b 100644 (file)
@@ -548,14 +548,14 @@ satip_frontend_add_pid( satip_frontend_t *lfe, int pid)
 
 static mpegts_pid_t *
 satip_frontend_open_pid
-  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner )
+  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner )
 {
   satip_frontend_t *lfe = (satip_frontend_t*)mi;
   satip_tune_req_t *tr;
   mpegts_pid_t *mp;
   int change = 0;
 
-  if (!(mp = mpegts_input_open_pid(mi, mm, pid, type, owner)))
+  if (!(mp = mpegts_input_open_pid(mi, mm, pid, type, weight, owner)))
     return NULL;
 
   if (mp->mp_pid > MPEGTS_FULLMUX_PID)
@@ -590,13 +590,13 @@ satip_frontend_open_pid
 
 static int
 satip_frontend_close_pid
-  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner )
+  ( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner )
 {
   satip_frontend_t *lfe = (satip_frontend_t*)mi;
   satip_tune_req_t *tr;
   int change = 0, r;
 
-  if ((r = mpegts_input_close_pid(mi, mm, pid, type, owner)) <= 0)
+  if ((r = mpegts_input_close_pid(mi, mm, pid, type, weight, owner)) <= 0)
     return r;
 
   /* Skip internal PIDs */
index 77860007499a6352e82c58c749055dd632211942..2780ca38a8ce81ad28b4120413170df68f573d69 100644 (file)
@@ -25,7 +25,7 @@
 
 static void tvhdhomerun_device_open_pid(tvhdhomerun_frontend_t *hfe, mpegts_pid_t *mp);
 
-static mpegts_pid_t * tvhdhomerun_frontend_open_pid( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner );
+static mpegts_pid_t * tvhdhomerun_frontend_open_pid( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner );
 
 static int
 tvhdhomerun_frontend_get_weight ( mpegts_input_t *mi, mpegts_mux_t *mm, int flags )
@@ -469,14 +469,14 @@ tvhdhomerun_frontend_stop_mux
   gtimer_arm(&hfe->hf_monitor_timer, tvhdhomerun_frontend_monitor_cb, hfe, 2);
 }
 
-static mpegts_pid_t *tvhdhomerun_frontend_open_pid( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner )
+static mpegts_pid_t *tvhdhomerun_frontend_open_pid( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner )
 {
   tvhdhomerun_frontend_t *hfe = (tvhdhomerun_frontend_t*)mi;
   mpegts_pid_t *mp;
 
   //tvhdebug("tvhdhomerun", "Open pid 0x%x\n", pid);
 
-  if (!(mp = mpegts_input_open_pid(mi, mm, pid, type, owner))) {
+  if (!(mp = mpegts_input_open_pid(mi, mm, pid, type, weight, owner))) {
     tvhdebug("tvhdhomerun", "Failed to open pid %d", pid);
     return NULL;
   }
@@ -486,13 +486,13 @@ static mpegts_pid_t *tvhdhomerun_frontend_open_pid( mpegts_input_t *mi, mpegts_m
   return mp;
 }
 
-static int tvhdhomerun_frontend_close_pid( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, void *owner )
+static int tvhdhomerun_frontend_close_pid( mpegts_input_t *mi, mpegts_mux_t *mm, int pid, int type, int weight, void *owner )
 {
   //tvhdhomerun_frontend_t *hfe = (tvhdhomerun_frontend_t*)mi;
 
   tvhdebug("tvhdhomerun", "closing pid 0x%x",pid);
 
-  return mpegts_input_close_pid(mi, mm, pid, type, owner);
+  return mpegts_input_close_pid(mi, mm, pid, type, weight, owner);
 
   //tvhdhomerun_device_update_pid_filter(hfe, mm);
 }