ffmpeg_options = {}
return (('ffmpeg-cdist', '1d4a1a4', ffmpeg_options),
- ('libdcp', 'v1.3.4'),
- ('libsub', 'v1.1.13'))
+ ('libdcp', 'b487f83'),
+ ('libsub', '45b8f2f'))
def configure_options(target):
opt = ''
float s = data[i];
float as = fabsf (s);
if (as < 10e-7) {
- /* SafeStringStream can't serialise and recover inf or -inf, so prevent such
+ /* locked_stringstream can't serialise and recover inf or -inf, so prevent such
values by replacing with this (140dB down) */
s = as = 10e-7;
}
string
AudioFilterGraph::src_parameters () const
{
- SafeStringStream a;
+ locked_stringstream a;
char buffer[64];
av_get_channel_layout_string (buffer, sizeof(buffer), 0, _channel_layout);
i.make_zip_file (film_name, zip_file);
string subject = config->kdm_subject();
- SafeStringStream start;
+ locked_stringstream start;
start << from.date() << " " << from.time_of_day();
- SafeStringStream end;
+ locked_stringstream end;
end << to.date() << " " << to.time_of_day();
boost::algorithm::replace_all (subject, "$CPL_NAME", cpl_name);
boost::algorithm::replace_all (subject, "$START_TIME", start.str ());
boost::algorithm::replace_all (body, "$END_TIME", end.str ());
boost::algorithm::replace_all (body, "$CINEMA_NAME", i.cinema->name);
- SafeStringStream screens;
+ locked_stringstream screens;
BOOST_FOREACH (ScreenKDM const & j, i.screen_kdms) {
screens << j.screen->name << ", ";
}
#ifndef STRING_COMPOSE_H
#define STRING_COMPOSE_H
+#include <locked_sstream.h>
#include <string>
#include <list>
#include <map> // for multimap
-#include "safe_stringstream.h"
namespace StringPrivate
{
std::string str() const;
private:
- SafeStringStream os;
+ locked_stringstream os;
int arg_no;
// we store the output as a list - when the output string is requested, the
case '8':
case '9':
return true;
-
+
default:
return false;
}
os << obj;
std::string rep = os.str();
-
+
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) {
output_list::iterator pos = i->second;
++pos;
-
+
output.insert(pos, rep);
}
-
+
os.str(std::string());
//os.clear();
++arg_no;
}
-
+
return *this;
}
: arg_no(1)
{
std::string::size_type b = 0, i = 0;
-
+
// fill in output with the strings between the %1 %2 %3 etc. and
// fill in specs with the positions
while (i < fmt.length()) {
else if (is_number(fmt[i + 1])) { // aha! a spec!
// save string
output.push_back(fmt.substr(b, i - b));
-
+
int n = 1; // number of digits
int spec_no = 0;
spec_no /= 10;
output_list::iterator pos = output.end();
--pos; // safe since we have just inserted a string>
-
+
specs.insert(specification_map::value_type(spec_no, pos));
-
+
// jump over spec string
i += n;
b = i;
else
++i;
}
-
+
if (i - b > 0) // add the rest of the string
output.push_back(fmt.substr(b, i - b));
}
{
// assemble string
std::string str;
-
+
for (output_list::const_iterator i = output.begin(), end = output.end();
i != end; ++i)
str += *i;
-
+
return str;
}
}
// now for the real thing(s)
-namespace String
+namespace String
{
// a series of functions which accept a format string on the form "text %1
// more %2 less %3" and a number of templated parameters and spits out the
.arg(o10);
return c.str();
}
-
+
template <typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10,
typename T11>
#include "content_factory.h"
#include "exceptions.h"
#include "film.h"
-#include "safe_stringstream.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>
string
Content::identifier () const
{
- SafeStringStream s;
+ locked_stringstream s;
s << Content::digest()
<< "_" << position().get()
string
DCPContent::identifier () const
{
- SafeStringStream s;
+ locked_stringstream s;
s << Content::identifier() << "_" << video->identifier() << "_";
if (subtitle) {
s << subtitle->identifier () << " ";
#define DCPOMATIC_TIME_H
#include "frame_rate_change.h"
-#include "safe_stringstream.h"
#include "dcpomatic_assert.h"
+#include <locked_sstream.h>
#include <stdint.h>
#include <cmath>
#include <ostream>
int f;
split (r, h, m, s, f);
- SafeStringStream o;
+ locked_stringstream o;
o.width (2);
o.fill ('0');
o << std::setw(2) << std::setfill('0') << h << ":"
*/
#include "digester.h"
-#include "safe_stringstream.h"
+#include <locked_sstream.h>
#include <nettle/md5.h>
#include <iomanip>
unsigned char digest[MD5_DIGEST_SIZE];
md5_digest (&_context, MD5_DIGEST_SIZE, digest);
- SafeStringStream s;
+ locked_stringstream s;
for (int i = 0; i < MD5_DIGEST_SIZE; ++i) {
s << hex << setfill('0') << setw(2) << ((int) digest[i]);
}
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());
- SafeStringStream email;
+ locked_stringstream email;
email << "Date: " << date_buffer << "\r\n"
<< "To: " << address_list (_to) << "\r\n"
#include "config.h"
#include "cross.h"
#include "player_video.h"
-#include "safe_stringstream.h"
#include "raw_convert.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 "encoded_log_entry.h"
-#include "safe_stringstream.h"
+#include <locked_sstream.h>
using std::string;
using std::fixed;
string
EncodedLogEntry::message () const
{
- SafeStringStream m;
+ locked_stringstream m;
m.precision (2);
m << fixed
<< "Encoded frame " << _frame << " from " << _ip << ": "
string
ffmpeg_version_to_string (int v)
{
- SafeStringStream s;
+ locked_stringstream s;
s << ((v & 0xff0000) >> 16) << N_(".") << ((v & 0xff00) >> 8) << N_(".") << (v & 0xff);
return s.str ();
}
string
dependency_version_summary ()
{
- SafeStringStream s;
+ 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_(", ")
#include "log.h"
#include "exceptions.h"
#include "frame_rate_change.h"
-#include "safe_stringstream.h"
#include "raw_convert.h"
#include "subtitle_content.h"
+#include <locked_sstream.h>
#include <libcxml/cxml.h>
extern "C" {
#include <libavformat/avformat.h>
string
FFmpegContent::identifier () const
{
- SafeStringStream s;
+ locked_stringstream s;
s << Content::identifier();
#include "ffmpeg_audio_stream.h"
#include "ffmpeg_subtitle_stream.h"
#include "util.h"
-#include "safe_stringstream.h"
+#include <locked_sstream.h>
#include <boost/foreach.hpp>
#include <iostream>
string
FFmpegExaminer::subtitle_stream_name (AVStream* s) const
{
- SafeStringStream n;
+ locked_stringstream n;
n << stream_name (s);
string
FFmpegExaminer::stream_name (AVStream* s) const
{
- SafeStringStream n;
+ locked_stringstream n;
if (s->metadata) {
AVDictionaryEntry const * lang = av_dict_get (s->metadata, "language", 0, 0);
#include "dcp_content_type.h"
#include "ratio.h"
#include "cross.h"
-#include "safe_stringstream.h"
#include "environment_info.h"
#include "raw_convert.h"
#include "audio_processor.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>
{
DCPOMATIC_ASSERT (container ());
- SafeStringStream s;
+ locked_stringstream s;
s.imbue (std::locale::classic ());
s << container()->id()
string
Film::isdcf_name (bool if_created_now) const
{
- SafeStringStream d;
+ locked_stringstream d;
string raw_name = name ();
p /= "j2c";
p /= video_identifier ();
- SafeStringStream s;
+ locked_stringstream s;
s.width (8);
s << setfill('0') << reel << "_" << frame;
#include "filter.h"
#include "exceptions.h"
#include "image.h"
-#include "safe_stringstream.h"
+#include <locked_sstream.h>
#include "compose.hpp"
extern "C" {
#include <libavfilter/avfiltergraph.h>
#include "job.h"
#include "frame_rate_change.h"
#include "exceptions.h"
-#include "safe_stringstream.h"
#include "image_filename_sorter.h"
+#include <locked_sstream.h>
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
#include <boost/foreach.hpp>
string
ImageContent::identifier () const
{
- SafeStringStream s;
+ locked_stringstream s;
s << Content::identifier();
s << "_" << video->identifier ();
s << "_" << video->length();
#include "scoped_temporary.h"
#include "compose.hpp"
-#include "safe_stringstream.h"
#include "exceptions.h"
+#include <locked_sstream.h>
#include <curl/curl.h>
#include <zip.h>
#include <boost/function.hpp>
throw NetworkError (curl_easy_strerror (r));
}
- SafeStringStream s (ls_raw);
+ locked_stringstream s (ls_raw);
list<string> ls;
while (s.good ()) {
string line = s.getline ();
int const t = elapsed_sub_time ();
int const r = remaining_time ();
- SafeStringStream s;
+ locked_stringstream s;
if (!finished () && p) {
int pc = lrintf (p.get() * 100);
if (pc == 100) {
action = r["action"];
}
- SafeStringStream json;
+ locked_stringstream json;
if (action == "status") {
list<shared_ptr<Job> > jobs = JobManager::instance()->get ();
}
}
- SafeStringStream reply;
+ locked_stringstream reply;
reply << "HTTP/1.1 200 OK\r\n"
<< "Content-Length: " << json.str().length() << "\r\n"
<< "Content-Type: application/json\r\n"
#include "log.h"
#include "cross.h"
#include "config.h"
-#include "safe_stringstream.h"
#include "string_log_entry.h"
+#include <locked_sstream.h>
#include <time.h>
#include <cstdio>
*/
#include "log_entry.h"
-#include "safe_stringstream.h"
+#include <locked_sstream.h>
#include "i18n.h"
string
LogEntry::get () const
{
- SafeStringStream s;
+ locked_stringstream s;
if (_type & TYPE_TIMING) {
s << _time.tv_sec << ":" << _time.tv_usec << " ";
} else {
#ifndef DCPOMATIC_RAW_CONVERT_H
#define DCPOMATIC_RAW_CONVERT_H
-#include "safe_stringstream.h"
+#include <locked_sstream.h>
#include <iomanip>
/** A sort-of version of boost::lexical_cast that does uses the "C"
P
raw_convert (Q v, int precision = 16)
{
- SafeStringStream s;
+ locked_stringstream s;
s.imbue (std::locale::classic ());
s << std::setprecision (precision);
s << v;
+++ /dev/null
-/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- DCP-o-matic is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include <boost/thread/mutex.hpp>
-#include "safe_stringstream.h"
-
-boost::mutex SafeStringStream::_mutex;
+++ /dev/null
-/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- DCP-o-matic is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef DCPOMATIC_SAFE_STRINGSTREAM_H
-#define DCPOMATIC_SAFE_STRINGSTREAM_H
-
-#include <boost/thread/mutex.hpp>
-
-/* I've not been able to reproduce it, but there have been reports that DCP-o-matic crashes
- * on OS X with two simultaneous backtraces that look like this:
- *
- * 0 libSystem.B.dylib 0x00007fff84ebe264 __numeric_load_locale + 125
- * 1 libSystem.B.dylib 0x00007fff84e2aac4 loadlocale + 323
- * 2 libstdc++.6.dylib 0x00007fff8976ba69 std::__convert_from_v(int* const&, char*, int, char const*, ...) + 199
- * 3 libstdc++.6.dylib 0x00007fff8974e99b std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char,
-std::char_traits<char> > >::_M_insert_float<double>(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, char, double) const + 199
- * 4 libstdc++.6.dylib 0x00007fff8974ebc0 std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> >
->::do_put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const + 28
- * 5 libstdc++.6.dylib 0x00007fff897566a2 std::ostream& std::ostream::_M_insert<double>(double) + 178
- * 6 libdcpomatic.dylib 0x0000000100331e21 StringPrivate::Composition& StringPrivate::Composition::arg<float>(float const&) + 33
- *
- * in two different threads. I'm assuming that for some bizarre reason it is unsafe to use two separate stringstream
- * objects in different threads on OS X. This is a hack to work around it.
- */
-
-class SafeStringStream
-{
-public:
- SafeStringStream ()
- {}
-
- SafeStringStream (std::string s)
- : _stream (s)
- {}
-
- template <class T>
- std::ostream& operator<< (T val)
- {
- boost::mutex::scoped_lock lm (_mutex);
- _stream << val;
- return _stream;
- }
-
- template <class T>
- std::istream& operator>> (T& val)
- {
- boost::mutex::scoped_lock lm (_mutex);
- _stream >> val;
- return _stream;
- }
-
- std::string str () const {
- return _stream.str ();
- }
-
- void str (std::string const & s) {
- _stream.str (s);
- }
-
- void imbue (std::locale const & loc)
- {
- boost::mutex::scoped_lock lm (_mutex);
- _stream.imbue (loc);
- }
-
- void width (int w)
- {
- _stream.width (w);
- }
-
- void fill (int f)
- {
- _stream.fill (f);
- }
-
- void precision (int p)
- {
- _stream.precision (p);
- }
-
- bool good () const
- {
- return _stream.good ();
- }
-
- std::string getline ()
- {
- boost::mutex::scoped_lock lm (_mutex);
- std::string s;
- std::getline (_stream, s);
- return s;
- }
-
- void setf (std::ios_base::fmtflags flags, std::ios_base::fmtflags mask)
- {
- _stream.setf (flags, mask);
- }
-
-private:
- static boost::mutex _mutex;
- std::stringstream _stream;
-};
-
-#endif
*/
#include "string_log_entry.h"
-#include "safe_stringstream.h"
+#include <locked_sstream.h>
#include "i18n.h"
#include "subtitle_content.h"
#include "util.h"
#include "exceptions.h"
-#include "safe_stringstream.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>
string
SubtitleContent::identifier () const
{
- SafeStringStream s;
+ locked_stringstream s;
s << raw_convert<string> (x_scale())
<< "_" << raw_convert<string> (y_scale())
<< "_" << raw_convert<string> (x_offset())
#include "film.h"
#include "transcoder.h"
#include "log.h"
-#include "safe_stringstream.h"
+#include <locked_sstream.h>
#include "compose.hpp"
#include <iostream>
#include <iomanip>
return Job::status ();
}
- SafeStringStream s;
+ locked_stringstream s;
s << Job::status ();
#include "update_checker.h"
#include "version.h"
-#include "safe_stringstream.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 "rect.h"
#include "digester.h"
#include "audio_processor.h"
-#include "safe_stringstream.h"
#include "compose.hpp"
+#include <locked_sstream.h>
#include <dcp/util.h>
#include <dcp/picture_asset.h>
#include <dcp/sound_asset.h>
int h = m / 60;
m -= (h * 60);
- SafeStringStream hms;
+ locked_stringstream hms;
hms << h << N_(":");
hms.width (2);
hms << setfill ('0') << m << N_(":");
int h = m / 60;
m -= (h * 60);
- SafeStringStream ap;
+ locked_stringstream ap;
bool const hours = h > 0;
bool const minutes = h < 6 && m > 0;
#include "exceptions.h"
#include "frame_rate_change.h"
#include "log.h"
-#include "safe_stringstream.h"
#include "raw_convert.h"
+#include <locked_sstream.h>
#include <libcxml/cxml.h>
#include <dcp/colour_matrix.h>
#include <libxml++/libxml++.h>
string
VideoContent::identifier () const
{
- SafeStringStream s;
+ locked_stringstream s;
s << crop().left
<< "_" << crop().right
<< "_" << crop().top
VideoContent::processing_description () const
{
/* stringstream is OK here as this string is just for presentation to the user */
- SafeStringStream d;
+ locked_stringstream d;
if (size().width && size().height) {
d << String::compose (
#include "video_content_scale.h"
#include "video_content.h"
#include "ratio.h"
-#include "safe_stringstream.h"
#include "util.h"
+#include <locked_sstream.h>
#include <libcxml/cxml.h>
#include <libxml++/libxml++.h>
#include <boost/optional.hpp>
string
VideoContentScale::id () const
{
- SafeStringStream s;
+ locked_stringstream s;
if (_ratio) {
s << _ratio->id ();
string
VideoFilterGraph::src_parameters () const
{
- SafeStringStream a;
+ locked_stringstream a;
a << "video_size=" << _size.width << "x" << _size.height << ":"
<< "pix_fmt=" << _pixel_format << ":"
render_subtitles.cc
resampler.cc
rgba.cc
- safe_stringstream.cc
scoped_temporary.cc
scp_uploader.cc
screen.cc
}
for (size_t i = 0; i < history.size(); ++i) {
- SafeStringStream s;
+ locked_stringstream s;
if (i < 9) {
s << "&" << (i + 1) << " ";
}
#include "lib/config.h"
#include "lib/exceptions.h"
#include "lib/emailer.h"
-#include "lib/safe_stringstream.h"
+#include <locked_sstream.h>
#include <dcp/certificate.h>
#include <getopt.h>
#include <iostream>
static boost::posix_time::time_duration
duration_from_string (string d)
{
- SafeStringStream s (d);
+ locked_stringstream s (d);
int N;
string unit;
s >> N >> unit;
void update_state ()
{
- SafeStringStream s;
+ locked_stringstream s;
s << fixed << setprecision(1) << server_log->fps ();
_fps->SetLabel (std_to_wx (s.str()));
}
*/
#include "lib/colour_conversion.h"
-#include "lib/safe_stringstream.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>
_ignore_chromaticity_changed = true;
- SafeStringStream s;
+ locked_stringstream s;
s.setf (std::ios::fixed, std::ios::floatfield);
s.precision (6);
boost::numeric::ublas::matrix<double> m = get().bradford ();
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
- SafeStringStream s;
+ locked_stringstream s;
s.setf (std::ios::fixed, std::ios::floatfield);
s.precision (7);
s << m (i, 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) {
- SafeStringStream s;
+ locked_stringstream s;
s.setf (std::ios::fixed, std::ios::floatfield);
s.precision (7);
s << m (i, j);
void
ColourConversionEditor::set_text_ctrl (wxTextCtrl* control, double value)
{
- SafeStringStream s;
+ locked_stringstream s;
s.precision (7);
s << value;
control->SetValue (std_to_wx (s.str ()));
} else {
message->SetLabel (wxT (""));
- SafeStringStream s;
+ locked_stringstream s;
BOOST_FOREACH (string e, errors) {
s << e << "\n";
}
_hours->SetValue (std_to_wx (raw_convert<string> (_hours_spin->GetValue ())));
- SafeStringStream m;
+ locked_stringstream m;
m << setfill('0') << setw(2) << _minutes_spin->GetValue();
_minutes->SetValue (std_to_wx (m.str()));
uint8_t* ref_buffer = new uint8_t[buffer_size];
uint8_t* check_buffer = new uint8_t[buffer_size];
- SafeStringStream error;
+ locked_stringstream error;
error << "File " << check.string() << " differs from reference " << ref.string();
while (N) {
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;
- SafeStringStream s;
+ locked_stringstream s;
s << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<Content>"
"<Type>FFmpeg</Type>"