summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2021-01-29 18:41:46 +0100
committerDamiano Galassi <[email protected]>2021-02-25 08:02:57 +0100
commit861fb711b167b03ec878f511f1ac9f297d55cbbd (patch)
tree46ae8ea0f22e9b5969d6f1f6f93965eb0e1bf779
parent2cc7a61bdfdc77c821eb091387df084dbc366045 (diff)
sync: fix missing last subtitle in mp4, the subtitle sanitizer did not receive the eof buffer. Fix missing initial subtitle when 'align a/v' option is enabled by adjusting the sub start timestamp.
-rw-r--r--libhb/sync.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/libhb/sync.c b/libhb/sync.c
index b8ac292c5..736f271b2 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -465,8 +465,19 @@ static void alignStream( sync_common_t * common, sync_stream_t * stream,
buf = hb_list_item(other_stream->in_queue, 0);
if (buf->s.start < pts)
{
- hb_list_rem(other_stream->in_queue, buf);
- hb_buffer_close(&buf);
+ if (other_stream->type == SYNC_TYPE_SUBTITLE &&
+ buf->s.stop > pts)
+ {
+ // Subtitle ends after start time, keep sub and
+ // adjust it's start time
+ buf->s.start = pts;
+ break;
+ }
+ else
+ {
+ hb_list_rem(other_stream->in_queue, buf);
+ hb_buffer_close(&buf);
+ }
}
else
{
@@ -1423,8 +1434,7 @@ static int OutputBuffer( sync_common_t * common )
hb_list_count(stream->in_queue) > min)
{
buf = hb_list_item(stream->in_queue, 0);
- if (buf->s.start < pts &&
- !(buf->s.flags & HB_BUF_FLAG_EOF))
+ if (buf->s.start < pts)
{
pts = buf->s.start;
out_stream = stream;