std::shared_ptr
[dcpomatic.git] / src / lib / film.cc
index 5d298baae5b4009152351a4cc1c3cbf3194d76f5..68e5c1c1fc76657ea7d2b9d99e90ab6316969c1a 100644 (file)
@@ -97,9 +97,9 @@ using std::back_inserter;
 using std::map;
 using std::exception;
 using std::find;
-using boost::shared_ptr;
-using boost::weak_ptr;
-using boost::dynamic_pointer_cast;
+using std::shared_ptr;
+using std::weak_ptr;
+using std::dynamic_pointer_cast;
 using boost::optional;
 using boost::is_any_of;
 #if BOOST_VERSION >= 106100
@@ -702,15 +702,17 @@ Film::read_metadata (optional<boost::filesystem::path> path)
                }
        }
 
-       optional<string> isdcf_language = f.node_child("ISDCFMetadata")->optional_string_child("SubtitleLanguage");
-       if (isdcf_language && !found_language) {
-               try {
-                       found_language = dcp::LanguageTag(*isdcf_language);
-               } catch (...) {
+       if (_state_version >= 9) {
+               optional<string> isdcf_language = f.node_child("ISDCFMetadata")->optional_string_child("SubtitleLanguage");
+               if (isdcf_language && !found_language) {
                        try {
-                               found_language = dcp::LanguageTag(boost::algorithm::to_lower_copy(*isdcf_language));
+                               found_language = dcp::LanguageTag(*isdcf_language);
                        } catch (...) {
+                               try {
+                                       found_language = dcp::LanguageTag(boost::algorithm::to_lower_copy(*isdcf_language));
+                               } catch (...) {
 
+                               }
                        }
                }
        }
@@ -1518,6 +1520,14 @@ Film::check_settings_consistency ()
                        d->set_reference_audio(false);
                        change_made = true;
                }
+               if (d->reference_text(TEXT_OPEN_SUBTITLE) && !d->can_reference_text(shared_from_this(), TEXT_OPEN_SUBTITLE, why_not)) {
+                       d->set_reference_text(TEXT_OPEN_SUBTITLE, false);
+                       change_made = true;
+               }
+               if (d->reference_text(TEXT_CLOSED_CAPTION) && !d->can_reference_text(shared_from_this(), TEXT_CLOSED_CAPTION, why_not)) {
+                       d->set_reference_text(TEXT_CLOSED_CAPTION, false);
+                       change_made = true;
+               }
        }
 
        if (change_made) {