Tidy and fix logging. no-film-in-content
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 95b3a13..440510c 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 4099630..94230d0 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 b1debfc..4f4e508 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 aaeb0d9..f5d9aef 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 9d4887f..566b947 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 30f0254..f123061 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 75205dc..61b150a 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 f1af033..cd03723 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 1bf15ca..f506d5c 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 3110f93..b455e7f 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 31d1661..6f32b66 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 32cd1a1..81ddc44 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 2603732..9902c8e 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 00a1b6b..c9bd557 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 68496f9..31279ac 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 3bd08e8..53829c5 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 fcadc91..34a6e14 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 fbc0ee4..3d9e965 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 8bb9b5e..07b6919 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 5356c5c..79539ac 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 804022f..2c67bb5 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 63826e2..8b9d0b6 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 4d6b3d7..60b80d0 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 f92f231..94728d6 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 7539a50..dde8cce 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 8f7794a..e3ffd1c 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 636de6a..65d0229 100644 (file)
@@ -66,6 +66,4 @@ private:
        boost::signals2::scoped_connection _config_connection;
 };
 
-extern boost::shared_ptr<Log> dcpomatic_log;
-
 #endif
index 5a71c13..ae16290 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 9a600a7..350120d 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 eff77ce..38484b9 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 88de1e9..b4e007e 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 420f5a8..15711a7 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 4726c73..cbcb8df 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 15445a6..9329778 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 893c009..c31ae2a 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 88cec75..7c332e8 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 1a87a28..bd0c40e 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 779e0ad..5535e62 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 e901d2d..2af57e3 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 7028624..d00129a 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 2b22aca..64bbb30 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 6dca806..d1bee2d 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 3d16038..1dc6fa6 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 93b270f..89690a5 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 2d489b3..66b919a 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 45dc2b4..abb28c2 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 07bbce2..694957e 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 ba947b7..ed162e0 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 a453bd8..93e141c 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 3ab1c36..10286c7 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 4bb4d5a..afefbac 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 2ebcec4..7e2631c 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);