From ad1ef39eda58b3a919ea3b7084401a0439409ec6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 21 Nov 2018 23:17:00 +0000 Subject: [PATCH] Tidy and fix logging. --- src/lib/audio_decoder.cc | 3 +-- src/lib/butler.cc | 24 ++++++--------------- src/lib/butler.h | 3 --- src/lib/cinema_kdms.cc | 25 +++++++++------------- src/lib/cinema_kdms.h | 3 +-- src/lib/content_factory.cc | 3 +-- src/lib/cross.cc | 7 ++----- src/lib/cross.h | 2 +- src/lib/dcp.cc | 3 +-- src/lib/dcp_content.cc | 3 +-- src/lib/dcp_video.cc | 16 +++++--------- src/lib/dcp_video.h | 8 +++---- src/lib/encode_server.cc | 15 +++++-------- src/lib/encode_server.h | 3 +-- src/lib/environment_info.cc | 3 --- src/lib/ffmpeg.cc | 13 ++++-------- src/lib/ffmpeg_content.cc | 2 -- src/lib/ffmpeg_decoder.cc | 5 +---- src/lib/ffmpeg_encoder.cc | 10 ++++----- src/lib/ffmpeg_encoder.h | 1 - src/lib/ffmpeg_file_encoder.cc | 2 -- src/lib/ffmpeg_file_encoder.h | 2 -- src/lib/film.cc | 6 ++---- src/lib/j2k_encoder.cc | 18 ++++++---------- src/lib/job.cc | 4 +--- src/lib/log.cc | 2 -- src/lib/log.h | 2 -- src/lib/player.cc | 2 -- src/lib/reel_writer.cc | 6 +----- src/lib/send_kdm_email_job.cc | 7 ++----- src/lib/send_kdm_email_job.h | 4 +--- src/lib/transcode_job.cc | 5 +---- src/lib/upload_job.cc | 3 +-- src/lib/video_content.cc | 3 +-- src/lib/writer.cc | 9 +------- src/lib/wscript | 1 + src/tools/dcpomatic.cc | 2 ++ src/tools/dcpomatic_cli.cc | 3 +++ src/tools/dcpomatic_kdm.cc | 2 +- src/tools/dcpomatic_player.cc | 1 + src/tools/dcpomatic_server.cc | 4 +++- src/tools/dcpomatic_server_cli.cc | 8 +++---- src/tools/server_test.cc | 7 +++---- src/wx/content_panel.cc | 3 +-- src/wx/film_viewer.cc | 2 +- src/wx/kdm_dialog.cc | 2 +- src/wx/kdm_output_panel.cc | 5 ++--- src/wx/kdm_output_panel.h | 3 +-- test/butler_test.cc | 2 +- test/client_server_test.cc | 35 ++++++++++++++----------------- test/dcp_playback_test.cc | 1 - test/player_test.cc | 4 ++-- 52 files changed, 106 insertions(+), 206 deletions(-) diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index 95b3a130d..440510ce5 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -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; diff --git a/src/lib/butler.cc b/src/lib/butler.cc index 409963016..94230d094 100644 --- a/src/lib/butler.cc +++ b/src/lib/butler.cc @@ -22,15 +22,13 @@ #include "player.h" #include "util.h" #include "log.h" +#include "dcpomatic_log.h" #include "cross.h" #include "compose.hpp" #include "exceptions.h" #include #include -#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, - shared_ptr log, AudioMapping audio_mapping, int audio_channels, function 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 weak_video) const shared_ptr 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()); } } diff --git a/src/lib/butler.h b/src/lib/butler.h index b1debfca2..4f4e50884 100644 --- a/src/lib/butler.h +++ b/src/lib/butler.h @@ -32,14 +32,12 @@ class Player; class PlayerVideo; -class Log; class Butler : public ExceptionStore, public boost::noncopyable { public: Butler ( boost::shared_ptr player, - boost::shared_ptr log, AudioMapping map, int audio_channels, boost::function pixel_format, @@ -75,7 +73,6 @@ private: void seek_unlocked (DCPTime position, bool accurate); boost::shared_ptr _player; - boost::shared_ptr _log; boost::thread* _thread; /** mutex to protect _video, _audio and _closed_caption for when we are clearing them and they all need to be diff --git a/src/lib/cinema_kdms.cc b/src/lib/cinema_kdms.cc index aaeb0d905..f5d9aef41 100644 --- a/src/lib/cinema_kdms.cc +++ b/src/lib/cinema_kdms.cc @@ -27,6 +27,7 @@ #include "emailer.h" #include "compose.hpp" #include "log.h" +#include "dcpomatic_log.h" #include #include @@ -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 + 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); } } diff --git a/src/lib/cinema_kdms.h b/src/lib/cinema_kdms.h index 9d4887f5a..566b947a2 100644 --- a/src/lib/cinema_kdms.h +++ b/src/lib/cinema_kdms.h @@ -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 + std::string cpl_name ); boost::shared_ptr cinema; diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index 30f02546c..f123061b7 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -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 @@ -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. diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 75205dc1a..61b150a3b 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -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) +run_ffprobe (boost::filesystem::path content, boost::filesystem::path out) { #ifdef DCPOMATIC_WINDOWS SECURITY_ATTRIBUTES security; diff --git a/src/lib/cross.h b/src/lib/cross.h index f1af03346..cd0372338 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -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); +extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path); extern std::list > mount_info (); extern boost::filesystem::path openssl_path (); #ifdef DCPOMATIC_OSX diff --git a/src/lib/dcp.cc b/src/lib/dcp.cc index 1bf15ca24..f506d5c70 100644 --- a/src/lib/dcp.cc +++ b/src/lib/dcp.cc @@ -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 @@ -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 > DCP::cpls () const diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 3110f93ad..b455e7f7f 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -29,6 +29,7 @@ #include "compose.hpp" #include "dcp_decoder.h" #include "log.h" +#include "dcpomatic_log.h" #include "text_content.h" #include #include @@ -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) diff --git a/src/lib/dcp_video.cc b/src/lib/dcp_video.cc index 31d166194..6f32b6686 100644 --- a/src/lib/dcp_video.cc +++ b/src/lib/dcp_video.cc @@ -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" @@ -50,10 +51,6 @@ #include #include -#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 frame, int index, int dcp_fps, int bw, Resolution r, shared_ptr l + shared_ptr 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 frame, shared_ptr node, shared_ptr log) +DCPVideo::DCPVideo (shared_ptr frame, shared_ptr node) : _frame (frame) - , _log (log) { _index = node->number_child ("Index"); _frames_per_second = node->number_child ("FramesPerSecond"); @@ -119,10 +113,10 @@ DCPVideo::convert_to_xyz (shared_ptr 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, diff --git a/src/lib/dcp_video.h b/src/lib/dcp_video.h index 32cd1a169..81ddc4470 100644 --- a/src/lib/dcp_video.h +++ b/src/lib/dcp_video.h @@ -42,10 +42,10 @@ class PlayerVideo; class DCPVideo : public boost::noncopyable { public: - DCPVideo (boost::shared_ptr, int, int, int, Resolution, boost::shared_ptr); - DCPVideo (boost::shared_ptr, cxml::ConstNodePtr, boost::shared_ptr); + DCPVideo (boost::shared_ptr, int, int, int, Resolution); + DCPVideo (boost::shared_ptr, 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 }; diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc index 2603732c8..9902c8e84 100644 --- a/src/lib/encode_server.cc +++ b/src/lib/encode_server.cc @@ -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 @@ -50,11 +51,6 @@ #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, 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, struct timeval& after_read, st shared_ptr 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 (); diff --git a/src/lib/encode_server.h b/src/lib/encode_server.h index 00a1b6b12..c9bd55718 100644 --- a/src/lib/encode_server.h +++ b/src/lib/encode_server.h @@ -42,7 +42,7 @@ class Log; class EncodeServer : public Server, public ExceptionStore { public: - EncodeServer (boost::shared_ptr log, bool verbose, int num_threads); + EncodeServer (bool verbose, int num_threads); ~EncodeServer (); void run (); @@ -58,7 +58,6 @@ private: std::list > _queue; boost::condition _full_condition; boost::condition _empty_condition; - boost::shared_ptr _log; bool _verbose; int _num_threads; diff --git a/src/lib/environment_info.cc b/src/lib/environment_info.cc index 68496f996..31279acfb 100644 --- a/src/lib/environment_info.cc +++ b/src/lib/environment_info.cc @@ -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; diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index 3bd08e84a..53829c5f2 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -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 FFmpeg::_ffmpeg_log; FFmpeg::FFmpeg (boost::shared_ptr 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 = _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 diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index fcadc9116..34a6e1444 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -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; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index fbc0ee416..3d9e965a9 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -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; diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index 8bb9b5e45..07b691956 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -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, 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( - 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( - 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( - 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)) ); } } diff --git a/src/lib/ffmpeg_encoder.h b/src/lib/ffmpeg_encoder.h index 5356c5ce2..79539acce 100644 --- a/src/lib/ffmpeg_encoder.h +++ b/src/lib/ffmpeg_encoder.h @@ -59,7 +59,6 @@ private: int video_frame_rate, int audio_frame_rate, int channels, - boost::shared_ptr log, ExportFormat, int x264_crf, bool three_d, diff --git a/src/lib/ffmpeg_file_encoder.cc b/src/lib/ffmpeg_file_encoder.cc index 804022f0b..2c67bb5f9 100644 --- a/src/lib/ffmpeg_file_encoder.cc +++ b/src/lib/ffmpeg_file_encoder.cc @@ -47,7 +47,6 @@ FFmpegFileEncoder::FFmpegFileEncoder ( int video_frame_rate, int audio_frame_rate, int channels, - shared_ptr 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); diff --git a/src/lib/ffmpeg_file_encoder.h b/src/lib/ffmpeg_file_encoder.h index 63826e2d5..8b9d0b67c 100644 --- a/src/lib/ffmpeg_file_encoder.h +++ b/src/lib/ffmpeg_file_encoder.h @@ -38,7 +38,6 @@ public: int video_frame_rate, int audio_frame_rate, int channels, - boost::shared_ptr 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; boost::shared_ptr _pending_audio; diff --git a/src/lib/film.cc b/src/lib/film.cc index 4d6b3d7e3..60b80d052 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -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, bool disable_audio_analysis) { if (dynamic_pointer_cast (content) && _directory) { - run_ffprobe (content->path(0), file ("ffprobe.log"), _log); + run_ffprobe (content->path(0), file("ffprobe.log")); } shared_ptr j (new ExamineContentJob (shared_from_this(), content)); diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index f92f23168..94728d6a9 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -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" @@ -41,12 +42,6 @@ #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 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 */ diff --git a/src/lib/job.cc b/src/lib/job.cc index 7539a5070..dde8cce62 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -28,6 +28,7 @@ #include "exceptions.h" #include "film.h" #include "log.h" +#include "dcpomatic_log.h" #include "compose.hpp" #include #include @@ -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 film) : _film (film) diff --git a/src/lib/log.cc b/src/lib/log.cc index 8f7794aed..e3ffd1cad 100644 --- a/src/lib/log.cc +++ b/src/lib/log.cc @@ -35,8 +35,6 @@ using std::string; using std::cout; using boost::shared_ptr; -boost::shared_ptr dcpomatic_log; - Log::Log () : _types (0) { diff --git a/src/lib/log.h b/src/lib/log.h index 636de6a58..65d0229e9 100644 --- a/src/lib/log.h +++ b/src/lib/log.h @@ -66,6 +66,4 @@ private: boost::signals2::scoped_connection _config_connection; }; -extern boost::shared_ptr dcpomatic_log; - #endif diff --git a/src/lib/player.cc b/src/lib/player.cc index 5a71c1330..ae16290f5 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -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; diff --git a/src/lib/reel_writer.cc b/src/lib/reel_writer.cc index 9a600a739..350120d9d 100644 --- a/src/lib/reel_writer.cc +++ b/src/lib/reel_writer.cc @@ -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" @@ -49,11 +50,6 @@ #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; diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc index eff77ce43..38484b91e 100644 --- a/src/lib/send_kdm_email_job.cc +++ b/src/lib/send_kdm_email_job.cc @@ -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 cinema_kdms, dcp::NameFormat container_name_format, dcp::NameFormat filename_format, dcp::NameFormat::Map name_values, - string cpl_name, - shared_ptr log + string cpl_name ) : Job (shared_ptr()) , _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); } diff --git a/src/lib/send_kdm_email_job.h b/src/lib/send_kdm_email_job.h index 88de1e9fe..b4e007e3b 100644 --- a/src/lib/send_kdm_email_job.h +++ b/src/lib/send_kdm_email_job.h @@ -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 + std::string cpl_name ); std::string name () const; @@ -49,5 +48,4 @@ private: dcp::NameFormat::Map _name_values; std::string _cpl_name; std::list _cinema_kdms; - boost::shared_ptr _log; }; diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index 420f5a8d2..15711a796 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -29,16 +29,13 @@ #include "film.h" #include "encoder.h" #include "log.h" +#include "dcpomatic_log.h" #include "compose.hpp" #include #include #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; diff --git a/src/lib/upload_job.cc b/src/lib/upload_job.cc index 4726c734a..cbcb8dfc6 100644 --- a/src/lib/upload_job.cc +++ b/src/lib/upload_job.cc @@ -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; diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 15445a68a..932977858 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -30,6 +30,7 @@ #include "exceptions.h" #include "frame_rate_change.h" #include "log.h" +#include "dcpomatic_log.h" #include #include #include @@ -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; diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 893c009cd..c31ae2a91 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -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" @@ -44,14 +45,6 @@ #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 diff --git a/src/lib/wscript b/src/lib/wscript index 88cec75ec..7c332e88d 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -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 diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 1a87a2872..bd0c40e88 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -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 #include #include @@ -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) diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index 779e0ad26..5535e6218 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -33,6 +33,7 @@ #include "lib/ratio.h" #include "lib/video_content.h" #include "lib/audio_content.h" +#include "lib/dcpomatic_log.h" #include #include #include @@ -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 paths = (*i)->paths (); diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index e901d2d0c..2af57e369 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -340,7 +340,7 @@ private: } pair, int> result = _output->make ( - screen_kdms, decrypted.content_title_text(), _timing, bind (&DOMFrame::confirm_overwrite, this, _1), shared_ptr () + screen_kdms, decrypted.content_title_text(), _timing, bind (&DOMFrame::confirm_overwrite, this, _1) ); if (result.first) { diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 7028624a8..d00129a4c 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -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 #include #include diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index 2b22aca7d..64bbb3049 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -27,6 +27,7 @@ #include "lib/log.h" #include "lib/signaller.h" #include "lib/cross.h" +#include "lib/dcpomatic_log.h" #include #include #include @@ -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 (); diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index 6dca8064c..d1bee2dcc 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -28,6 +28,7 @@ #include "lib/null_log.h" #include "lib/version.h" #include "lib/encode_server.h" +#include "lib/dcpomatic_log.h" #include #include #include @@ -104,14 +105,11 @@ main (int argc, char* argv[]) } } - shared_ptr 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 (); diff --git a/src/tools/server_test.cc b/src/tools/server_test.cc index 3d16038c1..1dc6fa6ca 100644 --- a/src/tools/server_test.cc +++ b/src/tools/server_test.cc @@ -47,21 +47,20 @@ using dcp::Data; static shared_ptr film; static EncodeServerDescription* server; -static shared_ptr log_ (new FileLog ("servomatictest.log")); static int frame_count = 0; void process_video (shared_ptr pvf) { - shared_ptr local (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); - shared_ptr remote (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K, log_)); + shared_ptr local (new DCPVideo (pvf, frame_count, film->video_frame_rate(), 250000000, RESOLUTION_2K)); + shared_ptr 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; diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 93b270faa..89690a5d0 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -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 #include #include @@ -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, weak_ptr viewer) : _video_panel (0) , _audio_panel (0) diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 2d489b3e8..66b919a75 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -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 (); } diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 45dc2b477..abb28c228 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -153,7 +153,7 @@ KDMDialog::make_clicked () return; } - pair, int> result = _output->make (screen_kdms, film->name(), _timing, bind (&KDMDialog::confirm_overwrite, this, _1), film->log()); + pair, int> result = _output->make (screen_kdms, film->name(), _timing, bind (&KDMDialog::confirm_overwrite, this, _1)); if (result.first) { JobManager::instance()->add (result.first); } diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc index 07bbce2d2..694957ee8 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -179,7 +179,7 @@ KDMOutputPanel::kdm_write_type_changed () pair, int> KDMOutputPanel::make ( - list screen_kdms, string name, KDMTimingPanel* timing, function confirm_overwrite, shared_ptr log + list screen_kdms, string name, KDMTimingPanel* timing, function confirm_overwrite ) { list 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 ) ); } diff --git a/src/wx/kdm_output_panel.h b/src/wx/kdm_output_panel.h index ba947b714..ed162e053 100644 --- a/src/wx/kdm_output_panel.h +++ b/src/wx/kdm_output_panel.h @@ -52,8 +52,7 @@ public: std::list screen_kdms, std::string name, KDMTimingPanel* timing, - boost::function confirm_overwrite, - boost::shared_ptr log + boost::function confirm_overwrite ); private: diff --git a/test/butler_test.cc b/test/butler_test.cc index a453bd858..93e141c42 100644 --- a/test/butler_test.cc +++ b/test/butler_test.cc @@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE (butler_test1) map.set (i, i, 1); } - Butler butler (shared_ptr(new Player(film, film->playlist())), film->log(), map, 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, false); + Butler butler (shared_ptr(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)); diff --git a/test/client_server_test.cc b/test/client_server_test.cc index 3ab1c36e1..10286c72a 100644 --- a/test/client_server_test.cc +++ b/test/client_server_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington 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 #include @@ -84,7 +85,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb) p += sub_image->stride()[0]; } - shared_ptr log (new FileLog ("build/test/client_server_test_rgb.log")); + dcpomatic_log.reset (new FileLog("build/test/client_server_test_rgb.log")); shared_ptr 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 log (new FileLog ("build/test/client_server_test_yuv.log")); + dcpomatic_log.reset (new FileLog("build/test/client_server_test_yuv.log")); shared_ptr 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 log (new FileLog ("build/test/client_server_test_j2k.log")); + dcpomatic_log.reset (new FileLog("build/test/client_server_test_j2k.log")); shared_ptr 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 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)); diff --git a/test/dcp_playback_test.cc b/test/dcp_playback_test.cc index 4bb4d5a5d..afefbac58 100644 --- a/test/dcp_playback_test.cc +++ b/test/dcp_playback_test.cc @@ -40,7 +40,6 @@ BOOST_AUTO_TEST_CASE (dcp_playback_test) shared_ptr butler ( new Butler( shared_ptr(new Player(film, film->playlist())), - shared_ptr(), AudioMapping(6, 6), 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), diff --git a/test/player_test.cc b/test/player_test.cc index 2ebcec4bf..7e2631cc9 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE (player_seek_test) player->set_always_burn_open_subtitles (); player->set_play_referenced (); - shared_ptr butler (new Butler (player, film->log(), AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true)); + shared_ptr 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 (new Butler(player, film->log(), AudioMapping(), 2, bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true)); + shared_ptr 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); -- 2.30.2