diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-07-10 02:02:19 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-07-10 02:02:19 +0200 |
| commit | 5b0e331380c83ec9835e8aa42fd342b2f0ad275d (patch) | |
| tree | 13c27f0b3420f5c3a268a5a22a9172675fdc370c | |
| parent | 5d838bc863a7569e68546026c109607fd5a94362 (diff) | |
Use dcp::compose rather than our own.compose
118 files changed, 395 insertions, 787 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index ca0f49f57..e71230683 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -21,13 +21,13 @@ #include "analyse_audio_job.h" #include "audio_analysis.h" -#include "compose.hpp" #include "dcpomatic_log.h" #include "film.h" #include "filter.h" #include "player.h" #include "playlist.h" #include "config.h" +#include <dcp/compose.h> #include <iostream> #include "i18n.h" diff --git a/src/lib/analytics.cc b/src/lib/analytics.cc index ac0abc222..697e8f0e4 100644 --- a/src/lib/analytics.cc +++ b/src/lib/analytics.cc @@ -20,9 +20,9 @@ #include "analytics.h" -#include "compose.hpp" #include "exceptions.h" #include "warnings.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <libcxml/cxml.h> DCPOMATIC_DISABLE_WARNINGS @@ -60,7 +60,7 @@ Analytics::successful_dcp_encode () boost::bind( boost::ref(Message), _("Congratulations!"), - String::compose (_( + dcp::compose (_( "<h2>You have made %1 DCPs with DCP-o-matic!</h2>" "<img width=\"20%%\" src=\"memory:me.jpg\" align=\"center\">" "<p>Hello. I'm Carl and I'm the " diff --git a/src/lib/atmos_mxf_content.cc b/src/lib/atmos_mxf_content.cc index 82c20e88f..d833bc416 100644 --- a/src/lib/atmos_mxf_content.cc +++ b/src/lib/atmos_mxf_content.cc @@ -21,11 +21,11 @@ #include "atmos_content.h" #include "atmos_mxf_content.h" -#include "compose.hpp" #include "film.h" #include "job.h" #include <asdcp/KM_log.h> #include <dcp/atmos_asset.h> +#include <dcp/compose.h> #include <dcp/exceptions.h> #include <dcp/raw_convert.h> #include <libxml++/libxml++.h> @@ -93,7 +93,7 @@ AtmosMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) string AtmosMXFContent::summary () const { - return String::compose (_("%1 [Atmos]"), path_summary()); + return dcp::compose (_("%1 [Atmos]"), path_summary()); } diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 748cbb7d0..d0c08e480 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -20,11 +20,11 @@ #include "audio_content.h" -#include "compose.hpp" #include "config.h" #include "exceptions.h" #include "film.h" #include "frame_rate_change.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <libcxml/cxml.h> #include <libxml++/libxml++.h> @@ -148,7 +148,7 @@ AudioContent::technical_summary () const { string s = "audio: "; for (auto i: streams()) { - s += String::compose ("stream channels %1 rate %2 ", i->channels(), i->frame_rate()); + s += dcp::compose ("stream channels %1 rate %2 ", i->channels(), i->frame_rate()); } return s; @@ -263,14 +263,14 @@ AudioContent::processing_description (shared_ptr<const Film> film) const } if (not_resampled && resampled) { - return String::compose (_("Some audio will be resampled to %1Hz"), resampled_frame_rate(film)); + return dcp::compose (_("Some audio will be resampled to %1Hz"), resampled_frame_rate(film)); } if (!not_resampled && resampled) { if (same) { - return String::compose (_("Audio will be resampled from %1Hz to %2Hz"), common_frame_rate.get(), resampled_frame_rate(film)); + return dcp::compose (_("Audio will be resampled from %1Hz to %2Hz"), common_frame_rate.get(), resampled_frame_rate(film)); } else { - return String::compose (_("Audio will be resampled to %1Hz"), resampled_frame_rate(film)); + return dcp::compose (_("Audio will be resampled to %1Hz"), resampled_frame_rate(film)); } } @@ -288,7 +288,7 @@ AudioContent::channel_names () const int stream = 1; for (auto i: streams()) { for (int j = 0; j < i->channels(); ++j) { - n.push_back (NamedChannel(String::compose ("%1:%2", stream, j + 1), index++)); + n.push_back (NamedChannel(dcp::compose ("%1:%2", stream, j + 1), index++)); } ++stream; } diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index 77c9b0695..7cc0621b3 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -25,7 +25,7 @@ #include "dcpomatic_log.h" #include "log.h" #include "resampler.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <iostream> #include "i18n.h" diff --git a/src/lib/audio_filter_graph.cc b/src/lib/audio_filter_graph.cc index fc43b5a34..e99434069 100644 --- a/src/lib/audio_filter_graph.cc +++ b/src/lib/audio_filter_graph.cc @@ -20,7 +20,7 @@ #include "audio_filter_graph.h" #include "audio_buffers.h" -#include "compose.hpp" +#include <dcp/compose.h> extern "C" { #include <libavfilter/buffersink.h> #include <libavfilter/buffersrc.h> @@ -149,7 +149,7 @@ AudioFilterGraph::process (shared_ptr<const AudioBuffers> buffers) if (r < 0) { char buffer[256]; av_strerror (r, buffer, sizeof(buffer)); - throw DecodeError (String::compose (N_("could not push buffer into filter chain (%1)"), &buffer[0])); + throw DecodeError (dcp::compose (N_("could not push buffer into filter chain (%1)"), &buffer[0])); } while (true) { diff --git a/src/lib/butler.cc b/src/lib/butler.cc index 5a8e646aa..3edad6978 100644 --- a/src/lib/butler.cc +++ b/src/lib/butler.cc @@ -25,9 +25,9 @@ #include "log.h" #include "dcpomatic_log.h" #include "cross.h" -#include "compose.hpp" #include "exceptions.h" #include "video_content.h" +#include <dcp/compose.h> using std::cout; @@ -138,10 +138,10 @@ Butler::should_run () const optional<DCPTime> pos = _audio.peek(); if (pos) { throw ProgrammingError - (__FILE__, __LINE__, String::compose ("Butler video buffers reached %1 frames (audio is %2 at %3)", _video.size(), _audio.size(), pos->get())); + (__FILE__, __LINE__, dcp::compose ("Butler video buffers reached %1 frames (audio is %2 at %3)", _video.size(), _audio.size(), pos->get())); } else { throw ProgrammingError - (__FILE__, __LINE__, String::compose ("Butler video buffers reached %1 frames (audio is %2)", _video.size(), _audio.size())); + (__FILE__, __LINE__, dcp::compose ("Butler video buffers reached %1 frames (audio is %2)", _video.size(), _audio.size())); } } @@ -150,10 +150,10 @@ Butler::should_run () const optional<DCPTime> pos = _audio.peek(); if (pos) { throw ProgrammingError - (__FILE__, __LINE__, String::compose ("Butler audio buffers reached %1 frames at %2 (video is %3)", _audio.size(), pos->get(), _video.size())); + (__FILE__, __LINE__, dcp::compose ("Butler audio buffers reached %1 frames at %2 (video is %3)", _audio.size(), pos->get(), _video.size())); } else { throw ProgrammingError - (__FILE__, __LINE__, String::compose ("Butler audio buffers reached %1 frames (video is %3)", _audio.size(), _video.size())); + (__FILE__, __LINE__, dcp::compose ("Butler audio buffers reached %1 frames (video is %3)", _audio.size(), _video.size())); } } @@ -470,7 +470,7 @@ Butler::Error::summary () const case Error::AGAIN: return "Butler not ready"; case Error::DIED: - return String::compose("Butler died (%1)", message); + return dcp::compose("Butler died (%1)", message); case Error::FINISHED: return "Butler finished"; } diff --git a/src/lib/combine_dcp_job.cc b/src/lib/combine_dcp_job.cc index 5c299492b..0f548ec8b 100644 --- a/src/lib/combine_dcp_job.cc +++ b/src/lib/combine_dcp_job.cc @@ -20,9 +20,9 @@ #include "combine_dcp_job.h" -#include "compose.hpp" #include "config.h" #include <dcp/combine.h> +#include <dcp/compose.h> #include <dcp/exceptions.h> #include "i18n.h" @@ -64,8 +64,8 @@ CombineDCPJob::run () dcp::combine ( _inputs, _output, - String::compose("libdcp %1", dcp::version), - String::compose("libdcp %1", dcp::version), + dcp::compose("libdcp %1", dcp::version), + dcp::compose("libdcp %1", dcp::version), dcp::LocalTime().as_string(), _annotation_text, Config::instance()->signer_chain() diff --git a/src/lib/compose.hpp b/src/lib/compose.hpp deleted file mode 100644 index 479493f14..000000000 --- a/src/lib/compose.hpp +++ /dev/null @@ -1,392 +0,0 @@ -/* -*- c-basic-offset: 2 -*- - * Defines String::compose(fmt, arg...) for easy, i18n-friendly - * composition of strings. - * - * Version 1.0. - * - * Copyright (c) 2002 Ole Laursen <olau@hardworking.dk>. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -// -// Basic usage is like -// -// std::cout << String::compose("This is a %1x%2 matrix.", rows, cols); -// -// See http://www.cs.aau.dk/~olau/compose/ or the included README.compose for -// more details. -// - -#ifndef DCPOMATIC_STRING_COMPOSE_H -#define DCPOMATIC_STRING_COMPOSE_H - -#include <dcp/locale_convert.h> -#include <boost/filesystem.hpp> -#include <string> -#include <list> -#include <map> -#include <inttypes.h> -#include <cstdio> - -namespace StringPrivate -{ - // the actual composition class - using string::compose is cleaner, so we - // hide it here - class Composition - { - public: - // initialize and prepare format string on the form "text %1 text %2 etc." - explicit Composition(std::string fmt); - - // supply an replacement argument starting from %1 - template <typename T> - Composition &arg(const T &obj); - - // compose and return string - std::string str() const; - - private: - std::string os; - int arg_no; - - // we store the output as a list - when the output string is requested, the - // list is concatenated to a string; this way we can keep iterators into - // the list instead of into a string where they're possibly invalidated on - // inserting a specification string - typedef std::list<std::string> output_list; - output_list output; - - // the initial parse of the format string fills in the specification map - // with positions for each of the various %?s - typedef std::multimap<int, output_list::iterator> specification_map; - specification_map specs; - }; - - // helper for converting spec string numbers - inline int char_to_int(char c) - { - switch (c) { - case '0': return 0; - case '1': return 1; - case '2': return 2; - case '3': return 3; - case '4': return 4; - case '5': return 5; - case '6': return 6; - case '7': return 7; - case '8': return 8; - case '9': return 9; - default: return -1000; - } - } - - inline bool is_number(int n) - { - switch (n) { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - return true; - - default: - return false; - } - } - - // implementation of class Composition - template <typename T> - inline Composition &Composition::arg(const T &obj) - { - os += dcp::locale_convert<std::string>(obj); - - if (!os.empty()) { // manipulators don't produce output - for (specification_map::const_iterator i = specs.lower_bound(arg_no), end = specs.upper_bound(arg_no); i != end; ++i) { - output_list::iterator pos = i->second; - ++pos; - - output.insert(pos, os); - } - - os = ""; - ++arg_no; - } - - return *this; - } - - inline Composition::Composition(std::string fmt) - : arg_no(1) - { - std::string::size_type b = 0, i = 0; - - // fill in output with the strings between the %1 %2 %3 etc. and - // fill in specs with the positions - while (i < fmt.length()) { - if (fmt[i] == '%' && i + 1 < fmt.length()) { - if (fmt[i + 1] == '%') { // catch %% - fmt.replace(i, 2, "%"); - ++i; - } - else if (is_number(fmt[i + 1])) { // aha! a spec! - // save string - output.push_back(fmt.substr(b, i - b)); - - int n = 1; // number of digits - int spec_no = 0; - - do { - spec_no += char_to_int(fmt[i + n]); - spec_no *= 10; - ++n; - } while (i + n < fmt.length() && is_number(fmt[i + n])); - - spec_no /= 10; - output_list::iterator pos = output.end(); - --pos; // safe since we have just inserted a string> - - specs.insert(specification_map::value_type(spec_no, pos)); - - // jump over spec string - i += n; - b = i; - } - else - ++i; - } - else - ++i; - } - - if (i - b > 0) // add the rest of the string - output.push_back(fmt.substr(b, i - b)); - } - - inline std::string Composition::str() const - { - // assemble string - std::string str; - - for (output_list::const_iterator i = output.begin(), end = output.end(); - i != end; ++i) - str += *i; - - return str; - } -} - -// now for the real thing(s) -namespace String -{ - // a series of functions which accept a format string on the form "text %1 - // more %2 less %3" and a number of templated parameters and spits out the - // composited string - template <typename T1> - inline std::string compose(const std::string &fmt, const T1 &o1) - { - StringPrivate::Composition c(fmt); - c.arg(o1); - return c.str(); - } - - template <typename T1, typename T2> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2); - return c.str(); - } - - template <typename T1, typename T2, typename T3> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11, const T12 &o12) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11).arg(o12); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11, const T12 &o12, - const T13 &o13) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11).arg(o12).arg(o13); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11, const T12 &o12, - const T13 &o13, const T14 &o14) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11).arg(o12).arg(o13).arg(o14); - return c.str(); - } - - template <typename T1, typename T2, typename T3, typename T4, typename T5, - typename T6, typename T7, typename T8, typename T9, typename T10, - typename T11, typename T12, typename T13, typename T14, - typename T15> - inline std::string compose(const std::string &fmt, - const T1 &o1, const T2 &o2, const T3 &o3, - const T4 &o4, const T5 &o5, const T6 &o6, - const T7 &o7, const T8 &o8, const T9 &o9, - const T10 &o10, const T11 &o11, const T12 &o12, - const T13 &o13, const T14 &o14, const T15 &o15) - { - StringPrivate::Composition c(fmt); - c.arg(o1).arg(o2).arg(o3).arg(o4).arg(o5).arg(o6).arg(o7).arg(o8).arg(o9) - .arg(o10).arg(o11).arg(o12).arg(o13).arg(o14).arg(o15); - return c.str(); - } -} - - -#endif // STRING_COMPOSE_H diff --git a/src/lib/config.cc b/src/lib/config.cc index a8653a10c..ce7651ea8 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -30,9 +30,9 @@ #include "cross.h" #include "film.h" #include "dkdm_wrapper.h" -#include "compose.hpp" #include "crypto.h" #include "dkdm_recipient.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <dcp/name_format.h> #include <dcp/certificate_chain.h> @@ -217,13 +217,13 @@ Config::backup () /* Make a copy of the configuration */ try { int n = 1; - while (n < 100 && boost::filesystem::exists(path(String::compose("config.xml.%1", n)))) { + while (n < 100 && boost::filesystem::exists(path(dcp::compose("config.xml.%1", n)))) { ++n; } - boost::filesystem::copy_file(path("config.xml", false), path(String::compose("config.xml.%1", n), false)); - boost::filesystem::copy_file(path("cinemas.xml", false), path(String::compose("cinemas.xml.%1", n), false)); - boost::filesystem::copy_file(path("dkdm_recipients.xml", false), path(String::compose("dkdm_recipients.xml.%1", n), false)); + boost::filesystem::copy_file(path("config.xml", false), path(dcp::compose("config.xml.%1", n), false)); + boost::filesystem::copy_file(path("cinemas.xml", false), path(dcp::compose("cinemas.xml.%1", n), false)); + boost::filesystem::copy_file(path("dkdm_recipients.xml", false), path(dcp::compose("dkdm_recipients.xml.%1", n), false)); } catch (...) {} } diff --git a/src/lib/content.cc b/src/lib/content.cc index 49ab944be..d2d8208de 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -34,7 +34,7 @@ #include "exceptions.h" #include "film.h" #include "job.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <dcp/locale_convert.h> #include <dcp/raw_convert.h> #include <libcxml/cxml.h> @@ -304,9 +304,9 @@ Content::clone () const string Content::technical_summary () const { - auto s = String::compose ("%1 %2 %3", path_summary(), digest(), position().seconds()); + auto s = dcp::compose ("%1 %2 %3", path_summary(), digest(), position().seconds()); if (_video_frame_rate) { - s += String::compose(" %1", *_video_frame_rate); + s += dcp::compose(" %1", *_video_frame_rate); } return s; } diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index e912589fc..6531986fb 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -38,7 +38,7 @@ #include "log_entry.h" #include "dcpomatic_log.h" #include "log.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <libcxml/cxml.h> #include <dcp/smpte_subtitle_asset.h> #include <boost/algorithm/string.hpp> diff --git a/src/lib/copy_to_drive_job.cc b/src/lib/copy_to_drive_job.cc index 9ddedfe62..539afb61f 100644 --- a/src/lib/copy_to_drive_job.cc +++ b/src/lib/copy_to_drive_job.cc @@ -20,9 +20,9 @@ #include "disk_writer_messages.h" #include "copy_to_drive_job.h" -#include "compose.hpp" #include "exceptions.h" #include "dcpomatic_log.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <nanomsg/nn.h> #include <unistd.h> @@ -53,7 +53,7 @@ CopyToDriveJob::CopyToDriveJob (boost::filesystem::path dcp, Drive drive, Nanoms string CopyToDriveJob::name () const { - return String::compose (_("Copying %1\nto %2"), _dcp.filename().string(), _drive.description()); + return dcp::compose (_("Copying %1\nto %2"), _dcp.filename().string(), _drive.description()); } string @@ -66,7 +66,7 @@ void CopyToDriveJob::run () { LOG_DISK("Sending write request to disk writer for %1 %2", _dcp.string(), _drive.device()); - if (!_nanomsg.send(String::compose(DISK_WRITER_WRITE "\n%1\n%2\n", _dcp.string(), _drive.device()), 2000)) { + if (!_nanomsg.send(dcp::compose(DISK_WRITER_WRITE "\n%1\n%2\n", _dcp.string(), _drive.device()), 2000)) { LOG_DISK_NC("Failed to send write request."); throw CommunicationFailedError (); } diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc index 2258f8a2e..e311f74cf 100644 --- a/src/lib/create_cli.cc +++ b/src/lib/create_cli.cc @@ -19,11 +19,11 @@ */ -#include "compose.hpp" #include "config.h" #include "create_cli.h" #include "dcp_content_type.h" #include "ratio.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <iostream> #include <string> @@ -67,7 +67,7 @@ argument_option (int& n, int argc, char* argv[], string short_name, string long_ } if ((n + 1) >= argc) { - **error = String::compose("%1: option %2 requires an argument", argv[0], long_name); + **error = dcp::compose("%1: option %2 requires an argument", argv[0], long_name); return; } @@ -108,7 +108,7 @@ CreateCLI::CreateCLI (int argc, char* argv[]) } else if (a == "-h" || a == "--help") { error = "Create a film directory (ready for making a DCP) or metadata file from some content files.\n" "A film directory will be created if -o or --output is specified, otherwise a metadata file\n" - "will be written to stdout.\n" + String::compose(_help, argv[0]); + "will be written to stdout.\n" + dcp::compose(_help, argv[0]); return; } @@ -142,7 +142,7 @@ CreateCLI::CreateCLI (int argc, char* argv[]) if (!claimed) { if (a.length() > 2 && a.substr(0, 2) == "--") { - error = String::compose("%1: unrecognised option '%2'", argv[0], a) + String::compose(_help, argv[0]); + error = dcp::compose("%1: unrecognised option '%2'", argv[0], a) + dcp::compose(_help, argv[0]); return; } else { Content c; @@ -178,20 +178,20 @@ CreateCLI::CreateCLI (int argc, char* argv[]) dcp_content_type = DCPContentType::from_isdcf_name(dcp_content_type_string); if (!dcp_content_type) { - error = String::compose("%1: unrecognised DCP content type '%2'", argv[0], dcp_content_type_string); + error = dcp::compose("%1: unrecognised DCP content type '%2'", argv[0], dcp_content_type_string); return; } if (!container_ratio_string.empty()) { container_ratio = Ratio::from_id (container_ratio_string); if (!container_ratio) { - error = String::compose("%1: unrecognised container ratio %2", argv[0], container_ratio_string); + error = dcp::compose("%1: unrecognised container ratio %2", argv[0], container_ratio_string); return; } } if (standard_string != "SMPTE" && standard_string != "interop") { - error = String::compose("%1: standard must be SMPTE or interop", argv[0]); + error = dcp::compose("%1: standard must be SMPTE or interop", argv[0]); return; } @@ -200,7 +200,7 @@ CreateCLI::CreateCLI (int argc, char* argv[]) } if (content.empty()) { - error = String::compose("%1: no content specified", argv[0]); + error = dcp::compose("%1: no content specified", argv[0]); return; } @@ -209,7 +209,7 @@ CreateCLI::CreateCLI (int argc, char* argv[]) } if (j2k_bandwidth && (*j2k_bandwidth < 10000000 || *j2k_bandwidth > Config::instance()->maximum_j2k_bandwidth())) { - error = String::compose("%1: j2k-bandwidth must be between 10 and %2 Mbit/s", argv[0], (Config::instance()->maximum_j2k_bandwidth() / 1000000)); + error = dcp::compose("%1: j2k-bandwidth must be between 10 and %2 Mbit/s", argv[0], (Config::instance()->maximum_j2k_bandwidth() / 1000000)); return; } } diff --git a/src/lib/cross_common.cc b/src/lib/cross_common.cc index 2e48bf3e0..0a5451ff1 100644 --- a/src/lib/cross_common.cc +++ b/src/lib/cross_common.cc @@ -20,9 +20,9 @@ #include "cross.h" -#include "compose.hpp" #include "dcpomatic_log.h" #include "warnings.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> DCPOMATIC_DISABLE_WARNINGS #include <libxml++/libxml++.h> @@ -91,7 +91,7 @@ Drive::description () const name = _("Unknown"); } - return String::compose(_("%1 (%2 GB) [%3]"), name, gb, _device); + return dcp::compose(_("%1 (%2 GB) [%3]"), name, gb, _device); } @@ -108,7 +108,7 @@ Drive::log_summary () const mp = mp.substr (0, mp.length() - 1); } - return String::compose( + return dcp::compose( "Device %1 mounted on %2 size %3 vendor %4 model %5", _device, mp, _size, _vendor.get_value_or("[none]"), _model.get_value_or("[none]") ); diff --git a/src/lib/cross_linux.cc b/src/lib/cross_linux.cc index 65151791c..f2faa6a2a 100644 --- a/src/lib/cross_linux.cc +++ b/src/lib/cross_linux.cc @@ -19,7 +19,6 @@ */ -#include "compose.hpp" #include "config.h" #include "cross.h" #include "dcpomatic_log.h" @@ -27,6 +26,7 @@ #include "exceptions.h" #include "log.h" #include "warnings.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <glib.h> DCPOMATIC_DISABLE_WARNINGS diff --git a/src/lib/cross_osx.cc b/src/lib/cross_osx.cc index b9b7796a2..d7ca778f4 100644 --- a/src/lib/cross_osx.cc +++ b/src/lib/cross_osx.cc @@ -20,12 +20,12 @@ #include "cross.h" -#include "compose.hpp" #include "log.h" #include "dcpomatic_log.h" #include "config.h" #include "exceptions.h" #include "warnings.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <glib.h> extern "C" { diff --git a/src/lib/cross_windows.cc b/src/lib/cross_windows.cc index ac92aa7eb..43dc87cc3 100644 --- a/src/lib/cross_windows.cc +++ b/src/lib/cross_windows.cc @@ -20,13 +20,13 @@ #include "cross.h" -#include "compose.hpp" #include "log.h" #include "dcpomatic_log.h" #include "config.h" #include "exceptions.h" #include "dcpomatic_assert.h" #include "util.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <glib.h> extern "C" { @@ -599,7 +599,7 @@ Drive::get () continue; } - string const physical_drive = String::compose("\\\\.\\PHYSICALDRIVE%1", *device_number); + string const physical_drive = dcp::compose("\\\\.\\PHYSICALDRIVE%1", *device_number); HANDLE device = CreateFileA ( physical_drive.c_str(), 0, @@ -645,7 +645,7 @@ Drive::unmount () { LOG_DISK("Unmounting %1 with %2 mount points", _device, _mount_points.size()); DCPOMATIC_ASSERT (_mount_points.size() == 1); - string const device_name = String::compose ("\\\\.\\%1", _mount_points.front()); + string const device_name = dcp::compose ("\\\\.\\%1", _mount_points.front()); string const truncated = device_name.substr (0, device_name.length() - 1); //LOG_DISK("Actually opening %1", _device); //HANDLE device = CreateFileA (_device.c_str(), (GENERIC_READ | GENERIC_WRITE), FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); diff --git a/src/lib/curl_uploader.cc b/src/lib/curl_uploader.cc index 60835bea7..0b08227f0 100644 --- a/src/lib/curl_uploader.cc +++ b/src/lib/curl_uploader.cc @@ -23,7 +23,7 @@ #include "exceptions.h" #include "config.h" #include "cross.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <iostream> #include "i18n.h" @@ -82,19 +82,19 @@ CurlUploader::upload_file (boost::filesystem::path from, boost::filesystem::path curl_easy_setopt ( _curl, CURLOPT_URL, /* Use generic_string so that we get forward-slashes in the path, even on Windows */ - String::compose ("ftp://%1/%2/%3", Config::instance()->tms_ip(), Config::instance()->tms_path(), to.generic_string ()).c_str () + dcp::compose ("ftp://%1/%2/%3", Config::instance()->tms_ip(), Config::instance()->tms_path(), to.generic_string ()).c_str () ); _file = fopen_boost (from, "rb"); if (!_file) { - throw NetworkError (String::compose (_("Could not open %1 to send"), from)); + throw NetworkError (dcp::compose (_("Could not open %1 to send"), from)); } _transferred = &transferred; _total_size = total_size; auto const r = curl_easy_perform (_curl); if (r != CURLE_OK) { - throw NetworkError (String::compose (_("Could not write to remote file (%1)"), curl_easy_strerror (r))); + throw NetworkError (dcp::compose (_("Could not write to remote file (%1)"), curl_easy_strerror (r))); } fclose (_file); diff --git a/src/lib/dcp.cc b/src/lib/dcp.cc index abdfc7f9e..ee7b92ca5 100644 --- a/src/lib/dcp.cc +++ b/src/lib/dcp.cc @@ -19,12 +19,12 @@ */ -#include "compose.hpp" #include "dcp.h" #include "dcp_content.h" #include "dcpomatic_log.h" #include "log.h" #include "util.h" +#include <dcp/compose.h> #include <dcp/dcp.h> #include <dcp/decrypted_kdm.h> #include <dcp/exceptions.h> diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index c380e6f84..26ed49819 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -27,11 +27,11 @@ #include "film.h" #include "config.h" #include "overlaps.h" -#include "compose.hpp" #include "dcp_decoder.h" #include "log.h" #include "dcpomatic_log.h" #include "text_content.h" +#include <dcp/compose.h> #include <dcp/dcp.h> #include <dcp/raw_convert.h> #include <dcp/exceptions.h> @@ -315,7 +315,7 @@ string DCPContent::summary () const { boost::mutex::scoped_lock lm (_mutex); - return String::compose (_("%1 [DCP]"), _name); + return dcp::compose (_("%1 [DCP]"), _name); } string diff --git a/src/lib/dcp_encoder.cc b/src/lib/dcp_encoder.cc index f1c412539..e0e2f39cf 100644 --- a/src/lib/dcp_encoder.cc +++ b/src/lib/dcp_encoder.cc @@ -33,10 +33,10 @@ #include "player.h" #include "job.h" #include "writer.h" -#include "compose.hpp" #include "referenced_reel_asset.h" #include "text_content.h" #include "player_video.h" +#include <dcp/compose.h> #include <boost/signals2.hpp> #include <iostream> diff --git a/src/lib/dcp_subtitle.cc b/src/lib/dcp_subtitle.cc index 0943a6b08..21180dc2a 100644 --- a/src/lib/dcp_subtitle.cc +++ b/src/lib/dcp_subtitle.cc @@ -21,7 +21,7 @@ #include "dcp_subtitle.h" #include "exceptions.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <dcp/interop_subtitle_asset.h> #include <dcp/smpte_subtitle_asset.h> @@ -56,7 +56,7 @@ DCPSubtitle::load (boost::filesystem::path file) const } if (!sc) { - throw FileError(String::compose(_("Could not read subtitles (%1 / %2)"), interop_error, smpte_error), file); + throw FileError(dcp::compose(_("Could not read subtitles (%1 / %2)"), interop_error, smpte_error), file); } return sc; diff --git a/src/lib/dcp_text_track.cc b/src/lib/dcp_text_track.cc index 0bd751275..749129c35 100644 --- a/src/lib/dcp_text_track.cc +++ b/src/lib/dcp_text_track.cc @@ -20,7 +20,7 @@ #include "dcp_text_track.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <string> #include "i18n.h" @@ -50,7 +50,7 @@ DCPTextTrack::DCPTextTrack (string name_, optional<dcp::LanguageTag> language_) string DCPTextTrack::summary () const { - return String::compose("%1 (%2)", name, language ? language->to_string() : _("Unknown")); + return dcp::compose("%1 (%2)", name, language ? language->to_string() : _("Unknown")); } void diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index 4a505a7e1..895e39dd7 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -30,7 +30,6 @@ */ -#include "compose.hpp" #include "config.h" #include "cross.h" #include "dcp_video.h" @@ -44,6 +43,7 @@ #include "rng.h" #include "warnings.h" #include <libcxml/cxml.h> +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <dcp/openjpeg_image.h> #include <dcp/rgb_xyz.h> diff --git a/src/lib/dcpomatic_log.h b/src/lib/dcpomatic_log.h index 6a1c3a6ec..5eb8f2833 100644 --- a/src/lib/dcpomatic_log.h +++ b/src/lib/dcpomatic_log.h @@ -20,28 +20,28 @@ #include "log.h" -#include "compose.hpp" +#include <dcp/compose.h> /** The current log; set up by the front-ends when they have a Film to log into */ extern std::shared_ptr<Log> dcpomatic_log; -#define LOG_GENERAL(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL); +#define LOG_GENERAL(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL); #define LOG_GENERAL_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_GENERAL); -#define LOG_ERROR(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_ERROR); +#define LOG_ERROR(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_ERROR); #define LOG_ERROR_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_ERROR); -#define LOG_WARNING(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_WARNING); +#define LOG_WARNING(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_WARNING); #define LOG_WARNING_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_WARNING); -#define LOG_TIMING(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_TIMING); -#define LOG_DEBUG_ENCODE(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_ENCODE); -#define LOG_DEBUG_VIDEO_VIEW(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_VIDEO_VIEW); -#define LOG_DEBUG_THREE_D(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_THREE_D); +#define LOG_TIMING(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_TIMING); +#define LOG_DEBUG_ENCODE(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_ENCODE); +#define LOG_DEBUG_VIDEO_VIEW(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_VIDEO_VIEW); +#define LOG_DEBUG_THREE_D(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_THREE_D); #define LOG_DEBUG_THREE_D_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_DEBUG_THREE_D); -#define LOG_DISK(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_DISK); +#define LOG_DISK(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_DISK); #define LOG_DISK_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_DISK); -#define LOG_DEBUG_PLAYER(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_PLAYER); +#define LOG_DEBUG_PLAYER(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_PLAYER); #define LOG_DEBUG_PLAYER_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_DEBUG_PLAYER); -#define LOG_DEBUG_AUDIO_ANALYSIS(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_AUDIO_ANALYSIS); +#define LOG_DEBUG_AUDIO_ANALYSIS(...) dcpomatic_log->log(dcp::compose(__VA_ARGS__), LogEntry::TYPE_DEBUG_AUDIO_ANALYSIS); #define LOG_DEBUG_AUDIO_ANALYSIS_NC(...) dcpomatic_log->log(__VA_ARGS__, LogEntry::TYPE_DEBUG_AUDIO_ANALYSIS); diff --git a/src/lib/dcpomatic_socket.cc b/src/lib/dcpomatic_socket.cc index a92a294e6..a1670de55 100644 --- a/src/lib/dcpomatic_socket.cc +++ b/src/lib/dcpomatic_socket.cc @@ -19,9 +19,9 @@ */ #include "dcpomatic_socket.h" -#include "compose.hpp" #include "exceptions.h" #include "dcpomatic_assert.h" +#include <dcp/compose.h> #include <boost/bind/bind.hpp> #include <boost/lambda/lambda.hpp> #include <iostream> @@ -66,7 +66,7 @@ Socket::connect (boost::asio::ip::tcp::endpoint endpoint) } while (ec == boost::asio::error::would_block); if (ec) { - throw NetworkError (String::compose (_("error during async_connect (%1)"), ec.value ())); + throw NetworkError (dcp::compose (_("error during async_connect (%1)"), ec.value ())); } if (!_socket.is_open ()) { @@ -91,7 +91,7 @@ Socket::write (uint8_t const * data, int size) } while (ec == boost::asio::error::would_block); if (ec) { - throw NetworkError (String::compose (_("error during async_write (%1)"), ec.value ())); + throw NetworkError (dcp::compose (_("error during async_write (%1)"), ec.value ())); } if (_write_digester) { @@ -123,7 +123,7 @@ Socket::read (uint8_t* data, int size) } while (ec == boost::asio::error::would_block); if (ec) { - throw NetworkError (String::compose (_("error during async_read (%1)"), ec.value ())); + throw NetworkError (dcp::compose (_("error during async_read (%1)"), ec.value ())); } if (_read_digester) { diff --git a/src/lib/dkdm_wrapper.cc b/src/lib/dkdm_wrapper.cc index 4698c159d..ceba6582c 100644 --- a/src/lib/dkdm_wrapper.cc +++ b/src/lib/dkdm_wrapper.cc @@ -19,10 +19,10 @@ */ -#include "compose.hpp" #include "dkdm_wrapper.h" #include "dcpomatic_assert.h" #include "warnings.h" +#include <dcp/compose.h> DCPOMATIC_DISABLE_WARNINGS #include <libxml++/libxml++.h> DCPOMATIC_ENABLE_WARNINGS @@ -57,7 +57,7 @@ DKDMBase::read (cxml::ConstNodePtr node) string DKDM::name () const { - return String::compose ("%1 (%2)", _dkdm.content_title_text(), _dkdm.cpl_id()); + return dcp::compose ("%1 (%2)", _dkdm.content_title_text(), _dkdm.cpl_id()); } diff --git a/src/lib/emailer.cc b/src/lib/emailer.cc index 6ef23c3e0..4933b9953 100644 --- a/src/lib/emailer.cc +++ b/src/lib/emailer.cc @@ -19,10 +19,10 @@ */ -#include "compose.hpp" #include "config.h" #include "emailer.h" #include "exceptions.h" +#include <dcp/compose.h> #include <curl/curl.h> #include <boost/algorithm/string.hpp> #include <boost/date_time/c_local_time_adjustor.hpp> @@ -189,9 +189,9 @@ Emailer::send (string server, int port, EmailProtocol protocol, string user, str if ((protocol == EmailProtocol::AUTO && port == 465) || protocol == EmailProtocol::SSL) { /* "SSL" or "Implicit TLS"; I think curl wants us to use smtps here */ - curl_easy_setopt (curl, CURLOPT_URL, String::compose("smtps://%1:%2", server, port).c_str()); + curl_easy_setopt (curl, CURLOPT_URL, dcp::compose("smtps://%1:%2", server, port).c_str()); } else { - curl_easy_setopt (curl, CURLOPT_URL, String::compose("smtp://%1:%2", server, port).c_str()); + curl_easy_setopt (curl, CURLOPT_URL, dcp::compose("smtp://%1:%2", server, port).c_str()); } if (!user.empty ()) { diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc index 24ba5bc45..739903c8b 100644 --- a/src/lib/encode_server.cc +++ b/src/lib/encode_server.cc @@ -33,12 +33,12 @@ #include "config.h" #include "cross.h" #include "player_video.h" -#include "compose.hpp" #include "log.h" #include "dcpomatic_log.h" #include "encoded_log_entry.h" #include "version.h" #include "warnings.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <libcxml/cxml.h> DCPOMATIC_DISABLE_WARNINGS diff --git a/src/lib/environment_info.cc b/src/lib/environment_info.cc index 2a6d47a00..d7ac75ccb 100644 --- a/src/lib/environment_info.cc +++ b/src/lib/environment_info.cc @@ -19,11 +19,11 @@ */ -#include "compose.hpp" #include "cross.h" #include "log.h" #include "version.h" #include "warnings.h" +#include <dcp/compose.h> #include <dcp/version.h> #include <libssh/libssh.h> DCPOMATIC_DISABLE_WARNINGS @@ -85,12 +85,12 @@ environment_info () { list<string> info; - info.push_back (String::compose ("DCP-o-matic %1 git %2 using %3", dcpomatic_version, dcpomatic_git_commit, dependency_version_summary())); + info.push_back (dcp::compose ("DCP-o-matic %1 git %2 using %3", dcpomatic_version, dcpomatic_git_commit, dependency_version_summary())); { char buffer[128]; gethostname (buffer, sizeof (buffer)); - info.push_back (String::compose ("Host name %1", &buffer[0])); + info.push_back (dcp::compose ("Host name %1", &buffer[0])); } #ifdef DCPOMATIC_DEBUG @@ -109,7 +109,7 @@ environment_info () os_info.dwOSVersionInfoSize = sizeof (os_info); GetVersionEx (&os_info); info.push_back ( - String::compose ( + dcp::compose ( "Windows version %1.%2.%3", (int) os_info.dwMajorVersion, (int) os_info.dwMinorVersion, (int) os_info.dwBuildNumber ) @@ -141,9 +141,9 @@ environment_info () #endif #endif - info.push_back (String::compose ("CPU: %1, %2 processors", cpu_info(), boost::thread::hardware_concurrency())); + info.push_back (dcp::compose ("CPU: %1, %2 processors", cpu_info(), boost::thread::hardware_concurrency())); for (auto const& i: mount_info()) { - info.push_back (String::compose("Mount: %1 %2", i.first, i.second)); + info.push_back (dcp::compose("Mount: %1 %2", i.first, i.second)); } return info; diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc index 9350430f9..119963d90 100644 --- a/src/lib/exceptions.cc +++ b/src/lib/exceptions.cc @@ -20,7 +20,7 @@ #include "exceptions.h" -#include "compose.hpp" +#include <dcp/compose.h> #include "i18n.h" @@ -33,7 +33,7 @@ using boost::optional; /** @param f File that we were trying to open */ OpenFileError::OpenFileError (boost::filesystem::path f, int error, Mode mode) : FileError ( - String::compose ( + dcp::compose ( mode == READ_WRITE ? _("could not open file %1 for read/write (%2)") : (mode == READ ? _("could not open file %1 for read (%2)") : _("could not open file %1 for write (%2)")), f.string(), @@ -46,7 +46,7 @@ OpenFileError::OpenFileError (boost::filesystem::path f, int error, Mode mode) FileNotFoundError::FileNotFoundError (boost::filesystem::path f) - : runtime_error(String::compose("File %1 not found", f.string())) + : runtime_error(dcp::compose("File %1 not found", f.string())) , _file (f) { @@ -54,35 +54,35 @@ FileNotFoundError::FileNotFoundError (boost::filesystem::path f) ReadFileError::ReadFileError (boost::filesystem::path f, int e) - : FileError (String::compose(_("could not read from file %1 (%2)"), f.string(), strerror(e)), f) + : FileError (dcp::compose(_("could not read from file %1 (%2)"), f.string(), strerror(e)), f) { } WriteFileError::WriteFileError (boost::filesystem::path f, int e) - : FileError (String::compose(_("could not write to file %1 (%2)"), f.string(), strerror(e)), f) + : FileError (dcp::compose(_("could not write to file %1 (%2)"), f.string(), strerror(e)), f) { } MissingSettingError::MissingSettingError (string s) - : SettingError (s, String::compose(_("Missing required setting %1"), s)) + : SettingError (s, dcp::compose(_("Missing required setting %1"), s)) { } PixelFormatError::PixelFormatError (string o, AVPixelFormat f) - : runtime_error (String::compose(_("Cannot handle pixel format %1 during %2"), (int) f, o)) + : runtime_error (dcp::compose(_("Cannot handle pixel format %1 during %2"), (int) f, o)) { } TextSubtitleError::TextSubtitleError (string saw, string expecting, boost::filesystem::path f) - : FileError (String::compose(_("Error in subtitle file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f) + : FileError (dcp::compose(_("Error in subtitle file: saw %1 while expecting %2"), saw.empty() ? "[nothing]" : saw, expecting), f) { } @@ -96,14 +96,14 @@ InvalidSignerError::InvalidSignerError () InvalidSignerError::InvalidSignerError (string reason) - : runtime_error (String::compose(_("The certificate chain for signing is invalid (%1)"), reason)) + : runtime_error (dcp::compose(_("The certificate chain for signing is invalid (%1)"), reason)) { } ProgrammingError::ProgrammingError (string file, int line, string message) - : runtime_error (String::compose(_("Programming error at %1:%2 %3"), file, line, message)) + : runtime_error (dcp::compose(_("Programming error at %1:%2 %3"), file, line, message)) { } @@ -117,7 +117,7 @@ KDMAsContentError::KDMAsContentError () KDMError::KDMError (string s, string d) - : runtime_error (String::compose("%1 (%2)", s, d)) + : runtime_error (dcp::compose("%1 (%2)", s, d)) , _summary (s) , _detail (d) { @@ -126,14 +126,14 @@ KDMError::KDMError (string s, string d) GLError::GLError (char const * last, int e) - : runtime_error (String::compose("%1 failed %2", last, e)) + : runtime_error (dcp::compose("%1 failed %2", last, e)) { } CopyError::CopyError (string m, optional<int> n) - : runtime_error (String::compose("%1%2", m, n ? String::compose(" (%1)", *n) : "")) + : runtime_error (dcp::compose("%1%2", m, n ? dcp::compose(" (%1)", *n) : "")) , _message (m) , _number (n) { @@ -149,7 +149,7 @@ CommunicationFailedError::CommunicationFailedError () VerifyError::VerifyError (string m, int n) - : runtime_error (String::compose("%1 (%2)", m, n)) + : runtime_error (dcp::compose("%1 (%2)", m, n)) , _message (m) , _number (n) { diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index 5cbf69941..d6a0055c3 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -28,7 +28,7 @@ #define DCPOMATIC_EXCEPTIONS_H -#include "compose.hpp" +#include <dcp/compose.h> extern "C" { #include <libavutil/pixfmt.h> } @@ -50,19 +50,19 @@ public: {} DecodeError (std::string function, std::string caller) - : std::runtime_error (String::compose("%1 failed [%2]", function, caller)) + : std::runtime_error (dcp::compose("%1 failed [%2]", function, caller)) {} DecodeError (std::string function, std::string caller, int error) - : std::runtime_error (String::compose("%1 failed [%2] (%3)", function, caller, error)) + : std::runtime_error (dcp::compose("%1 failed [%2] (%3)", function, caller, error)) {} DecodeError (std::string function, std::string caller, boost::filesystem::path file) - : std::runtime_error (String::compose("%1 failed [%2] (%3)", function, caller, file.string())) + : std::runtime_error (dcp::compose("%1 failed [%2] (%3)", function, caller, file.string())) {} DecodeError (std::string function, std::string caller, int error, boost::filesystem::path file) - : std::runtime_error (String::compose("%1 failed [%2] (%3) (%4)", function, caller, error, file.string())) + : std::runtime_error (dcp::compose("%1 failed [%2] (%3) (%4)", function, caller, error, file.string())) {} }; @@ -87,11 +87,11 @@ public: {} explicit EncodeError (std::string function, std::string caller) - : std::runtime_error (String::compose("%1 failed [%2]", function, caller)) + : std::runtime_error (dcp::compose("%1 failed [%2]", function, caller)) {} explicit EncodeError (std::string function, std::string caller, int error) - : std::runtime_error (String::compose("%1 failed [%2] (%3)", function, caller, error)) + : std::runtime_error (dcp::compose("%1 failed [%2] (%3)", function, caller, error)) {} }; @@ -106,7 +106,7 @@ public: * @param f Name of the file that this exception concerns. */ FileError (std::string m, boost::filesystem::path f) - : std::runtime_error (String::compose("%1 with %2", m, f.string())) + : std::runtime_error (dcp::compose("%1 with %2", m, f.string())) , _file (f) {} diff --git a/src/lib/ext.cc b/src/lib/ext.cc index feba68c1f..d8df7609e 100644 --- a/src/lib/ext.cc +++ b/src/lib/ext.cc @@ -19,7 +19,6 @@ */ -#include "compose.hpp" #include "cross.h" #include "dcpomatic_log.h" #include "digester.h" @@ -27,6 +26,7 @@ #include "exceptions.h" #include "ext.h" #include "nanomsg.h" +#include <dcp/compose.h> #ifdef DCPOMATIC_LINUX #include <linux/fs.h> @@ -97,13 +97,13 @@ write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total ext4_file out; int r = ext4_fopen(&out, to.generic_string().c_str(), "wb"); if (r != EOK) { - throw CopyError (String::compose("Failed to open file %1", to.generic_string()), r); + throw CopyError (dcp::compose("Failed to open file %1", to.generic_string()), r); } FILE* in = fopen_boost (from, "rb"); if (!in) { ext4_fclose (&out); - throw CopyError (String::compose("Failed to open file %1", from.string()), 0); + throw CopyError (dcp::compose("Failed to open file %1", from.string()), 0); } uint8_t* buffer = new uint8_t[block_size]; @@ -119,7 +119,7 @@ write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total fclose (in); ext4_fclose (&out); delete[] buffer; - throw CopyError (String::compose("Short read; expected %1 but read %2", this_time, read), 0); + throw CopyError (dcp::compose("Short read; expected %1 but read %2", this_time, read), 0); } digester.add (buffer, this_time); @@ -136,14 +136,14 @@ write (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total fclose (in); ext4_fclose (&out); delete[] buffer; - throw CopyError (String::compose("Short write; expected %1 but wrote %2", this_time, written), 0); + throw CopyError (dcp::compose("Short write; expected %1 but wrote %2", this_time, written), 0); } remaining -= this_time; total_remaining -= this_time; ++progress_count; if ((progress_count % progress_frequency) == 0 && nanomsg) { - nanomsg->send(String::compose(DISK_WRITER_COPY_PROGRESS "\n%1\n", (1 - float(total_remaining) / total)), SHORT_TIMEOUT); + nanomsg->send(dcp::compose(DISK_WRITER_COPY_PROGRESS "\n%1\n", (1 - float(total_remaining) / total)), SHORT_TIMEOUT); } } @@ -163,7 +163,7 @@ read (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total_ LOG_DISK("Opening %1 for read", to.generic_string()); int r = ext4_fopen(&in, to.generic_string().c_str(), "rb"); if (r != EOK) { - throw VerifyError (String::compose("Failed to open file %1", to.generic_string()), r); + throw VerifyError (dcp::compose("Failed to open file %1", to.generic_string()), r); } LOG_DISK("Opened %1 for read", to.generic_string()); @@ -178,14 +178,14 @@ read (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total_ if (read != this_time) { ext4_fclose (&in); delete[] buffer; - throw VerifyError (String::compose("Short read; expected %1 but read %2", this_time, read), 0); + throw VerifyError (dcp::compose("Short read; expected %1 but read %2", this_time, read), 0); } digester.add (buffer, this_time); remaining -= this_time; total_remaining -= this_time; if (nanomsg) { - nanomsg->send(String::compose(DISK_WRITER_VERIFY_PROGRESS "\n%1\n", (1 - float(total_remaining) / total)), SHORT_TIMEOUT); + nanomsg->send(dcp::compose(DISK_WRITER_VERIFY_PROGRESS "\n%1\n", (1 - float(total_remaining) / total)), SHORT_TIMEOUT); } } @@ -229,7 +229,7 @@ copy (boost::filesystem::path from, boost::filesystem::path to, uint64_t& total_ if (is_directory(from)) { int r = ext4_dir_mk (cr.generic_string().c_str()); if (r != EOK) { - throw CopyError (String::compose("Failed to create directory %1", cr.generic_string()), r); + throw CopyError (dcp::compose("Failed to create directory %1", cr.generic_string()), r); } for (directory_iterator i = directory_iterator(from); i != directory_iterator(); ++i) { @@ -263,7 +263,7 @@ void format_progress (void* context, float progress) { if (context) { - reinterpret_cast<Nanomsg*>(context)->send(String::compose(DISK_WRITER_FORMAT_PROGRESS "\n%1\n", progress), SHORT_TIMEOUT); + reinterpret_cast<Nanomsg*>(context)->send(dcp::compose(DISK_WRITER_FORMAT_PROGRESS "\n%1\n", progress), SHORT_TIMEOUT); } } @@ -402,17 +402,17 @@ try } catch (CopyError& e) { LOG_DISK("CopyError (from write): %1 %2", e.message(), e.number().get_value_or(0)); if (nanomsg) { - nanomsg->send(String::compose(DISK_WRITER_ERROR "\n%1\n%2\n", e.message(), e.number().get_value_or(0)), LONG_TIMEOUT); + nanomsg->send(dcp::compose(DISK_WRITER_ERROR "\n%1\n%2\n", e.message(), e.number().get_value_or(0)), LONG_TIMEOUT); } } catch (VerifyError& e) { LOG_DISK("VerifyError (from write): %1 %2", e.message(), e.number()); if (nanomsg) { - nanomsg->send(String::compose(DISK_WRITER_ERROR "\n%1\n%2\n", e.message(), e.number()), LONG_TIMEOUT); + nanomsg->send(dcp::compose(DISK_WRITER_ERROR "\n%1\n%2\n", e.message(), e.number()), LONG_TIMEOUT); } } catch (exception& e) { LOG_DISK("Exception (from write): %1", e.what()); if (nanomsg) { - nanomsg->send(String::compose(DISK_WRITER_ERROR "\n%1\n0\n", e.what()), LONG_TIMEOUT); + nanomsg->send(dcp::compose(DISK_WRITER_ERROR "\n%1\n0\n", e.what()), LONG_TIMEOUT); } } diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index d476b4c29..9d07a8109 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -29,8 +29,8 @@ #include "ffmpeg_subtitle_stream.h" #include "ffmpeg_audio_stream.h" #include "digester.h" -#include "compose.hpp" #include "config.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> extern "C" { #include <libavcodec/avcodec.h> @@ -103,7 +103,7 @@ FFmpeg::ffmpeg_log_callback (void* ptr, int level, const char* fmt, va_list vl) av_log_format_line (ptr, level, fmt, vl, line, sizeof (line), &prefix); string str (line); boost::algorithm::trim (str); - dcpomatic_log->log (String::compose ("FFmpeg: %1", str), LogEntry::TYPE_GENERAL); + dcpomatic_log->log (dcp::compose ("FFmpeg: %1", str), LogEntry::TYPE_GENERAL); } @@ -236,7 +236,7 @@ FFmpeg::setup_decoders () throw DecodeError (N_("avcodec_open2"), N_("FFmpeg::setup_decoders"), r); } } else { - dcpomatic_log->log (String::compose ("No codec found for stream %1", i), LogEntry::TYPE_WARNING); + dcpomatic_log->log (dcp::compose ("No codec found for stream %1", i), LogEntry::TYPE_WARNING); } } } diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 516962936..8e8d43282 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -25,7 +25,6 @@ #include "ffmpeg_examiner.h" #include "ffmpeg_subtitle_stream.h" #include "ffmpeg_audio_stream.h" -#include "compose.hpp" #include "job.h" #include "util.h" #include "filter.h" @@ -35,6 +34,7 @@ #include "exceptions.h" #include "frame_rate_change.h" #include "text_content.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <libcxml/cxml.h> extern "C" { @@ -115,7 +115,7 @@ FFmpegContent::FFmpegContent (cxml::ConstNodePtr node, int version, list<string> if (f) { _filters.push_back (f); } else { - notes.push_back (String::compose (_("DCP-o-matic no longer supports the `%1' filter, so it has been turned off."), i->content())); + notes.push_back (dcp::compose (_("DCP-o-matic no longer supports the `%1' filter, so it has been turned off."), i->content())); } } @@ -338,11 +338,11 @@ string FFmpegContent::summary () const { if (video && audio) { - return String::compose (_("%1 [movie]"), path_summary()); + return dcp::compose (_("%1 [movie]"), path_summary()); } else if (video) { - return String::compose (_("%1 [video]"), path_summary()); + return dcp::compose (_("%1 [video]"), path_summary()); } else if (audio) { - return String::compose (_("%1 [audio]"), path_summary()); + return dcp::compose (_("%1 [audio]"), path_summary()); } return path_summary (); @@ -378,7 +378,7 @@ FFmpegContent::technical_summary () const s += " - " + audio->technical_summary (); } - return s + String::compose ( + return s + dcp::compose ( "ffmpeg: audio %1 subtitle %2 filters %3", as, ss, filt ); } @@ -550,14 +550,14 @@ FFmpegContent::add_properties (shared_ptr<const Film> film, list<UserProperty>& /// file is limited, so that not all possible values are valid. p.push_back ( UserProperty ( - UserProperty::VIDEO, _("Colour range"), String::compose(_("Limited (%1-%2)"), lim_start, lim_end) + UserProperty::VIDEO, _("Colour range"), dcp::compose(_("Limited (%1-%2)"), lim_start, lim_end) ) ); break; case AVCOL_RANGE_JPEG: /// TRANSLATORS: this means that the range of pixel values used in this /// file is full, so that all possible pixel values are valid. - p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), String::compose (_("Full (0-%1)"), total))); + p.push_back (UserProperty (UserProperty::VIDEO, _("Colour range"), dcp::compose (_("Full (0-%1)"), total))); break; default: DCPOMATIC_ASSERT (false); diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 31fbde773..a1b44624e 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -39,10 +39,10 @@ #include "video_decoder.h" #include "film.h" #include "audio_decoder.h" -#include "compose.hpp" #include "text_content.h" #include "audio_content.h" #include "frame_interval_checker.h" +#include <dcp/compose.h> #include <dcp/subtitle_string.h> #include <sub/ssa_reader.h> #include <sub/subtitle.h> @@ -340,7 +340,7 @@ FFmpegDecoder::deinterleave_audio (AVFrame* frame) break; default: - throw DecodeError (String::compose(_("Unrecognised audio sample format (%1)"), static_cast<int>(format))); + throw DecodeError (dcp::compose(_("Unrecognised audio sample format (%1)"), static_cast<int>(format))); } return audio; diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index 1ce375594..bd4f29c78 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -27,7 +27,7 @@ #include "image.h" #include "cross.h" #include "butler.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <iostream> #include "i18n.h" @@ -136,7 +136,7 @@ FFmpegEncoder::go () if (files > 1) { /// TRANSLATORS: _reel%1 here is to be added to an export filename to indicate /// which reel it is. Preserve the %1; it will be replaced with the reel number. - filename = filename.string() + String::compose(_("_reel%1"), i + 1); + filename = filename.string() + dcp::compose(_("_reel%1"), i + 1); } file_encoders.push_back ( @@ -179,7 +179,7 @@ FFmpegEncoder::go () auto v = _butler->get_video (true, &e); _butler->rethrow (); if (!v.first) { - throw DecodeError(String::compose("Error during decoding: %1", e.summary())); + throw DecodeError(dcp::compose("Error during decoding: %1", e.summary())); } auto fe = encoder->get (v.first->eyes()); if (fe) { @@ -248,17 +248,17 @@ FFmpegEncoder::FileEncoderSet::FileEncoderSet ( /// TRANSLATORS: L here is an abbreviation for "left", to indicate the left-eye part of a 3D export _encoders[Eyes::LEFT] = make_shared<FFmpegFileEncoder>( video_frame_size, video_frame_rate, audio_frame_rate, channels, format, - audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("L"), extension) + audio_stream_per_channel, x264_crf, dcp::compose("%1_%2%3", output.string(), _("L"), extension) ); /// TRANSLATORS: R here is an abbreviation for "right", to indicate the right-eye part of a 3D export _encoders[Eyes::RIGHT] = make_shared<FFmpegFileEncoder>( video_frame_size, video_frame_rate, audio_frame_rate, channels, format, - audio_stream_per_channel, x264_crf, String::compose("%1_%2%3", output.string(), _("R"), extension) + audio_stream_per_channel, x264_crf, dcp::compose("%1_%2%3", output.string(), _("R"), extension) ); } else { _encoders[Eyes::BOTH] = make_shared<FFmpegFileEncoder>( video_frame_size, video_frame_rate, audio_frame_rate, channels, format, - audio_stream_per_channel, x264_crf, String::compose("%1%2", output.string(), extension) + audio_stream_per_channel, x264_crf, dcp::compose("%1%2", output.string(), extension) ); } } diff --git a/src/lib/ffmpeg_file_encoder.cc b/src/lib/ffmpeg_file_encoder.cc index 29ee7455b..080f3ade9 100644 --- a/src/lib/ffmpeg_file_encoder.cc +++ b/src/lib/ffmpeg_file_encoder.cc @@ -28,7 +28,7 @@ #include "log.h" #include "image.h" #include "cross.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <iostream> #include "i18n.h" @@ -62,7 +62,7 @@ public: { _codec = avcodec_find_encoder_by_name (codec_name.c_str()); if (!_codec) { - throw EncodeError (String::compose("avcodec_find_encoder_by_name failed for %1", codec_name)); + throw EncodeError (dcp::compose("avcodec_find_encoder_by_name failed for %1", codec_name)); } _codec_context = avcodec_alloc_context3 (_codec); @@ -263,7 +263,7 @@ FFmpegFileEncoder::FFmpegFileEncoder ( r = avio_open_boost (&_format_context->pb, _output, AVIO_FLAG_WRITE); if (r < 0) { - throw EncodeError (String::compose(_("Could not open output file %1 (%2)"), _output.string(), r)); + throw EncodeError (dcp::compose(_("Could not open output file %1 (%2)"), _output.string(), r)); } AVDictionary* options = nullptr; @@ -307,7 +307,7 @@ FFmpegFileEncoder::setup_video () { _video_codec = avcodec_find_encoder_by_name (_video_codec_name.c_str()); if (!_video_codec) { - throw EncodeError (String::compose("avcodec_find_encoder_by_name failed for %1", _video_codec_name)); + throw EncodeError (dcp::compose("avcodec_find_encoder_by_name failed for %1", _video_codec_name)); } _video_codec_context = avcodec_alloc_context3 (_video_codec); diff --git a/src/lib/ffmpeg_image_proxy.cc b/src/lib/ffmpeg_image_proxy.cc index 54fb1c468..e26f4b040 100644 --- a/src/lib/ffmpeg_image_proxy.cc +++ b/src/lib/ffmpeg_image_proxy.cc @@ -19,7 +19,6 @@ */ -#include "compose.hpp" #include "cross.h" #include "dcpomatic_socket.h" #include "exceptions.h" @@ -27,6 +26,7 @@ #include "image.h" #include "util.h" #include "warnings.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> DCPOMATIC_DISABLE_WARNINGS extern "C" { @@ -160,7 +160,7 @@ FFmpegImageProxy::image (optional<dcp::Size>) const if (_path) { throw OpenFileError (_path->string(), e, OpenFileError::READ); } else { - boost::throw_exception(DecodeError(String::compose(_("Could not decode image (%1)"), e))); + boost::throw_exception(DecodeError(dcp::compose(_("Could not decode image (%1)"), e))); } } diff --git a/src/lib/file_group.cc b/src/lib/file_group.cc index 7dae1da92..c5f6aa0cb 100644 --- a/src/lib/file_group.cc +++ b/src/lib/file_group.cc @@ -24,11 +24,11 @@ */ -#include "compose.hpp" #include "cross.h" #include "dcpomatic_assert.h" #include "exceptions.h" #include "file_group.h" +#include <dcp/compose.h> #include <sndfile.h> #include <cstdio> @@ -182,7 +182,7 @@ FileGroup::read (uint8_t* buffer, int amount) const } if (ferror(_current_file)) { - throw FileError (String::compose("fread error %1", errno), _paths[_current_path]); + throw FileError (dcp::compose("fread error %1", errno), _paths[_current_path]); } if (eof) { diff --git a/src/lib/film.cc b/src/lib/film.cc index 44c49220b..3fe92c7cd 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -44,7 +44,6 @@ #include "environment_info.h" #include "audio_processor.h" #include "digester.h" -#include "compose.hpp" #include "screen.h" #include "audio_content.h" #include "video_content.h" @@ -58,6 +57,7 @@ #include "ffmpeg_subtitle_stream.h" #include "font.h" #include <libcxml/cxml.h> +#include <dcp/compose.h> #include <dcp/cpl.h> #include <dcp/certificate_chain.h> #include <dcp/util.h> @@ -564,7 +564,7 @@ Film::read_metadata (optional<boost::filesystem::path> path) throw runtime_error (_("This film was created with a newer version of DCP-o-matic, and it cannot be loaded into this version. Sorry!")); } else if (_state_version < current_state_version) { /* This is an older version; save a copy (if we haven't already) */ - auto const older = path->parent_path() / String::compose("metadata.%1.xml", _state_version); + auto const older = path->parent_path() / dcp::compose("metadata.%1.xml", _state_version); if (!boost::filesystem::is_regular_file(older)) { try { boost::filesystem::copy_file(*path, older); @@ -887,7 +887,7 @@ Film::isdcf_name (bool if_created_now) const auto fl = _luminance->value_in_foot_lamberts(); char buffer[64]; snprintf (buffer, sizeof(buffer), "%.1f", fl); - d += String::compose("-%1fl", buffer); + d += dcp::compose("-%1fl", buffer); } if (video_frame_rate() != 24) { @@ -969,7 +969,7 @@ Film::isdcf_name (bool if_created_now) const if (!ch.first && !ch.second) { d += "_MOS"; } else if (ch.first) { - d += String::compose("_%1%2", ch.first, ch.second); + d += dcp::compose("_%1%2", ch.first, ch.second); } if (audio_channels() > static_cast<int>(dcp::Channel::HI) && find(mapped.begin(), mapped.end(), static_cast<int>(dcp::Channel::HI)) != mapped.end()) { diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index fc6b9033a..1984604ce 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -28,7 +28,7 @@ #include "filter.h" #include "exceptions.h" #include "image.h" -#include "compose.hpp" +#include <dcp/compose.h> extern "C" { #include <libavfilter/buffersrc.h> #include <libavfilter/buffersink.h> @@ -104,7 +104,7 @@ FilterGraph::setup (vector<Filter const *> filters) int e = avfilter_graph_config (_graph, 0); if (e < 0) { - throw DecodeError (String::compose(N_("could not configure filter graph (%1)"), e)); + throw DecodeError (dcp::compose(N_("could not configure filter graph (%1)"), e)); } } diff --git a/src/lib/frame_rate_change.cc b/src/lib/frame_rate_change.cc index a1ff2ae65..0ee4a492e 100644 --- a/src/lib/frame_rate_change.cc +++ b/src/lib/frame_rate_change.cc @@ -23,7 +23,7 @@ #include "types.h" #include "content.h" #include "film.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <cmath> #include "i18n.h" @@ -94,7 +94,7 @@ FrameRateChange::description () const } else if (repeat == 2) { description = _("Each content frame will be doubled in the DCP.\n"); } else if (repeat > 2) { - description = String::compose (_("Each content frame will be repeated %1 more times in the DCP.\n"), repeat - 1); + description = dcp::compose (_("Each content frame will be repeated %1 more times in the DCP.\n"), repeat - 1); } if (change_speed) { diff --git a/src/lib/hints.cc b/src/lib/hints.cc index 64122db8d..7653638fd 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -22,7 +22,6 @@ #include "audio_analysis.h" #include "audio_content.h" #include "audio_processor.h" -#include "compose.hpp" #include "content.h" #include "cross.h" #include "dcp_content_type.h" @@ -37,6 +36,7 @@ #include "util.h" #include "video_content.h" #include "writer.h" +#include <dcp/compose.h> #include <dcp/cpl.h> #include <dcp/raw_convert.h> #include <dcp/reel.h> @@ -182,7 +182,7 @@ Hints::check_frame_rate () case 25: { /* You might want to go to 24 */ - string base = String::compose(_("You are set up for a DCP at a frame rate of %1 fps. This frame rate is not supported by all projectors. You may want to consider changing your frame rate to %2 fps."), 25, 24); + string base = dcp::compose(_("You are set up for a DCP at a frame rate of %1 fps. This frame rate is not supported by all projectors. You may want to consider changing your frame rate to %2 fps."), 25, 24); if (f->interop()) { base += " "; base += _("If you do use 25fps you should change your DCP standard to SMPTE."); @@ -198,7 +198,7 @@ Hints::check_frame_rate () case 50: case 60: /* You almost certainly want to go to half frame rate */ - hint (String::compose(_("You are set up for a DCP at a frame rate of %1 fps. This frame rate is not supported by all projectors. You are advised to change the DCP frame rate to %2 fps."), f->video_frame_rate(), f->video_frame_rate() / 2)); + hint (dcp::compose(_("You are set up for a DCP at a frame rate of %1 fps. This frame rate is not supported by all projectors. You are advised to change the DCP frame rate to %2 fps."), f->video_frame_rate(), f->video_frame_rate() / 2)); break; } } @@ -287,7 +287,7 @@ Hints::check_vob () } if (vob > 1) { - hint (String::compose (_("You have %1 files that look like they are VOB files from DVD. You should join them to ensure smooth joins between the files."), vob)); + hint (dcp::compose (_("You have %1 files that look like they are VOB files from DVD. You should join them to ensure smooth joins between the files."), vob)); } } @@ -336,7 +336,7 @@ Hints::check_loudness () ch = ch.substr (0, ch.length() - 2); if (!ch.empty()) { - hint(String::compose( + hint(dcp::compose( _("Your audio level is very high (on %1). You should reduce the gain of your audio content."), ch ) @@ -540,7 +540,7 @@ Hints::closed_caption (PlayerText text, DCPTimePeriod period) if (!_long_ccap) { _long_ccap = true; hint ( - String::compose( + dcp::compose( "At least one of your closed caption lines has more than %1 characters. " "It is advisable to make each line %1 characters at most in length.", MAX_CLOSED_CAPTION_LENGTH, @@ -551,7 +551,7 @@ Hints::closed_caption (PlayerText text, DCPTimePeriod period) } if (!_too_many_ccap_lines && lines > MAX_CLOSED_CAPTION_LINES) { - hint (String::compose(_("Some of your closed captions span more than %1 lines, so they will be truncated."), MAX_CLOSED_CAPTION_LINES)); + hint (dcp::compose(_("Some of your closed captions span more than %1 lines, so they will be truncated."), MAX_CLOSED_CAPTION_LINES)); _too_many_ccap_lines = true; } diff --git a/src/lib/image.cc b/src/lib/image.cc index 8e6c5717b..591727ba5 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -24,7 +24,6 @@ */ -#include "compose.hpp" #include "dcpomatic_socket.h" #include "exceptions.h" #include "image.h" @@ -32,6 +31,7 @@ #include "timer.h" #include "util.h" #include "warnings.h" +#include <dcp/compose.h> #include <dcp/rgb_xyz.h> #include <dcp/transfer_function.h> DCPOMATIC_DISABLE_WARNINGS @@ -1384,7 +1384,7 @@ png_error_fn (png_structp png_ptr, char const * message) void Image::png_error (char const * message) { - throw EncodeError (String::compose ("Error during PNG write: %1", message)); + throw EncodeError (dcp::compose ("Error during PNG write: %1", message)); } dcp::ArrayData diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 517d6792f..b0d253624 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -21,12 +21,12 @@ #include "image_content.h" #include "video_content.h" #include "image_examiner.h" -#include "compose.hpp" #include "film.h" #include "job.h" #include "frame_rate_change.h" #include "exceptions.h" #include "image_filename_sorter.h" +#include <dcp/compose.h> #include <libcxml/cxml.h> #include <libxml++/libxml++.h> #include <iostream> diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc index 89d1517ce..d94891c6e 100644 --- a/src/lib/image_examiner.cc +++ b/src/lib/image_examiner.cc @@ -26,9 +26,9 @@ #include "exceptions.h" #include "config.h" #include "cross.h" -#include "compose.hpp" #include "ffmpeg_image_proxy.h" #include "image.h" +#include <dcp/compose.h> #include <dcp/openjpeg_image.h> #include <dcp/exceptions.h> #include <dcp/j2k_transcode.h> @@ -62,7 +62,7 @@ ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const Imag _video_size = dcp::decompress_j2k (buffer, size, 0)->size (); } catch (dcp::ReadError& e) { delete[] buffer; - throw DecodeError (String::compose (_("Could not decode JPEG2000 file %1 (%2)"), path, e.what ())); + throw DecodeError (dcp::compose (_("Could not decode JPEG2000 file %1 (%2)"), path, e.what ())); } delete[] buffer; } else { diff --git a/src/lib/internet.cc b/src/lib/internet.cc index ca72399f3..648e4b1a9 100644 --- a/src/lib/internet.cc +++ b/src/lib/internet.cc @@ -20,10 +20,10 @@ #include "scoped_temporary.h" -#include "compose.hpp" #include "exceptions.h" #include "cross.h" #include "util.h" +#include <dcp/compose.h> #include <curl/curl.h> #include <zip.h> #include <boost/optional.hpp> @@ -118,7 +118,7 @@ get_from_url (string url, bool pasv, bool skip_pasv_ip, ScopedTemporary& temp) temp.close (); curl_easy_cleanup (curl); if (cr != CURLE_OK) { - return String::compose (_("Download failed (%1 error %2)"), url, (int) cr); + return dcp::compose (_("Download failed (%1 error %2)"), url, (int) cr); } return optional<string>(); @@ -173,7 +173,7 @@ get_from_zip_url (string url, string file, bool pasv, bool skip_pasv_ip, functio zip_error_init (&error); auto zip = zip_open_from_source (zip_source, ZIP_RDONLY, &error); if (!zip) { - return String::compose (_("Could not open downloaded ZIP file (%1:%2: %3)"), error.zip_err, error.sys_err, error.str ? error.str : ""); + return dcp::compose (_("Could not open downloaded ZIP file (%1:%2: %3)"), error.zip_err, error.sys_err, error.str ? error.str : ""); } #else diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index 5dee5ca35..c3f308508 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -37,7 +37,7 @@ #include "player.h" #include "player_video.h" #include "encode_server_description.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <libcxml/cxml.h> #include <iostream> diff --git a/src/lib/job.cc b/src/lib/job.cc index 52558046a..9aeaf800a 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -29,7 +29,7 @@ #include "film.h" #include "log.h" #include "dcpomatic_log.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <dcp/exceptions.h> #include <sub/exceptions.h> #include <boost/thread.hpp> @@ -95,7 +95,7 @@ Job::start () void Job::run_wrapper () { - start_of_thread (String::compose("Job-%1", json_name())); + start_of_thread (dcp::compose("Job-%1", json_name())); try { @@ -103,7 +103,7 @@ Job::run_wrapper () } catch (dcp::FileError& e) { - string m = String::compose (_("An error occurred whilst handling the file %1."), boost::filesystem::path (e.filename()).leaf()); + string m = dcp::compose (_("An error occurred whilst handling the file %1."), boost::filesystem::path (e.filename()).leaf()); try { auto const s = boost::filesystem::space (e.filename()); @@ -158,8 +158,8 @@ Job::run_wrapper () } catch (OpenFileError& e) { set_error ( - String::compose (_("Could not open %1"), e.file().string()), - String::compose ( + dcp::compose (_("Could not open %1"), e.file().string()), + dcp::compose ( _("DCP-o-matic could not open the file %1 (%2). Perhaps it does not exist or is in an unexpected format."), boost::filesystem::absolute (e.file()).string(), e.what() @@ -173,8 +173,8 @@ Job::run_wrapper () if (e.code() == boost::system::errc::no_such_file_or_directory) { set_error ( - String::compose (_("Could not open %1"), e.path1().string ()), - String::compose ( + dcp::compose (_("Could not open %1"), e.path1().string ()), + dcp::compose ( _("DCP-o-matic could not open the file %1 (%2). Perhaps it does not exist or is in an unexpected format."), boost::filesystem::absolute (e.path1()).string(), e.what() @@ -443,7 +443,7 @@ void Job::set_error (string s, string d) { if (_film) { - _film->log()->log (String::compose ("Error in job: %1 (%2)", s, d), LogEntry::TYPE_ERROR); + _film->log()->log (dcp::compose ("Error in job: %1 (%2)", s, d), LogEntry::TYPE_ERROR); } boost::mutex::scoped_lock lm (_state_mutex); @@ -488,19 +488,19 @@ Job::status () const if (now.date() != finish.date()) { /// TRANSLATORS: the %1 in this string will be filled in with a day of the week /// to say what day a job will finish. - day = String::compose (_(" on %1"), day_of_week_to_string(finish.date().day_of_week())); + day = dcp::compose (_(" on %1"), day_of_week_to_string(finish.date().day_of_week())); } /// TRANSLATORS: "remaining; finishing at" here follows an amount of time that is remaining /// on an operation; after it is an estimated wall-clock completion time. - s += String::compose( + s += dcp::compose( _("; %1 remaining; finishing at %2%3"), seconds_to_approximate_hms(r), finish_string, day ); } } else if (finished_ok ()) { - s = String::compose (_("OK (ran for %1)"), seconds_to_hms (_ran_for)); + s = dcp::compose (_("OK (ran for %1)"), seconds_to_hms (_ran_for)); } else if (finished_in_error ()) { - s = String::compose (_("Error: %1"), error_summary ()); + s = dcp::compose (_("Error: %1"), error_summary ()); } else if (finished_cancelled ()) { s = _("Cancelled"); } diff --git a/src/lib/nanomsg.cc b/src/lib/nanomsg.cc index 61e6c08ce..24b54f93f 100644 --- a/src/lib/nanomsg.cc +++ b/src/lib/nanomsg.cc @@ -44,11 +44,11 @@ Nanomsg::Nanomsg (bool server) } if (server) { if ((_endpoint = nn_bind(_socket, NANOMSG_URL)) < 0) { - throw runtime_error(String::compose("Could not bind nanomsg socket (%1)", errno)); + throw runtime_error(dcp::compose("Could not bind nanomsg socket (%1)", errno)); } } else { if ((_endpoint = nn_connect(_socket, NANOMSG_URL)) < 0) { - throw runtime_error(String::compose("Could not connect nanomsg socket (%1)", errno)); + throw runtime_error(dcp::compose("Could not connect nanomsg socket (%1)", errno)); } } } @@ -73,7 +73,7 @@ Nanomsg::send (string s, int timeout) if (errno == ETIMEDOUT || errno == EAGAIN) { return false; } - throw runtime_error(String::compose("Could not send to nanomsg socket (%1)", errno)); + throw runtime_error(dcp::compose("Could not send to nanomsg socket (%1)", errno)); } else if (r != int(s.length())) { throw runtime_error("Could not send to nanomsg socket (message too big)"); } diff --git a/src/lib/player.cc b/src/lib/player.cc index 5de089ba9..3080fccd8 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -49,9 +49,9 @@ #include "audio_content.h" #include "dcp_decoder.h" #include "image_decoder.h" -#include "compose.hpp" #include "shuffler.h" #include "timer.h" +#include <dcp/compose.h> #include <dcp/reel.h> #include <dcp/reel_sound_asset.h> #include <dcp/reel_subtitle_asset.h> @@ -723,7 +723,7 @@ Player::pass () /* Let's not worry about less than a frame at 24fps */ int64_t const too_much_error = DCPTime::from_frames(1, 24).get(); if (error >= too_much_error) { - _film->log()->log(String::compose("Silence starting before or after last audio by %1", error), LogEntry::TYPE_ERROR); + _film->log()->log(dcp::compose("Silence starting before or after last audio by %1", error), LogEntry::TYPE_ERROR); } DCPOMATIC_ASSERT (error < too_much_error); period.from = *_last_audio_time; @@ -1265,7 +1265,7 @@ Player::emit_audio (shared_ptr<AudioBuffers> data, DCPTime time) { /* Log if the assert below is about to fail */ if (_last_audio_time && labs(time.get() - _last_audio_time->get()) > 1) { - _film->log()->log(String::compose("Out-of-sequence emit %1 vs %2", to_string(time), to_string(*_last_audio_time)), LogEntry::TYPE_WARNING); + _film->log()->log(dcp::compose("Out-of-sequence emit %1 vs %2", to_string(time), to_string(*_last_audio_time)), LogEntry::TYPE_WARNING); } /* This audio must follow on from the previous, allowing for half a sample (at 48kHz) leeway */ diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index e8714e9d6..bf2f3d734 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -32,7 +32,7 @@ #include "config.h" #include "util.h" #include "digester.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <libcxml/cxml.h> #include <libxml++/libxml++.h> #include <boost/bind/placeholders.hpp> @@ -219,12 +219,12 @@ Playlist::set_from_xml (shared_ptr<const Film> film, cxml::ConstNodePtr node, in string note = _("Your project contains video content that was not aligned to a frame boundary."); note += " "; if (old_pos < content->position()) { - note += String::compose( + note += dcp::compose( _("The file %1 has been moved %2 milliseconds later."), content->path_summary(), DCPTime(content->position() - old_pos).seconds() * 1000 ); } else { - note += String::compose( + note += dcp::compose( _("The file %1 has been moved %2 milliseconds earlier."), content->path_summary(), DCPTime(content->position() - old_pos).seconds() * 1000 ); @@ -239,12 +239,12 @@ Playlist::set_from_xml (shared_ptr<const Film> film, cxml::ConstNodePtr node, in string note = _("Your project contains video content whose trim was not aligned to a frame boundary."); note += " "; if (old_trim < content->trim_start()) { - note += String::compose( + note += dcp::compose( _("The file %1 has been trimmed by %2 milliseconds more."), content->path_summary(), ContentTime(content->trim_start() - old_trim).seconds() * 1000 ); } else { - note += String::compose( + note += dcp::compose( _("The file %1 has been trimmed by %2 milliseconds less."), content->path_summary(), ContentTime(old_trim - content->trim_start()).seconds() * 1000 ); diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 521ba55df..24d25b4fa 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -26,13 +26,13 @@ #include "dcpomatic_log.h" #include "digester.h" #include "font_data.h" -#include "compose.hpp" #include "config.h" #include "audio_buffers.h" #include "image.h" #include <dcp/atmos_asset.h> #include <dcp/atmos_asset_writer.h> #include <dcp/certificate_chain.h> +#include <dcp/compose.h> #include <dcp/cpl.h> #include <dcp/dcp.h> #include <dcp/interop_subtitle_asset.h> @@ -415,7 +415,7 @@ ReelWriter::finish (boost::filesystem::path output_dcp) boost::filesystem::rename (film()->file(aaf), audio_to, ec); if (ec) { throw FileError ( - String::compose (_("could not move audio asset into the DCP (%1)"), ec.value ()), aaf + dcp::compose (_("could not move audio asset into the DCP (%1)"), ec.value ()), aaf ); } @@ -432,7 +432,7 @@ ReelWriter::finish (boost::filesystem::path output_dcp) boost::filesystem::rename (film()->file(aaf), atmos_to, ec); if (ec) { throw FileError ( - String::compose (_("could not move atmos asset into the DCP (%1)"), ec.value ()), aaf + dcp::compose (_("could not move atmos asset into the DCP (%1)"), ec.value ()), aaf ); } @@ -511,7 +511,7 @@ maybe_add_text ( if (!text_only && reel_asset->actual_duration() != period_duration) { throw ProgrammingError ( __FILE__, __LINE__, - String::compose ("%1 vs %2", reel_asset->actual_duration(), period_duration) + dcp::compose ("%1 vs %2", reel_asset->actual_duration(), period_duration) ); } reel->add (reel_asset); @@ -557,7 +557,7 @@ ReelWriter::create_reel_picture (shared_ptr<dcp::Reel> reel, list<ReferencedReel if (reel_asset->duration() != period_duration) { throw ProgrammingError ( __FILE__, __LINE__, - String::compose ("%1 vs %2", reel_asset->actual_duration(), period_duration) + dcp::compose ("%1 vs %2", reel_asset->actual_duration(), period_duration) ); } reel->add (reel_asset); @@ -609,7 +609,7 @@ ReelWriter::create_reel_sound (shared_ptr<dcp::Reel> reel, list<ReferencedReelAs if (reel_asset->actual_duration() != period_duration) { throw ProgrammingError ( __FILE__, __LINE__, - String::compose ("%1 vs %2", reel_asset->actual_duration(), period_duration) + dcp::compose ("%1 vs %2", reel_asset->actual_duration(), period_duration) ); } diff --git a/src/lib/resampler.cc b/src/lib/resampler.cc index 056b2e1ee..30164ca21 100644 --- a/src/lib/resampler.cc +++ b/src/lib/resampler.cc @@ -22,8 +22,8 @@ #include "resampler.h" #include "audio_buffers.h" #include "exceptions.h" -#include "compose.hpp" #include "dcpomatic_assert.h" +#include <dcp/compose.h> #include <samplerate.h> #include <iostream> #include <cmath> @@ -51,7 +51,7 @@ Resampler::Resampler (int in, int out, int channels) int error; _src = src_new (SRC_SINC_BEST_QUALITY, _channels, &error); if (!_src) { - throw runtime_error (String::compose(N_("could not create sample-rate converter (%1)"), error)); + throw runtime_error (dcp::compose(N_("could not create sample-rate converter (%1)"), error)); } } @@ -73,7 +73,7 @@ Resampler::set_fast () int error; _src = src_new (SRC_LINEAR, _channels, &error); if (!_src) { - throw runtime_error (String::compose(N_("could not create sample-rate converter (%1)"), error)); + throw runtime_error (dcp::compose(N_("could not create sample-rate converter (%1)"), error)); } } @@ -117,7 +117,7 @@ Resampler::run (shared_ptr<const AudioBuffers> in) int const r = src_process (_src, &data); if (r) { throw EncodeError ( - String::compose ( + dcp::compose ( N_("could not run sample-rate converter (%1) [processing %2 to %3, %4 channels]"), src_strerror (r), in_frames, @@ -173,7 +173,7 @@ Resampler::flush () int const r = src_process (_src, &data); if (r) { - throw EncodeError (String::compose(N_("could not run sample-rate converter (%1)"), src_strerror(r))); + throw EncodeError (dcp::compose(N_("could not run sample-rate converter (%1)"), src_strerror(r))); } out->ensure_size (out_offset + data.output_frames_gen); diff --git a/src/lib/scp_uploader.cc b/src/lib/scp_uploader.cc index 9c349f233..9373346ef 100644 --- a/src/lib/scp_uploader.cc +++ b/src/lib/scp_uploader.cc @@ -24,8 +24,8 @@ #include "job.h" #include "config.h" #include "cross.h" -#include "compose.hpp" #include "warnings.h" +#include <dcp/compose.h> #include <sys/stat.h> #include "i18n.h" @@ -42,7 +42,7 @@ SCPUploader::SCPUploader (function<void (string)> set_status, function<void (flo { _session = ssh_new (); if (!_session) { - throw NetworkError (String::compose(_("SSH error [%1]"), "ssh_new")); + throw NetworkError (dcp::compose(_("SSH error [%1]"), "ssh_new")); } ssh_options_set (_session, SSH_OPTIONS_HOST, Config::instance()->tms_ip().c_str()); @@ -52,29 +52,29 @@ SCPUploader::SCPUploader (function<void (string)> set_status, function<void (flo int r = ssh_connect (_session); if (r != SSH_OK) { - throw NetworkError (String::compose(_("Could not connect to server %1 (%2)"), Config::instance()->tms_ip(), ssh_get_error(_session))); + throw NetworkError (dcp::compose(_("Could not connect to server %1 (%2)"), Config::instance()->tms_ip(), ssh_get_error(_session))); } DCPOMATIC_DISABLE_WARNINGS r = ssh_is_server_known (_session); if (r == SSH_SERVER_ERROR) { - throw NetworkError (String::compose(_("SSH error [%1] (%2)"), "ssh_is_server_known", ssh_get_error(_session))); + throw NetworkError (dcp::compose(_("SSH error [%1] (%2)"), "ssh_is_server_known", ssh_get_error(_session))); } DCPOMATIC_ENABLE_WARNINGS r = ssh_userauth_password (_session, 0, Config::instance()->tms_password().c_str ()); if (r != SSH_AUTH_SUCCESS) { - throw NetworkError (String::compose(_("Failed to authenticate with server (%1)"), ssh_get_error(_session))); + throw NetworkError (dcp::compose(_("Failed to authenticate with server (%1)"), ssh_get_error(_session))); } _scp = ssh_scp_new (_session, SSH_SCP_WRITE | SSH_SCP_RECURSIVE, Config::instance()->tms_path().c_str()); if (!_scp) { - throw NetworkError (String::compose(_("SSH error [%1] (%2)"), "ssh_scp_new", ssh_get_error(_session))); + throw NetworkError (dcp::compose(_("SSH error [%1] (%2)"), "ssh_scp_new", ssh_get_error(_session))); } r = ssh_scp_init (_scp); if (r != SSH_OK) { - throw NetworkError (String::compose(_("SSH error [%1] (%2)"), "ssh_scp_init", ssh_get_error(_session))); + throw NetworkError (dcp::compose(_("SSH error [%1] (%2)"), "ssh_scp_init", ssh_get_error(_session))); } } @@ -93,7 +93,7 @@ SCPUploader::create_directory (boost::filesystem::path directory) /* Use generic_string so that we get forward-slashes in the path, even on Windows */ int const r = ssh_scp_push_directory (_scp, directory.generic_string().c_str(), S_IRWXU); if (r != SSH_OK) { - throw NetworkError (String::compose(_("Could not create remote directory %1 (%2)"), directory, ssh_get_error(_session))); + throw NetworkError (dcp::compose(_("Could not create remote directory %1 (%2)"), directory, ssh_get_error(_session))); } } @@ -107,7 +107,7 @@ SCPUploader::upload_file (boost::filesystem::path from, boost::filesystem::path auto f = fopen_boost (from, "rb"); if (f == nullptr) { - throw NetworkError (String::compose(_("Could not open %1 to send"), from)); + throw NetworkError (dcp::compose(_("Could not open %1 to send"), from)); } boost::uintmax_t buffer_size = 64 * 1024; @@ -124,7 +124,7 @@ SCPUploader::upload_file (boost::filesystem::path from, boost::filesystem::path int const r = ssh_scp_write (_scp, buffer, t); if (r != SSH_OK) { fclose (f); - throw NetworkError (String::compose(_("Could not write to remote file (%1)"), ssh_get_error(_session))); + throw NetworkError (dcp::compose(_("Could not write to remote file (%1)"), ssh_get_error(_session))); } to_do -= t; transferred += t; diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc index 67ddd0eef..1ed042130 100644 --- a/src/lib/send_kdm_email_job.cc +++ b/src/lib/send_kdm_email_job.cc @@ -20,9 +20,9 @@ #include "send_kdm_email_job.h" -#include "compose.hpp" #include "kdm_with_metadata.h" #include "film.h" +#include <dcp/compose.h> #include <list> #include "i18n.h" @@ -89,7 +89,7 @@ SendKDMEmailJob::name () const return _("Email KDMs"); } - return String::compose (_("Email KDMs for %2"), *f); + return dcp::compose (_("Email KDMs for %2"), *f); } diff --git a/src/lib/send_notification_email_job.cc b/src/lib/send_notification_email_job.cc index c4d5a6518..2e272a454 100644 --- a/src/lib/send_notification_email_job.cc +++ b/src/lib/send_notification_email_job.cc @@ -23,7 +23,7 @@ #include "exceptions.h" #include "config.h" #include "emailer.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <list> #include "i18n.h" diff --git a/src/lib/send_problem_report_job.cc b/src/lib/send_problem_report_job.cc index 6ab83ee62..fc5028ae4 100644 --- a/src/lib/send_problem_report_job.cc +++ b/src/lib/send_problem_report_job.cc @@ -20,7 +20,6 @@ #include "send_problem_report_job.h" -#include "compose.hpp" #include "film.h" #include "cross.h" #include "film.h" @@ -28,6 +27,7 @@ #include "version.h" #include "emailer.h" #include "environment_info.h" +#include <dcp/compose.h> #include <libxml++/libxml++.h> #include "i18n.h" @@ -68,7 +68,7 @@ SendProblemReportJob::name () const return _("Email problem report"); } - return String::compose (_("Email problem report for %1"), _film->name()); + return dcp::compose (_("Email problem report for %1"), _film->name()); } diff --git a/src/lib/shuffler.cc b/src/lib/shuffler.cc index 5a4faf4d1..16c9bb05b 100644 --- a/src/lib/shuffler.cc +++ b/src/lib/shuffler.cc @@ -84,8 +84,8 @@ Shuffler::video (weak_ptr<Piece> weak_piece, ContentVideo video) ); if (!store_front_in_sequence) { - string const store = _store.empty() ? "store empty" : String::compose("store front frame=%1 eyes=%2", _store.front().second.frame, static_cast<int>(_store.front().second.eyes)); - string const last = _last ? String::compose("last frame=%1 eyes=%2", _last->frame, static_cast<int>(_last->eyes)) : "no last"; + string const store = _store.empty() ? "store empty" : dcp::compose("store front frame=%1 eyes=%2", _store.front().second.frame, static_cast<int>(_store.front().second.eyes)); + string const last = _last ? dcp::compose("last frame=%1 eyes=%2", _last->frame, static_cast<int>(_last->eyes)) : "no last"; LOG_DEBUG_THREE_D("Shuffler not in sequence: %1 %2", store, last); } diff --git a/src/lib/subtitle_encoder.cc b/src/lib/subtitle_encoder.cc index ba47e1231..531c9cdcb 100644 --- a/src/lib/subtitle_encoder.cc +++ b/src/lib/subtitle_encoder.cc @@ -19,11 +19,11 @@ */ -#include "compose.hpp" #include "font_data.h" #include "job.h" #include "player.h" #include "subtitle_encoder.h" +#include <dcp/compose.h> #include <dcp/interop_subtitle_asset.h> #include <dcp/raw_convert.h> #include <dcp/smpte_subtitle_asset.h> @@ -72,7 +72,7 @@ SubtitleEncoder::SubtitleEncoder (shared_ptr<const Film> film, shared_ptr<Job> j if (files > 1) { /// TRANSLATORS: _reel%1 here is to be added to an export filename to indicate /// which reel it is. Preserve the %1; it will be replaced with the reel number. - filename /= String::compose("%1_reel%2", initial_name, i + 1); + filename /= dcp::compose("%1_reel%2", initial_name, i + 1); } else { filename /= initial_name; } diff --git a/src/lib/text_decoder.cc b/src/lib/text_decoder.cc index 0a7bdf95d..3b28b7e12 100644 --- a/src/lib/text_decoder.cc +++ b/src/lib/text_decoder.cc @@ -23,7 +23,7 @@ #include "text_content.h" #include "util.h" #include "log.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <sub/subtitle.h> #include <boost/algorithm/string.hpp> #include <iostream> diff --git a/src/lib/timer.cc b/src/lib/timer.cc index caef89e0e..6f4072747 100644 --- a/src/lib/timer.cc +++ b/src/lib/timer.cc @@ -24,9 +24,9 @@ */ -#include "compose.hpp" #include "timer.h" #include "util.h" +#include <dcp/compose.h> #include <sys/time.h> #include <iostream> @@ -130,7 +130,7 @@ StateTimer::~StateTimer () char buffer[64]; snprintf (buffer, 64, "%.4f", i.second.total_time); string total_time (buffer); - sorted.push_back (make_pair(i.second.total_time, String::compose("\t%1%2 %3 %4", name, total_time, i.second.number, (i.second.total_time / i.second.number)))); + sorted.push_back (make_pair(i.second.total_time, dcp::compose("\t%1%2 %3 %4", name, total_time, i.second.number, (i.second.total_time / i.second.number)))); } sorted.sort ([](pair<double, string> const& a, pair<double, string> const& b) { diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index 3502c3346..463a3c7bd 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -25,7 +25,6 @@ #include "analytics.h" -#include "compose.hpp" #include "config.h" #include "dcp_encoder.h" #include "dcpomatic_log.h" @@ -35,6 +34,7 @@ #include "log.h" #include "transcode_job.h" #include "upload_job.h" +#include <dcp/compose.h> #include <iomanip> #include <iostream> @@ -68,7 +68,7 @@ TranscodeJob::~TranscodeJob () string TranscodeJob::name () const { - return String::compose (_("Transcoding %1"), _film->name()); + return dcp::compose (_("Transcoding %1"), _film->name()); } diff --git a/src/lib/types.cc b/src/lib/types.cc index 228ebf28f..9e8748159 100644 --- a/src/lib/types.cc +++ b/src/lib/types.cc @@ -19,10 +19,10 @@ */ #include "types.h" -#include "compose.hpp" #include "dcpomatic_assert.h" #include "warnings.h" #include <dcp/raw_convert.h> +#include <dcp/compose.h> #include <dcp/cpl.h> #include <dcp/dcp.h> #include <dcp/reel_file_asset.h> @@ -112,7 +112,7 @@ string_to_text_type (string s) } else if (s == "closed-caption") { return TextType::CLOSED_CAPTION; } else { - throw MetadataError (String::compose ("Unknown text type %1", s)); + throw MetadataError (dcp::compose ("Unknown text type %1", s)); } } diff --git a/src/lib/upload_job.cc b/src/lib/upload_job.cc index 113e3a7e8..e88b3aaf8 100644 --- a/src/lib/upload_job.cc +++ b/src/lib/upload_job.cc @@ -24,7 +24,6 @@ */ -#include "compose.hpp" #include "config.h" #include "curl_uploader.h" #include "dcpomatic_log.h" @@ -32,6 +31,7 @@ #include "log.h" #include "scp_uploader.h" #include "upload_job.h" +#include <dcp/compose.h> #include <iostream> #include "i18n.h" diff --git a/src/lib/uploader.cc b/src/lib/uploader.cc index c5448e469..11fb55f35 100644 --- a/src/lib/uploader.cc +++ b/src/lib/uploader.cc @@ -21,7 +21,7 @@ #include "uploader.h" #include "dcpomatic_assert.h" -#include "compose.hpp" +#include <dcp/compose.h> #include "i18n.h" @@ -76,7 +76,7 @@ Uploader::upload_directory (boost::filesystem::path base, boost::filesystem::pat if (is_directory(i.path())) { upload_directory (base, i.path(), transferred, total_size); } else { - _set_status (String::compose(_("copying %1"), i.path().leaf())); + _set_status (dcp::compose(_("copying %1"), i.path().leaf())); upload_file (i.path(), remove_prefix (base, i.path()), transferred, total_size); } } diff --git a/src/lib/util.cc b/src/lib/util.cc index a3c8c5082..8903eae1d 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -36,7 +36,6 @@ #include "digester.h" #include "audio_processor.h" #include "crypto.h" -#include "compose.hpp" #include "audio_buffers.h" #include "string_text.h" #include "font.h" @@ -46,6 +45,7 @@ #include "text_decoder.h" #include "job_manager.h" #include "warnings.h" +#include <dcp/compose.h> #include <dcp/decrypted_kdm.h> #include <dcp/locale_convert.h> #include <dcp/util.h> @@ -385,7 +385,7 @@ DCPOMATIC_ENABLE_WARNINGS #ifdef DCPOMATIC_WINDOWS putenv ("PANGOCAIRO_BACKEND=fontconfig"); - putenv (String::compose("FONTCONFIG_PATH=%1", resources_path().string()).c_str()); + putenv (dcp::compose("FONTCONFIG_PATH=%1", resources_path().string()).c_str()); #endif #ifdef DCPOMATIC_OSX @@ -452,11 +452,11 @@ dcpomatic_setup_gettext_i18n (string lang) /* Override our environment language. Note that the caller must not free the string passed into putenv(). */ - string s = String::compose ("LANGUAGE=%1", lang); + string s = dcp::compose ("LANGUAGE=%1", lang); putenv (strdup (s.c_str ())); - s = String::compose ("LANG=%1", lang); + s = dcp::compose ("LANG=%1", lang); putenv (strdup (s.c_str ())); - s = String::compose ("LC_ALL=%1", lang); + s = dcp::compose ("LC_ALL=%1", lang); putenv (strdup (s.c_str ())); } @@ -881,7 +881,7 @@ checked_fwrite (void const * ptr, size_t size, FILE* stream, boost::filesystem:: if (N != size) { if (ferror(stream)) { fclose (stream); - throw FileError (String::compose("fwrite error %1", errno), path); + throw FileError (dcp::compose("fwrite error %1", errno), path); } else { fclose (stream); throw FileError ("Unexpected short write", path); @@ -896,7 +896,7 @@ checked_fread (void* ptr, size_t size, FILE* stream, boost::filesystem::path pat if (N != size) { if (ferror(stream)) { fclose (stream); - throw FileError (String::compose("fread error %1", errno), path); + throw FileError (dcp::compose("fread error %1", errno), path); } else { fclose (stream); throw FileError ("Unexpected short read", path); diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 5686a0a6f..054c91873 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -21,7 +21,6 @@ #include "video_content.h" #include "content.h" #include "video_examiner.h" -#include "compose.hpp" #include "ratio.h" #include "config.h" #include "colour_conversion.h" @@ -31,6 +30,7 @@ #include "frame_rate_change.h" #include "log.h" #include "dcpomatic_log.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <libcxml/cxml.h> #include <libxml++/libxml++.h> @@ -354,7 +354,7 @@ VideoContent::identifier () const string VideoContent::technical_summary () const { - string s = String::compose ( + string s = dcp::compose ( N_("video: length %1 frames, size %2x%3"), length_after_3d_combine(), size().width, @@ -362,7 +362,7 @@ VideoContent::technical_summary () const ); if (sample_aspect_ratio ()) { - s += String::compose (N_(", sample aspect ratio %1"), (sample_aspect_ratio().get ())); + s += dcp::compose (N_(", sample aspect ratio %1"), (sample_aspect_ratio().get ())); } return s; @@ -426,7 +426,7 @@ VideoContent::processing_description (shared_ptr<const Film> film) char buffer[256]; if (size().width && size().height) { - d += String::compose ( + d += dcp::compose ( _("Content video is %1x%2"), size_after_3d_split().width, size_after_3d_split().height @@ -447,7 +447,7 @@ VideoContent::processing_description (shared_ptr<const Film> film) if ((crop().left || crop().right || crop().top || crop().bottom) && size() != dcp::Size (0, 0)) { dcp::Size cropped = size_after_crop (); - d += String::compose ( + d += dcp::compose ( _("\nCropped to %1x%2"), cropped.width, cropped.height ); @@ -460,7 +460,7 @@ VideoContent::processing_description (shared_ptr<const Film> film) auto const scaled = scaled_size (container_size); if (scaled != size_after_crop ()) { - d += String::compose ( + d += dcp::compose ( _("\nScaled to %1x%2"), scaled.width, scaled.height ); @@ -470,7 +470,7 @@ VideoContent::processing_description (shared_ptr<const Film> film) } if (scaled != container_size) { - d += String::compose ( + d += dcp::compose ( _("\nPadded with black to fit container %1 (%2x%3)"), film->container()->container_nickname (), container_size.width, container_size.height @@ -497,7 +497,7 @@ void VideoContent::add_properties (list<UserProperty>& p) const { p.push_back (UserProperty (UserProperty::VIDEO, _("Length"), length (), _("video frames"))); - p.push_back (UserProperty (UserProperty::VIDEO, _("Size"), String::compose ("%1x%2", size().width, size().height))); + p.push_back (UserProperty (UserProperty::VIDEO, _("Size"), dcp::compose ("%1x%2", size().width, size().height))); } void diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc index ce42f428f..a05c30f64 100644 --- a/src/lib/video_decoder.cc +++ b/src/lib/video_decoder.cc @@ -19,7 +19,6 @@ */ -#include "compose.hpp" #include "film.h" #include "frame_interval_checker.h" #include "image.h" @@ -27,6 +26,7 @@ #include "log.h" #include "raw_image_proxy.h" #include "video_decoder.h" +#include <dcp/compose.h> #include <iostream> #include "i18n.h" @@ -82,7 +82,7 @@ VideoDecoder::emit (shared_ptr<const Film> film, shared_ptr<const ImageProxy> im if (_frame_interval_checker->guess() == FrameIntervalChecker::PROBABLY_NOT_3D && vft == VideoFrameType::THREE_D) { boost::throw_exception ( DecodeError( - String::compose( + dcp::compose( _("The content file %1 is set as 3D but does not appear to contain 3D images. Please set it to 2D. " "You can still make a 3D DCP from this content by ticking the 3D option in the DCP video tab."), _content->path(0) diff --git a/src/lib/video_filter_graph.cc b/src/lib/video_filter_graph.cc index a61da6773..87915fff7 100644 --- a/src/lib/video_filter_graph.cc +++ b/src/lib/video_filter_graph.cc @@ -19,10 +19,10 @@ */ -#include "compose.hpp" #include "image.h" #include "video_filter_graph.h" #include "warnings.h" +#include <dcp/compose.h> extern "C" { #include <libavfilter/buffersrc.h> #include <libavfilter/buffersink.h> @@ -63,7 +63,7 @@ VideoFilterGraph::process (AVFrame* frame) } else { int r = av_buffersrc_write_frame (_buffer_src_context, frame); if (r < 0) { - throw DecodeError (String::compose(N_("could not push buffer into filter chain (%1)."), r)); + throw DecodeError (dcp::compose(N_("could not push buffer into filter chain (%1)."), r)); } while (true) { diff --git a/src/lib/video_mxf_content.cc b/src/lib/video_mxf_content.cc index c7ee69d89..20ff3d3fc 100644 --- a/src/lib/video_mxf_content.cc +++ b/src/lib/video_mxf_content.cc @@ -24,8 +24,8 @@ #include "video_content.h" #include "job.h" #include "film.h" -#include "compose.hpp" #include <asdcp/KM_log.h> +#include <dcp/compose.h> #include <dcp/mono_picture_asset.h> #include <dcp/stereo_picture_asset.h> #include <dcp/exceptions.h> @@ -102,7 +102,7 @@ VideoMXFContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) string VideoMXFContent::summary () const { - return String::compose (_("%1 [video]"), path_summary()); + return dcp::compose (_("%1 [video]"), path_summary()); } diff --git a/src/lib/video_ring_buffers.cc b/src/lib/video_ring_buffers.cc index 63c52ee06..0ac097977 100644 --- a/src/lib/video_ring_buffers.cc +++ b/src/lib/video_ring_buffers.cc @@ -21,7 +21,7 @@ #include "video_ring_buffers.h" #include "player_video.h" -#include "compose.hpp" +#include <dcp/compose.h> #include <list> #include <iostream> @@ -89,7 +89,7 @@ VideoRingBuffers::memory_used () const for (auto const& i: _data) { m += i.first->memory_used(); } - return make_pair(m, String::compose("%1 frames", _data.size())); + return make_pair(m, dcp::compose("%1 frames", _data.size())); } diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 6b8076875..6bb3afd0e 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -20,7 +20,6 @@ #include "writer.h" -#include "compose.hpp" #include "film.h" #include "ratio.h" #include "log.h" @@ -37,6 +36,7 @@ #include "util.h" #include "reel_writer.h" #include "text_content.h" +#include <dcp/compose.h> #include <dcp/cpl.h> #include <dcp/locale_convert.h> #include <dcp/reel_file_asset.h> @@ -616,12 +616,12 @@ Writer::finish (boost::filesystem::path output_dcp) auto creator = Config::instance()->dcp_creator(); if (creator.empty()) { - creator = String::compose("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit); + creator = dcp::compose("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit); } auto issuer = Config::instance()->dcp_issuer(); if (issuer.empty()) { - issuer = String::compose("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit); + issuer = dcp::compose("DCP-o-matic %1 %2", dcpomatic_version, dcpomatic_git_commit); } cpl->set_creator (creator); @@ -746,13 +746,13 @@ Writer::write_cover_sheet (boost::filesystem::path output_dcp) } if (size > (1000000000L)) { - boost::algorithm::replace_all (text, "$SIZE", String::compose("%1GB", dcp::locale_convert<string>(size / 1000000000.0, 1, true))); + boost::algorithm::replace_all (text, "$SIZE", dcp::compose("%1GB", dcp::locale_convert<string>(size / 1000000000.0, 1, true))); } else { - boost::algorithm::replace_all (text, "$SIZE", String::compose("%1MB", dcp::locale_convert<string>(size / 1000000.0, 1, true))); + boost::algorithm::replace_all (text, "$SIZE", dcp::compose("%1MB", dcp::locale_convert<string>(size / 1000000.0, 1, true))); } auto ch = audio_channel_types (film()->mapped_audio_channels(), film()->audio_channels()); - auto description = String::compose("%1.%2", ch.first, ch.second); + auto description = dcp::compose("%1.%2", ch.first, ch.second); if (description == "0.0") { description = _("None"); @@ -766,11 +766,11 @@ Writer::write_cover_sheet (boost::filesystem::path output_dcp) auto const hmsf = film()->length().split(film()->video_frame_rate()); string length; if (hmsf.h == 0 && hmsf.m == 0) { - length = String::compose("%1s", hmsf.s); + length = dcp::compose("%1s", hmsf.s); } else if (hmsf.h == 0 && hmsf.m > 0) { - length = String::compose("%1m%2s", hmsf.m, hmsf.s); + length = dcp::compose("%1m%2s", hmsf.m, hmsf.s); } else if (hmsf.h > 0 && hmsf.m > 0) { - length = String::compose("%1h%2m%3s", hmsf.h, hmsf.m, hmsf.s); + length = dcp::compose("%1h%2m%3s", hmsf.h, hmsf.m, hmsf.s); } boost::algorithm::replace_all (text, "$LENGTH", length); diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 24c5bd5ec..99084c8d6 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -74,7 +74,6 @@ #include "lib/update_checker.h" #include "lib/cross.h" #include "lib/content_factory.h" -#include "lib/compose.hpp" #include "lib/dcpomatic_socket.h" #include "lib/hints.h" #include "lib/dcp_content.h" @@ -87,6 +86,7 @@ #include "lib/dcpomatic_log.h" #include "lib/subtitle_encoder.h" #include "lib/warnings.h" +#include <dcp/compose.h> #include <dcp/exceptions.h> #include <dcp/raw_convert.h> DCPOMATIC_DISABLE_WARNINGS @@ -1030,14 +1030,14 @@ private: #ifdef DCPOMATIC_LINUX int r = system ("which nautilus"); if (WEXITSTATUS (r) == 0) { - r = system (String::compose("nautilus \"%1\"", _film->directory()->string()).c_str()); + r = system (dcp::compose("nautilus \"%1\"", _film->directory()->string()).c_str()); if (WEXITSTATUS (r)) { error_dialog (this, _("Could not show DCP."), _("Could not run nautilus")); } } else { int r = system ("which konqueror"); if (WEXITSTATUS (r) == 0) { - r = system (String::compose ("konqueror \"%1\"", _film->directory()->string()).c_str()); + r = system (dcp::compose ("konqueror \"%1\"", _film->directory()->string()).c_str()); if (WEXITSTATUS (r)) { error_dialog (this, _("Could not show DCP"), _("Could not run konqueror")); } @@ -1046,7 +1046,7 @@ private: #endif #ifdef DCPOMATIC_OSX - int r = system (String::compose ("open -R \"%1\"", _film->dir (_film->dcp_name(false)).string()).c_str()); + int r = system (dcp::compose ("open -R \"%1\"", _film->dir (_film->dcp_name(false)).string()).c_str()); if (WEXITSTATUS (r)) { error_dialog (this, _("Could not show DCP")); } @@ -1444,7 +1444,7 @@ private: for (size_t i = 0; i < history.size(); ++i) { string s; if (i < 9) { - s = String::compose ("&%1 %2", i + 1, history[i].string()); + s = dcp::compose ("&%1 %2", i + 1, history[i].string()); } else { s = history[i].string(); } @@ -1638,7 +1638,7 @@ private: try { _frame->load_film (_film_to_load); } catch (exception& e) { - error_dialog (nullptr, std_to_wx(String::compose(wx_to_std(_("Could not load film %1 (%2)")), _film_to_load)), std_to_wx(e.what())); + error_dialog (nullptr, std_to_wx(dcp::compose(wx_to_std(_("Could not load film %1 (%2)")), _film_to_load)), std_to_wx(e.what())); } } diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 061470602..08cd7248b 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -26,7 +26,6 @@ #include "wx/servers_list_dialog.h" #include "wx/wx_signal_manager.h" #include "wx/wx_util.h" -#include "lib/compose.hpp" #include "lib/config.h" #include "lib/dcpomatic_socket.h" #include "lib/film.h" @@ -35,6 +34,7 @@ #include "lib/transcode_job.h" #include "lib/util.h" #include "lib/version.h" +#include <dcp/compose.h> #include <wx/aboutdlg.h> #include <wx/cmdline.h> #include <wx/preferences.h> @@ -454,7 +454,7 @@ class App : public wxApp } catch (exception& e) { error_dialog ( 0, - std_to_wx(String::compose(wx_to_std(_("Could not load film %1")), i.string())), + std_to_wx(dcp::compose(wx_to_std(_("Could not load film %1")), i.string())), std_to_wx(e.what()) ); } diff --git a/src/tools/dcpomatic_combiner.cc b/src/tools/dcpomatic_combiner.cc index 4a783d634..0f6004bd2 100644 --- a/src/tools/dcpomatic_combiner.cc +++ b/src/tools/dcpomatic_combiner.cc @@ -152,7 +152,7 @@ private: if (!confirm_dialog ( this, std_to_wx ( - String::compose(wx_to_std(_("The directory %1 already exists and is not empty. " + dcp::compose(wx_to_std(_("The directory %1 already exists and is not empty. " "Are you sure you want to use it?")), output.string()) ) @@ -162,7 +162,7 @@ private: } else if (is_regular_file(output)) { error_dialog ( this, - String::compose (wx_to_std(_("%1 already exists as a file, so you cannot use it for a DCP.")), output.string()) + dcp::compose (wx_to_std(_("%1 already exists as a file, so you cannot use it for a DCP.")), output.string()) ); return; } diff --git a/src/tools/dcpomatic_disk.cc b/src/tools/dcpomatic_disk.cc index 7e43c0684..563620693 100644 --- a/src/tools/dcpomatic_disk.cc +++ b/src/tools/dcpomatic_disk.cc @@ -202,7 +202,7 @@ private: #ifdef DCPOMATIC_OSX void uninstall() { - system(String::compose("osascript \"%1/uninstall_disk.applescript\"", resources_path().string()).c_str()); + system(dcp::compose("osascript \"%1/uninstall_disk.applescript\"", resources_path().string()).c_str()); } #endif diff --git a/src/tools/dcpomatic_disk_writer.cc b/src/tools/dcpomatic_disk_writer.cc index c638b72eb..ca6618125 100644 --- a/src/tools/dcpomatic_disk_writer.cc +++ b/src/tools/dcpomatic_disk_writer.cc @@ -19,7 +19,6 @@ */ -#include "lib/compose.hpp" #include "lib/cross.h" #include "lib/dcpomatic_log.h" #include "lib/digester.h" @@ -30,6 +29,7 @@ #include "lib/nanomsg.h" #include "lib/version.h" #include "lib/warnings.h" +#include <dcp/compose.h> #ifdef DCPOMATIC_POSIX #include <sys/ioctl.h> diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 4d84f2f33..c83beec74 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -36,7 +36,6 @@ #include "wx/wx_signal_manager.h" #include "wx/wx_util.h" #include "lib/cinema.h" -#include "lib/compose.hpp" #include "lib/config.h" #include "lib/cross.h" #include "lib/dkdm_wrapper.h" @@ -46,6 +45,7 @@ #include "lib/screen.h" #include "lib/send_kdm_email_job.h" #include "lib/util.h" +#include <dcp/compose.h> #include <dcp/encrypted_kdm.h> #include <dcp/decrypted_kdm.h> #include <dcp/exceptions.h> diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 112f2c065..16847911c 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -38,7 +38,6 @@ #include "lib/util.h" #include "lib/internet.h" #include "lib/update_checker.h" -#include "lib/compose.hpp" #include "lib/dcp_content.h" #include "lib/job_manager.h" #include "lib/job.h" @@ -56,6 +55,7 @@ #include "lib/ffmpeg_content.h" #include "lib/dcpomatic_log.h" #include "lib/file_log.h" +#include <dcp/compose.h> #include <dcp/cpl.h> #include <dcp/dcp.h> #include <dcp/raw_convert.h> @@ -694,7 +694,7 @@ private: try { load_dcp (history[n]); } catch (exception& e) { - error_dialog (0, std_to_wx(String::compose(wx_to_std(_("Could not load DCP %1.")), history[n])), std_to_wx(e.what())); + error_dialog (0, std_to_wx(dcp::compose(wx_to_std(_("Could not load DCP %1.")), history[n])), std_to_wx(e.what())); } } } @@ -955,7 +955,7 @@ private: for (size_t i = 0; i < history.size(); ++i) { string s; if (i < 9) { - s = String::compose ("&%1 %2", i + 1, history[i].string()); + s = dcp::compose ("&%1 %2", i + 1, history[i].string()); } else { s = history[i].string(); } @@ -1164,7 +1164,7 @@ private: try { _frame->load_dcp (_dcp_to_load); } catch (exception& e) { - error_dialog (0, std_to_wx (String::compose (wx_to_std (_("Could not load DCP %1.")), _dcp_to_load)), std_to_wx(e.what())); + error_dialog (0, std_to_wx (dcp::compose (wx_to_std (_("Could not load DCP %1.")), _dcp_to_load)), std_to_wx(e.what())); } } diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index 401fb1077..825098e9b 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -241,7 +241,7 @@ public: #else string const colour = gui_is_dark() ? "white" : "black"; wxBitmap bitmap ( - bitmap_path(String::compose("dcpomatic_small_%1", colour)), + bitmap_path(dcp::compose("dcpomatic_small_%1", colour)), wxBITMAP_TYPE_PNG ); wxIcon icon; diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index 73c569282..3a2558f14 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -26,8 +26,8 @@ #include "wx_util.h" #include "static_text.h" #include "lib/version.h" -#include "lib/compose.hpp" #include "lib/warnings.h" +#include <dcp/compose.h> DCPOMATIC_DISABLE_WARNINGS #include <wx/notebook.h> #include <wx/hyperlink.h> @@ -57,9 +57,9 @@ AboutDialog::AboutDialog (wxWindow* parent) wxString s; if (strcmp (dcpomatic_git_commit, "release") == 0) { - t = new StaticText (this, std_to_wx(String::compose("Version %1", dcpomatic_version))); + t = new StaticText (this, std_to_wx(dcp::compose("Version %1", dcpomatic_version))); } else { - t = new StaticText (this, std_to_wx(String::compose("Version %1 git %2", dcpomatic_version, dcpomatic_git_commit))); + t = new StaticText (this, std_to_wx(dcp::compose("Version %1 git %2", dcpomatic_version, dcpomatic_git_commit))); } t->SetFont (version_font); sizer->Add (t, wxSizerFlags().Centre().Border(wxALL, 2)); diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc index 90a4aa91d..cfb08eb54 100644 --- a/src/wx/audio_plot.cc +++ b/src/wx/audio_plot.cc @@ -24,7 +24,7 @@ #include "film_viewer.h" #include "lib/audio_decoder.h" #include "lib/audio_analysis.h" -#include "lib/compose.hpp" +#include <dcp/compose.h> #include <wx/graphics.h> #include <boost/bind/bind.hpp> #include <iostream> @@ -190,7 +190,7 @@ AudioPlot::paint () int const y = (metrics.height - (i - _minimum) * metrics.y_scale) - metrics.y_origin; h_grid.MoveToPoint (metrics.db_label_width - 4, y); h_grid.AddLineToPoint (metrics.db_label_width + data_width, y); - gc->DrawText (std_to_wx (String::compose ("%1dB", i)), 0, y - (db_label_height / 2)); + gc->DrawText (std_to_wx (dcp::compose ("%1dB", i)), 0, y - (db_label_height / 2)); } gc->SetPen (wxPen (wxColour (200, 200, 200))); diff --git a/src/wx/barco_alchemy_certificate_panel.cc b/src/wx/barco_alchemy_certificate_panel.cc index a1d6167aa..25ec3511c 100644 --- a/src/wx/barco_alchemy_certificate_panel.cc +++ b/src/wx/barco_alchemy_certificate_panel.cc @@ -22,8 +22,8 @@ #include "download_certificate_dialog.h" #include "wx_util.h" #include "lib/internet.h" -#include "lib/compose.hpp" #include "lib/config.h" +#include <dcp/compose.h> using std::string; using boost::optional; @@ -55,7 +55,7 @@ void BarcoAlchemyCertificatePanel::do_download () { string const serial = wx_to_std (_serial->GetValue()); - string const url = String::compose ( + string const url = dcp::compose ( "ftp://%1:%2@certificates.barco.com/%3xxx/%4/Barco-ICMP.%5_cert.pem", Config::instance()->barco_username().get(), Config::instance()->barco_password().get(), diff --git a/src/wx/christie_certificate_panel.cc b/src/wx/christie_certificate_panel.cc index ab131e015..77a067fb5 100644 --- a/src/wx/christie_certificate_panel.cc +++ b/src/wx/christie_certificate_panel.cc @@ -22,8 +22,8 @@ #include "download_certificate_dialog.h" #include "wx_util.h" #include "lib/internet.h" -#include "lib/compose.hpp" #include "lib/config.h" +#include <dcp/compose.h> using std::string; using boost::optional; @@ -50,7 +50,7 @@ ChristieCertificatePanel::ChristieCertificatePanel (DownloadCertificateDialog* d void ChristieCertificatePanel::do_download () { - string const prefix = String::compose( + string const prefix = dcp::compose( "ftp://%1:%2@certificates.christiedigital.com/Certificates/", Config::instance()->christie_username().get(), Config::instance()->christie_password().get() @@ -59,7 +59,7 @@ ChristieCertificatePanel::do_download () string serial = wx_to_std (_serial->GetValue()); serial.insert (0, 12 - serial.length(), '0'); - string const url = String::compose ("%1F-IMB/F-IMB_%2_sha256.pem", prefix, serial); + string const url = dcp::compose ("%1F-IMB/F-IMB_%2_sha256.pem", prefix, serial); optional<string> all_errors; bool ok = true; @@ -68,7 +68,7 @@ ChristieCertificatePanel::do_download () if (error) { all_errors = *error; - string const url = String::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial); + string const url = dcp::compose ("%1IMB-S2/IMB-S2_%2_sha256.pem", prefix, serial); error = get_from_url (url, true, false, boost::bind(&DownloadCertificatePanel::load_certificate_from_chain, this, _1)); if (error) { diff --git a/src/wx/closed_captions_dialog.cc b/src/wx/closed_captions_dialog.cc index 7fcfc0808..73ad98a26 100644 --- a/src/wx/closed_captions_dialog.cc +++ b/src/wx/closed_captions_dialog.cc @@ -24,7 +24,7 @@ #include "lib/string_text.h" #include "lib/butler.h" #include "lib/text_content.h" -#include "lib/compose.hpp" +#include <dcp/compose.h> #include <boost/bind/bind.hpp> using std::list; @@ -249,7 +249,7 @@ ClosedCaptionsDialog::update_tracks (shared_ptr<const Film> film) _track->Clear (); for (auto const& i: _tracks) { - _track->Append (std_to_wx(String::compose("%1 (%2)", i.name, i.language ? i.language->to_string() : wx_to_std(_("Unknown"))))); + _track->Append (std_to_wx(dcp::compose("%1 (%2)", i.name, i.language ? i.language->to_string() : wx_to_std(_("Unknown"))))); } if (_track->GetCount() > 0) { diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index bcc699913..5c2b19f61 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -31,7 +31,6 @@ #include "wx_util.h" #include "lib/audio_content.h" #include "lib/case_insensitive_sorter.h" -#include "lib/compose.hpp" #include "lib/config.h" #include "lib/content_factory.h" #include "lib/cross.h" @@ -45,6 +44,7 @@ #include "lib/string_text_file_content.h" #include "lib/text_content.h" #include "lib/video_content.h" +#include <dcp/compose.h> #include <wx/wx.h> #include <wx/notebook.h> #include <wx/listctrl.h> diff --git a/src/wx/content_sub_panel.cc b/src/wx/content_sub_panel.cc index 9c236abeb..a43a5fc94 100644 --- a/src/wx/content_sub_panel.cc +++ b/src/wx/content_sub_panel.cc @@ -22,8 +22,8 @@ #include "content_panel.h" #include "wx_util.h" #include "lib/dcp_content.h" -#include "lib/compose.hpp" #include "lib/log.h" +#include <dcp/compose.h> #include <wx/notebook.h> using std::list; diff --git a/src/wx/dolby_doremi_certificate_panel.cc b/src/wx/dolby_doremi_certificate_panel.cc index 817867cc1..6049a6818 100644 --- a/src/wx/dolby_doremi_certificate_panel.cc +++ b/src/wx/dolby_doremi_certificate_panel.cc @@ -22,10 +22,10 @@ #include "dolby_doremi_certificate_panel.h" #include "download_certificate_dialog.h" #include "wx_util.h" -#include "lib/compose.hpp" #include "lib/internet.h" #include "lib/signal_manager.h" #include "lib/util.h" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <curl/curl.h> #include <zip.h> @@ -53,30 +53,30 @@ DolbyDoremiCertificatePanel::DolbyDoremiCertificatePanel (DownloadCertificateDia static void try_dcp2000 (list<string>& urls, list<string>& files, string prefix, string serial) { - urls.push_back (String::compose("%1%2xxx/dcp2000-%3.dcicerts.zip", prefix, serial.substr(0, 3), serial)); - files.push_back (String::compose("dcp2000-%1.cert.sha256.pem", serial)); + urls.push_back (dcp::compose("%1%2xxx/dcp2000-%3.dcicerts.zip", prefix, serial.substr(0, 3), serial)); + files.push_back (dcp::compose("dcp2000-%1.cert.sha256.pem", serial)); - urls.push_back (String::compose("%1%2xxx/dcp2000-%3.dcicerts.zip", prefix, serial.substr(0, 3), serial)); - files.push_back (String::compose("dcp2000-%1.cert.sha256.pem", serial)); + urls.push_back (dcp::compose("%1%2xxx/dcp2000-%3.dcicerts.zip", prefix, serial.substr(0, 3), serial)); + files.push_back (dcp::compose("dcp2000-%1.cert.sha256.pem", serial)); - urls.push_back (String::compose("%1%2xxx/dcp2000-%3.certs.zip", prefix, serial.substr(0, 3), serial)); - files.push_back (String::compose("dcp2000-%1.cert.sha256.pem", serial)); + urls.push_back (dcp::compose("%1%2xxx/dcp2000-%3.certs.zip", prefix, serial.substr(0, 3), serial)); + files.push_back (dcp::compose("dcp2000-%1.cert.sha256.pem", serial)); } static void try_imb (list<string>& urls, list<string>& files, string prefix, string serial) { - urls.push_back (String::compose("%1%2xxx/imb-%3.dcicerts.zip", prefix, serial.substr(0, 3), serial)); - files.push_back (String::compose("imb-%1.cert.sha256.pem", serial)); + urls.push_back (dcp::compose("%1%2xxx/imb-%3.dcicerts.zip", prefix, serial.substr(0, 3), serial)); + files.push_back (dcp::compose("imb-%1.cert.sha256.pem", serial)); } static void try_ims (list<string>& urls, list<string>& files, string prefix, string serial) { - urls.push_back (String::compose("%1%2xxx/ims-%3.dcicerts.zip", prefix, serial.substr(0, 3), serial)); - files.push_back (String::compose("ims-%1.cert.sha256.pem", serial)); + urls.push_back (dcp::compose("%1%2xxx/ims-%3.dcicerts.zip", prefix, serial.substr(0, 3), serial)); + files.push_back (dcp::compose("ims-%1.cert.sha256.pem", serial)); } @@ -92,11 +92,11 @@ try_cat862 (list<string>& urls, list<string>& files, string prefix, string seria cat862 = "CAT862_617000_and_higher"; } else { int const lower = serial_int - (serial_int % 1000); - cat862 = String::compose ("CAT862_%1-%2", lower, lower + 999); + cat862 = dcp::compose ("CAT862_%1-%2", lower, lower + 999); } - urls.push_back (String::compose("%1%2/cert_Dolby256-CAT862-%3.zip", prefix, cat862, serial_int)); - files.push_back (String::compose("cert_Dolby256-CAT862-%1.pem.crt", serial_int)); + urls.push_back (dcp::compose("%1%2/cert_Dolby256-CAT862-%3.zip", prefix, cat862, serial_int)); + files.push_back (dcp::compose("cert_Dolby256-CAT862-%1.pem.crt", serial_int)); } @@ -112,11 +112,11 @@ try_dsp100 (list<string>& urls, list<string>& files, string prefix, string seria dsp100 = "DSP100_3000_and_higher"; } else { int const lower = serial_int - (serial_int % 1000); - dsp100 = String::compose ("DSP100_%1_thru_%2", lower, lower + 999); + dsp100 = dcp::compose ("DSP100_%1_thru_%2", lower, lower + 999); } - urls.push_back (String::compose("%1%2/cert_Dolby256-DSP100-%3.zip", prefix, dsp100, serial_int)); - files.push_back (String::compose("cert_Dolby256-DSP100-%1.pem.crt", serial_int)); + urls.push_back (dcp::compose("%1%2/cert_Dolby256-DSP100-%3.zip", prefix, dsp100, serial_int)); + files.push_back (dcp::compose("cert_Dolby256-DSP100-%1.pem.crt", serial_int)); } @@ -132,11 +132,11 @@ try_cat745 (list<string>& urls, list<string>& files, string prefix, string seria cat745 = "CAT745_6000_and_higher"; } else { int const lower = serial_int - (serial_int % 1000); - cat745 = String::compose("CAT745_%1_thru_%2", lower, lower + 999); + cat745 = dcp::compose("CAT745_%1_thru_%2", lower, lower + 999); } - urls.push_back (String::compose("%1%2/cert_Dolby-CAT745-%3.zip", prefix, cat745, serial_int)); - files.push_back (String::compose("cert_Dolby-CAT745-%1.pem.crt", serial_int)); + urls.push_back (dcp::compose("%1%2/cert_Dolby-CAT745-%3.zip", prefix, cat745, serial_int)); + files.push_back (dcp::compose("cert_Dolby-CAT745-%1.pem.crt", serial_int)); } @@ -146,16 +146,16 @@ try_cp850 (list<string>& urls, list<string>& files, string prefix, string serial int const serial_int = raw_convert<int> (serial.substr (1)); int const lower = serial_int - (serial_int % 1000); - urls.push_back (String::compose ("%1CP850_CAT1600_F%2-F%3/cert_RMB_SPB_MDE_FMA.Dolby-CP850-F%4.zip", prefix, lower, lower + 999, serial_int)); - files.push_back (String::compose ("cert_RMB_SPB_MDE_FMA.Dolby-CP850-F%1.pem.crt", serial_int)); + urls.push_back (dcp::compose ("%1CP850_CAT1600_F%2-F%3/cert_RMB_SPB_MDE_FMA.Dolby-CP850-F%4.zip", prefix, lower, lower + 999, serial_int)); + files.push_back (dcp::compose ("cert_RMB_SPB_MDE_FMA.Dolby-CP850-F%1.pem.crt", serial_int)); } static void try_ims3000 (list<string>& urls, list<string>& files, string prefix, string serial) { - urls.push_back (String::compose ("%1%2xxx/cert_Dolby-IMS3000-%3-SMPTE.zip", prefix, serial.substr(0, 3), serial)); - files.push_back (String::compose("cert_Dolby-IMS3000-%1-SMPTE.pem", serial)); + urls.push_back (dcp::compose ("%1%2xxx/cert_Dolby-IMS3000-%3-SMPTE.zip", prefix, serial.substr(0, 3), serial)); + files.push_back (dcp::compose("cert_Dolby-IMS3000-%1-SMPTE.pem", serial)); } diff --git a/src/wx/download_certificate_panel.cc b/src/wx/download_certificate_panel.cc index c30b05008..b4bdd1ce4 100644 --- a/src/wx/download_certificate_panel.cc +++ b/src/wx/download_certificate_panel.cc @@ -22,9 +22,9 @@ #include "download_certificate_dialog.h" #include "download_certificate_panel.h" #include "wx_util.h" -#include "lib/compose.hpp" #include "lib/signal_manager.h" #include <dcp/certificate_chain.h> +#include <dcp/compose.h> #include <dcp/exceptions.h> #include <dcp/util.h> #include <boost/bind/bind.hpp> @@ -63,7 +63,7 @@ DownloadCertificatePanel::load_certificate (boost::filesystem::path file) try { _certificate = dcp::Certificate (dcp::file_to_string(file)); } catch (dcp::MiscError& e) { - return String::compose(wx_to_std(_("Could not read certificate file (%1)")), e.what()); + return dcp::compose(wx_to_std(_("Could not read certificate file (%1)")), e.what()); } return {}; } @@ -75,7 +75,7 @@ DownloadCertificatePanel::load_certificate_from_chain (boost::filesystem::path f try { _certificate = dcp::CertificateChain (dcp::file_to_string(file)).leaf(); } catch (dcp::MiscError& e) { - return String::compose(wx_to_std(_("Could not read certificate file (%1)")), e.what()); + return dcp::compose(wx_to_std(_("Could not read certificate file (%1)")), e.what()); } return {}; } diff --git a/src/wx/film_name_location_dialog.cc b/src/wx/film_name_location_dialog.cc index 516ed86ae..55e5a534d 100644 --- a/src/wx/film_name_location_dialog.cc +++ b/src/wx/film_name_location_dialog.cc @@ -26,7 +26,7 @@ #include "dir_picker_ctrl.h" #endif #include "lib/config.h" -#include "lib/compose.hpp" +#include <dcp/compose.h> #include <wx/stdpaths.h> #include <boost/filesystem.hpp> @@ -139,7 +139,7 @@ FilmNameLocationDialog::check_path () if (!confirm_dialog ( this, std_to_wx ( - String::compose(wx_to_std(_("The directory %1 already exists and is not empty. " + dcp::compose(wx_to_std(_("The directory %1 already exists and is not empty. " "Are you sure you want to use it?")), path().string().c_str()) ) @@ -149,7 +149,7 @@ FilmNameLocationDialog::check_path () } else if (boost::filesystem::is_regular_file(path())) { error_dialog ( this, - String::compose (wx_to_std(_("%1 already exists as a file, so you cannot use it for a film.")), path().c_str()) + dcp::compose (wx_to_std(_("%1 already exists as a file, so you cannot use it for a film.")), path().c_str()) ); return false; } diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 4ea2a8b00..031c00154 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -48,12 +48,12 @@ #include "lib/butler.h" #include "lib/log.h" #include "lib/config.h" -#include "lib/compose.hpp" #include "lib/dcpomatic_log.h" #include "lib/text_content.h" extern "C" { #include <libavutil/pixfmt.h> } +#include <dcp/compose.h> #include <dcp/exceptions.h> #include <wx/tglbtn.h> #include <iostream> diff --git a/src/wx/gdc_certificate_panel.cc b/src/wx/gdc_certificate_panel.cc index f7f86895d..555c1b232 100644 --- a/src/wx/gdc_certificate_panel.cc +++ b/src/wx/gdc_certificate_panel.cc @@ -22,8 +22,8 @@ #include "download_certificate_dialog.h" #include "wx_util.h" #include "lib/internet.h" -#include "lib/compose.hpp" #include "lib/config.h" +#include <dcp/compose.h> using std::string; using boost::optional; @@ -54,7 +54,7 @@ GDCCertificatePanel::do_download () /* We're adding the A ourselves */ serial = serial.substr(1); } - string const url = String::compose( + string const url = dcp::compose( "ftp://%1:%2@ftp.gdc-tech.com/SHA256/A%3.crt.pem", Config::instance()->gdc_username().get(), Config::instance()->gdc_password().get(), diff --git a/src/wx/job_manager_view.cc b/src/wx/job_manager_view.cc index 19243393c..e49227ef1 100644 --- a/src/wx/job_manager_view.cc +++ b/src/wx/job_manager_view.cc @@ -33,7 +33,7 @@ #include "lib/job.h" #include "lib/util.h" #include "lib/exceptions.h" -#include "lib/compose.hpp" +#include <dcp/compose.h> #include <iostream> diff --git a/src/wx/job_view.cc b/src/wx/job_view.cc index 231176e4f..cb1a9fcdd 100644 --- a/src/wx/job_view.cc +++ b/src/wx/job_view.cc @@ -27,11 +27,11 @@ #include "dcpomatic_button.h" #include "lib/job.h" #include "lib/job_manager.h" -#include "lib/compose.hpp" #include "lib/config.h" #include "lib/send_notification_email_job.h" #include "lib/transcode_job.h" #include "lib/analyse_audio_job.h" +#include <dcp/compose.h> #include <wx/wx.h> #include <boost/algorithm/string.hpp> diff --git a/src/wx/name_format_editor.cc b/src/wx/name_format_editor.cc index b2c11b50c..969cd6076 100644 --- a/src/wx/name_format_editor.cc +++ b/src/wx/name_format_editor.cc @@ -44,7 +44,7 @@ NameFormatEditor::NameFormatEditor (wxWindow* parent, dcp::NameFormat name, dcp: _panel->SetSizer (_sizer); for (auto const& i: titles) { - auto t = new StaticText (_panel, std_to_wx (String::compose ("%%%1 %2", i.first, i.second))); + auto t = new StaticText (_panel, std_to_wx (dcp::compose ("%%%1 %2", i.first, i.second))); _sizer->Add (t); auto font = t->GetFont(); font.SetStyle (wxFONTSTYLE_ITALIC); diff --git a/src/wx/name_format_editor.h b/src/wx/name_format_editor.h index 596b42740..972f32655 100644 --- a/src/wx/name_format_editor.h +++ b/src/wx/name_format_editor.h @@ -23,8 +23,8 @@ #define DCPOMATIC_NAME_FORMAT_EDITOR_H -#include "lib/compose.hpp" #include "lib/warnings.h" +#include <dcp/compose.h> #include <dcp/name_format.h> DCPOMATIC_DISABLE_WARNINGS #include <wx/wx.h> diff --git a/src/wx/player_information.cc b/src/wx/player_information.cc index f0eaa59bb..ae5ebe617 100644 --- a/src/wx/player_information.cc +++ b/src/wx/player_information.cc @@ -22,11 +22,11 @@ #include "wx_util.h" #include "film_viewer.h" #include "lib/playlist.h" -#include "lib/compose.hpp" #include "lib/video_content.h" #include "lib/audio_content.h" #include "lib/dcp_content.h" #include "lib/film.h" +#include <dcp/compose.h> using std::cout; using std::string; @@ -157,7 +157,7 @@ PlayerInformation::triggered_update () vfr = dcp->video_frame_rate (); DCPOMATIC_ASSERT (vfr); - string const len = String::compose( + string const len = dcp::compose( wx_to_std(_("Length: %1 (%2 frames)")), time_to_hmsf(dcp->full_length(fv->film()), lrint(*vfr)), dcp->full_length(fv->film()).frames_round(*vfr) diff --git a/src/wx/playlist_controls.cc b/src/wx/playlist_controls.cc index d65cb0fcc..b935b0ba2 100644 --- a/src/wx/playlist_controls.cc +++ b/src/wx/playlist_controls.cc @@ -30,7 +30,7 @@ #include "lib/scoped_temporary.h" #include "lib/internet.h" #include "lib/ffmpeg_content.h" -#include "lib/compose.hpp" +#include <dcp/compose.h> #include <dcp/raw_convert.h> #include <dcp/exceptions.h> #include <wx/listctrl.h> diff --git a/src/wx/qube_certificate_panel.cc b/src/wx/qube_certificate_panel.cc index e1c6bfb41..403fff695 100644 --- a/src/wx/qube_certificate_panel.cc +++ b/src/wx/qube_certificate_panel.cc @@ -23,8 +23,8 @@ #include "download_certificate_dialog.h" #include "wx_util.h" #include "lib/internet.h" -#include "lib/compose.hpp" #include "lib/config.h" +#include <dcp/compose.h> #include <boost/algorithm/string/predicate.hpp> @@ -50,7 +50,7 @@ QubeCertificatePanel::QubeCertificatePanel (DownloadCertificateDialog* dialog, s void QubeCertificatePanel::do_download () { - auto files = ls_url(String::compose("%1SMPTE-%2/", base, _type)); + auto files = ls_url(dcp::compose("%1SMPTE-%2/", base, _type)); if (files.empty()) { error_dialog (this, _("Could not read certificates from Qube server.")); return; @@ -59,7 +59,7 @@ QubeCertificatePanel::do_download () auto const serial = wx_to_std(_serial->GetValue()); optional<string> name; for (auto i: files) { - if (boost::algorithm::starts_with(i, String::compose("%1-%2-", _type, serial))) { + if (boost::algorithm::starts_with(i, dcp::compose("%1-%2-", _type, serial))) { name = i; break; } @@ -71,7 +71,7 @@ QubeCertificatePanel::do_download () return; } - auto error = get_from_url (String::compose("%1SMPTE-%2/%3", base, _type, *name), true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1)); + auto error = get_from_url (dcp::compose("%1SMPTE-%2/%3", base, _type, *name), true, false, boost::bind(&DownloadCertificatePanel::load_certificate, this, _1)); if (error) { _dialog->message()->SetLabel(wxT("")); diff --git a/src/wx/recipient_dialog.cc b/src/wx/recipient_dialog.cc index d59226a96..b6638edd8 100644 --- a/src/wx/recipient_dialog.cc +++ b/src/wx/recipient_dialog.cc @@ -25,8 +25,8 @@ #include "download_certificate_dialog.h" #include "table_dialog.h" #include "dcpomatic_button.h" -#include "lib/compose.hpp" #include "lib/util.h" +#include <dcp/compose.h> #include <dcp/exceptions.h> #include <dcp/certificate_chain.h> #include "lib/warnings.h" diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc index 8da8f061e..e438ca87e 100644 --- a/src/wx/screen_dialog.cc +++ b/src/wx/screen_dialog.cc @@ -26,9 +26,9 @@ #include "static_text.h" #include "table_dialog.h" #include "wx_util.h" -#include "lib/compose.hpp" #include "lib/util.h" #include "lib/warnings.h" +#include <dcp/compose.h> #include <dcp/exceptions.h> #include <dcp/certificate_chain.h> DCPOMATIC_DISABLE_WARNINGS diff --git a/src/wx/timeline_dialog.cc b/src/wx/timeline_dialog.cc index 975f7cd9d..8f4ea0cea 100644 --- a/src/wx/timeline_dialog.cc +++ b/src/wx/timeline_dialog.cc @@ -23,9 +23,9 @@ #include "film_editor.h" #include "timeline_dialog.h" #include "wx_util.h" -#include "lib/compose.hpp" #include "lib/cross.h" #include "lib/playlist.h" +#include <dcp/compose.h> #include <wx/graphics.h> #include <iostream> #include <list> diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index a0beb8f72..b0ed81cc4 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -646,7 +646,7 @@ bitmap_path (string name) base = resources_path(); #endif - auto p = base / String::compose("%1.png", name); + auto p = base / dcp::compose("%1.png", name); return std_to_wx (p.string()); } diff --git a/test/cpl_hash_test.cc b/test/cpl_hash_test.cc index f34c29583..0e57d54e4 100644 --- a/test/cpl_hash_test.cc +++ b/test/cpl_hash_test.cc @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test) make_and_verify_dcp (ov); /* Remove <Hash> tags from the CPL */ - for (auto i: directory_iterator(String::compose("build/test/%1/%2", ov_name, ov->dcp_name()))) { + for (auto i: directory_iterator(dcp::compose("build/test/%1/%2", ov_name, ov->dcp_name()))) { if (boost::algorithm::starts_with(i.path().filename().string(), "cpl_")) { auto in = fopen_boost(i.path(), "r"); BOOST_REQUIRE (in); @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test) } string const vf_name = "hash_added_to_imported_dcp_test_vf"; - auto ov_content = make_shared<DCPContent>(String::compose("build/test/%1/%2", ov_name, ov->dcp_name())); + auto ov_content = make_shared<DCPContent>(dcp::compose("build/test/%1/%2", ov_name, ov->dcp_name())); auto vf = new_test_film2 ( vf_name, { ov_content } ); @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE (hash_added_to_imported_dcp_test) /* Check for Hash tags in the VF DCP */ int hashes = 0; - for (auto i: directory_iterator(String::compose("build/test/%1/%2", vf_name, vf->dcp_name()))) { + for (auto i: directory_iterator(dcp::compose("build/test/%1/%2", vf_name, vf->dcp_name()))) { if (boost::algorithm::starts_with(i.path().filename().string(), "cpl_")) { auto in = fopen_boost(i.path(), "r"); BOOST_REQUIRE (in); diff --git a/test/digest_test.cc b/test/digest_test.cc index 59a8cb7a7..0a155d8ba 100644 --- a/test/digest_test.cc +++ b/test/digest_test.cc @@ -28,9 +28,9 @@ #include "lib/film.h" #include "lib/image_content.h" #include "lib/dcp_content_type.h" -#include "lib/compose.hpp" #include "lib/config.h" #include "test.h" +#include <dcp/compose.h> #include <dcp/cpl.h> #include <dcp/reel.h> #include <dcp/reel_picture_asset.h> @@ -46,7 +46,7 @@ using std::make_shared; static string openssl_hash (boost::filesystem::path file) { - auto pipe = popen (String::compose ("openssl sha1 -binary %1 | openssl base64 -e", file.string()).c_str (), "r"); + auto pipe = popen (dcp::compose ("openssl sha1 -binary %1 | openssl base64 -e", file.string()).c_str (), "r"); BOOST_REQUIRE (pipe); char buffer[128]; string output; diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc index d0bce0356..62c55e682 100644 --- a/test/ffmpeg_encoder_test.cc +++ b/test/ffmpeg_encoder_test.cc @@ -20,7 +20,6 @@ #include "lib/audio_content.h" -#include "lib/compose.hpp" #include "lib/content_factory.h" #include "lib/dcp_content.h" #include "lib/ffmpeg_content.h" @@ -34,6 +33,7 @@ #include "lib/transcode_job.h" #include "lib/video_content.h" #include "test.h" +#include <dcp/compose.h> #include <boost/test/unit_test.hpp> @@ -65,7 +65,7 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f BOOST_REQUIRE (false); } - name = String::compose("%1_test%2", name, number); + name = dcp::compose("%1_test%2", name, number); auto c = make_shared<FFmpegContent>(content); shared_ptr<Film> film = new_test_film2 (name, {c}, &cl); @@ -74,7 +74,7 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f film->write_metadata (); auto job = make_shared<TranscodeJob>(film); - auto file = boost::filesystem::path("build") / "test" / String::compose("%1.%2", name, extension); + auto file = boost::filesystem::path("build") / "test" / dcp::compose("%1.%2", name, extension); cl.add (file); FFmpegEncoder encoder (film, job, file, format, false, false, false, 23); encoder.go (); diff --git a/test/hints_test.cc b/test/hints_test.cc index 263f02435..827427222 100644 --- a/test/hints_test.cc +++ b/test/hints_test.cc @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE (hint_closed_caption_too_long) check ( TextType::CLOSED_CAPTION, "hint_closed_caption_too_long", - String::compose("At least one of your closed caption lines has more than %1 characters. It is advisable to make each line %1 characters at most in length.", MAX_CLOSED_CAPTION_LENGTH, MAX_CLOSED_CAPTION_LENGTH) + dcp::compose("At least one of your closed caption lines has more than %1 characters. It is advisable to make each line %1 characters at most in length.", MAX_CLOSED_CAPTION_LENGTH, MAX_CLOSED_CAPTION_LENGTH) ); } @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE (hint_many_closed_caption_lines) check ( TextType::CLOSED_CAPTION, "hint_many_closed_caption_lines", - String::compose("Some of your closed captions span more than %1 lines, so they will be truncated.", MAX_CLOSED_CAPTION_LINES) + dcp::compose("Some of your closed captions span more than %1 lines, so they will be truncated.", MAX_CLOSED_CAPTION_LINES) ); } @@ -174,7 +174,7 @@ BOOST_AUTO_TEST_CASE (hint_subtitle_mxf_too_big) content->text.front()->set_type (TextType::OPEN_SUBTITLE); content->text.front()->set_language (dcp::LanguageTag("en-US")); for (int i = 1; i < 512; ++i) { - auto font = make_shared<dcpomatic::Font>(String::compose("font_%1", i)); + auto font = make_shared<dcpomatic::Font>(dcp::compose("font_%1", i)); font->set_file ("test/data/LiberationSans-Regular.ttf"); content->text.front()->add_font(font); } @@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE (hint_closed_caption_xml_too_big) auto film = new_test_film2 (name); - auto ccap = fopen_boost (String::compose("build/test/%1.srt", name), "w"); + auto ccap = fopen_boost (dcp::compose("build/test/%1.srt", name), "w"); BOOST_REQUIRE (ccap); for (int i = 0; i < 2048; ++i) { fprintf(ccap, "%d\n", i + 1); diff --git a/test/image_filename_sorter_test.cc b/test/image_filename_sorter_test.cc index eb662a120..b6d5a731a 100644 --- a/test/image_filename_sorter_test.cc +++ b/test/image_filename_sorter_test.cc @@ -26,7 +26,7 @@ #include "lib/image_filename_sorter.h" -#include "lib/compose.hpp" +#include <dcp/compose.h> #include <boost/test/unit_test.hpp> @@ -67,11 +67,11 @@ BOOST_AUTO_TEST_CASE (image_filename_sorter_test2) { vector<boost::filesystem::path> paths; for (int i = 0; i < 100000; ++i) { - paths.push_back(String::compose("some.filename.with.%1.number.tiff", i)); + paths.push_back(dcp::compose("some.filename.with.%1.number.tiff", i)); } random_shuffle (paths.begin(), paths.end()); sort (paths.begin(), paths.end(), ImageFilenameSorter()); for (int i = 0; i < 100000; ++i) { - BOOST_CHECK_EQUAL(paths[i].string(), String::compose("some.filename.with.%1.number.tiff", i)); + BOOST_CHECK_EQUAL(paths[i].string(), dcp::compose("some.filename.with.%1.number.tiff", i)); } } diff --git a/test/image_test.cc b/test/image_test.cc index 3993b3efb..c461a93d3 100644 --- a/test/image_test.cc +++ b/test/image_test.cc @@ -26,12 +26,12 @@ */ -#include "lib/compose.hpp" #include "lib/image.h" #include "lib/image_content.h" #include "lib/image_decoder.h" #include "lib/ffmpeg_image_proxy.h" #include "test.h" +#include <dcp/compose.h> #include <boost/test/unit_test.hpp> #include <iostream> @@ -364,7 +364,7 @@ BOOST_AUTO_TEST_CASE (crop_scale_window_test7) true, false ); - path file = String::compose("crop_scale_window_test7-%1.png", left_crop); + path file = dcp::compose("crop_scale_window_test7-%1.png", left_crop); write_image(cropped, path("build") / "test" / file); check_image(path("test") / "data" / file, path("build") / "test" / file, 10); } diff --git a/test/kdm_naming_test.cc b/test/kdm_naming_test.cc index f692c165d..a78d0a12d 100644 --- a/test/kdm_naming_test.cc +++ b/test/kdm_naming_test.cc @@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE (single_kdm_naming_test) auto until_time = until.time_of_day (true, false); boost::algorithm::replace_all (until_time, ":", "-"); - auto const ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + auto const ref = dcp::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); BOOST_CHECK_MESSAGE (boost::filesystem::exists("build/test/single_kdm_naming_test/" + ref), "File " << ref << " not found"); } @@ -195,36 +195,36 @@ BOOST_AUTO_TEST_CASE (directory_kdm_naming_test, * boost::unit_test::depends_on( path const base = "build/test/directory_kdm_naming_test"; - path dir_a = String::compose("Cinema_A_-_%s_-_my_great_film_-_%1_%2_-_%3_%4", from.date(), from_time, until.date(), until_time); + path dir_a = dcp::compose("Cinema_A_-_%s_-_my_great_film_-_%1_%2_-_%3_%4", from.date(), from_time, until.date(), until_time); BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_a), "Directory " << dir_a << " not found"); - path dir_b = String::compose("Cinema_B_-_%s_-_my_great_film_-_%1_%2_-_%3_%4", from.date(), from_time, until.date(), until_time); + path dir_b = dcp::compose("Cinema_B_-_%s_-_my_great_film_-_%1_%2_-_%3_%4", from.date(), from_time, until.date(), until_time); BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_b), "Directory " << dir_b << " not found"); #ifdef DCPOMATIC_WINDOWS - path ref = String::compose("KDM_Cinema_A_-_Screen_2_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + path ref = dcp::compose("KDM_Cinema_A_-_Screen_2_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); #else - path ref = String::compose("KDM_Cinema_A_-_Screen_2_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); + path ref = dcp::compose("KDM_Cinema_A_-_Screen_2_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); #endif BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_a / ref), "File " << ref << " not found"); #ifdef DCPOMATIC_WINDOWS - ref = String::compose("KDM_Cinema_B_-_Screen_X_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + ref = dcp::compose("KDM_Cinema_B_-_Screen_X_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); #else - ref = String::compose("KDM_Cinema_B_-_Screen_X_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); + ref = dcp::compose("KDM_Cinema_B_-_Screen_X_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); #endif BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_b / ref), "File " << ref << " not found"); #ifdef DCPOMATIC_WINDOWS - ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + ref = dcp::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); #else - ref = String::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); + ref = dcp::compose("KDM_Cinema_A_-_Screen_1_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); #endif BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_a / ref), "File " << ref << " not found"); #ifdef DCPOMATIC_WINDOWS - ref = String::compose("KDM_Cinema_B_-_Screen_Z_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); + ref = dcp::compose("KDM_Cinema_B_-_Screen_Z_-_my_great_film_-_%1_%2_-_%3_%4.xml", from.date(), from_time, until.date(), until_time); #else - ref = String::compose("KDM_Cinema_B_-_Screen_Z_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); + ref = dcp::compose("KDM_Cinema_B_-_Screen_Z_-_my_great_film_-_%1_%2_-_%3_%4_-_%5.xml", from.date(), from_time, until.date(), until_time, cpl_id); #endif BOOST_CHECK_MESSAGE (boost::filesystem::exists(base / dir_b / ref), "File " << ref << " not found"); } diff --git a/test/markers_test.cc b/test/markers_test.cc index 844f25660..a2d581423 100644 --- a/test/markers_test.cc +++ b/test/markers_test.cc @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE (automatic_ffoc_lfoc_markers_test1) film->set_interop (false); make_and_verify_dcp (film); - dcp::DCP dcp (String::compose("build/test/%1/%2", name, film->dcp_name())); + dcp::DCP dcp (dcp::compose("build/test/%1/%2", name, film->dcp_name())); dcp.read (); BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U); auto cpl = dcp.cpls().front(); @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE (automatic_ffoc_lfoc_markers_test2) dcp::VerificationNote::Code::INCORRECT_LFOC }); - dcp::DCP dcp (String::compose("build/test/%1/%2", name, film->dcp_name())); + dcp::DCP dcp (dcp::compose("build/test/%1/%2", name, film->dcp_name())); dcp.read (); BOOST_REQUIRE_EQUAL (dcp.cpls().size(), 1U); auto cpl = dcp.cpls().front(); diff --git a/test/player_test.cc b/test/player_test.cc index c325537fa..08fa5eb18 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -38,9 +38,9 @@ #include "lib/dcp_content.h" #include "lib/text_content.h" #include "lib/butler.h" -#include "lib/compose.hpp" #include "lib/cross.h" #include "test.h" +#include <dcp/compose.h> #include <boost/test/unit_test.hpp> #include <boost/algorithm/string.hpp> #include <iostream> @@ -242,12 +242,12 @@ BOOST_AUTO_TEST_CASE (player_seek_test) butler->seek (t, true); auto video = butler->get_video(true, 0); BOOST_CHECK_EQUAL(video.second.get(), t.get()); - write_image(video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true), String::compose("build/test/player_seek_test_%1.png", i)); + write_image(video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true), dcp::compose("build/test/player_seek_test_%1.png", i)); /* This 14.08 is empirically chosen (hopefully) to accept changes in rendering between the reference and a test machine (17.10 and 16.04 seem to anti-alias a little differently) but to reject gross errors e.g. missing fonts or missing text altogether. */ - check_image(TestPaths::private_data() / String::compose("player_seek_test_%1.png", i), String::compose("build/test/player_seek_test_%1.png", i), 14.08); + check_image(TestPaths::private_data() / dcp::compose("player_seek_test_%1.png", i), dcp::compose("build/test/player_seek_test_%1.png", i), 14.08); } } @@ -277,9 +277,9 @@ BOOST_AUTO_TEST_CASE (player_seek_test2) auto video = butler->get_video(true, 0); BOOST_CHECK_EQUAL(video.second.get(), t.get()); write_image( - video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true), String::compose("build/test/player_seek_test2_%1.png", i) + video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), VideoRange::FULL, false, true), dcp::compose("build/test/player_seek_test2_%1.png", i) ); - check_image(TestPaths::private_data() / String::compose("player_seek_test2_%1.png", i), String::compose("build/test/player_seek_test2_%1.png", i), 14.08); + check_image(TestPaths::private_data() / dcp::compose("player_seek_test2_%1.png", i), dcp::compose("build/test/player_seek_test2_%1.png", i), 14.08); } } diff --git a/test/subtitle_language_test.cc b/test/subtitle_language_test.cc index e198b78f9..2ee0da336 100644 --- a/test/subtitle_language_test.cc +++ b/test/subtitle_language_test.cc @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE (subtitle_language_interop_test) dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION }); - check_dcp (String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name())); + check_dcp (dcp::compose("test/data/%1", name), dcp::compose("build/test/%1/%2", name, film->dcp_name())); } @@ -79,6 +79,6 @@ BOOST_AUTO_TEST_CASE (subtitle_language_smpte_test) dcp::VerificationNote::Code::MISSING_CPL_METADATA }); - check_dcp (String::compose("test/data/%1", name), String::compose("build/test/%1/%2", name, film->dcp_name())); + check_dcp (dcp::compose("test/data/%1", name), dcp::compose("build/test/%1/%2", name, film->dcp_name())); } diff --git a/test/test.cc b/test/test.cc index 4dab0cff1..7720fa3b7 100644 --- a/test/test.cc +++ b/test/test.cc @@ -25,7 +25,6 @@ */ -#include "lib/compose.hpp" #include "lib/config.h" #include "lib/cross.h" #include "lib/dcp_content_type.h" @@ -42,6 +41,7 @@ #include "lib/signal_manager.h" #include "lib/util.h" #include "test.h" +#include <dcp/compose.h> #include <dcp/cpl.h> #include <dcp/dcp.h> #include <dcp/mono_picture_asset.h> @@ -754,7 +754,7 @@ write_image (shared_ptr<const Image> image, boost::filesystem::path file) void check_ffmpeg (boost::filesystem::path ref, boost::filesystem::path check, int audio_tolerance) { - int const r = system (String::compose("ffcmp -t %1 %2 %3", audio_tolerance, ref.string(), check.string()).c_str()); + int const r = system (dcp::compose("ffcmp -t %1 %2 %3", audio_tolerance, ref.string(), check.string()).c_str()); BOOST_REQUIRE_EQUAL (WEXITSTATUS(r), 0); } diff --git a/test/threed_test.cc b/test/threed_test.cc index f98464fb5..06d05c1d8 100644 --- a/test/threed_test.cc +++ b/test/threed_test.cc @@ -201,7 +201,7 @@ BOOST_AUTO_TEST_CASE (threed_test7) } } BOOST_REQUIRE (failed); - BOOST_CHECK_EQUAL (failed->error_summary(), String::compose("The content file %1 is set as 3D but does not appear to contain 3D images. Please set it to 2D. You can still make a 3D DCP from this content by ticking the 3D option in the DCP video tab.", content_path.string())); + BOOST_CHECK_EQUAL (failed->error_summary(), dcp::compose("The content file %1 is set as 3D but does not appear to contain 3D images. Please set it to 2D. You can still make a 3D DCP from this content by ticking the 3D option in the DCP video tab.", content_path.string())); while (signal_manager->ui_idle ()) {} |
