summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-08-06 23:57:22 +0200
committerCarl Hetherington <cth@carlh.net>2024-09-03 17:02:24 +0200
commitf3ab77e34a41ad4d8f5156e9d6598314975b9565 (patch)
tree638c81f1b1e71ee138afd4d58ef404e7b3c7f523 /src/lib
parente65d17fa04c411295496968f6ecee9b3a6c21fae (diff)
Adapt to some libdcp class renaming to allow open captions/closed subtitles.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/content_factory.cc4
-rw-r--r--src/lib/content_text.h2
-rw-r--r--src/lib/dcp_content.cc3
-rw-r--r--src/lib/dcp_decoder.cc17
-rw-r--r--src/lib/dcp_decoder.h4
-rw-r--r--src/lib/dcp_digest_file.cc6
-rw-r--r--src/lib/dcp_examiner.cc7
-rw-r--r--src/lib/dcp_subtitle.cc12
-rw-r--r--src/lib/dcp_subtitle.h4
-rw-r--r--src/lib/dcp_subtitle_content.cc12
-rw-r--r--src/lib/dcp_subtitle_content.h2
-rw-r--r--src/lib/dcp_subtitle_decoder.cc16
-rw-r--r--src/lib/dcp_subtitle_decoder.h8
-rw-r--r--src/lib/ffmpeg_decoder.cc2
-rw-r--r--src/lib/font_id_allocator.cc7
-rw-r--r--src/lib/font_id_allocator.h4
-rw-r--r--src/lib/hints.cc5
-rw-r--r--src/lib/map_cli.cc15
-rw-r--r--src/lib/player.cc3
-rw-r--r--src/lib/reel_writer.cc53
-rw-r--r--src/lib/reel_writer.h8
-rw-r--r--src/lib/referenced_reel_asset.cc3
-rw-r--r--src/lib/string_text.h10
-rw-r--r--src/lib/string_text_file_decoder.cc4
-rw-r--r--src/lib/subtitle_film_encoder.cc18
-rw-r--r--src/lib/subtitle_film_encoder.h4
-rw-r--r--src/lib/text_decoder.cc6
-rw-r--r--src/lib/text_decoder.h6
-rw-r--r--src/lib/text_type.cc12
-rw-r--r--src/lib/text_type.h4
-rw-r--r--src/lib/util.cc8
-rw-r--r--src/lib/util.h8
-rw-r--r--src/lib/writer.cc31
33 files changed, 158 insertions, 150 deletions
diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc
index dfa1ba55e..bac41f940 100644
--- a/src/lib/content_factory.cc
+++ b/src/lib/content_factory.cc
@@ -41,7 +41,7 @@
#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"
@@ -178,7 +178,7 @@ content_factory (boost::filesystem::path path)
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);
diff --git a/src/lib/content_text.h b/src/lib/content_text.h
index 51d4e8009..4b59ac65f 100644
--- a/src/lib/content_text.h
+++ b/src/lib/content_text.h
@@ -27,7 +27,7 @@
#include "dcpomatic_time.h"
#include "rect.h"
#include "string_text.h"
-#include <dcp/subtitle_string.h>
+#include <dcp/text_string.h>
#include <vector>
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 35b175736..b61138577 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -36,9 +36,8 @@
#include <dcp/dcp.h>
#include <dcp/raw_convert.h>
#include <dcp/exceptions.h>
-#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_picture_asset.h>
-#include <dcp/reel_subtitle_asset.h>
+#include <dcp/reel_text_asset.h>
#include <dcp/reel.h>
#include <dcp/scope_guard.h>
#include <libxml++/libxml++.h>
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc
index abbaaf15d..cd792c0b7 100644
--- a/src/lib/dcp_decoder.cc
+++ b/src/lib/dcp_decoder.cc
@@ -45,17 +45,16 @@
#include <dcp/mono_mpeg2_picture_asset.h>
#include <dcp/reel.h>
#include <dcp/reel_atmos_asset.h>
-#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_picture_asset.h>
#include <dcp/reel_sound_asset.h>
-#include <dcp/reel_subtitle_asset.h>
+#include <dcp/reel_text_asset.h>
#include <dcp/search.h>
#include <dcp/sound_asset_reader.h>
#include <dcp/sound_frame.h>
#include <dcp/stereo_j2k_picture_asset.h>
#include <dcp/stereo_j2k_picture_asset_reader.h>
#include <dcp/stereo_j2k_picture_frame.h>
-#include <dcp/subtitle_image.h>
+#include <dcp/text_image.h>
#include <iostream>
#include "i18n.h"
@@ -318,7 +317,7 @@ DCPDecoder::pass_texts (ContentTime next, dcp::Size size)
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());
@@ -326,16 +325,16 @@ DCPDecoder::pass_texts (
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();
@@ -350,7 +349,7 @@ DCPDecoder::pass_texts (
strings.clear ();
}
- dcp::SubtitleString is_copy = *is;
+ auto is_copy = *is;
if (is_copy.font()) {
is_copy.set_font(_font_id_allocator.font_id(_reel - _reels.begin(), asset->id(), is_copy.font().get()));
} else {
@@ -363,7 +362,7 @@ DCPDecoder::pass_texts (
this would need to be done both here and in DCPSubtitleDecoder.
*/
- auto ii = dynamic_pointer_cast<const dcp::SubtitleImage>(i);
+ auto ii = dynamic_pointer_cast<const dcp::TextImage>(i);
if (ii) {
emit_subtitle_image (
ContentTimePeriod (
diff --git a/src/lib/dcp_decoder.h b/src/lib/dcp_decoder.h
index ee0f30694..56a13874b 100644
--- a/src/lib/dcp_decoder.h
+++ b/src/lib/dcp_decoder.h
@@ -32,7 +32,7 @@
#include <dcp/mono_mpeg2_picture_asset_reader.h>
#include <dcp/mpeg2_transcode.h>
#include <dcp/sound_asset_reader.h>
-#include <dcp/subtitle_asset.h>
+#include <dcp/text_asset.h>
namespace dcp {
@@ -79,7 +79,7 @@ private:
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,
diff --git a/src/lib/dcp_digest_file.cc b/src/lib/dcp_digest_file.cc
index 4278caa98..57e87bd6f 100644
--- a/src/lib/dcp_digest_file.cc
+++ b/src/lib/dcp_digest_file.cc
@@ -24,9 +24,9 @@
#include <dcp/mxf.h>
#include <dcp/reel.h>
#include <dcp/reel_picture_asset.h>
+#include <dcp/reel_smpte_text_asset.h>
#include <dcp/reel_sound_asset.h>
-#include <dcp/reel_subtitle_asset.h>
-#include <dcp/reel_smpte_subtitle_asset.h>
+#include <dcp/reel_text_asset.h>
#include <dcp/warnings.h>
LIBDCP_DISABLE_WARNINGS
#include <libxml++/libxml++.h>
@@ -80,7 +80,7 @@ write_dcp_digest_file (
if (in_reel->main_sound()) {
add_asset(film_key, in_reel->main_sound(), in_reel->main_sound()->asset(), out_reel, "MainSound");
}
- if (auto smpte_sub = dynamic_pointer_cast<dcp::ReelSMPTESubtitleAsset>(in_reel->main_subtitle())) {
+ if (auto smpte_sub = dynamic_pointer_cast<dcp::ReelSMPTETextAsset>(in_reel->main_subtitle())) {
add_asset(film_key, smpte_sub, smpte_sub->smpte_asset(), out_reel, "MainSubtitle");
}
}
diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc
index a7af9feca..3f8b4ca90 100644
--- a/src/lib/dcp_examiner.cc
+++ b/src/lib/dcp_examiner.cc
@@ -39,11 +39,10 @@
#include <dcp/mpeg2_transcode.h>
#include <dcp/reel.h>
#include <dcp/reel_atmos_asset.h>
-#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_markers_asset.h>
#include <dcp/reel_picture_asset.h>
#include <dcp/reel_sound_asset.h>
-#include <dcp/reel_subtitle_asset.h>
+#include <dcp/reel_text_asset.h>
#include <dcp/search.h>
#include <dcp/sound_asset.h>
#include <dcp/sound_asset.h>
@@ -51,7 +50,7 @@
#include <dcp/stereo_j2k_picture_asset.h>
#include <dcp/stereo_j2k_picture_asset_reader.h>
#include <dcp/stereo_j2k_picture_frame.h>
-#include <dcp/subtitle_asset.h>
+#include <dcp/text_asset.h>
#include <iostream>
#include "i18n.h"
@@ -343,7 +342,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content, bool tolerant)
LOG_GENERAL_NC ("Subtitle has no key");
break;
}
- sub->subtitles ();
+ sub->texts();
}
if (i->atmos() && i->atmos()->asset_ref().resolved()) {
diff --git a/src/lib/dcp_subtitle.cc b/src/lib/dcp_subtitle.cc
index c2c3f7f70..c2d390b55 100644
--- a/src/lib/dcp_subtitle.cc
+++ b/src/lib/dcp_subtitle.cc
@@ -22,8 +22,8 @@
#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"
@@ -35,22 +35,22 @@ using std::string;
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();
}
diff --git a/src/lib/dcp_subtitle.h b/src/lib/dcp_subtitle.h
index 285dd55bc..0f7928103 100644
--- a/src/lib/dcp_subtitle.h
+++ b/src/lib/dcp_subtitle.h
@@ -28,14 +28,14 @@
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;
};
diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc
index 58007ac34..cbd8638f3 100644
--- a/src/lib/dcp_subtitle_content.cc
+++ b/src/lib/dcp_subtitle_content.cc
@@ -25,9 +25,9 @@
#include "font_id_allocator.h"
#include "text_content.h"
#include <dcp/interop_load_font_node.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 <libxml++/libxml++.h>
#include "i18n.h"
@@ -64,8 +64,8 @@ DCPSubtitleContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
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);
}
@@ -75,7 +75,7 @@ DCPSubtitleContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
/* 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();
add_fonts(only_text(), subtitle_asset);
@@ -83,7 +83,7 @@ DCPSubtitleContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
void
-DCPSubtitleContent::add_fonts(shared_ptr<TextContent> content, shared_ptr<dcp::SubtitleAsset> subtitle_asset)
+DCPSubtitleContent::add_fonts(shared_ptr<TextContent> content, shared_ptr<dcp::TextAsset> subtitle_asset)
{
FontIDAllocator font_id_allocator;
diff --git a/src/lib/dcp_subtitle_content.h b/src/lib/dcp_subtitle_content.h
index a3cd78b39..53b2eaf5c 100644
--- a/src/lib/dcp_subtitle_content.h
+++ b/src/lib/dcp_subtitle_content.h
@@ -42,7 +42,7 @@ public:
dcpomatic::DCPTime approximate_length () const override;
private:
- void add_fonts(std::shared_ptr<TextContent> content, std::shared_ptr<dcp::SubtitleAsset> subtitle_asset);
+ void add_fonts(std::shared_ptr<TextContent> content, std::shared_ptr<dcp::TextAsset> subtitle_asset);
dcpomatic::ContentTime _length;
};
diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc
index 711dc77f2..95e80ac19 100644
--- a/src/lib/dcp_subtitle_decoder.cc
+++ b/src/lib/dcp_subtitle_decoder.cc
@@ -25,7 +25,7 @@
#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>
@@ -45,7 +45,7 @@ DCPSubtitleDecoder::DCPSubtitleDecoder (shared_ptr<const Film> film, shared_ptr<
/* Load the XML or MXF file */
_asset = load(content->path(0));
_asset->fix_empty_font_ids();
- _subtitles = _asset->subtitles();
+ _subtitles = _asset->texts();
_next = _subtitles.begin ();
_subtitle_standard = _asset->subtitle_standard();
@@ -91,14 +91,14 @@ DCPSubtitleDecoder::pass ()
time of emitting the first.
*/
- vector<dcp::SubtitleString> s;
- vector<dcp::SubtitleImage> i;
+ vector<dcp::TextString> s;
+ vector<dcp::TextImage> 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) {
- dcp::SubtitleString ns_copy = *ns;
+ auto ns_copy = *ns;
if (ns_copy.font()) {
ns_copy.set_font(_font_id_allocator.font_id(0, _asset->id(), ns_copy.font().get()));
} else {
@@ -111,7 +111,7 @@ DCPSubtitleDecoder::pass ()
this would need to be done both here and in DCPDecoder.
*/
- auto ni = dynamic_pointer_cast<const dcp::SubtitleImage>(*_next);
+ auto ni = dynamic_pointer_cast<const dcp::TextImage>(*_next);
if (ni) {
emit_subtitle_image (p, *ni, film()->frame_size(), only_text());
++_next;
@@ -128,7 +128,7 @@ DCPSubtitleDecoder::pass ()
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()),
diff --git a/src/lib/dcp_subtitle_decoder.h b/src/lib/dcp_subtitle_decoder.h
index 9d0851253..f11fc3044 100644
--- a/src/lib/dcp_subtitle_decoder.h
+++ b/src/lib/dcp_subtitle_decoder.h
@@ -38,14 +38,14 @@ public:
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;
- std::shared_ptr<dcp::SubtitleAsset> _asset;
+ std::shared_ptr<dcp::TextAsset> _asset;
FontIDAllocator _font_id_allocator;
};
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 29ab5aaf8..9713a26f6 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -45,7 +45,7 @@
#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>
diff --git a/src/lib/font_id_allocator.cc b/src/lib/font_id_allocator.cc
index d5430e858..b85fc90dc 100644
--- a/src/lib/font_id_allocator.cc
+++ b/src/lib/font_id_allocator.cc
@@ -24,9 +24,8 @@
#include "dcpomatic_assert.h"
#include "font_id_allocator.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/reel_text_asset.h>
+#include <dcp/text_asset.h>
#include <set>
#include <string>
#include <vector>
@@ -61,7 +60,7 @@ FontIDAllocator::add_fonts_from_reels(vector<shared_ptr<dcp::Reel>> const& reels
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()) {
add_font(reel_index, asset->id(), font.first);
diff --git a/src/lib/font_id_allocator.h b/src/lib/font_id_allocator.h
index 6737907c1..2a242a8cf 100644
--- a/src/lib/font_id_allocator.h
+++ b/src/lib/font_id_allocator.h
@@ -32,7 +32,7 @@
namespace dcp {
class Reel;
- class SubtitleAsset;
+ class TextAsset;
}
@@ -74,7 +74,7 @@ public:
}
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
{
diff --git a/src/lib/hints.cc b/src/lib/hints.cc
index 1114d0acb..9a947f98d 100644
--- a/src/lib/hints.cc
+++ b/src/lib/hints.cc
@@ -42,8 +42,7 @@
#include <dcp/filesystem.h>
#include <dcp/raw_convert.h>
#include <dcp/reel.h>
-#include <dcp/reel_closed_caption_asset.h>
-#include <dcp/reel_subtitle_asset.h>
+#include <dcp/reel_text_asset.h>
#include <boost/algorithm/string.hpp>
#include <iostream>
@@ -372,7 +371,7 @@ Hints::check_loudness ()
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);
}
diff --git a/src/lib/map_cli.cc b/src/lib/map_cli.cc
index be3841deb..149e09fbc 100644
--- a/src/lib/map_cli.cc
+++ b/src/lib/map_cli.cc
@@ -24,18 +24,17 @@
#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_j2k_picture_asset.h>
#include <dcp/reel.h>
#include <dcp/reel_atmos_asset.h>
-#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_file_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/reel_text_asset.h>
+#include <dcp/smpte_text_asset.h>
#include <dcp/sound_asset.h>
#include <dcp/stereo_j2k_picture_asset.h>
#include <boost/optional.hpp>
@@ -292,16 +291,16 @@ map_cli(int argc, char* argv[], std::function<void (string)> out)
}
};
- 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()) {
- if (auto image = dynamic_pointer_cast<const dcp::SubtitleImage>(subtitle)) {
+ for (auto subtitle: interop->texts()) {
+ if (auto image = dynamic_pointer_cast<const dcp::TextImage>(subtitle)) {
auto const output_path = *output_dir / asset->id() / image->file()->filename();
copy(*image->file(), output_path, hard_link, soft_link);
}
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 14cd95906..20792aec4 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -54,10 +54,9 @@
#include "timer.h"
#include "video_decoder.h"
#include <dcp/reel.h>
-#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_picture_asset.h>
#include <dcp/reel_sound_asset.h>
-#include <dcp/reel_subtitle_asset.h>
+#include <dcp/reel_text_asset.h>
#include <algorithm>
#include <iostream>
#include <stdint.h>
diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc
index d8aff1162..5210466b2 100644
--- a/src/lib/reel_writer.cc
+++ b/src/lib/reel_writer.cc
@@ -41,24 +41,22 @@
#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_j2k_picture_asset.h>
#include <dcp/raw_convert.h>
#include <dcp/reel.h>
#include <dcp/reel_atmos_asset.h>
-#include <dcp/reel_interop_closed_caption_asset.h>
-#include <dcp/reel_interop_subtitle_asset.h>
+#include <dcp/reel_interop_text_asset.h>
#include <dcp/reel_markers_asset.h>
#include <dcp/reel_mono_picture_asset.h>
-#include <dcp/reel_smpte_closed_caption_asset.h>
-#include <dcp/reel_smpte_subtitle_asset.h>
+#include <dcp/reel_smpte_text_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_j2k_picture_asset.h>
-#include <dcp/subtitle_image.h>
+#include <dcp/text_image.h>
#include "i18n.h"
@@ -416,12 +414,13 @@ ReelWriter::finish (boost::filesystem::path output_dcp)
/** Try to make a ReelAsset for a subtitles or closed captions in a given period in the DCP.
- * A SubtitleAsset can be provided, or we will use one from @ref refs if not.
+ * A TextAsset can be provided, or we will use one from @ref refs if not.
*/
template <class Interop, class SMPTE, class Result>
shared_ptr<Result>
maybe_add_text (
- shared_ptr<dcp::SubtitleAsset> asset,
+ shared_ptr<dcp::TextAsset> asset,
+ dcp::TextType type,
int64_t picture_duration,
shared_ptr<dcp::Reel> reel,
int reel_index,
@@ -439,17 +438,18 @@ maybe_add_text (
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"));
reel_asset = make_shared<Interop> (
+ type,
interop,
dcp::Fraction(film->video_frame_rate(), 1),
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
@@ -460,6 +460,7 @@ maybe_add_text (
output_dcp / subtitle_asset_filename(asset, reel_index, reel_count, content_summary, ".mxf")
);
reel_asset = make_shared<SMPTE> (
+ type,
smpte,
dcp::Fraction(film->video_frame_rate(), 1),
picture_duration,
@@ -602,14 +603,15 @@ ReelWriter::create_reel_text (
set<DCPTextTrack> ensure_closed_captions
) const
{
- auto subtitle = maybe_add_text<dcp::ReelInteropSubtitleAsset, dcp::ReelSMPTESubtitleAsset, dcp::ReelSubtitleAsset> (
- _subtitle_asset, duration, reel, _reel_index, _reel_count, _content_summary, refs, film(), _period, output_dcp, _text_only
+ auto subtitle = maybe_add_text<dcp::ReelInteropTextAsset, dcp::ReelSMPTETextAsset, dcp::ReelTextAsset> (
+ _subtitle_asset, dcp::TextType::OPEN_SUBTITLE, duration, reel, _reel_index, _reel_count, _content_summary, refs, film(), _period, output_dcp, _text_only
);
if (!subtitle && ensure_subtitles) {
/* We had no subtitle asset, but we've been asked to make sure there is one */
- subtitle = maybe_add_text<dcp::ReelInteropSubtitleAsset, dcp::ReelSMPTESubtitleAsset, dcp::ReelSubtitleAsset> (
+ subtitle = maybe_add_text<dcp::ReelInteropTextAsset, dcp::ReelSMPTETextAsset, dcp::ReelTextAsset>(
empty_text_asset(TextType::OPEN_SUBTITLE, optional<DCPTextTrack>(), true),
+ dcp::TextType::OPEN_SUBTITLE,
duration,
reel,
_reel_index,
@@ -631,8 +633,8 @@ ReelWriter::create_reel_text (
}
for (auto const& i: _closed_caption_assets) {
- auto a = maybe_add_text<dcp::ReelInteropClosedCaptionAsset, dcp::ReelSMPTEClosedCaptionAsset, dcp::ReelClosedCaptionAsset> (
- i.second, duration, reel, _reel_index, _reel_count, _content_summary, refs, film(), _period, output_dcp, _text_only
+ auto a = maybe_add_text<dcp::ReelInteropTextAsset, dcp::ReelSMPTETextAsset, dcp::ReelTextAsset>(
+ i.second, dcp::TextType::CLOSED_CAPTION, duration, reel, _reel_index, _reel_count, _content_summary, refs, film(), _period, output_dcp, _text_only
);
DCPOMATIC_ASSERT (a);
a->set_annotation_text (i.first.name);
@@ -645,8 +647,9 @@ ReelWriter::create_reel_text (
/* Make empty tracks for anything we've been asked to ensure but that we haven't added */
for (auto i: ensure_closed_captions) {
- auto a = maybe_add_text<dcp::ReelInteropClosedCaptionAsset, dcp::ReelSMPTEClosedCaptionAsset, dcp::ReelClosedCaptionAsset> (
+ auto a = maybe_add_text<dcp::ReelInteropTextAsset, dcp::ReelSMPTETextAsset, dcp::ReelTextAsset>(
empty_text_asset(TextType::CLOSED_CAPTION, i, true),
+ dcp::TextType::CLOSED_CAPTION,
duration,
reel,
_reel_index,
@@ -791,15 +794,15 @@ ReelWriter::write (shared_ptr<const AudioBuffers> audio)
}
-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");
@@ -809,7 +812,7 @@ ReelWriter::empty_text_asset (TextType type, optional<DCPTextTrack> track, bool
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) {
@@ -829,7 +832,7 @@ ReelWriter::empty_text_asset (TextType type, optional<DCPTextTrack> track, bool
if (with_dummy) {
asset->add(
- std::make_shared<dcp::SubtitleString>(
+ std::make_shared<dcp::TextString>(
font,
false,
false,
@@ -897,7 +900,7 @@ ReelWriter::convert_vertical_position(StringText const& subtitle, dcp::SubtitleS
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:
@@ -934,7 +937,7 @@ ReelWriter::write(PlayerText subs, TextType type, optional<DCPTextTrack> track,
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);
+ 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.
@@ -951,7 +954,7 @@ ReelWriter::write(PlayerText subs, TextType type, optional<DCPTextTrack> track,
for (auto i: subs.bitmap) {
asset->add (
- make_shared<dcp::SubtitleImage>(
+ make_shared<dcp::TextImage>(
image_as_png(i.image),
dcp::Time(period.from.seconds() - _period.from.seconds(), tcr),
dcp::Time(period.to.seconds() - _period.from.seconds(), tcr),
diff --git a/src/lib/reel_writer.h b/src/lib/reel_writer.h
index 0b243b264..ac6531148 100644
--- a/src/lib/reel_writer.h
+++ b/src/lib/reel_writer.h
@@ -57,7 +57,7 @@ namespace dcp {
class SoundAssetWriter;
class StereoJ2KPictureAsset;
class StereoJ2KPictureAssetWriter;
- class SubtitleAsset;
+ class TextAsset;
}
@@ -107,7 +107,7 @@ private:
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;
@@ -145,8 +145,8 @@ private:
std::shared_ptr<dcp::MPEG2PictureAssetWriter> _mpeg2_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;
diff --git a/src/lib/referenced_reel_asset.cc b/src/lib/referenced_reel_asset.cc
index 3175d772d..5ef3b9ae7 100644
--- a/src/lib/referenced_reel_asset.cc
+++ b/src/lib/referenced_reel_asset.cc
@@ -27,10 +27,9 @@
#include "referenced_reel_asset.h"
#include <dcp/reel.h>
#include <dcp/reel_asset.h>
-#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_picture_asset.h>
#include <dcp/reel_sound_asset.h>
-#include <dcp/reel_subtitle_asset.h>
+#include <dcp/reel_text_asset.h>
#include <cmath>
diff --git a/src/lib/string_text.h b/src/lib/string_text.h
index 787231b8c..d39a889cf 100644
--- a/src/lib/string_text.h
+++ b/src/lib/string_text.h
@@ -25,7 +25,7 @@
#include "font.h"
#include <dcp/subtitle_standard.h>
-#include <dcp/subtitle_string.h>
+#include <dcp/text_string.h>
/** A wrapper for SubtitleString which allows us to:
@@ -36,13 +36,13 @@
* - 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::SubtitleStandard valign_standard_)
+ : dcp::TextString(dcp_)
, outline_width (outline_width_)
, font (font_)
, valign_standard (valign_standard_)
diff --git a/src/lib/string_text_file_decoder.cc b/src/lib/string_text_file_decoder.cc
index 2ec0ec1cb..585d68888 100644
--- a/src/lib/string_text_file_decoder.cc
+++ b/src/lib/string_text_file_decoder.cc
@@ -19,11 +19,11 @@
*/
-#include "string_text_file_decoder.h"
#include "string_text_file_content.h"
+#include "string_text_file_decoder.h"
#include "text_content.h"
#include "text_decoder.h"
-#include <dcp/subtitle_string.h>
+#include <dcp/text_string.h>
#include <iostream>
diff --git a/src/lib/subtitle_film_encoder.cc b/src/lib/subtitle_film_encoder.cc
index 93ccc177b..8356433a8 100644
--- a/src/lib/subtitle_film_encoder.cc
+++ b/src/lib/subtitle_film_encoder.cc
@@ -25,9 +25,9 @@
#include "player.h"
#include "subtitle_film_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>
@@ -79,7 +79,7 @@ SubtitleFilmEncoder::SubtitleFilmEncoder(shared_ptr<const Film> film, shared_ptr
}
}
- _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()) {
@@ -108,12 +108,12 @@ SubtitleFilmEncoder::go()
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;
@@ -140,10 +140,10 @@ SubtitleFilmEncoder::text(PlayerText subs, TextType type, optional<DCPTextTrack>
}
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());
@@ -151,7 +151,7 @@ SubtitleFilmEncoder::text(PlayerText subs, TextType type, optional<DCPTextTrack>
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);
@@ -176,7 +176,7 @@ SubtitleFilmEncoder::text(PlayerText subs, TextType type, optional<DCPTextTrack>
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) {
diff --git a/src/lib/subtitle_film_encoder.h b/src/lib/subtitle_film_encoder.h
index 54231794d..6482916cb 100644
--- a/src/lib/subtitle_film_encoder.h
+++ b/src/lib/subtitle_film_encoder.h
@@ -26,7 +26,7 @@
namespace dcp {
- class SubtitleAsset;
+ class TextAsset;
}
@@ -53,7 +53,7 @@ public:
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;
diff --git a/src/lib/text_decoder.cc b/src/lib/text_decoder.cc
index 945ffaa03..36909c2ee 100644
--- a/src/lib/text_decoder.cc
+++ b/src/lib/text_decoder.cc
@@ -128,7 +128,7 @@ TextDecoder::remove_invalid_characters_for_xml(string text)
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::SubtitleStandard valign_standard)
{
vector<StringText> string_texts;
@@ -274,7 +274,7 @@ TextDecoder::emit_plain_start (ContentTime from, sub::Subtitle const & sub_subti
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,
@@ -337,7 +337,7 @@ TextDecoder::emit_stop (ContentTime to)
void
-TextDecoder::emit_plain(ContentTimePeriod period, vector<dcp::SubtitleString> subtitles, dcp::SubtitleStandard valign_standard)
+TextDecoder::emit_plain(ContentTimePeriod period, vector<dcp::TextString> subtitles, dcp::SubtitleStandard valign_standard)
{
emit_plain_start (period.from, subtitles, valign_standard);
emit_stop (period.to);
diff --git a/src/lib/text_decoder.h b/src/lib/text_decoder.h
index 1a7632fd8..26248ef06 100644
--- a/src/lib/text_decoder.h
+++ b/src/lib/text_decoder.h
@@ -30,7 +30,7 @@
#include "content_text.h"
#include "types.h"
#include <dcp/subtitle_standard.h>
-#include <dcp/subtitle_string.h>
+#include <dcp/text_string.h>
#include <boost/signals2.hpp>
@@ -52,9 +52,9 @@ public:
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::SubtitleStandard 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::SubtitleStandard valign_standard);
void emit_plain (dcpomatic::ContentTimePeriod period, sub::Subtitle const & subtitle);
void emit_stop (dcpomatic::ContentTime to);
diff --git a/src/lib/text_type.cc b/src/lib/text_type.cc
index b1dcfc99c..4f8f50ac5 100644
--- a/src/lib/text_type.cc
+++ b/src/lib/text_type.cc
@@ -38,6 +38,10 @@ string_to_text_type(string s)
return TextType::UNKNOWN;
} else if (s == "open-subtitle") {
return TextType::OPEN_SUBTITLE;
+ } else if (s == "open-caption") {
+ return TextType::OPEN_CAPTION;
+ } else if (s == "closed-subtitle") {
+ return TextType::CLOSED_SUBTITLE;
} else if (s == "closed-caption") {
return TextType::CLOSED_CAPTION;
} else {
@@ -53,6 +57,10 @@ text_type_to_string(TextType t)
return "unknown";
case TextType::OPEN_SUBTITLE:
return "open-subtitle";
+ case TextType::OPEN_CAPTION:
+ return "open-caption";
+ case TextType::CLOSED_SUBTITLE:
+ return "closed-subtitle";
case TextType::CLOSED_CAPTION:
return "closed-caption";
default:
@@ -68,6 +76,10 @@ text_type_to_name(TextType t)
return _("Timed text");
case TextType::OPEN_SUBTITLE:
return _("Open subtitles");
+ case TextType::OPEN_CAPTION:
+ return _("Open captions");
+ case TextType::CLOSED_SUBTITLE:
+ return _("Closed subtitles");
case TextType::CLOSED_CAPTION:
return _("Closed captions");
default:
diff --git a/src/lib/text_type.h b/src/lib/text_type.h
index d21e03a60..94224af4e 100644
--- a/src/lib/text_type.h
+++ b/src/lib/text_type.h
@@ -34,8 +34,6 @@
* - open: on-screen
* - closed: only visible by some audience members
*
- * At the moment DoM supports open subtitles and closed captions.
- *
* There is some use of the word `subtitle' in the code which may mean
* caption in some contexts.
*/
@@ -43,6 +41,8 @@ enum class TextType
{
UNKNOWN,
OPEN_SUBTITLE,
+ OPEN_CAPTION,
+ CLOSED_SUBTITLE,
CLOSED_CAPTION,
COUNT
};
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 172b8d763..2e3485075 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -61,7 +61,7 @@
#include <dcp/raw_convert.h>
#include <dcp/scope_guard.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
@@ -475,7 +475,7 @@ LIBDCP_ENABLE_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>()
);
@@ -763,7 +763,7 @@ audio_asset_filename (shared_ptr<dcp::SoundAsset> asset, int reel_index, int ree
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);
}
@@ -910,7 +910,7 @@ utf8_strlen (string s)
/** @param size Size of picture that the subtitle will be overlaid onto */
void
-emit_subtitle_image (ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, shared_ptr<TextDecoder> decoder)
+emit_subtitle_image(ContentTimePeriod period, dcp::TextImage sub, dcp::Size size, shared_ptr<TextDecoder> decoder)
{
/* XXX: this is rather inefficient; decoding the image just to get its size */
FFmpegImageProxy proxy (sub.png_image());
diff --git a/src/lib/util.h b/src/lib/util.h
index 7c40c5ce8..d6ed0bccc 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -36,7 +36,7 @@
#include <dcp/atmos_asset.h>
#include <dcp/decrypted_kdm.h>
#include <dcp/util.h>
-#include <dcp/subtitle_image.h>
+#include <dcp/text_image.h>
#include <boost/optional.hpp>
#include <boost/filesystem.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
@@ -50,7 +50,7 @@
namespace dcp {
class PictureAsset;
class SoundAsset;
- class SubtitleAsset;
+ class TextAsset;
}
extern std::string program_name;
@@ -82,13 +82,13 @@ extern dcp::Size fit_ratio_within (float ratio, dcp::Size);
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);
extern std::shared_ptr<AudioBuffers> remap (std::shared_ptr<const AudioBuffers> input, int output_channels, AudioMapping map);
extern size_t utf8_strlen (std::string s);
-extern void emit_subtitle_image (dcpomatic::ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
+extern void emit_subtitle_image (dcpomatic::ContentTimePeriod period, dcp::TextImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>);
extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container, PixelQuanta quanta);
extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm);
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index f9293ed09..29fc543ba 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -43,9 +43,8 @@
#include <dcp/mono_mpeg2_picture_frame.h>
#include <dcp/locale_convert.h>
#include <dcp/raw_convert.h>
-#include <dcp/reel_closed_caption_asset.h>
#include <dcp/reel_file_asset.h>
-#include <dcp/reel_subtitle_asset.h>
+#include <dcp/reel_text_asset.h>
#include <cerrno>
#include <cfloat>
#include <set>
@@ -945,19 +944,21 @@ Writer::write (ReferencedReelAsset asset)
{
_reel_assets.push_back (asset);
- if (dynamic_pointer_cast<dcp::ReelSubtitleAsset>(asset.asset)) {
- _have_subtitles = true;
- } else if (auto ccap = dynamic_pointer_cast<dcp::ReelClosedCaptionAsset>(asset.asset)) {
- /* This feels quite fragile. We have a referenced reel and want to know if it's
- * part of a given closed-caption track so that we can fill if it has any
- * missing reels. I guess for that purpose almost any DCPTextTrack values are
- * fine so long as they are consistent.
- */
- DCPTextTrack track;
- track.name = ccap->annotation_text().get_value_or("");
- track.language = dcp::LanguageTag(ccap->language().get_value_or("en-US"));
- if (_have_closed_captions.find(track) == _have_closed_captions.end()) {
- _have_closed_captions.insert(track);
+ if (auto text_asset = dynamic_pointer_cast<dcp::ReelTextAsset>(asset.asset)) {
+ if (text_asset->type() == dcp::TextType::OPEN_SUBTITLE || text_asset->type() == dcp::TextType::OPEN_CAPTION) {
+ _have_subtitles = true;
+ } else {
+ /* This feels quite fragile. We have a referenced reel and want to know if it's
+ * part of a given closed-caption track so that we can fill if it has any
+ * missing reels. I guess for that purpose almost any DCPTextTrack values are
+ * fine so long as they are consistent.
+ */
+ DCPTextTrack track;
+ track.name = text_asset->annotation_text().get_value_or("");
+ track.language = dcp::LanguageTag(text_asset->language().get_value_or("en-US"));
+ if (_have_closed_captions.find(track) == _have_closed_captions.end()) {
+ _have_closed_captions.insert(track);
+ }
}
}
}