Logging improvements to allow prettier displays in the server GUI.
[dcpomatic.git] / src / lib / ffmpeg_subtitle_stream.cc
index 413477865cf189481180bf0eaefa616bc7dc055c..e12075581b12705a71d53153904218a6950b1cce 100644 (file)
 #include "raw_convert.h"
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
+#include <iostream>
 
 using std::string;
 using std::map;
 using std::list;
+using std::cout;
 
 /** Construct a SubtitleStream from a value returned from to_string().
  *  @param t String returned from to_string().
@@ -84,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;
+}