Merge master; fix crash on new film.
[dcpomatic.git] / src / lib / audio_mapping.cc
index b85ea731402046347a58738be6d5bb550df7fdd3..83c748f1aada87d374894d3cb9ff5d1d31c4dca0 100644 (file)
@@ -41,7 +41,7 @@ int
 AudioMapping::dcp_channels () const
 {
        for (list<pair<Channel, libdcp::Channel> >::const_iterator i = _content_to_dcp.begin(); i != _content_to_dcp.end(); ++i) {
-               if (((int) i->second) > 2) {
+               if (((int) i->second) >= 2) {
                        return 6;
                }
        }
@@ -94,7 +94,7 @@ AudioMapping::as_xml (xmlpp::Node* node) const
        for (list<pair<Channel, libdcp::Channel> >::const_iterator i = _content_to_dcp.begin(); i != _content_to_dcp.end(); ++i) {
                xmlpp::Node* t = node->add_child ("Map");
                shared_ptr<const AudioContent> c = i->first.content.lock ();
-               t->add_child ("Content")->add_child_text (c->file().string ());
+               t->add_child ("Content")->add_child_text (c->digest ());
                t->add_child ("ContentIndex")->add_child_text (lexical_cast<string> (i->first.index));
                t->add_child ("DCP")->add_child_text (lexical_cast<string> (i->second));
        }
@@ -107,7 +107,7 @@ AudioMapping::set_from_xml (ContentList const & content, shared_ptr<const cxml::
        for (list<shared_ptr<cxml::Node> >::const_iterator i = c.begin(); i != c.end(); ++i) {
                string const c = (*i)->string_child ("Content");
                ContentList::const_iterator j = content.begin ();
-               while (j != content.end() && (*j)->file().string() != c) {
+               while (j != content.end() && (*j)->digest() != c) {
                        ++j;
                }