summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-12-15 16:56:18 +0000
committerCarl Hetherington <cth@carlh.net>2014-12-15 16:56:18 +0000
commita5902c6008fd20392c7248c30bc469310122c527 (patch)
tree8b2712fd09a64c4ca3ea01f2d6304f39837abddd /src/lib
parent99dc00531b985aa1efa23bec5a00b1a5ad26e86c (diff)
Start of Fonts dialog for setting up subtitle fonts.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dcp_subtitle_content.cc11
-rw-r--r--src/lib/font.h34
-rw-r--r--src/lib/subrip_content.cc2
-rw-r--r--src/lib/subtitle_content.cc1
-rw-r--r--src/lib/subtitle_content.h10
5 files changed, 58 insertions, 0 deletions
diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc
index 85c28d038..351d8c26e 100644
--- a/src/lib/dcp_subtitle_content.cc
+++ b/src/lib/dcp_subtitle_content.cc
@@ -17,8 +17,10 @@
*/
+#include "font.h"
#include "dcp_subtitle_content.h"
#include <dcp/interop_subtitle_content.h>
+#include <dcp/interop_load_font.h>
#include <dcp/raw_convert.h>
#include "i18n.h"
@@ -47,9 +49,18 @@ void
DCPSubtitleContent::examine (shared_ptr<Job> job, bool calculate_digest)
{
Content::examine (job, calculate_digest);
+
dcp::InteropSubtitleContent sc (path (0));
+
+ boost::mutex::scoped_lock lm (_mutex);
+
_subtitle_language = sc.language ();
_length = DCPTime::from_seconds (sc.latest_subtitle_out().to_seconds ());
+
+ list<shared_ptr<dcp::InteropLoadFont> > fonts = sc.load_font_nodes ();
+ for (list<shared_ptr<dcp::InteropLoadFont> >::const_iterator i = fonts.begin(); i != fonts.end(); ++i) {
+ _fonts.push_back (shared_ptr<Font> (new Font ((*i)->id)));
+ }
}
DCPTime
diff --git a/src/lib/font.h b/src/lib/font.h
new file mode 100644
index 000000000..59d983277
--- /dev/null
+++ b/src/lib/font.h
@@ -0,0 +1,34 @@
+/*
+ Copyright (C) 2014 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/optional.hpp>
+#include <boost/filesystem.hpp>
+#include <string>
+
+class Font
+{
+public:
+ Font () {}
+ Font (std::string id_)
+ : id (id_) {}
+
+ /** Font ID, or empty for the default font */
+ boost::optional<std::string> id;
+ boost::optional<boost::filesystem::path> file;
+};
diff --git a/src/lib/subrip_content.cc b/src/lib/subrip_content.cc
index 7a336f88a..969829b31 100644
--- a/src/lib/subrip_content.cc
+++ b/src/lib/subrip_content.cc
@@ -21,6 +21,7 @@
#include "util.h"
#include "subrip.h"
#include "film.h"
+#include "font.h"
#include <dcp/raw_convert.h>
#include "i18n.h"
@@ -59,6 +60,7 @@ SubRipContent::examine (boost::shared_ptr<Job> job, bool calculate_digest)
boost::mutex::scoped_lock lm (_mutex);
_length = len;
+ _fonts.push_back (shared_ptr<Font> (new Font ()));
}
string
diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc
index df90a4a1a..f6bceb753 100644
--- a/src/lib/subtitle_content.cc
+++ b/src/lib/subtitle_content.cc
@@ -39,6 +39,7 @@ int const SubtitleContentProperty::SUBTITLE_X_SCALE = 502;
int const SubtitleContentProperty::SUBTITLE_Y_SCALE = 503;
int const SubtitleContentProperty::USE_SUBTITLES = 504;
int const SubtitleContentProperty::SUBTITLE_LANGUAGE = 505;
+int const SubtitleContentProperty::FONTS = 506;
SubtitleContent::SubtitleContent (shared_ptr<const Film> f)
: Content (f)
diff --git a/src/lib/subtitle_content.h b/src/lib/subtitle_content.h
index 4cbef657a..e8915fc96 100644
--- a/src/lib/subtitle_content.h
+++ b/src/lib/subtitle_content.h
@@ -22,6 +22,8 @@
#include "content.h"
+class Font;
+
class SubtitleContentProperty
{
public:
@@ -31,6 +33,7 @@ public:
static int const SUBTITLE_Y_SCALE;
static int const USE_SUBTITLES;
static int const SUBTITLE_LANGUAGE;
+ static int const FONTS;
};
/** @class SubtitleContent
@@ -84,13 +87,20 @@ public:
return _subtitle_y_scale;
}
+ std::list<boost::shared_ptr<Font> > fonts () const {
+ boost::mutex::scoped_lock lm (_mutex);
+ return _fonts;
+ }
+
std::string subtitle_language () const {
+ boost::mutex::scoped_lock lm (_mutex);
return _subtitle_language;
}
protected:
/** subtitle language (e.g. "German") or empty if it is not known */
std::string _subtitle_language;
+ std::list<boost::shared_ptr<Font> > _fonts;
private:
friend struct ffmpeg_pts_offset_test;