Logging improvements to allow prettier displays in the server GUI.
[dcpomatic.git] / src / lib / ffmpeg_subtitle_stream.cc
index 8b1baf724f307038ffdd37047ea6772df1c85465..e12075581b12705a71d53153904218a6950b1cce 100644 (file)
@@ -21,6 +21,7 @@
 #include "raw_convert.h"
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
+#include <iostream>
 
 using std::string;
 using std::map;
@@ -85,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;
+}