Change end() to only do one thing, and copy the required stuff into pause()
[dcpomatic.git] / src / lib / film.cc
index 2780dbf5c6a838f4de159ee29988079478825b9d..eb1943ffb292397b1aba2b6f9220ed4e90793943 100644 (file)
@@ -416,7 +416,7 @@ Film::metadata (bool with_content_paths) const
        root->add_child("UserExplicitVideoFrameRate")->add_child_text(_user_explicit_video_frame_rate ? "1" : "0");
        for (auto const& marker: _markers) {
                auto m = root->add_child("Marker");
-               m->set_attribute("Type", dcp::marker_to_string(marker.first));
+               m->set_attribute("type", dcp::marker_to_string(marker.first));
                m->add_child_text(raw_convert<string>(marker.second.get()));
        }
        for (auto i: _ratings) {
@@ -602,7 +602,11 @@ Film::read_metadata (optional<boost::filesystem::path> path)
        _user_explicit_video_frame_rate = f.optional_bool_child("UserExplicitVideoFrameRate").get_value_or(false);
 
        for (auto i: f.node_children("Marker")) {
-               _markers[dcp::marker_from_string(i->string_attribute("Type"))] = DCPTime(dcp::raw_convert<DCPTime::Type>(i->content()));
+               auto type = i->optional_string_attribute("Type");
+               if (!type) {
+                       type = i->string_attribute("type");
+               }
+               _markers[dcp::marker_from_string(*type)] = DCPTime(dcp::raw_convert<DCPTime::Type>(i->content()));
        }
 
        for (auto i: f.node_children("Rating")) {
@@ -775,7 +779,7 @@ Film::subtitle_languages () const
 {
        pair<optional<dcp::LanguageTag>, vector<dcp::LanguageTag>> result;
        for (auto i: content()) {
-               for (auto text: i->text) {
+               for (auto const& text: i->text) {
                        if (text->use() && text->type() == TextType::OPEN_SUBTITLE && text->language()) {
                                if (text->language_is_additional()) {
                                        result.second.push_back(text->language().get());
@@ -1303,7 +1307,7 @@ Film::cpls () const
        for (auto const& item: dcp::filesystem::directory_iterator(dir)) {
                if (
                        dcp::filesystem::is_directory(item) &&
-                       item.path().leaf() != "j2c" && item.path().leaf() != "video" && item.path().leaf() != "info" && item.path().leaf() != "analysis"
+                       item.path().filename() != "j2c" && item.path().filename() != "video" && item.path().filename() != "info" && item.path().filename() != "analysis"
                        ) {
 
                        try {
@@ -1400,7 +1404,9 @@ Film::add_content (shared_ptr<Content> c)
 
        maybe_set_container_and_resolution ();
        if (c->atmos) {
-               set_audio_channels (14);
+               if (_audio_channels < 14) {
+                       set_audio_channels(14);
+               }
                set_interop (false);
        }
 }