(target.platform == 'osx' and target.bits == 64) or
(target.platform == 'windows')) else {}
- deps.append(('libdcp', '2b522d0', cpp_lib_options))
- deps.append(('libsub', 'dcd8bf5', cpp_lib_options))
+ deps.append(('libdcp', 'c6665c1', cpp_lib_options))
+ deps.append(('libsub', '64eb116', cpp_lib_options))
deps.append(('leqm-nrt', 'carl'))
deps.append(('rtaudio', 'carl'))
# We get our OpenSSL libraries from the environment, but we
using std::list;
using std::cout;
+using std::map;
using std::string;
+using std::vector;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
{
return ContentTime::from_frames(_offset, _dcp_content->active_video_frame_rate(film())) + _next;
}
+
+
+vector<FontData>
+DCPDecoder::fonts () const
+{
+ vector<FontData> data;
+ BOOST_FOREACH (shared_ptr<dcp::Reel> i, _reels) {
+ if (i->main_subtitle() && i->main_subtitle()->asset()) {
+ map<string, dcp::ArrayData> fm = i->main_subtitle()->asset()->font_data();
+ for (map<string, dcp::ArrayData>::const_iterator j = fm.begin(); j != fm.end(); ++j) {
+ data.push_back (FontData(j->first, j->second));
+ }
+ }
+ }
+ return data;
+}
+
bool pass ();
void seek (dcpomatic::ContentTime t, bool accurate);
+ std::vector<dcpomatic::FontData> fonts () const;
+
std::string lazy_digest () const {
return _lazy_digest;
}
/*
- Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
using std::string;
using std::cout;
using std::list;
+using std::vector;
using boost::shared_ptr;
using boost::weak_ptr;
using boost::dynamic_pointer_cast;
}
if (_non_burnt_subtitles) {
- list<shared_ptr<Font> > fonts = _player->get_subtitle_fonts ();
+ vector<FontData> fonts = _player->get_subtitle_fonts ();
if (fonts.size() > 1 && _film->interop()) {
/* Interop will ignore second and subsequent <LoadFont>s so don't even
write them as they upset some validators.
*/
- shared_ptr<Font> first = fonts.front ();
+ FontData first = fonts.front ();
fonts.clear ();
fonts.push_back (first);
}
/*
- Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "dcp_subtitle_decoder.h"
#include "dcp_subtitle_content.h"
#include <dcp/interop_subtitle_asset.h>
+#include <dcp/load_font_node.h>
#include <iostream>
-using std::list;
using std::cout;
+using std::list;
+using std::map;
+using std::string;
+using std::vector;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::bind;
first = content_time_period(*_next).from;
}
text.push_back (shared_ptr<TextDecoder> (new TextDecoder (this, content->only_text(), first)));
+
+ map<string, dcp::ArrayData> fm = c->font_data();
+ for (map<string, dcp::ArrayData>::const_iterator j = fm.begin(); j != fm.end(); ++j) {
+ _fonts.push_back (FontData(j->first, j->second));
+ }
+
+ /* Add a default font for any LoadFont nodes in our file which we haven't yet found fonts for */
+ BOOST_FOREACH (shared_ptr<dcp::LoadFontNode> i, c->load_font_nodes()) {
+ if (fm.find(i->id) == fm.end()) {
+ _fonts.push_back (FontData(i->id, dcp::ArrayData(default_font_file())));
+ }
+ }
}
void
ContentTime::from_seconds (s->out().as_seconds ())
);
}
+
+
+vector<dcpomatic::FontData>
+DCPSubtitleDecoder::fonts () const
+{
+ return _fonts;
+}
+
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "text_decoder.h"
#include "dcp_subtitle.h"
+#include "font_data.h"
class DCPSubtitleContent;
bool pass ();
void seek (dcpomatic::ContentTime time, bool accurate);
+ std::vector<dcpomatic::FontData> fonts () const;
+
private:
dcpomatic::ContentTimePeriod content_time_period (boost::shared_ptr<dcp::Subtitle> s) const;
std::list<boost::shared_ptr<dcp::Subtitle> > _subtitles;
std::list<boost::shared_ptr<dcp::Subtitle> >::const_iterator _next;
+
+ std::vector<dcpomatic::FontData> _fonts;
};
#include "types.h"
#include "film.h"
+#include "font_data.h"
#include "dcpomatic_time.h"
#include "weak_film.h"
#include <boost/utility.hpp>
virtual void seek (dcpomatic::ContentTime time, bool accurate);
virtual dcpomatic::ContentTime position () const;
+
+ virtual std::vector<dcpomatic::FontData> fonts () const {
+ return std::vector<dcpomatic::FontData>();
+ }
};
#endif
*/
+#ifndef DCPOMATIC_FONT_DATA_H
+#define DCPOMATIC_FONT_DATA_H
+
+
#include <dcp/array_data.h>
#include <boost/optional.hpp>
#include <string>
}
+
+
+#endif
#include "text_content.h"
#include "audio_processor.h"
#include "font.h"
+#include "font_data.h"
#include "ratio.h"
#include "audio_analysis.h"
#include "compose.hpp"
return max (DCPTime (), DCPTime (t - piece->content->trim_start(), piece->frc) + piece->content->position());
}
-list<shared_ptr<Font> >
+vector<FontData>
Player::get_subtitle_fonts ()
{
boost::mutex::scoped_lock lm (_mutex);
- list<shared_ptr<Font> > fonts;
+ vector<FontData> fonts;
BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
- BOOST_FOREACH (shared_ptr<TextContent> j, i->content->text) {
- /* XXX: things may go wrong if there are duplicate font IDs
- with different font files.
- */
- list<shared_ptr<Font> > f = j->fonts ();
- copy (f.begin(), f.end(), back_inserter (fonts));
- }
+ /* XXX: things may go wrong if there are duplicate font IDs
+ with different font files.
+ */
+ vector<FontData> f = i->decoder->fonts ();
+ copy (f.begin(), f.end(), back_inserter(fonts));
}
return fonts;
}
namespace dcpomatic {
- class Font;
+ class FontData;
}
class AtmosContent;
bool pass ();
void seek (dcpomatic::DCPTime time, bool accurate);
- std::list<boost::shared_ptr<dcpomatic::Font> > get_subtitle_fonts ();
+ std::vector<dcpomatic::FontData> get_subtitle_fonts ();
std::list<ReferencedReelAsset> get_reel_assets ();
dcp::Size video_container_size () const {
boost::mutex::scoped_lock lm (_mutex);
#include "log.h"
#include "dcpomatic_log.h"
#include "digester.h"
-#include "font.h"
+#include "font_data.h"
#include "compose.hpp"
#include "config.h"
#include "audio_buffers.h"
film()->contains_atmos_content()
);
}
+
+ _default_font = dcp::ArrayData(default_font_file());
}
/** @param frame reel-relative frame */
int64_t picture_duration,
shared_ptr<dcp::Reel> reel,
list<ReferencedReelAsset> const & refs,
- list<shared_ptr<Font> > const & fonts,
+ vector<FontData> const & fonts,
+ dcp::ArrayData default_font,
shared_ptr<const Film> film,
DCPTimePeriod period,
boost::filesystem::path output_dcp,
if (asset) {
/* Add the font to the subtitle content */
- BOOST_FOREACH (shared_ptr<Font> j, fonts) {
- asset->add_font (j->id(), j->file().get_value_or(default_font_file()));
+ BOOST_FOREACH (FontData const& j, fonts) {
+ asset->add_font (j.id, j.data.get_value_or(default_font));
}
if (dynamic_pointer_cast<dcp::InteropSubtitleAsset> (asset)) {
ReelWriter::create_reel_text (
shared_ptr<dcp::Reel> reel,
list<ReferencedReelAsset> const & refs,
- list<shared_ptr<Font> > const& fonts,
+ vector<FontData> const& fonts,
int64_t duration,
boost::filesystem::path output_dcp,
bool ensure_subtitles,
) const
{
shared_ptr<dcp::ReelSubtitleAsset> subtitle = maybe_add_text<dcp::ReelSubtitleAsset> (
- _subtitle_asset, duration, reel, refs, fonts, film(), _period, output_dcp, _text_only
+ _subtitle_asset, duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only
);
if (subtitle) {
reel,
refs,
fonts,
+ _default_font,
film(),
_period,
output_dcp,
for (map<DCPTextTrack, shared_ptr<dcp::SubtitleAsset> >::const_iterator i = _closed_caption_assets.begin(); i != _closed_caption_assets.end(); ++i) {
shared_ptr<dcp::ReelClosedCaptionAsset> a = maybe_add_text<dcp::ReelClosedCaptionAsset> (
- i->second, duration, reel, refs, fonts, film(), _period, output_dcp, _text_only
+ i->second, duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only
);
DCPOMATIC_ASSERT (a);
a->set_annotation_text (i->first.name);
/* Make empty tracks for anything we've been asked to ensure but that we haven't added */
BOOST_FOREACH (DCPTextTrack i, ensure_closed_captions) {
shared_ptr<dcp::ReelClosedCaptionAsset> a = maybe_add_text<dcp::ReelClosedCaptionAsset> (
- empty_text_asset(TEXT_CLOSED_CAPTION, i), duration, reel, refs, fonts, film(), _period, output_dcp, _text_only
+ empty_text_asset(TEXT_CLOSED_CAPTION, i), duration, reel, refs, fonts, _default_font, film(), _period, output_dcp, _text_only
);
DCPOMATIC_ASSERT (a);
a->set_annotation_text (i.name);
shared_ptr<dcp::Reel>
ReelWriter::create_reel (
list<ReferencedReelAsset> const & refs,
- list<shared_ptr<Font> > const & fonts,
+ vector<FontData> const & fonts,
boost::filesystem::path output_dcp,
bool ensure_subtitles,
set<DCPTextTrack> ensure_closed_captions
#include <boost/weak_ptr.hpp>
namespace dcpomatic {
- class Font;
+ class FontData;
}
class Film;
void finish (boost::filesystem::path output_dcp);
boost::shared_ptr<dcp::Reel> create_reel (
std::list<ReferencedReelAsset> const & refs,
- std::list<boost::shared_ptr<dcpomatic::Font> > const & fonts,
+ std::vector<dcpomatic::FontData> const & fonts,
boost::filesystem::path output_dcp,
bool ensure_subtitles,
std::set<DCPTextTrack> ensure_closed_captions
void create_reel_sound (boost::shared_ptr<dcp::Reel> reel, std::list<ReferencedReelAsset> const & refs) const;
void create_reel_text (
boost::shared_ptr<dcp::Reel> reel,
- std::list<ReferencedReelAsset> const & refs, std::list<boost::shared_ptr<dcpomatic::Font> > const& fonts,
+ std::list<ReferencedReelAsset> const & refs,
+ std::vector<dcpomatic::FontData> const& fonts,
int64_t duration,
boost::filesystem::path output_dcp,
bool ensure_subtitles,
boost::weak_ptr<Job> _job;
bool _text_only;
+ dcp::ArrayData _default_font;
+
boost::shared_ptr<dcp::PictureAsset> _picture_asset;
/** picture asset writer, or 0 if we are not writing any picture because we already have one */
boost::shared_ptr<dcp::PictureAssetWriter> _picture_asset_writer;
ContentTime::from_seconds (s.to.all_as_seconds())
);
}
+
+
+vector<FontData>
+StringTextFileDecoder::fonts () const
+{
+ vector<FontData> data;
+ BOOST_FOREACH (shared_ptr<TextDecoder> i, text) {
+ BOOST_FOREACH (shared_ptr<Font> j, i->content()->fonts()) {
+ data.push_back (FontData(j));
+ }
+ }
+ return data;
+}
+
void seek (dcpomatic::ContentTime time, bool accurate);
bool pass ();
+ std::vector<dcpomatic::FontData> fonts () const;
+
private:
dcpomatic::ContentTimePeriod content_time_period (sub::Subtitle s) const;
/*
- Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2019-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
-#include "font.h"
+#include "font_data.h"
#include "subtitle_encoder.h"
#include "player.h"
#include "compose.hpp"
BOOST_FOREACH (dcpomatic::DCPTimePeriod i, film->reels()) {
_reels.push_back (i);
}
+
+ _default_font = dcp::ArrayData (default_font_file());
}
void
}
if (!_film->interop() || _include_font) {
- BOOST_FOREACH (shared_ptr<dcpomatic::Font> j, _player->get_subtitle_fonts()) {
- i->first->add_font (j->id(), default_font_file());
+ BOOST_FOREACH (dcpomatic::FontData j, _player->get_subtitle_fonts()) {
+ i->first->add_font (j.id, _default_font);
}
}
int _reel_index;
boost::optional<dcpomatic::DCPTime> _last;
dcpomatic::DCPTime _length;
+ dcp::ArrayData _default_font;
};
#include "cross.h"
#include "audio_buffers.h"
#include "version.h"
-#include "font.h"
+#include "font_data.h"
#include "util.h"
#include "reel_writer.h"
#include "text_content.h"
}
void
-Writer::write (list<shared_ptr<Font> > fonts)
+Writer::write (vector<FontData> fonts)
{
/* Just keep a list of unique fonts and we'll deal with them in ::finish */
- BOOST_FOREACH (shared_ptr<Font> i, fonts) {
+ BOOST_FOREACH (FontData const& i, fonts) {
bool got = false;
- BOOST_FOREACH (shared_ptr<Font> j, _fonts) {
- if (*i == *j) {
+ BOOST_FOREACH (FontData const& j, _fonts) {
+ if (i == j) {
got = true;
}
}
}
namespace dcpomatic {
- class Font;
+ class FontData;
}
class Film;
void repeat (Frame, Eyes);
void write (boost::shared_ptr<const AudioBuffers>, dcpomatic::DCPTime time);
void write (PlayerText text, TextType type, boost::optional<DCPTextTrack>, dcpomatic::DCPTimePeriod period);
- void write (std::list<boost::shared_ptr<dcpomatic::Font> > fonts);
+ void write (std::vector<dcpomatic::FontData> fonts);
void write (ReferencedReelAsset asset);
void write (boost::shared_ptr<const dcp::AtmosFrame> atmos, dcpomatic::DCPTime time, AtmosMetadata metadata);
void finish (boost::filesystem::path output_dcp);
std::list<ReferencedReelAsset> _reel_assets;
- std::list<boost::shared_ptr<dcpomatic::Font> > _fonts;
+ std::vector<dcpomatic::FontData> _fonts;
/** true if any reel has any subtitles */
bool _have_subtitles;
-Subproject commit 578c16ee95b416d4dcec31c72219dac91e632169
+Subproject commit 8a1b08134f51c1172abd177eb64a4c790f854833