diff options
author | jstebbins <[email protected]> | 2010-11-22 21:52:05 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2010-11-22 21:52:05 +0000 |
commit | bdb3c747159ff77aa36feaeb9365c58c23d512b6 (patch) | |
tree | bc77628a40f6ea9c55b59e2939e875cb346a9bab /libhb/decssasub.c | |
parent | ffa6c17f19cf2e88d1de9858c10cf9925272001b (diff) |
fix sync of ssa subtitles when using point-to-point encoding
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3685 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/decssasub.c')
-rw-r--r-- | libhb/decssasub.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libhb/decssasub.c b/libhb/decssasub.c index c02de3e85..8d0a9995d 100644 --- a/libhb/decssasub.c +++ b/libhb/decssasub.c @@ -170,6 +170,34 @@ static hb_buffer_t *ssa_decode_packet( hb_work_object_t * w, hb_buffer_t *in ) *nextPtr = out; nextPtr = &out->next; } + + // For point-to-point encoding, when the start time of the stream + // may be offset, the timestamps of the subtitles must be offset as well. + // + // HACK: Here we are making the assumption that, under normal circumstances, + // the output display time of the first output packet is equal to the + // display time of the input packet. + // + // During point-to-point encoding, the display time of the input + // packet will be offset to compensate. + // + // Therefore we offset all of the output packets by a slip amount + // such that first output packet's display time aligns with the + // input packet's display time. This should give the correct time + // when point-to-point encoding is in effect. + if (out_list && out_list->start > in->start) + { + int64_t slip = out_list->start - in->start; + hb_buffer_t *out; + + out = out_list; + while (out) + { + out->start -= slip; + out->stop -= slip; + out = out->next; + } + } return out_list; } |