Remove all use of stringstream in an attempt to fix
authorCarl Hetherington <cth@carlh.net>
Wed, 10 Aug 2016 15:38:33 +0000 (16:38 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 Aug 2016 08:13:51 +0000 (09:13 +0100)
the suspected thread-unsafe crash bugs on OS X.

55 files changed:
src/lib/analyse_audio_job.cc
src/lib/audio_filter_graph.cc
src/lib/cinema_kdms.cc
src/lib/compose.hpp
src/lib/content.cc
src/lib/dcp_content.cc
src/lib/dcpomatic_time.cc
src/lib/dcpomatic_time.h
src/lib/digester.cc
src/lib/emailer.cc
src/lib/encode_server.cc
src/lib/encoded_log_entry.cc
src/lib/encoder.cc
src/lib/environment_info.cc
src/lib/exceptions.cc
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_examiner.cc
src/lib/ffmpeg_subtitle_stream.h
src/lib/film.cc
src/lib/filter_graph.cc
src/lib/image_content.cc
src/lib/internet.cc
src/lib/job.cc
src/lib/json_server.cc
src/lib/json_server.h
src/lib/log.cc
src/lib/log_entry.cc
src/lib/string_log_entry.cc
src/lib/subtitle_content.cc
src/lib/transcode_job.cc
src/lib/update_checker.cc
src/lib/util.cc
src/lib/util.h
src/lib/video_content.cc
src/lib/video_content_scale.cc
src/lib/video_filter_graph.cc
src/lib/writer.cc
src/tools/dcpomatic.cc
src/tools/dcpomatic_kdm_cli.cc
src/tools/dcpomatic_server.cc
src/wx/colour_conversion_editor.cc
src/wx/dolby_doremi_certificate_panel.cc
src/wx/time_picker.cc
test/audio_analysis_test.cc
test/dcp_subtitle_test.cc
test/dcpomatic_time_test.cc
test/ffmpeg_examiner_test.cc
test/ffmpeg_pts_offset_test.cc
test/player_test.cc
test/reels_test.cc
test/test.cc
test/time_calculation_test.cc
test/util_test.cc
test/video_content_scale_test.cc

index 3e771d3f6af6a35c1e7a9e6a45b2be48b1b6b1ea..bfbf33a9d8ffbd510ee95f5aed8b97f54dcad267 100644 (file)
@@ -169,7 +169,7 @@ AnalyseAudioJob::analyse (shared_ptr<const AudioBuffers> b)
                        float s = data[i];
                        float as = fabsf (s);
                        if (as < 10e-7) {
                        float s = data[i];
                        float as = fabsf (s);
                        if (as < 10e-7) {
-                               /* locked_stringstream can't serialise and recover inf or -inf, so prevent such
+                               /* We may struggle to serialise and recover inf or -inf, so prevent such
                                   values by replacing with this (140dB down) */
                                s = as = 10e-7;
                        }
                                   values by replacing with this (140dB down) */
                                s = as = 10e-7;
                        }
index 6b70300fce195550eee6b2eec22b83d714ede4e1..744fdb2b7213d9dfbb0b21964939af543bc383bb 100644 (file)
@@ -29,7 +29,6 @@ extern "C" {
 #include "i18n.h"
 
 using std::string;
 #include "i18n.h"
 
 using std::string;
-using std::cout;
 using boost::shared_ptr;
 
 AudioFilterGraph::AudioFilterGraph (int sample_rate, int channels)
 using boost::shared_ptr;
 
 AudioFilterGraph::AudioFilterGraph (int sample_rate, int channels)
@@ -56,16 +55,16 @@ AudioFilterGraph::~AudioFilterGraph()
 string
 AudioFilterGraph::src_parameters () const
 {
 string
 AudioFilterGraph::src_parameters () const
 {
-       locked_stringstream a;
+       char layout[64];
+       av_get_channel_layout_string (layout, sizeof(layout), 0, _channel_layout);
 
 
-       char buffer[64];
-       av_get_channel_layout_string (buffer, sizeof(buffer), 0, _channel_layout);
+       char buffer[256];
+       snprintf (
+               buffer, sizeof(buffer), "time_base=1/1:sample_rate=%d:sample_fmt=%s:channel_layout=%s",
+               _sample_rate, av_get_sample_fmt_name(AV_SAMPLE_FMT_FLTP), layout
+               );
 
 
-       a << "time_base=1/1:sample_rate=" << _sample_rate << ":"
-         << "sample_fmt=" << av_get_sample_fmt_name(AV_SAMPLE_FMT_FLTP) << ":"
-         << "channel_layout=" << buffer;
-
-       return a.str ();
+       return buffer;
 }
 
 void *
 }
 
 void *
@@ -149,7 +148,7 @@ AudioFilterGraph::process (shared_ptr<const AudioBuffers> buffers)
        if (r < 0) {
                char buffer[256];
                av_strerror (r, buffer, sizeof(buffer));
        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));
+               throw DecodeError (String::compose (N_("could not push buffer into filter chain (%1)"), &buffer[0]));
        }
 
        while (true) {
        }
 
        while (true) {
index 299cdf94e5d94dcf075a312a11d21c6315f5059e..c05dd613857db93776e1d6a288e9d7d2fd343e8c 100644 (file)
@@ -174,11 +174,11 @@ CinemaKDMs::email (
                boost::algorithm::replace_all (body, "$END_TIME", name_values['t']);
                boost::algorithm::replace_all (body, "$CINEMA_NAME", i.cinema->name);
 
                boost::algorithm::replace_all (body, "$END_TIME", name_values['t']);
                boost::algorithm::replace_all (body, "$CINEMA_NAME", i.cinema->name);
 
-               locked_stringstream screens;
+               string screens;
                BOOST_FOREACH (ScreenKDM const & j, i.screen_kdms) {
                BOOST_FOREACH (ScreenKDM const & j, i.screen_kdms) {
-                       screens << j.screen->name << ", ";
+                       screens += j.screen->name + ", ";
                }
                }
-               boost::algorithm::replace_all (body, "$SCREENS", screens.str().substr (0, screens.str().length() - 2));
+               boost::algorithm::replace_all (body, "$SCREENS", screens.substr (0, screens.length() - 2));
 
                Emailer email (config->kdm_from(), i.cinema->emails, subject, body);
 
 
                Emailer email (config->kdm_from(), i.cinema->emails, subject, body);
 
index ebabe671a7f40545b0a546294a485375de192134..6206eb61170d7ba4823be190d219182403d4b3f1 100644 (file)
@@ -1,4 +1,5 @@
-/* Defines String::compose(fmt, arg...) for easy, i18n-friendly
+/* -*- c-basic-offset: 2 -*-
+ * Defines String::compose(fmt, arg...) for easy, i18n-friendly
  * composition of strings.
  *
  * Version 1.0.
  * composition of strings.
  *
  * Version 1.0.
 #ifndef STRING_COMPOSE_H
 #define STRING_COMPOSE_H
 
 #ifndef STRING_COMPOSE_H
 #define STRING_COMPOSE_H
 
-#include <locked_sstream.h>
+#include <boost/filesystem.hpp>
 #include <string>
 #include <list>
 #include <string>
 #include <list>
-#include <map>                 // for multimap
+#include <map>
+#include <inttypes.h>
 
 namespace StringPrivate
 {
 
 namespace StringPrivate
 {
@@ -56,7 +58,7 @@ namespace StringPrivate
     std::string str() const;
 
   private:
     std::string str() const;
 
   private:
-    locked_stringstream os;
+    std::string os;
     int arg_no;
 
     // we store the output as a list - when the output string is requested, the
     int arg_no;
 
     // we store the output as a list - when the output string is requested, the
@@ -110,26 +112,106 @@ namespace StringPrivate
     }
   }
 
     }
   }
 
+  template <typename T>
+  inline void write(std::string& s, const T& obj)
+  {
+    /* Assume anything not specialized has a to_string() method */
+    s += to_string (obj);
+  }
+
+  template <>
+  inline void write(std::string& s, const int64_t& obj)
+  {
+    char buffer[64];
+    snprintf(buffer, 64, "%" PRId64, obj);
+    s += buffer;
+  }
+
+  template <>
+  inline void write(std::string& s, const int& obj)
+  {
+    char buffer[64];
+    snprintf(buffer, 64, "%d", obj);
+    s += buffer;
+  }
+
+  template <>
+  inline void write(std::string& s, const unsigned int& obj)
+  {
+    char buffer[64];
+    snprintf(buffer, 64, "%ud", obj);
+    s += buffer;
+  }
+
+  template <>
+  inline void write(std::string& s, const long unsigned int& obj)
+  {
+    char buffer[64];
+    snprintf(buffer, 64, "%lu", obj);
+    s += buffer;
+  }
+
+  template <>
+  inline void write(std::string& s, const float& obj)
+  {
+    char buffer[64];
+    snprintf(buffer, 64, "%f", obj);
+    s += buffer;
+  }
+
+  template <>
+  inline void write(std::string& s, const char& obj)
+  {
+    s += obj;
+  }
+
+  template <>
+  inline void write(std::string& s, const double& obj)
+  {
+    char buffer[64];
+    snprintf(buffer, 64, "%f", obj);
+    s += buffer;
+  }
+
+  template <>
+  inline void write(std::string& s, char const * const & obj)
+  {
+    s += obj;
+  }
+
+  template <>
+  inline void write(std::string& s, char* const & obj)
+  {
+    s += obj;
+  }
+
+  template <>
+  inline void write(std::string& s, const std::string& obj)
+  {
+    s += obj;
+  }
+
+  template <>
+  inline void write(std::string& s, const boost::filesystem::path & obj)
+  {
+    s += obj.string();
+  }
 
   // implementation of class Composition
   template <typename T>
   inline Composition &Composition::arg(const T &obj)
   {
 
   // implementation of class Composition
   template <typename T>
   inline Composition &Composition::arg(const T &obj)
   {
-    os << obj;
-
-    std::string rep = os.str();
+    write(os, obj);
 
 
-    if (!rep.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) {
+    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_list::iterator pos = i->second;
        ++pos;
 
-       output.insert(pos, rep);
+       output.insert(pos, os);
       }
 
       }
 
-      os.str(std::string());
-      //os.clear();
+      os = "";
       ++arg_no;
     }
 
       ++arg_no;
     }
 
index a56573ed28536503e4099a7bdd88c44ebb23604f..9c7e790402c157aa7ffec1ad20a7b1e79e30948d 100644 (file)
@@ -30,7 +30,6 @@
 #include "job.h"
 #include "compose.hpp"
 #include "raw_convert.h"
 #include "job.h"
 #include "compose.hpp"
 #include "raw_convert.h"
-#include <locked_sstream.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/thread/mutex.hpp>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/thread/mutex.hpp>
@@ -254,14 +253,12 @@ Content::length_after_trim () const
 string
 Content::identifier () const
 {
 string
 Content::identifier () const
 {
-       locked_stringstream s;
-
-       s << Content::digest()
-         << "_" << position().get()
-         << "_" << trim_start().get()
-         << "_" << trim_end().get();
-
-       return s.str ();
+       char buffer[256];
+       snprintf (
+               buffer, sizeof(buffer), "%s_%" PRId64 "_%" PRId64 "_%" PRId64,
+               Content::digest().c_str(), position().get(), trim_start().get(), trim_end().get()
+               );
+       return buffer;
 }
 
 bool
 }
 
 bool
index 431492c7ac29b8b50091d75e1cdbfead4d5e3dac..b41e31c0cc684a76f82e39ff90df5a478b61ac84 100644 (file)
@@ -239,14 +239,13 @@ DCPContent::full_length () const
 string
 DCPContent::identifier () const
 {
 string
 DCPContent::identifier () const
 {
-       locked_stringstream s;
-       s << Content::identifier() << "_" << video->identifier() << "_";
+       string s = Content::identifier() + "_" + video->identifier() + "_";
        if (subtitle) {
        if (subtitle) {
-               s << subtitle->identifier () << " ";
+               s += subtitle->identifier () + " ";
        }
        }
-       s << (_reference_video ? "1" : "0")
-         << (_reference_subtitle ? "1" : "0");
-       return s.str ();
+
+       s += string (_reference_video ? "1" : "0") + string (_reference_subtitle ? "1" : "0");
+       return s;
 }
 
 void
 }
 
 void
index f96688979c9504646437846b438738e719d5689f..6563c6e5f9a2835082082a0116ebe489e16a3e72 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -19,8 +19,9 @@
 */
 
 #include "dcpomatic_time.h"
 */
 
 #include "dcpomatic_time.h"
+#include <inttypes.h>
 
 
-using std::ostream;
+using std::string;
 
 template <>
 Time<ContentTimeDifferentiator, DCPTimeDifferentiator>::Time (DCPTime d, FrameRateChange f)
 
 template <>
 Time<ContentTimeDifferentiator, DCPTimeDifferentiator>::Time (DCPTime d, FrameRateChange f)
@@ -76,23 +77,26 @@ max (ContentTime a, ContentTime b)
        return b;
 }
 
        return b;
 }
 
-ostream &
-operator<< (ostream& s, ContentTime t)
+string
+to_string (ContentTime t)
 {
 {
-       s << "[CONT " << t.get() << " " << t.seconds() << "s]";
-       return s;
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "[CONT %" PRId64 " %fs]", t.get(), t.seconds());
+       return buffer;
 }
 
 }
 
-ostream &
-operator<< (ostream& s, DCPTime t)
+string
+to_string (DCPTime t)
 {
 {
-       s << "[DCP " << t.get() << " " << t.seconds() << "s]";
-       return s;
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "[DCP %" PRId64 " %fs]", t.get(), t.seconds());
+       return buffer;
 }
 
 }
 
-ostream &
-operator<< (ostream& s, DCPTimePeriod p)
+string
+to_string (DCPTimePeriod p)
 {
 {
-       s << "[DCP " << p.from.get() << " " << p.from.seconds() << "s -> " << p.to.get() << " " << p.to.seconds() << "s]";
-       return s;
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "[DCP %" PRId64 " %fs -> %" PRId64 " %fs]", p.from.get(), p.from.seconds(), p.to.get(), p.to.seconds());
+       return buffer;
 }
 }
index a94b605d2b94f61d7a1eebb68d0835d7856174ac..7dbde46b7b2698f73724d518d7298eb3ff17433e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
 
     This file is part of DCP-o-matic.
 
@@ -27,7 +27,6 @@
 
 #include "frame_rate_change.h"
 #include "dcpomatic_assert.h"
 
 #include "frame_rate_change.h"
 #include "dcpomatic_assert.h"
-#include <locked_sstream.h>
 #include <boost/optional.hpp>
 #include <stdint.h>
 #include <cmath>
 #include <boost/optional.hpp>
 #include <stdint.h>
 #include <cmath>
@@ -182,14 +181,9 @@ public:
                int f;
                split (r, h, m, s, f);
 
                int f;
                split (r, h, m, s, f);
 
-               locked_stringstream o;
-               o.width (2);
-               o.fill ('0');
-               o << std::setw(2) << std::setfill('0') << h << ":"
-                 << std::setw(2) << std::setfill('0') << m << ":"
-                 << std::setw(2) << std::setfill('0') << s << ":"
-                 << std::setw(2) << std::setfill('0') << f;
-               return o.str ();
+               char buffer[128];
+               snprintf (buffer, sizeof (buffer), "%02d:%02d:%02d:%02d", h, m, s, f);
+               return buffer;
        }
 
 
        }
 
 
@@ -289,8 +283,8 @@ DCPTime min (DCPTime a, DCPTime b);
 DCPTime max (DCPTime a, DCPTime b);
 ContentTime min (ContentTime a, ContentTime b);
 ContentTime max (ContentTime a, ContentTime b);
 DCPTime max (DCPTime a, DCPTime b);
 ContentTime min (ContentTime a, ContentTime b);
 ContentTime max (ContentTime a, ContentTime b);
-std::ostream& operator<< (std::ostream& s, ContentTime t);
-std::ostream& operator<< (std::ostream& s, DCPTime t);
-std::ostream& operator<< (std::ostream& s, DCPTimePeriod p);
+std::string to_string (ContentTime t);
+std::string to_string (DCPTime t);
+std::string to_string (DCPTimePeriod p);
 
 #endif
 
 #endif
index 70c2babf5e4fd6d054a5db9a5f5594d2f49c3848..155d43af478b32d62fcae50a8e13282ba6bbb5b9 100644 (file)
@@ -19,7 +19,6 @@
 */
 
 #include "digester.h"
 */
 
 #include "digester.h"
-#include <locked_sstream.h>
 #include <nettle/md5.h>
 #include <iomanip>
 
 #include <nettle/md5.h>
 #include <iomanip>
 
@@ -57,12 +56,12 @@ Digester::get () const
                unsigned char digest[MD5_DIGEST_SIZE];
                md5_digest (&_context, MD5_DIGEST_SIZE, digest);
 
                unsigned char digest[MD5_DIGEST_SIZE];
                md5_digest (&_context, MD5_DIGEST_SIZE, digest);
 
-               locked_stringstream s;
+               char hex[MD5_DIGEST_SIZE * 2 + 1];
                for (int i = 0; i < MD5_DIGEST_SIZE; ++i) {
                for (int i = 0; i < MD5_DIGEST_SIZE; ++i) {
-                       s << hex << setfill('0') << setw(2) << ((int) digest[i]);
+                       sprintf(hex + i * 2, "%02x", digest[i]);
                }
 
                }
 
-               _digest = s.str ();
+               _digest = hex;
        }
 
        return _digest.get ();
        }
 
        return _digest.get ();
index 71b29db1e06acb42c0fc359ced67bd589197bfee..534856ba61f23613ab684e29969a2036fd1bfd38 100644 (file)
@@ -103,18 +103,16 @@ Emailer::send (string server, int port, string user, string password)
        boost::posix_time::time_duration offset = local_now - utc_now;
        sprintf (date_buffer + strlen(date_buffer), "%s%02d%02d", (offset.hours() >= 0 ? "+" : "-"), abs (offset.hours()), offset.minutes());
 
        boost::posix_time::time_duration offset = local_now - utc_now;
        sprintf (date_buffer + strlen(date_buffer), "%s%02d%02d", (offset.hours() >= 0 ? "+" : "-"), abs (offset.hours()), offset.minutes());
 
-       locked_stringstream email;
-
-       email << "Date: " << date_buffer << "\r\n"
-             << "To: " << address_list (_to) << "\r\n"
-             << "From: " << _from << "\r\n";
+       _email = "Date: " + string(date_buffer) + "\r\n"
+               "To: " + address_list (_to) + "\r\n"
+               "From: " + _from + "\r\n";
 
        if (!_cc.empty ()) {
 
        if (!_cc.empty ()) {
-               email << "Cc: " << address_list (_cc) << "\r\n";
+               _email += "Cc: " + address_list (_cc) + "\r\n";
        }
 
        if (!_bcc.empty ()) {
        }
 
        if (!_bcc.empty ()) {
-               email << "Bcc: " << address_list (_bcc) << "\r\n";
+               _email += "Bcc: " + address_list (_bcc) + "\r\n";
        }
 
        string const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
        }
 
        string const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
@@ -124,26 +122,26 @@ Emailer::send (string server, int port, string user, string password)
        }
 
        if (!_attachments.empty ()) {
        }
 
        if (!_attachments.empty ()) {
-               email << "MIME-Version: 1.0\r\n"
-                     << "Content-Type: multipart/mixed; boundary=" << boundary << "\r\n";
+               _email += "MIME-Version: 1.0\r\n"
+                       "Content-Type: multipart/mixed; boundary=" + boundary + "\r\n";
        }
 
        }
 
-       email << "Subject: " << _subject << "\r\n"
-             << "User-Agent: DCP-o-matic\r\n"
-             << "\r\n";
+       _email += "Subject: " + _subject + "\r\n"
+               "User-Agent: DCP-o-matic\r\n"
+               "\r\n";
 
        if (!_attachments.empty ()) {
 
        if (!_attachments.empty ()) {
-               email << "--" << boundary << "\r\n"
-                     << "Content-Type: text/plain; charset=utf-8\r\n\r\n";
+               _email += "--" + boundary + "\r\n"
+                       + "Content-Type: text/plain; charset=utf-8\r\n\r\n";
        }
 
        }
 
-       email << _body;
+       _email += _body;
 
        BOOST_FOREACH (Attachment i, _attachments) {
 
        BOOST_FOREACH (Attachment i, _attachments) {
-               email << "\r\n\r\n--" << boundary << "\r\n"
-                     << "Content-Type: " << i.mime_type << "; name=" << i.name << "\r\n"
-                     << "Content-Transfer-Encoding: Base64\r\n"
-                     << "Content-Disposition: attachment; filename=" << i.name << "\r\n\r\n";
+               _email += "\r\n\r\n--" + boundary + "\r\n"
+                       "Content-Type: " + i.mime_type + "; name=" + i.name + "\r\n"
+                       "Content-Transfer-Encoding: Base64\r\n"
+                       "Content-Disposition: attachment; filename=" + i.name + "\r\n\r\n";
 
                BIO* b64 = BIO_new (BIO_f_base64());
 
 
                BIO* b64 = BIO_new (BIO_f_base64());
 
@@ -156,17 +154,15 @@ Emailer::send (string server, int port, string user, string password)
 
                char* out;
                long int bytes = BIO_get_mem_data (bio, &out);
 
                char* out;
                long int bytes = BIO_get_mem_data (bio, &out);
-               email << string (out, bytes);
+               _email += string (out, bytes);
 
                BIO_free_all (b64);
        }
 
        if (!_attachments.empty ()) {
 
                BIO_free_all (b64);
        }
 
        if (!_attachments.empty ()) {
-               email << "\r\n--" << boundary << "--\r\n";
+               _email += "\r\n--" + boundary + "--\r\n";
        }
 
        }
 
-       _email = email.str ();
-
        curl_global_init (CURL_GLOBAL_DEFAULT);
 
        CURL* curl = curl_easy_init ();
        curl_global_init (CURL_GLOBAL_DEFAULT);
 
        CURL* curl = curl_easy_init ();
index cf5ec651a99655ba249cb07dccd3c4d019622b59..abd8537c01786475c927ad1a09ac1ba9cb40a063 100644 (file)
@@ -35,7 +35,6 @@
 #include "compose.hpp"
 #include "log.h"
 #include "encoded_log_entry.h"
 #include "compose.hpp"
 #include "log.h"
 #include "encoded_log_entry.h"
-#include <locked_sstream.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/algorithm/string.hpp>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/algorithm/string.hpp>
index 84c7a6ca6ba61e252bc731173988ae20b885573b..e8d43630594d0d9b2296229dabe898f4fa0d6703 100644 (file)
 */
 
 #include "encoded_log_entry.h"
 */
 
 #include "encoded_log_entry.h"
-#include <locked_sstream.h>
 
 using std::string;
 
 using std::string;
-using std::fixed;
 
 EncodedLogEntry::EncodedLogEntry (int frame, string ip, double receive, double encode, double send)
        : LogEntry (LogEntry::TYPE_GENERAL)
 
 EncodedLogEntry::EncodedLogEntry (int frame, string ip, double receive, double encode, double send)
        : LogEntry (LogEntry::TYPE_GENERAL)
@@ -38,13 +36,7 @@ EncodedLogEntry::EncodedLogEntry (int frame, string ip, double receive, double e
 string
 EncodedLogEntry::message () const
 {
 string
 EncodedLogEntry::message () const
 {
-       locked_stringstream m;
-       m.precision (2);
-       m << fixed
-         << "Encoded frame " << _frame << " from " << _ip << ": "
-         << "receive " << _receive << "s "
-         << "encode " << _encode << "s "
-         << "send " << _send << "s.";
-
-       return m.str ();
+       char buffer[256];
+       snprintf (buffer, sizeof(buffer), "Encoded frame %d from %s: receive %.2fs encode %.2fs send %.2fs.", _frame, _ip.c_str(), _receive, _encode, _send);
+       return buffer;
 }
 }
index 0c41d8d806a8ec9bf627a54b2ac579315edab074..364d29fbed589228c60b9d304984914e944c1646 100644 (file)
@@ -304,7 +304,7 @@ try
 
                LOG_TIMING ("encoder-wake thread=%1 queue=%2", boost::this_thread::get_id(), _queue.size());
                shared_ptr<DCPVideo> vf = _queue.front ();
 
                LOG_TIMING ("encoder-wake thread=%1 queue=%2", boost::this_thread::get_id(), _queue.size());
                shared_ptr<DCPVideo> vf = _queue.front ();
-               LOG_TIMING ("encoder-pop thread=%1 frame=%2 eyes=%3", boost::this_thread::get_id(), vf->index(), vf->eyes ());
+               LOG_TIMING ("encoder-pop thread=%1 frame=%2 eyes=%3", boost::this_thread::get_id(), vf->index(), (int) vf->eyes ());
                _queue.pop_front ();
 
                lock.unlock ();
                _queue.pop_front ();
 
                lock.unlock ();
index eb241d512489579d5e7dcc8fff1139d549186fdd..b5093e4d6c01a24505e7380286dc80c26bd7c687 100644 (file)
@@ -57,28 +57,30 @@ static
 string
 ffmpeg_version_to_string (int v)
 {
 string
 ffmpeg_version_to_string (int v)
 {
-       locked_stringstream s;
-       s << ((v & 0xff0000) >> 16) << N_(".") << ((v & 0xff00) >> 8) << N_(".") << (v & 0xff);
-       return s.str ();
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%d.%d.%d", ((v & 0xff0000) >> 16), ((v & 0xff00) >> 8), (v & 0xff));
+       return buffer;
 }
 
 }
 
-
 /** Return a user-readable string summarising the versions of our dependencies */
 static
 string
 dependency_version_summary ()
 {
 /** Return a user-readable string summarising the versions of our dependencies */
 static
 string
 dependency_version_summary ()
 {
-       locked_stringstream s;
-       s << N_("libavcodec ") << ffmpeg_version_to_string (avcodec_version()) << N_(", ")
-         << N_("libavfilter ") << ffmpeg_version_to_string (avfilter_version()) << N_(", ")
-         << N_("libavformat ") << ffmpeg_version_to_string (avformat_version()) << N_(", ")
-         << N_("libavutil ") << ffmpeg_version_to_string (avutil_version()) << N_(", ")
-         << N_("libswscale ") << ffmpeg_version_to_string (swscale_version()) << N_(", ")
-         << MagickVersion << N_(", ")
-         << N_("libssh ") << ssh_version (0) << N_(", ")
-         << N_("libdcp ") << dcp::version << N_(" git ") << dcp::git_commit;
-
-       return s.str ();
+       char buffer[512];
+       snprintf (
+               buffer, sizeof(buffer), "libavcodec %s, libavfilter %s, libavformat %s, libavutil %s, libswscale %s, %s, libssh %s, libdcp %s git %s",
+               ffmpeg_version_to_string(avcodec_version()).c_str(),
+               ffmpeg_version_to_string(avfilter_version()).c_str(),
+               ffmpeg_version_to_string(avformat_version()).c_str(),
+               ffmpeg_version_to_string(avutil_version()).c_str(),
+               ffmpeg_version_to_string(swscale_version()).c_str(),
+               MagickVersion,
+               ssh_version(0),
+               dcp::version, dcp::git_commit
+               );
+
+       return buffer;
 }
 
 list<string>
 }
 
 list<string>
@@ -91,7 +93,7 @@ environment_info ()
        {
                char buffer[128];
                gethostname (buffer, sizeof (buffer));
        {
                char buffer[128];
                gethostname (buffer, sizeof (buffer));
-               info.push_back (String::compose ("Host name %1", buffer));
+               info.push_back (String::compose ("Host name %1", &buffer[0]));
        }
 
 #ifdef DCPOMATIC_DEBUG
        }
 
 #ifdef DCPOMATIC_DEBUG
index b8144d2edb3bb338f68f4b5a2f349e642d710bb7..f07354ca109cb953b61e3f4c53e9eaa21870c5cc 100644 (file)
@@ -59,7 +59,7 @@ MissingSettingError::MissingSettingError (string s)
 }
 
 PixelFormatError::PixelFormatError (string o, AVPixelFormat f)
 }
 
 PixelFormatError::PixelFormatError (string o, AVPixelFormat f)
-       : runtime_error (String::compose (_("Cannot handle pixel format %1 during %2"), f, o))
+       : runtime_error (String::compose (_("Cannot handle pixel format %1 during %2"), (int) f, o))
 {
 
 }
 {
 
 }
index 60c777b3c3d9f6107386525fa211630c14906afc..9f8cb78a60dce3596778facad10f15b8c1642f20 100644 (file)
@@ -34,7 +34,6 @@
 #include "frame_rate_change.h"
 #include "raw_convert.h"
 #include "subtitle_content.h"
 #include "frame_rate_change.h"
 #include "raw_convert.h"
 #include "subtitle_content.h"
-#include <locked_sstream.h>
 #include <libcxml/cxml.h>
 extern "C" {
 #include <libavformat/avformat.h>
 #include <libcxml/cxml.h>
 extern "C" {
 #include <libavformat/avformat.h>
@@ -388,29 +387,27 @@ FFmpegContent::set_filters (vector<Filter const *> const & filters)
 string
 FFmpegContent::identifier () const
 {
 string
 FFmpegContent::identifier () const
 {
-       locked_stringstream s;
-
-       s << Content::identifier();
+       string s = Content::identifier();
 
        if (video) {
 
        if (video) {
-               s << "_" << video->identifier();
+               s += "_" + video->identifier();
        }
 
        if (subtitle) {
        }
 
        if (subtitle) {
-               s << "_" << subtitle->identifier();
+               s += "_" + subtitle->identifier();
        }
 
        boost::mutex::scoped_lock lm (_mutex);
 
        if (_subtitle_stream) {
        }
 
        boost::mutex::scoped_lock lm (_mutex);
 
        if (_subtitle_stream) {
-               s << "_" << _subtitle_stream->identifier ();
+               s += "_" + _subtitle_stream->identifier ();
        }
 
        for (vector<Filter const *>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
        }
 
        for (vector<Filter const *>::const_iterator i = _filters.begin(); i != _filters.end(); ++i) {
-               s << "_" << (*i)->id ();
+               s += "_" + (*i)->id ();
        }
 
        }
 
-       return s.str ();
+       return s;
 }
 
 list<ContentTimePeriod>
 }
 
 list<ContentTimePeriod>
index a47cd405d38f47ae1ea1536b95a5d440bb989c77..ace54f7194a3eaffd0cd13f984e80af97e0be12e 100644 (file)
@@ -137,7 +137,7 @@ FFmpegDecoder::pass (PassReason reason, bool accurate)
                        /* Maybe we should fail here, but for now we'll just finish off instead */
                        char buf[256];
                        av_strerror (r, buf, sizeof(buf));
                        /* Maybe we should fail here, but for now we'll just finish off instead */
                        char buf[256];
                        av_strerror (r, buf, sizeof(buf));
-                       LOG_ERROR (N_("error on av_read_frame (%1) (%2)"), buf, r);
+                       LOG_ERROR (N_("error on av_read_frame (%1) (%2)"), &buf[0], r);
                }
 
                flush ();
                }
 
                flush ();
index 544cc11b91fc545d2d74426b5ab372db4933fdd1..847c141da4a142e49b694429eea41829b095224f 100644 (file)
@@ -30,7 +30,6 @@ extern "C" {
 #include "ffmpeg_audio_stream.h"
 #include "ffmpeg_subtitle_stream.h"
 #include "util.h"
 #include "ffmpeg_audio_stream.h"
 #include "ffmpeg_subtitle_stream.h"
 #include "util.h"
-#include <locked_sstream.h>
 #include <boost/foreach.hpp>
 #include <iostream>
 
 #include <boost/foreach.hpp>
 #include <iostream>
 
@@ -351,38 +350,36 @@ FFmpegExaminer::sample_aspect_ratio () const
 string
 FFmpegExaminer::subtitle_stream_name (AVStream* s) const
 {
 string
 FFmpegExaminer::subtitle_stream_name (AVStream* s) const
 {
-       locked_stringstream n;
+       string n = stream_name (s);
 
 
-       n << stream_name (s);
-
-       if (n.str().empty()) {
-               n << _("unknown");
+       if (n.empty()) {
+               n = _("unknown");
        }
 
        }
 
-       return n.str ();
+       return n;
 }
 
 string
 FFmpegExaminer::stream_name (AVStream* s) const
 {
 }
 
 string
 FFmpegExaminer::stream_name (AVStream* s) const
 {
-       locked_stringstream n;
+       string n;
 
        if (s->metadata) {
                AVDictionaryEntry const * lang = av_dict_get (s->metadata, "language", 0, 0);
                if (lang) {
 
        if (s->metadata) {
                AVDictionaryEntry const * lang = av_dict_get (s->metadata, "language", 0, 0);
                if (lang) {
-                       n << lang->value;
+                       n = lang->value;
                }
 
                AVDictionaryEntry const * title = av_dict_get (s->metadata, "title", 0, 0);
                if (title) {
                }
 
                AVDictionaryEntry const * title = av_dict_get (s->metadata, "title", 0, 0);
                if (title) {
-                       if (!n.str().empty()) {
-                               n << " ";
+                       if (!n.empty()) {
+                               n += " ";
                        }
                        }
-                       n << title->value;
+                       n += title->value;
                }
        }
 
                }
        }
 
-       return n.str ();
+       return n;
 }
 
 int
 }
 
 int
index f79e7aca7429b92f830939f37562331991bc96a4..6d4853b8d2a4a83f5bd206158504e731f2f57c78 100644 (file)
@@ -21,6 +21,7 @@
 #include "dcpomatic_time.h"
 #include "rgba.h"
 #include "ffmpeg_stream.h"
 #include "dcpomatic_time.h"
 #include "rgba.h"
 #include "ffmpeg_stream.h"
+#include <map>
 
 class FFmpegSubtitleStream : public FFmpegStream
 {
 
 class FFmpegSubtitleStream : public FFmpegStream
 {
index 5e204e126e8d9008fdbc602df42f1336afe06e77..28017669bd035afa2e7cb00327c23c27888e62da 100644 (file)
@@ -51,7 +51,6 @@
 #include "dcp_content.h"
 #include "screen_kdm.h"
 #include "cinema.h"
 #include "dcp_content.h"
 #include "screen_kdm.h"
 #include "cinema.h"
-#include <locked_sstream.h>
 #include <libcxml/cxml.h>
 #include <dcp/cpl.h>
 #include <dcp/certificate_chain.h>
 #include <libcxml/cxml.h>
 #include <dcp/cpl.h>
 #include <dcp/certificate_chain.h>
@@ -197,32 +196,29 @@ Film::video_identifier () const
 {
        DCPOMATIC_ASSERT (container ());
 
 {
        DCPOMATIC_ASSERT (container ());
 
-       locked_stringstream s;
-       s.imbue (std::locale::classic ());
-
-       s << container()->id()
-         << "_" << resolution_to_string (_resolution)
-         << "_" << _playlist->video_identifier()
-         << "_" << _video_frame_rate
-         << "_" << j2k_bandwidth();
+       string s = container()->id()
+               + "_" + resolution_to_string (_resolution)
+               + "_" + _playlist->video_identifier()
+               + "_" + raw_convert<string>(_video_frame_rate)
+               + "_" + raw_convert<string>(j2k_bandwidth());
 
        if (encrypted ()) {
 
        if (encrypted ()) {
-               s << "_E";
+               s += "_E";
        } else {
        } else {
-               s << "_P";
+               s += "_P";
        }
 
        if (_interop) {
        }
 
        if (_interop) {
-               s << "_I";
+               s += "_I";
        } else {
        } else {
-               s << "_S";
+               s += "_S";
        }
 
        if (_three_d) {
        }
 
        if (_three_d) {
-               s << "_3D";
+               s += "_3D";
        }
 
        }
 
-       return s.str ();
+       return s;
 }
 
 /** @return The file to write video frame info to */
 }
 
 /** @return The file to write video frame info to */
@@ -530,7 +526,7 @@ Film::mapped_audio_channels () const
 string
 Film::isdcf_name (bool if_created_now) const
 {
 string
 Film::isdcf_name (bool if_created_now) const
 {
-       locked_stringstream d;
+       string d;
 
        string raw_name = name ();
 
 
        string raw_name = name ();
 
@@ -573,49 +569,49 @@ Film::isdcf_name (bool if_created_now) const
                fixed_name = fixed_name.substr (0, 14);
        }
 
                fixed_name = fixed_name.substr (0, 14);
        }
 
-       d << fixed_name;
+       d += fixed_name;
 
        if (dcp_content_type()) {
 
        if (dcp_content_type()) {
-               d << "_" << dcp_content_type()->isdcf_name();
-               d << "-" << isdcf_metadata().content_version;
+               d += "_" + dcp_content_type()->isdcf_name();
+               d += "-" + raw_convert<string>(isdcf_metadata().content_version);
        }
 
        ISDCFMetadata const dm = isdcf_metadata ();
 
        if (dm.temp_version) {
        }
 
        ISDCFMetadata const dm = isdcf_metadata ();
 
        if (dm.temp_version) {
-               d << "-Temp";
+               d += "-Temp";
        }
 
        if (dm.pre_release) {
        }
 
        if (dm.pre_release) {
-               d << "-Pre";
+               d += "-Pre";
        }
 
        if (dm.red_band) {
        }
 
        if (dm.red_band) {
-               d << "-RedBand";
+               d += "-RedBand";
        }
 
        if (!dm.chain.empty ()) {
        }
 
        if (!dm.chain.empty ()) {
-               d << "-" << dm.chain;
+               d += "-" + dm.chain;
        }
 
        if (three_d ()) {
        }
 
        if (three_d ()) {
-               d << "-3D";
+               d += "-3D";
        }
 
        if (dm.two_d_version_of_three_d) {
        }
 
        if (dm.two_d_version_of_three_d) {
-               d << "-2D";
+               d += "-2D";
        }
 
        if (!dm.mastered_luminance.empty ()) {
        }
 
        if (!dm.mastered_luminance.empty ()) {
-               d << "-" << dm.mastered_luminance;
+               d += "-" + dm.mastered_luminance;
        }
 
        if (video_frame_rate() != 24) {
        }
 
        if (video_frame_rate() != 24) {
-               d << "-" << video_frame_rate();
+               d += "-" + raw_convert<string>(video_frame_rate());
        }
 
        if (container()) {
        }
 
        if (container()) {
-               d << "_" << container()->isdcf_name();
+               d += "_" + container()->isdcf_name();
        }
 
        /* XXX: this uses the first bit of content only */
        }
 
        /* XXX: this uses the first bit of content only */
@@ -636,12 +632,12 @@ Film::isdcf_name (bool if_created_now) const
                }
 
                if (content_ratio && content_ratio != container()) {
                }
 
                if (content_ratio && content_ratio != container()) {
-                       d << "-" << content_ratio->isdcf_name();
+                       d += "-" + content_ratio->isdcf_name();
                }
        }
 
        if (!dm.audio_language.empty ()) {
                }
        }
 
        if (!dm.audio_language.empty ()) {
-               d << "_" << dm.audio_language;
+               d += "_" + dm.audio_language;
                if (!dm.subtitle_language.empty()) {
 
                        bool burnt_in = true;
                if (!dm.subtitle_language.empty()) {
 
                        bool burnt_in = true;
@@ -662,18 +658,18 @@ Film::isdcf_name (bool if_created_now) const
                                transform (language.begin(), language.end(), language.begin(), ::toupper);
                        }
 
                                transform (language.begin(), language.end(), language.begin(), ::toupper);
                        }
 
-                       d << "-" << language;
+                       d += "-" + language;
                } else {
                } else {
-                       d << "-XX";
+                       d += "-XX";
                }
        }
 
        if (!dm.territory.empty ()) {
                }
        }
 
        if (!dm.territory.empty ()) {
-               d << "_" << dm.territory;
+               d += "_" + dm.territory;
                if (dm.rating.empty ()) {
                if (dm.rating.empty ()) {
-                       d << "-NR";
+                       d += "-NR";
                } else {
                } else {
-                       d << "-" << dm.rating;
+                       d += "-" + dm.rating;
                }
        }
 
                }
        }
 
@@ -696,35 +692,35 @@ Film::isdcf_name (bool if_created_now) const
        }
 
        if (non_lfe) {
        }
 
        if (non_lfe) {
-               d << "_" << non_lfe << lfe;
+               d += String::compose("_%1%2", non_lfe, lfe);
        }
 
        /* XXX: HI/VI */
 
        }
 
        /* XXX: HI/VI */
 
-       d << "_" << resolution_to_string (_resolution);
+       d += "_" + resolution_to_string (_resolution);
 
        if (!dm.studio.empty ()) {
 
        if (!dm.studio.empty ()) {
-               d << "_" << dm.studio;
+               d += "_" + dm.studio;
        }
 
        if (if_created_now) {
        }
 
        if (if_created_now) {
-               d << "_" << boost::gregorian::to_iso_string (boost::gregorian::day_clock::local_day ());
+               d += "_" + boost::gregorian::to_iso_string (boost::gregorian::day_clock::local_day ());
        } else {
        } else {
-               d << "_" << boost::gregorian::to_iso_string (_isdcf_date);
+               d += "_" + boost::gregorian::to_iso_string (_isdcf_date);
        }
 
        if (!dm.facility.empty ()) {
        }
 
        if (!dm.facility.empty ()) {
-               d << "_" << dm.facility;
+               d += "_" + dm.facility;
        }
 
        if (_interop) {
        }
 
        if (_interop) {
-               d << "_IOP";
+               d += "_IOP";
        } else {
        } else {
-               d << "_SMPTE";
+               d += "_SMPTE";
        }
 
        if (three_d ()) {
        }
 
        if (three_d ()) {
-               d << "-3D";
+               d += "-3D";
        }
 
        bool vf = false;
        }
 
        bool vf = false;
@@ -736,12 +732,12 @@ Film::isdcf_name (bool if_created_now) const
        }
 
        if (vf) {
        }
 
        if (vf) {
-               d << "_VF";
+               d += "_VF";
        } else {
        } else {
-               d << "_OV";
+               d += "_OV";
        }
 
        }
 
-       return d.str ();
+       return d;
 }
 
 /** @return name to give the DCP */
 }
 
 /** @return name to give the DCP */
@@ -922,23 +918,23 @@ Film::j2c_path (int reel, Frame frame, Eyes eyes, bool tmp) const
        p /= "j2c";
        p /= video_identifier ();
 
        p /= "j2c";
        p /= video_identifier ();
 
-       locked_stringstream s;
-       s.width (8);
-       s << setfill('0') << reel << "_" << frame;
+       char buffer[256];
+       snprintf(buffer, sizeof(buffer), "%08d_%08" PRId64, reel, frame);
+       string s (buffer);
 
        if (eyes == EYES_LEFT) {
 
        if (eyes == EYES_LEFT) {
-               s << ".L";
+               s += ".L";
        } else if (eyes == EYES_RIGHT) {
        } else if (eyes == EYES_RIGHT) {
-               s << ".R";
+               s += ".R";
        }
 
        }
 
-       s << ".j2c";
+       s += ".j2c";
 
        if (tmp) {
 
        if (tmp) {
-               s << ".tmp";
+               s += ".tmp";
        }
 
        }
 
-       p /= s.str();
+       p /= s;
        return file (p);
 }
 
        return file (p);
 }
 
index d918f7dc8cf0d1bd163fa65ae880331a6fd3e86c..7a29738154bb2f3aa52b47505de0daf17037b7ab 100644 (file)
@@ -26,7 +26,6 @@
 #include "filter.h"
 #include "exceptions.h"
 #include "image.h"
 #include "filter.h"
 #include "exceptions.h"
 #include "image.h"
-#include <locked_sstream.h>
 #include "compose.hpp"
 extern "C" {
 #include <libavfilter/avfiltergraph.h>
 #include "compose.hpp"
 extern "C" {
 #include <libavfilter/avfiltergraph.h>
index 08b9fd6ae475a364dd367f48274ef28e23ebf5d0..825f6da25aab1267bffe75f8fba442585c4a44e6 100644 (file)
@@ -27,7 +27,6 @@
 #include "frame_rate_change.h"
 #include "exceptions.h"
 #include "image_filename_sorter.h"
 #include "frame_rate_change.h"
 #include "exceptions.h"
 #include "image_filename_sorter.h"
-#include <locked_sstream.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
@@ -136,11 +135,9 @@ ImageContent::full_length () const
 string
 ImageContent::identifier () const
 {
 string
 ImageContent::identifier () const
 {
-       locked_stringstream s;
-       s << Content::identifier();
-       s << "_" << video->identifier ();
-       s << "_" << video->length();
-       return s.str ();
+       char buffer[256];
+       snprintf (buffer, sizeof(buffer), "%s_%s_%" PRId64, Content::identifier().c_str(), video->identifier().c_str(), video->length());
+       return buffer;
 }
 
 bool
 }
 
 bool
index c0a29bfbdf13cfbc52d93b2e9f1d997fe247832d..aafdf3a839a342b99944c2c20bdd14a9c9c56b82 100644 (file)
@@ -21,7 +21,6 @@
 #include "scoped_temporary.h"
 #include "compose.hpp"
 #include "exceptions.h"
 #include "scoped_temporary.h"
 #include "compose.hpp"
 #include "exceptions.h"
-#include <locked_sstream.h>
 #include <curl/curl.h>
 #include <zip.h>
 #include <boost/function.hpp>
 #include <curl/curl.h>
 #include <zip.h>
 #include <boost/function.hpp>
@@ -74,7 +73,7 @@ get_from_zip_url (string url, string file, bool pasv, function<void (boost::file
        temp_zip.close ();
        curl_easy_cleanup (curl);
        if (cr != CURLE_OK) {
        temp_zip.close ();
        curl_easy_cleanup (curl);
        if (cr != CURLE_OK) {
-               return String::compose (_("Download failed (%1/%2 error %3)"), url, file, cr);
+               return String::compose (_("Download failed (%1/%2 error %3)"), url, file, (int) cr);
        }
 
        /* Open the ZIP file and read `file' out of it */
        }
 
        /* Open the ZIP file and read `file' out of it */
@@ -149,16 +148,19 @@ ftp_ls (string url, bool pasv)
                throw NetworkError (curl_easy_strerror (r));
        }
 
                throw NetworkError (curl_easy_strerror (r));
        }
 
-       locked_stringstream s (ls_raw);
        list<string> ls;
        list<string> ls;
-       while (s.good ()) {
-               string line = s.getline ();
-               trim (line);
-               if (line.length() > 55) {
-                       string const file = line.substr (55);
-                       if (file != "." && file != "..") {
-                               ls.push_back (file);
+       string line;
+       for (size_t i = 0; i < ls_raw.length(); ++i) {
+               line += ls_raw[i];
+               if (ls_raw[i] == '\n') {
+                       trim (line);
+                       if (line.length() > 55) {
+                               string const file = line.substr (55);
+                               if (file != "." && file != "..") {
+                                       ls.push_back (file);
+                               }
                        }
                        }
+                       line = "";
                }
        }
 
                }
        }
 
index 585e8fb0d29ace1bdf905fe9ab5fdab691a20fcc..6e2bc9f53bed706910be46e5414efd9e253c43fa 100644 (file)
@@ -376,7 +376,7 @@ Job::status () const
        int const t = elapsed_sub_time ();
        int const r = remaining_time ();
 
        int const t = elapsed_sub_time ();
        int const r = remaining_time ();
 
-       locked_stringstream s;
+       string s;
        if (!finished () && p) {
                int pc = lrintf (p.get() * 100);
                if (pc == 100) {
        if (!finished () && p) {
                int pc = lrintf (p.get() * 100);
                if (pc == 100) {
@@ -384,22 +384,24 @@ Job::status () const
                        pc = 99;
                }
 
                        pc = 99;
                }
 
-               s << pc << N_("%");
+               char buffer[64];
+               snprintf (buffer, sizeof(buffer), "%d%%", pc);
+               s += buffer;
 
                if (t > 10 && r > 0) {
                        /// TRANSLATORS: remaining here follows an amount of time that is remaining
                        /// on an operation.
 
                if (t > 10 && r > 0) {
                        /// TRANSLATORS: remaining here follows an amount of time that is remaining
                        /// on an operation.
-                       s << "; " << seconds_to_approximate_hms (r) << " " << _("remaining");
+                       s += "; " + seconds_to_approximate_hms (r) + " " + _("remaining");
                }
        } else if (finished_ok ()) {
                }
        } else if (finished_ok ()) {
-               s << String::compose (_("OK (ran for %1)"), seconds_to_hms (_ran_for));
+               s = String::compose (_("OK (ran for %1)"), seconds_to_hms (_ran_for));
        } else if (finished_in_error ()) {
        } else if (finished_in_error ()) {
-               s << String::compose (_("Error: %1"), error_summary ());
+               s = String::compose (_("Error: %1"), error_summary ());
        } else if (finished_cancelled ()) {
        } else if (finished_cancelled ()) {
-               s << _("Cancelled");
+               s = _("Cancelled");
        }
 
        }
 
-       return s.str ();
+       return s;
 }
 
 string
 }
 
 string
index 4af13387510885d701736bc5a5678bd5f7de4d0f..490f9fc5f6b211321c93b2609acbdc8924901c0f 100644 (file)
 
 */
 
 
 */
 
-#include <boost/asio.hpp>
-#include <boost/bind.hpp>
-#include <boost/thread.hpp>
 #include "json_server.h"
 #include "job_manager.h"
 #include "job.h"
 #include "util.h"
 #include "film.h"
 #include "transcode_job.h"
 #include "json_server.h"
 #include "job_manager.h"
 #include "job.h"
 #include "util.h"
 #include "film.h"
 #include "transcode_job.h"
+#include "raw_convert.h"
+#include <boost/asio.hpp>
+#include <boost/bind.hpp>
+#include <boost/thread.hpp>
 #include <iostream>
 
 using std::string;
 #include <iostream>
 
 using std::string;
@@ -151,48 +152,43 @@ JSONServer::request (string url, shared_ptr<tcp::socket> socket)
                action = r["action"];
        }
 
                action = r["action"];
        }
 
-       locked_stringstream json;
+       string json;
        if (action == "status") {
 
                list<shared_ptr<Job> > jobs = JobManager::instance()->get ();
 
        if (action == "status") {
 
                list<shared_ptr<Job> > jobs = JobManager::instance()->get ();
 
-               json << "{ \"jobs\": [";
+               json += "{ \"jobs\": [";
                for (list<shared_ptr<Job> >::iterator i = jobs.begin(); i != jobs.end(); ++i) {
 
                for (list<shared_ptr<Job> >::iterator i = jobs.begin(); i != jobs.end(); ++i) {
 
-                       json << "{ ";
+                       json += "{ ";
 
                        if ((*i)->film()) {
 
                        if ((*i)->film()) {
-                               json << "\"dcp\": \"" << (*i)->film()->dcp_name() << "\", ";
+                               json += "\"dcp\": \"" + (*i)->film()->dcp_name() + "\", ";
                        }
 
                        }
 
-                       json << "\"name\": \""   << (*i)->json_name() << "\", ";
+                       json += "\"name\": \"" + (*i)->json_name() + "\", ";
                        if ((*i)->progress ()) {
                        if ((*i)->progress ()) {
-                               json << "\"progress\": " << (*i)->progress().get() << ", ";
+                               json += "\"progress\": " + raw_convert<string>((*i)->progress().get()) + ", ";
                        } else {
                        } else {
-                               json << "\"progress\": unknown, ";
+                               json += "\"progress\": unknown, ";
                        }
                        }
-                       json << "\"status\": \"" << (*i)->json_status() << "\"";
-                       json << " }";
+                       json += "\"status\": \"" + (*i)->json_status() + "\"";
+                       json += " }";
 
                        list<shared_ptr<Job> >::iterator j = i;
                        ++j;
                        if (j != jobs.end ()) {
 
                        list<shared_ptr<Job> >::iterator j = i;
                        ++j;
                        if (j != jobs.end ()) {
-                               json << ", ";
+                               json += ", ";
                        }
                }
                        }
                }
-               json << "] }";
-
-               if (json.str().empty ()) {
-                       json << "{ }";
-               }
+               json += "] }";
        }
 
        }
 
-       locked_stringstream reply;
-       reply << "HTTP/1.1 200 OK\r\n"
-             << "Content-Length: " << json.str().length() << "\r\n"
-             << "Content-Type: application/json\r\n"
-                             << "\r\n"
-             << json.str () << "\r\n";
-       cout << "reply: " << json.str() << "\n";
-       boost::asio::write (*socket, boost::asio::buffer (reply.str().c_str(), reply.str().length()));
+       string reply = "HTTP/1.1 200 OK\r\n"
+               "Content-Length: " + raw_convert<string>(json.length()) + "\r\n"
+               "Content-Type: application/json\r\n"
+               "\r\n"
+               + json + "\r\n";
+       cout << "reply: " << json << "\n";
+       boost::asio::write (*socket, boost::asio::buffer (reply.c_str(), reply.length()));
 }
 }
index 5d1cb049209b6f102b28aeab22f86d8726f4a675..996b9bf79eb1077fe7db19346c2ca3ccfe7ccfa0 100644 (file)
@@ -18,6 +18,8 @@
 
 */
 
 
 */
 
+#include <boost/asio.hpp>
+
 class JSONServer
 {
 public:
 class JSONServer
 {
 public:
@@ -28,5 +30,3 @@ private:
        void handle (boost::shared_ptr<boost::asio::ip::tcp::socket> socket);
        void request (std::string url, boost::shared_ptr<boost::asio::ip::tcp::socket> socket);
 };
        void handle (boost::shared_ptr<boost::asio::ip::tcp::socket> socket);
        void request (std::string url, boost::shared_ptr<boost::asio::ip::tcp::socket> socket);
 };
-
-
index c8ba74f23615ff5fe2108cecb346f118136add62..e3ffd1cadcc05f4f114e107df4e870d46ce0a3f6 100644 (file)
@@ -26,7 +26,6 @@
 #include "cross.h"
 #include "config.h"
 #include "string_log_entry.h"
 #include "cross.h"
 #include "config.h"
 #include "string_log_entry.h"
-#include <locked_sstream.h>
 #include <time.h>
 #include <cstdio>
 
 #include <time.h>
 #include <cstdio>
 
index 53605c389546e04f139449348e932188241fab79..18eed489404b672aed23a835e35b9074e31ce9f2 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 #include "log_entry.h"
 */
 
 #include "log_entry.h"
-#include <locked_sstream.h>
+#include <inttypes.h>
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
@@ -42,28 +42,30 @@ LogEntry::LogEntry (int type)
 string
 LogEntry::get () const
 {
 string
 LogEntry::get () const
 {
-       locked_stringstream s;
+       string s;
        if (_type & TYPE_TIMING) {
        if (_type & TYPE_TIMING) {
-               s << _time.tv_sec << ":" << _time.tv_usec << " ";
+               char buffer[64];
+               snprintf (buffer, sizeof(buffer), "%" PRId64 ":%" PRId64 " ", static_cast<int64_t> (_time.tv_sec), static_cast<int64_t> (_time.tv_usec));
+               s += buffer;
        } else {
                char buffer[64];
                time_t const sec = _time.tv_sec;
                struct tm* t = localtime (&sec);
                strftime (buffer, 64, "%c", t);
                string a (buffer);
        } else {
                char buffer[64];
                time_t const sec = _time.tv_sec;
                struct tm* t = localtime (&sec);
                strftime (buffer, 64, "%c", t);
                string a (buffer);
-               s << a << N_(": ");
+               s += string(buffer) + N_(": ");
        }
 
        if (_type & TYPE_ERROR) {
        }
 
        if (_type & TYPE_ERROR) {
-               s << "ERROR: ";
+               s += "ERROR: ";
        }
 
        if (_type & TYPE_WARNING) {
        }
 
        if (_type & TYPE_WARNING) {
-               s << "WARNING: ";
+               s += "WARNING: ";
        }
 
        }
 
-       s << message ();
-       return s.str ();
+       s += message ();
+       return s;
 }
 
 double
 }
 
 double
index 69c1130fbcb385a3ef42b97b7f043155c7d4eb7c..3ee9b5c4c2902b080a93b25dc5670322821eac2c 100644 (file)
@@ -19,7 +19,6 @@
 */
 
 #include "string_log_entry.h"
 */
 
 #include "string_log_entry.h"
-#include <locked_sstream.h>
 
 #include "i18n.h"
 
 
 #include "i18n.h"
 
index 422bb65658e9e4a2afc160e1117a37c13d3ac470..c7dc948750634545dad34868a4f03b275c2ced80 100644 (file)
@@ -24,7 +24,6 @@
 #include "font.h"
 #include "raw_convert.h"
 #include "content.h"
 #include "font.h"
 #include "raw_convert.h"
 #include "content.h"
-#include <locked_sstream.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/foreach.hpp>
@@ -249,19 +248,18 @@ SubtitleContent::as_xml (xmlpp::Node* root) const
 string
 SubtitleContent::identifier () const
 {
 string
 SubtitleContent::identifier () const
 {
-       locked_stringstream s;
-       s << raw_convert<string> (x_scale())
-         << "_" << raw_convert<string> (y_scale())
-         << "_" << raw_convert<string> (x_offset())
-         << "_" << raw_convert<string> (y_offset())
-         << "_" << raw_convert<string> (line_spacing());
+       string s = raw_convert<string> (x_scale())
+               + "_" + raw_convert<string> (y_scale())
+               + "_" + raw_convert<string> (x_offset())
+               + "_" + raw_convert<string> (y_offset())
+               + "_" + raw_convert<string> (line_spacing());
 
        /* XXX: I suppose really _fonts shouldn't be in here, since not all
           types of subtitle content involve fonts.
        */
        BOOST_FOREACH (shared_ptr<Font> f, _fonts) {
                for (int i = 0; i < FontFiles::VARIANTS; ++i) {
 
        /* XXX: I suppose really _fonts shouldn't be in here, since not all
           types of subtitle content involve fonts.
        */
        BOOST_FOREACH (shared_ptr<Font> f, _fonts) {
                for (int i = 0; i < FontFiles::VARIANTS; ++i) {
-                       s << "_" << f->file(static_cast<FontFiles::Variant>(i)).get_value_or ("Default");
+                       s += "_" + f->file(static_cast<FontFiles::Variant>(i)).get_value_or("Default").string();
                }
        }
 
                }
        }
 
@@ -269,7 +267,7 @@ SubtitleContent::identifier () const
           how this content looks.
        */
 
           how this content looks.
        */
 
-       return s.str ();
+       return s;
 }
 
 void
 }
 
 void
index 8e56603302e1200382197965d51b8c0cbf0f1ee1..4eb2b1d290d6c6ed7d8c29adc7de2cd9c1e46f49 100644 (file)
@@ -28,7 +28,6 @@
 #include "film.h"
 #include "transcoder.h"
 #include "log.h"
 #include "film.h"
 #include "transcoder.h"
 #include "log.h"
-#include <locked_sstream.h>
 #include "compose.hpp"
 #include <iostream>
 #include <iomanip>
 #include "compose.hpp"
 #include <iostream>
 #include <iomanip>
@@ -112,18 +111,21 @@ TranscodeJob::status () const
                return Job::status ();
        }
 
                return Job::status ();
        }
 
-       locked_stringstream s;
-
-       s << Job::status ();
-
-       if (!finished () && !_transcoder->finishing ()) {
+       char buffer[256];
+       if (finished() || _transcoder->finishing()) {
+               strncpy (buffer, Job::status().c_str(), 256);
+       } else {
                /// TRANSLATORS: fps here is an abbreviation for frames per second
                /// TRANSLATORS: fps here is an abbreviation for frames per second
-               s << "; " << _transcoder->video_frames_enqueued() << "/"
-                 << _film->length().frames_round (_film->video_frame_rate ()) << " " << _("frames") << "; "
-                 << fixed << setprecision (1) << fps << " " << _("fps");
+               snprintf (
+                       buffer, sizeof(buffer), "%s; %d/%" PRId64 " frames; %.1f fps",
+                       Job::status().c_str(),
+                       _transcoder->video_frames_enqueued(),
+                       _film->length().frames_round (_film->video_frame_rate ()),
+                       fps
+                       );
        }
 
        }
 
-       return s.str ();
+       return buffer;
 }
 
 /** @return Approximate remaining time in seconds */
 }
 
 /** @return Approximate remaining time in seconds */
index e6ee851a0c5202a0c49e947a421f065f6ab5864d..6c1217f860b318266e84beb7208e13c07375438a 100644 (file)
@@ -22,7 +22,6 @@
 #include "version.h"
 #include "util.h"
 #include "raw_convert.h"
 #include "version.h"
 #include "util.h"
 #include "raw_convert.h"
-#include <locked_sstream.h>
 #include <libcxml/cxml.h>
 #include <curl/curl.h>
 #include <boost/algorithm/string.hpp>
 #include <libcxml/cxml.h>
 #include <curl/curl.h>
 #include <boost/algorithm/string.hpp>
index 1cf71ba32090a40963363d8abc37d065c9160124..5e870f1e2715f349ee3309f5f530e2133da32672 100644 (file)
@@ -36,7 +36,6 @@
 #include "digester.h"
 #include "audio_processor.h"
 #include "compose.hpp"
 #include "digester.h"
 #include "audio_processor.h"
 #include "compose.hpp"
-#include <locked_sstream.h>
 #include <dcp/util.h>
 #include <dcp/picture_asset.h>
 #include <dcp/sound_asset.h>
 #include <dcp/util.h>
 #include <dcp/picture_asset.h>
 #include <dcp/sound_asset.h>
@@ -115,14 +114,9 @@ seconds_to_hms (int s)
        int h = m / 60;
        m -= (h * 60);
 
        int h = m / 60;
        m -= (h * 60);
 
-       locked_stringstream hms;
-       hms << h << N_(":");
-       hms.width (2);
-       hms << setfill ('0') << m << N_(":");
-       hms.width (2);
-       hms << setfill ('0') << s;
-
-       return hms.str ();
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%d:%02d:%02d", h, m, s);
+       return buffer;
 }
 
 /** @param s Number of seconds.
 }
 
 /** @param s Number of seconds.
@@ -136,7 +130,7 @@ seconds_to_approximate_hms (int s)
        int h = m / 60;
        m -= (h * 60);
 
        int h = m / 60;
        m -= (h * 60);
 
-       locked_stringstream ap;
+       string ap;
 
        bool const hours = h > 0;
        bool const minutes = h < 6 && m > 0;
 
        bool const hours = h > 0;
        bool const minutes = h < 6 && m > 0;
@@ -145,14 +139,14 @@ seconds_to_approximate_hms (int s)
        if (hours) {
                if (m > 30 && !minutes) {
                        /// TRANSLATORS: h here is an abbreviation for hours
        if (hours) {
                if (m > 30 && !minutes) {
                        /// TRANSLATORS: h here is an abbreviation for hours
-                       ap << (h + 1) << _("h");
+                       ap += raw_convert<string>(h + 1) + _("h");
                } else {
                        /// TRANSLATORS: h here is an abbreviation for hours
                } else {
                        /// TRANSLATORS: h here is an abbreviation for hours
-                       ap << h << _("h");
+                       ap += raw_convert<string>(h) + _("h");
                }
 
                if (minutes || seconds) {
                }
 
                if (minutes || seconds) {
-                       ap << N_(" ");
+                       ap += N_(" ");
                }
        }
 
                }
        }
 
@@ -160,24 +154,24 @@ seconds_to_approximate_hms (int s)
                /* Minutes */
                if (s > 30 && !seconds) {
                        /// TRANSLATORS: m here is an abbreviation for minutes
                /* Minutes */
                if (s > 30 && !seconds) {
                        /// TRANSLATORS: m here is an abbreviation for minutes
-                       ap << (m + 1) << _("m");
+                       ap += raw_convert<string>(m + 1) + _("m");
                } else {
                        /// TRANSLATORS: m here is an abbreviation for minutes
                } else {
                        /// TRANSLATORS: m here is an abbreviation for minutes
-                       ap << m << _("m");
+                       ap += raw_convert<string>(m) + _("m");
                }
 
                if (seconds) {
                }
 
                if (seconds) {
-                       ap << N_(" ");
+                       ap += N_(" ");
                }
        }
 
        if (seconds) {
                /* Seconds */
                /// TRANSLATORS: s here is an abbreviation for seconds
                }
        }
 
        if (seconds) {
                /* Seconds */
                /// TRANSLATORS: s here is an abbreviation for seconds
-               ap << s << _("s");
+               ap += raw_convert<string>(s) + _("s");
        }
 
        }
 
-       return ap.str ();
+       return ap;
 }
 
 double
 }
 
 double
index 21c0b66614e3a3b9d88f476571443b27818ac68c..e786bb9c1a7a4251ffe7d5a5a9974f531348d83f 100644 (file)
@@ -32,6 +32,7 @@
 #include <boost/optional.hpp>
 #include <boost/filesystem.hpp>
 #include <string>
 #include <boost/optional.hpp>
 #include <boost/filesystem.hpp>
 #include <string>
+#include <map>
 #include <vector>
 
 #undef check
 #include <vector>
 
 #undef check
index 335f8c6dbf75f2a6bae9bda6a97f159d8acb6bf8..967522e3645166d8455b834060947d4b673db121 100644 (file)
@@ -31,7 +31,6 @@
 #include "frame_rate_change.h"
 #include "log.h"
 #include "raw_convert.h"
 #include "frame_rate_change.h"
 #include "log.h"
 #include "raw_convert.h"
-#include <locked_sstream.h>
 #include <libcxml/cxml.h>
 #include <dcp/colour_matrix.h>
 #include <libxml++/libxml++.h>
 #include <libcxml/cxml.h>
 #include <dcp/colour_matrix.h>
 #include <libxml++/libxml++.h>
@@ -264,20 +263,25 @@ VideoContent::take_from_examiner (shared_ptr<VideoExaminer> d)
 string
 VideoContent::identifier () const
 {
 string
 VideoContent::identifier () const
 {
-       locked_stringstream s;
-       s << crop().left
-         << "_" << crop().right
-         << "_" << crop().top
-         << "_" << crop().bottom
-         << "_" << scale().id()
-         << "_" << _fade_in
-         << "_" << _fade_out;
+       char buffer[256];
+       snprintf (
+               buffer, sizeof(buffer), "%d_%d_%d_%d_%s_%" PRId64 "_%" PRId64,
+               crop().left,
+               crop().right,
+               crop().top,
+               crop().bottom,
+               scale().id().c_str(),
+               _fade_in,
+               _fade_out
+               );
+
+       string s (buffer);
 
        if (colour_conversion()) {
 
        if (colour_conversion()) {
-               s << "_" << colour_conversion().get().identifier ();
+               s += "_" + colour_conversion().get().identifier ();
        }
 
        }
 
-       return s.str ();
+       return s;
 }
 
 string
 }
 
 string
@@ -376,11 +380,11 @@ VideoContent::fade (Frame f) const
 string
 VideoContent::processing_description () const
 {
 string
 VideoContent::processing_description () const
 {
-       /* stringstream is OK here as this string is just for presentation to the user */
-       locked_stringstream d;
+       string d;
+       char buffer[256];
 
        if (size().width && size().height) {
 
        if (size().width && size().height) {
-               d << String::compose (
+               d += String::compose (
                        _("Content video is %1x%2"),
                        size_after_3d_split().width,
                        size_after_3d_split().height
                        _("Content video is %1x%2"),
                        size_after_3d_split().width,
                        size_after_3d_split().height
@@ -390,21 +394,24 @@ VideoContent::processing_description () const
                double ratio = size_after_3d_split().ratio ();
 
                if (sample_aspect_ratio ()) {
                double ratio = size_after_3d_split().ratio ();
 
                if (sample_aspect_ratio ()) {
-                       d << ", " << _("pixel aspect ratio") << " " << fixed << setprecision(2) << sample_aspect_ratio().get () << ":1";
+                       snprintf (buffer, sizeof(buffer), _(", pixel aspect ratio %.2f:1"), sample_aspect_ratio().get());
+                       d += buffer;
                        ratio *= sample_aspect_ratio().get ();
                }
 
                        ratio *= sample_aspect_ratio().get ();
                }
 
-               d << "\n" << _("Display aspect ratio") << " " << fixed << setprecision(2) << ratio << ":1\n";
+               snprintf (buffer, sizeof(buffer), _("\nDisplay aspect ratio %.2f:1"), ratio);
+               d += buffer;
        }
 
        if ((crop().left || crop().right || crop().top || crop().bottom) && size() != dcp::Size (0, 0)) {
                dcp::Size cropped = size_after_crop ();
        }
 
        if ((crop().left || crop().right || crop().top || crop().bottom) && size() != dcp::Size (0, 0)) {
                dcp::Size cropped = size_after_crop ();
-               d << String::compose (
+               d += String::compose (
                        _("Cropped to %1x%2"),
                        cropped.width, cropped.height
                        );
 
                        _("Cropped to %1x%2"),
                        cropped.width, cropped.height
                        );
 
-               d << " (" << fixed << setprecision(2) << cropped.ratio () << ":1)\n";
+               snprintf (buffer, sizeof(buffer), " (%.2f:1)\n", cropped.ratio());
+               d += buffer;
        }
 
        shared_ptr<const Film> film = _parent->film ();
        }
 
        shared_ptr<const Film> film = _parent->film ();
@@ -412,35 +419,37 @@ VideoContent::processing_description () const
        dcp::Size const scaled = scale().size (shared_from_this(), container_size, container_size);
 
        if (scaled != size_after_crop ()) {
        dcp::Size const scaled = scale().size (shared_from_this(), container_size, container_size);
 
        if (scaled != size_after_crop ()) {
-               d << String::compose (
+               d += String::compose (
                        _("Scaled to %1x%2"),
                        scaled.width, scaled.height
                        );
 
                        _("Scaled to %1x%2"),
                        scaled.width, scaled.height
                        );
 
-               d << " (" << fixed << setprecision(2) << scaled.ratio() << ":1)\n";
+               snprintf (buffer, sizeof(buffer), _(" (%.2f:1)\n"), scaled.ratio());
+               d += buffer;
        }
 
        if (scaled != container_size) {
        }
 
        if (scaled != container_size) {
-               d << String::compose (
+               d += String::compose (
                        _("Padded with black to fit container %1 (%2x%3)"),
                        film->container()->nickname (),
                        container_size.width, container_size.height
                        );
 
                        _("Padded with black to fit container %1 (%2x%3)"),
                        film->container()->nickname (),
                        container_size.width, container_size.height
                        );
 
-               d << " (" << fixed << setprecision(2) << container_size.ratio () << ":1)\n";
+               snprintf (buffer, sizeof(buffer), _(" (%.2f:1)\n"), container_size.ratio());
+               d += buffer;
        }
 
        if (_parent->video_frame_rate()) {
                double const vfr = _parent->video_frame_rate().get ();
 
        }
 
        if (_parent->video_frame_rate()) {
                double const vfr = _parent->video_frame_rate().get ();
 
-               d << _("Content frame rate");
-               d << " " << fixed << setprecision(4) << vfr << "\n";
+               snprintf (buffer, sizeof(buffer), _("Content frame rate %.4f\n"), vfr);
+               d += buffer;
 
                FrameRateChange frc (vfr, film->video_frame_rate ());
 
                FrameRateChange frc (vfr, film->video_frame_rate ());
-               d << frc.description () << "\n";
+               d += frc.description () + "\n";
        }
 
        }
 
-       return d.str ();
+       return d;
 }
 
 void
 }
 
 void
index 47ceab5d1f2f4516f21b071081e4d298abf2f419..c86ba6ef8a9995cdc8bf7f5c23e1958f5a3a16b3 100644 (file)
@@ -22,7 +22,6 @@
 #include "video_content.h"
 #include "ratio.h"
 #include "util.h"
 #include "video_content.h"
 #include "ratio.h"
 #include "util.h"
-#include <locked_sstream.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/optional.hpp>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/optional.hpp>
@@ -85,15 +84,11 @@ VideoContentScale::as_xml (xmlpp::Node* node) const
 string
 VideoContentScale::id () const
 {
 string
 VideoContentScale::id () const
 {
-       locked_stringstream s;
-
        if (_ratio) {
        if (_ratio) {
-               s << _ratio->id ();
-       } else {
-               s << (_scale ? "S1" : "S0");
+               return _ratio->id ();
        }
 
        }
 
-       return s.str ();
+       return (_scale ? "S1" : "S0");
 }
 
 string
 }
 
 string
index 3549e0947a22412794a7a91e1725e31ae64bc0b6..534dd6142fce4e9765245f6b25df273e68e427fe 100644 (file)
@@ -84,14 +84,9 @@ VideoFilterGraph::can_process (dcp::Size s, AVPixelFormat p) const
 string
 VideoFilterGraph::src_parameters () const
 {
 string
 VideoFilterGraph::src_parameters () const
 {
-       locked_stringstream a;
-
-       a << "video_size=" << _size.width << "x" << _size.height << ":"
-         << "pix_fmt=" << _pixel_format << ":"
-         << "time_base=1/1:"
-         << "pixel_aspect=1/1";
-
-       return a.str ();
+       char buffer[256];
+       snprintf (buffer, sizeof(buffer), "video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=1/1", _size.width, _size.height, _pixel_format);
+       return buffer;
 }
 
 void *
 }
 
 void *
index 85099062f1493e7f742f8297a1c34d2d8ae8de19..bb65c1f2b9b7584ab8b93ad854f5ee6ef1711c32 100644 (file)
@@ -319,9 +319,9 @@ try
                                LOG_WARNING (N_("Finishing writer with a left-over queue of %1:"), _queue.size());
                                for (list<QueueItem>::const_iterator i = _queue.begin(); i != _queue.end(); ++i) {
                                        if (i->type == QueueItem::FULL) {
                                LOG_WARNING (N_("Finishing writer with a left-over queue of %1:"), _queue.size());
                                for (list<QueueItem>::const_iterator i = _queue.begin(); i != _queue.end(); ++i) {
                                        if (i->type == QueueItem::FULL) {
-                                               LOG_WARNING (N_("- type FULL, frame %1, eyes %2"), i->frame, i->eyes);
+                                               LOG_WARNING (N_("- type FULL, frame %1, eyes %2"), i->frame, (int) i->eyes);
                                        } else {
                                        } else {
-                                               LOG_WARNING (N_("- type FAKE, size %1, frame %2, eyes %3"), i->size, i->frame, i->eyes);
+                                               LOG_WARNING (N_("- type FAKE, size %1, frame %2, eyes %3"), i->size, i->frame, (int) i->eyes);
                                        }
                                }
                        }
                                        }
                                }
                        }
@@ -342,7 +342,7 @@ try
 
                        switch (qi.type) {
                        case QueueItem::FULL:
 
                        switch (qi.type) {
                        case QueueItem::FULL:
-                               LOG_DEBUG_ENCODE (N_("Writer FULL-writes %1 (%2)"), qi.frame, qi.eyes);
+                               LOG_DEBUG_ENCODE (N_("Writer FULL-writes %1 (%2)"), qi.frame, (int) qi.eyes);
                                if (!qi.encoded) {
                                        qi.encoded = Data (_film->j2c_path (qi.reel, qi.frame, qi.eyes, false));
                                }
                                if (!qi.encoded) {
                                        qi.encoded = Data (_film->j2c_path (qi.reel, qi.frame, qi.eyes, false));
                                }
index cd827016d6bd1f710a18e0268185f24d04a2c348..7c7b39b0423616674b1439f67fe61013d9fd0ef6 100644 (file)
@@ -75,6 +75,7 @@
 #include <boost/noncopyable.hpp>
 #include <iostream>
 #include <fstream>
 #include <boost/noncopyable.hpp>
 #include <iostream>
 #include <fstream>
+/* This is OK as it's only used with DCPOMATIC_WINDOWS */
 #include <sstream>
 
 #ifdef check
 #include <sstream>
 
 #ifdef check
@@ -900,12 +901,13 @@ private:
                }
 
                for (size_t i = 0; i < history.size(); ++i) {
                }
 
                for (size_t i = 0; i < history.size(); ++i) {
-                       locked_stringstream s;
+                       string s;
                        if (i < 9) {
                        if (i < 9) {
-                               s << "&" << (i + 1) << " ";
+                               s = String::compose ("&%1 %2", i + 1, history[i].string());
+                       } else {
+                               s = history[i].string();
                        }
                        }
-                       s << history[i].string();
-                       _file_menu->Insert (pos++, ID_file_history + i, std_to_wx (s.str ()));
+                       _file_menu->Insert (pos++, ID_file_history + i, std_to_wx (s));
                }
 
                _history_items = history.size ();
                }
 
                _history_items = history.size ();
index de89a9c7c2446f120c20f72ec5203a63e3a368e6..5126e1954c10405b1929c2acf0a72e1b188afa11 100644 (file)
@@ -29,7 +29,6 @@
 #include "lib/config.h"
 #include "lib/exceptions.h"
 #include "lib/emailer.h"
 #include "lib/config.h"
 #include "lib/exceptions.h"
 #include "lib/emailer.h"
-#include <locked_sstream.h>
 #include <dcp/certificate.h>
 #include <getopt.h>
 #include <iostream>
 #include <dcp/certificate.h>
 #include <getopt.h>
 #include <iostream>
@@ -82,10 +81,10 @@ time_from_string (string t)
 static boost::posix_time::time_duration
 duration_from_string (string d)
 {
 static boost::posix_time::time_duration
 duration_from_string (string d)
 {
-       locked_stringstream s (d);
        int N;
        int N;
-       string unit;
-       s >> N >> unit;
+       char unit_buf[64] = "\0";
+       sscanf (d.c_str(), "%d %64s", &N, unit_buf);
+       string const unit (unit_buf);
 
        if (N == 0) {
                cerr << "Could not understand duration \"" << d << "\"\n";
 
        if (N == 0) {
                cerr << "Could not understand duration \"" << d << "\"\n";
index 08a04f35cda0e753b240c40dd87630ae0beda87a..4e9d5592dcdd875882c61f9aa6b0f886372ced1c 100644 (file)
@@ -191,9 +191,7 @@ private:
 
        void update_state ()
        {
 
        void update_state ()
        {
-               locked_stringstream s;
-               s << fixed << setprecision(1) << server_log->fps ();
-               _fps->SetLabel (std_to_wx (s.str()));
+               _fps->SetLabel (wxString::Format ("%.1f", server_log->fps()));
        }
 
        wxTextCtrl* _text;
        }
 
        wxTextCtrl* _text;
index 79365bf88e52534fcea6ff45113da6cc6172c532..3d4363cb970e65c6e1008d7569b54c5ffafde478 100644 (file)
@@ -22,7 +22,6 @@
 #include "lib/raw_convert.h"
 #include "wx_util.h"
 #include "colour_conversion_editor.h"
 #include "lib/raw_convert.h"
 #include "wx_util.h"
 #include "colour_conversion_editor.h"
-#include <locked_sstream.h>
 #include <dcp/gamma_transfer_function.h>
 #include <dcp/modified_gamma_transfer_function.h>
 #include <wx/spinctrl.h>
 #include <dcp/gamma_transfer_function.h>
 #include <dcp/modified_gamma_transfer_function.h>
 #include <wx/spinctrl.h>
@@ -247,51 +246,32 @@ ColourConversionEditor::set (ColourConversion conversion)
 
        _ignore_chromaticity_changed = true;
 
 
        _ignore_chromaticity_changed = true;
 
-       locked_stringstream s;
-       s.setf (std::ios::fixed, std::ios::floatfield);
-       s.precision (6);
-
-       s << conversion.red().x;
-       _red_x->SetValue (std_to_wx (s.str ()));
-
-       s.str ("");
-       s << conversion.red().y;
-       _red_y->SetValue (std_to_wx (s.str ()));
-
-       s.str ("");
-       s << conversion.green().x;
-       _green_x->SetValue (std_to_wx (s.str ()));
-
-       s.str ("");
-       s << conversion.green().y;
-       _green_y->SetValue (std_to_wx (s.str ()));
-
-       s.str ("");
-       s << conversion.blue().x;
-       _blue_x->SetValue (std_to_wx (s.str ()));
-
-       s.str ("");
-       s << conversion.blue().y;
-       _blue_y->SetValue (std_to_wx (s.str ()));
-
-       s.str ("");
-       s << conversion.white().x;
-       _white_x->SetValue (std_to_wx (s.str ()));
-
-       s.str ("");
-       s << conversion.white().y;
-       _white_y->SetValue (std_to_wx (s.str ()));
+       char buffer[256];
+       snprintf (buffer, sizeof (buffer), "%.6f", conversion.red().x);
+       _red_x->SetValue (std_to_wx (buffer));
+       snprintf (buffer, sizeof (buffer), "%.6f", conversion.red().y);
+       _red_y->SetValue (std_to_wx (buffer));
+       snprintf (buffer, sizeof (buffer), "%.6f", conversion.green().x);
+       _green_x->SetValue (std_to_wx (buffer));
+       snprintf (buffer, sizeof (buffer), "%.6f", conversion.green().y);
+       _green_y->SetValue (std_to_wx (buffer));
+       snprintf (buffer, sizeof (buffer), "%.6f", conversion.blue().x);
+       _blue_x->SetValue (std_to_wx (buffer));
+       snprintf (buffer, sizeof (buffer), "%.6f", conversion.blue().y);
+       _blue_y->SetValue (std_to_wx (buffer));
+       snprintf (buffer, sizeof (buffer), "%.6f", conversion.white().x);
+       _white_x->SetValue (std_to_wx (buffer));
+       snprintf (buffer, sizeof (buffer), "%.6f", conversion.white().y);
+       _white_y->SetValue (std_to_wx (buffer));
 
        _ignore_chromaticity_changed = false;
 
        if (conversion.adjusted_white ()) {
                _adjust_white->SetValue (true);
 
        _ignore_chromaticity_changed = false;
 
        if (conversion.adjusted_white ()) {
                _adjust_white->SetValue (true);
-               s.str ("");
-               s << conversion.adjusted_white().get().x;
-               _adjusted_white_x->SetValue (std_to_wx (s.str ()));
-               s.str ("");
-               s << conversion.adjusted_white().get().y;
-               _adjusted_white_y->SetValue (std_to_wx (s.str ()));
+               snprintf (buffer, sizeof (buffer), "%.6f", conversion.adjusted_white().get().x);
+               _adjusted_white_x->SetValue (std_to_wx (buffer));
+               snprintf (buffer, sizeof (buffer), "%.6f", conversion.adjusted_white().get().y);
+               _adjusted_white_y->SetValue (std_to_wx (buffer));
        } else {
                _adjust_white->SetValue (false);
        }
        } else {
                _adjust_white->SetValue (false);
        }
@@ -394,11 +374,9 @@ ColourConversionEditor::update_bradford ()
        boost::numeric::ublas::matrix<double> m = get().bradford ();
        for (int i = 0; i < 3; ++i) {
                for (int j = 0; j < 3; ++j) {
        boost::numeric::ublas::matrix<double> m = get().bradford ();
        for (int i = 0; i < 3; ++i) {
                for (int j = 0; j < 3; ++j) {
-                       locked_stringstream s;
-                       s.setf (std::ios::fixed, std::ios::floatfield);
-                       s.precision (7);
-                       s << m (i, j);
-                       _bradford[i][j]->SetLabel (std_to_wx (s.str ()));
+                       char buffer[256];
+                       snprintf (buffer, sizeof (buffer), "%.7f", m (i, j));
+                       _bradford[i][j]->SetLabel (std_to_wx (buffer));
                }
        }
 }
                }
        }
 }
@@ -409,11 +387,9 @@ ColourConversionEditor::update_rgb_to_xyz ()
        boost::numeric::ublas::matrix<double> m = get().rgb_to_xyz ();
        for (int i = 0; i < 3; ++i) {
                for (int j = 0; j < 3; ++j) {
        boost::numeric::ublas::matrix<double> m = get().rgb_to_xyz ();
        for (int i = 0; i < 3; ++i) {
                for (int j = 0; j < 3; ++j) {
-                       locked_stringstream s;
-                       s.setf (std::ios::fixed, std::ios::floatfield);
-                       s.precision (7);
-                       s << m (i, j);
-                       _rgb_to_xyz[i][j]->SetLabel (std_to_wx (s.str ()));
+                       char buffer[256];
+                       snprintf (buffer, sizeof (buffer), "%.7f", m (i, j));
+                       _rgb_to_xyz[i][j]->SetLabel (std_to_wx (buffer));
                }
        }
 }
                }
        }
 }
@@ -442,8 +418,7 @@ ColourConversionEditor::set_spin_ctrl (wxSpinCtrlDouble* control, double value)
 void
 ColourConversionEditor::set_text_ctrl (wxTextCtrl* control, double value)
 {
 void
 ColourConversionEditor::set_text_ctrl (wxTextCtrl* control, double value)
 {
-       locked_stringstream s;
-       s.precision (7);
-       s << value;
-       control->SetValue (std_to_wx (s.str ()));
+       char buffer[256];
+       snprintf (buffer, sizeof (buffer), "%.7f", value);
+       control->SetValue (std_to_wx (buffer));
 }
 }
index fcff93a068a2d0c3b9a38f15fb2f0e67e2eb2301..18a0ed66ec34ba63e8156065329cc15ca1048873 100644 (file)
@@ -205,12 +205,12 @@ DolbyDoremiCertificatePanel::finish_download (string serial, wxStaticText* messa
        } else {
                message->SetLabel (wxT (""));
 
        } else {
                message->SetLabel (wxT (""));
 
-               locked_stringstream s;
+               string s;
                BOOST_FOREACH (string e, errors) {
                BOOST_FOREACH (string e, errors) {
-                       s << e << "\n";
+                       s += e + "\n";
                }
 
                }
 
-               error_dialog (this, std_to_wx (s.str ()));
+               error_dialog (this, std_to_wx (s));
        }
 }
 
        }
 }
 
index a18182138af0be609e4136315d329333f80ef4d8..4706c896b03bc0cfad3c87c151f8dd853e3bf79a 100644 (file)
@@ -80,11 +80,8 @@ TimePicker::update_text ()
 
        _block_update = true;
 
 
        _block_update = true;
 
-       _hours->SetValue (std_to_wx (raw_convert<string> (_hours_spin->GetValue ())));
-
-       locked_stringstream m;
-       m << setfill('0') << setw(2) << _minutes_spin->GetValue();
-       _minutes->SetValue (std_to_wx (m.str()));
+       _hours->SetValue (wxString::Format ("%d", _hours_spin->GetValue ()));
+       _minutes->SetValue (wxString::Format ("%02d", _minutes_spin->GetValue ()));
 
        _block_update = false;
 
 
        _block_update = false;
 
index 278ea06d9962701562ece6545735bff644d653ef..c960884a1ef9d6c2b6ae3eacfcf5700090fdd47b 100644 (file)
@@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE (audio_analysis_serialisation_test)
        BOOST_CHECK (b.sample_peak ());
        BOOST_CHECK_CLOSE (b.sample_peak().get(), peak, 1);
        BOOST_CHECK (b.sample_peak_time ());
        BOOST_CHECK (b.sample_peak ());
        BOOST_CHECK_CLOSE (b.sample_peak().get(), peak, 1);
        BOOST_CHECK (b.sample_peak_time ());
-       BOOST_CHECK_EQUAL (b.sample_peak_time().get(), peak_time);
+       BOOST_CHECK_EQUAL (b.sample_peak_time().get().get(), peak_time.get());
 }
 
 static void
 }
 
 static void
index d45ac603e4961c433fc2d72e8f40d938ed857105..27dd87bbf940d416ae4e508f2b16563a02265549 100644 (file)
@@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_test)
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
        film->examine_and_add_content (content);
        wait_for_jobs ();
 
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (2));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(2).get());
 
        content->subtitle->set_use (true);
        content->subtitle->set_burn (false);
 
        content->subtitle->set_use (true);
        content->subtitle->set_burn (false);
@@ -82,10 +82,10 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test)
                );
 
        BOOST_REQUIRE_EQUAL (ctp.size(), 2);
                );
 
        BOOST_REQUIRE_EQUAL (ctp.size(), 2);
-       BOOST_CHECK_EQUAL (ctp.front().from, ContentTime::from_seconds (25 + 12 * 0.04));
-       BOOST_CHECK_EQUAL (ctp.front().to, ContentTime::from_seconds (26 + 4 * 0.04));
-       BOOST_CHECK_EQUAL (ctp.back().from, ContentTime::from_seconds (25 + 12 * 0.04));
-       BOOST_CHECK_EQUAL (ctp.back().to, ContentTime::from_seconds (26 + 4 * 0.04));
+       BOOST_CHECK_EQUAL (ctp.front().from.get(), ContentTime::from_seconds(25 + 12 * 0.04).get());
+       BOOST_CHECK_EQUAL (ctp.front().to.get(), ContentTime::from_seconds(26 + 4 * 0.04).get());
+       BOOST_CHECK_EQUAL (ctp.back().from.get(), ContentTime::from_seconds(25 + 12 * 0.04).get());
+       BOOST_CHECK_EQUAL (ctp.back().to.get(), ContentTime::from_seconds(26 + 4 * 0.04).get());
 
        list<ContentTextSubtitle> subs = decoder->subtitle->get_text (
                ContentTimePeriod (
 
        list<ContentTextSubtitle> subs = decoder->subtitle->get_text (
                ContentTimePeriod (
index 6dd4094dafbfb85510bea1a7ce719e194741d35a..ae03d91c0e09a3c9ec36f76d508ae7210d2876a1 100644 (file)
@@ -65,10 +65,10 @@ BOOST_AUTO_TEST_CASE (dcpomatic_time_period_overlaps_test)
        /* Some overlaps */
        a = TimePeriod<DCPTime> (DCPTime (0), DCPTime (4));
        b = TimePeriod<DCPTime> (DCPTime (3), DCPTime (8));
        /* Some overlaps */
        a = TimePeriod<DCPTime> (DCPTime (0), DCPTime (4));
        b = TimePeriod<DCPTime> (DCPTime (3), DCPTime (8));
-       BOOST_CHECK (a.overlap (b));
-       BOOST_CHECK_EQUAL (a.overlap(b).get(), DCPTimePeriod(DCPTime(3), DCPTime(4)));
+       BOOST_CHECK (a.overlap(b));
+       BOOST_CHECK (a.overlap(b).get() == DCPTimePeriod(DCPTime(3), DCPTime(4)));
        a = TimePeriod<DCPTime> (DCPTime (1), DCPTime (9));
        b = TimePeriod<DCPTime> (DCPTime (0), DCPTime (10));
        a = TimePeriod<DCPTime> (DCPTime (1), DCPTime (9));
        b = TimePeriod<DCPTime> (DCPTime (0), DCPTime (10));
-       BOOST_CHECK (a.overlap (b));
-       BOOST_CHECK_EQUAL (a.overlap(b).get(), DCPTimePeriod(DCPTime(1), DCPTime(9)));
+       BOOST_CHECK (a.overlap(b));
+       BOOST_CHECK (a.overlap(b).get() == DCPTimePeriod(DCPTime(1), DCPTime(9)));
 }
 }
index 13846a8a16bff016609efa9a85357e8b7b5d8fb5..4113160899b7aa63b920bf96455193e1f6f5be0a 100644 (file)
@@ -37,7 +37,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_examiner_test)
        shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/count300bd24.m2ts"));
        shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (content));
 
        shared_ptr<FFmpegContent> content (new FFmpegContent (film, "test/data/count300bd24.m2ts"));
        shared_ptr<FFmpegExaminer> examiner (new FFmpegExaminer (content));
 
-       BOOST_CHECK_EQUAL (examiner->first_video().get(), ContentTime::from_seconds (600));
+       BOOST_CHECK_EQUAL (examiner->first_video().get().get(), ContentTime::from_seconds(600).get());
        BOOST_CHECK_EQUAL (examiner->audio_streams().size(), 1U);
        BOOST_CHECK_EQUAL (examiner->audio_streams().size(), 1U);
-       BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->first_audio.get(), ContentTime::from_seconds (600));
+       BOOST_CHECK_EQUAL (examiner->audio_streams()[0]->first_audio.get().get(), ContentTime::from_seconds(600).get());
 }
 }
index 05c4e15c8dcdce222e14d1b62412c230d94f1aa4..f9371f74ca7196e769dcc869c8053498a12e157c 100644 (file)
@@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
                content->_first_video = ContentTime ();
                content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
                FFmpegDecoder decoder (content, film->log());
                content->_first_video = ContentTime ();
                content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
                FFmpegDecoder decoder (content, film->log());
-               BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
+               BOOST_CHECK_EQUAL (decoder._pts_offset.get(), 0);
        }
 
        {
        }
 
        {
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
                content->_first_video = ContentTime::from_seconds (600);
                content->ffmpeg_audio_streams().front()->first_audio = ContentTime::from_seconds (600);
                FFmpegDecoder decoder (content, film->log());
                content->_first_video = ContentTime::from_seconds (600);
                content->ffmpeg_audio_streams().front()->first_audio = ContentTime::from_seconds (600);
                FFmpegDecoder decoder (content, film->log());
-               BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime::from_seconds (-600));
+               BOOST_CHECK_EQUAL (decoder._pts_offset.get(), ContentTime::from_seconds(-600).get());
        }
 
        {
        }
 
        {
@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_pts_offset_test)
                content->_first_video = ContentTime::from_frames (1, 24);
                content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
                FFmpegDecoder decoder (content, film->log());
                content->_first_video = ContentTime::from_frames (1, 24);
                content->ffmpeg_audio_streams().front()->first_audio = ContentTime ();
                FFmpegDecoder decoder (content, film->log());
-               BOOST_CHECK_EQUAL (decoder._pts_offset, ContentTime ());
+               BOOST_CHECK_EQUAL (decoder._pts_offset.get(), 0);
        }
 
        {
        }
 
        {
index 1b628f72a3034d051f7cfe02a71c28a3ee99d237..57db3d778214bce9b5f1d455e97f275f900d98af 100644 (file)
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE (player_overlaps_test)
        film->examine_and_add_content (C);
        wait_for_jobs ();
 
        film->examine_and_add_content (C);
        wait_for_jobs ();
 
-       BOOST_CHECK_EQUAL (A->full_length(), DCPTime (288000));
+       BOOST_CHECK_EQUAL (A->full_length().get(), 288000);
 
        A->set_position (DCPTime::from_seconds (0));
        B->set_position (DCPTime::from_seconds (10));
 
        A->set_position (DCPTime::from_seconds (0));
        B->set_position (DCPTime::from_seconds (10));
index 50b4622e2a33f6c6a0bd509ada4ce1bd87778220..9718898e256547f7df4fd0b8fdbded98f5242a53 100644 (file)
@@ -43,21 +43,21 @@ BOOST_AUTO_TEST_CASE (reels_test1)
        shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/test.mp4"));
        film->examine_and_add_content (B);
        wait_for_jobs ();
        shared_ptr<FFmpegContent> B (new FFmpegContent (film, "test/data/test.mp4"));
        film->examine_and_add_content (B);
        wait_for_jobs ();
-       BOOST_CHECK_EQUAL (A->full_length(), DCPTime (288000));
+       BOOST_CHECK_EQUAL (A->full_length().get(), 288000);
 
        film->set_reel_type (REELTYPE_SINGLE);
        list<DCPTimePeriod> r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 1);
 
        film->set_reel_type (REELTYPE_SINGLE);
        list<DCPTimePeriod> r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 1);
-       BOOST_CHECK_EQUAL (r.front().from, DCPTime (0));
-       BOOST_CHECK_EQUAL (r.front().to, DCPTime (288000 * 2));
+       BOOST_CHECK_EQUAL (r.front().from.get(), 0);
+       BOOST_CHECK_EQUAL (r.front().to.get(), 288000 * 2);
 
        film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
        r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 2);
 
        film->set_reel_type (REELTYPE_BY_VIDEO_CONTENT);
        r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 2);
-       BOOST_CHECK_EQUAL (r.front().from, DCPTime (0));
-       BOOST_CHECK_EQUAL (r.front().to, DCPTime (288000));
-       BOOST_CHECK_EQUAL (r.back().from, DCPTime (288000));
-       BOOST_CHECK_EQUAL (r.back().to, DCPTime (288000 * 2));
+       BOOST_CHECK_EQUAL (r.front().from.get(), 0);
+       BOOST_CHECK_EQUAL (r.front().to.get(), 288000);
+       BOOST_CHECK_EQUAL (r.back().from.get(), 288000);
+       BOOST_CHECK_EQUAL (r.back().to.get(), 288000 * 2);
 
        film->set_j2k_bandwidth (100000000);
        film->set_reel_type (REELTYPE_BY_LENGTH);
 
        film->set_j2k_bandwidth (100000000);
        film->set_reel_type (REELTYPE_BY_LENGTH);
@@ -66,14 +66,14 @@ BOOST_AUTO_TEST_CASE (reels_test1)
        r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 3);
        list<DCPTimePeriod>::const_iterator i = r.begin ();
        r = film->reels ();
        BOOST_CHECK_EQUAL (r.size(), 3);
        list<DCPTimePeriod>::const_iterator i = r.begin ();
-       BOOST_CHECK_EQUAL (i->from, DCPTime (0));
-       BOOST_CHECK_EQUAL (i->to, DCPTime::from_frames (60, 24));
+       BOOST_CHECK_EQUAL (i->from.get(), 0);
+       BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_frames(60, 24).get());
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime::from_frames (60, 24));
-       BOOST_CHECK_EQUAL (i->to, DCPTime::from_frames (120, 24));
+       BOOST_CHECK_EQUAL (i->from.get(), DCPTime::from_frames(60, 24).get());
+       BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_frames(120, 24).get());
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime::from_frames (120, 24));
-       BOOST_CHECK_EQUAL (i->to, DCPTime::from_frames (144, 24));
+       BOOST_CHECK_EQUAL (i->from.get(), DCPTime::from_frames(120, 24).get());
+       BOOST_CHECK_EQUAL (i->to.get(), DCPTime::from_frames(144, 24).get());
 }
 
 /** Make a short DCP with multi reels split by video content, then import
 }
 
 /** Make a short DCP with multi reels split by video content, then import
@@ -128,14 +128,14 @@ BOOST_AUTO_TEST_CASE (reels_test2)
        list<DCPTimePeriod> r = film2->reels ();
        BOOST_CHECK_EQUAL (r.size(), 3);
        list<DCPTimePeriod>::const_iterator i = r.begin ();
        list<DCPTimePeriod> r = film2->reels ();
        BOOST_CHECK_EQUAL (r.size(), 3);
        list<DCPTimePeriod>::const_iterator i = r.begin ();
-       BOOST_CHECK_EQUAL (i->from, DCPTime (0));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000));
+       BOOST_CHECK_EQUAL (i->from.get(), 0);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000);
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime (96000));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000 * 2));
+       BOOST_CHECK_EQUAL (i->from.get(), 96000);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000 * 2);
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime (96000 * 2));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000 * 3));
+       BOOST_CHECK_EQUAL (i->from.get(), 96000 * 2);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000 * 3);
 
        c->set_reference_video (true);
        c->set_reference_audio (true);
 
        c->set_reference_video (true);
        c->set_reference_audio (true);
@@ -164,17 +164,17 @@ BOOST_AUTO_TEST_CASE (reels_test3)
        list<DCPTimePeriod> reels = film->reels();
        BOOST_REQUIRE_EQUAL (reels.size(), 4);
        list<DCPTimePeriod>::const_iterator i = reels.begin ();
        list<DCPTimePeriod> reels = film->reels();
        BOOST_REQUIRE_EQUAL (reels.size(), 4);
        list<DCPTimePeriod>::const_iterator i = reels.begin ();
-       BOOST_CHECK_EQUAL (i->from, DCPTime (0));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000));
+       BOOST_CHECK_EQUAL (i->from.get(), 0);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000);
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime (96000));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000 * 2));
+       BOOST_CHECK_EQUAL (i->from.get(), 96000);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000 * 2);
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime (96000 * 2));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000 * 3));
+       BOOST_CHECK_EQUAL (i->from.get(), 96000 * 2);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000 * 3);
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime (96000 * 3));
-       BOOST_CHECK_EQUAL (i->to, sub->full_length().round_up (film->video_frame_rate()));
+       BOOST_CHECK_EQUAL (i->from.get(), 96000 * 3);
+       BOOST_CHECK_EQUAL (i->to.get(), sub->full_length().round_up(film->video_frame_rate()).get());
 }
 
 /** Check creation of a multi-reel DCP with a single .srt subtitle file;
 }
 
 /** Check creation of a multi-reel DCP with a single .srt subtitle file;
@@ -204,17 +204,17 @@ BOOST_AUTO_TEST_CASE (reels_test4)
        list<DCPTimePeriod> reels = film->reels();
        BOOST_REQUIRE_EQUAL (reels.size(), 4);
        list<DCPTimePeriod>::const_iterator i = reels.begin ();
        list<DCPTimePeriod> reels = film->reels();
        BOOST_REQUIRE_EQUAL (reels.size(), 4);
        list<DCPTimePeriod>::const_iterator i = reels.begin ();
-       BOOST_CHECK_EQUAL (i->from, DCPTime (0));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000));
+       BOOST_CHECK_EQUAL (i->from.get(), 0);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000);
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime (96000));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000 * 2));
+       BOOST_CHECK_EQUAL (i->from.get(), 96000);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000 * 2);
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime (96000 * 2));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000 * 3));
+       BOOST_CHECK_EQUAL (i->from.get(), 96000 * 2);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000 * 3);
        ++i;
        ++i;
-       BOOST_CHECK_EQUAL (i->from, DCPTime (96000 * 3));
-       BOOST_CHECK_EQUAL (i->to, DCPTime (96000 * 4));
+       BOOST_CHECK_EQUAL (i->from.get(), 96000 * 3);
+       BOOST_CHECK_EQUAL (i->to.get(), 96000 * 4);
 
        film->make_dcp ();
        wait_for_jobs ();
 
        film->make_dcp ();
        wait_for_jobs ();
index 3ccfd2c35ea84dac9d503b8edc1fe7a4fada9433..0b98f7b8226ba4cdc58a3f5705455e765eccb000 100644 (file)
@@ -174,8 +174,7 @@ check_file (boost::filesystem::path ref, boost::filesystem::path check)
        uint8_t* ref_buffer = new uint8_t[buffer_size];
        uint8_t* check_buffer = new uint8_t[buffer_size];
 
        uint8_t* ref_buffer = new uint8_t[buffer_size];
        uint8_t* check_buffer = new uint8_t[buffer_size];
 
-       locked_stringstream error;
-       error << "File " << check.string() << " differs from reference " << ref.string();
+       string error = "File " + check.string() + " differs from reference " + ref.string();
 
        while (N) {
                uintmax_t this_time = min (uintmax_t (buffer_size), N);
 
        while (N) {
                uintmax_t this_time = min (uintmax_t (buffer_size), N);
@@ -184,7 +183,7 @@ check_file (boost::filesystem::path ref, boost::filesystem::path check)
                r = fread (check_buffer, 1, this_time, check_file);
                BOOST_CHECK_EQUAL (r, this_time);
 
                r = fread (check_buffer, 1, this_time, check_file);
                BOOST_CHECK_EQUAL (r, this_time);
 
-               BOOST_CHECK_MESSAGE (memcmp (ref_buffer, check_buffer, this_time) == 0, error.str ());
+               BOOST_CHECK_MESSAGE (memcmp (ref_buffer, check_buffer, this_time) == 0, error);
                if (memcmp (ref_buffer, check_buffer, this_time)) {
                        break;
                }
                if (memcmp (ref_buffer, check_buffer, this_time)) {
                        break;
                }
index 6c7d69b25dedee9f9cf85e9a9b964c95084e507b..391d30dbd98fa663a4288c348ddc1bcc2014ef61 100644 (file)
@@ -131,19 +131,19 @@ BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test)
 
        /* 25fps content, 25fps DCP */
        film->set_video_frame_rate (25);
 
        /* 25fps content, 25fps DCP */
        film->set_video_frame_rate (25);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() / 25.0));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
        /* 25fps content, 24fps DCP; length should be increased */
        film->set_video_frame_rate (24);
        /* 25fps content, 24fps DCP; length should be increased */
        film->set_video_frame_rate (24);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() / 24.0));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 24.0).get());
        /* 25fps content, 30fps DCP; length should be decreased */
        film->set_video_frame_rate (30);
        /* 25fps content, 30fps DCP; length should be decreased */
        film->set_video_frame_rate (30);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() / 30.0));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 30.0).get());
        /* 25fps content, 50fps DCP; length should be the same */
        film->set_video_frame_rate (50);
        /* 25fps content, 50fps DCP; length should be the same */
        film->set_video_frame_rate (50);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() / 25.0));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() / 25.0).get());
        /* 25fps content, 60fps DCP; length should be decreased */
        film->set_video_frame_rate (60);
        /* 25fps content, 60fps DCP; length should be decreased */
        film->set_video_frame_rate (60);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (content->video->length() * (50.0 / 60) / 25.0));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(content->video->length() * (50.0 / 60) / 25.0).get());
 
        /* Make the content audio-only */
        content->video.reset ();
 
        /* Make the content audio-only */
        content->video.reset ();
@@ -151,23 +151,23 @@ BOOST_AUTO_TEST_CASE (ffmpeg_time_calculation_test)
        /* 24fps content, 24fps DCP */
        film->set_video_frame_rate (24);
        content->set_video_frame_rate (24);
        /* 24fps content, 24fps DCP */
        film->set_video_frame_rate (24);
        content->set_video_frame_rate (24);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (1));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get());
        /* 25fps content, 25fps DCP */
        film->set_video_frame_rate (25);
        content->set_video_frame_rate (25);
        /* 25fps content, 25fps DCP */
        film->set_video_frame_rate (25);
        content->set_video_frame_rate (25);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (1));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get());
        /* 25fps content, 24fps DCP; length should be increased */
        film->set_video_frame_rate (24);
        BOOST_CHECK_SMALL (labs (content->full_length().get() - DCPTime::from_seconds(25.0 / 24).get()), 2L);
        /* 25fps content, 30fps DCP; length should be decreased */
        film->set_video_frame_rate (30);
        /* 25fps content, 24fps DCP; length should be increased */
        film->set_video_frame_rate (24);
        BOOST_CHECK_SMALL (labs (content->full_length().get() - DCPTime::from_seconds(25.0 / 24).get()), 2L);
        /* 25fps content, 30fps DCP; length should be decreased */
        film->set_video_frame_rate (30);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (25.0 / 30));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(25.0 / 30).get());
        /* 25fps content, 50fps DCP; length should be the same */
        film->set_video_frame_rate (50);
        /* 25fps content, 50fps DCP; length should be the same */
        film->set_video_frame_rate (50);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (1));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(1).get());
        /* 25fps content, 60fps DCP; length should be decreased */
        film->set_video_frame_rate (60);
        /* 25fps content, 60fps DCP; length should be decreased */
        film->set_video_frame_rate (60);
-       BOOST_CHECK_EQUAL (content->full_length(), DCPTime::from_seconds (50.0 / 60));
+       BOOST_CHECK_EQUAL (content->full_length().get(), DCPTime::from_seconds(50.0 / 60).get());
 
 }
 
 
 }
 
@@ -399,9 +399,9 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        shared_ptr<Piece> piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        shared_ptr<Piece> piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime ());
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 12), DCPTime::from_seconds (0.5));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (3.0));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0).get(), 0);
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 12).get(), DCPTime::from_seconds(0.5).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72).get(), DCPTime::from_seconds(3.0).get());
 
        /* Position 3s, no trim, content rate = DCP rate */
        content->set_position (DCPTime::from_seconds (3));
 
        /* Position 3s, no trim, content rate = DCP rate */
        content->set_position (DCPTime::from_seconds (3));
@@ -411,9 +411,9 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (3.00));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 36), DCPTime::from_seconds (4.50));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 162), DCPTime::from_seconds (9.75));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(4.50).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get());
 
        /* Position 3s, 1.5s trim, content rate = DCP rate */
        content->set_position (DCPTime::from_seconds (3));
 
        /* Position 3s, 1.5s trim, content rate = DCP rate */
        content->set_position (DCPTime::from_seconds (3));
@@ -423,10 +423,10 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (1.50));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 36), DCPTime::from_seconds (3.00));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (4.50));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 198), DCPTime::from_seconds (9.75));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.50).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(3.00).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(4.50).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 198).get(), DCPTime::from_seconds(9.75).get());
 
        /* Position 0, no trim, content rate 24, DCP rate 25.
           Now, for example, a DCPTime position of 3s means 3s at 25fps.  Since we run the video
 
        /* Position 0, no trim, content rate 24, DCP rate 25.
           Now, for example, a DCPTime position of 3s means 3s at 25fps.  Since we run the video
@@ -439,9 +439,9 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime ());
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 15), DCPTime::from_seconds (0.6));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 75), DCPTime::from_seconds (3.0));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), 0);
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 15).get(), DCPTime::from_seconds(0.6).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 75).get(), DCPTime::from_seconds(3.0).get());
 
        /* Position 3s, no trim, content rate 24, DCP rate 25 */
        content->set_position (DCPTime::from_seconds (3));
 
        /* Position 3s, no trim, content rate 24, DCP rate 25 */
        content->set_position (DCPTime::from_seconds (3));
@@ -451,9 +451,9 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (3.00));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 40), DCPTime::from_seconds (4.60));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 169), DCPTime::from_seconds (9.76));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 40).get(), DCPTime::from_seconds(4.60).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 169).get(), DCPTime::from_seconds(9.76).get());
 
        /* Position 3s, 1.6s trim, content rate 24, DCP rate 25, so the 1.6s trim is at 24fps */
        content->set_position (DCPTime::from_seconds (3));
 
        /* Position 3s, 1.6s trim, content rate 24, DCP rate 25, so the 1.6s trim is at 24fps */
        content->set_position (DCPTime::from_seconds (3));
@@ -463,10 +463,10 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (1.464));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 40), DCPTime::from_seconds (3.064));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 80), DCPTime::from_seconds (4.664));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 209), DCPTime::from_seconds (9.824));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.464).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 40).get(), DCPTime::from_seconds(3.064).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 80).get(), DCPTime::from_seconds(4.664).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 209).get(), DCPTime::from_seconds(9.824).get());
 
        /* Position 0, no trim, content rate 24, DCP rate 48
           Now, for example, a DCPTime position of 3s means 3s at 48fps.  Since we run the video
 
        /* Position 0, no trim, content rate 24, DCP rate 48
           Now, for example, a DCPTime position of 3s means 3s at 48fps.  Since we run the video
@@ -481,9 +481,9 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime ());
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 12), DCPTime::from_seconds (0.5));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (3.0));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), 0);
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 12).get(), DCPTime::from_seconds(0.5).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.0).get());
 
        /* Position 3s, no trim, content rate 24, DCP rate 48 */
        content->set_position (DCPTime::from_seconds (3));
 
        /* Position 3s, no trim, content rate 24, DCP rate 48 */
        content->set_position (DCPTime::from_seconds (3));
@@ -493,9 +493,9 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (3.00));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 36), DCPTime::from_seconds (4.50));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 162), DCPTime::from_seconds (9.75));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(4.50).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 162).get(), DCPTime::from_seconds(9.75).get());
 
        /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
        content->set_position (DCPTime::from_seconds (3));
 
        /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
        content->set_position (DCPTime::from_seconds (3));
@@ -505,10 +505,10 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (1.50));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 36), DCPTime::from_seconds (3.00));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (4.50));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 198), DCPTime::from_seconds (9.75));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.50).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 36).get(), DCPTime::from_seconds(3.00).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(4.50).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 198).get(), DCPTime::from_seconds(9.75).get());
 
        /* Position 0, no trim, content rate 48, DCP rate 24
           Now, for example, a DCPTime position of 3s means 3s at 24fps.  Since we run the video
 
        /* Position 0, no trim, content rate 48, DCP rate 24
           Now, for example, a DCPTime position of 3s means 3s at 24fps.  Since we run the video
@@ -522,9 +522,9 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime ());
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 24), DCPTime::from_seconds (0.5));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 144), DCPTime::from_seconds (3.0));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), 0);
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 24).get(), DCPTime::from_seconds(0.5).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 144).get(), DCPTime::from_seconds(3.0).get());
 
        /* Position 3s, no trim, content rate 24, DCP rate 48 */
        content->set_position (DCPTime::from_seconds (3));
 
        /* Position 3s, no trim, content rate 24, DCP rate 48 */
        content->set_position (DCPTime::from_seconds (3));
@@ -534,9 +534,9 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (3.00));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (4.50));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 324), DCPTime::from_seconds (9.75));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(3.00).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(4.50).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 324).get(), DCPTime::from_seconds(9.75).get());
 
        /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
        content->set_position (DCPTime::from_seconds (3));
 
        /* Position 3s, 1.5s trim, content rate 24, DCP rate 48 */
        content->set_position (DCPTime::from_seconds (3));
@@ -546,10 +546,10 @@ BOOST_AUTO_TEST_CASE (player_time_calculation_test2)
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
        player->setup_pieces ();
        BOOST_REQUIRE_EQUAL (player->_pieces.size(), 1);
        piece = player->_pieces.front ();
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 0), DCPTime::from_seconds (1.50));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 72), DCPTime::from_seconds (3.00));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 144), DCPTime::from_seconds (4.50));
-       BOOST_CHECK_EQUAL (player->content_video_to_dcp (piece, 396), DCPTime::from_seconds (9.75));
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 0).get(), DCPTime::from_seconds(1.50).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 72).get(), DCPTime::from_seconds(3.00).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 144).get(), DCPTime::from_seconds(4.50).get());
+       BOOST_CHECK_EQUAL (player->content_video_to_dcp(piece, 396).get(), DCPTime::from_seconds(9.75).get());
 }
 
 /** Test Player::dcp_to_content_audio */
 }
 
 /** Test Player::dcp_to_content_audio */
index 881d584d0162526e35bacc3f8c351987fadb2358..1f894d329537b0998600a8cb3b8211a8aa2a50c7 100644 (file)
@@ -55,18 +55,18 @@ BOOST_AUTO_TEST_CASE (digest_head_tail_test)
 /* Straightforward test of DCPTime::round_up */
 BOOST_AUTO_TEST_CASE (dcptime_round_up_test)
 {
 /* Straightforward test of DCPTime::round_up */
 BOOST_AUTO_TEST_CASE (dcptime_round_up_test)
 {
-       BOOST_CHECK_EQUAL (DCPTime (0).round_up (DCPTime::HZ / 2), DCPTime (0));
-       BOOST_CHECK_EQUAL (DCPTime (1).round_up (DCPTime::HZ / 2), DCPTime (2));
-       BOOST_CHECK_EQUAL (DCPTime (2).round_up (DCPTime::HZ / 2), DCPTime (2));
-       BOOST_CHECK_EQUAL (DCPTime (3).round_up (DCPTime::HZ / 2), DCPTime (4));
+       BOOST_CHECK_EQUAL (DCPTime(0).round_up(DCPTime::HZ / 2).get(), 0);
+       BOOST_CHECK_EQUAL (DCPTime(1).round_up(DCPTime::HZ / 2).get(), 2);
+       BOOST_CHECK_EQUAL (DCPTime(2).round_up(DCPTime::HZ / 2).get(), 2);
+       BOOST_CHECK_EQUAL (DCPTime(3).round_up(DCPTime::HZ / 2).get(), 4);
 
 
-       BOOST_CHECK_EQUAL (DCPTime (0).round_up (DCPTime::HZ / 42), DCPTime (0));
-       BOOST_CHECK_EQUAL (DCPTime (1).round_up (DCPTime::HZ / 42), DCPTime (42));
-       BOOST_CHECK_EQUAL (DCPTime (42).round_up (DCPTime::HZ / 42), DCPTime (42));
-       BOOST_CHECK_EQUAL (DCPTime (43).round_up (DCPTime::HZ / 42), DCPTime (84));
+       BOOST_CHECK_EQUAL (DCPTime(0).round_up(DCPTime::HZ / 42).get(), 0);
+       BOOST_CHECK_EQUAL (DCPTime(1).round_up(DCPTime::HZ / 42).get(), 42);
+       BOOST_CHECK_EQUAL (DCPTime(42).round_up(DCPTime::HZ / 42).get(), 42);
+       BOOST_CHECK_EQUAL (DCPTime(43).round_up(DCPTime::HZ / 42).get(), 84);
 
        /* Check that rounding up to non-integer frame rates works */
 
        /* Check that rounding up to non-integer frame rates works */
-       BOOST_CHECK_EQUAL (DCPTime (45312).round_up (29.976), DCPTime (48045));
+       BOOST_CHECK_EQUAL (DCPTime(45312).round_up(29.976).get(), 48045);
 }
 
 BOOST_AUTO_TEST_CASE (timecode_test)
 }
 
 BOOST_AUTO_TEST_CASE (timecode_test)
index e297d0cd231fcf38dee6e8af7c6726ddeb1c1893..b1a1e258d1482c0587251daed57d09c632a24db3 100644 (file)
@@ -34,8 +34,7 @@ void
 test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop crop, Ratio const * ratio, bool scale, dcp::Size correct)
 {
        shared_ptr<Film> film;
 test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop crop, Ratio const * ratio, bool scale, dcp::Size correct)
 {
        shared_ptr<Film> film;
-       locked_stringstream s;
-       s << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+       string s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                "<Content>"
                "<Type>FFmpeg</Type>"
                "<Path>/home/c.hetherington/DCP/prophet_clip.mkv</Path>"
                "<Content>"
                "<Type>FFmpeg</Type>"
                "<Path>/home/c.hetherington/DCP/prophet_clip.mkv</Path>"
@@ -44,26 +43,26 @@ test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop
                "<TrimStart>0</TrimStart>"
                "<TrimEnd>0</TrimEnd>"
                "<VideoLength>2879</VideoLength>"
                "<TrimStart>0</TrimStart>"
                "<TrimEnd>0</TrimEnd>"
                "<VideoLength>2879</VideoLength>"
-               "<VideoWidth>" << content_size.width << "</VideoWidth>"
-               "<VideoHeight>" << content_size.height << "</VideoHeight>"
+               "<VideoWidth>" + raw_convert<string>(content_size.width) + "</VideoWidth>"
+               "<VideoHeight>" + raw_convert<string>(content_size.height) + "</VideoHeight>"
                "<VideoFrameRate>23.97602462768555</VideoFrameRate>"
                "<OriginalVideoFrameRate>23.97602462768555</OriginalVideoFrameRate>"
                "<VideoFrameType>0</VideoFrameType>"
                "<SampleAspectRatio>1</SampleAspectRatio>"
                "<BitsPerPixel>12</BitsPerPixel>"
                "<VideoFrameRate>23.97602462768555</VideoFrameRate>"
                "<OriginalVideoFrameRate>23.97602462768555</OriginalVideoFrameRate>"
                "<VideoFrameType>0</VideoFrameType>"
                "<SampleAspectRatio>1</SampleAspectRatio>"
                "<BitsPerPixel>12</BitsPerPixel>"
-               "<LeftCrop>" << crop.left << "</LeftCrop>"
-               "<RightCrop>" << crop.right << "</RightCrop>"
-               "<TopCrop>" << crop.top << "</TopCrop>"
-               "<BottomCrop>" << crop.bottom << "</BottomCrop>"
+               "<LeftCrop>" + raw_convert<string>(crop.left) + "</LeftCrop>"
+               "<RightCrop>" + raw_convert<string>(crop.right) + "</RightCrop>"
+               "<TopCrop>" + raw_convert<string>(crop.top) + "</TopCrop>"
+               "<BottomCrop>" + raw_convert<string>(crop.bottom) + "</BottomCrop>"
                "<Scale>";
 
        if (ratio) {
                "<Scale>";
 
        if (ratio) {
-               s << "<Ratio>" << ratio->id() << "</Ratio>";
+               s += "<Ratio>" + ratio->id() + "</Ratio>";
        } else {
        } else {
-               s << "<Scale>" << scale << "</Scale>";
+               s += "<Scale>" + string(scale ? "1" : "0") + "</Scale>";
        }
 
        }
 
-       s << "</Scale>"
+       s += "</Scale>"
                "<ColourConversion>"
                "<InputGamma>2.4</InputGamma>"
                "<InputGammaLinearised>1</InputGammaLinearised>"
                "<ColourConversion>"
                "<InputGamma>2.4</InputGamma>"
                "<InputGammaLinearised>1</InputGammaLinearised>"
@@ -87,7 +86,7 @@ test (dcp::Size content_size, dcp::Size display_size, dcp::Size film_size, Crop
                "</Content>";
 
        shared_ptr<cxml::Document> doc (new cxml::Document ());
                "</Content>";
 
        shared_ptr<cxml::Document> doc (new cxml::Document ());
-       doc->read_string(s.str ());
+       doc->read_string (s);
 
        list<string> notes;
        shared_ptr<FFmpegContent> vc (new FFmpegContent (film, doc, 10, notes));
 
        list<string> notes;
        shared_ptr<FFmpegContent> vc (new FFmpegContent (film, doc, 10, notes));