]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
teletext parser: pts clock cleanups, don't modify st->es_pts (it's not used for telet...
authorJaroslav Kysela <perex@perex.cz>
Wed, 15 Feb 2017 10:14:36 +0000 (11:14 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 15 Feb 2017 10:14:36 +0000 (11:14 +0100)
src/parsers/parser_teletext.c

index 236098f6371b7862136a4695fcec2d15097fdf87..183e755be39ce698515afeedd05383c45f5b22e7 100644 (file)
@@ -694,7 +694,7 @@ get_cset(uint8_t off)
   return char_table[off];
 }
 
-static void
+static int
 extract_subtitle(mpegts_service_t *t, elementary_stream_t *st,
                 tt_mag_t *ttm, int64_t pts)
 {
@@ -787,17 +787,12 @@ extract_subtitle(mpegts_service_t *t, elementary_stream_t *st,
   }
 
   if(off == 0 && st->es_blank)
-    return; // Avoid multiple blank subtitles
+    return 0; // Avoid multiple blank subtitles
 
   st->es_blank = !off;
 
-  if(st->es_curpts == pts)
-    pts++; // Avoid non-monotonic PTS
-
-  st->es_curpts = pts;
-
   sub[off++] = 0;
-  
+
   th_pkt_t *pkt = pkt_alloc(sub, off, pts, pts);
   pkt->pkt_componentindex = st->es_index;
 
@@ -805,6 +800,8 @@ extract_subtitle(mpegts_service_t *t, elementary_stream_t *st,
 
   /* Decrease our own reference to the packet */
   pkt_ref_dec(pkt);
+
+  return 1;
 }
 
 /**
@@ -849,7 +846,8 @@ tt_subtitle_deliver(mpegts_service_t *t, elementary_stream_t *parent, tt_mag_t *
   TAILQ_FOREACH(st, &t->s_components, es_link) {
      if(parent->es_pid == st->es_parent_pid &&
        ttm->ttm_curpage == st->es_pid -  PID_TELETEXT_BASE) {
-       extract_subtitle(t, st, ttm, ttm->ttm_current_pts);
+       if (extract_subtitle(t, st, ttm, ttm->ttm_current_pts))
+         ttm->ttm_current_pts++; // Avoid duplicate (non-monotonic) PTS
      }
   }
 }