#include "log.h"
#include "exceptions.h"
#include "frame_rate_change.h"
-#include "caption_content.h"
+#include "text_content.h"
#include <dcp/raw_convert.h>
#include <libcxml/cxml.h>
extern "C" {
{
video = VideoContent::from_xml (this, node, version);
audio = AudioContent::from_xml (this, node, version);
- caption = CaptionContent::from_xml (this, node, version);
+ text = TextContent::from_xml (this, node, version);
list<cxml::NodePtr> c = node->node_children ("SubtitleStream");
for (list<cxml::NodePtr>::const_iterator i = c.begin(); i != c.end(); ++i) {
bool need_video = false;
bool need_audio = false;
- bool need_caption = false;
+ bool need_text = false;
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_text = !(*i)->text.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)) {
- throw JoinError (_("Content to be joined must all have or not have captions"));
+ if (need_text != !(*i)->text.empty()) {
+ throw JoinError (_("Content to be joined must all have or not have subtitles or captions"));
}
++i;
}
if (need_audio) {
audio.reset (new AudioContent (this, c));
}
- if (need_caption) {
- caption.reset (new CaptionContent (this, c));
+ if (need_text) {
+ text.push_back (shared_ptr<TextContent> (new TextContent (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_text() && fc->only_text()->use() && *(fc->_subtitle_stream.get()) != *(ref->_subtitle_stream.get())) {
throw JoinError (_("Content to be joined must use the same subtitle stream."));
}
}
}
}
- if (caption) {
- caption->as_xml (node);
+ if (only_text()) {
+ only_text()->as_xml (node);
}
boost::mutex::scoped_lock lm (_mutex);
void
FFmpegContent::examine (shared_ptr<Job> job)
{
+ ChangeSignaller<Content> cc1 (this, FFmpegContentProperty::SUBTITLE_STREAMS);
+ ChangeSignaller<Content> cc2 (this, FFmpegContentProperty::SUBTITLE_STREAM);
+
job->set_progress_unknown ();
Content::examine (job);
_subtitle_streams = examiner->subtitle_streams ();
if (!_subtitle_streams.empty ()) {
- caption.reset (new CaptionContent (this));
+ text.clear ();
+ text.push_back (shared_ptr<TextContent> (new TextContent (this, TEXT_OPEN_SUBTITLE, TEXT_UNKNOWN)));
_subtitle_stream = _subtitle_streams.front ();
}
if (examiner->has_video ()) {
set_default_colour_conversion ();
}
-
- signal_changed (FFmpegContentProperty::SUBTITLE_STREAMS);
- signal_changed (FFmpegContentProperty::SUBTITLE_STREAM);
}
string
void
FFmpegContent::set_subtitle_stream (shared_ptr<FFmpegSubtitleStream> s)
{
+ ChangeSignaller<Content> cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
+
{
boost::mutex::scoped_lock lm (_mutex);
_subtitle_stream = s;
}
-
- signal_changed (FFmpegContentProperty::SUBTITLE_STREAM);
}
bool
void
FFmpegContent::set_filters (vector<Filter const *> const & filters)
{
+ ChangeSignaller<Content> cc (this, FFmpegContentProperty::FILTERS);
+
{
boost::mutex::scoped_lock lm (_mutex);
_filters = filters;
}
-
- signal_changed (FFmpegContentProperty::FILTERS);
}
string
s += "_" + video->identifier();
}
- if (caption && caption->use() && caption->burn()) {
- s += "_" + caption->identifier();
+ if (only_text() && only_text()->use() && only_text()->burn()) {
+ s += "_" + only_text()->identifier();
}
boost::mutex::scoped_lock lm (_mutex);
void
FFmpegContent::signal_subtitle_stream_changed ()
{
- signal_changed (FFmpegContentProperty::SUBTITLE_STREAM);
+ /* XXX: this is too late; really it should be before the change */
+ ChangeSignaller<Content> cc (this, FFmpegContentProperty::SUBTITLE_STREAM);
}
vector<shared_ptr<FFmpegAudioStream> >