From: Jaroslav Kysela Date: Tue, 24 Nov 2015 15:51:08 +0000 (+0100) Subject: DVR: make configurable 'extra warming up time', fixes #3341 X-Git-Tag: v4.2.1~1472 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f7d03154ca9c52629b5ef10663eb23845ad1bb57;p=thirdparty%2Ftvheadend.git DVR: make configurable 'extra warming up time', fixes #3341 --- diff --git a/src/dvr/dvr.h b/src/dvr/dvr.h index ae3f47e09..b3b86b01f 100644 --- a/src/dvr/dvr.h +++ b/src/dvr/dvr.h @@ -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; diff --git a/src/dvr/dvr_config.c b/src/dvr/dvr_config.c index 7860c087d..416f90e58 100644 --- a/src/dvr/dvr_config.c +++ b/src/dvr/dvr_config.c @@ -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", diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index ec2366a7e..311ff7152 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -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; diff --git a/src/dvr/dvr_rec.c b/src/dvr/dvr_rec.c index 4011a4f1e..136e6e555 100644 --- a/src/dvr/dvr_rec.c +++ b/src/dvr/dvr_rec.c @@ -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