Calm down default logging a bit.
authorCarl Hetherington <cth@carlh.net>
Tue, 30 Jun 2015 09:58:22 +0000 (10:58 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 30 Jun 2015 09:58:22 +0000 (10:58 +0100)
src/lib/dcp_video.cc
src/lib/log.cc
src/lib/log.h
src/lib/writer.cc
src/wx/config_dialog.cc

index 3879947eb027ba38912f5fa255f27fd0e879a7dc..7610e6c9f43a5e1dda8643c8ad5f850ec5e1c67b 100644 (file)
@@ -59,6 +59,7 @@
 #include <errno.h>
 
 #define LOG_GENERAL(...) _log->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL);
+#define LOG_DEBUG_ENCODE(...) _log->log (String::compose (__VA_ARGS__), Log::TYPE_DEBUG_ENCODE);
 
 #include "i18n.h"
 
@@ -223,13 +224,13 @@ DCPVideo::encode_locally (dcp::NoteHandler note)
 
        switch (_frame->eyes()) {
        case EYES_BOTH:
-               LOG_GENERAL (N_("Finished locally-encoded frame %1 for mono"), _index);
+               LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for mono"), _index);
                break;
        case EYES_LEFT:
-               LOG_GENERAL (N_("Finished locally-encoded frame %1 for L"), _index);
+               LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for L"), _index);
                break;
        case EYES_RIGHT:
-               LOG_GENERAL (N_("Finished locally-encoded frame %1 for R"), _index);
+               LOG_DEBUG_ENCODE (N_("Finished locally-encoded frame %1 for R"), _index);
                break;
        default:
                break;
@@ -266,7 +267,7 @@ DCPVideo::encode_remotely (ServerDescription serv)
        root->add_child("Version")->add_child_text (raw_convert<string> (SERVER_LINK_VERSION));
        add_metadata (root);
 
-       LOG_GENERAL (N_("Sending frame %1 to remote"), _index);
+       LOG_DEBUG_ENCODE (N_("Sending frame %1 to remote"), _index);
 
        /* Send XML metadata */
        string xml = doc.write_to_string ("UTF-8");
@@ -282,7 +283,7 @@ DCPVideo::encode_remotely (ServerDescription serv)
        Data e (socket->read_uint32 ());
        socket->read (e.data().get(), e.size());
 
-       LOG_GENERAL (N_("Finished remotely-encoded frame %1"), _index);
+       LOG_DEBUG_ENCODE (N_("Finished remotely-encoded frame %1"), _index);
 
        return e;
 }
index d9696f3cce2ca31bacc89692cbedf7bd468b8880..ac3277c4e618a1e04f7049492e6299424b79b1ee 100644 (file)
@@ -36,7 +36,8 @@ int const Log::TYPE_GENERAL      = 0x1;
 int const Log::TYPE_WARNING      = 0x2;
 int const Log::TYPE_ERROR        = 0x4;
 int const Log::TYPE_DEBUG_DECODE = 0x8;
-int const Log::TYPE_TIMING       = 0x10;
+int const Log::TYPE_DEBUG_ENCODE = 0x10;
+int const Log::TYPE_TIMING       = 0x20;
 
 Log::Log ()
        : _types (0)
index 6803f8d59ce707bb87cdb3d8c9a01599e1149751..73a1aa582935a17939f606d4935be0c6881d763e 100644 (file)
@@ -43,6 +43,7 @@ public:
        static const int TYPE_WARNING;
        static const int TYPE_ERROR;
        static const int TYPE_DEBUG_DECODE;
+       static const int TYPE_DEBUG_ENCODE;
        static const int TYPE_TIMING;
 
        void log (std::string message, int type);
index 7099f51c2c995559fc6d1b78dbcb3559cf4ebb7b..e911c37201ab5204e97e827c2b88cda46a5ed5d7 100644 (file)
@@ -55,6 +55,7 @@
 #include "i18n.h"
 
 #define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_GENERAL);
+#define LOG_DEBUG_ENCODE(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_DEBUG_ENCODE);
 #define LOG_TIMING(...) _film->log()->microsecond_log (String::compose (__VA_ARGS__), Log::TYPE_TIMING);
 #define LOG_WARNING_NC(...) _film->log()->log (__VA_ARGS__, Log::TYPE_WARNING);
 #define LOG_WARNING(...) _film->log()->log (String::compose (__VA_ARGS__), Log::TYPE_WARNING);
@@ -361,7 +362,7 @@ try
                        switch (qi.type) {
                        case QueueItem::FULL:
                        {
-                               LOG_GENERAL (N_("Writer FULL-writes %1 (%2)"), qi.frame, qi.eyes);
+                               LOG_DEBUG_ENCODE (N_("Writer FULL-writes %1 (%2)"), qi.frame, qi.eyes);
                                if (!qi.encoded) {
                                        qi.encoded = Data (_film->j2c_path (qi.frame, qi.eyes, false));
                                }
@@ -373,13 +374,13 @@ try
                                break;
                        }
                        case QueueItem::FAKE:
-                               LOG_GENERAL (N_("Writer FAKE-writes %1"), qi.frame);
+                               LOG_DEBUG_ENCODE (N_("Writer FAKE-writes %1"), qi.frame);
                                _picture_asset_writer->fake_write (qi.size);
                                _last_written[qi.eyes].reset ();
                                ++_fake_written;
                                break;
                        case QueueItem::REPEAT:
-                               LOG_GENERAL (N_("Writer REPEAT-writes %1"), qi.frame);
+                               LOG_DEBUG_ENCODE (N_("Writer REPEAT-writes %1"), qi.frame);
                                dcp::FrameInfo fin = _picture_asset_writer->write (
                                        _last_written[qi.eyes]->data().get(),
                                        _last_written[qi.eyes]->size()
@@ -678,7 +679,7 @@ Writer::check_existing_picture_asset ()
                        }
                }
 
-               LOG_GENERAL ("Have existing frame %1", _first_nonexistant_frame);
+               LOG_DEBUG_ENCODE ("Have existing frame %1", _first_nonexistant_frame);
                ++_first_nonexistant_frame;
        }
 
index 0c1ea29e56709fcdb9fc4f4aab4254a3fc8bc8cb..34aaa779542a5b577e186b8ea655e19ebd77217d 100644 (file)
@@ -1119,6 +1119,7 @@ public:
                , _log_error (0)
                , _log_timing (0)
                , _log_debug_decode (0)
+               , _log_debug_encode (0)
        {}
 
 private:
@@ -1161,6 +1162,8 @@ private:
                        t->Add (_log_timing, 1, wxEXPAND | wxALL);
                        _log_debug_decode = new wxCheckBox (_panel, wxID_ANY, _("Debug: decode"));
                        t->Add (_log_debug_decode, 1, wxEXPAND | wxALL);
+                       _log_debug_encode = new wxCheckBox (_panel, wxID_ANY, _("Debug: encode"));
+                       t->Add (_log_debug_encode, 1, wxEXPAND | wxALL);
                        table->Add (t, 0, wxALL, 6);
                }
 
@@ -1178,6 +1181,7 @@ private:
                _log_error->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this));
                _log_timing->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this));
                _log_debug_decode->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this));
+               _log_debug_encode->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::log_changed, this));
 #ifdef DCPOMATIC_WINDOWS
                _win32_console->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&AdvancedPage::win32_console_changed, this));
 #endif
@@ -1194,6 +1198,7 @@ private:
                checked_set (_log_error, config->log_types() & Log::TYPE_ERROR);
                checked_set (_log_timing, config->log_types() & Log::TYPE_TIMING);
                checked_set (_log_debug_decode, config->log_types() & Log::TYPE_DEBUG_DECODE);
+               checked_set (_log_debug_encode, config->log_types() & Log::TYPE_DEBUG_ENCODE);
 #ifdef DCPOMATIC_WINDOWS
                checked_set (_win32_console, config->win32_console());
 #endif
@@ -1227,6 +1232,9 @@ private:
                if (_log_debug_decode->GetValue ()) {
                        types |= Log::TYPE_DEBUG_DECODE;
                }
+               if (_log_debug_encode->GetValue ()) {
+                       types |= Log::TYPE_DEBUG_ENCODE;
+               }
                Config::instance()->set_log_types (types);
        }
 
@@ -1244,6 +1252,7 @@ private:
        wxCheckBox* _log_error;
        wxCheckBox* _log_timing;
        wxCheckBox* _log_debug_decode;
+       wxCheckBox* _log_debug_encode;
 #ifdef DCPOMATIC_WINDOWS
        wxCheckBox* _win32_console;
 #endif