]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
htsp_server: implement subscriptionGrace message
authorJaroslav Kysela <perex@perex.cz>
Tue, 12 Aug 2014 08:02:59 +0000 (10:02 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 12 Aug 2014 08:02:59 +0000 (10:02 +0200)
src/htsp_server.c

index d029a5e28e1e34e41df7517ec5be2966fb603908..f914c5a69a3eb3de4d682f9e22b2c48fd1bec555 100644 (file)
@@ -2774,6 +2774,21 @@ htsp_subscription_stop(htsp_subscription_t *hs, const char *err)
   htsp_send(hs->hs_htsp, m, NULL, &hs->hs_q, 0);
 }
 
+/**
+ * Send a 'subscriptionGrace' message
+ */
+static void
+htsp_subscription_grace(htsp_subscription_t *hs, int grace)
+{
+  htsmsg_t *m = htsmsg_create_map();
+  htsmsg_add_str(m, "method", "subscriptionGrace");
+  htsmsg_add_u32(m, "subscriptionId", hs->hs_sid);
+  htsmsg_add_u32(m, "graceTimeout", grace);
+  tvhdebug("htsp", "%s - subscription grace %i seconds", hs->hs_htsp->htsp_logname, grace);
+
+  htsp_send(hs->hs_htsp, m, NULL, &hs->hs_q, 0);
+}
+
 /**
  * Send a 'subscriptionStatus' message
  */
@@ -2912,6 +2927,10 @@ htsp_streaming_input(void *opaque, streaming_message_t *sm)
     htsp_subscription_stop(hs, streaming_code2txt(sm->sm_code));
     break;
 
+  case SMT_GRACE:
+    htsp_subscription_grace(hs, sm->sm_code);
+    break;
+
   case SMT_SERVICE_STATUS:
     htsp_subscription_service_status(hs, sm->sm_code);
     break;
@@ -2924,7 +2943,6 @@ htsp_streaming_input(void *opaque, streaming_message_t *sm)
     htsp_subscription_status(hs,  streaming_code2txt(sm->sm_code));
     break;
 
-  case SMT_GRACE:
   case SMT_MPEGTS:
     break;