Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
DVR: Fix bugs in the extra time calculators
  • Loading branch information
perexg committed Sep 11, 2014
1 parent b9c3895 commit 5c7196b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/dvr/dvr_db.c
Expand Up @@ -51,15 +51,20 @@ static int dvr_entry_class_disp_title_set(void *o, const void *v);
/*
* Start / stop time calculators
*/
static inline int extra_valid(time_t extra)
{
return extra != 0 && extra != (time_t)-1;
}

static int
dvr_entry_get_start_time( dvr_entry_t *de )
{
time_t extra = de->de_start_extra;

if (extra == 0) {
if (!extra_valid(extra)) {
if (de->de_channel)
extra = de->de_channel->ch_dvr_extra_time_pre;
else
if (!extra_valid(extra))
extra = de->de_config->dvr_extra_time_pre;
}
/* Note 30 seconds might not be enough (rotors) */
Expand All @@ -71,11 +76,11 @@ dvr_entry_get_stop_time( dvr_entry_t *de )
{
time_t extra = de->de_stop_extra;

if (extra == 0) {
if (!extra_valid(extra)) {
if (de->de_channel)
extra = de->de_channel->ch_dvr_extra_time_post;
else
extra = de->de_config->dvr_extra_time_pre;
if (!extra_valid(extra))
extra = de->de_config->dvr_extra_time_post;
}
return de->de_stop + (60 * extra);
}
Expand Down

0 comments on commit 5c7196b

Please sign in to comment.