summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2016-04-23 13:16:23 -0600
committerJohn Stebbins <[email protected]>2016-05-17 09:55:47 -0600
commit1c96039c34d8c95756dda597e3f4f75db2353f84 (patch)
tree43c0a303a4b9b34ec8d71bf7cee44d7ce741521e /libhb
parent987defc068526a7d926ad734b043ae76065ae373 (diff)
decpgssub: allow PGS to have negative timestamps
This can happen due to poorly muxed MTS files that result in a suboptimal scr offset calculation in reader.c
Diffstat (limited to 'libhb')
-rw-r--r--libhb/decpgssub.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/libhb/decpgssub.c b/libhb/decpgssub.c
index 54957729b..2a00617ce 100644
--- a/libhb/decpgssub.c
+++ b/libhb/decpgssub.c
@@ -52,7 +52,7 @@ static int decsubInit( hb_work_object_t * w, hb_job_t * job )
hb_buffer_list_clear(&pv->list_pass);
pv->discard_subtitle = 1;
pv->seen_forced_sub = 0;
- pv->last_pts = 0;
+ pv->last_pts = AV_NOPTS_VALUE;
pv->context = context;
pv->job = job;
@@ -303,7 +303,14 @@ static int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
// occurs after a discontinuity and before the
// next audio or video packet which re-establishes
// timing (afaik).
- pts = pv->last_pts + 3 * 90000LL;
+ if (pv->last_pts == AV_NOPTS_VALUE)
+ {
+ pts = 0LL;
+ }
+ else
+ {
+ pts = pv->last_pts + 3 * 90000LL;
+ }
hb_log("[warning] decpgssub: track %d, invalid PTS",
w->subtitle->out_track);
}
@@ -316,9 +323,10 @@ static int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
// overshot the next pgs pts.
//
// assign a 1 second duration
+ hb_log("decpgssub: track %d, non-monotically increasing PTS, last %"PRId64" current %"PRId64"",
+ w->subtitle->out_track,
+ pv->last_pts, pts);
pts = pv->last_pts + 1 * 90000LL;
- hb_log("[warning] decpgssub: track %d, non-monotically increasing PTS",
- w->subtitle->out_track);
}
pv->last_pts = pts;