From 7fff85ef947f9353317c0125dc37f1f16faecbf1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 21 Jun 2015 02:02:42 +0100 Subject: [PATCH] Prevent DCP creation if we're trying not to burn in text subs (#606). --- ChangeLog | 3 +++ src/lib/dcp_content.h | 7 ++++++- src/lib/dcp_subtitle_content.h | 7 ++++++- src/lib/ffmpeg_content.cc | 8 +++++++- src/lib/ffmpeg_content.h | 3 ++- src/lib/film.cc | 18 +++++++++++++++--- src/lib/subrip_content.h | 7 ++++++- src/lib/subtitle_content.cc | 5 +++++ src/lib/subtitle_content.h | 4 +++- 9 files changed, 53 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23bf7b2b2..a922728ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-06-21 Carl Hetherington + * Prevent DCP creation if the project is set up to request + non-burnt-in subtitles with text-subtitle content (#606). + * Fix status message appearance on OS X (#615). 2015-06-19 Carl Hetherington diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h index 54527422e..2d0aaacde 100644 --- a/src/lib/dcp_content.h +++ b/src/lib/dcp_content.h @@ -59,11 +59,16 @@ public: std::string identifier () const; /* SubtitleContent */ - bool has_subtitles () const { + + bool has_text_subtitles () const { boost::mutex::scoped_lock lm (_mutex); return _has_subtitles; } + bool has_image_subtitles () const { + return false; + } + boost::filesystem::path directory () const; bool encrypted () const { diff --git a/src/lib/dcp_subtitle_content.h b/src/lib/dcp_subtitle_content.h index 05af71690..9fea81c2a 100644 --- a/src/lib/dcp_subtitle_content.h +++ b/src/lib/dcp_subtitle_content.h @@ -34,10 +34,15 @@ public: DCPTime full_length () const; /* SubtitleContent */ - bool has_subtitles () const { + + bool has_text_subtitles () const { return true; } + bool has_image_subtitles () const { + return false; + } + private: DCPTime _length; }; diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index c4fc36357..8feb7df57 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -298,7 +298,13 @@ FFmpegContent::subtitles_during (ContentTimePeriod period, bool starting) const } bool -FFmpegContent::has_subtitles () const +FFmpegContent::has_text_subtitles () const +{ + return false; +} + +bool +FFmpegContent::has_image_subtitles () const { return !subtitle_streams().empty (); } diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 5c2b5496d..c5797d5d1 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -70,7 +70,8 @@ public: std::vector audio_streams () const; /* SubtitleContent */ - bool has_subtitles () const; + bool has_text_subtitles () const; + bool has_image_subtitles () const; void set_filters (std::vector const &); diff --git a/src/lib/film.cc b/src/lib/film.cc index 66f1de868..75dfa45eb 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -277,15 +277,27 @@ Film::audio_analysis_path () const void Film::make_dcp () { - set_isdcf_date_today (); - if (dcp_name().find ("/") != string::npos) { throw BadSettingError (_("name"), _("cannot contain slashes")); } + bool must_burn = false; + ContentList cl = content (); + BOOST_FOREACH (shared_ptr c, cl) { + shared_ptr sc = dynamic_pointer_cast (c); + if (sc && sc->has_image_subtitles() && sc->use_subtitles() && !burn_subtitles()) { + must_burn = true; + } + } + + if (must_burn) { + throw EncodeError (_("this project has content with image-based subtitles, which this version of DCP-o-matic cannot include as separate DCP subtitles. To use subtitles with this project you must burn them into the image (tick the box on the DCP Video tab).")); + } + + set_isdcf_date_today (); + environment_info (log ()); - ContentList cl = content (); for (ContentList::const_iterator i = cl.begin(); i != cl.end(); ++i) { LOG_GENERAL ("Content: %1", (*i)->technical_summary()); } diff --git a/src/lib/subrip_content.h b/src/lib/subrip_content.h index 09346a174..342efd4de 100644 --- a/src/lib/subrip_content.h +++ b/src/lib/subrip_content.h @@ -37,10 +37,15 @@ public: DCPTime full_length () const; /* SubtitleContent */ - bool has_subtitles () const { + + bool has_text_subtitles () const { return true; } + bool has_image_subtitles () const { + return false; + } + static std::string const font_id; private: diff --git a/src/lib/subtitle_content.cc b/src/lib/subtitle_content.cc index 215829659..c8fa75e7c 100644 --- a/src/lib/subtitle_content.cc +++ b/src/lib/subtitle_content.cc @@ -283,3 +283,8 @@ SubtitleContent::font_changed () signal_changed (SubtitleContentProperty::FONTS); } +bool +SubtitleContent::has_subtitles () const +{ + return has_text_subtitles() || has_image_subtitles(); +} diff --git a/src/lib/subtitle_content.h b/src/lib/subtitle_content.h index c00ec6f90..7f2e3b136 100644 --- a/src/lib/subtitle_content.h +++ b/src/lib/subtitle_content.h @@ -53,7 +53,9 @@ public: void as_xml (xmlpp::Node *) const; std::string identifier () const; - virtual bool has_subtitles () const = 0; + bool has_subtitles () const; + virtual bool has_text_subtitles () const = 0; + virtual bool has_image_subtitles () const = 0; void add_font (boost::shared_ptr font); -- 2.30.2