]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
service: add PTS shift for the teletext subtitles
authorJaroslav Kysela <perex@perex.cz>
Wed, 15 Feb 2017 10:23:07 +0000 (11:23 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 15 Feb 2017 10:23:07 +0000 (11:23 +0100)
src/input/mpegts/mpegts_service.c
src/parsers/parsers.c
src/service.h

index 5e37d4e8311beec3a39c5a932c960d98878cd9ae..3c2ad83da8546cd2df4ebcf5a01205f92eb8f736 100644 (file)
@@ -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",
index e6f6dcb55712002c29481ecea2a2d6963296b7eb..60d25fc895ed2356f4845c4de6cb0fabf085cdfe 100644 (file)
@@ -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");
 
index 658a57782dabcc2ea2514c13f9dd1ff1932d6b8c..9a5c13fe792e3b75a7e9a488452ed947b070f95c 100644 (file)
@@ -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;