Merge branch 'main' into v2.17.x
authorCarl Hetherington <cth@carlh.net>
Fri, 8 Mar 2024 23:11:38 +0000 (00:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 8 Mar 2024 23:11:38 +0000 (00:11 +0100)
1  2 
cscript
src/lib/dcp_content.cc
src/lib/kdm_cli.cc
src/lib/util.cc
src/lib/util.h
src/lib/wscript
src/tools/dcpomatic.cc
src/wx/audio_panel.cc
src/wx/dkdm_dialog.cc
src/wx/full_config_dialog.cc

diff --cc cscript
Simple merge
index 378ba18827e7ccd32b8bfe1946cfd8e8b77f2a26,bdd5e0e091c0aa6b523ec7c7400ec9449beef3a0..c459a9ece6e099aa82d9a09ac50cfbef72f6d3a8
@@@ -723,17 -720,22 +723,25 @@@ DCPContent::can_reference_audio (shared
                return false;
        }
  
 -      /// TRANSLATORS: this string will follow "Cannot reference this DCP: "
 -      return can_reference(
 -              film, [](shared_ptr<const Content> c) {
 -                      return static_cast<bool>(c->audio) && !c->audio->mapping().mapped_output_channels().empty();
 -              },
 -              _("it overlaps other audio content; remove the other content."),
 -              why_not
 -      );
+       if (audio && audio->stream()) {
+               auto const channels = audio->stream()->channels();
+               if (channels != film->audio_channels()) {
+                       why_not = String::compose(_("it has a different number of audio channels than the project; set the project to have %1 channels."), channels);
+                       return false;
+               }
+       }
 +      auto part = [](shared_ptr<const Content> c) {
 +              return static_cast<bool>(c->audio) && !c->audio->mapping().mapped_output_channels().empty();
 +      };
 +
 +      if (overlaps(film, part)) {
 +              /// TRANSLATORS: this string will follow "Cannot reference this DCP: "
 +              why_not = _("it overlaps other audio content.");
 +              return false;
 +      }
 +
 +      return can_reference_anything(film, why_not);
  }
  
  
Simple merge
diff --cc src/lib/util.cc
index 01a7f0248d603f4cb1d44c0661b57bca9a78828f,fe6602de380cf60c2b3f0cf9fc197471eeef011b..ef15b90e5b1c4fea79837a814ccce69df84d2017
@@@ -1120,30 -1124,30 +1120,57 @@@ word_wrap(string input, int columns
  }
  
  
 +#ifdef DCPOMATIC_GROK
 +void
 +setup_grok_library_path()
 +{
 +      static std::string old_path;
 +      if (old_path.empty()) {
 +              auto const old = getenv("LD_LIRARY_PATH");
 +              if (old) {
 +                      old_path = old;
 +              }
 +      }
 +      auto const grok = Config::instance()->grok();
 +      if (!grok || grok->binary_location.empty()) {
 +              setenv("LD_LIRARY_PATH", old_path.c_str(), 1);
 +              return;
 +      }
 +
 +      std::string new_path = old_path;
 +      if (!new_path.empty()) {
 +              new_path += ":";
 +      }
 +      new_path += grok->binary_location.string();
 +
 +      setenv("LD_LIBRARY_PATH", new_path.c_str(), 1);
 +}
 +#endif
++
+ string
+ screen_names_to_string(vector<string> names)
+ {
+       if (names.empty()) {
+               return {};
+       }
+       auto number = [](string const& s) {
+               return s.find_first_not_of("0123456789") == string::npos;
+       };
+       if (std::find_if(names.begin(), names.end(), [number](string const& s) { return !number(s); }) == names.end()) {
+               std::sort(names.begin(), names.end(), [](string const& a, string const& b) {
+                       return dcp::raw_convert<int>(a) < dcp::raw_convert<int>(b);
+               });
+       } else {
+               std::sort(names.begin(), names.end());
+       }
+       string result;
+       for (auto const& name: names) {
+               result += name + ", ";
+       }
+       return result.substr(0, result.length() - 2);
+ }
diff --cc src/lib/util.h
index b85cf0a333fef898a4829e15917bbd7afdd61651,fd6fd61649ac4a896f9f04d40571e3686d429913..4f64369d33ac6d5cdb34e73b60be7a6e1f09b069
@@@ -98,20 -97,6 +98,22 @@@ extern std::string error_details(boost:
  extern bool contains_assetmap(boost::filesystem::path dir);
  extern std::string word_wrap(std::string input, int columns);
  extern void capture_ffmpeg_logs();
 +#ifdef DCPOMATIC_GROK
 +extern void setup_grok_library_path();
 +#endif
 +
 +
 +template <class T>
 +T
 +number_attribute(cxml::ConstNodePtr node, std::string name1, std::string name2)
 +{
 +      auto value = node->optional_number_attribute<T>(name1);
 +      if (!value) {
 +              value = node->number_attribute<T>(name2);
 +      }
 +      return *value;
 +}
 +
+ extern std::string screen_names_to_string(std::vector<std::string> names);
  #endif
diff --cc src/lib/wscript
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge