#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().
_subtitles[period.from] = period.to;
}
-list<ContentTimePeriod>
+list<ContentTimePeriod>
FFmpegSubtitleStream::subtitles_during (ContentTimePeriod period, bool starting) const
{
list<ContentTimePeriod> d;
-
+
/* XXX: inefficient */
for (map<ContentTime, ContentTime>::const_iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
if ((starting && period.contains (i->first)) || (!starting && period.overlaps (ContentTimePeriod (i->first, i->second)))) {
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;
+}