Tidy and fix logging.
authorCarl Hetherington <cth@carlh.net>
Wed, 21 Nov 2018 23:17:00 +0000 (23:17 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 21 Nov 2018 23:17:00 +0000 (23:17 +0000)
52 files changed:
src/lib/audio_decoder.cc
src/lib/butler.cc
src/lib/butler.h
src/lib/cinema_kdms.cc
src/lib/cinema_kdms.h
src/lib/content_factory.cc
src/lib/cross.cc
src/lib/cross.h
src/lib/dcp.cc
src/lib/dcp_content.cc
src/lib/dcp_video.cc
src/lib/dcp_video.h
src/lib/encode_server.cc
src/lib/encode_server.h
src/lib/environment_info.cc
src/lib/ffmpeg.cc
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_encoder.cc
src/lib/ffmpeg_encoder.h
src/lib/ffmpeg_file_encoder.cc
src/lib/ffmpeg_file_encoder.h
src/lib/film.cc
src/lib/j2k_encoder.cc
src/lib/job.cc
src/lib/log.cc
src/lib/log.h
src/lib/player.cc
src/lib/reel_writer.cc
src/lib/send_kdm_email_job.cc
src/lib/send_kdm_email_job.h
src/lib/transcode_job.cc
src/lib/upload_job.cc
src/lib/video_content.cc
src/lib/writer.cc
src/lib/wscript
src/tools/dcpomatic.cc
src/tools/dcpomatic_cli.cc
src/tools/dcpomatic_kdm.cc
src/tools/dcpomatic_player.cc
src/tools/dcpomatic_server.cc
src/tools/dcpomatic_server_cli.cc
src/tools/server_test.cc
src/wx/content_panel.cc
src/wx/film_viewer.cc
src/wx/kdm_dialog.cc
src/wx/kdm_output_panel.cc
src/wx/kdm_output_panel.h
test/butler_test.cc
test/client_server_test.cc
test/dcp_playback_test.cc
test/player_test.cc

index 95b3a130db0287819cfe623656adbc7eb08a8a8c..440510ce562c9dbb13304a75f5f3a24e6f471eb2 100644 (file)
@@ -21,6 +21,7 @@
 #include "audio_decoder.h"
 #include "audio_buffers.h"
 #include "audio_content.h"
+#include "dcpomatic_log.h"
 #include "log.h"
 #include "resampler.h"
 #include "compose.hpp"
@@ -29,8 +30,6 @@
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) dcpomatic_log->log (String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL);
-
 using std::cout;
 using std::map;
 using std::pair;
index 409963016f76304d7829d47f2170984c9799fe1d..94230d0942b7b65dd910766495d94c850cb0392f 100644 (file)
 #include "player.h"
 #include "util.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "cross.h"
 #include "compose.hpp"
 #include "exceptions.h"
 #include <boost/weak_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 
-#define LOG_TIMING(...)  _log->log (String::compose(__VA_ARGS__), LogEntry::TYPE_TIMING);
-#define LOG_WARNING(...) _log->log (String::compose(__VA_ARGS__), LogEntry::TYPE_WARNING);
-
 using std::cout;
 using std::pair;
 using std::make_pair;
@@ -57,7 +55,6 @@ using boost::function;
  */
 Butler::Butler (
        shared_ptr<Player> player,
-       shared_ptr<Log> log,
        AudioMapping audio_mapping,
        int audio_channels,
        function<AVPixelFormat (AVPixelFormat)> pixel_format,
@@ -65,7 +62,6 @@ Butler::Butler (
        bool fast
        )
        : _player (player)
-       , _log (log)
        , _prepare_work (new boost::asio::io_service::work (_prepare_service))
        , _pending_seek_accurate (false)
        , _suspended (0)
@@ -95,9 +91,7 @@ Butler::Butler (
           multi-thread JPEG2000 decoding.
        */
 
-       if (_log) {
-               LOG_TIMING("start-prepare-threads %1", boost::thread::hardware_concurrency() * 2);
-       }
+       LOG_TIMING("start-prepare-threads %1", boost::thread::hardware_concurrency() * 2);
 
        for (size_t i = 0; i < boost::thread::hardware_concurrency() * 2; ++i) {
                _prepare_pool.create_thread (bind (&boost::asio::io_service::run, &_prepare_service));
@@ -140,11 +134,11 @@ Butler::should_run () const
                        (__FILE__, __LINE__, String::compose ("Butler audio buffers reached %1 frames (video is %2)", _audio.size(), _video.size()));
        }
 
-       if (_video.size() >= MAXIMUM_VIDEO_READAHEAD * 2 && _log) {
+       if (_video.size() >= MAXIMUM_VIDEO_READAHEAD * 2) {
                LOG_WARNING ("Butler video buffers reached %1 frames (audio is %2)", _video.size(), _audio.size());
        }
 
-       if (_audio.size() >= MAXIMUM_AUDIO_READAHEAD * 2 && _log) {
+       if (_audio.size() >= MAXIMUM_AUDIO_READAHEAD * 2) {
                LOG_WARNING ("Butler audio buffers reached %1 frames (video is %2)", _audio.size(), _video.size());
        }
 
@@ -279,15 +273,9 @@ Butler::prepare (weak_ptr<PlayerVideo> weak_video) const
        shared_ptr<PlayerVideo> video = weak_video.lock ();
        /* If the weak_ptr cannot be locked the video obviously no longer requires any work */
        if (video) {
-               if (_log) {
-                       LOG_TIMING("start-prepare in %1", thread_id());
-               }
-
+               LOG_TIMING("start-prepare in %1", thread_id());
                video->prepare (_pixel_format, _aligned, _fast);
-
-               if (_log) {
-                       LOG_TIMING("finish-prepare in %1", thread_id());
-               }
+               LOG_TIMING("finish-prepare in %1", thread_id());
        }
 }
 
index b1debfca2b2c948bb407cb8faa3cc844d6444ae3..4f4e508843d8cb04f45fc545a4f13119b8b5ecdd 100644 (file)
 
 class Player;
 class PlayerVideo;
-class Log;
 
 class Butler : public ExceptionStore, public boost::noncopyable
 {
 public:
        Butler (
                boost::shared_ptr<Player> player,
-               boost::shared_ptr<Log> log,
                AudioMapping map,
                int audio_channels,
                boost::function<AVPixelFormat (AVPixelFormat)> pixel_format,
@@ -75,7 +73,6 @@ private:
        void seek_unlocked (DCPTime position, bool accurate);
 
        boost::shared_ptr<Player> _player;
-       boost::shared_ptr<Log> _log;
        boost::thread* _thread;
 
        /** mutex to protect _video, _audio and _closed_caption for when we are clearing them and they all need to be
index aaeb0d9056f3f89b94b9c62c731b4a8edd7912ef..f5d9aef4172705f599680281f6e2c5f98ee32d93 100644 (file)
@@ -27,6 +27,7 @@
 #include "emailer.h"
 #include "compose.hpp"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include <zip.h>
 #include <boost/foreach.hpp>
 
@@ -184,7 +185,6 @@ CinemaKDMs::write_zip_files (
  *  @param filename_format Format of filenames to use.
  *  @param name_values Values to substitute into \p container_name_format and \p filename_format.
  *  @param cpl_name Name of the CPL that the KDMs are for.
- *  @param log Log to write email session transcript to, or 0.
  */
 void
 CinemaKDMs::email (
@@ -192,8 +192,7 @@ CinemaKDMs::email (
        dcp::NameFormat container_name_format,
        dcp::NameFormat filename_format,
        dcp::NameFormat::Map name_values,
-       string cpl_name,
-       shared_ptr<Log> log
+       string cpl_name
        )
 {
        Config* config = Config::instance ();
@@ -249,22 +248,18 @@ CinemaKDMs::email (
                        email.send (c->mail_server(), c->mail_port(), c->mail_user(), c->mail_password());
                } catch (...) {
                        boost::filesystem::remove (zip_file);
-                       if (log) {
-                               log->log ("Email content follows", LogEntry::TYPE_DEBUG_EMAIL);
-                               log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL);
-                               log->log ("Email session follows", LogEntry::TYPE_DEBUG_EMAIL);
-                               log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL);
-                       }
+                       dcpomatic_log->log ("Email content follows", LogEntry::TYPE_DEBUG_EMAIL);
+                       dcpomatic_log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL);
+                       dcpomatic_log->log ("Email session follows", LogEntry::TYPE_DEBUG_EMAIL);
+                       dcpomatic_log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL);
                        throw;
                }
 
                boost::filesystem::remove (zip_file);
 
-               if (log) {
-                       log->log ("Email content follows", LogEntry::TYPE_DEBUG_EMAIL);
-                       log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL);
-                       log->log ("Email session follows", LogEntry::TYPE_DEBUG_EMAIL);
-                       log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL);
-               }
+               dcpomatic_log->log ("Email content follows", LogEntry::TYPE_DEBUG_EMAIL);
+               dcpomatic_log->log (email.email(), LogEntry::TYPE_DEBUG_EMAIL);
+               dcpomatic_log->log ("Email session follows", LogEntry::TYPE_DEBUG_EMAIL);
+               dcpomatic_log->log (email.notes(), LogEntry::TYPE_DEBUG_EMAIL);
        }
 }
index 9d4887f5ae53456fe48fe54cd12e78108c342a71..566b947a23e22208a64a774a3fe7752b6fcb22d3 100644 (file)
@@ -54,8 +54,7 @@ public:
                dcp::NameFormat container_name_format,
                dcp::NameFormat filename_format,
                dcp::NameFormat::Map name_values,
-               std::string cpl_name,
-               boost::shared_ptr<Log> log
+               std::string cpl_name
                );
 
        boost::shared_ptr<Cinema> cinema;
index 30f02546cfa757c36854de594a4ea5bad52da430..f123061b75ea1e936d311a128c6a2c779e3fa3e0 100644 (file)
@@ -34,6 +34,7 @@
 #include "video_mxf_content.h"
 #include "film.h"
 #include "log_entry.h"
+#include "dcpomatic_log.h"
 #include "log.h"
 #include "compose.hpp"
 #include <libcxml/cxml.h>
@@ -47,8 +48,6 @@ using std::list;
 using boost::shared_ptr;
 using boost::optional;
 
-#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-
 /** Create a Content object from an XML node.
  *  @param node XML description.
  *  @param version XML state version.
index 75205dc1aa11709d84b651421f452005e0399b6d..61b150a3b68fe05526a8a81aa60ff024a414cc6c 100644 (file)
@@ -21,6 +21,7 @@
 #include "cross.h"
 #include "compose.hpp"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "config.h"
 #include "exceptions.h"
 extern "C" {
@@ -53,10 +54,6 @@ extern "C" {
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_ERROR(...) log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR);
-#define LOG_ERROR_NC(...) log->log (__VA_ARGS__, LogEntry::TYPE_ERROR);
-
 using std::pair;
 using std::list;
 using std::ifstream;
@@ -182,7 +179,7 @@ shared_path ()
 }
 
 void
-run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, shared_ptr<Log> log)
+run_ffprobe (boost::filesystem::path content, boost::filesystem::path out)
 {
 #ifdef DCPOMATIC_WINDOWS
        SECURITY_ATTRIBUTES security;
index f1af03346d5253ace206a45dc17b5a957e101901..cd0372338fc062ec3e5a4fce4a631f52f119b0d1 100644 (file)
@@ -39,7 +39,7 @@ struct AVIOContext;
 
 void dcpomatic_sleep (int);
 extern std::string cpu_info ();
-extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path, boost::shared_ptr<Log>);
+extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path);
 extern std::list<std::pair<std::string, std::string> > mount_info ();
 extern boost::filesystem::path openssl_path ();
 #ifdef DCPOMATIC_OSX
index 1bf15ca249dee74f4245378508c6d3c8fe2b9db0..f506d5c70bf2d4b9bc839fa25f71e6057a145c62 100644 (file)
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "film.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "compose.hpp"
 #include "dcp_content.h"
 #include <dcp/dcp.h>
@@ -35,8 +36,6 @@ using std::list;
 using std::string;
 using boost::shared_ptr;
 
-#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-
 /** Find all the CPLs in our directories, cross-add assets and return the CPLs */
 list<shared_ptr<dcp::CPL> >
 DCP::cpls () const
index 3110f93ad5eb6b61abf18ceb1e752da5f7647b7b..b455e7f7f63b7e4018fbc39600a1b9e78cd8de67 100644 (file)
@@ -29,6 +29,7 @@
 #include "compose.hpp"
 #include "dcp_decoder.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "text_content.h"
 #include <dcp/dcp.h>
 #include <dcp/raw_convert.h>
@@ -64,8 +65,6 @@ int const DCPContentProperty::NAME               = 605;
 int const DCPContentProperty::TEXTS              = 606;
 int const DCPContentProperty::CPL                = 607;
 
-#define LOG_GENERAL(...) dcpomatic_log->log(String::compose(__VA_ARGS__), LogEntry::TYPE_GENERAL);
-
 DCPContent::DCPContent (boost::filesystem::path p)
        : _encrypted (false)
        , _needs_assets (false)
index 31d1661947b80527d5a51f825b10f5ae6abf2f40..6f32b6686dca1ac44eeeb4d8d7a575f4c1e004fe 100644 (file)
@@ -35,6 +35,7 @@
 #include "dcpomatic_socket.h"
 #include "image.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "cross.h"
 #include "player_video.h"
 #include "compose.hpp"
 #include <iomanip>
 #include <iostream>
 
-#define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_DEBUG_ENCODE(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_DEBUG_ENCODE);
-#define LOG_TIMING(...) _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_TIMING);
-
 #include "i18n.h"
 
 using std::string;
@@ -69,24 +66,21 @@ using dcp::raw_convert;
  *  @param frame Input frame.
  *  @param index Index of the frame within the DCP.
  *  @param bw J2K bandwidth to use (see Config::j2k_bandwidth ())
- *  @param l Log to write to.
  */
 DCPVideo::DCPVideo (
-       shared_ptr<const PlayerVideo> frame, int index, int dcp_fps, int bw, Resolution r, shared_ptr<Log> l
+       shared_ptr<const PlayerVideo> frame, int index, int dcp_fps, int bw, Resolution r
        )
        : _frame (frame)
        , _index (index)
        , _frames_per_second (dcp_fps)
        , _j2k_bandwidth (bw)
        , _resolution (r)
-       , _log (l)
 {
 
 }
 
-DCPVideo::DCPVideo (shared_ptr<const PlayerVideo> frame, shared_ptr<const cxml::Node> node, shared_ptr<Log> log)
+DCPVideo::DCPVideo (shared_ptr<const PlayerVideo> frame, shared_ptr<const cxml::Node> node)
        : _frame (frame)
-       , _log (log)
 {
        _index = node->number_child<int> ("Index");
        _frames_per_second = node->number_child<int> ("FramesPerSecond");
@@ -119,10 +113,10 @@ DCPVideo::convert_to_xyz (shared_ptr<const PlayerVideo> frame, dcp::NoteHandler
  *  @return Encoded data.
  */
 Data
-DCPVideo::encode_locally (dcp::NoteHandler note)
+DCPVideo::encode_locally ()
 {
        Data enc = compress_j2k (
-               convert_to_xyz (_frame, note),
+               convert_to_xyz (_frame, boost::bind(&Log::dcp_log, dcpomatic_log.get(), _1, _2)),
                _j2k_bandwidth,
                _frames_per_second,
                _frame->eyes() == EYES_LEFT || _frame->eyes() == EYES_RIGHT,
index 32cd1a1699ac56382ee547c04830af88b0808777..81ddc4470c9e748f81289262a3da382eae11ee68 100644 (file)
@@ -42,10 +42,10 @@ class PlayerVideo;
 class DCPVideo : public boost::noncopyable
 {
 public:
-       DCPVideo (boost::shared_ptr<const PlayerVideo>, int, int, int, Resolution, boost::shared_ptr<Log>);
-       DCPVideo (boost::shared_ptr<const PlayerVideo>, cxml::ConstNodePtr, boost::shared_ptr<Log>);
+       DCPVideo (boost::shared_ptr<const PlayerVideo>, int, int, int, Resolution);
+       DCPVideo (boost::shared_ptr<const PlayerVideo>, cxml::ConstNodePtr);
 
-       dcp::Data encode_locally (dcp::NoteHandler note);
+       dcp::Data encode_locally ();
        dcp::Data encode_remotely (EncodeServerDescription, int timeout = 30);
 
        int index () const {
@@ -67,6 +67,4 @@ private:
        int _frames_per_second;          ///< Frames per second that we will use for the DCP
        int _j2k_bandwidth;              ///< J2K bandwidth to use
        Resolution _resolution;          ///< Resolution (2K or 4K)
-
-       boost::shared_ptr<Log> _log; ///< log
 };
index 2603732c890041ff45fb6a0b356d640427e74aca..9902c8e84c65bf8d792700f6b2ce5594ea216c4d 100644 (file)
@@ -33,6 +33,7 @@
 #include "player_video.h"
 #include "compose.hpp"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "encoded_log_entry.h"
 #include "version.h"
 #include <dcp/raw_convert.h>
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...)    _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_GENERAL_NC(...) _log->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
-#define LOG_ERROR(...)      _log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR);
-#define LOG_ERROR_NC(...)   _log->log (__VA_ARGS__, LogEntry::TYPE_ERROR);
-
 using std::string;
 using std::vector;
 using std::list;
@@ -70,13 +66,12 @@ using dcp::Size;
 using dcp::Data;
 using dcp::raw_convert;
 
-EncodeServer::EncodeServer (shared_ptr<Log> log, bool verbose, int num_threads)
+EncodeServer::EncodeServer (bool verbose, int num_threads)
 #if !defined(RUNNING_ON_VALGRIND) || RUNNING_ON_VALGRIND == 0
        : Server (ENCODE_FRAME_PORT)
 #else
        : Server (ENCODE_FRAME_PORT, 2400)
 #endif
-       , _log (log)
        , _verbose (verbose)
        , _num_threads (num_threads)
 {
@@ -141,11 +136,11 @@ EncodeServer::process (shared_ptr<Socket> socket, struct timeval& after_read, st
 
        shared_ptr<PlayerVideo> pvf (new PlayerVideo (xml, socket));
 
-       DCPVideo dcp_video_frame (pvf, xml, _log);
+       DCPVideo dcp_video_frame (pvf, xml);
 
        gettimeofday (&after_read, 0);
 
-       Data encoded = dcp_video_frame.encode_locally (boost::bind (&Log::dcp_log, _log.get(), _1, _2));
+       Data encoded = dcp_video_frame.encode_locally ();
 
        gettimeofday (&after_encode, 0);
 
@@ -220,7 +215,7 @@ EncodeServer::worker_thread ()
                                cout << e->get() << "\n";
                        }
 
-                       _log->log (e);
+                       dcpomatic_log->log (e);
                }
 
                _full_condition.notify_all ();
index 00a1b6b12b0e65abcbf850007669d0767ea0e826..c9bd5571849d1d0e66aa670daab2795e6930e714 100644 (file)
@@ -42,7 +42,7 @@ class Log;
 class EncodeServer : public Server, public ExceptionStore
 {
 public:
-       EncodeServer (boost::shared_ptr<Log> log, bool verbose, int num_threads);
+       EncodeServer (bool verbose, int num_threads);
        ~EncodeServer ();
 
        void run ();
@@ -58,7 +58,6 @@ private:
        std::list<boost::shared_ptr<Socket> > _queue;
        boost::condition _full_condition;
        boost::condition _empty_condition;
-       boost::shared_ptr<Log> _log;
        bool _verbose;
        int _num_threads;
 
index 68496f9965da300415928d7d21558ea3ffda9fd5..31279acfbf539b1be227542d9194af3ebd4a0ab2 100644 (file)
@@ -35,9 +35,6 @@ extern "C" {
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_GENERAL_NC(...) log->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
-
 using std::string;
 using std::list;
 using std::pair;
index 3bd08e84a6ea7c1be2f27426e1755171dce484d4..53829c5f2391919056b4248a368693b7fef1d640 100644 (file)
@@ -24,6 +24,7 @@
 #include "exceptions.h"
 #include "util.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "ffmpeg_subtitle_stream.h"
 #include "ffmpeg_audio_stream.h"
 #include "digester.h"
@@ -49,7 +50,6 @@ using boost::optional;
 using dcp::raw_convert;
 
 boost::mutex FFmpeg::_mutex;
-boost::weak_ptr<Log> FFmpeg::_ffmpeg_log;
 
 FFmpeg::FFmpeg (boost::shared_ptr<const FFmpegContent> c)
        : _ffmpeg_content (c)
@@ -97,14 +97,9 @@ FFmpeg::ffmpeg_log_callback (void* ptr, int level, const char* fmt, va_list vl)
        char line[1024];
        static int prefix = 0;
        av_log_format_line (ptr, level, fmt, vl, line, sizeof (line), &prefix);
-       shared_ptr<Log> log = _ffmpeg_log.lock ();
-       if (log) {
-               string str (line);
-               boost::algorithm::trim (str);
-               log->log (String::compose ("FFmpeg: %1", str), LogEntry::TYPE_GENERAL);
-       } else {
-               cerr << line;
-       }
+       string str (line);
+       boost::algorithm::trim (str);
+       dcpomatic_log->log (String::compose ("FFmpeg: %1", str), LogEntry::TYPE_GENERAL);
 }
 
 void
index fcadc91165ab12179b9e1987467fd912115d97fa..34a6e144432f2d3d467e3a925eb8441cd7678dc9 100644 (file)
@@ -45,8 +45,6 @@ extern "C" {
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-
 using std::string;
 using std::vector;
 using std::list;
index fbc0ee416b77dcb74db59aba773265a0fddab750..3d9e965a9d169ad3e66a014cb3cb4e0d7a750c1b 100644 (file)
@@ -27,6 +27,7 @@
 #include "image.h"
 #include "util.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "ffmpeg_decoder.h"
 #include "text_decoder.h"
 #include "ffmpeg_audio_stream.h"
@@ -58,10 +59,6 @@ extern "C" {
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_ERROR(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR);
-#define LOG_WARNING_NC(...) dcpomatic_log->log (__VA_ARGS__, LogEntry::TYPE_WARNING);
-#define LOG_WARNING(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_WARNING);
 
 using std::cout;
 using std::string;
index 8bb9b5e45b7556fab9fdd5fc67cf7db85d51c5a2..07b69195605dfd35998448f1c1a9e885d1715276 100644 (file)
@@ -73,7 +73,6 @@ FFmpegEncoder::FFmpegEncoder (
                                _film->video_frame_rate(),
                                _film->audio_frame_rate(),
                                mixdown_to_stereo ? 2 : film->audio_channels(),
-                               _film->log(),
                                format,
                                x264_crf,
                                _film->three_d(),
@@ -108,7 +107,7 @@ FFmpegEncoder::FFmpegEncoder (
                }
        }
 
-       _butler.reset (new Butler (_player, film->log(), map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), true, false));
+       _butler.reset (new Butler(_player, map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), true, false));
 }
 
 void
@@ -191,7 +190,6 @@ FFmpegEncoder::FileEncoderSet::FileEncoderSet (
        int video_frame_rate,
        int audio_frame_rate,
        int channels,
-       shared_ptr<Log> log,
        ExportFormat format,
        int x264_crf,
        bool three_d,
@@ -202,15 +200,15 @@ FFmpegEncoder::FileEncoderSet::FileEncoderSet (
        if (three_d) {
                /// TRANSLATORS: L here is an abbreviation for "left", to indicate the left-eye part of a 3D export
                _encoders[EYES_LEFT] = shared_ptr<FFmpegFileEncoder>(
-                       new FFmpegFileEncoder(video_frame_size, video_frame_rate, audio_frame_rate, channels, log, format, x264_crf, String::compose("%1_%2%3", output.string(), _("L"), extension))
+                       new FFmpegFileEncoder(video_frame_size, video_frame_rate, audio_frame_rate, channels, format, x264_crf, String::compose("%1_%2%3", output.string(), _("L"), extension))
                        );
                /// TRANSLATORS: R here is an abbreviation for "left", to indicate the left-eye part of a 3D export
                _encoders[EYES_RIGHT] = shared_ptr<FFmpegFileEncoder>(
-                       new FFmpegFileEncoder(video_frame_size, video_frame_rate, audio_frame_rate, channels, log, format, x264_crf, String::compose("%1_%2%3", output.string(), _("R"), extension))
+                       new FFmpegFileEncoder(video_frame_size, video_frame_rate, audio_frame_rate, channels, format, x264_crf, String::compose("%1_%2%3", output.string(), _("R"), extension))
                        );
        } else {
                _encoders[EYES_BOTH]  = shared_ptr<FFmpegFileEncoder>(
-                       new FFmpegFileEncoder(video_frame_size, video_frame_rate, audio_frame_rate, channels, log, format, x264_crf, String::compose("%1%2", output.string(), extension))
+                       new FFmpegFileEncoder(video_frame_size, video_frame_rate, audio_frame_rate, channels, format, x264_crf, String::compose("%1%2", output.string(), extension))
                        );
        }
 }
index 5356c5ce2fd8aae6786493b10c4052e59fab43a8..79539acce44a24f8f7be9da8f8d1f9030645bc27 100644 (file)
@@ -59,7 +59,6 @@ private:
                        int video_frame_rate,
                        int audio_frame_rate,
                        int channels,
-                       boost::shared_ptr<Log> log,
                        ExportFormat,
                        int x264_crf,
                        bool three_d,
index 804022f0bfe8ebab3660af4f8d1fd6055e062647..2c67bb5f927be110d0cbadea7f0d110beb0a8f4d 100644 (file)
@@ -47,7 +47,6 @@ FFmpegFileEncoder::FFmpegFileEncoder (
        int video_frame_rate,
        int audio_frame_rate,
        int channels,
-       shared_ptr<Log> log,
        ExportFormat format,
        int x264_crf,
        boost::filesystem::path output
@@ -58,7 +57,6 @@ FFmpegFileEncoder::FFmpegFileEncoder (
        , _video_frame_size (video_frame_size)
        , _video_frame_rate (video_frame_rate)
        , _audio_frame_rate (audio_frame_rate)
-       , _log (log)
 {
        _pixel_format = pixel_format (format);
 
index 63826e2d5169bbe26298d910132f17955b8d440c..8b9d0b67c2a7269af994690ca52ede24a6880bc2 100644 (file)
@@ -38,7 +38,6 @@ public:
                int video_frame_rate,
                int audio_frame_rate,
                int channels,
-               boost::shared_ptr<Log> log,
                ExportFormat,
                int x264_crf,
                boost::filesystem::path output
@@ -79,7 +78,6 @@ private:
        dcp::Size _video_frame_size;
        int _video_frame_rate;
        int _audio_frame_rate;
-       boost::shared_ptr<Log> _log;
 
        boost::shared_ptr<AudioBuffers> _pending_audio;
 
index 4d6b3d7e3b4fa132bf54b9e75fa568246f1e3615..60b80d052689de056619a2dc8b967fba4f46f66b 100644 (file)
@@ -32,6 +32,7 @@
 #include "upload_job.h"
 #include "null_log.h"
 #include "file_log.h"
+#include "dcpomatic_log.h"
 #include "exceptions.h"
 #include "examine_content_job.h"
 #include "config.h"
@@ -98,9 +99,6 @@ using boost::optional;
 using boost::is_any_of;
 using dcp::raw_convert;
 
-#define LOG_GENERAL(...) log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_GENERAL_NC(...) log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
-
 string const Film::metadata_file = "metadata.xml";
 
 /* 5 -> 6
@@ -1087,7 +1085,7 @@ void
 Film::examine_and_add_content (shared_ptr<Content> content, bool disable_audio_analysis)
 {
        if (dynamic_pointer_cast<FFmpegContent> (content) && _directory) {
-               run_ffprobe (content->path(0), file ("ffprobe.log"), _log);
+               run_ffprobe (content->path(0), file("ffprobe.log"));
        }
 
        shared_ptr<Job> j (new ExamineContentJob (shared_from_this(), content));
index f92f2316800cea24818c84a9f2eab986bedd7770..94728d6a9e6acccbe5839e4acc0c73d3d1b09530 100644 (file)
@@ -26,6 +26,7 @@
 #include "util.h"
 #include "film.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "config.h"
 #include "dcp_video.h"
 #include "cross.h"
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_GENERAL_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
-#define LOG_ERROR(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR);
-#define LOG_TIMING(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_TIMING);
-#define LOG_DEBUG_ENCODE(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_DEBUG_ENCODE);
-
 using std::list;
 using std::cout;
 using boost::shared_ptr;
@@ -134,9 +129,9 @@ J2KEncoder::end ()
                LOG_GENERAL (N_("Encode left-over frame %1"), (*i)->index ());
                try {
                        _writer->write (
-                               (*i)->encode_locally (boost::bind (&Log::dcp_log, _film->log().get(), _1, _2)),
-                               (*i)->index (),
-                               (*i)->eyes ()
+                               (*i)->encode_locally(),
+                               (*i)->index(),
+                               (*i)->eyes()
                                );
                        frame_done ();
                } catch (std::exception& e) {
@@ -233,8 +228,7 @@ J2KEncoder::encode (shared_ptr<PlayerVideo> pv, DCPTime time)
                                                  position,
                                                  _film->video_frame_rate(),
                                                  _film->j2k_bandwidth(),
-                                                 _film->resolution(),
-                                                 _film->log()
+                                                 _film->resolution()
                                                  )
                                          ));
 
@@ -338,7 +332,7 @@ try
                        } else {
                                try {
                                        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));
+                                       encoded = vf->encode_locally ();
                                        LOG_TIMING ("finish-local-encode thread=%1 frame=%2", thread_id(), vf->index());
                                } catch (std::exception& e) {
                                        /* This is very bad, so don't cope with it, just pass it on */
index 7539a50703faa2074375bbf17ff7639509a7ddc5..dde8cce62ad42379c999ccf2103f891afbca6b04 100644 (file)
@@ -28,6 +28,7 @@
 #include "exceptions.h"
 #include "film.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "compose.hpp"
 #include <dcp/exceptions.h>
 #include <sub/exceptions.h>
@@ -46,9 +47,6 @@ using boost::shared_ptr;
 using boost::optional;
 using boost::function;
 
-#define LOG_ERROR_NC(...) if (_film) { _film->log()->log (__VA_ARGS__, LogEntry::TYPE_ERROR); }
-#define LOG_GENERAL(...) if (_film) { _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL); }
-
 /** @param film Associated film, or 0 */
 Job::Job (shared_ptr<const Film> film)
        : _film (film)
index 8f7794aed8f48cb265eda768a8b954cb07280bf8..e3ffd1cadcc05f4f114e107df4e870d46ce0a3f6 100644 (file)
@@ -35,8 +35,6 @@ using std::string;
 using std::cout;
 using boost::shared_ptr;
 
-boost::shared_ptr<Log> dcpomatic_log;
-
 Log::Log ()
        : _types (0)
 {
index 636de6a583e0172b6d8d410147b1b59bcf5e3d0d..65d0229e981876a2e1741f580ce51460d4aa214d 100644 (file)
@@ -66,6 +66,4 @@ private:
        boost::signals2::scoped_connection _config_connection;
 };
 
-extern boost::shared_ptr<Log> dcpomatic_log;
-
 #endif
index 5a71c133001016b893e6457399d1a8ed1318855e..ae16290f57d7343297bde3e3a5ed9c307991f3be 100644 (file)
@@ -60,8 +60,6 @@
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-
 using std::list;
 using std::cout;
 using std::min;
index 9a600a739b8fc59d5a3ccd727e102a54a15bea16..350120d9d1ceebe61576204b615224e8a59d8316 100644 (file)
@@ -23,6 +23,7 @@
 #include "cross.h"
 #include "job.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "digester.h"
 #include "font.h"
 #include "compose.hpp"
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_GENERAL_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
-#define LOG_WARNING_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_WARNING);
-#define LOG_ERROR(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR);
-
 using std::list;
 using std::string;
 using std::cout;
index eff77ce43bfa6b6467876fb24705df093171878c..38484b91e15500333184422541b45c77e763c396 100644 (file)
@@ -35,15 +35,13 @@ using boost::shared_ptr;
  *  @param filename_format Format to use for filenames.
  *  @param name_values Values to substitute into \p container_name_format and \p filename_format.
  *  @param cpl_name Name of the CPL that the KDMs are for.
- *  @param log Log to write to, or 0.
  */
 SendKDMEmailJob::SendKDMEmailJob (
        list<CinemaKDMs> cinema_kdms,
        dcp::NameFormat container_name_format,
        dcp::NameFormat filename_format,
        dcp::NameFormat::Map name_values,
-       string cpl_name,
-       shared_ptr<Log> log
+       string cpl_name
        )
        : Job (shared_ptr<Film>())
        , _container_name_format (container_name_format)
@@ -51,7 +49,6 @@ SendKDMEmailJob::SendKDMEmailJob (
        , _name_values (name_values)
        , _cpl_name (cpl_name)
        , _cinema_kdms (cinema_kdms)
-       , _log (log)
 {
 
 }
@@ -77,7 +74,7 @@ void
 SendKDMEmailJob::run ()
 {
        set_progress_unknown ();
-       CinemaKDMs::email (_cinema_kdms, _container_name_format, _filename_format, _name_values, _cpl_name, _log);
+       CinemaKDMs::email (_cinema_kdms, _container_name_format, _filename_format, _name_values, _cpl_name);
        set_progress (1);
        set_state (FINISHED_OK);
 }
index 88de1e9fee6bf86f8e997152391f2829e2674369..b4e007e3ba51cac9d576c115b90e4bac20245070 100644 (file)
@@ -35,8 +35,7 @@ public:
                dcp::NameFormat container_name_format,
                dcp::NameFormat filename_format,
                dcp::NameFormat::Map name_values,
-               std::string cpl_name,
-               boost::shared_ptr<Log> log
+               std::string cpl_name
                );
 
        std::string name () const;
@@ -49,5 +48,4 @@ private:
        dcp::NameFormat::Map _name_values;
        std::string _cpl_name;
        std::list<CinemaKDMs> _cinema_kdms;
-       boost::shared_ptr<Log> _log;
 };
index 420f5a8d219240ed726e617c9cab49febae7a9a5..15711a79678f368c9e542dec6b58fc1f88b26409 100644 (file)
 #include "film.h"
 #include "encoder.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "compose.hpp"
 #include <iostream>
 #include <iomanip>
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_GENERAL_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
-#define LOG_ERROR_NC(...)   _film->log()->log (__VA_ARGS__, LogEntry::TYPE_ERROR);
-
 using std::string;
 using std::fixed;
 using std::setprecision;
index 4726c734ab19db889ea97e8f3bcda684db3d1b71..cbcb8dfc622ce3261175fafec32df5311116ae5e 100644 (file)
@@ -26,6 +26,7 @@
 #include "upload_job.h"
 #include "config.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "film.h"
 #include "scp_uploader.h"
 #include "curl_uploader.h"
@@ -33,8 +34,6 @@
 
 #include "i18n.h"
 
-#define LOG_GENERAL_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
-
 using std::string;
 using std::min;
 using boost::shared_ptr;
index 15445a68a4c7ea0a5e564b2fcd6fc52d4a9739b0..932977858e8649abec0364e843c8e4c0da10c1f1 100644 (file)
@@ -30,6 +30,7 @@
 #include "exceptions.h"
 #include "frame_rate_change.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
@@ -38,8 +39,6 @@
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) dcpomatic_log->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-
 int const VideoContentProperty::SIZE     = 0;
 int const VideoContentProperty::FRAME_TYPE  = 1;
 int const VideoContentProperty::CROP     = 2;
index 893c009cd8b022d0accc152711677f34eacaf74f..c31ae2a91661f5e42b5403f28220bc0a1e8c4936 100644 (file)
@@ -23,6 +23,7 @@
 #include "film.h"
 #include "ratio.h"
 #include "log.h"
+#include "dcpomatic_log.h"
 #include "dcp_video.h"
 #include "dcp_content_type.h"
 #include "audio_mapping.h"
 
 #include "i18n.h"
 
-#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_GENERAL_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
-#define LOG_DEBUG_ENCODE(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_DEBUG_ENCODE);
-#define LOG_TIMING(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_TIMING);
-#define LOG_WARNING_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_WARNING);
-#define LOG_WARNING(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_WARNING);
-#define LOG_ERROR(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_ERROR);
-
 /* OS X strikes again */
 #undef set_key
 
index 88cec75ec940868d829a04e4dc0bf1e9d22e6322..7c332e88df1d4843a74bf1598fa4786e3bf12518 100644 (file)
@@ -63,6 +63,7 @@ sources = """
           dcp_subtitle_decoder.cc
           dcp_text_track.cc
           dcp_video.cc
+          dcpomatic_log.cc
           dcpomatic_socket.cc
           dcpomatic_time.cc
           decoder.cc
index 1a87a2872ee684269e727faf5c86a94db8ffe8e6..bd0c40e889d9c977d543766fb75d4255063cfc02 100644 (file)
@@ -76,6 +76,7 @@
 #include "lib/audio_content.h"
 #include "lib/check_content_change_job.h"
 #include "lib/text_content.h"
+#include "lib/dcpomatic_log.h"
 #include <dcp/exceptions.h>
 #include <dcp/raw_convert.h>
 #include <wx/generic/aboutdlgg.h>
@@ -402,6 +403,7 @@ public:
                film->set_name (path.filename().generic_string());
                film->write_metadata ();
                set_film (film);
+               dcpomatic_log = film->log ();
        }
 
        void load_film (boost::filesystem::path file)
index 779e0ad266d57f7421806c5038c37c02e69664c6..5535e6218868cd7a27fe57f929908192aad2b7cb 100644 (file)
@@ -33,6 +33,7 @@
 #include "lib/ratio.h"
 #include "lib/video_content.h"
 #include "lib/audio_content.h"
+#include "lib/dcpomatic_log.h"
 #include <dcp/version.h>
 #include <boost/foreach.hpp>
 #include <getopt.h>
@@ -331,6 +332,8 @@ main (int argc, char* argv[])
                exit (EXIT_SUCCESS);
        }
 
+       dcpomatic_log = film->log ();
+
        ContentList content = film->content ();
        for (ContentList::const_iterator i = content.begin(); i != content.end(); ++i) {
                vector<boost::filesystem::path> paths = (*i)->paths ();
index e901d2d0c34dfa59fa65953c428a103a03faf481..2af57e3690dbc6fc5ea8e92ff06b76f6ec04a943 100644 (file)
@@ -340,7 +340,7 @@ private:
                        }
 
                        pair<shared_ptr<Job>, int> result = _output->make (
-                               screen_kdms, decrypted.content_title_text(), _timing, bind (&DOMFrame::confirm_overwrite, this, _1), shared_ptr<Log> ()
+                               screen_kdms, decrypted.content_title_text(), _timing, bind (&DOMFrame::confirm_overwrite, this, _1)
                                );
 
                        if (result.first) {
index 7028624a847116c270df7839a248f0781485ecfb..d00129a4c6a10176b47228ed97c69ac3a5048a41 100644 (file)
@@ -51,6 +51,7 @@
 #include "lib/monitor_checker.h"
 #include "lib/lock_file_checker.h"
 #include "lib/ffmpeg_content.h"
+#include "lib/dcpomatic_log.h"
 #include <dcp/dcp.h>
 #include <dcp/raw_convert.h>
 #include <dcp/exceptions.h>
index 2b22aca7d8d8d077fa03dce8956712d5a4dd5c1b..64bbb3049504139195485572cd6f46b78ec11bf6 100644 (file)
@@ -27,6 +27,7 @@
 #include "lib/log.h"
 #include "lib/signaller.h"
 #include "lib/cross.h"
+#include "lib/dcpomatic_log.h"
 #include <wx/taskbar.h>
 #include <wx/splash.h>
 #include <wx/icon.h>
@@ -268,6 +269,7 @@ private:
                }
 
                server_log.reset (new ServerLog);
+               dcpomatic_log = server_log;
 
                Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
                Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
@@ -304,7 +306,7 @@ private:
 
        void main_thread ()
        try {
-               EncodeServer server (server_log, false, Config::instance()->server_encoding_threads());
+               EncodeServer server (false, Config::instance()->server_encoding_threads());
                server.run ();
        } catch (...) {
                store_current ();
index 6dca8064c77163a730c8aa6b4846f6fe140a2e7b..d1bee2dcc8cd3d64bb9b431528a627e4e8a4a7b8 100644 (file)
@@ -28,6 +28,7 @@
 #include "lib/null_log.h"
 #include "lib/version.h"
 #include "lib/encode_server.h"
+#include "lib/dcpomatic_log.h"
 #include <boost/array.hpp>
 #include <boost/asio.hpp>
 #include <boost/algorithm/string.hpp>
@@ -104,14 +105,11 @@ main (int argc, char* argv[])
                }
        }
 
-       shared_ptr<Log> log;
        if (write_log) {
-               log.reset (new FileLog ("dcpomatic_server_cli.log"));
-       } else {
-               log.reset (new NullLog);
+               dcpomatic_log.reset (new FileLog("dcpomatic_server_cli.log"));
        }
 
-       EncodeServer server (log, verbose, num_threads);
+       EncodeServer server (verbose, num_threads);
 
        try {
                server.run ();
index 3d16038c19fc6b10f43c933cbc5d16ff58bcf29a..1dc6fa6ca8ffe559f6d6d1f06c658fbd4aa176d2 100644 (file)
@@ -47,21 +47,20 @@ using dcp::Data;
 
 static shared_ptr<Film> film;
 static EncodeServerDescription* server;
-static shared_ptr<FileLog> log_ (new FileLog ("servomatictest.log"));
 static int frame_count = 0;
 
 void
 process_video (shared_ptr<PlayerVideo> pvf)
 {
-       shared_ptr<DCPVideo> local  (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
-       shared_ptr<DCPVideo> remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_));
+       shared_ptr<DCPVideo> local  (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K));
+       shared_ptr<DCPVideo> remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K));
 
        cout << "Frame " << frame_count << ": ";
        cout.flush ();
 
        ++frame_count;
 
-       Data local_encoded = local->encode_locally (boost::bind (&Log::dcp_log, log_.get(), _1, _2));
+       Data local_encoded = local->encode_locally ();
        Data remote_encoded;
 
        string remote_error;
index 93b270faac8029352915946ce3a11636a199e529..89690a5d0f6be9b0554efdcff2708187bc3fbd3c 100644 (file)
@@ -41,6 +41,7 @@
 #include "lib/compose.hpp"
 #include "lib/string_text_file_content.h"
 #include "lib/string_text_file.h"
+#include "lib/dcpomatic_log.h"
 #include <wx/wx.h>
 #include <wx/notebook.h>
 #include <wx/listctrl.h>
@@ -59,8 +60,6 @@ using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
 using boost::optional;
 
-#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-
 ContentPanel::ContentPanel (wxNotebook* n, shared_ptr<Film> film, weak_ptr<FilmViewer> viewer)
        : _video_panel (0)
        , _audio_panel (0)
index 2d489b3e82ec9465acc6c9b336cdb3da986afba5..66b919a7588d72aaa2f55444860bc8fedc6aaad7 100644 (file)
@@ -193,7 +193,7 @@ FilmViewer::recreate_butler ()
                map.set (dcp::RS,     1, 1 / sqrt(2)); // Rs -> Rt
        }
 
-       _butler.reset (new Butler(_player, _film->log(), map, _audio_channels, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
+       _butler.reset (new Butler(_player, map, _audio_channels, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
        if (!Config::instance()->sound() && !_audio.isStreamOpen()) {
                _butler->disable_audio ();
        }
index 45dc2b477b04b143d6b09c1ad4529456a649fcaa..abb28c22876e441ea549eb3ea1c2c3c671fda7b9 100644 (file)
@@ -153,7 +153,7 @@ KDMDialog::make_clicked ()
                return;
        }
 
-       pair<shared_ptr<Job>, int> result = _output->make (screen_kdms, film->name(), _timing, bind (&KDMDialog::confirm_overwrite, this, _1), film->log());
+       pair<shared_ptr<Job>, int> result = _output->make (screen_kdms, film->name(), _timing, bind (&KDMDialog::confirm_overwrite, this, _1));
        if (result.first) {
                JobManager::instance()->add (result.first);
        }
index 07bbce2d2510995ce7da460c6bc14910dcf9fcbc..694957ee8444e5a4aedfc2eeaf32b6e3573c80d6 100644 (file)
@@ -179,7 +179,7 @@ KDMOutputPanel::kdm_write_type_changed ()
 
 pair<shared_ptr<Job>, int>
 KDMOutputPanel::make (
-       list<ScreenKDM> screen_kdms, string name, KDMTimingPanel* timing, function<bool (boost::filesystem::path)> confirm_overwrite, shared_ptr<Log> log
+       list<ScreenKDM> screen_kdms, string name, KDMTimingPanel* timing, function<bool (boost::filesystem::path)> confirm_overwrite
        )
 {
        list<CinemaKDMs> const cinema_kdms = CinemaKDMs::collect (screen_kdms);
@@ -278,8 +278,7 @@ KDMOutputPanel::make (
                                        _container_name_format->get(),
                                        _filename_format->get(),
                                        name_values,
-                                       name,
-                                       log
+                                       name
                                        )
                                );
                }
index ba947b7149067970bb80f412ded37c37835c0ea5..ed162e0535bc19d32f78978206495ef7519478e5 100644 (file)
@@ -52,8 +52,7 @@ public:
                std::list<ScreenKDM> screen_kdms,
                std::string name,
                KDMTimingPanel* timing,
-               boost::function<bool (boost::filesystem::path)> confirm_overwrite,
-               boost::shared_ptr<Log> log
+               boost::function<bool (boost::filesystem::path)> confirm_overwrite
                );
 
 private:
index a453bd85858c32456d0f35cb5b47ec3be4c4f7e8..93e141c42ff199fc74970063cc53d3f53edba725 100644 (file)
@@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE (butler_test1)
                map.set (i, i, 1);
        }
 
-       Butler butler (shared_ptr<Player>(new Player(film, film->playlist())), film->log(), map, 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, false);
+       Butler butler (shared_ptr<Player>(new Player(film, film->playlist())), map, 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, false);
 
        BOOST_CHECK (butler.get_video().second == DCPTime());
        BOOST_CHECK (butler.get_video().second == DCPTime::from_frames(1, 24));
index 3ab1c36e177bdfde558264202e9405dcbf8d3285..10286c72a256b63c9a78829f0f8f3cab8c2d60b6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -36,6 +36,7 @@
 #include "lib/j2k_image_proxy.h"
 #include "lib/encode_server_description.h"
 #include "lib/file_log.h"
+#include "lib/dcpomatic_log.h"
 #include <boost/test/unit_test.hpp>
 #include <boost/thread.hpp>
 
@@ -84,7 +85,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
                p += sub_image->stride()[0];
        }
 
-       shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_rgb.log"));
+       dcpomatic_log.reset (new FileLog("build/test/client_server_test_rgb.log"));
 
        shared_ptr<PlayerVideo> pvf (
                new PlayerVideo (
@@ -109,14 +110,13 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
                        0,
                        24,
                        200000000,
-                       RESOLUTION_2K,
-                       log
+                       RESOLUTION_2K
                        )
                );
 
-       Data locally_encoded = frame->encode_locally (boost::bind (&Log::dcp_log, log.get(), _1, _2));
+       Data locally_encoded = frame->encode_locally ();
 
-       EncodeServer* server = new EncodeServer (log, true, 2);
+       EncodeServer* server = new EncodeServer (true, 2);
 
        thread* server_thread = new thread (boost::bind (&EncodeServer::run, server));
 
@@ -169,7 +169,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
                p += sub_image->stride()[0];
        }
 
-       shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_yuv.log"));
+       dcpomatic_log.reset (new FileLog("build/test/client_server_test_yuv.log"));
 
        shared_ptr<PlayerVideo> pvf (
                new PlayerVideo (
@@ -194,14 +194,13 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
                        0,
                        24,
                        200000000,
-                       RESOLUTION_2K,
-                       log
+                       RESOLUTION_2K
                        )
                );
 
-       Data locally_encoded = frame->encode_locally (boost::bind (&Log::dcp_log, log.get(), _1, _2));
+       Data locally_encoded = frame->encode_locally ();
 
-       EncodeServer* server = new EncodeServer (log, true, 2);
+       EncodeServer* server = new EncodeServer (true, 2);
 
        thread* server_thread = new thread (boost::bind (&EncodeServer::run, server));
 
@@ -241,7 +240,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
                }
        }
 
-       shared_ptr<FileLog> log (new FileLog ("build/test/client_server_test_j2k.log"));
+       dcpomatic_log.reset (new FileLog("build/test/client_server_test_j2k.log"));
 
        shared_ptr<PlayerVideo> raw_pvf (
                new PlayerVideo (
@@ -264,12 +263,11 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
                        0,
                        24,
                        200000000,
-                       RESOLUTION_2K,
-                       log
+                       RESOLUTION_2K
                        )
                );
 
-       Data raw_locally_encoded = raw_frame->encode_locally (boost::bind (&Log::dcp_log, log.get(), _1, _2));
+       Data raw_locally_encoded = raw_frame->encode_locally ();
 
        shared_ptr<PlayerVideo> j2k_pvf (
                new PlayerVideo (
@@ -292,14 +290,13 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
                        0,
                        24,
                        200000000,
-                       RESOLUTION_2K,
-                       log
+                       RESOLUTION_2K
                        )
                );
 
-       Data j2k_locally_encoded = j2k_frame->encode_locally (boost::bind (&Log::dcp_log, log.get(), _1, _2));
+       Data j2k_locally_encoded = j2k_frame->encode_locally ();
 
-       EncodeServer* server = new EncodeServer (log, true, 2);
+       EncodeServer* server = new EncodeServer (true, 2);
 
        thread* server_thread = new thread (boost::bind (&EncodeServer::run, server));
 
index 4bb4d5a5dd67151d8841a4a930a8367b2e1a2cb0..afefbac589d4916381eb5997b2934fec2630f657 100644 (file)
@@ -40,7 +40,6 @@ BOOST_AUTO_TEST_CASE (dcp_playback_test)
        shared_ptr<Butler> butler (
                new Butler(
                        shared_ptr<Player>(new Player(film, film->playlist())),
-                       shared_ptr<Log>(),
                        AudioMapping(6, 6),
                        6,
                        bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24),
index 2ebcec4bfcb808b5858fb4dbc6ed3a0b0a4e4c40..7e2631cc98da0337f445ff27565eeec031c5bb28 100644 (file)
@@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test)
        player->set_always_burn_open_subtitles ();
        player->set_play_referenced ();
 
-       shared_ptr<Butler> butler (new Butler (player, film->log(), AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
+       shared_ptr<Butler> butler (new Butler (player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
        butler->disable_audio();
 
        for (int i = 0; i < 10; ++i) {
@@ -243,7 +243,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test2)
        player->set_always_burn_open_subtitles ();
        player->set_play_referenced ();
 
-       shared_ptr<Butler> butler (new Butler(player, film->log(), AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
+       shared_ptr<Butler> butler (new Butler(player, AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
        butler->disable_audio();
 
        butler->seek(DCPTime::from_seconds(5), true);