diff options
-rw-r--r-- | libhb/decpgssub.c | 18 | ||||
-rw-r--r-- | libhb/sync.c | 20 |
2 files changed, 28 insertions, 10 deletions
diff --git a/libhb/decpgssub.c b/libhb/decpgssub.c index 7ea2a0122..3df1cc439 100644 --- a/libhb/decpgssub.c +++ b/libhb/decpgssub.c @@ -379,7 +379,8 @@ static int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in, out->sequence = in->sequence; } out->s.renderOffset = AV_NOPTS_VALUE; - out->s.start = out->s.stop = pts; + out->s.stop = AV_NOPTS_VALUE; + out->s.start = pts; } else { @@ -393,13 +394,14 @@ static int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in, out = hb_frame_buffer_init(AV_PIX_FMT_YUVA420P, rect->w, rect->h); - out->s.frametype = HB_FRAME_SUBTITLE; - out->s.id = in->s.id; - out->sequence = in->sequence; - out->s.start = pts; - out->s.stop = pts; - out->f.x = rect->x; - out->f.y = rect->y; + out->s.frametype = HB_FRAME_SUBTITLE; + out->s.id = in->s.id; + out->sequence = in->sequence; + out->s.start = pts; + out->s.stop = AV_NOPTS_VALUE; + out->s.renderOffset = AV_NOPTS_VALUE; + out->f.x = rect->x; + out->f.y = rect->y; uint8_t *lum = out->plane[0].data; uint8_t *chromaU = out->plane[1].data; diff --git a/libhb/sync.c b/libhb/sync.c index 84eb1eac5..7181e444a 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -220,7 +220,11 @@ static void InitSubtitle( hb_job_t * job, hb_sync_video_t * sync, int i ) // Merge overlapping subtitles since mpv tx3g does not support them sync->subtitle_sanitizer[i].merge = 1; } - if (subtitle->config.dest == PASSTHRUSUB) + // PGS subtitles don't need to be linked because there are explicit + // "clear" subtitle packets that indicate the end time of the + // previous subtitle + if (subtitle->config.dest == PASSTHRUSUB && + subtitle->source != PGSSUB) { // Fill in stop time when it is missing sync->subtitle_sanitizer[i].link = 1; @@ -320,7 +324,7 @@ static hb_buffer_t * mergeSubtitles(subtitle_sanitizer_t *sanitizer, int end) { b = a->next; - if (b != NULL && !sanitizer->merge) + if (!sanitizer->merge) { sanitizer->list_current = a->next; if (sanitizer->list_current == NULL) @@ -406,6 +410,18 @@ static hb_buffer_t * sanitizeSubtitle( if (!sanitizer->link && !sanitizer->merge) { + if (sub != NULL) + { + if (sub->s.stop != AV_NOPTS_VALUE) + sub->s.duration = sub->s.stop - sub->s.start; + else + sub->s.duration = 0; + sub->s.start -= pv->common->video_pts_slip; + if (sub->s.stop != AV_NOPTS_VALUE) + sub->s.stop -= pv->common->video_pts_slip; + if (sub->s.renderOffset != AV_NOPTS_VALUE) + sub->s.renderOffset -= pv->common->video_pts_slip; + } return sub; } |