]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
timeshift: do not save TELETEXT packets (configurable), fixes #4166
authorJaroslav Kysela <perex@perex.cz>
Mon, 9 Jan 2017 15:18:25 +0000 (16:18 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 9 Jan 2017 15:18:25 +0000 (16:18 +0100)
src/timeshift.c
src/timeshift.h
src/timeshift/private.h
src/timeshift/timeshift_writer.c

index 4e5de790f497dcb80421818f59e185213366040f..a36b2c6effc42dfa9bcb81596f1de1589165031f 100644 (file)
@@ -287,6 +287,15 @@ const idclass_t timeshift_conf_class = {
       .off    = offsetof(timeshift_conf_t, ram_fit),
       .opts   = PO_EXPERT,
     },
+    {
+      .type   = PT_BOOL,
+      .id     = "teletext",
+      .name   = N_("Include teletext"),
+      .desc   = N_("Include the teletext stream to the timeshift buffer. It may cause "
+                   "issues for channels where the teletext DTS is invalid."),
+      .off    = offsetof(timeshift_conf_t, teletext),
+      .opts   = PO_EXPERT,
+    },
     {}
   }
 };
index 1252bfa054eaab29c6cc082bd62432866fac0ad7..27e313d43601c561f9d4cbc8854637898e681ce2 100644 (file)
@@ -37,6 +37,7 @@ typedef struct timeshift_conf {
   uint64_t  total_ram_size;
   int       ram_only;
   int       ram_fit;
+  int       teletext;
 } timeshift_conf_t;
 
 extern struct timeshift_conf timeshift_conf;
index fe496df926a7f894fe17f016fba1dab4bc1fe947..416e30c8c835234ec25f33da8a4e96af83edac88 100644 (file)
@@ -131,6 +131,7 @@ typedef struct timeshift {
   int                         file_segments; ///< Count of segments in files
 
   int                         vididx;     ///< Index of (current) video stream
+  int                         teletextidx; ///< Index of (current) teletext stream
 
   streaming_start_t          *smt_start;  ///< Streaming start info
 
index c300ee6e5bb64745867edff8f272e167a25a04f3..24fb458f8b6bb28d4daf3d3edce4231a926a593f 100644 (file)
@@ -249,6 +249,12 @@ static void _update_smt_start ( timeshift_t *ts, streaming_start_t *ss )
       ts->vididx = ss->ss_components[i].ssc_index;
       break;
     }
+  /* Update teletext index */
+  for (i = 0; i < ss->ss_num_components; i++)
+    if (ss->ss_components[i].ssc_type == SCT_TELETEXT) {
+      ts->teletextidx = ss->ss_components[i].ssc_index;
+      break;
+    }
 }
 
 /*
@@ -313,8 +319,9 @@ static inline ssize_t _process_msg0
 static void _process_msg
   ( timeshift_t *ts, streaming_message_t *sm, int *run )
 {
-  int err;
+  int err, teletext = 0;
   timeshift_file_t *tsf;
+  th_pkt_t *pkt;
 
   /* Process */
   switch (sm->sm_type) {
@@ -343,12 +350,18 @@ static void _process_msg
       goto live;
 
     /* Store */
+    case SMT_PACKET:
+      if (timeshift_conf.teletext && sm->sm_type == SMT_PACKET) {
+        pkt = sm->sm_data;
+        teletext = pkt->pkt_componentindex == ts->teletextidx;
+      }
+      /* fall thru */
     case SMT_SIGNAL_STATUS:
     case SMT_START:
     case SMT_MPEGTS:
-    case SMT_PACKET:
       pthread_mutex_lock(&ts->state_mutex);
-      ts->buf_time = sm->sm_time;
+      if (!teletext) /* do not use time from teletext packets */
+        ts->buf_time = sm->sm_time;
       if (ts->state == TS_LIVE) {
         streaming_target_deliver2(ts->output, streaming_msg_clone(sm));
         if (sm->sm_type == SMT_PACKET)
@@ -357,6 +370,8 @@ static void _process_msg
       if (sm->sm_type == SMT_START)
         _update_smt_start(ts, (streaming_start_t *)sm->sm_data);
       if (ts->dobuf) {
+        if (teletext) /* do not save teletext packets */
+          goto end;
         if ((tsf = timeshift_filemgr_get(ts, sm->sm_time)) != NULL) {
           if (tsf->wfd >= 0 || tsf->ram) {
             if ((err = _process_msg0(ts, tsf, sm)) < 0) {
@@ -375,6 +390,7 @@ static void _process_msg
   }
 
   /* Next */
+end:
   streaming_msg_free(sm);
   return;