]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
linuxdvb: add proper support for multiple frontends in one adapter directory
authorJaroslav Kysela <perex@perex.cz>
Sat, 30 May 2015 20:06:06 +0000 (22:06 +0200)
committerJaroslav Kysela <perex@perex.cz>
Sat, 30 May 2015 20:06:06 +0000 (22:06 +0200)
src/input/mpegts/linuxdvb/linuxdvb_adapter.c
src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/linuxdvb/linuxdvb_private.h

index 4c59350233a73729f91bc16a7a83576dc984ed84..6f80e55a15cbf7eeff5cafdafed727ccfa07ba35 100644 (file)
@@ -453,11 +453,22 @@ linuxdvb_adapter_add ( const char *path )
   memset(fetypes, 0, sizeof(fetypes));
   LIST_FOREACH(lfe, &la->la_frontends, lfe_link)
     fetypes[lfe->lfe_type]++;
-  for (i = 0; i < ARRAY_SIZE(fetypes); i++)
+  for (i = j = r = 0; i < ARRAY_SIZE(fetypes); i++) {
     if (fetypes[i] > 1)
-      tvhwarn("linuxdvb", "adapter %d has multiple tuners %d for type %s, "
-                          "only one can be used at a time",
-                          a, fetypes[i], dvb_type2str(i));
+      r++;
+    else if (fetypes[i] > 0)
+      j++;
+  }
+  if (r && j) {
+    la->la_exclusive = 1;
+    for (i = 0; i < ARRAY_SIZE(fetypes); i++)
+      if (fetypes[i] > 0)
+        tvhwarn("linuxdvb", "adapter %d has tuner count %d for type %s (wrong config)",
+                            a, fetypes[i], dvb_type2str(i));
+  } else if (!r && j > 1) {
+    la->la_exclusive = 1;
+    tvhinfo("linuxdvb", "adapter %d setting exlusive flag", a);
+  }
 #endif
 
   /* Save configuration */
index 60f7f196f6dd9260780274df7dcf9099ec9adb67..8d2dd4dcacdb842da97ee3a3550e31f43953a85e 100644 (file)
@@ -271,8 +271,12 @@ linuxdvb_frontend_get_weight ( mpegts_input_t *mi, mpegts_mux_t *mm, int flags )
   int weight = 0;
   linuxdvb_adapter_t *la = ((linuxdvb_frontend_t*)mi)->lfe_adapter;
   linuxdvb_frontend_t *lfe;
-  LIST_FOREACH(lfe, &la->la_frontends, lfe_link)
-    weight = MAX(weight, mpegts_input_get_weight((mpegts_input_t*)lfe, mm, flags));
+  if (la->la_exclusive) {
+    LIST_FOREACH(lfe, &la->la_frontends, lfe_link)
+      weight = MAX(weight, mpegts_input_get_weight((mpegts_input_t*)lfe, mm, flags));
+  } else {
+    weight = mpegts_input_get_weight(mi, mm, flags);
+  }
   return weight;
 }
 
index 6ba2cf694cddaa90871b3a25f5993444439cc69d..291447e2035f04984f8c5cd4f8302c898dd254c1 100644 (file)
@@ -78,6 +78,7 @@ struct linuxdvb_adapter
   char    *la_name;
   char    *la_rootpath;
   int      la_dvb_number;
+  int      la_exclusive; /* one frontend at a time */
 
   /*
    * Frontends