using std::max;
using std::string;
using std::stringstream;
+using std::pair;
using boost::optional;
using boost::shared_ptr;
using boost::weak_ptr;
{
return _content;
}
+
+void
+Playlist::repeat (list<shared_ptr<Content> > c, int n)
+{
+ pair<Time, Time> range (TIME_MAX, 0);
+ for (list<shared_ptr<Content> >::iterator i = c.begin(); i != c.end(); ++i) {
+ range.first = min (range.first, (*i)->start ());
+ range.second = max (range.second, (*i)->start ());
+ range.first = min (range.first, (*i)->end ());
+ range.second = max (range.second, (*i)->end ());
+ }
+
+ Time pos = range.second;
+ for (int i = 0; i < n; ++i) {
+ for (list<shared_ptr<Content> >::iterator i = c.begin(); i != c.end(); ++i) {
+ shared_ptr<Content> copy = (*i)->clone ();
+ copy->set_start (pos + copy->start() - range.first);
+ _content.push_back (copy);
+ }
+ pos += range.second - range.first;
+ }
+
+ reconnect ();
+ Changed ();
+}