Prevent DCP creation if we're trying not to burn in text subs (#606).
authorCarl Hetherington <cth@carlh.net>
Sun, 21 Jun 2015 01:02:42 +0000 (02:02 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 21 Jun 2015 01:02:42 +0000 (02:02 +0100)
ChangeLog
src/lib/dcp_content.h
src/lib/dcp_subtitle_content.h
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h
src/lib/film.cc
src/lib/subrip_content.h
src/lib/subtitle_content.cc
src/lib/subtitle_content.h

index 23bf7b2b2e4ce18706a0eb5aad649ab536bbfd00..a922728eed9d2f480c8b0a17b050473e0256b915 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-06-21  Carl Hetherington  <cth@carlh.net>
 
+       * 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  <cth@carlh.net>
index 54527422e117db5eb15a1025d6cfc2af2fc60411..2d0aaacde10620de23ecf7a6f8a158c618736c12 100644 (file)
@@ -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 {
index 05af716906a31b05f96de284c4cbf1df5e62b9b7..9fea81c2a46737368ff16d7a1c21e4e1948716e2 100644 (file)
@@ -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;
 };
index c4fc363578f6c32ea23c3dec56b6f0a3bc39b0fb..8feb7df5728e6bff53b2f23dbfeed4d1aabcc5c8 100644 (file)
@@ -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 ();
 }
index 5c2b5496d3de187bb0b4987d674b6d77563d91ba..c5797d5d1b63761d6409fe055ed69692e8db6518 100644 (file)
@@ -70,7 +70,8 @@ public:
        std::vector<AudioStreamPtr> audio_streams () const;
 
        /* SubtitleContent */
-       bool has_subtitles () const;
+       bool has_text_subtitles () const;
+       bool has_image_subtitles () const;
 
        void set_filters (std::vector<Filter const *> const &);
 
index 66f1de868bd8c6307eb208337e92f478afeff605..75dfa45eba397e3cddc0c07e712cfdb6f43a41b7 100644 (file)
@@ -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<Content> c, cl) {
+               shared_ptr<SubtitleContent> sc = dynamic_pointer_cast<SubtitleContent> (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());
        }
index 09346a174294d62b7f1fe601293843d46350830d..342efd4defc0ce25fdf6836592862b0ca1fa7cf2 100644 (file)
@@ -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:
index 215829659a296cc179dc9b824073a3057ad2cd48..c8fa75e7cfb3a8919a80778000d61190c8599a5d 100644 (file)
@@ -283,3 +283,8 @@ SubtitleContent::font_changed ()
        signal_changed (SubtitleContentProperty::FONTS);
 }
 
+bool
+SubtitleContent::has_subtitles () const
+{
+       return has_text_subtitles() || has_image_subtitles();
+}
index c00ec6f900e07b41e386451f5c43e12246ab544f..7f2e3b136a1720714df15b5a996104f552d14d81 100644 (file)
@@ -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> font);