Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVR: make configurable 'extra warming up time', fixes #3341
  • Loading branch information
perexg committed Nov 24, 2015
1 parent be56a38 commit f7d0315
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/dvr/dvr.h
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions 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
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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",
Expand Down
14 changes: 11 additions & 3 deletions 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -963,7 +970,8 @@ dvr_entry_rerecord(dvr_entry_t *de)
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;
Expand Down
1 change: 1 addition & 0 deletions 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
Expand Down

0 comments on commit f7d0315

Please sign in to comment.