From: Jaroslav Kysela Date: Wed, 15 Feb 2017 10:23:07 +0000 (+0100) Subject: service: add PTS shift for the teletext subtitles X-Git-Tag: v4.2.1~115 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc02425dc1653c438085ebab612438c19c6a0566;p=thirdparty%2Ftvheadend.git service: add PTS shift for the teletext subtitles --- diff --git a/src/input/mpegts/mpegts_service.c b/src/input/mpegts/mpegts_service.c index 5e37d4e83..3c2ad83da 100644 --- a/src/input/mpegts/mpegts_service.c +++ b/src/input/mpegts/mpegts_service.c @@ -234,6 +234,14 @@ const idclass_t mpegts_service_class = .off = offsetof(mpegts_service_t, s_dvb_forcecaid), .opts = PO_EXPERT | PO_HEXA, }, + { + .type = PT_INT, + .id = "pts_shift", + .name = N_("Shift PTS (ms)"), + .desc = N_("Add this value to PTS for the teletext subtitles. The time value is in milliseconds and may be negative."), + .off = offsetof(mpegts_service_t, s_pts_shift), + .opts = PO_EXPERT, + }, { .type = PT_TIME, .id = "created", diff --git a/src/parsers/parsers.c b/src/parsers/parsers.c index e6f6dcb55..60d25fc89 100644 --- a/src/parsers/parsers.c +++ b/src/parsers/parsers.c @@ -1826,8 +1826,9 @@ parser_deliver(service_t *t, elementary_stream_t *st, th_pkt_t *pkt) if(SCT_ISAUDIO(st->es_type) && pkt->pkt_pts != PTS_UNSET && (t->s_current_pts == PTS_UNSET || pkt->pkt_pts > t->s_current_pts || - pkt->pkt_pts < t->s_current_pts - 180000)) - t->s_current_pts = pkt->pkt_pts; + pkt->pkt_pts < t->s_current_pts - 180000)) { + t->s_current_pts = (pkt->pkt_pts + (int64_t)t->s_pts_shift * 900) % PTS_MASK; + } pkt_trace(LS_PARSER, pkt, st->es_index, st->es_type, "deliver"); diff --git a/src/service.h b/src/service.h index 658a57782..9a5c13fe7 100644 --- a/src/service.h +++ b/src/service.h @@ -303,6 +303,7 @@ typedef struct service { int s_auto; int s_prio; int s_type_user; + int s_pts_shift; // in ms (may be negative) LIST_ENTRY(service) s_active_link;