]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Re-instance signalStatus HTSP message using new streaming message.
authorAdam Sutton <dev@adamsutton.me.uk>
Fri, 21 Sep 2012 20:15:58 +0000 (21:15 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Fri, 21 Sep 2012 20:15:58 +0000 (21:15 +0100)
src/dvb/dvb_fe.c
src/dvr/dvr_rec.c
src/htsp.c
src/plumbing/globalheaders.c
src/plumbing/tsfix.c
src/streaming.c
src/tvheadend.h
src/webui/webui.c

index 25da835a661599e3536ea12aa85392830abc6766..97536abe33e89a8556b78e3cc3c4b16b575944b4 100644 (file)
@@ -39,6 +39,8 @@
 #include "diseqc.h"
 #include "notify.h"
 #include "dvr/dvr.h"
+#include "service.h"
+#include "streaming.h"
 
 #include "epggrab.h"
 
@@ -91,6 +93,9 @@ dvb_fe_monitor(void *aux)
   int status, v, update = 0, vv, i, fec, q;
   th_dvb_mux_instance_t *tdmi = tda->tda_mux_current;
   char buf[50];
+  signal_status_t sigstat;
+  streaming_message_t sm;
+  struct service *t;
 
   gtimer_arm(&tda->tda_fe_monitor_timer, dvb_fe_monitor, tda, 1);
 
@@ -194,6 +199,22 @@ dvb_fe_monitor(void *aux)
 
     dvb_mux_save(tdmi);
   }
+
+  /* Streaming message */
+  sigstat.status_text = dvb_mux_status(tdmi);
+  sigstat.snr         = tdmi->tdmi_snr;
+  sigstat.signal      = tdmi->tdmi_signal;
+  sigstat.ber         = tdmi->tdmi_ber;
+  sigstat.unc         = tdmi->tdmi_uncorrected_blocks;
+  sm.sm_type = SMT_SIGNAL_STATUS;
+  sm.sm_data = &sigstat;
+  LIST_FOREACH(t, &tda->tda_transports, s_active_link)
+    if(t->s_dvb_mux_instance == tda->tda_mux_current && t->s_status == SERVICE_RUNNING ) {
+      pthread_mutex_lock(&t->s_stream_mutex);
+      streaming_pad_deliver(&t->s_streaming_pad, &sm);
+      pthread_mutex_unlock(&t->s_stream_mutex);
+    }
+
 }
 
 
index 1dd0d57a3ba253563ec88e3cba9de5d222a77c3d..9ba9e10323aa89843e68757fbe8f4e4688ed0f49 100755 (executable)
@@ -516,6 +516,9 @@ dvr_thread(void *aux)
       }
       break;
 
+    case SMT_SIGNAL_STATUS:
+      break;
+
     case SMT_EXIT:
       run = 0;
       break;
index 0fc0259b786eb44ad68917eaef42aaf3644516ad..91011c27773be2cf03255d69cbe17a2a4960dfdf 100644 (file)
@@ -1915,6 +1915,27 @@ htsp_subscription_service_status(htsp_subscription_t *hs, int status)
   }
 }
 
+/**
+ *
+ */
+static void
+htsp_subscription_signal_status(htsp_subscription_t *hs, signal_status_t *sig)
+{
+  htsmsg_t *m = htsmsg_create_map();
+  htsmsg_add_str(m, "method", "signalStatus");
+  htsmsg_add_u32(m, "subscriptionId", hs->hs_sid);
+  htsmsg_add_str(m, "feStatus",   sig->status_text);
+  if(sig->snr != -2)
+    htsmsg_add_u32(m, "feSNR",    sig->snr);
+  if(sig->signal != -2)
+    htsmsg_add_u32(m, "feSignal", sig->signal);
+  if(sig->ber != -2)
+    htsmsg_add_u32(m, "feBER",    sig->ber);
+  if(sig->unc != -2)
+    htsmsg_add_u32(m, "feUNC",    sig->unc);
+  htsp_send_message(hs->hs_htsp, m, &hs->hs_htsp->htsp_hmq_qstatus);
+}
+
 /**
  *
  */
@@ -1941,6 +1962,10 @@ htsp_streaming_input(void *opaque, streaming_message_t *sm)
     htsp_subscription_service_status(hs, sm->sm_code);
     break;
 
+  case SMT_SIGNAL_STATUS:
+    htsp_subscription_signal_status(hs, sm->sm_data);
+    break;
+
   case SMT_NOSTART:
     htsp_subscription_status(hs,  streaming_code2txt(sm->sm_code));
     break;
index 62a8315f92c6aa5483394244ad67ce35bac80ddd..d776f34c858539f82fa5a86d38d0ba9e17e7bded 100644 (file)
@@ -252,6 +252,7 @@ gh_hold(globalheaders_t *gh, streaming_message_t *sm)
 
   case SMT_EXIT:
   case SMT_SERVICE_STATUS:
+  case SMT_SIGNAL_STATUS:
   case SMT_NOSTART:
   case SMT_MPEGTS:
     streaming_target_deliver2(gh->gh_output, sm);
@@ -279,6 +280,7 @@ gh_pass(globalheaders_t *gh, streaming_message_t *sm)
     // FALLTHRU
   case SMT_EXIT:
   case SMT_SERVICE_STATUS:
+  case SMT_SIGNAL_STATUS:
   case SMT_NOSTART:
   case SMT_MPEGTS:
     streaming_target_deliver2(gh->gh_output, sm);
index 9bd26338f0688b0ff647dbf579346c3c0958f15d..d04e610db1f33de71cd6709eceddc167fc862b35 100644 (file)
@@ -363,6 +363,7 @@ tsfix_input(void *opaque, streaming_message_t *sm)
 
   case SMT_EXIT:
   case SMT_SERVICE_STATUS:
+  case SMT_SIGNAL_STATUS:
   case SMT_NOSTART:
   case SMT_MPEGTS:
     break;
index cb74b054545cbf96cfda9bd5b620778b5e25eb61..ea564dae2af40e872557d4c806ce112af9bf226d 100755 (executable)
@@ -182,6 +182,11 @@ streaming_msg_clone(streaming_message_t *src)
     atomic_add(&ss->ss_refcount, 1);
     break;
 
+  case SMT_SIGNAL_STATUS:
+    dst->sm_data = malloc(sizeof(signal_status_t));
+    memcpy(dst->sm_data, src->sm_data, sizeof(signal_status_t));
+    break;
+
   case SMT_STOP:
   case SMT_SERVICE_STATUS:
   case SMT_NOSTART:
@@ -250,6 +255,7 @@ streaming_msg_free(streaming_message_t *sm)
   case SMT_NOSTART:
     break;
 
+  case SMT_SIGNAL_STATUS:
   case SMT_MPEGTS:
     free(sm->sm_data);
     break;
index 1d8cc9f6a758a24a2cc198c7774d3cb4a527f4b2..f7bb0f7e1434e0cc9ef7f842e332d0e2acc8e384 100644 (file)
@@ -235,6 +235,13 @@ typedef enum {
    */
   SMT_SERVICE_STATUS,
 
+  /**
+   * Signal status
+   *
+   * Notification about frontend signal status
+   */
+  SMT_SIGNAL_STATUS,
+
   /**
    * Streaming stop.
    *
index 78b92bad9fff3dc6e4eff969008213c03ae9e834..6c1041e763d1ffe332d4a467f0e0ee02404a4b3f 100644 (file)
@@ -222,6 +222,9 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq,
       }
       break;
 
+    case SMT_SIGNAL_STATUS:
+      break;
+
     case SMT_NOSTART:
       tvhlog(LOG_DEBUG, "webui",  "Couldn't start stream for %s", hc->hc_url_orig);
       run = 0;