{
.type = PT_BOOL,
.id = "ondemand",
- .name = N_("On-demand (no rewind)"),
+ .name = N_("On-demand (no first rewind)"),
+ .desc = N_("Use timeshift only on-demand. It is started when the first request "
+ "to move in the playback time occurs (fast-forward, rewind, goto)."),
.off = offsetof(timeshift_conf_t, ondemand),
},
{
ts->packet_mode = 0;
/* Buffer to disk */
- if ((ts->state > TS_LIVE) || (!ts->ondemand && (ts->state == TS_LIVE))) {
+ if ((ts->state > TS_LIVE) || (ts->dobuf && (ts->state == TS_LIVE))) {
if (ts->packet_mode) {
sm->sm_time = ts->last_time;
if (type == SMT_PACKET) {
ts->vididx = -1;
ts->id = timeshift_index;
ts->ondemand = timeshift_conf.ondemand;
+ ts->dobuf = ts->ondemand ? 0 : 1;
ts->packet_mode= 1;
ts->last_time = 0;
ts->start_pts = 0;
time_t max_time; ///< Maximum period to shift
int ondemand; ///< Whether this is an on-demand timeshift
int packet_mode;///< Packet mode (otherwise MPEG-TS data mode)
+ int dobuf; ///< Buffer packets (store)
int64_t last_time; ///< Last time in us (PTS conversion)
int64_t start_pts; ///< Start time for packets (PTS)
int64_t ref_time; ///< Start time in us (monoclock)
if (speed < -3200) speed = -3200;
/* Ignore negative */
- if (ts->ondemand && (speed < 0))
+ if (!ts->dobuf && (speed < 0))
speed = cur_file ? speed : 0;
/* Process */
tvhlog(LOG_DEBUG, "timeshift", "ts %d enter timeshift mode",
ts->id);
timeshift_writer_flush(ts);
+ ts->dobuf = 1;
pthread_mutex_lock(&ts->rdwr_mutex);
cur_file = timeshift_filemgr_newest(ts);
cur_file = timeshift_filemgr_get(ts, cur_file ? cur_file->last :
skip = NULL;
} else {
ts->state = TS_PLAY;
+ ts->dobuf = 1;
tvhtrace("timeshift", "reader - set TS_PLAY");
}
}
cur_file->rfd = -1;
}
- /* Flush ALL files */
- if (ts->ondemand)
- timeshift_filemgr_flush(ts, NULL);
-
/* Pause */
} else {
if (cur_speed <= 0) {
cur_speed = 100;
tvhtrace("timeshift", "reader - set TS_PLAY");
ts->state = TS_PLAY;
+ ts->dobuf = 1;
if (mono_play_time != mono_now)
tvhtrace("timeshift", "update play time (pause) - %"PRId64, mono_now);
mono_play_time = mono_now;
ctrl = NULL;
}
- /* Flush unwanted */
- } else if (ts->ondemand && cur_file) {
- pthread_mutex_lock(&ts->rdwr_mutex);
- timeshift_filemgr_flush(ts, cur_file);
- pthread_mutex_unlock(&ts->rdwr_mutex);
}
pthread_mutex_unlock(&ts->state_mutex);