From: Jaroslav Kysela Date: Mon, 9 Jan 2017 15:18:25 +0000 (+0100) Subject: timeshift: do not save TELETEXT packets (configurable), fixes #4166 X-Git-Tag: v4.2.1~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=349fa78cba19facad3cdcbd479c9a4545f67e730;p=thirdparty%2Ftvheadend.git timeshift: do not save TELETEXT packets (configurable), fixes #4166 --- diff --git a/src/timeshift.c b/src/timeshift.c index 4e5de790f..a36b2c6ef 100644 --- a/src/timeshift.c +++ b/src/timeshift.c @@ -287,6 +287,15 @@ const idclass_t timeshift_conf_class = { .off = offsetof(timeshift_conf_t, ram_fit), .opts = PO_EXPERT, }, + { + .type = PT_BOOL, + .id = "teletext", + .name = N_("Include teletext"), + .desc = N_("Include the teletext stream to the timeshift buffer. It may cause " + "issues for channels where the teletext DTS is invalid."), + .off = offsetof(timeshift_conf_t, teletext), + .opts = PO_EXPERT, + }, {} } }; diff --git a/src/timeshift.h b/src/timeshift.h index 1252bfa05..27e313d43 100644 --- a/src/timeshift.h +++ b/src/timeshift.h @@ -37,6 +37,7 @@ typedef struct timeshift_conf { uint64_t total_ram_size; int ram_only; int ram_fit; + int teletext; } timeshift_conf_t; extern struct timeshift_conf timeshift_conf; diff --git a/src/timeshift/private.h b/src/timeshift/private.h index fe496df92..416e30c8c 100644 --- a/src/timeshift/private.h +++ b/src/timeshift/private.h @@ -131,6 +131,7 @@ typedef struct timeshift { int file_segments; ///< Count of segments in files int vididx; ///< Index of (current) video stream + int teletextidx; ///< Index of (current) teletext stream streaming_start_t *smt_start; ///< Streaming start info diff --git a/src/timeshift/timeshift_writer.c b/src/timeshift/timeshift_writer.c index c300ee6e5..24fb458f8 100644 --- a/src/timeshift/timeshift_writer.c +++ b/src/timeshift/timeshift_writer.c @@ -249,6 +249,12 @@ static void _update_smt_start ( timeshift_t *ts, streaming_start_t *ss ) ts->vididx = ss->ss_components[i].ssc_index; break; } + /* Update teletext index */ + for (i = 0; i < ss->ss_num_components; i++) + if (ss->ss_components[i].ssc_type == SCT_TELETEXT) { + ts->teletextidx = ss->ss_components[i].ssc_index; + break; + } } /* @@ -313,8 +319,9 @@ static inline ssize_t _process_msg0 static void _process_msg ( timeshift_t *ts, streaming_message_t *sm, int *run ) { - int err; + int err, teletext = 0; timeshift_file_t *tsf; + th_pkt_t *pkt; /* Process */ switch (sm->sm_type) { @@ -343,12 +350,18 @@ static void _process_msg goto live; /* Store */ + case SMT_PACKET: + if (timeshift_conf.teletext && sm->sm_type == SMT_PACKET) { + pkt = sm->sm_data; + teletext = pkt->pkt_componentindex == ts->teletextidx; + } + /* fall thru */ case SMT_SIGNAL_STATUS: case SMT_START: case SMT_MPEGTS: - case SMT_PACKET: pthread_mutex_lock(&ts->state_mutex); - ts->buf_time = sm->sm_time; + if (!teletext) /* do not use time from teletext packets */ + ts->buf_time = sm->sm_time; if (ts->state == TS_LIVE) { streaming_target_deliver2(ts->output, streaming_msg_clone(sm)); if (sm->sm_type == SMT_PACKET) @@ -357,6 +370,8 @@ static void _process_msg if (sm->sm_type == SMT_START) _update_smt_start(ts, (streaming_start_t *)sm->sm_data); if (ts->dobuf) { + if (teletext) /* do not save teletext packets */ + goto end; if ((tsf = timeshift_filemgr_get(ts, sm->sm_time)) != NULL) { if (tsf->wfd >= 0 || tsf->ram) { if ((err = _process_msg0(ts, tsf, sm)) < 0) { @@ -375,6 +390,7 @@ static void _process_msg } /* Next */ +end: streaming_msg_free(sm); return;