#include "film.h"
#include "log.h"
#include "exceptions.h"
+#include "frame_rate_change.h"
#include "i18n.h"
for (size_t i = 0; i < c.size(); ++i) {
shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c[i]);
- if (f->with_subtitles() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) {
+ if (fc->subtitle_use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) {
throw JoinError (_("Content to be joined must use the same subtitle stream."));
}
return p;
}
-bool
-FFmpegContent::has_subtitle_during (ContentTimePeriod period) const
+list<ContentTimePeriod>
+FFmpegContent::subtitles_during (ContentTimePeriod period, bool starting) const
{
+ list<ContentTimePeriod> d;
+
shared_ptr<FFmpegSubtitleStream> stream = subtitle_stream ();
+ if (!stream) {
+ return d;
+ }
/* XXX: inefficient */
for (vector<ContentTimePeriod>::const_iterator i = stream->periods.begin(); i != stream->periods.end(); ++i) {
- if (i->from <= period.to && i->to >= period.from) {
- return true;
+ if ((starting && period.contains (i->from)) || (!starting && period.overlaps (*i))) {
+ d.push_back (*i);
}
}
- return false;
+ return d;
}