projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set up TextDecoder position based on the time that the next thing will
[dcpomatic.git]
/
src
/
lib
/
text_decoder.cc
diff --git
a/src/lib/text_decoder.cc
b/src/lib/text_decoder.cc
index e3b7d995879b7f5dcc61b919b68db5fc6f86e567..b1b6cbcc4d503d438fb46074dcc9ec8541444a35 100644
(file)
--- a/
src/lib/text_decoder.cc
+++ b/
src/lib/text_decoder.cc
@@
-41,12
+41,10
@@
using namespace dcpomatic;
TextDecoder::TextDecoder (
Decoder* parent,
TextDecoder::TextDecoder (
Decoder* parent,
- shared_ptr<const TextContent> content,
- ContentTime first
+ shared_ptr<const TextContent> content
)
: DecoderPart (parent)
, _content (content)
)
: DecoderPart (parent)
, _content (content)
- , _position (first)
{
}
{
}
@@
-63,7
+61,7
@@
void
TextDecoder::emit_bitmap_start (ContentBitmapText const& bitmap)
{
BitmapStart (bitmap);
TextDecoder::emit_bitmap_start (ContentBitmapText const& bitmap)
{
BitmapStart (bitmap);
-
_position = bitmap.from(
);
+
maybe_set_position(bitmap.from()
);
}
}
@@
-116,7
+114,7
@@
TextDecoder::emit_plain_start (ContentTime from, vector<dcp::SubtitleString> sub
}
PlainStart(ContentStringText(from, string_texts));
}
PlainStart(ContentStringText(from, string_texts));
-
_position = from
;
+
maybe_set_position(from)
;
}
}
@@
-274,7
+272,7
@@
TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & sub_subti
}
PlainStart(ContentStringText(from, string_texts));
}
PlainStart(ContentStringText(from, string_texts));
-
_position = from
;
+
maybe_set_position(from)
;
}
}
@@
-318,3
+316,13
@@
TextDecoder::seek ()
{
_position = ContentTime ();
}
{
_position = ContentTime ();
}
+
+
+void
+TextDecoder::maybe_set_position (dcpomatic::ContentTime position)
+{
+ if (!_position || position > *_position) {
+ _position = position;
+ }
+}
+