]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
linuxdvb: do not monitor frontend in the diseqc/rotor setup
authorJaroslav Kysela <perex@perex.cz>
Sun, 27 Jul 2014 18:45:53 +0000 (20:45 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 4 Aug 2014 15:19:04 +0000 (17:19 +0200)
Also, move the active mux check outside tune0() function to
ensure, that the linux frontend is set again to requested
parameters (to be sure).

src/input/mpegts/linuxdvb/linuxdvb_frontend.c
src/input/mpegts/linuxdvb/linuxdvb_private.h

index 1a8adf95bde4a888cd8772b5f1c9f05695a31242..c69ae165e5957547747b49fd76227aba5556af35 100644 (file)
@@ -285,6 +285,7 @@ linuxdvb_frontend_stop_mux
   }
 
   /* Not locked */
+  lfe->lfe_ready  = 0;
   lfe->lfe_locked = 0;
   lfe->lfe_status = 0;
 
@@ -299,7 +300,21 @@ static int
 linuxdvb_frontend_start_mux
   ( mpegts_input_t *mi, mpegts_mux_instance_t *mmi )
 {
-  linuxdvb_frontend_t *lfe = (linuxdvb_frontend_t*)mi;
+  linuxdvb_frontend_t   *lfe = (linuxdvb_frontend_t*)mi;
+  mpegts_mux_instance_t *cur = LIST_FIRST(&lfe->mi_mux_active);
+
+  /* Currently active */
+  if (cur != NULL) {
+
+    /* Already tuned */
+    if (mmi == cur)
+      return 0;
+
+    /* Stop current */
+    cur->mmi_mux->mm_stop(cur->mmi_mux, 1);
+  }
+  assert(LIST_FIRST(&lfe->mi_mux_active) == NULL);
+
   if (lfe->lfe_satconf)
     return linuxdvb_satconf_start_mux(lfe->lfe_satconf, mmi);
   return linuxdvb_frontend_tune1((linuxdvb_frontend_t*)mi, mmi, -1);
@@ -471,7 +486,7 @@ linuxdvb_frontend_monitor ( void *aux )
   }
 
   /* Stop timer */
-  if (!mmi) return;
+  if (!mmi || !lfe->lfe_ready) return;
 
   /* re-arm */
   gtimer_arm(&lfe->lfe_monitor_timer, linuxdvb_frontend_monitor, lfe, 1);
@@ -1045,24 +1060,10 @@ linuxdvb_frontend_tune0
   int r;
   struct dvb_frontend_event ev;
   char buf1[256];
-  mpegts_mux_instance_t *cur = LIST_FIRST(&lfe->mi_mux_active);
   dvb_mux_t *lm = (dvb_mux_t*)mmi->mmi_mux;
   dvb_mux_conf_t *dmc;
   struct dvb_frontend_parameters p;
 
-  // Not sure if this is right place?
-  /* Currently active */
-  if (cur != NULL) {
-
-    /* Already tuned */
-    if (mmi == cur)
-      return 0;
-
-    /* Stop current */
-    cur->mmi_mux->mm_stop(cur->mmi_mux, 1);
-  }
-  assert(LIST_FIRST(&lfe->mi_mux_active) == NULL);
-
   /* Open FE */
   lfe->mi_display_name((mpegts_input_t*)lfe, buf1, sizeof(buf1));
   if (lfe->lfe_fe_fd <= 0) {
@@ -1246,6 +1247,7 @@ linuxdvb_frontend_tune1
     time(&lfe->lfe_monitor);
     lfe->lfe_monitor += 4;
     gtimer_arm_ms(&lfe->lfe_monitor_timer, linuxdvb_frontend_monitor, lfe, 50);
+    lfe->lfe_ready = 1;
   }
   
   return r;
index 4089ca14d4c690e1af3cb1160a94d9080aeb1bb0..9ed675b3640bb83ef80cb7f2775b9f1f261dfab6 100644 (file)
@@ -98,6 +98,7 @@ struct linuxdvb_frontend
   /*
    * Tuning
    */
+  int                       lfe_ready;
   int                       lfe_locked;
   int                       lfe_status;
   int                       lfe_ioctls;