static void *htsp_server, *htsp_server_2;
-#define HTSP_PROTO_VERSION 8
+#define HTSP_PROTO_VERSION 9
#define HTSP_ASYNC_OFF 0x00
#define HTSP_ASYNC_ON 0x01
return NULL;
}
+/*
+ * Revert to live
+ */
+static htsmsg_t *
+htsp_method_live(htsp_connection_t *htsp, htsmsg_t *in)
+{
+ htsp_subscription_t *hs;
+ uint32_t sid;
+ streaming_skip_t skip;
+
+ if(htsmsg_get_u32(in, "subscriptionId", &sid))
+ return htsp_error("Missing argument 'subscriptionId'");
+
+ LIST_FOREACH(hs, &htsp->htsp_subscriptions, hs_link)
+ if(hs->hs_sid == sid)
+ break;
+
+ if(hs == NULL)
+ return htsp_error("Requested subscription does not exist");
+
+ skip.type = SMT_SKIP_LIVE;
+ subscription_set_skip(hs->hs_s, &skip);
+
+ htsp_reply(htsp, in, htsmsg_create_map());
+ return NULL;
+}
+
/**
* Open file
*/
{ "subscriptionSeek", htsp_method_skip, ACCESS_STREAMING},
{ "subscriptionSkip", htsp_method_skip, ACCESS_STREAMING},
{ "subscriptionSpeed", htsp_method_speed, ACCESS_STREAMING},
+ { "subscriptionLive", htsp_method_live, ACCESS_STREAMING},
{ "fileOpen", htsp_method_file_open, ACCESS_RECORDER},
{ "fileRead", htsp_method_file_read, ACCESS_RECORDER},
{ "fileClose", htsp_method_file_close, ACCESS_RECORDER},
} else if (ctrl->sm_type == SMT_SKIP) {
skip = ctrl->sm_data;
switch (skip->type) {
+ case SMT_SKIP_LIVE:
+ if (ts->state != TS_LIVE) {
+
+ /* Reset */
+ if (ts->full) {
+ pthread_mutex_lock(&ts->rdwr_mutex);
+ timeshift_filemgr_flush(ts, NULL);
+ ts->full = 0;
+ pthread_mutex_unlock(&ts->rdwr_mutex);
+ }
+
+ /* Release */
+ if (sm)
+ streaming_msg_free(sm);
+
+ /* Find end */
+ skip_time = 0x7fffffffffffffff;
+ // TODO: change this sometime!
+ }
+ break;
+
case SMT_SKIP_ABS_TIME:
if (ts->pts_delta == PTS_UNSET) {
tvhlog(LOG_ERR, "timeshift", "ts %d abs skip not possible no PTS delta", ts->id);
if (!end)
end = (cur_speed > 0) ? 1 : -1;
- /* Back to live */
- if (end == 1) {
+ /* Back to live (unless buffer is full) */
+ if (end == 1 && !ts->full) {
tvhlog(LOG_DEBUG, "timeshift", "ts %d eob revert to live mode", ts->id);
ts->state = TS_LIVE;
cur_speed = 100;