+2015-04-16 Carl Hetherington <cth@carlh.net>
+
+ * Fix potential OS X crashes due to another incarnation
+ of the bizarre multi-thread stringstream bug.
+
2015-04-15 c.hetherington <cth@carlh.net>
* Hand-apply 94998e12d117f3f1781dfb1318939debfbf34546 from master;
#include "config.h"
#include "frame_rate_change.h"
#include "audio_processor.h"
+#include "raw_convert.h"
#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
#include "i18n.h"
using std::setprecision;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
int const AudioContentProperty::AUDIO_CHANNELS = 200;
int const AudioContentProperty::AUDIO_LENGTH = 201;
#include "audio_mapping.h"
#include "util.h"
#include "md5_digester.h"
+#include "raw_convert.h"
#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
#include <libxml++/libxml++.h>
using std::list;
using std::vector;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
AudioMapping::AudioMapping ()
: _content_channels (0)
#include "colour_conversion.h"
#include "util.h"
#include "md5_digester.h"
+#include "raw_convert.h"
#include <dcp/colour_matrix.h>
-#include <dcp/raw_convert.h>
#include <dcp/gamma_transfer_function.h>
#include <dcp/modified_gamma_transfer_function.h>
#include <libcxml/cxml.h>
using boost::shared_ptr;
using boost::optional;
using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
ColourConversion::ColourConversion ()
: dcp::ColourConversion (dcp::ColourConversion::srgb_to_xyz ())
#include "cinema.h"
#include "util.h"
#include "cross.h"
+#include "raw_convert.h"
#include <dcp/colour_matrix.h>
-#include <dcp/raw_convert.h>
#include <dcp/signer.h>
#include <dcp/certificate_chain.h>
#include <libcxml/cxml.h>
using boost::shared_ptr;
using boost::optional;
using boost::algorithm::trim;
-using dcp::raw_convert;
Config* Config::_instance = 0;
#include "film.h"
#include "safe_stringstream.h"
#include "job.h"
+#include "raw_convert.h"
#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
#include <libxml++/libxml++.h>
#include <boost/thread/mutex.hpp>
using std::vector;
using std::max;
using boost::shared_ptr;
-using dcp::raw_convert;
int const ContentProperty::PATH = 400;
int const ContentProperty::POSITION = 401;
digest here: a MD5 of the first and last 1e6 bytes with the
size of the first file tacked on the end as a string.
*/
- string const d = md5_digest_head_tail (p, 1000000) + dcp::raw_convert<string> (boost::filesystem::file_size (p.front ()));
+ string const d = md5_digest_head_tail (p, 1000000) + raw_convert<string> (boost::filesystem::file_size (p.front ()));
lm.lock ();
_digest = d;
#include "font.h"
#include "dcp_subtitle_content.h"
+#include "raw_convert.h"
#include <dcp/interop_subtitle_content.h>
#include <dcp/smpte_subtitle_content.h>
#include <dcp/interop_load_font.h>
-#include <dcp/raw_convert.h>
#include "i18n.h"
using std::string;
using std::list;
using boost::shared_ptr;
-using dcp::raw_convert;
DCPSubtitleContent::DCPSubtitleContent (shared_ptr<const Film> film, boost::filesystem::path path)
: Content (film, path)
#include "log.h"
#include "cross.h"
#include "player_video.h"
+#include "raw_convert.h"
#include "encoded_data.h"
#include <libcxml/cxml.h>
#include <dcp/xyz_image.h>
#include <dcp/rgb_xyz.h>
#include <dcp/colour_matrix.h>
-#include <dcp/raw_convert.h>
#include <boost/array.hpp>
#include <boost/asio.hpp>
#include <boost/filesystem.hpp>
using boost::shared_ptr;
using boost::lexical_cast;
using dcp::Size;
-using dcp::raw_convert;
#define DCI_COEFFICENT (48.0 / 52.37)
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
-#include <dcp/raw_convert.h>
#include "ffmpeg.h"
#include "ffmpeg_content.h"
#include "ffmpeg_audio_stream.h"
#include "ffmpeg_subtitle_stream.h"
#include "exceptions.h"
#include "util.h"
+#include "raw_convert.h"
#include "i18n.h"
using std::string;
using std::cout;
using boost::shared_ptr;
-using dcp::raw_convert;
boost::mutex FFmpeg::_mutex;
*/
+#include "ffmpeg_audio_stream.h"
+#include "raw_convert.h"
#include <libxml++/libxml++.h>
#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
-#include "ffmpeg_audio_stream.h"
using std::string;
-using dcp::raw_convert;
FFmpegAudioStream::FFmpegAudioStream (cxml::ConstNodePtr node, int version)
: FFmpegStream (node)
*/
-extern "C" {
-#include <libavformat/avformat.h>
-}
-#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
#include "ffmpeg_content.h"
#include "ffmpeg_examiner.h"
#include "ffmpeg_subtitle_stream.h"
#include "exceptions.h"
#include "frame_rate_change.h"
#include "safe_stringstream.h"
+#include "raw_convert.h"
+#include <libcxml/cxml.h>
+extern "C" {
+#include <libavformat/avformat.h>
+}
#include "i18n.h"
using std::pair;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
int const FFmpegContentProperty::SUBTITLE_STREAMS = 100;
int const FFmpegContentProperty::SUBTITLE_STREAM = 101;
#include "ffmpeg_stream.h"
#include "dcpomatic_assert.h"
-#include <dcp/raw_convert.h>
+#include "raw_convert.h"
#include <libxml++/libxml++.h>
extern "C" {
#include <libavformat/avformat.h>
}
using std::string;
-using dcp::raw_convert;
FFmpegStream::FFmpegStream (cxml::ConstNodePtr node)
: name (node->string_child ("Name"))
#include "cinema.h"
#include "safe_stringstream.h"
#include "environment_info.h"
+#include "raw_convert.h"
#include <libcxml/cxml.h>
#include <dcp/cpl.h>
#include <dcp/signer.h>
#include <dcp/util.h>
#include <dcp/local_time.h>
-#include <dcp/raw_convert.h>
#include <dcp/decrypted_kdm.h>
#include <libxml++/libxml++.h>
#include <boost/filesystem.hpp>
using boost::is_any_of;
using dcp::Size;
using dcp::Signer;
-using dcp::raw_convert;
-using dcp::raw_convert;
#define LOG_GENERAL(...) log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL);
#define LOG_GENERAL_NC(...) log()->log (__VA_ARGS__, Log::TYPE_GENERAL);
*/
-#include <iostream>
+#include "raw_convert.h"
#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
-#include <dcp/raw_convert.h>
+#include <iostream>
class ImageFilenameSorter
{
return boost::optional<int> ();
}
- return dcp::raw_convert<int> (number);
+ return raw_convert<int> (number);
}
};
#include "exceptions.h"
#include "cross.h"
#include <dcp/util.h>
-#include <dcp/raw_convert.h>
#include <libcxml/cxml.h>
#include "i18n.h"
*/
-#include <iostream>
-#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
#include "isdcf_metadata.h"
+#include "raw_convert.h"
+#include <libcxml/cxml.h>
+#include <iostream>
#include "i18n.h"
using std::string;
using boost::shared_ptr;
-using dcp::raw_convert;
ISDCFMetadata::ISDCFMetadata (cxml::ConstNodePtr node)
: content_version (node->number_child<int> ("ContentVersion"))
#include "dcpomatic_socket.h"
#include "image.h"
#include "encoded_data.h"
-#include <dcp/raw_convert.h>
+#include "raw_convert.h"
#include <dcp/mono_picture_frame.h>
#include <dcp/stereo_picture_frame.h>
#include <dcp/colour_conversion.h>
J2KImageProxy::add_metadata (xmlpp::Node* node) const
{
node->add_child("Type")->add_child_text (N_("J2K"));
- node->add_child("Width")->add_child_text (dcp::raw_convert<string> (_size.width));
- node->add_child("Height")->add_child_text (dcp::raw_convert<string> (_size.height));
+ node->add_child("Width")->add_child_text (raw_convert<string> (_size.width));
+ node->add_child("Height")->add_child_text (raw_convert<string> (_size.height));
if (_stereo) {
- node->add_child("Eye")->add_child_text (dcp::raw_convert<string> (_eye.get ()));
- node->add_child("LeftSize")->add_child_text (dcp::raw_convert<string> (_stereo->left_j2k_size ()));
- node->add_child("RightSize")->add_child_text (dcp::raw_convert<string> (_stereo->right_j2k_size ()));
+ node->add_child("Eye")->add_child_text (raw_convert<string> (_eye.get ()));
+ node->add_child("LeftSize")->add_child_text (raw_convert<string> (_stereo->left_j2k_size ()));
+ node->add_child("RightSize")->add_child_text (raw_convert<string> (_stereo->right_j2k_size ()));
} else {
- node->add_child("Size")->add_child_text (dcp::raw_convert<string> (_mono->j2k_size ()));
+ node->add_child("Size")->add_child_text (raw_convert<string> (_mono->j2k_size ()));
}
}
*/
-#include <dcp/raw_convert.h>
#include "player_video.h"
#include "image.h"
#include "image_proxy.h"
#include "j2k_image_proxy.h"
#include "film.h"
+#include "raw_convert.h"
using std::string;
using std::cout;
-using dcp::raw_convert;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
--- /dev/null
+/*
+ Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+
+ This program 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.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <iomanip>
+#include "safe_stringstream.h"
+
+/** A sort-of version of boost::lexical_cast that does uses the "C"
+ * locale (i.e. no thousands separators and a . for the decimal separator).
+ */
+template <typename P, typename Q>
+P
+raw_convert (Q v, int precision = 16)
+{
+ SafeStringStream s;
+ s.imbue (std::locale::classic ());
+ s << std::setprecision (precision);
+ s << v;
+ P r;
+ s >> r;
+ return r;
+}
*/
+#include "raw_image_proxy.h"
+#include "image.h"
+#include "raw_convert.h"
+#include <dcp/util.h>
extern "C" {
#include <libavutil/pixfmt.h>
}
#include <libcxml/cxml.h>
-#include <dcp/util.h>
-#include <dcp/raw_convert.h>
-#include "raw_image_proxy.h"
-#include "image.h"
#include "i18n.h"
RawImageProxy::add_metadata (xmlpp::Node* node) const
{
node->add_child("Type")->add_child_text (N_("Raw"));
- node->add_child("Width")->add_child_text (dcp::raw_convert<string> (_image->size().width));
- node->add_child("Height")->add_child_text (dcp::raw_convert<string> (_image->size().height));
- node->add_child("PixelFormat")->add_child_text (dcp::raw_convert<string> (_image->pixel_format ()));
+ node->add_child("Width")->add_child_text (raw_convert<string> (_image->size().width));
+ node->add_child("Height")->add_child_text (raw_convert<string> (_image->size().height));
+ node->add_child("PixelFormat")->add_child_text (raw_convert<string> (_image->pixel_format ()));
}
void
#include "player_video.h"
#include "encoded_data.h"
#include "safe_stringstream.h"
-#include <dcp/raw_convert.h>
+#include "raw_convert.h"
#include <libcxml/cxml.h>
#include <boost/algorithm/string.hpp>
#include <boost/scoped_array.hpp>
using boost::scoped_array;
using boost::optional;
using dcp::Size;
-using dcp::raw_convert;
Server::Server (shared_ptr<Log> log, bool verbose)
: _terminate (false)
#include "cross.h"
#include "ui_signaller.h"
#include "dcpomatic_socket.h"
+#include "raw_convert.h"
#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
#include <boost/lambda/lambda.hpp>
#include "i18n.h"
using boost::shared_ptr;
using boost::scoped_array;
using boost::weak_ptr;
-using dcp::raw_convert;
ServerFinder* ServerFinder::_instance = 0;
*/
-#include <dcp/raw_convert.h>
#include "single_stream_audio_content.h"
#include "audio_examiner.h"
#include "film.h"
+#include "raw_convert.h"
using std::string;
using std::cout;
using boost::shared_ptr;
-using dcp::raw_convert;
SingleStreamAudioContent::SingleStreamAudioContent (shared_ptr<const Film> f)
: Content (f)
*/
#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
#include "sndfile_content.h"
#include "sndfile_decoder.h"
#include "film.h"
using std::string;
using std::cout;
using boost::shared_ptr;
-using dcp::raw_convert;
SndfileContent::SndfileContent (shared_ptr<const Film> f, boost::filesystem::path p)
: Content (f, p)
#include "subrip.h"
#include "film.h"
#include "font.h"
-#include <dcp/raw_convert.h>
+#include "raw_convert.h"
#include "i18n.h"
using std::string;
using std::cout;
-using dcp::raw_convert;
using boost::shared_ptr;
using boost::lexical_cast;
*/
-#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
#include "subtitle_content.h"
#include "util.h"
#include "exceptions.h"
#include "safe_stringstream.h"
#include "font.h"
+#include "raw_convert.h"
+#include <libcxml/cxml.h>
#include "i18n.h"
using std::list;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
int const SubtitleContentProperty::SUBTITLE_X_OFFSET = 500;
int const SubtitleContentProperty::SUBTITLE_Y_OFFSET = 501;
*/
+#include "types.h"
+#include "raw_convert.h"
#include <libxml++/libxml++.h>
#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
-#include "types.h"
using std::max;
using std::min;
using std::string;
using boost::shared_ptr;
-using dcp::raw_convert;
bool operator== (Crop const & a, Crop const & b)
{
*/
-#include <string>
-#include <boost/algorithm/string.hpp>
-#include <curl/curl.h>
-#include <libcxml/cxml.h>
-#include <dcp/raw_convert.h>
#include "update.h"
#include "version.h"
#include "ui_signaller.h"
#include "safe_stringstream.h"
#include "config.h"
#include "util.h"
+#include "raw_convert.h"
+#include <libcxml/cxml.h>
+#include <curl/curl.h>
+#include <boost/algorithm/string.hpp>
+#include <string>
#define BUFFER_SIZE 1024
using std::min;
using std::string;
using std::vector;
-using dcp::raw_convert;
using boost::is_any_of;
using boost::ends_with;
#include "safe_stringstream.h"
#include <dcp/util.h>
#include <dcp/signer.h>
-#include <dcp/raw_convert.h>
#include <glib.h>
#include <pangomm/init.h>
#include <boost/algorithm/string.hpp>
using boost::thread;
using boost::optional;
using dcp::Size;
-using dcp::raw_convert;
/** Path to our executable, required by the stacktrace stuff and filled
* in during App::onInit().
#include "frame_rate_change.h"
#include "log.h"
#include "safe_stringstream.h"
+#include "raw_convert.h"
#include <libcxml/cxml.h>
#include <dcp/colour_matrix.h>
-#include <dcp/raw_convert.h>
#include <iomanip>
#include "i18n.h"
using boost::shared_ptr;
using boost::optional;
using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
VideoContent::VideoContent (shared_ptr<const Film> f)
: Content (f)
* @brief AudioMappingView class and helpers.
*/
-#include <wx/wx.h>
-#include <wx/renderer.h>
-#include <wx/grid.h>
-#include <dcp/types.h>
-#include <dcp/raw_convert.h>
#include "lib/audio_mapping.h"
#include "lib/util.h"
+#include "lib/raw_convert.h"
#include "audio_mapping_view.h"
#include "wx_util.h"
#include "audio_gain_dialog.h"
+#include <dcp/types.h>
+#include <wx/wx.h>
+#include <wx/renderer.h>
+#include <wx/grid.h>
#include <boost/lexical_cast.hpp>
using std::cout;
_grid->SetCellValue (i, 0, wxString::Format (wxT("%d"), i + 1));
for (int j = 1; j < _grid->GetNumberCols(); ++j) {
- _grid->SetCellValue (i, j, std_to_wx (dcp::raw_convert<string> (_map.get (i, static_cast<dcp::Channel> (j - 1)))));
+ _grid->SetCellValue (i, j, std_to_wx (raw_convert<string> (_map.get (i, static_cast<dcp::Channel> (j - 1)))));
}
}
#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 <dcp/gamma_transfer_function.h>
#include <dcp/modified_gamma_transfer_function.h>
-#include <dcp/raw_convert.h>
#include <wx/spinctrl.h>
#include <wx/gbsizer.h>
#include <boost/lexical_cast.hpp>
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::lexical_cast;
-using dcp::raw_convert;
ColourConversionEditor::ColourConversionEditor (wxWindow* parent)
: wxPanel (parent, wxID_ANY)
*/
-#include <dcp/raw_convert.h>
#include "wx_util.h"
#include "image_sequence_dialog.h"
-
-using dcp::raw_convert;
+#include "lib/raw_convert.h"
ImageSequenceDialog::ImageSequenceDialog (wxWindow* parent)
: TableDialog (parent, _("Add image sequence"), 2, true)
#include "lib/content.h"
#include "lib/image_content.h"
+#include "lib/raw_convert.h"
#include "timing_panel.h"
#include "wx_util.h"
#include "timecode.h"
#include "content_panel.h"
-#include <dcp/raw_convert.h>
#include <set>
using std::cout;
using std::set;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
TimingPanel::TimingPanel (ContentPanel* p)
/* horrid hack for apparent lack of context support with wxWidgets i18n code */