Tidy and fix logging.
[dcpomatic.git] / src / lib / film.cc
index 426c7f81ddeb30bb0b90b4a26db8e6edacf8c5d6..60b80d052689de056619a2dc8b967fba4f46f66b 100644 (file)
@@ -32,6 +32,7 @@
 #include "upload_job.h"
 #include "null_log.h"
 #include "file_log.h"
+#include "dcpomatic_log.h"
 #include "exceptions.h"
 #include "examine_content_job.h"
 #include "config.h"
@@ -98,9 +99,6 @@ using boost::optional;
 using boost::is_any_of;
 using dcp::raw_convert;
 
-#define LOG_GENERAL(...) log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
-#define LOG_GENERAL_NC(...) log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
-
 string const Film::metadata_file = "metadata.xml";
 
 /* 5 -> 6
@@ -975,7 +973,7 @@ Film::signal_change (ChangeType type, Property p)
                        /* We want to call Playlist::maybe_sequence but this must happen after the
                           main signal emission (since the butler will see that emission and un-suspend itself).
                        */
-                       emit (boost::bind(&Playlist::maybe_sequence, _playlist.get()));
+                       emit (boost::bind(&Playlist::maybe_sequence, _playlist.get(), shared_from_this()));
                }
        } else {
                Change (type, p);
@@ -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));
@@ -1116,7 +1114,7 @@ Film::maybe_add_content (weak_ptr<Job> j, weak_ptr<Content> c, bool disable_audi
 
        if (Config::instance()->automatic_audio_analysis() && content->audio && !disable_audio_analysis) {
                shared_ptr<Playlist> playlist (new Playlist);
-               playlist->add (content);
+               playlist->add (shared_from_this(), content);
                boost::signals2::connection c;
                JobManager::instance()->analyse_audio (
                        shared_from_this(), playlist, false, c, bind (&Film::audio_analysis_finished, this)
@@ -1130,9 +1128,9 @@ Film::add_content (shared_ptr<Content> c)
 {
        /* Add {video,subtitle} content after any existing {video,subtitle} content */
        if (c->video) {
-               c->set_position (_playlist->video_end());
+               c->set_position (shared_from_this(), _playlist->video_end(shared_from_this()));
        } else if (!c->text.empty()) {
-               c->set_position (_playlist->text_end());
+               c->set_position (shared_from_this(), _playlist->text_end(shared_from_this()));
        }
 
        if (_template_film) {
@@ -1142,7 +1140,7 @@ Film::add_content (shared_ptr<Content> c)
                }
        }
 
-       _playlist->add (c);
+       _playlist->add (shared_from_this(), c);
 }
 
 void
@@ -1154,20 +1152,20 @@ Film::remove_content (shared_ptr<Content> c)
 void
 Film::move_content_earlier (shared_ptr<Content> c)
 {
-       _playlist->move_earlier (c);
+       _playlist->move_earlier (shared_from_this(), c);
 }
 
 void
 Film::move_content_later (shared_ptr<Content> c)
 {
-       _playlist->move_later (c);
+       _playlist->move_later (shared_from_this(), c);
 }
 
 /** @return length of the film from time 0 to the last thing on the playlist */
 DCPTime
 Film::length () const
 {
-       return _playlist->length().ceil(video_frame_rate());
+       return _playlist->length(shared_from_this()).ceil(video_frame_rate());
 }
 
 int
@@ -1379,7 +1377,7 @@ Film::make_kdms (
 uint64_t
 Film::required_disk_space () const
 {
-       return _playlist->required_disk_space (j2k_bandwidth(), audio_channels(), audio_frame_rate());
+       return _playlist->required_disk_space (shared_from_this(), j2k_bandwidth(), audio_channels(), audio_frame_rate());
 }
 
 /** This method checks the disk that the Film is on and tries to decide whether or not
@@ -1513,7 +1511,7 @@ Film::audio_output_names () const
 void
 Film::repeat_content (ContentList c, int n)
 {
-       _playlist->repeat (c, n);
+       _playlist->repeat (shared_from_this(), c, n);
 }
 
 void
@@ -1554,7 +1552,7 @@ Film::reels () const
                        }
                }
 
-               DCPTime video_end = last_video ? last_video->end() : DCPTime(0);
+               DCPTime video_end = last_video ? last_video->end(shared_from_this()) : DCPTime(0);
                if (last_split) {
                        /* Definitely go from the last split to the end of the video content */
                        p.push_back (DCPTimePeriod (last_split.get(), video_end));
@@ -1589,7 +1587,7 @@ Film::reels () const
 string
 Film::content_summary (DCPTimePeriod period) const
 {
-       return _playlist->content_summary (period);
+       return _playlist->content_summary (shared_from_this(), period);
 }
 
 void