From: Carl Hetherington Date: Mon, 15 Aug 2016 13:56:42 +0000 (+0100) Subject: compose/raw_convert fiddling. X-Git-Tag: v2.9.12~9 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=8e96f8c1677146d224438ec040982532879d6c34 compose/raw_convert fiddling. --- diff --git a/cscript b/cscript index 4e6436ffb..434ae56a3 100644 --- a/cscript +++ b/cscript @@ -237,7 +237,7 @@ def dependencies(target): ffmpeg_options = {} return (('ffmpeg-cdist', '1d4a1a4', ffmpeg_options), - ('libdcp', '11777d1'), + ('libdcp', '943af65'), ('libsub', '067c21c')) def configure_options(target): diff --git a/src/lib/audio_decoder_stream.cc b/src/lib/audio_decoder_stream.cc index 150e7c242..b7b96ddd4 100644 --- a/src/lib/audio_decoder_stream.cc +++ b/src/lib/audio_decoder_stream.cc @@ -153,7 +153,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate) void AudioDecoderStream::audio (shared_ptr data, ContentTime time) { - _log->log (String::compose ("ADS receives %1 %2", time, data->frames ()), LogEntry::TYPE_DEBUG_DECODE); + _log->log (String::compose ("ADS receives %1 %2", to_string(time), data->frames ()), LogEntry::TYPE_DEBUG_DECODE); if (_resampler) { data = _resampler->run (data); diff --git a/src/lib/compose.hpp b/src/lib/compose.hpp index 425aceabf..2c44f148b 100644 --- a/src/lib/compose.hpp +++ b/src/lib/compose.hpp @@ -34,6 +34,7 @@ #ifndef STRING_COMPOSE_H #define STRING_COMPOSE_H +#include #include #include #include @@ -113,112 +114,11 @@ namespace StringPrivate } } - template - 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 int32_t& obj) - { - char buffer[64]; -#ifdef DCPOMATIC_WINDOWS - __mingw_snprintf(buffer, 64, "%" PRId32, obj); -#else - snprintf(buffer, 64, "%" PRId32, obj); -#endif - s += buffer; - } - - template <> - inline void write(std::string& s, const uint32_t& obj) - { - char buffer[64]; -#ifdef DCPOMATIC_WINDOWS - __mingw_snprintf(buffer, 64, "%" PRIu32, obj); -#else - snprintf(buffer, 64, "%" PRIu32, obj); -#endif - s += buffer; - } - - template <> - inline void write(std::string& s, const int64_t& obj) - { - char buffer[64]; -#ifdef DCPOMATIC_WINDOWS - __mingw_snprintf(buffer, 64, "%" PRId64, obj); -#else - snprintf(buffer, 64, "%" PRId64, obj); -#endif - s += buffer; - } - - template <> - inline void write(std::string& s, const uint64_t& obj) - { - char buffer[64]; -#ifdef DCPOMATIC_WINDOWS - __mingw_snprintf(buffer, 64, "%" PRIu64, obj); -#else - snprintf(buffer, 64, "%" PRIu64, obj); -#endif - 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 inline Composition &Composition::arg(const T &obj) { - write(os, obj); + os += dcp::locale_convert(obj); if (!os.empty()) { // manipulators don't produce output for (specification_map::const_iterator i = specs.lower_bound(arg_no), end = specs.upper_bound(arg_no); i != end; ++i) { diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 799607098..b33fa80ac 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -396,3 +396,9 @@ start_batch_converter (boost::filesystem::path dcpomatic) CreateProcess (0, cmd, 0, 0, FALSE, 0, 0, 0, &startup_info, &process_info); #endif } + +int +thread_id () +{ + return (int) pthread_self (); +} diff --git a/src/lib/cross.h b/src/lib/cross.h index 641900bc4..6956b8efa 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -48,6 +48,7 @@ extern boost::filesystem::path shared_path (); extern FILE * fopen_boost (boost::filesystem::path, std::string); extern int dcpomatic_fseek (FILE *, int64_t, int); extern void start_batch_converter (boost::filesystem::path dcpomatic); +extern int thread_id (); /** @class Waker * @brief A class which tries to keep the computer awake on various operating systems. diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index e3ba7d20f..89f541d85 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -177,17 +177,17 @@ DCPVideo::encode_remotely (EncodeServerDescription serv, int timeout) socket->write ((uint8_t *) xml.c_str(), xml.length() + 1); /* Send binary data */ - LOG_TIMING("start-remote-send thread=%1", boost::this_thread::get_id()); + LOG_TIMING("start-remote-send thread=%1", thread_id ()); _frame->send_binary (socket); /* Read the response (JPEG2000-encoded data); this blocks until the data is ready and sent back. */ - LOG_TIMING("start-remote-encode thread=%1", boost::this_thread::get_id ()); + LOG_TIMING("start-remote-encode thread=%1", thread_id ()); Data e (socket->read_uint32 ()); - LOG_TIMING("start-remote-receive thread=%1", boost::this_thread::get_id ()); + LOG_TIMING("start-remote-receive thread=%1", thread_id ()); socket->read (e.data().get(), e.size()); - LOG_TIMING("finish-remote-receive thread=%1", boost::this_thread::get_id ()); + LOG_TIMING("finish-remote-receive thread=%1", thread_id ()); LOG_DEBUG_ENCODE (N_("Finished remotely-encoded frame %1"), _index); diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index 364d29fbe..116dd5d19 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -283,9 +283,9 @@ Encoder::encoder_thread (optional server) try { if (server) { - LOG_TIMING ("start-encoder-thread thread=%1 server=%2", boost::this_thread::get_id (), server->host_name ()); + LOG_TIMING ("start-encoder-thread thread=%1 server=%2", thread_id (), server->host_name ()); } else { - LOG_TIMING ("start-encoder-thread thread=%1 server=localhost", boost::this_thread::get_id ()); + LOG_TIMING ("start-encoder-thread thread=%1 server=localhost", thread_id ()); } /* Number of seconds that we currently wait between attempts @@ -296,15 +296,15 @@ try while (true) { - LOG_TIMING ("encoder-sleep thread=%1", boost::this_thread::get_id()); + LOG_TIMING ("encoder-sleep thread=%1", thread_id ()); boost::mutex::scoped_lock lock (_queue_mutex); while (_queue.empty ()) { _empty_condition.wait (lock); } - LOG_TIMING ("encoder-wake thread=%1 queue=%2", boost::this_thread::get_id(), _queue.size()); + LOG_TIMING ("encoder-wake thread=%1 queue=%2", thread_id(), _queue.size()); shared_ptr vf = _queue.front (); - LOG_TIMING ("encoder-pop thread=%1 frame=%2 eyes=%3", boost::this_thread::get_id(), vf->index(), (int) vf->eyes ()); + LOG_TIMING ("encoder-pop thread=%1 frame=%2 eyes=%3", thread_id(), vf->index(), (int) vf->eyes ()); _queue.pop_front (); lock.unlock (); @@ -336,9 +336,9 @@ try } else { try { - LOG_TIMING ("start-local-encode thread=%1 frame=%2", boost::this_thread::get_id(), vf->index()); + LOG_TIMING ("start-local-encode thread=%1 frame=%2", thread_id(), vf->index()); encoded = vf->encode_locally (boost::bind (&Log::dcp_log, _film->log().get(), _1, _2)); - LOG_TIMING ("finish-local-encode thread=%1 frame=%2", boost::this_thread::get_id(), vf->index()); + LOG_TIMING ("finish-local-encode thread=%1 frame=%2", thread_id(), vf->index()); } catch (std::exception& e) { LOG_ERROR (N_("Local encode failed (%1)"), e.what ()); throw; @@ -350,7 +350,7 @@ try frame_done (); } else { lock.lock (); - LOG_GENERAL (N_("[%1] Encoder thread pushes frame %2 back onto queue after failure"), boost::this_thread::get_id(), vf->index()); + LOG_GENERAL (N_("[%1] Encoder thread pushes frame %2 back onto queue after failure"), thread_id(), vf->index()); _queue.push_front (vf); lock.unlock (); }