/* We can provide dummy values for time and frame rate here as they are only used to calculate fades */
dcp::Size const frame = _film->frame_size();
- std::vector<dcp::SubtitleStandard> override_standard;
+ std::vector<dcp::TextStandard> override_standard;
if (_film->interop()) {
/* Since the film is Interop there is only one way the vpositions in the subs can be interpreted
* (we assume).
*/
- override_standard.push_back(dcp::SubtitleStandard::INTEROP);
+ override_standard.push_back(dcp::TextStandard::INTEROP);
} else {
/* We're using the great new SMPTE standard, which means there are two different ways that vposition
* could be interpreted; we will write SMPTE-2014 standard assets, but if the projection system uses
* SMPTE 20{07,10} instead they won't be placed how we intended. To show the user this, make the
* bounding rectangle enclose both possibilities.
*/
- override_standard.push_back(dcp::SubtitleStandard::SMPTE_2007);
- override_standard.push_back(dcp::SubtitleStandard::SMPTE_2014);
+ override_standard.push_back(dcp::TextStandard::SMPTE_2007);
+ override_standard.push_back(dcp::TextStandard::SMPTE_2014);
}
for (auto standard: override_standard) {
#include "compose.hpp"
#include <libcxml/cxml.h>
#include <dcp/filesystem.h>
-#include <dcp/smpte_subtitle_asset.h>
+#include <dcp/smpte_text_asset.h>
#include <boost/algorithm/string.hpp>
#include "i18n.h"
throw KDMAsContentError ();
}
single = make_shared<DCPSubtitleContent>(path);
- } else if (ext == ".mxf" && dcp::SMPTESubtitleAsset::valid_mxf(path)) {
+ } else if (ext == ".mxf" && dcp::SMPTETextAsset::valid_mxf(path)) {
single = make_shared<DCPSubtitleContent>(path);
} else if (ext == ".mxf" && VideoMXFContent::valid_mxf(path)) {
single = make_shared<VideoMXFContent>(path);
#include "dcpomatic_time.h"
#include "rect.h"
#include "string_text.h"
-#include <dcp/subtitle_string.h>
+#include <dcp/text_string.h>
#include <vector>
void
DCPDecoder::pass_texts (
- ContentTime next, shared_ptr<dcp::SubtitleAsset> asset, bool reference, int64_t entry_point, shared_ptr<TextDecoder> decoder, dcp::Size size
+ ContentTime next, shared_ptr<dcp::TextAsset> asset, bool reference, int64_t entry_point, shared_ptr<TextDecoder> decoder, dcp::Size size
)
{
auto const vfr = _dcp_content->active_video_frame_rate (film());
auto const frame = next.frames_round (vfr);
if (_decode_referenced || !reference) {
- auto subs = asset->subtitles_during (
+ auto subs = asset->texts_during(
dcp::Time (entry_point + frame, vfr, vfr),
dcp::Time (entry_point + frame + 1, vfr, vfr),
true
);
- vector<dcp::SubtitleString> strings;
+ vector<dcp::TextString> strings;
for (auto i: subs) {
- auto is = dynamic_pointer_cast<const dcp::SubtitleString>(i);
+ auto is = dynamic_pointer_cast<const dcp::TextString>(i);
if (is) {
if (!strings.empty() && (strings.back().in() != is->in() || strings.back().out() != is->out())) {
auto b = strings.back();
ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.out().as_seconds())
),
strings,
- asset->subtitle_standard()
+ asset->text_standard()
);
strings.clear ();
}
- dcp::SubtitleString is_copy = *is;
+ dcp::TextString is_copy = *is;
is_copy.set_font(_font_id_allocator.font_id(_reel - _reels.begin(), asset->id(), is_copy.font().get_value_or("")));
strings.push_back(is_copy);
}
ContentTime::from_frames(_offset - entry_point, vfr) + ContentTime::from_seconds(b.out().as_seconds())
),
strings,
- asset->subtitle_standard()
+ asset->text_standard()
);
strings.clear ();
}
#include <dcp/mono_picture_asset_reader.h>
#include <dcp/stereo_picture_asset_reader.h>
#include <dcp/sound_asset_reader.h>
-#include <dcp/subtitle_asset.h>
+#include <dcp/text_asset.h>
namespace dcp {
void pass_texts (dcpomatic::ContentTime next, dcp::Size size);
void pass_texts (
dcpomatic::ContentTime next,
- std::shared_ptr<dcp::SubtitleAsset> asset,
+ std::shared_ptr<dcp::TextAsset> asset,
bool reference,
int64_t entry_point,
std::shared_ptr<TextDecoder> decoder,
#include <dcp/stereo_picture_asset.h>
#include <dcp/stereo_picture_asset_reader.h>
#include <dcp/stereo_picture_frame.h>
-#include <dcp/subtitle_asset.h>
+#include <dcp/text_asset.h>
#include <iostream>
#include "i18n.h"
LOG_GENERAL_NC ("Subtitle has no key");
break;
}
- sub->subtitles ();
+ sub->texts();
}
if (i->atmos()) {
#include "dcp_subtitle.h"
#include "exceptions.h"
#include "compose.hpp"
-#include <dcp/interop_subtitle_asset.h>
-#include <dcp/smpte_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
+#include <dcp/smpte_text_asset.h>
#include <memory>
#include "i18n.h"
using std::make_shared;
-shared_ptr<dcp::SubtitleAsset>
+shared_ptr<dcp::TextAsset>
DCPSubtitle::load (boost::filesystem::path file) const
{
- shared_ptr<dcp::SubtitleAsset> sc;
+ shared_ptr<dcp::TextAsset> sc;
string interop_error;
string smpte_error;
try {
- sc = make_shared<dcp::InteropSubtitleAsset>(file);
+ sc = make_shared<dcp::InteropTextAsset>(file);
} catch (exception& e) {
interop_error = e.what ();
}
if (!sc) {
try {
- sc = make_shared<dcp::SMPTESubtitleAsset>(file);
+ sc = make_shared<dcp::SMPTETextAsset>(file);
} catch (exception& e) {
smpte_error = e.what();
}
namespace dcp {
- class SubtitleAsset;
+ class TextAsset;
}
class DCPSubtitle
{
protected:
- std::shared_ptr<dcp::SubtitleAsset> load (boost::filesystem::path) const;
+ std::shared_ptr<dcp::TextAsset> load(boost::filesystem::path) const;
};
#include "film.h"
#include "text_content.h"
#include <dcp/raw_convert.h>
-#include <dcp/interop_subtitle_asset.h>
-#include <dcp/smpte_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
+#include <dcp/smpte_text_asset.h>
#include <dcp/interop_load_font_node.h>
#include <libxml++/libxml++.h>
auto subtitle_asset = load(path(0));
- auto iop = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(subtitle_asset);
- auto smpte = dynamic_pointer_cast<dcp::SMPTESubtitleAsset>(subtitle_asset);
+ auto iop = dynamic_pointer_cast<dcp::InteropTextAsset>(subtitle_asset);
+ auto smpte = dynamic_pointer_cast<dcp::SMPTETextAsset>(subtitle_asset);
if (smpte) {
set_video_frame_rate(film, smpte->edit_rate().numerator);
}
/* Default to turning these subtitles on */
only_text()->set_use (true);
- _length = ContentTime::from_seconds(subtitle_asset->latest_subtitle_out().as_seconds());
+ _length = ContentTime::from_seconds(subtitle_asset->latest_text_out().as_seconds());
subtitle_asset->fix_empty_font_ids();
#include "font.h"
#include "text_content.h"
#include "util.h"
-#include <dcp/interop_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
#include <dcp/load_font_node.h>
/* Load the XML or MXF file */
auto const asset = load (content->path(0));
asset->fix_empty_font_ids ();
- _subtitles = asset->subtitles ();
+ _subtitles = asset->texts();
_next = _subtitles.begin ();
- _subtitle_standard = asset->subtitle_standard();
+ _subtitle_standard = asset->text_standard();
text.push_back (make_shared<TextDecoder>(this, content->only_text()));
update_position();
time of emitting the first.
*/
- vector<dcp::SubtitleString> s;
+ vector<dcp::TextString> s;
vector<dcp::SubtitleImage> i;
auto const p = content_time_period (*_next);
while (_next != _subtitles.end () && content_time_period (*_next) == p) {
- auto ns = dynamic_pointer_cast<const dcp::SubtitleString>(*_next);
+ auto ns = dynamic_pointer_cast<const dcp::TextString>(*_next);
if (ns) {
s.push_back (*ns);
++_next;
ContentTimePeriod
-DCPSubtitleDecoder::content_time_period (shared_ptr<const dcp::Subtitle> s) const
+DCPSubtitleDecoder::content_time_period(shared_ptr<const dcp::Text> s) const
{
return {
ContentTime::from_seconds(s->in().as_seconds()),
boost::optional<dcpomatic::ContentTime> first () const;
private:
- dcpomatic::ContentTimePeriod content_time_period (std::shared_ptr<const dcp::Subtitle> s) const;
+ dcpomatic::ContentTimePeriod content_time_period(std::shared_ptr<const dcp::Text> s) const;
void update_position();
- std::vector<std::shared_ptr<const dcp::Subtitle>> _subtitles;
- std::vector<std::shared_ptr<const dcp::Subtitle>>::const_iterator _next;
+ std::vector<std::shared_ptr<const dcp::Text>> _subtitles;
+ std::vector<std::shared_ptr<const dcp::Text>>::const_iterator _next;
- dcp::SubtitleStandard _subtitle_standard;
+ dcp::TextStandard _subtitle_standard;
};
#include "util.h"
#include "video_decoder.h"
#include "video_filter_graph.h"
-#include <dcp/subtitle_string.h>
+#include <dcp/text_string.h>
#include <sub/ssa_reader.h>
#include <sub/subtitle.h>
#include <sub/collect.h>
#include <dcp/reel.h>
#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_subtitle_asset.h>
-#include <dcp/subtitle_asset.h>
+#include <dcp/text_asset.h>
#include <set>
#include <string>
#include <vector>
void
-FontIDAllocator::add_fonts_from_asset(int reel_index, shared_ptr<const dcp::SubtitleAsset> asset)
+FontIDAllocator::add_fonts_from_asset(int reel_index, shared_ptr<const dcp::TextAsset> asset)
{
for (auto const& font: asset->font_data()) {
_map[Font(reel_index, asset->id(), font.first)] = 0;
namespace dcp {
class Reel;
- class SubtitleAsset;
+ class TextAsset;
}
std::string font_id(int reel_index, std::string asset_id, std::string font_id) const;
private:
- void add_fonts_from_asset(int reel_index, std::shared_ptr<const dcp::SubtitleAsset> asset);
+ void add_fonts_from_asset(int reel_index, std::shared_ptr<const dcp::TextAsset> asset);
struct Font
{
static
bool
-subtitle_mxf_too_big (shared_ptr<dcp::SubtitleAsset> asset)
+subtitle_mxf_too_big(shared_ptr<dcp::TextAsset> asset)
{
return asset && asset->file() && dcp::filesystem::file_size(*asset->file()) >= (MAX_TEXT_MXF_SIZE - SIZE_SLACK);
}
#include "util.h"
#include <dcp/cpl.h>
#include <dcp/dcp.h>
-#include <dcp/interop_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
#include <dcp/filesystem.h>
#include <dcp/font_asset.h>
#include <dcp/mono_picture_asset.h>
#include <dcp/reel_picture_asset.h>
#include <dcp/reel_sound_asset.h>
#include <dcp/reel_subtitle_asset.h>
-#include <dcp/smpte_subtitle_asset.h>
+#include <dcp/smpte_text_asset.h>
#include <dcp/sound_asset.h>
#include <dcp/stereo_picture_asset.h>
#include <boost/optional.hpp>
}
};
- auto maybe_copy_font_and_images = [&maybe_copy, output_dir, copy](shared_ptr<const dcp::SubtitleAsset> asset, bool rename, bool hard_link, bool soft_link) {
- auto interop = dynamic_pointer_cast<const dcp::InteropSubtitleAsset>(asset);
+ auto maybe_copy_font_and_images = [&maybe_copy, output_dir, copy](shared_ptr<const dcp::TextAsset> asset, bool rename, bool hard_link, bool soft_link) {
+ auto interop = dynamic_pointer_cast<const dcp::InteropTextAsset>(asset);
boost::optional<boost::filesystem::path> extra;
if (interop) {
extra = interop->id();
for (auto font_asset: interop->font_assets()) {
maybe_copy(font_asset->id(), rename, hard_link, soft_link, extra);
}
- for (auto subtitle: interop->subtitles()) {
+ for (auto subtitle: interop->texts()) {
if (auto image = dynamic_pointer_cast<const dcp::SubtitleImage>(subtitle)) {
auto const output_path = *output_dir / asset->id() / image->file()->filename();
copy(*image->file(), output_path, hard_link, soft_link);
#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include <dcp/filesystem.h>
-#include <dcp/interop_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
#include <dcp/mono_picture_asset.h>
#include <dcp/raw_convert.h>
#include <dcp/reel.h>
#include <dcp/reel_smpte_subtitle_asset.h>
#include <dcp/reel_sound_asset.h>
#include <dcp/reel_stereo_picture_asset.h>
-#include <dcp/smpte_subtitle_asset.h>
+#include <dcp/smpte_text_asset.h>
#include <dcp/sound_asset.h>
#include <dcp/sound_asset_writer.h>
#include <dcp/stereo_picture_asset.h>
template <class Interop, class SMPTE, class Result>
shared_ptr<Result>
maybe_add_text (
- shared_ptr<dcp::SubtitleAsset> asset,
+ shared_ptr<dcp::TextAsset> asset,
int64_t picture_duration,
shared_ptr<dcp::Reel> reel,
int reel_index,
shared_ptr<Result> reel_asset;
if (asset) {
- if (auto interop = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(asset)) {
+ if (auto interop = dynamic_pointer_cast<dcp::InteropTextAsset>(asset)) {
auto directory = output_dcp / interop->id ();
dcp::filesystem::create_directories(directory);
interop->write (directory / subtitle_asset_filename(asset, reel_index, reel_count, content_summary, ".xml"));
picture_duration,
0
);
- } else if (auto smpte = dynamic_pointer_cast<dcp::SMPTESubtitleAsset>(asset)) {
+ } else if (auto smpte = dynamic_pointer_cast<dcp::SMPTETextAsset>(asset)) {
/* All our assets should be the same length; use the picture asset length here
as a reference to set the subtitle one. We'll use the duration rather than
the intrinsic duration; we don't care if the picture asset has been trimmed, we're
}
-shared_ptr<dcp::SubtitleAsset>
+shared_ptr<dcp::TextAsset>
ReelWriter::empty_text_asset (TextType type, optional<DCPTextTrack> track, bool with_dummy) const
{
- shared_ptr<dcp::SubtitleAsset> asset;
+ shared_ptr<dcp::TextAsset> asset;
optional<string> font;
auto lang = film()->subtitle_languages();
if (film()->interop()) {
- auto s = make_shared<dcp::InteropSubtitleAsset>();
+ auto s = make_shared<dcp::InteropTextAsset>();
s->set_movie_title (film()->name());
if (type == TextType::OPEN_SUBTITLE) {
s->set_language (lang.first ? lang.first->to_string() : "Unknown");
s->set_reel_number (raw_convert<string> (_reel_index + 1));
asset = s;
} else {
- auto s = make_shared<dcp::SMPTESubtitleAsset>();
+ auto s = make_shared<dcp::SMPTETextAsset>();
s->set_content_title_text (film()->name());
s->set_metadata (mxf_metadata());
if (type == TextType::OPEN_SUBTITLE && lang.first) {
if (with_dummy) {
asset->add(
- std::make_shared<dcp::SubtitleString>(
+ std::make_shared<dcp::TextString>(
font,
false,
false,
float
-ReelWriter::convert_vertical_position(StringText const& subtitle, dcp::SubtitleStandard to) const
+ReelWriter::convert_vertical_position(StringText const& subtitle, dcp::TextStandard to) const
{
if (dcp::uses_baseline(subtitle.valign_standard) == dcp::uses_baseline(to)) {
/* The from and to standards use the same alignment reference */
void
ReelWriter::write(PlayerText subs, TextType type, optional<DCPTextTrack> track, DCPTimePeriod period, FontIdMap const& fonts, shared_ptr<dcpomatic::Font> chosen_interop_font)
{
- shared_ptr<dcp::SubtitleAsset> asset;
+ shared_ptr<dcp::TextAsset> asset;
switch (type) {
case TextType::OPEN_SUBTITLE:
for (auto i: subs.string) {
i.set_in (dcp::Time(period.from.seconds() - _period.from.seconds(), tcr));
i.set_out (dcp::Time(period.to.seconds() - _period.from.seconds(), tcr));
- i.set_v_position(convert_vertical_position(i, film()->interop() ? dcp::SubtitleStandard::INTEROP : dcp::SubtitleStandard::SMPTE_2014));
- auto sub = make_shared<dcp::SubtitleString>(i);
+ i.set_v_position(convert_vertical_position(i, film()->interop() ? dcp::TextStandard::INTEROP : dcp::TextStandard::SMPTE_2014));
+ auto sub = make_shared<dcp::TextString>(i);
/* i.font is a shared_ptr<Font> which uniquely identifies the font we want,
* though if we are Interop we can only have one font, so we'll use the chosen
* one instead.
class SoundAssetWriter;
class StereoPictureAsset;
class StereoPictureAssetWriter;
- class SubtitleAsset;
+ class TextAsset;
}
long frame_info_position (Frame frame, Eyes eyes) const;
Frame check_existing_picture_asset (boost::filesystem::path asset);
bool existing_picture_frame_ok (dcp::File& asset_file, std::shared_ptr<InfoFileHandle> info_file, Frame frame) const;
- std::shared_ptr<dcp::SubtitleAsset> empty_text_asset (TextType type, boost::optional<DCPTextTrack> track, bool with_dummy) const;
+ std::shared_ptr<dcp::TextAsset> empty_text_asset(TextType type, boost::optional<DCPTextTrack> track, bool with_dummy) const;
std::shared_ptr<dcp::ReelPictureAsset> create_reel_picture (std::shared_ptr<dcp::Reel> reel, std::list<ReferencedReelAsset> const & refs) const;
void create_reel_sound (std::shared_ptr<dcp::Reel> reel, std::list<ReferencedReelAsset> const & refs) const;
std::set<DCPTextTrack> ensure_closed_captions
) const;
void create_reel_markers (std::shared_ptr<dcp::Reel> reel) const;
- float convert_vertical_position(StringText const& subtitle, dcp::SubtitleStandard to) const;
+ float convert_vertical_position(StringText const& subtitle, dcp::TextStandard to) const;
dcpomatic::DCPTimePeriod _period;
/** the first picture frame index that does not already exist in our MXF */
std::shared_ptr<dcp::PictureAssetWriter> _picture_asset_writer;
std::shared_ptr<dcp::SoundAsset> _sound_asset;
std::shared_ptr<dcp::SoundAssetWriter> _sound_asset_writer;
- std::shared_ptr<dcp::SubtitleAsset> _subtitle_asset;
- std::map<DCPTextTrack, std::shared_ptr<dcp::SubtitleAsset>> _closed_caption_assets;
+ std::shared_ptr<dcp::TextAsset> _subtitle_asset;
+ std::map<DCPTextTrack, std::shared_ptr<dcp::TextAsset>> _closed_caption_assets;
std::shared_ptr<dcp::AtmosAsset> _atmos_asset;
std::shared_ptr<dcp::AtmosAssetWriter> _atmos_asset_writer;
* @return y position of the top of the subtitle bounding box (in pixels) from the top of the screen.
*/
static int
-y_position(dcp::SubtitleStandard standard, dcp::VAlign align, float position, int target_height, int baseline_to_bottom, int layout_height)
+y_position(dcp::TextStandard standard, dcp::VAlign align, float position, int target_height, int baseline_to_bottom, int layout_height)
{
int y = 0;
switch (standard) {
- case dcp::SubtitleStandard::INTEROP:
- case dcp::SubtitleStandard::SMPTE_2014:
+ case dcp::TextStandard::INTEROP:
+ case dcp::TextStandard::SMPTE_2014:
switch (align) {
case dcp::VAlign::TOP:
/* position is distance from top of frame to subtitle baseline */
break;
}
break;
- case dcp::SubtitleStandard::SMPTE_2007:
- case dcp::SubtitleStandard::SMPTE_2010:
+ case dcp::TextStandard::SMPTE_2007:
+ case dcp::TextStandard::SMPTE_2010:
switch (align) {
case dcp::VAlign::TOP:
/* v_position is distance from top of frame to top of subtitle */
vector<dcpomatic::Rect<int>>
-bounding_box(vector<StringText> subtitles, dcp::Size target, optional<dcp::SubtitleStandard> override_standard)
+bounding_box(vector<StringText> subtitles, dcp::Size target, optional<dcp::TextStandard> override_standard)
{
vector<StringText> pending;
vector<dcpomatic::Rect<int>> rects;
std::string marked_up(std::vector<StringText> subtitles, int target_height, float fade_factor, std::string font_name);
std::vector<PositionImage> render_text(std::vector<StringText>, dcp::Size, dcpomatic::DCPTime, int);
-std::vector<dcpomatic::Rect<int>> bounding_box(std::vector<StringText> subtitles, dcp::Size target, boost::optional<dcp::SubtitleStandard> override_standard = boost::none);
+std::vector<dcpomatic::Rect<int>> bounding_box(std::vector<StringText> subtitles, dcp::Size target, boost::optional<dcp::TextStandard> override_standard = boost::none);
class FontMetrics
#include "font.h"
-#include <dcp/subtitle_standard.h>
-#include <dcp/subtitle_string.h>
+#include <dcp/text_standard.h>
+#include <dcp/text_string.h>
/** A wrapper for SubtitleString which allows us to:
* - include details of how v_align should be interpreted
*
* - specify the font by referring to a Font object from the content we came from, rather than
- * having to use a DCP ID like in dcp::SubtitleString.
+ * having to use a DCP ID like in dcp::TextString.
*/
-class StringText : public dcp::SubtitleString
+class StringText : public dcp::TextString
{
public:
- StringText(dcp::SubtitleString dcp_, int outline_width_, std::shared_ptr<dcpomatic::Font> font_, dcp::SubtitleStandard valign_standard_)
- : dcp::SubtitleString (dcp_)
+ StringText(dcp::TextString dcp_, int outline_width_, std::shared_ptr<dcpomatic::Font> font_, dcp::TextStandard valign_standard_)
+ : dcp::TextString(dcp_)
, outline_width (outline_width_)
, font (font_)
, valign_standard (valign_standard_)
* center - centre of screen to baseline of subtitle
* bottom - bottom of screen to baseline of subtitle
*/
- dcp::SubtitleStandard valign_standard;
+ dcp::TextStandard valign_standard;
};
#include "string_text_file_content.h"
#include "text_content.h"
#include "text_decoder.h"
-#include <dcp/subtitle_string.h>
+#include <dcp/text_string.h>
#include <iostream>
#include "player.h"
#include "subtitle_encoder.h"
#include <dcp/filesystem.h>
-#include <dcp/interop_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
#include <dcp/raw_convert.h>
-#include <dcp/smpte_subtitle_asset.h>
+#include <dcp/smpte_text_asset.h>
#include <boost/filesystem.hpp>
#include <boost/bind/bind.hpp>
}
}
- _assets.push_back(make_pair(shared_ptr<dcp::SubtitleAsset>(), dcp::filesystem::change_extension(filename, extension)));
+ _assets.push_back(make_pair(shared_ptr<dcp::TextAsset>(), dcp::filesystem::change_extension(filename, extension)));
}
for (auto i: film->reels()) {
if (!i.first) {
/* No subtitles arrived for this asset; make an empty one so we write something to the output */
if (_film->interop()) {
- auto s = make_shared<dcp::InteropSubtitleAsset>();
+ auto s = make_shared<dcp::InteropTextAsset>();
s->set_movie_title (_film->name());
s->set_reel_number (raw_convert<string>(reel + 1));
i.first = s;
} else {
- auto s = make_shared<dcp::SMPTESubtitleAsset>();
+ auto s = make_shared<dcp::SMPTETextAsset>();
s->set_content_title_text (_film->name());
s->set_reel_number (reel + 1);
i.first = s;
}
if (!_assets[_reel_index].first) {
- shared_ptr<dcp::SubtitleAsset> asset;
+ shared_ptr<dcp::TextAsset> asset;
auto lang = _film->subtitle_languages ();
if (_film->interop ()) {
- auto s = make_shared<dcp::InteropSubtitleAsset>();
+ auto s = make_shared<dcp::InteropTextAsset>();
s->set_movie_title (_film->name());
if (lang.first) {
s->set_language (lang.first->to_string());
s->set_reel_number (raw_convert<string>(_reel_index + 1));
_assets[_reel_index].first = s;
} else {
- auto s = make_shared<dcp::SMPTESubtitleAsset>();
+ auto s = make_shared<dcp::SMPTETextAsset>();
s->set_content_title_text (_film->name());
if (lang.first) {
s->set_language (*lang.first);
if (_film->interop() && !_include_font) {
i.unset_font ();
}
- _assets[_reel_index].first->add (make_shared<dcp::SubtitleString>(i));
+ _assets[_reel_index].first->add(make_shared<dcp::TextString>(i));
}
if (_split_reels && (_reel_index < int(_reels.size()) - 1) && period.from > _reels[_reel_index].from) {
namespace dcp {
- class SubtitleAsset;
+ class TextAsset;
}
private:
void text (PlayerText subs, TextType type, boost::optional<DCPTextTrack> track, dcpomatic::DCPTimePeriod period);
- std::vector<std::pair<std::shared_ptr<dcp::SubtitleAsset>, boost::filesystem::path>> _assets;
+ std::vector<std::pair<std::shared_ptr<dcp::TextAsset>, boost::filesystem::path>> _assets;
std::vector<dcpomatic::DCPTimePeriod> _reels;
bool _split_reels;
bool _include_font;
void
-TextDecoder::emit_plain_start(ContentTime from, vector<dcp::SubtitleString> subtitles, dcp::SubtitleStandard valign_standard)
+TextDecoder::emit_plain_start(ContentTime from, vector<dcp::TextString> subtitles, dcp::TextStandard valign_standard)
{
vector<StringText> string_texts;
return dcp::Colour(lrintf(c.r * 255), lrintf(c.g * 255), lrintf(c.b * 255));
};
- auto dcp_subtitle = dcp::SubtitleString(
+ auto dcp_subtitle = dcp::TextString(
optional<string>(),
block.italic,
block.bold,
dcp_subtitle,
content()->outline_width(),
font,
- dcp::SubtitleStandard::SMPTE_2014
+ dcp::TextStandard::SMPTE_2014
);
set_forced_appearance(content(), string_text);
string_texts.push_back(string_text);
void
-TextDecoder::emit_plain(ContentTimePeriod period, vector<dcp::SubtitleString> subtitles, dcp::SubtitleStandard valign_standard)
+TextDecoder::emit_plain(ContentTimePeriod period, vector<dcp::TextString> subtitles, dcp::TextStandard valign_standard)
{
emit_plain_start (period.from, subtitles, valign_standard);
emit_stop (period.to);
#include "rect.h"
#include "content_text.h"
#include "types.h"
-#include <dcp/subtitle_standard.h>
-#include <dcp/subtitle_string.h>
+#include <dcp/text_standard.h>
+#include <dcp/text_string.h>
#include <boost/signals2.hpp>
void emit_bitmap_start (ContentBitmapText const& bitmap);
void emit_bitmap (dcpomatic::ContentTimePeriod period, std::shared_ptr<const Image> image, dcpomatic::Rect<double> rect);
- void emit_plain_start(dcpomatic::ContentTime from, std::vector<dcp::SubtitleString> s, dcp::SubtitleStandard valign_standard);
+ void emit_plain_start(dcpomatic::ContentTime from, std::vector<dcp::TextString> s, dcp::TextStandard valign_standard);
void emit_plain_start (dcpomatic::ContentTime from, sub::Subtitle const & subtitle);
- void emit_plain(dcpomatic::ContentTimePeriod period, std::vector<dcp::SubtitleString> s, dcp::SubtitleStandard valign_standard);
+ void emit_plain(dcpomatic::ContentTimePeriod period, std::vector<dcp::TextString> s, dcp::TextStandard valign_standard);
void emit_plain (dcpomatic::ContentTimePeriod period, sub::Subtitle const & subtitle);
void emit_stop (dcpomatic::ContentTime to);
#include <dcp/picture_asset.h>
#include <dcp/raw_convert.h>
#include <dcp/sound_asset.h>
-#include <dcp/subtitle_asset.h>
+#include <dcp/text_asset.h>
#include <dcp/util.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX)
/* Render something to fontconfig to create its cache */
vector<StringText> subs;
- dcp::SubtitleString ss(
+ dcp::TextString ss(
optional<string>(), false, false, false, dcp::Colour(), 42, 1, dcp::Time(), dcp::Time(), 0, dcp::HAlign::CENTER, 0, dcp::VAlign::CENTER, 0, dcp::Direction::LTR,
"Hello dolly", dcp::Effect::NONE, dcp::Colour(), dcp::Time(), dcp::Time(), 0, std::vector<dcp::Ruby>()
);
string
-subtitle_asset_filename (shared_ptr<dcp::SubtitleAsset> asset, int reel_index, int reel_count, optional<string> summary, string extension)
+subtitle_asset_filename(shared_ptr<dcp::TextAsset> asset, int reel_index, int reel_count, optional<string> summary, string extension)
{
return asset_filename(asset, "sub", reel_index, reel_count, summary, extension);
}
namespace dcp {
class PictureAsset;
class SoundAsset;
- class SubtitleAsset;
+ class TextAsset;
}
extern std::string program_name;
extern void set_backtrace_file (boost::filesystem::path);
extern std::string video_asset_filename (std::shared_ptr<dcp::PictureAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
extern std::string audio_asset_filename (std::shared_ptr<dcp::SoundAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
-extern std::string subtitle_asset_filename (std::shared_ptr<dcp::SubtitleAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary, std::string extension);
+extern std::string subtitle_asset_filename(std::shared_ptr<dcp::TextAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary, std::string extension);
extern std::string atmos_asset_filename (std::shared_ptr<dcp::AtmosAsset> asset, int reel_index, int reel_count, boost::optional<std::string> content_summary);
extern std::string careful_string_filter (std::string);
extern std::pair<int, int> audio_channel_types (std::list<int> mapped, int channels);
#include "test.h"
#include <dcp/mono_picture_asset.h>
#include <dcp/openjpeg_image.h>
-#include <dcp/smpte_subtitle_asset.h>
+#include <dcp/smpte_text_asset.h>
#include <boost/test/unit_test.hpp>
#include <iostream>
dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
});
- dcp::SMPTESubtitleAsset check(dcp_file(film, "sub_"));
- auto subs = check.subtitles();
+ dcp::SMPTETextAsset check(dcp_file(film, "sub_"));
+ auto subs = check.texts();
BOOST_REQUIRE_EQUAL(subs.size(), 1U);
- auto sub = std::dynamic_pointer_cast<const dcp::SubtitleString>(subs[0]);
+ auto sub = std::dynamic_pointer_cast<const dcp::TextString>(subs[0]);
BOOST_REQUIRE(sub);
- /* libdcp::SubtitleAsset gets the text from the XML with get_content(), which
+ /* dcp::TextAsset gets the text from the XML with get_content(), which
* resolves the 5 predefined entities & " < > ' so we shouldn't see any
* entity here.
*/
#include "lib/render_text.h"
#include "lib/string_text.h"
#include "test.h"
-#include <dcp/subtitle_string.h>
+#include <dcp/text_string.h>
#include <boost/test/unit_test.hpp>
{
s.push_back (
StringText (
- dcp::SubtitleString (
+ dcp::TextString(
boost::optional<std::string> (),
italic,
bold,
),
2,
std::shared_ptr<dcpomatic::Font>(),
- dcp::SubtitleStandard::SMPTE_2014
+ dcp::TextStandard::SMPTE_2014
)
);
}
BOOST_AUTO_TEST_CASE(render_text_with_newline_test)
{
- std::list<dcp::SubtitleString> ss = {
+ std::list<dcp::TextString> ss = {
{
{}, true, false, false, dcp::Colour(255, 255, 255), 42, 1.0,
dcp::Time(0, 0, 0, 0, 24), dcp::Time(0, 0, 1, 0, 24),
std::vector<StringText> st;
for (auto i: ss) {
- st.push_back({i, 0, make_shared<dcpomatic::Font>("foo"), dcp::SubtitleStandard::SMPTE_2014});
+ st.push_back({i, 0, make_shared<dcpomatic::Font>("foo"), dcp::TextStandard::SMPTE_2014});
}
auto images = render_text(st, dcp::Size(1998, 1080), {}, 24);
BOOST_AUTO_TEST_CASE (render_text_test)
{
- auto dcp_string = dcp::SubtitleString(
+ auto dcp_string = dcp::TextString(
{}, false, false, false, dcp::Colour(255, 255, 255), 42, 1.0,
dcp::Time(0, 0, 0, 0, 24), dcp::Time(0, 0, 1, 0, 24),
0.5, dcp::HAlign::CENTER,
#include "lib/string_text_file_content.h"
#include "lib/text_content.h"
#include "test.h"
-#include <dcp/smpte_subtitle_asset.h>
-#include <dcp/subtitle_string.h>
+#include <dcp/smpte_text_asset.h>
+#include <dcp/text_string.h>
#include <boost/algorithm/string.hpp>
#include <boost/test/unit_test.hpp>
#include <list>
dcp::VerificationNote::Code::INVALID_SUBTITLE_SPACING,
});
- dcp::SMPTESubtitleAsset check(dcp_file(film, "sub_"));
- auto subs = check.subtitles();
+ dcp::SMPTETextAsset check(dcp_file(film, "sub_"));
+ auto subs = check.texts();
BOOST_REQUIRE_EQUAL(subs.size(), 1U);
- auto sub = std::dynamic_pointer_cast<const dcp::SubtitleString>(subs[0]);
+ auto sub = std::dynamic_pointer_cast<const dcp::TextString>(subs[0]);
BOOST_REQUIRE(sub);
- /* libdcp::SubtitleAsset gets the text from the XML with get_content(), which
+ /* dcp::TextAsset gets the text from the XML with get_content(), which
* resolves the 5 predefined entities & " < > ' so we shouldn't see any
* entity here.
*/
#include "lib/text_content.h"
#include "test.h"
#include <dcp/equality_options.h>
-#include <dcp/interop_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string.hpp>
make_and_verify_dcp (film, { dcp::VerificationNote::Code::INVALID_STANDARD });
- auto ref = make_shared<dcp::InteropSubtitleAsset>(TestPaths::private_data() / "DKH_UT_EN20160601def.xml");
- auto check = make_shared<dcp::InteropSubtitleAsset>(subtitle_file(film));
+ auto ref = make_shared<dcp::InteropTextAsset>(TestPaths::private_data() / "DKH_UT_EN20160601def.xml");
+ auto check = make_shared<dcp::InteropTextAsset>(subtitle_file(film));
dcp::EqualityOptions options;
options.max_subtitle_vertical_position_error = 0.1;
#include <dcp/dcp.h>
#include <dcp/reel.h>
#include <dcp/reel_subtitle_asset.h>
-#include <dcp/smpte_subtitle_asset.h>
+#include <dcp/smpte_text_asset.h>
#include "test.h"
#include <boost/test/unit_test.hpp>
});
auto check_file = subtitle_file(film);
- dcp::SMPTESubtitleAsset check_asset(check_file);
+ dcp::SMPTETextAsset check_asset(check_file);
BOOST_CHECK_EQUAL(check_asset.load_font_nodes().size(), 1U);
auto check_font_data = check_asset.font_data();
BOOST_CHECK_EQUAL(check_font_data.size(), 1U);
});
auto check_file = subtitle_file(film);
- dcp::SMPTESubtitleAsset check_asset(check_file);
+ dcp::SMPTETextAsset check_asset(check_file);
BOOST_CHECK_EQUAL(check_asset.load_font_nodes().size(), 1U);
auto check_font_data = check_asset.font_data();
BOOST_CHECK_EQUAL(check_font_data.size(), 1U);
BOOST_REQUIRE(check_subs);
BOOST_CHECK_EQUAL(check_subs->font_data().size(), 1U);
- BOOST_REQUIRE_EQUAL(check_subs->subtitles().size(), 1U);
- BOOST_CHECK(!std::dynamic_pointer_cast<const dcp::SubtitleString>(check_subs->subtitles()[0])->font().has_value());
+ BOOST_REQUIRE_EQUAL(check_subs->texts().size(), 1U);
+ BOOST_CHECK(!std::dynamic_pointer_cast<const dcp::TextString>(check_subs->texts()[0])->font().has_value());
auto check_film = new_test_film2(name_base + "_check", { make_shared<DCPContent>(bad_film->dir(bad_film->dcp_name())) });
make_and_verify_dcp(check_film);
#include "lib/make_dcp.h"
#include "lib/text_content.h"
#include "test.h"
-#include <dcp/interop_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
#include <dcp/language_tag.h>
-#include <dcp/smpte_subtitle_asset.h>
+#include <dcp/smpte_text_asset.h>
#include <boost/test/unit_test.hpp>
#include <vector>
auto output = subtitle_file(film);
- dcp::InteropSubtitleAsset asset(output);
- auto output_subs = asset.subtitles();
+ dcp::InteropTextAsset asset(output);
+ auto output_subs = asset.texts();
BOOST_REQUIRE_EQUAL(output_subs.size(), 1U);
BOOST_CHECK(output_subs[0]->v_align() == dcp::VAlign::BOTTOM);
auto output = subtitle_file(film);
- dcp::SMPTESubtitleAsset asset(output);
- auto output_subs = asset.subtitles();
+ dcp::SMPTETextAsset asset(output);
+ auto output_subs = asset.texts();
BOOST_REQUIRE_EQUAL(output_subs.size(), 1U);
BOOST_CHECK(output_subs[0]->v_align() == dcp::VAlign::BOTTOM);
/** Make a DCP from some DCP subtitles and check the vertical alignment */
static
void
-vpos_test(dcp::VAlign reference, float position, dcp::SubtitleStandard from, dcp::Standard to)
+vpos_test(dcp::VAlign reference, float position, dcp::TextStandard from, dcp::Standard to)
{
string standard;
switch (from) {
- case dcp::SubtitleStandard::SMPTE_2007:
- case dcp::SubtitleStandard::SMPTE_2010:
+ case dcp::TextStandard::SMPTE_2007:
+ case dcp::TextStandard::SMPTE_2010:
standard = "smpte_2010";
break;
- case dcp::SubtitleStandard::INTEROP:
+ case dcp::TextStandard::INTEROP:
standard = "interop";
break;
- case dcp::SubtitleStandard::SMPTE_2014:
+ case dcp::TextStandard::SMPTE_2014:
standard = "smpte_2014";
break;
}
BOOST_REQUIRE(!wait_for_jobs());
auto out = subtitle_file(film);
- vector<shared_ptr<const dcp::Subtitle>> subtitles;
+ vector<shared_ptr<const dcp::Text>> subtitles;
if (to == dcp::Standard::INTEROP) {
- dcp::InteropSubtitleAsset asset(out);
- subtitles = asset.subtitles();
+ dcp::InteropTextAsset asset(out);
+ subtitles = asset.texts();
} else {
- dcp::SMPTESubtitleAsset asset(out);
- subtitles = asset.subtitles();
+ dcp::SMPTETextAsset asset(out);
+ subtitles = asset.texts();
}
BOOST_REQUIRE_EQUAL(subtitles.size(), 1U);
constexpr auto height = 0.0462963;
/* Interop source */
- auto from = dcp::SubtitleStandard::INTEROP;
+ auto from = dcp::TextStandard::INTEROP;
// -> Interop
vpos_test(dcp::VAlign::TOP, 0.2, from, dcp::Standard::INTEROP);
vpos_test(dcp::VAlign::BOTTOM, 0.08, from, dcp::Standard::SMPTE);
/* SMPTE 2010 source */
- from = dcp::SubtitleStandard::SMPTE_2010;
+ from = dcp::TextStandard::SMPTE_2010;
// -> Interop
vpos_test(dcp::VAlign::TOP, 0.1 + height - baseline_to_bottom, from, dcp::Standard::INTEROP);
vpos_test(dcp::VAlign::BOTTOM, 0.10 + baseline_to_bottom, from, dcp::Standard::SMPTE);
/* SMPTE 2014 source */
- from = dcp::SubtitleStandard::SMPTE_2014;
+ from = dcp::TextStandard::SMPTE_2014;
// -> Interop
vpos_test(dcp::VAlign::TOP, 0.2, from, dcp::Standard::INTEROP);
#include <dcp/cpl.h>
#include <dcp/dcp.h>
#include <dcp/reel.h>
-#include <dcp/interop_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
#include <dcp/reel_subtitle_asset.h>
#include <dcp/raw_convert.h>
#include <boost/test/unit_test.hpp>
int n = 1;
for (auto i: cpl->reels()) {
if (i->main_subtitle()) {
- auto ass = dynamic_pointer_cast<dcp::InteropSubtitleAsset>(i->main_subtitle()->asset());
+ auto ass = dynamic_pointer_cast<dcp::InteropTextAsset>(i->main_subtitle()->asset());
BOOST_REQUIRE (ass);
BOOST_CHECK_EQUAL (ass->reel_number(), dcp::raw_convert<string>(n));
++n;
#include <dcp/dcp.h>
#include <dcp/cpl.h>
#include <dcp/reel.h>
-#include <dcp/interop_subtitle_asset.h>
+#include <dcp/interop_text_asset.h>
#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_subtitle_asset.h>
#include <boost/test/unit_test.hpp>
auto i = reels.begin ();
BOOST_REQUIRE ((*i)->main_subtitle());
BOOST_REQUIRE ((*i)->main_subtitle()->asset());
- auto A = std::dynamic_pointer_cast<dcp::InteropSubtitleAsset>((*i)->main_subtitle()->asset());
+ auto A = std::dynamic_pointer_cast<dcp::InteropTextAsset>((*i)->main_subtitle()->asset());
BOOST_REQUIRE (A);
++i;
BOOST_REQUIRE ((*i)->main_subtitle());
BOOST_REQUIRE ((*i)->main_subtitle()->asset());
- auto B = std::dynamic_pointer_cast<dcp::InteropSubtitleAsset>((*i)->main_subtitle()->asset());
+ auto B = std::dynamic_pointer_cast<dcp::InteropTextAsset>((*i)->main_subtitle()->asset());
BOOST_REQUIRE (B);
- BOOST_REQUIRE_EQUAL (A->subtitles().size(), 1U);
- BOOST_REQUIRE_EQUAL (B->subtitles().size(), 1U);
+ BOOST_REQUIRE_EQUAL(A->texts().size(), 1U);
+ BOOST_REQUIRE_EQUAL(B->texts().size(), 1U);
/* These times should be the same as they are should be offset from the start of the reel */
- BOOST_CHECK (A->subtitles().front()->in() == B->subtitles().front()->in());
+ BOOST_CHECK(A->texts().front()->in() == B->texts().front()->in());
}
/** Check that with a SMPTE DCP if we have subtitles in one reel, all reels have a
- * SubtitleAsset (even if it's empty); SMPTE Bv2.1 section 8.3.1.
+ * TextAsset (even if it's empty); SMPTE Bv2.1 section 8.3.1.
*/
BOOST_AUTO_TEST_CASE (subtitle_in_all_reels_test)
{
BOOST_REQUIRE (reel_sub);
auto sub = reel_sub->asset();
BOOST_REQUIRE (sub);
- BOOST_CHECK_EQUAL (sub->subtitles().size(), 1U);
+ BOOST_CHECK_EQUAL(sub->texts().size(), 1U);
}
}
BOOST_REQUIRE(reel->main_subtitle());
BOOST_REQUIRE(reel->main_subtitle()->asset());
- auto subs = reel->main_subtitle()->asset()->subtitles();
+ auto subs = reel->main_subtitle()->asset()->texts();
int index = 0;
for (auto i: subs) {
auto error = std::abs(i->in().as_seconds() - (index * content_frame_rate / dcp_frame_rate));