]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
globalheaders: add restart support to gh_pass()
authorJaroslav Kysela <perex@perex.cz>
Wed, 17 Sep 2014 07:00:22 +0000 (09:00 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 17 Sep 2014 07:00:22 +0000 (09:00 +0200)
src/plumbing/globalheaders.c

index 4710f5602610edb283e3662864a6cd2a96927102..6e23fbc7da2d88f1554f7069df2f766f252ab178 100644 (file)
@@ -44,15 +44,15 @@ typedef struct globalheaders {
 static void
 gh_flush(globalheaders_t *gh)
 {
-  if(gh->gh_ss != NULL)
+  if(gh->gh_ss != NULL) {
     streaming_start_unref(gh->gh_ss);
-  gh->gh_ss = NULL;
+    gh->gh_ss = NULL;
+  }
 
   pktref_clear_queue(&gh->gh_holdq);
 }
 
 
-
 /**
  *
  */
@@ -208,7 +208,7 @@ gh_hold(globalheaders_t *gh, streaming_message_t *sm)
     assert(ssc != NULL);
 
     if(ssc->ssc_type == SCT_TELETEXT) {
-      free(sm);
+      streaming_msg_free(sm);
       ssc->ssc_disabled = 1;
       break;
     }
@@ -278,7 +278,13 @@ gh_pass(globalheaders_t *gh, streaming_message_t *sm)
 
   switch(sm->sm_type) {
   case SMT_START:
-    abort(); // Should not happen
+    /* stop */
+    gh->gh_passthru = 0;
+    gh_flush(gh);
+    /* restart */
+    gh->gh_ss = streaming_start_copy(sm->sm_data);
+    streaming_msg_free(sm);
+    break;
     
   case SMT_STOP:
     gh->gh_passthru = 0;
@@ -348,4 +354,3 @@ globalheaders_destroy(streaming_target_t *pad)
   gh_flush(gh);
   free(gh);
 }
-