if (i != c.end ()) {
need_video = static_cast<bool> ((*i)->video);
need_audio = static_cast<bool> ((*i)->audio);
- need_caption = static_cast<bool> ((*i)->caption);
+ need_caption = !(*i)->caption.empty();
}
while (i != c.end ()) {
if (need_audio != static_cast<bool> ((*i)->audio)) {
throw JoinError (_("Content to be joined must all have or not have audio"));
}
- if (need_caption != static_cast<bool> ((*i)->caption)) {
+ if (need_caption != !(*i)->caption.empty()) {
throw JoinError (_("Content to be joined must all have or not have captions"));
}
++i;
audio.reset (new AudioContent (this, c));
}
if (need_caption) {
- caption.reset (new CaptionContent (this, c));
+ caption.push_back (shared_ptr<CaptionContent> (new CaptionContent (this, c)));
}
shared_ptr<FFmpegContent> ref = dynamic_pointer_cast<FFmpegContent> (c[0]);
for (size_t i = 0; i < c.size(); ++i) {
shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c[i]);
- if (fc->caption && fc->caption->use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) {
+ if (fc->only_caption() && fc->only_caption()->use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) {
throw JoinError (_("Content to be joined must use the same subtitle stream."));
}
}