summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_subtitle_stream.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-09-26 23:33:28 +0100
committerCarl Hetherington <cth@carlh.net>2015-09-26 23:33:28 +0100
commit9d4678143d1fa992059c90a2b0997fa5cae81e93 (patch)
treefadf52a829da6f962b09f234ca1166e85014ecd5 /src/lib/ffmpeg_subtitle_stream.cc
parent924dd6e5356f401c325a42ccb43607b79027bb59 (diff)
Fix problems with subtitles when there is a non-zero PTS offset
in FFmpegDecoder. This offset was not being taken into account for subtitles prior to this commit.
Diffstat (limited to 'src/lib/ffmpeg_subtitle_stream.cc')
-rw-r--r--src/lib/ffmpeg_subtitle_stream.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/ffmpeg_subtitle_stream.cc b/src/lib/ffmpeg_subtitle_stream.cc
index 27099b0f3..e12075581 100644
--- a/src/lib/ffmpeg_subtitle_stream.cc
+++ b/src/lib/ffmpeg_subtitle_stream.cc
@@ -86,3 +86,14 @@ FFmpegSubtitleStream::find_subtitle_to (ContentTime from) const
DCPOMATIC_ASSERT (i != _subtitles.end ());
return i->second;
}
+
+/** Add some offset to all the times in the stream */
+void
+FFmpegSubtitleStream::add_offset (ContentTime offset)
+{
+ map<ContentTime, ContentTime> fixed;
+ for (map<ContentTime, ContentTime>::iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
+ fixed[i->first + offset] = i->second + offset;
+ }
+ _subtitles = fixed;
+}