]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
DVR: make configurable 'extra warming up time', fixes #3341
authorJaroslav Kysela <perex@perex.cz>
Tue, 24 Nov 2015 15:51:08 +0000 (16:51 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 24 Nov 2015 15:51:08 +0000 (16:51 +0100)
src/dvr/dvr.h
src/dvr/dvr_config.c
src/dvr/dvr_db.c
src/dvr/dvr_rec.c

index ae3f47e092e84012e872858b204253e7aac37957..b3b86b01fe880d79d5ae77db282150256e35b9ba 100644 (file)
@@ -49,6 +49,7 @@ typedef struct dvr_config {
   char *dvr_charset_id;
   char *dvr_postproc;
   char *dvr_postremove;
+  uint32_t dvr_warm_time;
   uint32_t dvr_extra_time_pre;
   uint32_t dvr_extra_time_post;
   uint32_t dvr_update_window;
index 7860c087da3533d4a1760dbb3e03fa30a1930cc3..416f90e587baae760a1ef6ad84d387dbeb55c718 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *  Digital Video Recorder
  *  Copyright (C) 2008 Andreas Öman
+ *  Copyright (C) 2014,2015 Jaroslav Kysela
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -181,6 +182,7 @@ dvr_config_create(const char *name, const char *uuid, htsmsg_t *conf)
   cfg->dvr_tag_files = 1;
   cfg->dvr_skip_commercials = 1;
   dvr_charset_update(cfg, intlconv_filesystem_charset());
+  cfg->dvr_warm_time = 30;
   cfg->dvr_update_window = 24 * 3600;
   cfg->dvr_pathname = strdup("$t$n.$x");
 
@@ -837,6 +839,14 @@ const idclass_t dvr_config_class = {
       .off      = offsetof(dvr_config_t, dvr_rerecord_errors),
       .group    = 1,
     },
+    {
+      .type     = PT_U32,
+      .id       = "warm-time",
+      .name     = N_("Extra warming up time (seconds)"),
+      .off      = offsetof(dvr_config_t, dvr_warm_time),
+      .group    = 1,
+      .def.u32  = 30
+    },
     {
       .type     = PT_U32,
       .id       = "pre-extra-time",
index ec2366a7e92b2f954d3e02e2b4d12ff341db8ed6..311ff71522e3f31eef9a31ddacac156e7e1dcf1b 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *  Digital Video Recorder
  *  Copyright (C) 2008 Andreas Öman
+ *  Copyright (C) 2014,2015 Jaroslav Kysela
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -204,11 +205,17 @@ static inline int extra_valid(time_t extra)
   return extra != 0 && extra != (time_t)-1;
 }
 
+static uint32_t
+dvr_entry_warm_time( dvr_entry_t *de )
+{
+  return MIN(de->de_config->dvr_warm_time, 240);
+}
+
 time_t
 dvr_entry_get_start_time( dvr_entry_t *de )
 {
-  /* Note 30 seconds might not be enough (rotors) */
-  return de->de_start - (60 * dvr_entry_get_extra_time_pre(de)) - 30;
+  return de->de_start - (60 * dvr_entry_get_extra_time_pre(de)) -
+         dvr_entry_warm_time(de);
 }
 
 time_t
@@ -963,7 +970,8 @@ not_so_good:
     return 0;
 
   e = NULL;
-  pre = (60 * dvr_entry_get_extra_time_pre(de)) - 30;
+  pre = (60 * dvr_entry_get_extra_time_pre(de)) -
+        dvr_entry_warm_time(de);
   RB_FOREACH(ev, &de->de_channel->ch_epg_schedule, sched_link) {
     if (de->de_bcast == ev) continue;
     if (ev->start - pre < dispatch_clock) continue;
index 4011a4f1ea7f1e63337356e5670f0bf935a54e04..136e6e55506f70af8d9e1b2c93b3f288413eae94 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *  Digital Video Recorder
  *  Copyright (C) 2008 Andreas Öman
+ *  Copyright (C) 2014,2015 Jaroslav Kysela
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by