projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Resurrect neater repeat-write handling.
[dcpomatic.git]
/
src
/
lib
/
subrip_content.cc
diff --git
a/src/lib/subrip_content.cc
b/src/lib/subrip_content.cc
index 48d3528e14d881265dd93466b622038c207492a1..9656ec184144261c8a830de31b188bf698aac814 100644
(file)
--- a/
src/lib/subrip_content.cc
+++ b/
src/lib/subrip_content.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014
-2015
Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-20,12
+20,18
@@
#include "subrip_content.h"
#include "util.h"
#include "subrip.h"
#include "subrip_content.h"
#include "util.h"
#include "subrip.h"
+#include "film.h"
+#include "font.h"
+#include "raw_convert.h"
#include "i18n.h"
#include "i18n.h"
-using std::stringstream;
using std::string;
using std::string;
+using std::cout;
using boost::shared_ptr;
using boost::shared_ptr;
+using boost::lexical_cast;
+
+std::string const SubRipContent::font_id = "font";
SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
@@
-34,9
+40,10
@@
SubRipContent::SubRipContent (shared_ptr<const Film> film, boost::filesystem::pa
}
}
-SubRipContent::SubRipContent (shared_ptr<const Film> film,
shared_ptr<const cxml::Node> node, int
)
+SubRipContent::SubRipContent (shared_ptr<const Film> film,
cxml::ConstNodePtr node, int version
)
: Content (film, node)
: Content (film, node)
- , SubtitleContent (film, node)
+ , SubtitleContent (film, node, version)
+ , _length (node->number_child<DCPTime::Type> ("Length"))
{
}
{
}
@@
-46,8
+53,18
@@
SubRipContent::examine (boost::shared_ptr<Job> job)
{
Content::examine (job);
SubRip s (shared_from_this ());
{
Content::examine (job);
SubRip s (shared_from_this ());
+
+ shared_ptr<const Film> film = _film.lock ();
+ DCPOMATIC_ASSERT (film);
+
+ DCPTime len (s.length (), film->active_frame_rate_change (position ()));
+
+ /* Default to turning these subtitles on */
+ set_use_subtitles (true);
+
boost::mutex::scoped_lock lm (_mutex);
boost::mutex::scoped_lock lm (_mutex);
- _length = s.length ();
+ _length = len;
+ add_font (shared_ptr<Font> (new Font (font_id)));
}
string
}
string
@@
-62,18
+79,13
@@
SubRipContent::technical_summary () const
return Content::technical_summary() + " - " + _("SubRip subtitles");
}
return Content::technical_summary() + " - " + _("SubRip subtitles");
}
-string
-SubRipContent::information () const
-{
-
-}
-
void
void
-SubRipContent::as_xml (xmlpp::Node* node)
+SubRipContent::as_xml (xmlpp::Node* node)
const
{
node->add_child("Type")->add_child_text ("SubRip");
Content::as_xml (node);
SubtitleContent::as_xml (node);
{
node->add_child("Type")->add_child_text ("SubRip");
Content::as_xml (node);
SubtitleContent::as_xml (node);
+ node->add_child("Length")->add_child_text (raw_convert<string> (_length.get ()));
}
DCPTime
}
DCPTime
@@
-84,16
+96,3
@@
SubRipContent::full_length () const
*/
return _length;
}
*/
return _length;
}
-
-string
-SubRipContent::identifier () const
-{
- LocaleGuard lg;
-
- stringstream s;
- s << Content::identifier()
- << "_" << subtitle_scale()
- << "_" << subtitle_offset();
-
- return s.str ();
-}